Skip to content

NodeBroker: more informative error text and logs when a node is alrea… #21537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions ydb/core/mind/node_broker__register_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,22 @@ class TNodeBroker::TTxRegisterNode : public TTransactionBase<TNodeBroker> {
auto &node = Self->Nodes.find(it->second)->second;
NodeId = node.NodeId;

if (node.Address != rec.GetAddress()
|| node.ResolveHost != rec.GetResolveHost())
return Error(TStatus::WRONG_REQUEST,
TStringBuilder() << "Another address is registered for "
<< host << ":" << port,
ctx);
if (node.Address != rec.GetAddress() || node.ResolveHost != rec.GetResolveHost()) {
auto errorText = TStringBuilder() << "Another address is registered for " << host << ":" << port
<< ", expected (address, resolve host) = (" << node.Address << ", " << node.ResolveHost << ")"
<< ", got (address, resolve host) = (" << rec.GetAddress() << ", " << rec.GetResolveHost() << ")";

LOG_WARN_S(ctx, NKikimrServices::NODE_BROKER, errorText);
return Error(TStatus::WRONG_REQUEST, errorText, ctx);
}

if (node.Location != loc && node.Location != TNodeLocation()) {
return Error(TStatus::WRONG_REQUEST,
TStringBuilder() << "Another location is registered for "
<< host << ":" << port,
ctx);
auto errorText = TStringBuilder() << "Another location is registered for " << host << ":" << port
<< ", expected = " << node.Location.ToString()
<< ", got = " << loc.ToString();

LOG_WARN_S(ctx, NKikimrServices::NODE_BROKER, errorText);
return Error(TStatus::WRONG_REQUEST, errorText, ctx);
} else if (node.Location != loc) {
node.Location = loc;
Self->DbUpdateNodeLocation(node, txc);
Expand Down
Loading