Skip to content

Commit dcbe1a9

Browse files
authored
24-3: schemeshard: fix enable_alter_database_create_hive_first mode (#10098)
Storage pools duplication (in memory only) happened at the first database alter (first alter is actually constructs the database) causes StatusInvalidParameter errors for the next alters if they repeat storage pools specification. Ydbcp does exactly that and so databases created via ydbcp are displayed in the webui as having CONFIGURING state instead of RUNNING. Databases stuck in that state are actually fully functional, but still are not being able to execute some alters until root schemeshard is rebooted. KIKIMR-10367 YDBOPS-7628
1 parent 6508540 commit dcbe1a9

File tree

3 files changed

+358
-156
lines changed

3 files changed

+358
-156
lines changed

ydb/core/tx/schemeshard/schemeshard__operation_alter_extsubdomain.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -936,21 +936,23 @@ class TAlterExtSubDomain: public TSubOperation {
936936
// Create or derive alter.
937937
// (We could have always created new alter from a current subdomainInfo but
938938
// we need to take into account possible version increase from CreateHive suboperation.)
939-
auto createAlterFrom = [&inputSettings, &delta](auto prototype) {
939+
auto createAlterFrom = [&inputSettings](auto prototype, const TStoragePools& additionalPools) {
940940
return MakeIntrusive<TSubDomainInfo>(
941941
*prototype,
942942
inputSettings.GetPlanResolution(),
943943
inputSettings.GetTimeCastBucketsPerMediator(),
944-
delta.StoragePoolsAdded
944+
additionalPools
945945
);
946946
};
947947
TSubDomainInfo::TPtr alter = [&delta, &subdomainInfo, &createAlterFrom, &context]() {
948948
if (delta.AddExternalHive && context.SS->EnableAlterDatabaseCreateHiveFirst) {
949949
Y_ABORT_UNLESS(subdomainInfo->GetAlter());
950-
return createAlterFrom(subdomainInfo->GetAlter());
950+
//NOTE: existing alter already has all storage pools that combined operation wanted to add,
951+
// should not add them second time when deriving alter from alter
952+
return createAlterFrom(subdomainInfo->GetAlter(), {});
951953
} else {
952954
Y_ABORT_UNLESS(!subdomainInfo->GetAlter());
953-
return createAlterFrom(subdomainInfo);
955+
return createAlterFrom(subdomainInfo, delta.StoragePoolsAdded);
954956
}
955957
}();
956958

0 commit comments

Comments
 (0)