Skip to content

Commit 3d0c4ef

Browse files
authored
Support distconf shutdown (#13351)
1 parent fc474d1 commit 3d0c4ef

File tree

5 files changed

+30
-18
lines changed

5 files changed

+30
-18
lines changed

ydb/core/blobstorage/nodewarden/distconf.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ namespace NKikimr::NStorage {
9595
ProposedStorageConfig.reset();
9696
}
9797

98-
Send(MakeBlobStorageNodeWardenID(SelfId().NodeId()), new TEvNodeWardenStorageConfig(*StorageConfig,
99-
ProposedStorageConfig ? &ProposedStorageConfig.value() : nullptr));
98+
ReportStorageConfigToNodeWarden(0);
10099

101100
if (IsSelfStatic) {
102101
PersistConfig({});
@@ -290,6 +289,20 @@ namespace NKikimr::NStorage {
290289
}
291290
}
292291

292+
void TDistributedConfigKeeper::ReportStorageConfigToNodeWarden(ui64 cookie) {
293+
Y_ABORT_UNLESS(StorageConfig);
294+
const TActorId wardenId = MakeBlobStorageNodeWardenID(SelfId().NodeId());
295+
const bool distconfEnabled = StorageConfig->GetSelfManagementConfig().GetEnabled();
296+
const NKikimrBlobStorage::TStorageConfig *config = distconfEnabled
297+
? &StorageConfig.value()
298+
: &BaseConfig;
299+
const NKikimrBlobStorage::TStorageConfig *proposedConfig = ProposedStorageConfig && distconfEnabled
300+
? &ProposedStorageConfig.value()
301+
: nullptr;
302+
auto ev = std::make_unique<TEvNodeWardenStorageConfig>(*config, proposedConfig);
303+
Send(wardenId, ev.release(), 0, cookie);
304+
}
305+
293306
STFUNC(TDistributedConfigKeeper::StateFunc) {
294307
STLOG(PRI_DEBUG, BS_NODE, NWDC15, "StateFunc", (Type, ev->GetTypeRewrite()), (Sender, ev->Sender),
295308
(SessionId, ev->InterconnectSession), (Cookie, ev->Cookie));

ydb/core/blobstorage/nodewarden/distconf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ namespace NKikimr::NStorage {
292292
void Halt(); // cease any distconf activity, unbind and reject any bindings
293293
bool ApplyStorageConfig(const NKikimrBlobStorage::TStorageConfig& config);
294294
void HandleConfigConfirm(STATEFN_SIG);
295+
void ReportStorageConfigToNodeWarden(ui64 cookie);
295296

296297
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
297298
// PDisk configuration retrieval and storing

ydb/core/blobstorage/nodewarden/distconf_fsm.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,7 @@ namespace NKikimr::NStorage {
481481
// issue notification to node warden
482482
if (StorageConfig && StorageConfig->GetGeneration() &&
483483
StorageConfig->GetGeneration() < ProposedStorageConfig->GetGeneration()) {
484-
const TActorId wardenId = MakeBlobStorageNodeWardenID(SelfId().NodeId());
485-
auto ev = std::make_unique<TEvNodeWardenStorageConfig>(*StorageConfig, &ProposedStorageConfig.value());
486-
Send(wardenId, ev.release(), 0, cookie);
484+
ReportStorageConfigToNodeWarden(cookie);
487485
++task.AsyncOperationsPending;
488486
++ProposedStorageConfigCookieUsage;
489487
}

ydb/core/blobstorage/nodewarden/distconf_invoke.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ namespace NKikimr::NStorage {
678678

679679
if (Self->StorageConfigYamlVersion && newYamlVersion != *Self->StorageConfigYamlVersion + 1) {
680680
return FinishWithError(TResult::ERROR, TStringBuilder() << "version must be increasing by one"
681-
<< " new version# " << newYamlVersion << " expected version# " << *Self->StorageConfigYamlVersion);
681+
<< " new version# " << newYamlVersion << " expected version# " << *Self->StorageConfigYamlVersion + 1);
682682
}
683683

684684
TString errorReason;

ydb/core/blobstorage/nodewarden/node_warden_impl.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,16 +1230,16 @@ bool NKikimr::NStorage::DeriveStorageConfig(const NKikimrConfig::TAppConfig& app
12301230
if (domains.DomainSize() == 1) {
12311231
const auto& domain = domains.GetDomain(0);
12321232

1233-
auto updateConfig = [&](bool needMerge, auto *to, const auto& from) {
1233+
auto updateConfig = [&](bool needMerge, auto *to, const auto& from, const char *entity) {
12341234
if (needMerge) {
1235-
char prefix[TActorId::MaxServiceIDLength] = {0};
1236-
auto toInfo = BuildStateStorageInfo(prefix, *to);
1237-
auto fromInfo = BuildStateStorageInfo(prefix, from);
1238-
if (toInfo->NToSelect != fromInfo->NToSelect) {
1239-
*errorReason = "NToSelect differs";
1240-
return false;
1241-
} else if (toInfo->SelectAllReplicas() != fromInfo->SelectAllReplicas()) {
1242-
*errorReason = "StateStorage rings differ";
1235+
char toPrefix[TActorId::MaxServiceIDLength] = {0};
1236+
char fromPrefix[TActorId::MaxServiceIDLength] = {0};
1237+
auto toInfo = BuildStateStorageInfo(toPrefix, *to);
1238+
auto fromInfo = BuildStateStorageInfo(fromPrefix, from);
1239+
if (toInfo->NToSelect != fromInfo->NToSelect || toInfo->SelectAllReplicas() != fromInfo->SelectAllReplicas()) {
1240+
*errorReason = TStringBuilder() << entity << " NToSelect/rings differs"
1241+
<< " from# " << SingleLineProto(from)
1242+
<< " to# " << SingleLineProto(*to);
12431243
return false;
12441244
}
12451245
}
@@ -1254,9 +1254,9 @@ bool NKikimr::NStorage::DeriveStorageConfig(const NKikimrConfig::TAppConfig& app
12541254
const bool hadStateStorageConfig = config->HasStateStorageConfig();
12551255
const bool hadStateStorageBoardConfig = config->HasStateStorageBoardConfig();
12561256
const bool hadSchemeBoardConfig = config->HasSchemeBoardConfig();
1257-
if (!updateConfig(hadStateStorageConfig, config->MutableStateStorageConfig(), ss) ||
1258-
!updateConfig(hadStateStorageBoardConfig, config->MutableStateStorageBoardConfig(), ss) ||
1259-
!updateConfig(hadSchemeBoardConfig, config->MutableSchemeBoardConfig(), ss)) {
1257+
if (!updateConfig(hadStateStorageConfig, config->MutableStateStorageConfig(), ss, "StateStorage") ||
1258+
!updateConfig(hadStateStorageBoardConfig, config->MutableStateStorageBoardConfig(), ss, "StateStorageBoard") ||
1259+
!updateConfig(hadSchemeBoardConfig, config->MutableSchemeBoardConfig(), ss, "SchemeBoard")) {
12601260
return false;
12611261
}
12621262
break;

0 commit comments

Comments
 (0)