Skip to content

Commit

Permalink
Accurately check database size limit (#7457)
Browse files Browse the repository at this point in the history
  • Loading branch information
nshestakov authored Aug 5, 2024
1 parent e4c34ae commit b2e3ab3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ class TAlterPQ: public TSubOperation {
&& NKikimr::NPQ::SplitMergeEnabled(tabletConfig)
&& NKikimr::NPQ::SplitMergeEnabled(newTabletConfig);

THashSet<ui32> involvedPartitions;
if (splitMergeEnabled) {
auto Hex = [](const auto& value) {
return HexText(TBasicStringBuf(value));
Expand All @@ -595,8 +596,6 @@ class TAlterPQ: public TSubOperation {
ui32 nextId = topic->NextPartitionId;
ui32 nextGroupId = topic->TotalGroupCount;

THashSet<ui32> involvedPartitions;

for (const auto& split : alter.GetSplit()) {
alterData->TotalGroupCount += 2;
++alterData->ActivePartitionCount;
Expand Down Expand Up @@ -793,9 +792,10 @@ class TAlterPQ: public TSubOperation {
}

const PQGroupReserve reserve(newTabletConfig, alterData->ActivePartitionCount);
const PQGroupReserve reserveForCheckLimit(newTabletConfig, alterData->ActivePartitionCount + involvedPartitions.size());
const PQGroupReserve oldReserve(tabletConfig, topic->ActivePartitionCount);

const ui64 storageToReserve = reserve.Storage > oldReserve.Storage ? reserve.Storage - oldReserve.Storage : 0;
const ui64 storageToReserve = reserveForCheckLimit.Storage > oldReserve.Storage ? reserveForCheckLimit.Storage - oldReserve.Storage : 0;

{
TPath::TChecker checks = path.Check();
Expand Down

0 comments on commit b2e3ab3

Please sign in to comment.