Skip to content

Commit

Permalink
[dbnode] Register index.Query/Aggregate finalizers (#1567)
Browse files Browse the repository at this point in the history
  • Loading branch information
prateek authored Apr 18, 2019
1 parent 637dc24 commit 4c31000
Show file tree
Hide file tree
Showing 4 changed files with 1,223 additions and 248 deletions.
2 changes: 1 addition & 1 deletion src/dbnode/generated/mocks/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
//go:generate sh -c "mockgen -package=xio $PACKAGE/src/dbnode/x/xio SegmentReader,SegmentReaderPool | genclean -pkg $PACKAGE/src/dbnode/x/xio -out $GOPATH/src/$PACKAGE/src/dbnode/x/xio/io_mock.go"
//go:generate sh -c "mockgen -package=digest -destination=$GOPATH/src/$PACKAGE/src/dbnode/digest/digest_mock.go $PACKAGE/src/dbnode/digest ReaderWithDigest"
//go:generate sh -c "mockgen -package=series $PACKAGE/src/dbnode/storage/series DatabaseSeries,QueryableBlockRetriever | genclean -pkg $PACKAGE/src/dbnode/storage/series -out $GOPATH/src/$PACKAGE/src/dbnode/storage/series/series_mock.go"
//go:generate sh -c "mockgen -package=index $PACKAGE/src/dbnode/storage/index QueryResults,AggregateResults,Block,OnIndexSeries | genclean -pkg $PACKAGE/src/dbnode/storage/index -out $GOPATH/src/$PACKAGE/src/dbnode/storage/index/index_mock.go"

// mockgen rules for generating mocks for unexported interfaces (file mode)
//go:generate sh -c "mockgen -package=encoding -destination=$GOPATH/src/$PACKAGE/src/dbnode/encoding/encoding_mock.go -source=$GOPATH/src/$PACKAGE/src/dbnode/encoding/types.go"
Expand All @@ -41,5 +40,6 @@
//go:generate sh -c "mockgen -package=namespace -destination=$GOPATH/src/$PACKAGE/src/dbnode/storage/namespace/namespace_mock.go -source=$GOPATH/src/$PACKAGE/src/dbnode/storage/namespace/types.go"
//go:generate sh -c "mockgen -package=runtime -destination=$GOPATH/src/$PACKAGE/src/dbnode/runtime/runtime_mock.go -source=$GOPATH/src/$PACKAGE/src/dbnode/runtime/types.go"
//go:generate sh -c "mockgen -package=ts -destination=$GOPATH/src/$PACKAGE/src/dbnode/ts/write_batch_mock.go -source=$GOPATH/src/$PACKAGE/src/dbnode/ts/types.go"
//go:generate sh -c "mockgen -package=index -destination=$GOPATH/src/$PACKAGE/src/dbnode/storage/index/index_mock.go -source=$GOPATH/src/$PACKAGE/src/dbnode/storage/index/types.go"

package mocks
2 changes: 2 additions & 0 deletions src/dbnode/storage/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ func (i *nsIndex) Query(
results.Reset(i.nsMetadata.ID(), index.QueryResultsOptions{
SizeLimit: opts.Limit,
})
ctx.RegisterFinalizer(results)
exhaustive, err := i.query(ctx, query, results, opts)
if err != nil {
return index.QueryResult{}, err
Expand All @@ -890,6 +891,7 @@ func (i *nsIndex) AggregateQuery(
TermFilter: opts.TermFilter,
Type: opts.Type,
})
ctx.RegisterFinalizer(results)
exhaustive, err := i.query(ctx, query, results, opts.QueryOptions)
if err != nil {
return index.AggregateQueryResult{}, err
Expand Down
Loading

0 comments on commit 4c31000

Please sign in to comment.