diff options
author | Sema Checherinda <checherinda@gmail.com> | 2022-07-05 19:02:38 +0300 |
---|---|---|
committer | Sema Checherinda <checherinda@gmail.com> | 2022-07-05 19:02:38 +0300 |
commit | 2e58e521c5b70e0d3c48de81bce959ac1e909acf (patch) | |
tree | cf5847a21267a5e7fab542bf52eba529801c29e3 | |
parent | 27f30d5d46d24717f4572cee2e663c4bdcd2e8d5 (diff) | |
download | ydb-2e58e521c5b70e0d3c48de81bce959ac1e909acf.tar.gz |
KIKIMR-15101 distinguish domainID and pathId for a domain
ref:6708ff5397a82b693219e437eba4c794aeeee672
40 files changed, 135 insertions, 125 deletions
diff --git a/ydb/core/tx/schemeshard/schemeshard__find_subdomain_path_id.cpp b/ydb/core/tx/schemeshard/schemeshard__find_subdomain_path_id.cpp index a28c46ee39a..5ae559ad6e3 100644 --- a/ydb/core/tx/schemeshard/schemeshard__find_subdomain_path_id.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__find_subdomain_path_id.cpp @@ -42,9 +42,9 @@ public: return true; } - auto domainId = path.DomainId(); + auto domainPathId = path.GetPathIdForDomain(); Result = MakeHolder<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult>( - tabletId, domainId.OwnerId, domainId.LocalPathId); + tabletId, domainPathId.OwnerId, domainPathId.LocalPathId); return true; } diff --git a/ydb/core/tx/schemeshard/schemeshard__init.cpp b/ydb/core/tx/schemeshard/schemeshard__init.cpp index b095639e36f..d9801507d8b 100644 --- a/ydb/core/tx/schemeshard/schemeshard__init.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__init.cpp @@ -3767,7 +3767,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> { } TPathElement::TPtr parent = Self->PathsById.at(path->ParentPathId); - TPathElement::TPtr inclusiveDomainPath = Self->PathsById.at(Self->ResolveDomainId(parent)); // take upper domain id info even when the path is domain by itself + TPathElement::TPtr inclusiveDomainPath = Self->PathsById.at(Self->ResolvePathIdForDomain(parent)); // take upper domain id info even when the path is domain by itself TSubDomainInfo::TPtr inclusivedomainInfo = Self->ResolveDomainInfo(parent); if (inclusiveDomainPath->IsExternalSubDomainRoot()) { @@ -3842,7 +3842,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> { continue; } auto volumeSpace = kv.second->GetVolumeSpace(); - auto domainDir = Self->PathsById.at(Self->ResolveDomainId(itPath->second)); + auto domainDir = Self->PathsById.at(Self->ResolvePathIdForDomain(itPath->second)); domainDir->ChangeVolumeSpaceBegin(volumeSpace, { }); } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation.cpp b/ydb/core/tx/schemeshard/schemeshard__operation.cpp index c220249094f..517e7f3eb06 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation.cpp @@ -525,7 +525,7 @@ TOperation::TConsumeQuotaResult TOperation::ConsumeQuota(const TTxTransaction& t return result; } - auto domainId = path.DomainId(); + auto domainPathId = path.GetPathIdForDomain(); auto domainInfo = path.DomainInfo(); if (!domainInfo->TryConsumeSchemeQuota(context.Ctx.Now())) { result.Status = NKikimrScheme::StatusQuotaExceeded; @@ -534,7 +534,7 @@ TOperation::TConsumeQuotaResult TOperation::ConsumeQuota(const TTxTransaction& t // Even if operation fails later we want to persist updated/consumed quotas NIceDb::TNiceDb db(context.GetTxc().DB); // write quotas directly in db even if operation fails - context.SS->PersistSubDomainSchemeQuotas(db, domainId, *domainInfo); + context.SS->PersistSubDomainSchemeQuotas(db, domainPathId, *domainInfo); return result; } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp index 3e252342f49..899be0d8e9d 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp @@ -305,7 +305,7 @@ public: const auto volumeChannelsResolved = context.SS->ResolveChannelsByPoolKinds( poolKinds, - path.DomainId(), + path.GetPathIdForDomain(), *volumeChannelsBinding); if (!volumeChannelsResolved) { @@ -316,7 +316,7 @@ public: context.SS->SetNbsChannelsParams(ecps, *volumeChannelsBinding); } else { const ui32 volumeProfileId = 0; - if (!context.SS->ResolveTabletChannels(volumeProfileId, path.DomainId(), *volumeChannelsBinding)) { + if (!context.SS->ResolveTabletChannels(volumeProfileId, path.GetPathIdForDomain(), *volumeChannelsBinding)) { result.SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding for volume with the profile"); return false; @@ -387,7 +387,7 @@ public: const auto partitionChannelsResolved = context.SS->ResolveChannelsByPoolKinds( partitionPoolKinds, - path.DomainId(), + path.GetPathIdForDomain(), *partitionChannelsBinding ); if (!partitionChannelsResolved) { @@ -613,7 +613,7 @@ public: auto newVolumeSpace = volume->GetVolumeSpace(); - auto domainDir = context.SS->PathsById.at(path.DomainId()); + auto domainDir = context.SS->PathsById.at(path.GetPathIdForDomain()); Y_VERIFY(domainDir); auto checkedSpaceChange = domainDir->CheckVolumeSpaceChange(newVolumeSpace, oldVolumeSpace, errStr); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp index 285203b8f62..64a1cb8ba45 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp @@ -538,7 +538,7 @@ bool TAlterFileStore::ProcessChannelProfiles( const auto storeChannelsResolved = context.SS->ResolveChannelsByPoolKinds( partitionPoolKinds, - path.DomainId(), + path.GetPathIdForDomain(), storeChannelsBinding); if (!storeChannelsResolved) { diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp index 479f962f23b..da870c9a5b6 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp @@ -584,7 +584,7 @@ public: // a tablet with local db which doesn't use extra channels in any way. const ui32 tabletProfileId = 0; TChannelsBindings tabletChannelsBinding; - if (!context.SS->ResolvePqChannels(tabletProfileId, path.DomainId(), tabletChannelsBinding)) { + if (!context.SS->ResolvePqChannels(tabletProfileId, path.GetPathIdForDomain(), tabletChannelsBinding)) { result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding for PQ with the storage pool"); return result; @@ -606,7 +606,7 @@ public: const auto resolved = context.SS->ResolveChannelsByPoolKinds( partitionPoolKinds, - path.DomainId(), + path.GetPathIdForDomain(), pqChannelsBinding); if (!resolved) { result->SetError(NKikimrScheme::StatusInvalidParameter, diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp index 805fa23a9cd..b7c1275ff88 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp @@ -287,7 +287,7 @@ public: } TChannelsBindings channelsBinding; - if (!context.SS->ResolveSolomonChannels(channelProfileId, path.DomainId(), channelsBinding)) { + if (!context.SS->ResolveSolomonChannels(channelProfileId, path.GetPathIdForDomain(), channelsBinding)) { result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding with the storage pool"); return result; } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_table.cpp index 33f05ffe89c..fec8cb34e68 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_table.cpp @@ -595,7 +595,7 @@ public: TBindingsRoomsChanges bindingChanges; if (context.SS->IsStorageConfigLogic(table)) { - if (!context.SS->GetBindingsRoomsChanges(path.DomainId(), table->GetPartitions(), alterData->PartitionConfigFull(), bindingChanges, errStr)) { + if (!context.SS->GetBindingsRoomsChanges(path.GetPathIdForDomain(), table->GetPartitions(), alterData->PartitionConfigFull(), bindingChanges, errStr)) { result->SetError(NKikimrScheme::StatusInvalidParameter, errStr); return result; } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_backup_restore_common.h b/ydb/core/tx/schemeshard/schemeshard__operation_backup_restore_common.h index b068a54cca1..cda438a963c 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_backup_restore_common.h +++ b/ydb/core/tx/schemeshard/schemeshard__operation_backup_restore_common.h @@ -90,26 +90,26 @@ public: static void Bill(TOperationId operationId, const TPathId& pathId, const TShardIdx& shardIdx, ui64 ru, TOperationContext& context) { const auto path = TPath::Init(pathId, context.SS); - const auto domainId = path.DomainId(); - const auto domain = TPath::Init(domainId, context.SS); + const auto pathIdForDomainId = path.GetPathIdForDomain(); + const auto domainPath = TPath::Init(pathIdForDomainId, context.SS); auto unableToMakeABill = [&](const TStringBuf reason) { LOG_WARN_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "Unable to make a bill" << ": kind# " << TKind::Name() << ", opId# " << operationId << ", reason# " << reason - << ", domain# " << domain.PathString() - << ", domainId# " << domainId + << ", domain# " << domainPath.PathString() + << ", domainPathId# " << pathIdForDomainId << ", IsDomainSchemeShard: " << context.SS->IsDomainSchemeShard << ", ParentDomainId: " << context.SS->ParentDomainId - << ", ResourcesDomainId: " << domain.DomainInfo()->GetResourcesDomainId()); + << ", ResourcesDomainId: " << domainPath.DomainInfo()->GetResourcesDomainId()); }; - if (!context.SS->IsServerlessDomain(domain)) { + if (!context.SS->IsServerlessDomain(domainPath)) { return unableToMakeABill("domain is not a serverless db"); } - const auto& attrs = domain.Base()->UserAttrs->Attrs; + const auto& attrs = domainPath.Base()->UserAttrs->Attrs; if (!attrs.contains("cloud_id")) { return unableToMakeABill("cloud_id not found in user attributes"); } @@ -143,8 +143,8 @@ public: LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "Make a bill" << ": kind# " << TKind::Name() << ", opId# " << operationId - << ", domain# " << domain.PathString() - << ", domainId# " << domainId + << ", domain# " << domainPath.PathString() + << ", domainPathId# " << pathIdForDomainId << ", record# " << billRecord); context.OnComplete.Send(NMetering::MakeMeteringServiceID(), diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_blob_depot.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_blob_depot.cpp index a0aef187a77..3cf5d639ff7 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_blob_depot.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_blob_depot.cpp @@ -318,7 +318,7 @@ namespace NKikimr::NSchemeShard { // bind channels to storage pools TChannelsBindings channelBindings; - if (!context.SS->ResolveChannelsByPoolKinds(storagePoolKinds, dstPath.DomainId(), channelBindings)) { + if (!context.SS->ResolveChannelsByPoolKinds(storagePoolKinds, dstPath.GetPathIdForDomain(), channelBindings)) { return MakeHolder<TProposeResponse>(NKikimrScheme::StatusInvalidParameter, txId, ssId, "Unable to construct channel binding with the storage pool"); } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_common.h b/ydb/core/tx/schemeshard/schemeshard__operation_common.h index bd306d296a5..ef3dbf84f64 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_common.h +++ b/ydb/core/tx/schemeshard/schemeshard__operation_common.h @@ -672,7 +672,7 @@ public: THolder<TEvHive::TEvCreateTablet> ev = MakeHolder<TEvHive::TEvCreateTablet>(ui64(shardIdx.GetOwnerId()), ui64(shardIdx.GetLocalId()), shard.TabletType, shard.BindedChannels); - TPathId domainId = context.SS->ResolveDomainId(targetPath); + TPathId domainId = context.SS->ResolvePathIdForDomain(targetPath); TPathElement::TPtr domainEl = context.SS->PathsById.at(domainId); auto objectDomain = ev->Record.MutableObjectDomain(); @@ -1381,7 +1381,7 @@ public: volume->FinishAlter(); auto newVolumeSpace = volume->GetVolumeSpace(); // Decrease in occupied space is appled on tx finish - auto domainDir = context.SS->PathsById.at(context.SS->ResolveDomainId(path)); + auto domainDir = context.SS->PathsById.at(context.SS->ResolvePathIdForDomain(path)); Y_VERIFY(domainDir); domainDir->ChangeVolumeSpaceCommit(newVolumeSpace, oldVolumeSpace); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp index b1439387978..5e6612a9464 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp @@ -70,7 +70,7 @@ public: "CopyTable paritition counts don't match"); const ui64 dstSchemaVersion = NEW_TABLE_ALTER_VERSION; - const ui64 subDomainPathId = context.SS->ResolveDomainId(txState->TargetPathId).LocalPathId; + const ui64 subDomainPathId = context.SS->ResolvePathIdForDomain(txState->TargetPathId).LocalPathId; for (ui32 i = 0; i < dstTableInfo->GetPartitions().size(); ++i) { TShardIdx srcShardIdx = srcTableInfo->GetPartitions()[i].ShardIdx; @@ -439,10 +439,10 @@ public: auto domainInfo = parent.DomainInfo(); bool transactionSupport = domainInfo->IsSupportTransactions(); if (domainInfo->GetAlter()) { - TPathId domainId = parent.DomainId(); - Y_VERIFY(context.SS->PathsById.contains(domainId)); - TPathElement::TPtr domain = context.SS->PathsById.at(domainId); - Y_VERIFY(domain->PlannedToCreate() || domain->HasActiveChanges()); + TPathId domainPathId = parent.GetPathIdForDomain(); + Y_VERIFY(context.SS->PathsById.contains(domainPathId)); + TPathElement::TPtr domainPath = context.SS->PathsById.at(domainPathId); + Y_VERIFY(domainPath->PlannedToCreate() || domainPath->HasActiveChanges()); transactionSupport |= domainInfo->GetAlter()->IsSupportTransactions(); } @@ -523,7 +523,7 @@ public: THashMap<ui32, ui32> familyRooms; storageRooms.emplace_back(0); - if (!context.SS->GetBindingsRooms(dstPath.DomainId(), tableInfo->PartitionConfig(), storageRooms, familyRooms, channelsBinding, errStr)) { + if (!context.SS->GetBindingsRooms(dstPath.GetPathIdForDomain(), tableInfo->PartitionConfig(), storageRooms, familyRooms, channelsBinding, errStr)) { errStr = TString("database doesn't have required storage pools to create tablet with storage config, details: ") + errStr; result->SetError(NKikimrScheme::StatusInvalidParameter, errStr); return result; @@ -539,8 +539,8 @@ public: protoFamily->SetId(familyRoom.first); protoFamily->SetRoom(familyRoom.second); } - } else if (context.SS->IsCompatibleChannelProfileLogic(dstPath.DomainId(), tableInfo)) { - if (!context.SS->GetChannelsBindings(dstPath.DomainId(), tableInfo, channelsBinding, errStr)) { + } else if (context.SS->IsCompatibleChannelProfileLogic(dstPath.GetPathIdForDomain(), tableInfo)) { + if (!context.SS->GetChannelsBindings(dstPath.GetPathIdForDomain(), tableInfo, channelsBinding, errStr)) { result->SetError(NKikimrScheme::StatusInvalidParameter, errStr); return result; } @@ -552,7 +552,7 @@ public: context.MemChanges.GrabPath(context.SS, parent.Base()->PathId); context.MemChanges.GrabPath(context.SS, srcPath.Base()->PathId); context.MemChanges.GrabNewTxState(context.SS, OperationId); - context.MemChanges.GrabDomain(context.SS, parent.DomainId()); + context.MemChanges.GrabDomain(context.SS, parent.GetPathIdForDomain()); context.MemChanges.GrabNewTable(context.SS, allocatedPathId); context.DbChanges.PersistPath(allocatedPathId); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp index 10e6de9f029..ea2c10eb130 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp @@ -314,7 +314,7 @@ public: } return context.SS->ResolveChannelsByPoolKinds( poolKinds, - dstPath.DomainId(), + dstPath.GetPathIdForDomain(), binding); }; @@ -358,14 +358,14 @@ public: context.SS->SetNbsChannelsParams(ecps, volumeChannelsBinding); } else { const ui32 volumeProfileId = 0; - if (!context.SS->ResolveTabletChannels(volumeProfileId, dstPath.DomainId(), volumeChannelsBinding)) { + if (!context.SS->ResolveTabletChannels(volumeProfileId, dstPath.GetPathIdForDomain(), volumeChannelsBinding)) { result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding for volume with the profile"); return result; } } - auto domainDir = context.SS->PathsById.at(dstPath.DomainId()); + auto domainDir = context.SS->PathsById.at(dstPath.GetPathIdForDomain()); Y_VERIFY(domainDir); auto volumeSpace = volume->GetVolumeSpace(); 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 df595ee20be..49d5747c94d 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_cdc_stream.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_cdc_stream.cpp @@ -233,7 +233,7 @@ public: context.MemChanges.GrabNewPath(context.SS, pathId); context.MemChanges.GrabPath(context.SS, tablePath.Base()->PathId); context.MemChanges.GrabNewTxState(context.SS, OperationId); - context.MemChanges.GrabDomain(context.SS, streamPath.DomainId()); + context.MemChanges.GrabDomain(context.SS, streamPath.GetPathIdForDomain()); context.MemChanges.GrabNewCdcStream(context.SS, pathId); context.DbChanges.PersistPath(pathId); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp index 8129ff50f9e..b608520af13 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp @@ -184,10 +184,10 @@ public: } } - auto domainId = parentPath.DomainId(); - Y_VERIFY(context.SS->PathsById.contains(domainId)); - Y_VERIFY(context.SS->SubDomains.contains(domainId)); - if (domainId != context.SS->RootPathId()) { + auto domainPathId = parentPath.GetPathIdForDomain(); + Y_VERIFY(context.SS->PathsById.contains(domainPathId)); + Y_VERIFY(context.SS->SubDomains.contains(domainPathId)); + if (domainPathId != context.SS->RootPathId()) { result->SetError(NKikimrScheme::StatusNameConflict, "Nested subdomains is forbidden"); return result; } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp index 9c94b2654fe..54b9125fd09 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp @@ -405,7 +405,7 @@ THolder<TProposeResponse> TCreateFileStore::Propose( TChannelsBindings storeChannelBindings; const auto storeChannelsResolved = context.SS->ResolveChannelsByPoolKinds( storePoolKinds, - dstPath.DomainId(), + dstPath.GetPathIdForDomain(), storeChannelBindings ); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_indexed_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_indexed_table.cpp index 5beb0a88488..b115d0f22e5 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_indexed_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_indexed_table.cpp @@ -67,8 +67,8 @@ TVector<ISubOperationBase::TPtr> CreateIndexedTable(TOperationId nextId, const T LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TCreateTableIndex construct operation " << " table path: " << baseTablePath.PathString() - << " domain path id: " << baseTablePath.DomainId() - << " domain path: " << TPath::Init(baseTablePath.DomainId(), context.SS).PathString() + << " domain path id: " << baseTablePath.GetPathIdForDomain() + << " domain path: " << TPath::Init(baseTablePath.GetPathIdForDomain(), context.SS).PathString() << " shardsToCreate: " << shardsToCreate << " GetShardsInside: " << domainInfo->GetShardsInside() << " MaxShards: " << domainInfo->GetSchemeLimits().MaxShards); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp index ae409a2178c..f44ee9e0a2a 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp @@ -401,7 +401,7 @@ public: const ui32 kesusProfileId = 0; TChannelsBindings kesusChannelsBindings; - if (!context.SS->ResolveTabletChannels(kesusProfileId, dstPath.DomainId(), kesusChannelsBindings)) { + if (!context.SS->ResolveTabletChannels(kesusProfileId, dstPath.GetPathIdForDomain(), kesusChannelsBindings)) { result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding for coordination node with the storage pool"); return result; diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp index cfb26e14fce..ad91e488ecb 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp @@ -641,7 +641,7 @@ public: // Construct channels bindings for columnshards TChannelsBindings channelsBindings; - if (!context.SS->GetOlapChannelsBindings(dstPath.DomainId(), storeInfo->Description.GetStorageConfig(), channelsBindings, errStr)) { + if (!context.SS->GetOlapChannelsBindings(dstPath.GetPathIdForDomain(), storeInfo->Description.GetStorageConfig(), channelsBindings, errStr)) { result->SetError(NKikimrScheme::StatusInvalidParameter, errStr); return result; } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp index b90988b624e..f5976ca648c 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp @@ -430,7 +430,7 @@ public: // a tablet with local db which doesn't use extra channels in any way. const ui32 tabletProfileId = 0; TChannelsBindings tabletChannelsBinding; - if (!context.SS->ResolvePqChannels(tabletProfileId, dstPath.DomainId(), tabletChannelsBinding)) { + if (!context.SS->ResolvePqChannels(tabletProfileId, dstPath.GetPathIdForDomain(), tabletChannelsBinding)) { result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding for PQ with the storage pool"); return result; @@ -459,7 +459,7 @@ public: const auto resolved = context.SS->ResolveChannelsByPoolKinds( partitionPoolKinds, - dstPath.DomainId(), + dstPath.GetPathIdForDomain(), pqChannelsBinding); if (!resolved) { result->SetError(NKikimrScheme::StatusInvalidParameter, diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp index 98b4f5d2d59..d61c5f11343 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp @@ -291,7 +291,7 @@ public: } } - const auto domainId = parentPath.DomainId(); + const auto domainPathId = parentPath.GetPathIdForDomain(); auto domainInfo = parentPath.DomainInfo(); const ui64 shardsToCreate = domainInfo->GetReplicationControllers().empty(); @@ -343,7 +343,7 @@ public: TChannelsBindings channelsBindings; if (shardsToCreate) { - if (!context.SS->ResolveTabletChannels(0, domainId, channelsBindings)) { + if (!context.SS->ResolveTabletChannels(0, domainPathId, channelsBindings)) { result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding for replication controller with the storage pool"); return result; @@ -367,15 +367,15 @@ public: if (shardsToCreate) { const auto shardIdx = context.SS->RegisterShardInfo( - TShardInfo::ReplicationControllerInfo(OperationId.GetTxId(), domainId) + TShardInfo::ReplicationControllerInfo(OperationId.GetTxId(), domainPathId) .WithBindedChannels(channelsBindings)); context.SS->TabletCounters->Simple()[COUNTER_REPLICATION_CONTROLLER_COUNT].Add(1); txState.Shards.emplace_back(shardIdx, ETabletType::ReplicationController, TTxState::CreateParts); txState.State = TTxState::CreateParts; - Y_VERIFY(context.SS->PathsById.contains(domainId)); - context.SS->PathsById.at(domainId)->IncShardsInside(); + Y_VERIFY(context.SS->PathsById.contains(domainPathId)); + context.SS->PathsById.at(domainPathId)->IncShardsInside(); domainInfo->AddInternalShard(shardIdx); domainInfo->AddReplicationController(shardIdx); @@ -417,7 +417,7 @@ public: const TShardInfo& shardInfo = context.SS->ShardInfos.at(shard.Idx); if (shard.Operation == TTxState::CreateParts) { - context.SS->PersistShardMapping(db, shard.Idx, InvalidTabletId, domainId, OperationId.GetTxId(), shard.TabletType); + context.SS->PersistShardMapping(db, shard.Idx, InvalidTabletId, domainPathId, OperationId.GetTxId(), shard.TabletType); context.SS->PersistChannelsBinding(db, shard.Idx, shardInfo.BindedChannels); } } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp index c0412276691..d2c169f4320 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp @@ -325,7 +325,7 @@ public: } TChannelsBindings channelsBinding; - if (!context.SS->ResolveRtmrChannels(dstPath.DomainId(), channelsBinding)) { + if (!context.SS->ResolveRtmrChannels(dstPath.GetPathIdForDomain(), channelsBinding)) { result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding with the storage pool"); return result; } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp index b8578bd228e..f66755dce1e 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp @@ -356,7 +356,7 @@ public: } } - auto domainId = parentPath.DomainId(); + auto domainPathId = parentPath.GetPathIdForDomain(); auto domainInfo = parentPath.DomainInfo(); // TODO: maybe select from several shards @@ -428,7 +428,7 @@ public: const ui32 profileId = 0; TChannelsBindings channelsBindings; if (shardsToCreate) { - if (!context.SS->ResolveTabletChannels(profileId, dstPath.DomainId(), channelsBindings)) { + if (!context.SS->ResolveTabletChannels(profileId, dstPath.GetPathIdForDomain(), channelsBindings)) { result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding for sequence shard with the storage pool"); return result; @@ -459,12 +459,12 @@ public: if (shardsToCreate) { sequenceShard = context.SS->RegisterShardInfo( - TShardInfo::SequenceShardInfo(OperationId.GetTxId(), domainId) + TShardInfo::SequenceShardInfo(OperationId.GetTxId(), domainPathId) .WithBindedChannels(channelsBindings)); context.SS->TabletCounters->Simple()[COUNTER_SEQUENCESHARD_COUNT].Add(1); txState.Shards.emplace_back(sequenceShard, ETabletType::SequenceShard, TTxState::CreateParts); txState.State = TTxState::CreateParts; - context.SS->PathsById.at(domainId)->IncShardsInside(); + context.SS->PathsById.at(domainPathId)->IncShardsInside(); domainInfo->AddInternalShard(sequenceShard); domainInfo->AddSequenceShard(sequenceShard); } else { @@ -506,7 +506,7 @@ public: for (auto shard : txState.Shards) { if (shard.Operation == TTxState::CreateParts) { context.SS->PersistChannelsBinding(db, shard.Idx, context.SS->ShardInfos.at(shard.Idx).BindedChannels); - context.SS->PersistShardMapping(db, shard.Idx, InvalidTabletId, domainId, OperationId.GetTxId(), shard.TabletType); + context.SS->PersistShardMapping(db, shard.Idx, InvalidTabletId, domainPathId, OperationId.GetTxId(), shard.TabletType); } } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp index 4356554f2f9..6aa4b20d304 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp @@ -360,7 +360,7 @@ public: const bool adoptingTablets = solomonDescription.AdoptedPartitionsSize() > 0; TChannelsBindings channelsBinding; - if (!adoptingTablets && !context.SS->ResolveSolomonChannels(channelProfileId, dstPath.DomainId(), channelsBinding)) { + if (!adoptingTablets && !context.SS->ResolveSolomonChannels(channelProfileId, dstPath.GetPathIdForDomain(), channelsBinding)) { result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding with the storage pool"); return result; } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp index 8aa1ad7de07..2d9d180e36e 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp @@ -230,10 +230,10 @@ public: return result; } - auto domainId = parentPath.DomainId(); - Y_VERIFY(context.SS->PathsById.contains(domainId)); - Y_VERIFY(context.SS->SubDomains.contains(domainId)); - if (domainId != context.SS->RootPathId()) { + auto domainPathId = parentPath.GetPathIdForDomain(); + Y_VERIFY(context.SS->PathsById.contains(domainPathId)); + Y_VERIFY(context.SS->SubDomains.contains(domainPathId)); + if (domainPathId != context.SS->RootPathId()) { result->SetError(NKikimrScheme::StatusNameConflict, "Nested subdomains is forbidden"); return result; } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp index 4db21b6816b..0d111051cd9 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp @@ -171,7 +171,7 @@ public: txState->ClearShardsInProgress(); - const ui64 subDomainPathId = context.SS->ResolveDomainId(txState->TargetPathId).LocalPathId; + const ui64 subDomainPathId = context.SS->ResolvePathIdForDomain(txState->TargetPathId).LocalPathId; for (ui32 i = 0; i < txState->Shards.size(); ++i) { TShardIdx shardIdx = txState->Shards[i].Idx; @@ -526,9 +526,9 @@ public: auto domainInfo = parentPath.DomainInfo(); bool transactionSupport = domainInfo->IsSupportTransactions(); if (domainInfo->GetAlter()) { - TPathId domainId = dstPath.DomainId(); - Y_VERIFY(context.SS->PathsById.contains(domainId)); - TPathElement::TPtr domain = context.SS->PathsById.at(domainId); + TPathId domainPathId = dstPath.GetPathIdForDomain(); + Y_VERIFY(context.SS->PathsById.contains(domainPathId)); + TPathElement::TPtr domain = context.SS->PathsById.at(domainPathId); Y_VERIFY(domain->PlannedToCreate() || domain->HasActiveChanges()); transactionSupport |= domainInfo->GetAlter()->IsSupportTransactions(); @@ -583,7 +583,7 @@ public: TVector<TStorageRoom> storageRooms; THashMap<ui32, ui32> familyRooms; storageRooms.emplace_back(0); - if (!context.SS->GetBindingsRooms(dstPath.DomainId(), tableInfo->PartitionConfig(), storageRooms, familyRooms, channelsBinding, errStr)) { + if (!context.SS->GetBindingsRooms(dstPath.GetPathIdForDomain(), tableInfo->PartitionConfig(), storageRooms, familyRooms, channelsBinding, errStr)) { errStr = TString("database doesn't have required storage pools to create tablet with storage config, details: ") + errStr; result->SetError(NKikimrScheme::StatusInvalidParameter, errStr); return result; @@ -599,8 +599,8 @@ public: protoFamily->SetId(familyRoom.first); protoFamily->SetRoom(familyRoom.second); } - } else if (context.SS->IsCompatibleChannelProfileLogic(dstPath.DomainId(), tableInfo)) { - if (!context.SS->GetChannelsBindings(dstPath.DomainId(), tableInfo, channelsBinding, errStr)) { + } else if (context.SS->IsCompatibleChannelProfileLogic(dstPath.GetPathIdForDomain(), tableInfo)) { + if (!context.SS->GetChannelsBindings(dstPath.GetPathIdForDomain(), tableInfo, channelsBinding, errStr)) { result->SetError(NKikimrScheme::StatusInvalidParameter, errStr); return result; } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp index d6e119676fb..69efddbf058 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp @@ -100,7 +100,7 @@ public: TBlockStoreVolumeInfo::TPtr volume = context.SS->BlockStoreVolumes.at(pathId); auto volumeSpace = volume->GetVolumeSpace(); - auto domainDir = context.SS->PathsById.at(context.SS->ResolveDomainId(path)); + auto domainDir = context.SS->PathsById.at(context.SS->ResolvePathIdForDomain(path)); domainDir->ChangeVolumeSpaceCommit({ }, volumeSpace); if (!AppData()->DisableSchemeShardCleanupOnDropForTest) { diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp index fe3c0b867ea..92634111057 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp @@ -227,7 +227,7 @@ public: context.MemChanges.GrabNewPath(context.SS, allocatedPathId); context.MemChanges.GrabPath(context.SS, parentPath.Base()->PathId); context.MemChanges.GrabNewTxState(context.SS, OperationId); - context.MemChanges.GrabDomain(context.SS, parentPath.DomainId()); + context.MemChanges.GrabDomain(context.SS, parentPath.GetPathIdForDomain()); context.DbChanges.PersistPath(allocatedPathId); context.DbChanges.PersistPath(parentPath.Base()->PathId); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp index 6b1b99425e0..6716e81d754 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp @@ -121,7 +121,7 @@ public: const ui64 alterVersion = (*tableInfo)->AlterVersion; - const ui64 subDomainPathId = context.SS->ResolveDomainId(txState->TargetPathId).LocalPathId; + const ui64 subDomainPathId = context.SS->ResolvePathIdForDomain(txState->TargetPathId).LocalPathId; for (const auto& shard: txState->Shards) { // Skip src shard @@ -300,7 +300,7 @@ public: if (!tableInfo->IsBackup && !tableInfo->IsShardsStatsDetached()) { auto newAggrStats = tableInfo->GetStats().Aggregated; - auto subDomainId = context.SS->ResolveDomainId(tableId); + auto subDomainId = context.SS->ResolvePathIdForDomain(tableId); auto subDomainInfo = context.SS->ResolveDomainInfo(tableId); subDomainInfo->AggrDiskSpaceUsage(context.SS, newAggrStats, oldAggrStats); if (subDomainInfo->CheckDiskSpaceQuotas(context.SS)) { @@ -904,7 +904,7 @@ public: THashMap<ui32, ui32> familyRooms; storageRooms.emplace_back(0); - if (!context.SS->GetBindingsRooms(path.DomainId(), tableInfo->PartitionConfig(), storageRooms, familyRooms, channelsBinding, errStr)) { + if (!context.SS->GetBindingsRooms(path.GetPathIdForDomain(), tableInfo->PartitionConfig(), storageRooms, familyRooms, channelsBinding, errStr)) { errStr = TString("database doesn't have required storage pools to create tablet with storage config, details: ") + errStr; result->SetError(NKikimrScheme::StatusInvalidParameter, errStr); return result; @@ -919,8 +919,8 @@ public: protoFamily->SetId(familyRoom.first); protoFamily->SetRoom(familyRoom.second); } - } else if (context.SS->IsCompatibleChannelProfileLogic(path.DomainId(), tableInfo)) { - if (!context.SS->GetChannelsBindings(path.DomainId(), tableInfo, channelsBinding, errStr)) { + } else if (context.SS->IsCompatibleChannelProfileLogic(path.GetPathIdForDomain(), tableInfo)) { + if (!context.SS->GetChannelsBindings(path.GetPathIdForDomain(), tableInfo, channelsBinding, errStr)) { result->SetError(NKikimrScheme::StatusInvalidParameter, errStr); return result; } @@ -961,7 +961,7 @@ public: auto guard = context.DbGuard(); context.MemChanges.GrabNewTxState(context.SS, OperationId); - context.MemChanges.GrabDomain(context.SS, path.DomainId()); + context.MemChanges.GrabDomain(context.SS, path.GetPathIdForDomain()); context.MemChanges.GrabPath(context.SS, path->PathId); context.MemChanges.GrabTable(context.SS, path->PathId); diff --git a/ydb/core/tx/schemeshard/schemeshard__table_stats.cpp b/ydb/core/tx/schemeshard/schemeshard__table_stats.cpp index eea4325f986..5b1d3303473 100644 --- a/ydb/core/tx/schemeshard/schemeshard__table_stats.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__table_stats.cpp @@ -279,7 +279,7 @@ bool TTxStorePartitionStats::PersistSingleStats(TTransactionContext& txc, const } if (updateSubdomainInfo) { - auto subDomainId = Self->ResolveDomainId(pathId); + auto subDomainId = Self->ResolvePathIdForDomain(pathId); auto subDomainInfo = Self->ResolveDomainInfo(pathId); subDomainInfo->AggrDiskSpaceUsage(Self, newAggrStats, oldAggrStats); if (subDomainInfo->CheckDiskSpaceQuotas(Self)) { diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index__cancel.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index__cancel.cpp index f68e76634a0..64f6af6b41a 100644 --- a/ydb/core/tx/schemeshard/schemeshard_build_index__cancel.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_build_index__cancel.cpp @@ -45,7 +45,7 @@ public: TStringBuilder() << "Database <" << record.GetDatabaseName() << "> not found" ); } - const TPathId domainId = database.DomainId(); + const TPathId domainPathId = database.GetPathIdForDomain(); TIndexBuildId indexBuildId = TIndexBuildId(record.GetIndexBuildId()); @@ -58,7 +58,7 @@ public: } TIndexBuildInfo::TPtr indexBuildInfo = Self->IndexBuilds.at(indexBuildId); - if (indexBuildInfo->DomainPathId != domainId) { + if (indexBuildInfo->DomainPathId != domainPathId) { return Reply( std::move(response), Ydb::StatusIds::NOT_FOUND, diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index__create.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index__create.cpp index 8a94bce2981..4d5c36591e8 100644 --- a/ydb/core/tx/schemeshard/schemeshard_build_index__create.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_build_index__create.cpp @@ -108,12 +108,12 @@ public: NIceDb::TNiceDb db(txc.DB); - auto subDomainId = domainPath.DomainId(); + auto subDomainPathId = domainPath.GetPathIdForDomain(); auto subDomainInfo = domainPath.DomainInfo(); bool quotaAcquired = subDomainInfo->TryConsumeSchemeQuota(ctx.Now()); // We need to persist updated/consumed quotas even if operation fails for other reasons - Self->PersistSubDomainSchemeQuotas(db, subDomainId, *subDomainInfo); + Self->PersistSubDomainSchemeQuotas(db, subDomainPathId, *subDomainInfo); if (!quotaAcquired) { return Reply( diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index__forget.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index__forget.cpp index 10ac85c8a01..b6ec902e85b 100644 --- a/ydb/core/tx/schemeshard/schemeshard_build_index__forget.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_build_index__forget.cpp @@ -44,7 +44,7 @@ public: TStringBuilder() << "Database <" << record.GetDatabaseName() << "> not found" ); } - const TPathId domainId = database.DomainId(); + const TPathId domainPathId = database.GetPathIdForDomain(); TIndexBuildId indexBuildId = TIndexBuildId(record.GetIndexBuildId()); @@ -57,7 +57,7 @@ public: } TIndexBuildInfo::TPtr indexBuildInfo = Self->IndexBuilds.at(indexBuildId); - if (indexBuildInfo->DomainPathId != domainId) { + if (indexBuildInfo->DomainPathId != domainPathId) { return Reply( std::move(response), Ydb::StatusIds::NOT_FOUND, diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index__get.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index__get.cpp index ad6f5d01a48..d0657e40c93 100644 --- a/ydb/core/tx/schemeshard/schemeshard_build_index__get.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_build_index__get.cpp @@ -44,7 +44,7 @@ public: TStringBuilder() << "Database <" << record.GetDatabaseName() << "> not found" ); } - const TPathId domainId = database.DomainId(); + const TPathId domainPathId = database.GetPathIdForDomain(); TIndexBuildId indexBuildId = TIndexBuildId(record.GetIndexBuildId()); @@ -57,7 +57,7 @@ public: } TIndexBuildInfo::TPtr indexBuildInfo = Self->IndexBuilds.at(indexBuildId); - if (indexBuildInfo->DomainPathId != domainId) { + if (indexBuildInfo->DomainPathId != domainPathId) { return Reply( std::move(response), Ydb::StatusIds::BAD_REQUEST, diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index__list.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index__list.cpp index f42e8542a79..b6ceeeeee6e 100644 --- a/ydb/core/tx/schemeshard/schemeshard_build_index__list.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_build_index__list.cpp @@ -49,7 +49,7 @@ public: TStringBuilder() << "Database <" << record.GetDatabaseName() << "> not found" ); } - const TPathId domainId = database.DomainId(); + const TPathId domainPathId = database.GetPathIdForDomain(); ui64 page = DefaultPage; if (record.GetPageToken() && !TryFromString(record.GetPageToken(), page)) { @@ -66,7 +66,7 @@ public: auto it = Self->IndexBuilds.begin(); ui64 skip = (page - 1) * pageSize; while ((it != Self->IndexBuilds.end()) && skip) { - if (it->second->DomainPathId == domainId) { + if (it->second->DomainPathId == domainPathId) { --skip; } ++it; @@ -77,7 +77,7 @@ public: ui64 size = 0; while ((it != Self->IndexBuilds.end()) && size < pageSize) { - if (it->second->DomainPathId == domainId) { + if (it->second->DomainPathId == domainPathId) { Fill(*respRecord.MutableEntries()->Add(), it->second); ++size; } diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.cpp b/ydb/core/tx/schemeshard/schemeshard_impl.cpp index ea1bad65c46..2891485f1a9 100644 --- a/ydb/core/tx/schemeshard/schemeshard_impl.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_impl.cpp @@ -981,13 +981,13 @@ bool TSchemeShard::TabletResolveChannelsDetails(ui32 profileId, const TChannelPr return true; } -TPathId TSchemeShard::ResolveDomainId(TPathId pathId) const { +TPathId TSchemeShard::ResolvePathIdForDomain(TPathId pathId) const { Y_VERIFY(pathId != InvalidPathId); Y_VERIFY(PathsById.contains(pathId)); - return ResolveDomainId(PathsById.at(pathId)); + return ResolvePathIdForDomain(PathsById.at(pathId)); } -TPathId TSchemeShard::ResolveDomainId(TPathElement::TPtr pathEl) const { +TPathId TSchemeShard::ResolvePathIdForDomain(TPathElement::TPtr pathEl) const { TPathId domainId = pathEl->IsDomainRoot() ? pathEl->PathId : pathEl->DomainPathId; @@ -1002,18 +1002,24 @@ TSubDomainInfo::TPtr TSchemeShard::ResolveDomainInfo(TPathId pathId) const { } TSubDomainInfo::TPtr TSchemeShard::ResolveDomainInfo(TPathElement::TPtr pathEl) const { - TPathId domainId = ResolveDomainId(pathEl); + TPathId domainId = ResolvePathIdForDomain(pathEl); Y_VERIFY(SubDomains.contains(domainId)); auto info = SubDomains.at(domainId); Y_VERIFY(info); return info; } +TPathId TSchemeShard::GetDomainKey(TPathElement::TPtr pathEl) const { + auto pathIdForDomain = ResolvePathIdForDomain(pathEl); + TPathElement::TPtr domainPathElement = PathsById.at(pathIdForDomain); + Y_VERIFY(domainPathElement); + return domainPathElement->IsRoot() ? ParentDomainId : pathIdForDomain; +} + TPathId TSchemeShard::GetDomainKey(TPathId pathId) const { - auto domainId = ResolveDomainId(pathId); - TPathElement::TPtr domainElement = PathsById.at(domainId); - Y_VERIFY(domainElement); - return domainElement->IsRoot() ? ParentDomainId : domainId; + Y_VERIFY(pathId != InvalidPathId); + Y_VERIFY(PathsById.contains(pathId)); + return GetDomainKey(PathsById.at(pathId)); } const NKikimrSubDomains::TProcessingParams &TSchemeShard::SelectProcessingPrarams(TPathId id) const { @@ -3287,7 +3293,7 @@ void TSchemeShard::PersistRemoveTable(NIceDb::TNiceDb& db, TPathId pathId, const } if (!tableInfo->IsBackup && !tableInfo->IsShardsStatsDetached()) { - auto subDomainId = ResolveDomainId(pathId); + auto subDomainId = ResolvePathIdForDomain(pathId); auto subDomainInfo = ResolveDomainInfo(pathId); subDomainInfo->AggrDiskSpaceUsage(this, TPartitionStats(), tableInfo->GetStats().Aggregated); if (subDomainInfo->CheckDiskSpaceQuotas(this)) { @@ -4380,15 +4386,15 @@ void TSchemeShard::MarkAsMigrated(TPathElement::TPtr node, const TActorContext & "Mark as Migrated path id " << node->PathId); Y_VERIFY(!node->Dropped()); - Y_VERIFY_S(PathsById.contains(ResolveDomainId(node)), + Y_VERIFY_S(PathsById.contains(ResolvePathIdForDomain(node)), "details:" << " node->PathId: " << node->PathId << ", node->DomainPathId: " << node->DomainPathId); - Y_VERIFY_S(PathsById.at(ResolveDomainId(node))->IsExternalSubDomainRoot(), + Y_VERIFY_S(PathsById.at(ResolvePathIdForDomain(node))->IsExternalSubDomainRoot(), "details:" - << " pathId: " << ResolveDomainId(node) - << ", pathType: " << NKikimrSchemeOp::EPathType_Name(PathsById.at(ResolveDomainId(node))->PathType)); + << " pathId: " << ResolvePathIdForDomain(node) + << ", pathType: " << NKikimrSchemeOp::EPathType_Name(PathsById.at(ResolvePathIdForDomain(node))->PathType)); node->PathState = TPathElement::EPathState::EPathStateMigrated; diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.h b/ydb/core/tx/schemeshard/schemeshard_impl.h index 71885b07ad5..600943a9b76 100644 --- a/ydb/core/tx/schemeshard/schemeshard_impl.h +++ b/ydb/core/tx/schemeshard/schemeshard_impl.h @@ -467,11 +467,12 @@ public: const TTableInfo* GetMainTableForIndex(TPathId indexTableId) const; - TPathId ResolveDomainId(TPathId pathId) const; - TPathId ResolveDomainId(TPathElement::TPtr pathEl) const; + TPathId ResolvePathIdForDomain(TPathId pathId) const; + TPathId ResolvePathIdForDomain(TPathElement::TPtr pathEl) const; TSubDomainInfo::TPtr ResolveDomainInfo(TPathId pathId) const; TSubDomainInfo::TPtr ResolveDomainInfo(TPathElement::TPtr pathEl) const; + TPathId GetDomainKey(TPathElement::TPtr pathEl) const; TPathId GetDomainKey(TPathId pathId) const; const NKikimrSubDomains::TProcessingParams& SelectProcessingPrarams(TPathId id) const; diff --git a/ydb/core/tx/schemeshard/schemeshard_path.cpp b/ydb/core/tx/schemeshard/schemeshard_path.cpp index 938cffda4d5..1a4c6aa511b 100644 --- a/ydb/core/tx/schemeshard/schemeshard_path.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_path.cpp @@ -130,7 +130,7 @@ const TPath::TChecker &TPath::TChecker::NotUnderDomainUpgrade(TPath::TChecker::E Failed = true; Status = status; Explain << "path is being upgraded as part of subdomain right now" - << ", domainId: " << Path.DomainId(); + << ", domainId: " << Path.GetPathIdForDomain(); return *this; } @@ -685,7 +685,7 @@ const TPath::TChecker& TPath::TChecker::IsTheSameDomain(const TPath &another, TP return *this; } - if (Path.DomainId() == another.DomainId()) { + if (Path.GetPathIdForDomain() == another.GetPathIdForDomain()) { return *this; } @@ -1154,11 +1154,17 @@ TSubDomainInfo::TPtr TPath::DomainInfo() const { return SS->ResolveDomainInfo(Elements.back()); } -TPathId TPath::DomainId() const { +TPathId TPath::GetPathIdForDomain() const { Y_VERIFY(!IsEmpty()); Y_VERIFY(Elements.size()); - return SS->ResolveDomainId(Elements.back()); + return SS->ResolvePathIdForDomain(Elements.back()); +} + +TPathId TPath::GetDomainKey() const { + Y_VERIFY(IsResolved()); + + return SS->GetDomainKey(Elements.back()); } bool TPath::IsDomain() const { @@ -1390,7 +1396,7 @@ bool TPath::IsUnderDomainUpgrade() const { return false; } - return SS->PathsById.at(DomainId())->PathState == NKikimrSchemeOp::EPathState::EPathStateUpgrade; + return SS->PathsById.at(GetPathIdForDomain())->PathState == NKikimrSchemeOp::EPathState::EPathStateUpgrade; } bool TPath::IsUnderCopying() const { diff --git a/ydb/core/tx/schemeshard/schemeshard_path.h b/ydb/core/tx/schemeshard/schemeshard_path.h index a95aeeb4a36..2a43e66d509 100644 --- a/ydb/core/tx/schemeshard/schemeshard_path.h +++ b/ydb/core/tx/schemeshard/schemeshard_path.h @@ -121,7 +121,8 @@ public: TPath& RiseUntilExisted(); TPath FirstExistedParent() const; TSubDomainInfo::TPtr DomainInfo() const; - TPathId DomainId() const; + TPathId GetPathIdForDomain() const; + TPathId GetDomainKey() const; bool IsDomain() const; TPath& Dive(const TString& name); TPath Child(const TString& name) const; diff --git a/ydb/core/tx/schemeshard/schemeshard_path_describer.cpp b/ydb/core/tx/schemeshard/schemeshard_path_describer.cpp index 4acbcb79f2b..53406550528 100644 --- a/ydb/core/tx/schemeshard/schemeshard_path_describer.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_path_describer.cpp @@ -567,7 +567,7 @@ void TPathDescriber::DescribePathVersion(const TPath& path) { } void TPathDescriber::DescribeDomain(TPathElement::TPtr pathEl) { - TPathId domainId = Self->ResolveDomainId(pathEl); + TPathId domainId = Self->ResolvePathIdForDomain(pathEl); TPathElement::TPtr domainEl = Self->PathsById.at(domainId); Y_VERIFY(domainEl); @@ -596,17 +596,13 @@ void TPathDescriber::DescribeDomainRoot(TPathElement::TPtr pathEl) { NKikimrSubDomains::TDomainDescription * entry = Result->Record.MutablePathDescription()->MutableDomainDescription(); - NKikimrSubDomains::TDomainKey *key = entry->MutableDomainKey(); entry->SetSchemeShardId_Depricated(Self->ParentDomainId.OwnerId); entry->SetPathId_Depricated(Self->ParentDomainId.LocalPathId); - if (pathEl->IsRoot()) { - key->SetSchemeShard(Self->ParentDomainId.OwnerId); - key->SetPathId(Self->ParentDomainId.LocalPathId); - } else { - key->SetSchemeShard(pathEl->PathId.OwnerId); - key->SetPathId(pathEl->PathId.LocalPathId); - } + auto domainKey = Self->GetDomainKey(pathEl->PathId); + NKikimrSubDomains::TDomainKey *key = entry->MutableDomainKey(); + key->SetSchemeShard(domainKey.OwnerId); + key->SetPathId(domainKey.LocalPathId); entry->MutableProcessingParams()->CopyFrom(subDomainInfo->GetProcessingParams()); |