Skip to content

Commit 356c61b

Browse files
authored
25-1-2: ensure that there aren't 2 locals on 1 node in 1 hive (#19583) (#19881)
2 parents 76f0d01 + acbe6f1 commit 356c61b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

ydb/core/mind/local.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
10301030
TRegistrationInfo Info;
10311031
TVector<TActorId> Locals;
10321032
TActorId Subscriber;
1033-
TVector<TTabletId> HiveIds;
1033+
std::set<TTabletId> HiveIds;
10341034
THashMap<TString, TString> Attributes;
10351035
TSubDomainKey DomainKey;
10361036
};
@@ -1152,7 +1152,7 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
11521152

11531153
void RegisterAsSubDomain(const NKikimrScheme::TEvDescribeSchemeResult &rec,
11541154
const TResolveTask &task,
1155-
const TVector<TTabletId> hiveIds,
1155+
const std::set<TTabletId> hiveIds,
11561156
const TActorContext &ctx)
11571157
{
11581158
const auto &domainDesc = rec.GetPathDescription().GetDomainDescription();
@@ -1273,14 +1273,14 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
12731273
const auto &domainDesc = rec.GetPathDescription().GetDomainDescription();
12741274
Y_ABORT_UNLESS(domainDesc.GetDomainKey().GetSchemeShard() == SchemeRoot);
12751275

1276-
TVector<TTabletId> hiveIds(HiveIds);
1276+
std::set<TTabletId> hiveIds(HiveIds.begin(), HiveIds.end());
12771277
TTabletId hiveId = domainDesc.GetProcessingParams().GetHive();
12781278
if (hiveId) {
1279-
hiveIds.emplace_back(hiveId);
1279+
hiveIds.emplace(hiveId);
12801280
}
12811281
TTabletId sharedHiveId = domainDesc.GetSharedHive();
12821282
if (sharedHiveId) {
1283-
hiveIds.emplace_back(sharedHiveId);
1283+
hiveIds.emplace(sharedHiveId);
12841284
}
12851285
RegisterAsSubDomain(rec, task, hiveIds, ctx);
12861286

@@ -1311,7 +1311,7 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
13111311
TTenantInfo& tenant = itTenant->second;
13121312
TTabletId hiveId = ev->Get()->DescribeSchemeResult.GetPathDescription().GetDomainDescription().GetProcessingParams().GetHive();
13131313
if (hiveId) {
1314-
auto itHiveId = Find(tenant.HiveIds, hiveId);
1314+
auto itHiveId = tenant.HiveIds.find(hiveId);
13151315
if (itHiveId == tenant.HiveIds.end()) {
13161316
const auto &domainDesc = ev->Get()->DescribeSchemeResult.GetPathDescription().GetDomainDescription();
13171317
TVector<TSubDomainKey> servicedDomains = {TSubDomainKey(domainDesc.GetDomainKey())};
@@ -1321,7 +1321,7 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
13211321
<< " to hive " << hiveId
13221322
<< " (allocated resources: " << tenant.Info.ResourceLimit.ShortDebugString() << ")");
13231323
RegisterLocalNode(tenant.Info.TenantName, tenant.Info.ResourceLimit, hiveId, servicedDomains, ctx);
1324-
tenant.HiveIds.emplace_back(hiveId);
1324+
tenant.HiveIds.emplace(hiveId);
13251325
}
13261326
}
13271327
}

0 commit comments

Comments
 (0)