@@ -110,16 +110,17 @@ namespace NKikimr::NStorage {
110
110
}
111
111
112
112
void TDistributedConfigKeeper::ProcessCollectConfigs (TEvGather::TCollectConfigs *res) {
113
- TOverloaded handler{
114
- [&](std::monostate&&) {
113
+ auto r = ProcessCollectConfigs (res, std::nullopt);
114
+ std::visit (TOverloaded{
115
+ [&](std::monostate&) {
115
116
STLOG (PRI_DEBUG, BS_NODE, NWDC61, " ProcessCollectConfigs: monostate" );
116
117
RootState = ERootState::RELAX;
117
118
},
118
- [&](TString&& error) {
119
+ [&](TString& error) {
119
120
STLOG (PRI_DEBUG, BS_NODE, NWDC63, " ProcessCollectConfigs: error" , (Error, error));
120
121
SwitchToError (error);
121
122
},
122
- [&](NKikimrBlobStorage::TStorageConfig&& proposedConfig) {
123
+ [&](NKikimrBlobStorage::TStorageConfig& proposedConfig) {
123
124
STLOG (PRI_DEBUG, BS_NODE, NWDC64, " ProcessCollectConfigs: proposed new config" ,
124
125
(ProposedConfig, proposedConfig));
125
126
TEvScatter task;
@@ -130,12 +131,11 @@ namespace NKikimr::NStorage {
130
131
propose->MutableConfig ()->Swap (&proposedConfig);
131
132
IssueScatterTask (TActorId (), std::move (task));
132
133
}
133
- };
134
- std::visit (handler, ProcessCollectConfigs (res, nullptr ));
134
+ }, r.Outcome );
135
135
}
136
136
137
137
TDistributedConfigKeeper::TProcessCollectConfigsResult TDistributedConfigKeeper::ProcessCollectConfigs (
138
- TEvGather::TCollectConfigs *res, const TString * selfAssemblyUUID) {
138
+ TEvGather::TCollectConfigs *res, std::optional<TStringBuf> selfAssemblyUUID) {
139
139
auto generateSuccessful = [&](auto && callback) {
140
140
for (const auto & item : res->GetNodes ()) {
141
141
for (const auto & node : item.GetNodeIds ()) {
@@ -171,10 +171,24 @@ namespace NKikimr::NStorage {
171
171
172
172
if (nodeQuorum && !configQuorum) {
173
173
// check if there is quorum of no-distconf config along the cluster
174
+ auto generateNodesWithoutDistconf = [&](auto && callback) {
175
+ for (const auto & item : res->GetNodes ()) {
176
+ if (item.GetBaseConfig ().GetSelfManagementConfig ().GetEnabled ()) {
177
+ continue ;
178
+ }
179
+ for (const auto & node : item.GetNodeIds ()) {
180
+ callback (node);
181
+ }
182
+ }
183
+ };
184
+ if (HasNodeQuorum (*StorageConfig, generateNodesWithoutDistconf)) {
185
+ // yes, distconf is disabled on the majority of the nodes, so we can't do anything about it
186
+ return {.IsDistconfDisabledQuorum = true };
187
+ }
174
188
}
175
189
176
190
if (!nodeQuorum || !configQuorum) {
177
- return " no quorum for CollectConfigs" ;
191
+ return { " no quorum for CollectConfigs" } ;
178
192
}
179
193
180
194
// TODO: validate self-assembly UUID
@@ -223,7 +237,7 @@ namespace NKikimr::NStorage {
223
237
(BaseConfigs.size , baseConfigs.size ()));
224
238
Y_DEBUG_ABORT (" Multiple nonintersecting node sets have quorum of BaseConfig" );
225
239
Halt ();
226
- return " Multiple nonintersecting node sets have quorum of BaseConfig" ;
240
+ return { " Multiple nonintersecting node sets have quorum of BaseConfig" } ;
227
241
}
228
242
NKikimrBlobStorage::TStorageConfig *baseConfig = nullptr ;
229
243
for (auto & [meta, info] : baseConfigs) {
@@ -289,13 +303,13 @@ namespace NKikimr::NStorage {
289
303
(Generation, generation), (Configs, configs));
290
304
Y_DEBUG_ABORT (" Multiple nonintersecting node sets have quorum of persistent config" );
291
305
Halt ();
292
- return " Multiple nonintersecting node sets have quorum of persistent config" ;
306
+ return { " Multiple nonintersecting node sets have quorum of persistent config" } ;
293
307
}
294
308
Y_ABORT_UNLESS (configs.size () == 1 );
295
309
persistedConfig = configs.front ();
296
310
}
297
311
if (maxSeenGeneration && (!persistedConfig || persistedConfig->GetGeneration () < maxSeenGeneration)) {
298
- return " couldn't obtain quorum for configuration that was seen in effect" ;
312
+ return { " couldn't obtain quorum for configuration that was seen in effect" } ;
299
313
}
300
314
301
315
// let's try to find possibly proposed config, but without a quorum, and try to reconstruct it
@@ -311,7 +325,7 @@ namespace NKikimr::NStorage {
311
325
(PersistentConfig, *persistedConfig), (ProposedConfig, config));
312
326
Y_DEBUG_ABORT (" persistently proposed config has too big generation" );
313
327
Halt ();
314
- return " persistently proposed config has too big generation" ;
328
+ return { " persistently proposed config has too big generation" } ;
315
329
}
316
330
}
317
331
if (proposedConfig && (proposedConfig->GetGeneration () != config.GetGeneration () ||
@@ -361,11 +375,11 @@ namespace NKikimr::NStorage {
361
375
if (!CurrentSelfAssemblyUUID) {
362
376
CurrentSelfAssemblyUUID.emplace (CreateGuidAsString ());
363
377
}
364
- selfAssemblyUUID = & CurrentSelfAssemblyUUID.value ();
378
+ selfAssemblyUUID. emplace ( CurrentSelfAssemblyUUID.value () );
365
379
}
366
380
propositionBase.emplace (*baseConfig);
367
- if (auto error = GenerateFirstConfig (baseConfig, *selfAssemblyUUID)) {
368
- return *error;
381
+ if (auto error = GenerateFirstConfig (baseConfig, TString ( *selfAssemblyUUID) )) {
382
+ return { *error} ;
369
383
}
370
384
configToPropose = baseConfig;
371
385
}
@@ -392,12 +406,12 @@ namespace NKikimr::NStorage {
392
406
393
407
if (error) {
394
408
Y_DEBUG_ABORT (" incorrect config proposition" );
395
- return " incorrect config proposition" ;
409
+ return { " incorrect config proposition" } ;
396
410
}
397
411
398
412
if (propositionBase) {
399
413
if (auto error = ValidateConfig (*propositionBase)) {
400
- return TStringBuilder () << " failed to propose configuration, base config contains errors: " << *error;
414
+ return { TStringBuilder () << " failed to propose configuration, base config contains errors: " << *error} ;
401
415
}
402
416
if (auto error = ValidateConfigUpdate (*propositionBase, *configToPropose)) {
403
417
Y_FAIL_S (" incorrect config proposed: " << *error);
@@ -408,7 +422,7 @@ namespace NKikimr::NStorage {
408
422
}
409
423
}
410
424
411
- return std::move (*configToPropose);
425
+ return { std::move (*configToPropose)} ;
412
426
}
413
427
414
428
return {};
0 commit comments