Skip to content

Commit e24df2d

Browse files
alexvruuzhastik
authored andcommitted
Fix 24-2 allowing to load data generated by newer versions of VDisk (ydb-platform#5883)
1 parent b391f90 commit e24df2d

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

ydb/core/blobstorage/vdisk/huge/blobstorage_hullhugeheap.cpp

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -538,13 +538,26 @@ namespace NKikimr {
538538
}
539539
Y_ABORT_UNLESS(loadedIt == loadedEnd);
540540
} else {
541-
// entry point size rollback case
542541
Y_ABORT_UNLESS(size > ChainDelegators.size());
543-
ui32 curChainDelegatorsSize = ChainDelegators.size();
544-
Y_FAIL_S("Impossible case; MinHugeBlobInBytes# " << MinHugeBlobInBytes
545-
<< " MilestoneBlobInBytes# " << MilestoneBlobInBytes
546-
<< " loadedSize# " << size
547-
<< " curChainDelegatorsSize# " << curChainDelegatorsSize);
542+
543+
// skip first delegators, which must not be used
544+
for (size_t i = ChainDelegators.size(); i < size; ++i) {
545+
ui32 slotsInChunk;
546+
::Load(s, slotsInChunk);
547+
ui32 allocatedSlots;
548+
::Load(s, allocatedSlots);
549+
TMap<ui32, TMask> freeSpace;
550+
::Load(s, freeSpace);
551+
Y_ABORT_UNLESS(slotsInChunk > ChainDelegators.front().SlotsInChunk, "incompatible format");
552+
Y_ABORT_UNLESS(!allocatedSlots, "incompatible format");
553+
Y_ABORT_UNLESS(freeSpace.empty(), "incompatible format");
554+
}
555+
556+
// load the rest as usual
557+
StartMode = EStartMode::Loaded;
558+
for (TChainDelegator& delegator : ChainDelegators) {
559+
::Load(s, delegator);
560+
}
548561
}
549562
}
550563

0 commit comments

Comments
 (0)