1
0
Fork 0

Coordinators do not unregister at every shutdown. (#9134)

* Coordinators do not unregister at every shutdown.

Instead they create a new short name with every start.
This is needed for the transactions.

* Always new short id for coordinators. Never for DBServers!
This commit is contained in:
Max Neunhöffer 2019-05-29 22:55:22 +02:00 committed by GitHub
parent d67513607d
commit 4da1a6afdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View File

@ -245,10 +245,6 @@ void ClusterFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
FATAL_ERROR_EXIT();
}
ServerState::instance()->setRole(_requestedRole);
if (ServerState::isCoordinator(_requestedRole)) {
setUnregisterOnShutdown(true);
}
}
}

View File

@ -553,7 +553,7 @@ bool ServerState::registerAtAgencyPhase1(AgencyComm& comm, const ServerState::Ro
// coordinator is already/still registered from an previous unclean shutdown;
// must establish a new short ID
bool forceChangeShortId = (!res.successful() && isCoordinator(role));
bool forceChangeShortId = isCoordinator(role);
std::string targetIdPath = "Target/" + latestIdKey;
std::string targetUrl = "Target/MapUniqueToShortID/" + _id;
@ -625,7 +625,7 @@ bool ServerState::registerAtAgencyPhase1(AgencyComm& comm, const ServerState::Ro
preconditions.push_back(*(latestIdPrecondition.get()));
preconditions.push_back(AgencyPrecondition(targetUrl, AgencyPrecondition::Type::EMPTY,
!forceChangeShortId));
mapSlice.isNone()));
AgencyWriteTransaction trx(operations, preconditions);
result = comm.sendTransactionWithFailover(trx, 0.0);