Skip to content

Commit

Permalink
refactoring: DbUpdateSlotIndexToNull
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-shchetinin committed Oct 14, 2024
1 parent 19910f0 commit 092d8cb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 9 additions & 0 deletions ydb/core/mind/node_broker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,15 @@ void TNodeBroker::DbUpdateNodeLocation(const TNodeInfo &node,
db.Table<T>().Key(node.NodeId).Update<T::Location>(node.Location.GetSerializedLocation());
}

void TNodeBroker::DbUpdateSlotIndexToNull(const TNodeInfo &node,
TTransactionContext &txc)
{
NIceDb::TNiceDb db(txc.DB);
using T = Schema::Nodes;
db.Table<T>().Key(node.NodeId)
.UpdateToNull<T::SlotIndex>();
}

void TNodeBroker::Handle(TEvConsole::TEvConfigNotificationRequest::TPtr &ev,
const TActorContext &ctx)
{
Expand Down
6 changes: 1 addition & 5 deletions ydb/core/mind/node_broker__decommission_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ class TNodeBroker::TTxDecommissionNode : public TTransactionBase<TNodeBroker> {

if (Self->EnableDecomissionNode) {
Self->SlotIndexesPools[node.ServicedSubDomain].Release(node.SlotIndex.value());

NIceDb::TNiceDb db(txc.DB);
using T = Schema::Nodes;
db.Table<T>().Key(node.NodeId)
.UpdateToNull<T::SlotIndex>();
Self->DbUpdateSlotIndexToNull(node, txc);
}
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions ydb/core/mind/node_broker_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ class TNodeBroker : public TActor<TNodeBroker>
TTransactionContext &txc);
void DbUpdateNodeLocation(const TNodeInfo &node,
TTransactionContext &txc);
void DbUpdateSlotIndexToNull(const TNodeInfo &node,
TTransactionContext &txc);

void Handle(TEvConsole::TEvConfigNotificationRequest::TPtr &ev,
const TActorContext &ctx);
Expand Down

0 comments on commit 092d8cb

Please sign in to comment.