Skip to content

Commit 6bafc50

Browse files
benderrobertAskAlexSharovsudeepdino008
authored
db/state: reset reader on recsplit collision retry in SimpleAccessorBuilder (#20886)
Adds `iidq.reader.Reset(0)` at the top of the retry loop in `SimpleAccessorBuilder.Build`, matching `buildVI` (5c7fe1b) and `buildHashMapAccessor`. Without it, retry iterations start with an exhausted `PagedReader` and feed zero keys to recsplit, producing a corrupt accessor index for forkable snapshots (headers/bodies). --------- Co-authored-by: Alexey Sharov <AskAlexSharov@gmail.com> Co-authored-by: moskud <sudeepdino008@gmail.com>
1 parent fe92da2 commit 6bafc50

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

db/state/simple_accessor_builder.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type IndexInputDataQuery interface {
2424
GetStream(ctx context.Context) stream.Trio[[]byte, uint64, uint64] // (word/value, index, offset)
2525
GetBaseDataId() uint64
2626
GetCount() uint64
27+
Reset()
2728
Close()
2829
}
2930

@@ -192,6 +193,7 @@ func (s *SimpleAccessorBuilder) Build(ctx context.Context, decomp *seg.Decompres
192193

193194
defer iidq.reader.MadvNormal().DisableReadAhead()
194195
for {
196+
iidq.Reset()
195197
rs.SetProgress(p)
196198
stream := iidq.GetStream(ctx)
197199
defer stream.Close()
@@ -264,6 +266,10 @@ func (d *DecompressorIndexInputDataQuery) Metadata() NumMetadata {
264266
return d.m
265267
}
266268

269+
func (d *DecompressorIndexInputDataQuery) Reset() {
270+
d.reader.Reset(0)
271+
}
272+
267273
func (d *DecompressorIndexInputDataQuery) Close() {
268274
d.reader = nil
269275
}

0 commit comments

Comments
 (0)