Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ingestion: avoid redundant reallocation during streamBucketContents #5097

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ingest/checkpoint_change_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,15 +325,19 @@ func (r *CheckpointChangeReader) streamBucketContents(hash historyarchive.Hash,
var batch []xdr.BucketEntry
lastBatch := false

preloadKeys := make([]string, 0, preloadedEntries)

LoopBucketEntry:
for {
// Preload entries for faster retrieve from temp store.
if len(batch) == 0 {
if lastBatch {
return true
}
batch = make([]xdr.BucketEntry, 0, preloadedEntries)

preloadKeys := []string{}
// reset the content of the preloadKeys
preloadKeys = preloadKeys[:0]

for i := 0; i < preloadedEntries; i++ {
var entry xdr.BucketEntry
Expand Down
Loading