33
44namespace NKikimr {
55
6- THugeSlotsMap::THugeSlotsMap (ui32 appendBlockSize, TAllSlotsInfo &&slotsInfo, TSearchTable &&searchTable)
6+ THugeSlotsMap::THugeSlotsMap (ui32 appendBlockSize, ui32 minHugeBlobInBlocks, TAllSlotsInfo &&slotsInfo,
7+ TSearchTable &&searchTable)
78 : AppendBlockSize(appendBlockSize)
9+ , MinHugeBlobInBlocks(minHugeBlobInBlocks)
810 , AllSlotsInfo(std::move(slotsInfo))
911 , SearchTable(std::move(searchTable))
1012 {}
1113
1214 const THugeSlotsMap::TSlotInfo *THugeSlotsMap::GetSlotInfo (ui32 size) const {
13- ui32 sizeInBlocks = size / AppendBlockSize;
14- sizeInBlocks += !(sizeInBlocks * AppendBlockSize == size );
15- const ui64 idx = SearchTable.at (sizeInBlocks);
15+ const ui32 sizeInBlocks = ( size + AppendBlockSize - 1 ) / AppendBlockSize;
16+ Y_ABORT_UNLESS (MinHugeBlobInBlocks <= sizeInBlocks );
17+ const ui64 idx = SearchTable.at (sizeInBlocks - MinHugeBlobInBlocks );
1618 return &AllSlotsInfo.at (idx);
1719 }
1820
1921 ui32 THugeSlotsMap::AlignByBlockSize (ui32 size) const {
20- ui32 sizeInBlocks = size / AppendBlockSize;
21- Y_ABORT_UNLESS (sizeInBlocks, " Blob size to align is smaller than a single block. BlobSize# %" PRIu32, size);
22- return sizeInBlocks * AppendBlockSize;
22+ return Max (MinHugeBlobInBlocks * AppendBlockSize, size - size % AppendBlockSize);
2323 }
2424
2525 void THugeSlotsMap::Output (IOutputStream &str) const {
@@ -31,11 +31,7 @@ namespace NKikimr {
3131 str << " ]}\n " ;
3232 str << " {SearchTable# [" ;
3333 for (const auto &idx : SearchTable) {
34- if (idx != NoOpIdx) {
35- AllSlotsInfo.at (idx).Output (str);
36- } else {
37- str << " null" ;
38- }
34+ AllSlotsInfo.at (idx).Output (str);
3935 str << " \n " ;
4036 }
4137 str << " ]}" ;
0 commit comments