Skip to content

Commit 749bd51

Browse files
authored
fix drain compatability (#6613) (#6716)
1 parent dec025f commit 749bd51

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ydb/core/mind/hive/tx__load_everything.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,11 @@ class TTxLoadEverything : public TTransactionBase<THive> {
318318
node.Statistics = nodeRowset.GetValueOrDefault<Schema::Node::Statistics>();
319319
node.Name = nodeRowset.GetValueOrDefault<Schema::Node::Name>();
320320
node.BecomeUpOnRestart = nodeRowset.GetValueOrDefault<Schema::Node::BecomeUpOnRestart>(false);
321+
if (node.BecomeUpOnRestart) {
322+
// If a node must become up on restart, it must have been down
323+
// That was not persisted to avoid issues with downgrades
324+
node.Down = true;
325+
}
321326
if (nodeRowset.HaveValue<Schema::Node::Location>()) {
322327
auto location = nodeRowset.GetValue<Schema::Node::Location>();
323328
if (location.HasDataCenter()) {

ydb/core/mind/hive/tx__switch_drain.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ class TTxSwitchDrainOn : public TTransactionBase<THive> {
3838
}
3939
node->SetDown(true);
4040
if (Settings.Persist) {
41-
db.Table<Schema::Node>().Key(NodeId).Update<Schema::Node::Down, Schema::Node::BecomeUpOnRestart>(true, node->BecomeUpOnRestart);
41+
db.Table<Schema::Node>().Key(NodeId).Update<Schema::Node::BecomeUpOnRestart>(node->BecomeUpOnRestart);
42+
if (Settings.DownPolicy == NKikimrHive::DRAIN_POLICY_KEEP_DOWN) {
43+
db.Table<Schema::Node>().Key(NodeId).Update<Schema::Node::Down>(true);
44+
}
4245
}
4346
}
4447
Self->StartHiveDrain(NodeId, std::move(Settings));

0 commit comments

Comments
 (0)