diff options
author | Alexey Efimov <xeno@prnwatch.com> | 2022-05-04 19:13:01 +0300 |
---|---|---|
committer | Alexey Efimov <xeno@prnwatch.com> | 2022-05-04 19:13:01 +0300 |
commit | 38ce9d983b454c4a7da55a472c478fd5cac694d3 (patch) | |
tree | c957ffb3a861212da5774166b9a257f40bdcf833 | |
parent | d5c58fcc1b24193acf8aa43b7fddd70e94c3085d (diff) | |
download | ydb-38ce9d983b454c4a7da55a472c478fd5cac694d3.tar.gz |
fix storage version consistency, fix unnecessary tablet generation increase KIKIMR-14856
ref:a3a12bf84de6988dc4de7dca669b7fcb75732c40
-rw-r--r-- | ydb/core/mind/hive/monitoring.cpp | 3 | ||||
-rw-r--r-- | ydb/core/mind/hive/tx__update_tablet_groups.cpp | 15 |
2 files changed, 11 insertions, 7 deletions
diff --git a/ydb/core/mind/hive/monitoring.cpp b/ydb/core/mind/hive/monitoring.cpp index 3add5cbee06..6d482f1ac6e 100644 --- a/ydb/core/mind/hive/monitoring.cpp +++ b/ydb/core/mind/hive/monitoring.cpp @@ -2169,8 +2169,7 @@ public: if (tablet != nullptr) { tablets.push_back(tablet); } - } else - if (TabletType != TTabletTypes::TYPE_INVALID) { + } else if (TabletType != TTabletTypes::TYPE_INVALID) { for (auto& pr : Self->Tablets) { if (pr.second.Type == TabletType) { tablets.push_back(&pr.second); diff --git a/ydb/core/mind/hive/tx__update_tablet_groups.cpp b/ydb/core/mind/hive/tx__update_tablet_groups.cpp index 49c8141e864..9ca73c3dd33 100644 --- a/ydb/core/mind/hive/tx__update_tablet_groups.cpp +++ b/ydb/core/mind/hive/tx__update_tablet_groups.cpp @@ -160,10 +160,18 @@ public: if (channel->History.empty()) { fromGeneration = 0; } else { - tablet->IncreaseGeneration(); - db.Table<Schema::Tablet>().Key(tablet->Id).Update<Schema::Tablet::KnownGeneration>(tablet->KnownGeneration); + if (!changed) { + tablet->IncreaseGeneration(); + db.Table<Schema::Tablet>().Key(tablet->Id).Update<Schema::Tablet::KnownGeneration>(tablet->KnownGeneration); + } fromGeneration = tablet->KnownGeneration; } + + if (!changed) { + ++tabletStorageInfo->Version; + db.Table<Schema::Tablet>().Key(tablet->Id).Update<Schema::Tablet::TabletStorageVersion>(tabletStorageInfo->Version); + } + TInstant timestamp = ctx.Now(); db.Table<Schema::TabletChannelGen>().Key(tablet->Id, channelId, fromGeneration).Update( NIceDb::TUpdate<Schema::TabletChannelGen::Group>(group->GetGroupID()), @@ -198,9 +206,6 @@ public: } if (changed && (tablet->ChannelProfileNewGroup.none() || !hasEmptyChannel)) { - ++tabletStorageInfo->Version; - db.Table<Schema::Tablet>().Key(tablet->Id).Update<Schema::Tablet::TabletStorageVersion>(tabletStorageInfo->Version); - if (tablet->ChannelProfileNewGroup.any()) { BLOG_W("THive::TTxUpdateTabletGroups::Execute{" << (ui64)this << "}: tablet " << tablet->Id |