Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Enjection committed Jul 15, 2024
1 parent 2cc063e commit 7d794a4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ydb/core/scheme/scheme_tablecell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,12 @@ bool TSerializedCellVec::UnsafeAppendCells(TConstArrayRef<TCell> cells, TString&
ui16 cellCount = ReadUnaligned<ui16>(buf);
cellCount += cells.size();

const ui64 addSize = std::accumulate(
std::begin(cells), std::end(cells), 0ul, [](const auto& acc, const auto& cell){ return acc + cell.Size(); });
size_t newSize = serializedCellVec.size();

serializedCellVec.ReserveAndResize(serializedCellVec.size() + sizeof(ui32) * cells.size() + addSize);
for (auto& cell : cells)
newSize += sizeof(TCellHeader) + cell.Size();

serializedCellVec.ReserveAndResize(newSize);

char* mutableBuf = serializedCellVec.Detach();
char* oldBufEnd = mutableBuf + (bufEnd - buf);
Expand Down

0 comments on commit 7d794a4

Please sign in to comment.