Skip to content

Commit

Permalink
Revert "[dbnode] Remove allocation per series ID when streaming block…
Browse files Browse the repository at this point in the history
… from disk (#3093)"

This reverts commit 5b4f793.
  • Loading branch information
wesleyk committed Jan 18, 2021
1 parent e2b479c commit 452e651
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
6 changes: 2 additions & 4 deletions src/dbnode/network/server/tchannelthrift/node/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -808,14 +808,12 @@ func (s *service) fetchReadEncoded(ctx context.Context,
// Re-use reader and id for more memory-efficient processing of
// tags from doc.Metadata
reader := docs.NewEncodedDocumentReader()
id := ident.NewReusableBytesID()
for _, entry := range results.Map().Iter() {
idx := i
i++

// NB(r): Use a bytes ID here so that this ID doesn't need to be
// copied by the blockRetriever in the streamRequest method when
// it checks if the ID is finalizeable or not with IsNoFinalize.
id := ident.BytesID(entry.Key())
id.Reset(entry.Key())

d := entry.Value()
metadata, err := docs.MetadataFromDocument(d, reader)
Expand Down
14 changes: 3 additions & 11 deletions src/dbnode/persist/fs/retriever.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,17 +575,9 @@ func (r *blockRetriever) streamRequest(
return false, err
}
req.shard = shard

// NB(r): If the ID is a ident.BytesID then we can just hold
// onto this ID.
seriesID := id
if !seriesID.IsNoFinalize() {
// NB(r): Clone the ID as we're not positive it will stay valid throughout
// the lifecycle of the async request.
seriesID = r.idPool.Clone(id)
}

req.id = seriesID
// NB(r): Clone the ID as we're not positive it will stay valid throughout
// the lifecycle of the async request.
req.id = r.idPool.Clone(id)
req.start = startTime
req.blockSize = r.blockSize

Expand Down

0 comments on commit 452e651

Please sign in to comment.