Skip to content

Commit

Permalink
Add more comments in BatchPreload
Browse files Browse the repository at this point in the history
  • Loading branch information
fxamacker committed May 13, 2024
1 parent a459d96 commit f521009
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -1561,12 +1561,16 @@ func (s *PersistentSlabStorage) getAllChildReferences(slab Slab) (
return references, brokenReferences, nil
}

// BatchPreload decodeds and caches slabs of given ids in parallel.
// This is useful for storage health or data validation in migration programs.
func (s *PersistentSlabStorage) BatchPreload(ids []SlabID, numWorkers int) error {
if len(ids) == 0 {
return nil
}

minCountForBatchPreload := 11
// Use 11 for min slab count for parallel decoding because micro benchmarks showed
// performance regression for <= 10 slabs when decoding slabs in parallel.
const minCountForBatchPreload = 11
if len(ids) < minCountForBatchPreload {

for _, id := range ids {
Expand Down

0 comments on commit f521009

Please sign in to comment.