Skip to content

Commit

Permalink
upgrade Zed to 427a57b70a954f990857c5190c44713b22d04ac8 (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwt authored Sep 16, 2024
1 parent fb918e2 commit 459f74a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 29 deletions.
18 changes: 5 additions & 13 deletions analyzer/combiner.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

// A Combiner is a zio.Reader that returns records by reading from multiple Readers.
type Combiner struct {
arena *zed.Arena // Owns the zed.Value returned by Read
cancel context.CancelFunc
ctx context.Context
done []bool
Expand All @@ -32,10 +31,9 @@ func NewCombiner(ctx context.Context, readers []zio.Reader) *Combiner {
}

type combinerResult struct {
err error
idx int
val *zed.Value
arena *zed.Arena
err error
idx int
val *zed.Value
}

func (c *Combiner) run() {
Expand All @@ -44,16 +42,14 @@ func (c *Combiner) run() {
go func() {
for {
rec, err := c.readers[idx].Read()
var arena *zed.Arena
if rec != nil {
arena = zed.NewArena()
// Make a copy since we don't wait for
// Combiner.Read's caller to finish with
// this value before we read the next.
rec = rec.Copy(arena).Ptr()
rec = rec.Copy().Ptr()
}
select {
case c.results <- combinerResult{err, idx, rec, arena}:
case c.results <- combinerResult{err, idx, rec}:
if rec == nil || err != nil {
return
}
Expand All @@ -79,10 +75,6 @@ func (c *Combiner) Read() (*zed.Value, error) {
return nil, r.err
}
if r.val != nil {
if c.arena != nil {
c.arena.Unref()
}
c.arena = r.arena
return r.val, nil
}
c.done[r.idx] = true
Expand Down
4 changes: 1 addition & 3 deletions cli/pcapsearchflags.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ func (f *PcapSearchFlags) SetFlags(fs *flag.FlagSet) {
f.duration = 1
return nil
}
arena := zed.NewArena()
defer arena.Unref()
val, err := zson.ParseValue(zed.NewContext(), arena, s)
val, err := zson.ParseValue(zed.NewContext(), s)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/brimdata/brimcap
go 1.21

require (
github.com/brimdata/zed v1.17.1-0.20240913153822-4290afdca76d
github.com/brimdata/zed v1.17.1-0.20240916171320-427a57b70a95
github.com/fsnotify/fsnotify v1.4.9
github.com/gopacket/gopacket v1.2.0
github.com/gosuri/uilive v0.0.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ github.com/axiomhq/hyperloglog v0.0.0-20191112132149-a4c4c47bc57f h1:y06x6vGnFYf
github.com/axiomhq/hyperloglog v0.0.0-20191112132149-a4c4c47bc57f/go.mod h1:2stgcRjl6QmW+gU2h5E7BQXg4HU0gzxKWDuT5HviN9s=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/brimdata/zed v1.17.1-0.20240913153822-4290afdca76d h1:AB7RmPV+mRmfWDK5F5oxvBbvrdJ/8N0KRTBxmGTr8wA=
github.com/brimdata/zed v1.17.1-0.20240913153822-4290afdca76d/go.mod h1:DsN4jhoF1EvqHhzMTSz1GJGltBMh2iQeV1/GVEeeso0=
github.com/brimdata/zed v1.17.1-0.20240916171320-427a57b70a95 h1:/T2gNKxt8boZg2vvm/NfNEE8BTMud4kg1JGaS649LZo=
github.com/brimdata/zed v1.17.1-0.20240916171320-427a57b70a95/go.mod h1:DsN4jhoF1EvqHhzMTSz1GJGltBMh2iQeV1/GVEeeso0=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
13 changes: 3 additions & 10 deletions ztail/ztail.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
// written log data are transformed into *zed.Values and returned on a
// first-come-first serve basis.
type Tailer struct {
arena *zed.Arena // Owns the zed.Value returned by Read
forceClose uint32
opts anyio.ReaderOpts
readers map[string]*tail.File
Expand Down Expand Up @@ -60,9 +59,8 @@ type nopWarner struct{}
func (nopWarner) Warn(_ string) error { return nil }

type result struct {
zv *zed.Value
arena *zed.Arena
err error
zv *zed.Value
err error
}

func (t *Tailer) start() {
Expand Down Expand Up @@ -152,10 +150,9 @@ func (t *Tailer) tailFile(file string) error {
if val == nil {
return
}
arena := zed.NewArena()
// Copy because we may read the next value before
// Tailer.Read's caller has finished with this one.
t.results <- result{val.Copy(arena).Ptr(), arena, nil}
t.results <- result{zv: val.Copy().Ptr()}
}
}()
return nil
Expand All @@ -173,10 +170,6 @@ func (t *Tailer) Read() (*zed.Value, error) {
for range t.results {
}
}
if t.arena != nil {
t.arena.Unref()
}
t.arena = res.arena
return res.zv, res.err
}

Expand Down

0 comments on commit 459f74a

Please sign in to comment.