Skip to content

Commit

Permalink
simplify seek index writer and CLI arg (#2742)
Browse files Browse the repository at this point in the history
This commit simplifies the seek index writer by moving the
logic for auto-stream-termination out of zngio and into
segment.Writer.  We also deleted the unused indexing code
in zngio along with the "zed index seek" command and related
support.

As previously agreed among the team, the streamax argument
to zed lake add and zed lake load was changed to seekstride
and the units changed from records to bytes.

Closes #2542
  • Loading branch information
mccanne authored May 20, 2021
1 parent 7f2de51 commit 58dbccc
Show file tree
Hide file tree
Showing 23 changed files with 130 additions and 769 deletions.
1 change: 0 additions & 1 deletion cli/outputflags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func (f *Flags) setFlags(fs *flag.FlagSet) {
fs.BoolVar(&f.Text.ShowTypes, "T", false, "display field types in text output")
fs.BoolVar(&f.Text.ShowFields, "F", false, "display field names in text output")
fs.BoolVar(&f.color, "color", true, "enable/disable color formatting for -Z and lake text output")
fs.IntVar(&f.Zng.StreamRecordsMax, "b", 0, "limit for number of records in each ZNG stream (0 for no limit)")
fs.IntVar(&f.Zng.LZ4BlockSize, "znglz4blocksize", zngio.DefaultLZ4BlockSize,
"LZ4 block size in bytes for ZNG compression (nonpositive to disable)")
fs.IntVar(&f.ZSON.Pretty, "pretty", 4,
Expand Down
134 changes: 0 additions & 134 deletions cmd/zed/index/seek/command.go

This file was deleted.

18 changes: 11 additions & 7 deletions cmd/zed/lake/add/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/brimdata/zed/pkg/charm"
"github.com/brimdata/zed/pkg/rlimit"
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/pkg/units"
"github.com/brimdata/zed/zbuf"
"github.com/brimdata/zed/zio"
"github.com/brimdata/zed/zson"
Expand Down Expand Up @@ -45,17 +46,20 @@ func init() {
// TBD: add option to apply Zed program on add path?

type Command struct {
lake *zedlake.Command
importStreamRecordMax int
commit bool
inputFlags inputflags.Flags
lake *zedlake.Command
seekStride units.Bytes
commit bool
inputFlags inputflags.Flags
zedlake.CommitFlags
}

func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error) {
c := &Command{lake: parent.(*zedlake.Command)}
c := &Command{
lake: parent.(*zedlake.Command),
seekStride: units.Bytes(lake.SeekIndexStride),
}
f.BoolVar(&c.commit, "commit", false, "commit added data if successfully written")
f.IntVar(&c.importStreamRecordMax, "streammax", lake.ImportStreamRecordsMax, "limit for number of records in each ZNG stream (0 for no limit)")
f.Var(&c.seekStride, "seekstride", "size of seek-index unit for ZNG data, as '32KB', '1MB', etc.")
c.inputFlags.SetFlags(f)
c.CommitFlags.SetFlags(f)
return c, nil
Expand All @@ -70,7 +74,7 @@ func (c *Command) Run(args []string) error {
if len(args) == 0 {
return errors.New("zed lake add: at least one input file must be specified (- for stdin)")
}
lake.ImportStreamRecordsMax = c.importStreamRecordMax
lake.SeekIndexStride = int(c.seekStride)
if _, err := rlimit.RaiseOpenFilesLimit(); err != nil {
return err
}
Expand Down
16 changes: 10 additions & 6 deletions cmd/zed/lake/load/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/brimdata/zed/pkg/charm"
"github.com/brimdata/zed/pkg/rlimit"
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/pkg/units"
"github.com/brimdata/zed/zbuf"
"github.com/brimdata/zed/zio"
"github.com/brimdata/zed/zson"
Expand All @@ -33,17 +34,20 @@ func init() {
}

type Command struct {
lake *zedlake.Command
importStreamRecordMax int
commit bool
lake *zedlake.Command
seekStride units.Bytes
commit bool
zedlake.CommitFlags
procFlags procflags.Flags
inputFlags inputflags.Flags
}

func New(parent charm.Command, f *flag.FlagSet) (charm.Command, error) {
c := &Command{lake: parent.(*zedlake.Command)}
f.IntVar(&c.importStreamRecordMax, "streammax", lake.ImportStreamRecordsMax, "limit for number of records in each ZNG stream (0 for no limit)")
c := &Command{
lake: parent.(*zedlake.Command),
seekStride: units.Bytes(lake.SeekIndexStride),
}
f.Var(&c.seekStride, "seekstride", "size of seek-index unit for ZNG data, as '32KB', '1MB', etc.")
c.CommitFlags.SetFlags(f)
c.inputFlags.SetFlags(f)
c.procFlags.SetFlags(f)
Expand All @@ -59,7 +63,7 @@ func (c *Command) Run(args []string) error {
if len(args) == 0 {
return errors.New("zed lake load: at least one input file must be specified (- for stdin)")
}
lake.ImportStreamRecordsMax = c.importStreamRecordMax
lake.SeekIndexStride = int(c.seekStride)
if _, err := rlimit.RaiseOpenFilesLimit(); err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion cmd/zed/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
_ "github.com/brimdata/zed/cmd/zed/index/create"
_ "github.com/brimdata/zed/cmd/zed/index/lookup"
_ "github.com/brimdata/zed/cmd/zed/index/section"
_ "github.com/brimdata/zed/cmd/zed/index/seek"
"github.com/brimdata/zed/cmd/zed/lake"
_ "github.com/brimdata/zed/cmd/zed/lake/add"
_ "github.com/brimdata/zed/cmd/zed/lake/commit"
Expand Down
25 changes: 0 additions & 25 deletions index/ztests/seek.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions index/ztests/tsindex.yaml

This file was deleted.

Loading

0 comments on commit 58dbccc

Please sign in to comment.