aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzalyalov <zalyalov@yandex-team.com>2023-08-18 15:18:20 +0300
committerzalyalov <zalyalov@yandex-team.com>2023-08-18 18:10:22 +0300
commit30ec9c2db5243f3d9e9567ad6d3369c4142f236b (patch)
tree4cecdee2b213d4168521e73175aa1f664b3d1f5e
parent392e21c723ebcf4844c427ab1ee9af2e599a761f (diff)
downloadydb-30ec9c2db5243f3d9e9567ad6d3369c4142f236b.tar.gz
fix StickTogetherInDC
-rw-r--r--ydb/core/mind/hive/hive_impl.cpp2
-rw-r--r--ydb/core/mind/hive/tx__load_everything.cpp6
2 files changed, 5 insertions, 3 deletions
diff --git a/ydb/core/mind/hive/hive_impl.cpp b/ydb/core/mind/hive/hive_impl.cpp
index 98f3bada80..bb2f90d36c 100644
--- a/ydb/core/mind/hive/hive_impl.cpp
+++ b/ydb/core/mind/hive/hive_impl.cpp
@@ -1151,7 +1151,7 @@ THive::TBestNodeResult THive::FindBestNode(const TTabletInfo& tablet) {
dataCentersGroups = GetDefaultDataCentersPreference(leader.Type);
}
if (dataCentersGroups.empty()) {
- if (leader.Category) {
+ if (leader.Category && leader.Category->StickTogetherInDC) {
std::unordered_map<TDataCenterId, ui32> dcTablets;
for (TLeaderTabletInfo* tab : leader.Category->Tablets) {
if (tab->IsAlive()) {
diff --git a/ydb/core/mind/hive/tx__load_everything.cpp b/ydb/core/mind/hive/tx__load_everything.cpp
index 382b44f92f..96636d550a 100644
--- a/ydb/core/mind/hive/tx__load_everything.cpp
+++ b/ydb/core/mind/hive/tx__load_everything.cpp
@@ -344,8 +344,10 @@ public:
BLOG_D("THive::TTxLoadEverything loaded " << numTabletCategories << " tablet categories");
}
- if (Self->CurrentConfig.GetSystemTabletCategoryId() != 0 && Self->TabletCategories.empty()) {
- db.Table<Schema::TabletCategory>().Key(Self->CurrentConfig.GetSystemTabletCategoryId()).Update<Schema::TabletCategory::StickTogetherInDC>(true);
+ if (auto systemCategoryId = Self->CurrentConfig.GetSystemTabletCategoryId(); systemCategoryId != 0 && Self->TabletCategories.empty()) {
+ db.Table<Schema::TabletCategory>().Key(systemCategoryId).Update<Schema::TabletCategory::StickTogetherInDC>(true);
+ TTabletCategoryInfo& systemCategory = Self->TabletCategories.emplace(systemCategoryId, systemCategoryId).first->second;
+ systemCategory.StickTogetherInDC = true;
}
TTabletId maxTabletId = 0;