From fc24b06cf1405d15d44f5545178dfbcbe6abcc49 Mon Sep 17 00:00:00 2001 From: Radu Berinde Date: Sat, 27 Apr 2024 08:10:04 -0700 Subject: [PATCH] sstable: change an out-of-bounds error into an assertion We now panic in invariants mode. This might help debug #3556. --- sstable/value_block.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sstable/value_block.go b/sstable/value_block.go index ff8b05cf4f..884a584fbd 100644 --- a/sstable/value_block.go +++ b/sstable/value_block.go @@ -934,8 +934,8 @@ func (r *valueBlockReader) getBlockHandle(blockNum uint32) (BlockHandle, error) int(r.vbih.blockNumByteLength + r.vbih.blockOffsetByteLength + r.vbih.blockLengthByteLength) offsetInIndex := indexEntryLen * int(blockNum) if len(r.vbiBlock) < offsetInIndex+indexEntryLen { - return BlockHandle{}, errors.Errorf( - "cannot read at offset %d and length %d from block of length %d", + return BlockHandle{}, base.AssertionFailedf( + "index entry out of bounds: offset %d length %d block length %d", offsetInIndex, indexEntryLen, len(r.vbiBlock)) } b := r.vbiBlock[offsetInIndex : offsetInIndex+indexEntryLen]