Skip to content

Commit f60436a

Browse files
committed
sstable: use correct blockkind for checksum validation of blob ref index
Previously, we were using a read function with `blockkind.Metadata` when we should have passed in the `readBlobRefIndexBlock` read function (the only difference here is the proper blockkind, `blockkind.BlobReferenceValueLivenessIndex`, is used)
1 parent 6debdd2 commit f60436a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

sstable/layout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ func (l *Layout) Describe(
370370
// We have already read the value-index to construct the list of
371371
// value-blocks, so no need to do it again.
372372
case "blob-reference-index":
373-
h, err = r.readBlobRefIndexBlock(ctx, block.NoReadEnv, noReadHandle)
373+
h, err = r.readBlobRefIndexBlock(ctx, block.NoReadEnv, noReadHandle, r.blobRefIndexBH)
374374
if err != nil {
375375
return err
376376
}

sstable/reader.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,13 +425,13 @@ func (r *Reader) readValueBlock(
425425
func (r *Reader) ReadBlobRefIndexBlock(
426426
ctx context.Context, env block.ReadEnv,
427427
) (block.BufferHandle, error) {
428-
return r.readBlobRefIndexBlock(ctx, env, noReadHandle)
428+
return r.readBlobRefIndexBlock(ctx, env, noReadHandle, r.blobRefIndexBH)
429429
}
430430

431431
func (r *Reader) readBlobRefIndexBlock(
432-
ctx context.Context, env block.ReadEnv, readHandle objstorage.ReadHandle,
432+
ctx context.Context, env block.ReadEnv, readHandle objstorage.ReadHandle, bh block.Handle,
433433
) (block.BufferHandle, error) {
434-
return r.blockReader.Read(ctx, env, readHandle, r.blobRefIndexBH, blockkind.BlobReferenceValueLivenessIndex, noInitBlockMetadataFn)
434+
return r.blockReader.Read(ctx, env, readHandle, bh, blockkind.BlobReferenceValueLivenessIndex, noInitBlockMetadataFn)
435435
}
436436

437437
// metaBufferPools is a sync pool of BufferPools used exclusively when opening a
@@ -756,7 +756,7 @@ func (r *Reader) ValidateBlockChecksums() error {
756756
})
757757
blocks = append(blocks, blk{
758758
bh: l.BlobReferenceIndex,
759-
readFn: readNoInit,
759+
readFn: r.readBlobRefIndexBlock,
760760
})
761761

762762
// Sorting by offset ensures we are performing a sequential scan of the

0 commit comments

Comments
 (0)