Skip to content

Commit 44d4e10

Browse files
authored
Revert "Add node interlace to GroupMapper's TScore (#13458)" (#13858)
1 parent 5a3b8a8 commit 44d4e10

File tree

3 files changed

+9
-50
lines changed

3 files changed

+9
-50
lines changed

ydb/core/mind/bscontroller/group_layout_checker.h

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,13 @@ namespace NKikimr::NBsController {
7272
TEntityId RealmGroup;
7373
TEntityId Realm;
7474
TEntityId Domain;
75-
TEntityId Node;
7675

7776
TPDiskLayoutPosition() = default;
7877

79-
TPDiskLayoutPosition(TEntityId realmGroup, TEntityId realm, TEntityId domain, TEntityId node)
78+
TPDiskLayoutPosition(TEntityId realmGroup, TEntityId realm, TEntityId domain)
8079
: RealmGroup(realmGroup)
8180
, Realm(realm)
8281
, Domain(domain)
83-
, Node(node)
8482
{}
8583

8684
TPDiskLayoutPosition(TDomainMapper& mapper, const TNodeLocation& location, TPDiskId pdiskId, const TGroupGeometryInfo& geom) {
@@ -104,7 +102,6 @@ namespace NKikimr::NBsController {
104102
RealmGroup = mapper(realmGroup.Str());
105103
Realm = mapper(realm.Str());
106104
Domain = mapper(domain.Str());
107-
Node.Value = pdiskId.NodeId;
108105
}
109106

110107
TString ToString() const {
@@ -127,13 +124,12 @@ namespace NKikimr::NBsController {
127124
struct TScore {
128125
ui32 RealmInterlace = 0;
129126
ui32 DomainInterlace = 0;
130-
ui32 NodeInterlace = 0;
131127
ui32 RealmGroupScatter = 0;
132128
ui32 RealmScatter = 0;
133129
ui32 DomainScatter = 0;
134130

135131
auto AsTuple() const {
136-
return std::make_tuple(RealmInterlace, DomainInterlace, NodeInterlace, RealmGroupScatter, RealmScatter, DomainScatter);
132+
return std::make_tuple(RealmInterlace, DomainInterlace, RealmGroupScatter, RealmScatter, DomainScatter);
137133
}
138134

139135
bool BetterThan(const TScore& other) const {
@@ -145,13 +141,12 @@ namespace NKikimr::NBsController {
145141
}
146142

147143
static TScore Max() {
148-
return {::Max<ui32>(), ::Max<ui32>(), ::Max<ui32>(), ::Max<ui32>(), ::Max<ui32>(), ::Max<ui32>()};
144+
return {::Max<ui32>(), ::Max<ui32>(), ::Max<ui32>(), ::Max<ui32>(), ::Max<ui32>()};
149145
}
150146

151147
TString ToString() const {
152148
return TStringBuilder() << "{RealmInterlace# " << RealmInterlace
153149
<< " DomainInterlace# " << DomainInterlace
154-
<< " NodeInterlace# " << NodeInterlace
155150
<< " RealmGroupScatter# " << RealmGroupScatter
156151
<< " RealmScatter# " << RealmScatter
157152
<< " DomainScatter# " << DomainScatter
@@ -173,8 +168,6 @@ namespace NKikimr::NBsController {
173168
TStackVec<THashMap<TEntityId, ui32>, 32> NumDisksPerDomain;
174169
THashMap<TEntityId, ui32> NumDisksPerDomainTotal;
175170

176-
THashMap<TEntityId, ui32> NumDisksPerNode;
177-
178171
TGroupLayout(const TBlobStorageGroupInfo::TTopology& topology)
179172
: Topology(topology)
180173
, NumDisksInRealm(Topology.GetTotalFailRealmsNum())
@@ -194,8 +187,6 @@ namespace NKikimr::NBsController {
194187
NumDisksInDomain[domainIdx] += value;
195188
NumDisksPerDomain[domainIdx][pos.Domain] += value;
196189
NumDisksPerDomainTotal[pos.Domain] += value;
197-
198-
NumDisksPerNode[pos.Node] += value;
199190
}
200191

201192
void AddDisk(const TPDiskLayoutPosition& pos, ui32 orderNumber) {
@@ -213,12 +204,9 @@ namespace NKikimr::NBsController {
213204
const auto& disksPerRealm = NumDisksPerRealm[vdisk.FailRealm][pos.Realm];
214205
const auto& disksPerDomain = NumDisksPerDomain[domainIdx][pos.Domain];
215206

216-
const ui32 disksOnNode = NumDisksPerNode[pos.Node];
217-
218207
return {
219208
.RealmInterlace = NumDisksPerRealmTotal[pos.Realm] - disksPerRealm,
220209
.DomainInterlace = NumDisksPerDomainTotal[pos.Domain] - disksPerDomain,
221-
.NodeInterlace = disksOnNode,
222210
.RealmGroupScatter = NumDisks - NumDisksPerRealmGroup[pos.RealmGroup],
223211
.RealmScatter = NumDisksInRealm[vdisk.FailRealm] - disksPerRealm,
224212
.DomainScatter = NumDisksInDomain[domainIdx] - disksPerDomain,

ydb/core/mind/bscontroller/group_mapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ namespace NKikimr::NBsController {
405405

406406
static std::pair<TPDiskLayoutPosition, TPDiskLayoutPosition> MakeRange(const TPDiskLayoutPosition& x, TEntityId& scope) {
407407
scope = x.Realm;
408-
return {{x.RealmGroup, x.Realm, TEntityId::Min(), TEntityId::Min()}, {x.RealmGroup, x.Realm, TEntityId::Max(), TEntityId::Max()}};
408+
return {{x.RealmGroup, x.Realm, TEntityId::Min()}, {x.RealmGroup, x.Realm, TEntityId::Max()}};
409409
}
410410
};
411411

@@ -415,7 +415,7 @@ namespace NKikimr::NBsController {
415415

416416
static std::pair<TPDiskLayoutPosition, TPDiskLayoutPosition> MakeRange(const TPDiskLayoutPosition& x, TEntityId& scope) {
417417
scope = x.RealmGroup;
418-
return {{x.RealmGroup, TEntityId::Min(), TEntityId::Min(), TEntityId::Min()}, {x.RealmGroup, TEntityId::Max(), TEntityId::Max(), TEntityId::Max()}};
418+
return {{x.RealmGroup, TEntityId::Min(), TEntityId::Min()}, {x.RealmGroup, TEntityId::Max(), TEntityId::Max()}};
419419
}
420420
};
421421

ydb/core/mind/bscontroller/group_mapper_ut.cpp

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,10 @@ Y_UNIT_TEST_SUITE(TGroupMapperTest) {
593593
TestBlock42(1);
594594
}
595595

596+
Y_UNIT_TEST(Block42_2disk) {
597+
TestBlock42(2);
598+
}
599+
596600
Y_UNIT_TEST(Mirror3dc) {
597601
TTestContext context(6, 3, 3, 3, 3);
598602
TGroupMapper mapper(TTestContext::CreateGroupGeometry(TBlobStorageGroupType::ErasureMirror3dc));
@@ -634,39 +638,6 @@ Y_UNIT_TEST_SUITE(TGroupMapperTest) {
634638
}
635639
}
636640

637-
Y_UNIT_TEST(InterlacedRacksWithoutInterlacedNodes) {
638-
TTestContext context(
639-
{
640-
{1, 1, 1, 1, 1}, // node 1
641-
{1, 1, 2, 1, 1},
642-
{1, 1, 3, 1, 2}, // node 3 has two disks
643-
{1, 1, 4, 1, 1},
644-
{1, 1, 5, 1, 1},
645-
{1, 1, 6, 1, 1},
646-
{1, 1, 2, 1, 1}, // node 7 is in the same rack as node 2
647-
{1, 1, 8, 1, 1},
648-
{1, 1, 3, 1, 1}, // node 9 is in the same rack as node 3
649-
}
650-
);
651-
652-
TGroupMapper mapper(TTestContext::CreateGroupGeometry(TBlobStorageGroupType::Erasure4Plus2Block));
653-
context.PopulateGroupMapper(mapper, 8);
654-
655-
TGroupMapper::TGroupDefinition group;
656-
group.emplace_back(TVector<TVector<TPDiskId>>(8));
657-
auto& g = group[0];
658-
659-
for (int i = 0; i < 8; i++) {
660-
g[i].emplace_back(TPDiskId(i + 1, 1));
661-
}
662-
663-
context.SetGroup(1, group);
664-
665-
TGroupMapper::TGroupDefinition newGroup = context.ReallocateGroup(mapper, 1, {TPDiskId(8, 1)});
666-
667-
UNIT_ASSERT_EQUAL_C(TPDiskId(9, 1), newGroup[0][7][0], context.FormatGroup(newGroup));
668-
}
669-
670641
Y_UNIT_TEST(NonUniformClusterDifferentSlotsPerDisk) {
671642
std::vector<std::tuple<ui32, ui32, ui32, ui32, ui32>> disks;
672643
for (ui32 rack = 0; rack < 12; ++rack) {

0 commit comments

Comments
 (0)