diff --git a/ydb/core/protos/counters_schemeshard.proto b/ydb/core/protos/counters_schemeshard.proto index 4c77a949b514..84c1ae27100d 100644 --- a/ydb/core/protos/counters_schemeshard.proto +++ b/ydb/core/protos/counters_schemeshard.proto @@ -236,6 +236,11 @@ enum ESimpleCounters { COUNTER_IN_FLIGHT_OPS_TxDropTransferCascade = 186 [(CounterOpts) = {Name: "InFlightOps/DropTransferCascade"}]; COUNTER_TRANSFER_COUNT = 187 [(CounterOpts) = {Name: "Transfers"}]; + + COUNTER_PATHS_QUOTA = 188 [(CounterOpts) = {Name: "PathsQuota"}]; + COUNTER_PATHS = 189 [(CounterOpts) = {Name: "Paths"}]; + COUNTER_SHARDS_QUOTA = 190 [(CounterOpts) = {Name: "ShardsQuota"}]; + COUNTER_SHARDS = 191 [(CounterOpts) = {Name: "Shards"}]; } enum ECumulativeCounters { diff --git a/ydb/core/tx/schemeshard/olap/operations/create_store.cpp b/ydb/core/tx/schemeshard/olap/operations/create_store.cpp index 9f6cccb799db..08327a5bf8ab 100644 --- a/ydb/core/tx/schemeshard/olap/operations/create_store.cpp +++ b/ydb/core/tx/schemeshard/olap/operations/create_store.cpp @@ -500,8 +500,8 @@ class TCreateOlapStore: public TSubOperation { context.SS->ClearDescribePathCaches(dstPath.Base()); context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId); - dstPath.DomainInfo()->IncPathsInside(); - dstPath.DomainInfo()->AddInternalShards(txState); + dstPath.DomainInfo()->IncPathsInside(context.SS); + dstPath.DomainInfo()->AddInternalShards(txState, context.SS); dstPath.Base()->IncShardsInside(shardsToCreate); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop diff --git a/ydb/core/tx/schemeshard/olap/operations/create_table.cpp b/ydb/core/tx/schemeshard/olap/operations/create_table.cpp index 92d5267fd794..fa56e94193c4 100644 --- a/ydb/core/tx/schemeshard/olap/operations/create_table.cpp +++ b/ydb/core/tx/schemeshard/olap/operations/create_table.cpp @@ -861,9 +861,9 @@ class TCreateColumnTable: public TSubOperation { context.SS->ClearDescribePathCaches(dstPath.Base()); context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId); - dstPath.DomainInfo()->IncPathsInside(); + dstPath.DomainInfo()->IncPathsInside(context.SS); if (!storeInfo) { - dstPath.DomainInfo()->AddInternalShards(txState); + dstPath.DomainInfo()->AddInternalShards(txState, context.SS); dstPath.Base()->IncShardsInside(tableInfo->GetOwnedColumnShardsVerified().size()); } IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop diff --git a/ydb/core/tx/schemeshard/olap/operations/drop_store.cpp b/ydb/core/tx/schemeshard/olap/operations/drop_store.cpp index ab1addac4a50..b33757cbaf8b 100644 --- a/ydb/core/tx/schemeshard/olap/operations/drop_store.cpp +++ b/ydb/core/tx/schemeshard/olap/operations/drop_store.cpp @@ -92,7 +92,7 @@ class TPropose: public TSubOperationState { context.SS->PersistDropStep(db, pathId, step, OperationId); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentDir, context); // for correct discard of ChildrenExist prop context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size()); diff --git a/ydb/core/tx/schemeshard/olap/operations/drop_table.cpp b/ydb/core/tx/schemeshard/olap/operations/drop_table.cpp index 4f50157d810d..368f8a7dd0b9 100644 --- a/ydb/core/tx/schemeshard/olap/operations/drop_table.cpp +++ b/ydb/core/tx/schemeshard/olap/operations/drop_table.cpp @@ -131,7 +131,7 @@ class TPropose: public TSubOperationState { context.SS->PersistDropStep(db, pathId, step, OperationId); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentDir, context); // for correct discard of ChildrenExist prop context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size()); diff --git a/ydb/core/tx/schemeshard/schemeshard__delete_tablet_reply.cpp b/ydb/core/tx/schemeshard/schemeshard__delete_tablet_reply.cpp index 0f521959ac6e..872a3f2914e9 100644 --- a/ydb/core/tx/schemeshard/schemeshard__delete_tablet_reply.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__delete_tablet_reply.cpp @@ -135,7 +135,7 @@ struct TSchemeShard::TTxDeleteTabletReply : public TSchemeShard::TRwTxBase { path->DecShardsInside(); auto domain = Self->ResolveDomainInfo(path); - domain->RemoveInternalShard(ShardIdx); + domain->RemoveInternalShard(ShardIdx, Self); switch (tabletType) { case ETabletType::SequenceShard: domain->RemoveSequenceShard(ShardIdx); diff --git a/ydb/core/tx/schemeshard/schemeshard__init.cpp b/ydb/core/tx/schemeshard/schemeshard__init.cpp index 93f41ff501d9..e7c8aee7836e 100644 --- a/ydb/core/tx/schemeshard/schemeshard__init.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__init.cpp @@ -1511,7 +1511,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase { } TSubDomainInfo::TPtr rootDomainInfo = new TSubDomainInfo(version, Self->RootPathId()); - rootDomainInfo->SetSchemeLimits(rootLimits); + rootDomainInfo->SetSchemeLimits(rootLimits, Self); rootDomainInfo->SetSecurityStateVersion(row.GetValueOrDefault()); rootDomainInfo->InitializeAsGlobal(Self->CreateRootProcessingParams(ctx)); @@ -1551,7 +1551,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase { TTabletId sharedHiveId = rowset.GetValue(); domainInfo->SetSharedHive(sharedHiveId); - domainInfo->SetSchemeLimits(LoadSchemeLimits(rootLimits, rowset)); + domainInfo->SetSchemeLimits(LoadSchemeLimits(rootLimits, rowset), !Self->IsDomainSchemeShard ? Self : nullptr); if (rowset.HaveValue()) { NKikimrSubDomains::TSchemeQuotas declaredSchemeQuotas; @@ -4007,7 +4007,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase { path->IncShardsInside(); auto domainInfo = Self->ResolveDomainInfo(pathId); //domain should't be dropped? - domainInfo->AddInternalShard(shardIdx, Self->IsBackupTable(pathId)); + domainInfo->AddInternalShard(shardIdx, Self, Self->IsBackupTable(pathId)); switch (si.second.TabletType) { case ETabletType::DataShard: @@ -4115,7 +4115,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase { if (!path->IsRoot()) { const bool isBackupTable = Self->IsBackupTable(item.first); parent->IncAliveChildrenPrivate(isBackupTable); - inclusiveDomainInfo->IncPathsInside(1, isBackupTable); + inclusiveDomainInfo->IncPathsInside(Self, 1, isBackupTable); } Self->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Add(path->UserAttrs->Size()); diff --git a/ydb/core/tx/schemeshard/schemeshard__init_root.cpp b/ydb/core/tx/schemeshard/schemeshard__init_root.cpp index 6d6b5bd68283..9938d913fed9 100644 --- a/ydb/core/tx/schemeshard/schemeshard__init_root.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__init_root.cpp @@ -258,7 +258,7 @@ struct TSchemeShard::TTxInitTenantSchemeShard : public TSchemeShard::TRwTxBase { Self->PersistShardMapping(db, shardIdx, id, Self->RootPathId(), InvalidTxId, type); subdomain->AddPrivateShard(shardIdx); - subdomain->AddInternalShard(shardIdx); + subdomain->AddInternalShard(shardIdx, Self); } } @@ -386,7 +386,7 @@ struct TSchemeShard::TTxInitTenantSchemeShard : public TSchemeShard::TRwTxBase { subdomain->AddStoragePool(x); } - subdomain->SetSchemeLimits(TSchemeLimits::FromProto(schemeLimits)); + subdomain->SetSchemeLimits(TSchemeLimits::FromProto(schemeLimits), Self); if (record.HasDeclaredSchemeQuotas()) { subdomain->ApplyDeclaredSchemeQuotas(record.GetDeclaredSchemeQuotas(), ctx.Now()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp index ddd171b86454..95302daf314d 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp @@ -618,7 +618,7 @@ class TAlterBlockStoreVolume: public TSubOperation { context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId); TSubDomainInfo::TPtr domainInfo = path.DomainInfo(); - domainInfo->AddInternalShards(txState); + domainInfo->AddInternalShards(txState, context.SS); path.Base()->IncShardsInside(shardsToCreate); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_extsubdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_extsubdomain.cpp index 57a1ec970697..4c8de882a02a 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_extsubdomain.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_extsubdomain.cpp @@ -360,7 +360,7 @@ void RegisterChanges(const TTxState& txState, const TTxId operationTxId, TOperat context.DbChanges.PersistShard(shardIdx); // Path - path.DomainInfo()->AddInternalShard(shardIdx); + path.DomainInfo()->AddInternalShard(shardIdx, context.SS); path.Base()->IncShardsInside(1); // Extsubdomain data @@ -497,7 +497,7 @@ class TCreateHive: public TSubOperationState { { auto subdomain = context.SS->SubDomains.at(txState->TargetPathId); subdomain->AddPrivateShard(shardIdx); - subdomain->AddInternalShard(shardIdx); + subdomain->AddInternalShard(shardIdx, context.SS); subdomain->SetTenantHiveIDPrivate(createdTabletId); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp index a05fcadf3096..c6dd1aa23a89 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp @@ -864,7 +864,7 @@ class TAlterPQ: public TSubOperation { context.SS->ClearDescribePathCaches(path.Base()); context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId); - path.DomainInfo()->AddInternalShards(txState); + path.DomainInfo()->AddInternalShards(txState, context.SS); path.DomainInfo()->IncPQPartitionsInside(partitionsToCreate); path.DomainInfo()->UpdatePQReservedStorage(oldReserve.Storage, reserve.Storage); path.Base()->IncShardsInside(shardsToCreate); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp index 9ef098971c02..611f9a3bcacc 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp @@ -331,7 +331,7 @@ class TAlterSolomon: public TSubOperation { context.SS->PersistTxState(db, OperationId); - path.DomainInfo()->AddInternalShards(txState); + path.DomainInfo()->AddInternalShards(txState, context.SS); SetState(NextState()); return result; diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_subdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_subdomain.cpp index 7da692f95ceb..27aacc5f9d84 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_subdomain.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_subdomain.cpp @@ -332,7 +332,7 @@ class TAlterSubDomain: public TSubOperation { context.SS->PersistTxState(db, OperationId); context.OnComplete.ActivateTx(OperationId); - path.DomainInfo()->AddInternalShards(txState); + path.DomainInfo()->AddInternalShards(txState, context.SS); path.Base()->IncShardsInside(shardsToCreate); SetState(NextState()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_blob_depot.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_blob_depot.cpp index 0d9de988d397..278d1b5437c8 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_blob_depot.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_blob_depot.cpp @@ -374,8 +374,8 @@ namespace NKikimr::NSchemeShard { context.OnComplete.PublishToSchemeBoard(OperationId, parentPath->PathId); context.SS->ClearDescribePathCaches(dstPath.Base()); context.OnComplete.PublishToSchemeBoard(OperationId, dstPath->PathId); - dstPath.DomainInfo()->IncPathsInside(); - dstPath.DomainInfo()->AddInternalShards(txState); + dstPath.DomainInfo()->IncPathsInside(context.SS); + dstPath.DomainInfo()->AddInternalShards(txState, context.SS); dstPath->IncShardsInside(); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_common.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_common.cpp index da2ce5b753ca..fd427430e642 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_common.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_common.cpp @@ -883,7 +883,7 @@ void UpdatePartitioningForCopyTable(TOperationId operationId, TTxState &txState, dstTableInfo->PerShardPartitionConfig.erase(shard.Idx); context.SS->PersistShardDeleted(db, shard.Idx, context.SS->ShardInfos[shard.Idx].BindedChannels); context.SS->ShardInfos.erase(shard.Idx); - domainInfo->RemoveInternalShard(shard.Idx); + domainInfo->RemoveInternalShard(shard.Idx, context.SS); context.SS->DecrementPathDbRefCount(pathId, "remove shard from txState"); context.SS->OnShardRemoved(shard.Idx); } @@ -934,7 +934,7 @@ void UpdatePartitioningForCopyTable(TOperationId operationId, TTxState &txState, ui32 newShardCout = dstTableInfo->GetPartitions().size(); dstPath->SetShardsInside(newShardCout); - domainInfo->AddInternalShards(txState); + domainInfo->AddInternalShards(txState, context.SS); context.SS->PersistTable(db, txState.TargetPathId); context.SS->PersistTxState(db, operationId); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_copy_sequence.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_copy_sequence.cpp index 00044c9f551c..ad3ce5c4a4b4 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_copy_sequence.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_copy_sequence.cpp @@ -731,7 +731,7 @@ class TCopySequence: public TSubOperation { context.SS->ClearDescribePathCaches(dstPath.Base()); context.OnComplete.PublishToSchemeBoard(OperationId, dstPath->PathId); - domainInfo->IncPathsInside(); + domainInfo->IncPathsInside(context.SS); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop SetState(NextState()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp index 8a2188f558bc..f486d73441f0 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp @@ -712,8 +712,8 @@ class TCopyTable: public TSubOperation { const ui32 shardsToCreate = tableInfo->GetPartitions().size(); Y_VERIFY_S(shardsToCreate <= maxShardsToCreate, "shardsToCreate: " << shardsToCreate << " maxShardsToCreate: " << maxShardsToCreate); - dstPath.DomainInfo()->IncPathsInside(1, isBackup); - dstPath.DomainInfo()->AddInternalShards(txState, isBackup); + dstPath.DomainInfo()->IncPathsInside(context.SS, 1, isBackup); + dstPath.DomainInfo()->AddInternalShards(txState, context.SS, isBackup); dstPath.Base()->IncShardsInside(shardsToCreate); IncAliveChildrenSafeWithUndo(OperationId, parent, context, isBackup); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_backup_collection.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_backup_collection.cpp index 645c1c6d6282..2287780e5f40 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_backup_collection.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_backup_collection.cpp @@ -173,7 +173,7 @@ class TCreateBackupCollection : public TSubOperation { auto pathEl = CreateBackupCollectionPathElement(dstPath); IncAliveChildrenDirect(OperationId, rootPath, context); // for correct discard of ChildrenExist prop - rootPath.DomainInfo()->IncPathsInside(); + rootPath.DomainInfo()->IncPathsInside(context.SS); auto backupCollection = TBackupCollectionInfo::Create(desc); context.SS->BackupCollections[dstPath->PathId] = backupCollection; diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp index 7fc407cc4452..e964a126b960 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp @@ -362,8 +362,8 @@ class TCreateBlockStoreVolume: public TSubOperation { context.SS->ClearDescribePathCaches(dstPath.Base()); context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId); - dstPath.DomainInfo()->IncPathsInside(); - dstPath.DomainInfo()->AddInternalShards(txState); + dstPath.DomainInfo()->IncPathsInside(context.SS); + dstPath.DomainInfo()->AddInternalShards(txState, context.SS); dstPath.Base()->IncShardsInside(shardsToCreate); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_cdc_stream.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_cdc_stream.cpp index 55d2255e3461..6db5e4e6f557 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_cdc_stream.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_cdc_stream.cpp @@ -324,7 +324,7 @@ class TNewCdcStream: public TSubOperation { context.SS->CdcStreams[pathId] = stream; context.SS->IncrementPathDbRefCount(pathId); - streamPath.DomainInfo()->IncPathsInside(); + streamPath.DomainInfo()->IncPathsInside(context.SS); IncAliveChildrenSafeWithUndo(OperationId, tablePath, context); // for correct discard of ChildrenExist prop context.OnComplete.ActivateTx(OperationId); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_external_data_source.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_external_data_source.cpp index 39e9d548087b..67203e64f74e 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_external_data_source.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_external_data_source.cpp @@ -278,7 +278,7 @@ class TCreateExternalDataSource : public TSubOperation { context.SS, context.OnComplete); - dstPath.DomainInfo()->IncPathsInside(); + dstPath.DomainInfo()->IncPathsInside(context.SS); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop SetState(NextState()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_external_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_external_table.cpp index b99081d05fdb..24ee429b3a50 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_external_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_external_table.cpp @@ -370,7 +370,7 @@ class TCreateExternalTable: public TSubOperation { context.SS, context.OnComplete); - dstPath.DomainInfo()->IncPathsInside(); + dstPath.DomainInfo()->IncPathsInside(context.SS); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop SetState(NextState()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp index 216b90bc911a..8f8095924e7e 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp @@ -261,7 +261,7 @@ class TCreateExtSubDomain: public TSubOperation { context.OnComplete.PublishToSchemeBoard(OperationId, newNode->PathId); Y_ABORT_UNLESS(0 == txState.Shards.size()); - parentPath.DomainInfo()->IncPathsInside(); + parentPath.DomainInfo()->IncPathsInside(context.SS); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop SetState(NextState()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp index a7aab5d81cf1..55938e8fe9e9 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp @@ -428,8 +428,8 @@ THolder TCreateFileStore::Propose( context.SS->ClearDescribePathCaches(dstPath.Base()); context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId); - dstPath.DomainInfo()->IncPathsInside(); - dstPath.DomainInfo()->AddInternalShards(txState); + dstPath.DomainInfo()->IncPathsInside(context.SS); + dstPath.DomainInfo()->AddInternalShards(txState, context.SS); dstPath.Base()->IncShardsInside(shardsToCreate); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_index.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_index.cpp index c307386c7206..32340961f667 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_index.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_index.cpp @@ -245,7 +245,7 @@ class TCreateTableIndex: public TSubOperation { context.OnComplete.ActivateTx(OperationId); - dstPath.DomainInfo()->IncPathsInside(); + dstPath.DomainInfo()->IncPathsInside(context.SS); IncAliveChildrenSafeWithUndo(OperationId, parentPath, context); // for correct discard of ChildrenExist prop SetState(NextState()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp index 8b9086614045..fb63e75499d2 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp @@ -402,8 +402,8 @@ class TCreateKesus: public TSubOperation { context.SS->ClearDescribePathCaches(dstPath.Base()); context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId); - dstPath.DomainInfo()->IncPathsInside(); - dstPath.DomainInfo()->AddInternalShards(txState); + dstPath.DomainInfo()->IncPathsInside(context.SS); + dstPath.DomainInfo()->AddInternalShards(txState, context.SS); dstPath.Base()->IncShardsInside(); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp index 7e7f8891fe7c..c472b8adf5a1 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp @@ -545,8 +545,8 @@ class TCreatePQ: public TSubOperation { context.SS->ClearDescribePathCaches(dstPath.Base()); context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId); - dstPath.DomainInfo()->IncPathsInside(); - dstPath.DomainInfo()->AddInternalShards(txState); + dstPath.DomainInfo()->IncPathsInside(context.SS); + dstPath.DomainInfo()->AddInternalShards(txState, context.SS); dstPath.DomainInfo()->IncPQPartitionsInside(partitionsToCreate); dstPath.DomainInfo()->IncPQReservedStorage(reserve.Storage); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp index 9eb07feaca6c..d8307a88d855 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp @@ -398,7 +398,7 @@ class TCreateReplication: public TSubOperation { context.SS->IncrementPathDbRefCount(path->PathId); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop - parentPath.DomainInfo()->IncPathsInside(); + parentPath.DomainInfo()->IncPathsInside(context.SS); if (desc.GetConfig().GetSrcConnectionParams().GetCredentialsCase() == NKikimrReplication::TConnectionParams::CREDENTIALS_NOT_SET) { desc.MutableConfig()->MutableSrcConnectionParams()->MutableOAuthToken()->SetToken(BUILTIN_ACL_ROOT); @@ -425,7 +425,7 @@ class TCreateReplication: public TSubOperation { txState.State = TTxState::CreateParts; path->IncShardsInside(); - parentPath.DomainInfo()->AddInternalShards(txState); + parentPath.DomainInfo()->AddInternalShards(txState, context.SS); if (parentPath->HasActiveChanges()) { const auto parentTxId = parentPath->PlannedToCreate() ? parentPath->CreateTxId : parentPath->LastTxId; diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_resource_pool.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_resource_pool.cpp index 1ae142e14bfb..9c3dee8ebc99 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_resource_pool.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_resource_pool.cpp @@ -182,7 +182,7 @@ class TCreateResourcePool : public TSubOperation { IncParentDirAlterVersionWithRepublishSafeWithUndo(OperationId, dstPath, context.SS, context.OnComplete); - dstPath.DomainInfo()->IncPathsInside(); + dstPath.DomainInfo()->IncPathsInside(context.SS); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop SetState(NextState()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp index 985a8c5589ae..899bae346427 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp @@ -368,8 +368,8 @@ class TCreateRTMR: public TSubOperation { Y_ABORT_UNLESS(shardsToCreate == txState.Shards.size(), "shardsToCreate=%ld != txStateShards=%ld", shardsToCreate, txState.Shards.size()); - dstPath.DomainInfo()->IncPathsInside(); - dstPath.DomainInfo()->AddInternalShards(txState); + dstPath.DomainInfo()->IncPathsInside(context.SS); + dstPath.DomainInfo()->AddInternalShards(txState, context.SS); dstPath.Base()->IncShardsInside(shardsToCreate); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp index 531da899c70a..0e23348c0880 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp @@ -524,7 +524,7 @@ class TCreateSequence : public TSubOperation { txState.Shards.emplace_back(sequenceShard, ETabletType::SequenceShard, TTxState::CreateParts); txState.State = TTxState::CreateParts; context.SS->PathsById.at(domainPathId)->IncShardsInside(); - domainInfo->AddInternalShard(sequenceShard); + domainInfo->AddInternalShard(sequenceShard, context.SS); domainInfo->AddSequenceShard(sequenceShard); } else { txState.Shards.emplace_back(sequenceShard, ETabletType::SequenceShard, TTxState::ConfigureParts); @@ -576,7 +576,7 @@ class TCreateSequence : public TSubOperation { context.SS->ClearDescribePathCaches(dstPath.Base()); context.OnComplete.PublishToSchemeBoard(OperationId, dstPath->PathId); - domainInfo->IncPathsInside(); + domainInfo->IncPathsInside(context.SS); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop SetState(NextState()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp index 46a24d41e6ea..ab27603f2835 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp @@ -418,8 +418,8 @@ class TCreateSolomon: public TSubOperation { IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context); Y_ABORT_UNLESS(shardsToCreate == txState.Shards.size()); - dstPath.DomainInfo()->IncPathsInside(); - dstPath.DomainInfo()->AddInternalShards(txState); + dstPath.DomainInfo()->IncPathsInside(context.SS); + dstPath.DomainInfo()->AddInternalShards(txState, context.SS); dstPath.Base()->IncShardsInside(shardsToCreate); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp index 3651f6a97902..ec89d2412df7 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp @@ -340,8 +340,8 @@ class TCreateSubDomain: public TSubOperation { Y_ABORT_UNLESS(shardsToCreate == txState.Shards.size()); - parentPath.DomainInfo()->IncPathsInside(); - dstPath.DomainInfo()->AddInternalShards(txState); + parentPath.DomainInfo()->IncPathsInside(context.SS); + dstPath.DomainInfo()->AddInternalShards(txState, context.SS); dstPath.Base()->IncShardsInside(shardsToCreate); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp index 1c8fcbc56963..600e3509aa41 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp @@ -724,8 +724,8 @@ class TCreateTable: public TSubOperation { context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId); Y_ABORT_UNLESS(shardsToCreate == txState.Shards.size()); - dstPath.DomainInfo()->IncPathsInside(); - dstPath.DomainInfo()->AddInternalShards(txState); + dstPath.DomainInfo()->IncPathsInside(context.SS); + dstPath.DomainInfo()->AddInternalShards(txState, context.SS); dstPath.Base()->IncShardsInside(shardsToCreate); IncAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_view.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_view.cpp index 65e26daf3ac0..15a95abeb7ba 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_view.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_view.cpp @@ -197,7 +197,7 @@ class TCreateView: public TSubOperation { context.DbChanges.PersistTxState(OperationId); dstPath.MaterializeLeaf(owner, viewPathId); - dstPath.DomainInfo()->IncPathsInside(); + dstPath.DomainInfo()->IncPathsInside(context.SS); IncAliveChildrenSafeWithUndo(OperationId, parentPath, context); // for correct discard of ChildrenExist prop result->SetPathId(viewPathId.LocalPathId); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_backup_collection.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_backup_collection.cpp index b0883939268d..60989c361782 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_backup_collection.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_backup_collection.cpp @@ -46,7 +46,7 @@ class TPropose : public TSubOperationState { context.SS->PersistRemoveBackupCollection(db, pathId); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentDirPtr, context); // for correct discard of ChildrenExist prop context.SS->TabletCounters->Simple()[COUNTER_BACKUP_COLLECTION_COUNT].Sub(1); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp index 228da123b76d..e455ba81b579 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp @@ -52,7 +52,7 @@ class TPropose: public TSubOperationState { path->SetDropped(step, OperationId.GetTxId()); context.SS->PersistDropStep(db, pathId, step, OperationId); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentDir, context); // for correct discard of ChildrenExist prop // KIKIMR-13173 diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_cdc_stream.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_cdc_stream.cpp index 2fc09a841abd..d93f162ea406 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_cdc_stream.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_cdc_stream.cpp @@ -67,7 +67,7 @@ class TPropose: public TSubOperationState { Y_ABORT_UNLESS(context.SS->PathsById.contains(path->ParentPathId)); auto parent = context.SS->PathsById.at(path->ParentPathId); - context.SS->ResolveDomainInfo(pathId)->DecPathsInside(); + context.SS->ResolveDomainInfo(pathId)->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parent, context); // for correct discard of ChildrenExist prop context.SS->ClearDescribePathCaches(path); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_external_data_source.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_external_data_source.cpp index bc211d733069..7943658fb938 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_external_data_source.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_external_data_source.cpp @@ -51,7 +51,7 @@ class TPropose: public TSubOperationState { path->SetDropped(step, OperationId.GetTxId()); context.SS->PersistDropStep(db, pathId, step, OperationId); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentDir, context); // for correct discard of ChildrenExist prop context.SS->TabletCounters->Simple()[COUNTER_EXTERNAL_DATA_SOURCE_COUNT].Sub(1); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_external_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_external_table.cpp index ee945523f5a3..b45002d86636 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_external_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_external_table.cpp @@ -53,7 +53,7 @@ class TPropose: public TSubOperationState { path->SetDropped(step, OperationId.GetTxId()); context.SS->PersistDropStep(db, pathId, step, OperationId); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentDir, context); // for correct discard of ChildrenExist prop TExternalDataSourceInfo::TPtr externalDataSourceInfo = context.SS->ExternalDataSources.Value(dataSourcePathId, nullptr); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_fs.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_fs.cpp index 6428bbd31852..423fe22cf5c7 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_fs.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_fs.cpp @@ -58,7 +58,7 @@ class TPropose: public TSubOperationState { path->SetDropped(step, OperationId.GetTxId()); context.SS->PersistDropStep(db, pathId, step, OperationId); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentDir, context); // for correct discard of ChildrenExist prop // KIKIMR-13173 diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_indexed_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_indexed_table.cpp index 9b1ce9c0d69d..5f30f978d3a5 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_indexed_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_indexed_table.cpp @@ -37,7 +37,7 @@ void DropPath(NIceDb::TNiceDb& db, TOperationContext& context, context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr); auto domainInfo = context.SS->ResolveDomainInfo(path->PathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); auto parentDir = path.Parent(); DecAliveChildrenDirect(operationId, parentDir.Base(), context); // for correct discard of ChildrenExist prop diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_kesus.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_kesus.cpp index 00bdd7219b52..8b73f1f45466 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_kesus.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_kesus.cpp @@ -50,7 +50,7 @@ class TPropose: public TSubOperationState { path->SetDropped(step, OperationId.GetTxId()); context.SS->PersistDropStep(db, pathId, step, OperationId); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentDir, context); // for correct discard of ChildrenExist prop // KIKIMR-13173 diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_pq.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_pq.cpp index 29a73c1fd9c7..d091afbeac77 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_pq.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_pq.cpp @@ -189,7 +189,7 @@ class TPropose: public TSubOperationState { const PQGroupReserve reserve(config, pqGroup->ActivePartitionCount); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); domainInfo->DecPQPartitionsInside(pqGroup->TotalPartitionCount); domainInfo->DecPQReservedStorage(reserve.Storage); domainInfo->AggrDiskSpaceUsage({}, pqGroup->Stats); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_replication.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_replication.cpp index d7b374cb7952..e8c6bdc44a15 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_replication.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_replication.cpp @@ -201,7 +201,7 @@ class TPropose: public TSubOperationState { context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr); context.SS->TabletCounters->Simple()[COUNTER_REPLICATION_COUNT].Add(-1); - context.SS->ResolveDomainInfo(pathId)->DecPathsInside(); + context.SS->ResolveDomainInfo(pathId)->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentPath, context); // for correct discard of ChildrenExist prop ++parentPath->DirAlterVersion; diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_resource_pool.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_resource_pool.cpp index 4c42f0969108..7982572421e1 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_resource_pool.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_resource_pool.cpp @@ -33,7 +33,7 @@ class TPropose : public TSubOperationState { context.SS->PersistRemoveResourcePool(db, pathId); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentDirPtr, context); // for correct discard of ChildrenExist prop context.SS->TabletCounters->Simple()[COUNTER_RESOURCE_POOL_COUNT].Sub(1); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_sequence.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_sequence.cpp index 790bff09fe27..13f5acce5eb5 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_sequence.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_sequence.cpp @@ -170,7 +170,7 @@ class TPropose: public TSubOperationState { context.SS->PersistDropStep(db, pathId, step, OperationId); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentDir, context); // for correct discard of ChildrenExist prop context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Add(-path->UserAttrs->Size()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp index 9ab828b9003b..71fb72628869 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp @@ -39,7 +39,7 @@ void DropPath(NIceDb::TNiceDb& db, const auto isBackupTable = context.SS->IsBackupTable(path->PathId); auto domainInfo = context.SS->ResolveDomainInfo(path->PathId); - domainInfo->DecPathsInside(1, isBackupTable); + domainInfo->DecPathsInside(context.SS, 1, isBackupTable); auto parentDir = path.Parent(); DecAliveChildrenDirect(operationId, parentDir.Base(), context, isBackupTable); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_view.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_view.cpp index a9f1f8cd04c6..8e2cdf2d262a 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_view.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_view.cpp @@ -56,7 +56,7 @@ class TPropose: public TSubOperationState { path->SetDropped(step, OperationId.GetTxId()); context.SS->PersistDropStep(db, pathId, step, OperationId); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentDir, context); // for correct discard of ChildrenExist prop context.SS->TabletCounters->Simple()[COUNTER_VIEW_COUNT].Sub(1); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp index 7c2ef6b2ccfe..52913d43a38f 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp @@ -259,7 +259,7 @@ class TMkDir: public TSubOperation { newDir->TempDirOwnerActorId, newDir->PathId); } - dstPath.DomainInfo()->IncPathsInside(); + dstPath.DomainInfo()->IncPathsInside(context.SS); IncAliveChildrenSafeWithUndo(OperationId, parentPath, context); // for correct discard of ChildrenExist prop context.OnComplete.ActivateTx(OperationId); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_move_sequence.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_move_sequence.cpp index 92a876486d9a..dfa2e51f303a 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_move_sequence.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_move_sequence.cpp @@ -23,7 +23,7 @@ void MarkSrcDropped(NIceDb::TNiceDb& db, context.SS->PersistDropStep(db, srcPath->PathId, txState.PlanStep, operationId); DecAliveChildrenDirect(operationId, srcPath.Parent().Base(), context); - srcPath.DomainInfo()->DecPathsInside(); + srcPath.DomainInfo()->DecPathsInside(context.SS); IncParentDirAlterVersionWithRepublish(operationId, srcPath, context); } @@ -203,7 +203,7 @@ class TPropose: public TSubOperationState { dstPath->StepCreated = step; context.SS->PersistCreateStep(db, pathId, step); - dstPath.DomainInfo()->IncPathsInside(); + dstPath.DomainInfo()->IncPathsInside(context.SS); dstPath.Activate(); IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_move_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_move_table.cpp index 110bb7febd21..b74177f65399 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_move_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_move_table.cpp @@ -144,7 +144,7 @@ void MarkSrcDropped(NIceDb::TNiceDb& db, { const auto isBackupTable = context.SS->IsBackupTable(srcPath->PathId); DecAliveChildrenDirect(operationId, srcPath.Parent().Base(), context, isBackupTable); - srcPath.DomainInfo()->DecPathsInside(1, isBackupTable); + srcPath.DomainInfo()->DecPathsInside(context.SS, 1, isBackupTable); srcPath->SetDropped(txState.PlanStep, operationId.GetTxId()); context.SS->PersistDropStep(db, srcPath->PathId, txState.PlanStep, operationId); @@ -239,7 +239,7 @@ class TPropose: public TSubOperationState { dstPath->StepCreated = step; context.SS->PersistCreateStep(db, dstPath.Base()->PathId, step); - dstPath.DomainInfo()->IncPathsInside(); + dstPath.DomainInfo()->IncPathsInside(context.SS); dstPath.Activate(); IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_move_table_index.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_move_table_index.cpp index 39995c90f32e..e285aa8dbb0b 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_move_table_index.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_move_table_index.cpp @@ -22,7 +22,7 @@ void MarkSrcDropped(NIceDb::TNiceDb& db, context.SS->PersistUserAttributes(db, srcPath->PathId, srcPath->UserAttrs, nullptr); DecAliveChildrenDirect(operationId, srcPath.Parent().Base(), context); - srcPath.DomainInfo()->DecPathsInside(); + srcPath.DomainInfo()->DecPathsInside(context.SS); IncParentDirAlterVersionWithRepublish(operationId, srcPath, context); } @@ -72,7 +72,7 @@ class TPropose: public TSubOperationState { dstPath->StepCreated = step; context.SS->PersistCreateStep(db, dstPath.Base()->PathId, step); - dstPath.DomainInfo()->IncPathsInside(); + dstPath.DomainInfo()->IncPathsInside(context.SS); dstPath.Activate(); IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_rmdir.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_rmdir.cpp index 71392600d7a5..fe730c1b8bcb 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_rmdir.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_rmdir.cpp @@ -158,7 +158,7 @@ class TRmDir: public TSubOperationBase { path->SetDropped(step, OperationId.GetTxId()); context.SS->PersistDropStep(db, pathId, step, OperationId); auto domainInfo = context.SS->ResolveDomainInfo(pathId); - domainInfo->DecPathsInside(); + domainInfo->DecPathsInside(context.SS); DecAliveChildrenDirect(OperationId, parentDir, context); // for correct discard of ChildrenExist prop ++parentDir->DirAlterVersion; diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp index d76c2f0244f5..b699fb0dea78 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp @@ -967,7 +967,7 @@ class TSplitMerge: public TSubOperation { } } - path.DomainInfo()->AddInternalShards(op); //allow over commit for merge + path.DomainInfo()->AddInternalShards(op, context.SS); //allow over commit for merge path->IncShardsInside(dstCount); SetState(NextState()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_upgrade_subdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_upgrade_subdomain.cpp index 66bfd2956a08..a92cf4a21779 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_upgrade_subdomain.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_upgrade_subdomain.cpp @@ -1255,7 +1255,7 @@ class TUpgradeSubDomain: public TSubOperation { context.OnComplete.Dependence(otherTxId, OperationId.GetTxId()); } - path.DomainInfo()->AddInternalShards(txState); + path.DomainInfo()->AddInternalShards(txState, context.SS); path.Base()->IncShardsInside(); context.OnComplete.ActivateTx(OperationId); diff --git a/ydb/core/tx/schemeshard/schemeshard__sync_update_tenants.cpp b/ydb/core/tx/schemeshard/schemeshard__sync_update_tenants.cpp index c558fd3c52d3..0939371ec2fe 100644 --- a/ydb/core/tx/schemeshard/schemeshard__sync_update_tenants.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__sync_update_tenants.cpp @@ -157,7 +157,7 @@ struct TSchemeShard::TTxUpdateTenant : public TSchemeShard::TRwTxBase { } subdomain->AddPrivateShard(shardIdx); - subdomain->AddInternalShard(shardIdx); + subdomain->AddInternalShard(shardIdx, Self); subdomain->Initialize(Self->ShardInfos); Self->PersistSubDomain(db, Self->RootPathId(), *subdomain); diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.cpp b/ydb/core/tx/schemeshard/schemeshard_impl.cpp index a976e60cf531..9560486fe032 100644 --- a/ydb/core/tx/schemeshard/schemeshard_impl.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_impl.cpp @@ -5141,9 +5141,9 @@ void TSchemeShard::UncountNode(TPathElement::TPtr node) { const auto isBackupTable = IsBackupTable(node->PathId); if (node->IsDomainRoot()) { - ResolveDomainInfo(node->ParentPathId)->DecPathsInside(1, isBackupTable); + ResolveDomainInfo(node->ParentPathId)->DecPathsInside(this, 1, isBackupTable); } else { - ResolveDomainInfo(node)->DecPathsInside(1, isBackupTable); + ResolveDomainInfo(node)->DecPathsInside(this, 1, isBackupTable); } PathsById.at(node->ParentPathId)->DecAliveChildrenPrivate(isBackupTable); @@ -7515,6 +7515,22 @@ void TSchemeShard::AddDiskSpaceSoftQuotaBytes(EUserFacingStorageType storageType } } +void TSchemeShard::ChangePathCount(i64 delta) { + TabletCounters->Simple()[COUNTER_PATHS].Add(delta); +} + +void TSchemeShard::SetPathsQuota(ui64 value) { + TabletCounters->Simple()[COUNTER_PATHS_QUOTA].Set(value); +} + +void TSchemeShard::ChangeShardCount(i64 delta) { + TabletCounters->Simple()[COUNTER_SHARDS].Add(delta); +} + +void TSchemeShard::SetShardsQuota(ui64 value) { + TabletCounters->Simple()[COUNTER_SHARDS_QUOTA].Set(value); +} + void TSchemeShard::Handle(TEvSchemeShard::TEvLogin::TPtr &ev, const TActorContext &ctx) { Execute(CreateTxLogin(ev), ctx); } diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.h b/ydb/core/tx/schemeshard/schemeshard_impl.h index 2bcf17ab43d2..2f5670a54ba7 100644 --- a/ydb/core/tx/schemeshard/schemeshard_impl.h +++ b/ydb/core/tx/schemeshard/schemeshard_impl.h @@ -1465,6 +1465,10 @@ class TSchemeShard void ChangeDiskSpaceHardQuotaBytes(i64 delta) override; void ChangeDiskSpaceSoftQuotaBytes(i64 delta) override; void AddDiskSpaceSoftQuotaBytes(EUserFacingStorageType storageType, ui64 addend) override; + void ChangePathCount(i64 delta) override; + void SetPathsQuota(ui64 value) override; + void ChangeShardCount(i64 delta) override; + void SetShardsQuota(ui64 value) override; NLogin::TLoginProvider LoginProvider; diff --git a/ydb/core/tx/schemeshard/schemeshard_info_types.h b/ydb/core/tx/schemeshard/schemeshard_info_types.h index 81a4b4012fdb..b21e3a0fc27b 100644 --- a/ydb/core/tx/schemeshard/schemeshard_info_types.h +++ b/ydb/core/tx/schemeshard/schemeshard_info_types.h @@ -1377,6 +1377,10 @@ struct IQuotaCounters { virtual void ChangeDiskSpaceHardQuotaBytes(i64 delta) = 0; virtual void ChangeDiskSpaceSoftQuotaBytes(i64 delta) = 0; virtual void AddDiskSpaceSoftQuotaBytes(EUserFacingStorageType storageType, ui64 addend) = 0; + virtual void ChangePathCount(i64 delta) = 0; + virtual void SetPathsQuota(ui64 value) = 0; + virtual void ChangeShardCount(i64 delta) = 0; + virtual void SetShardsQuota(ui64 value) = 0; }; struct TSubDomainInfo: TSimpleRefCount { @@ -1458,8 +1462,12 @@ struct TSubDomainInfo: TSimpleRefCount { } } - void SetSchemeLimits(const TSchemeLimits& limits) { + void SetSchemeLimits(const TSchemeLimits& limits, IQuotaCounters* counters = nullptr) { SchemeLimits = limits; + if (counters) { + counters->SetPathsQuota(limits.MaxPaths); + counters->SetShardsQuota(limits.MaxShards); + } } const TSchemeLimits& GetSchemeLimits() const { @@ -1577,23 +1585,27 @@ struct TSubDomainInfo: TSimpleRefCount { return BackupPathsCount; } - void IncPathsInside(ui64 delta = 1, bool isBackup = false) { + void IncPathsInside(IQuotaCounters* counters, ui64 delta = 1, bool isBackup = false) { Y_ABORT_UNLESS(Max() - PathsInsideCount >= delta); PathsInsideCount += delta; if (isBackup) { Y_ABORT_UNLESS(Max() - BackupPathsCount >= delta); BackupPathsCount += delta; + } else { + counters->ChangePathCount(delta); } } - void DecPathsInside(ui64 delta = 1, bool isBackup = false) { + void DecPathsInside(IQuotaCounters* counters, ui64 delta = 1, bool isBackup = false) { Y_VERIFY_S(PathsInsideCount >= delta, "PathsInsideCount: " << PathsInsideCount << " delta: " << delta); PathsInsideCount -= delta; if (isBackup) { Y_VERIFY_S(BackupPathsCount >= delta, "BackupPathsCount: " << BackupPathsCount << " delta: " << delta); BackupPathsCount -= delta; + } else { + counters->ChangePathCount(-delta); } } @@ -1776,10 +1788,12 @@ struct TSubDomainInfo: TSimpleRefCount { return PrivateShards; } - void AddInternalShard(TShardIdx shardId, bool isBackup = false) { + void AddInternalShard(TShardIdx shardId, IQuotaCounters* counters, bool isBackup = false) { InternalShards.insert(shardId); if (isBackup) { BackupShards.insert(shardId); + } else { + counters->ChangeShardCount(1); } } @@ -1787,20 +1801,25 @@ struct TSubDomainInfo: TSimpleRefCount { return InternalShards; } - void AddInternalShards(const TTxState& txState, bool isBackup = false) { + void AddInternalShards(const TTxState& txState, IQuotaCounters* counters, bool isBackup = false) { for (auto txShard: txState.Shards) { if (txShard.Operation != TTxState::CreateParts) { continue; } - AddInternalShard(txShard.Idx, isBackup); + AddInternalShard(txShard.Idx, counters, isBackup); } } - void RemoveInternalShard(TShardIdx shardIdx) { + void RemoveInternalShard(TShardIdx shardIdx, IQuotaCounters* counters) { auto it = InternalShards.find(shardIdx); Y_VERIFY_S(it != InternalShards.end(), "shardIdx: " << shardIdx); InternalShards.erase(it); - BackupShards.erase(shardIdx); + + if (BackupShards.contains(shardIdx)) { + BackupShards.erase(shardIdx); + } else { + counters->ChangeShardCount(-1); + } } const THashSet& GetSequenceShards() const {