From 4da1a6afdf13ca5ddaa0dfedddb23e4e3c6fa74e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Neunh=C3=B6ffer?= Date: Wed, 29 May 2019 22:55:22 +0200 Subject: [PATCH] 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! --- arangod/Cluster/ClusterFeature.cpp | 4 ---- arangod/Cluster/ServerState.cpp | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/arangod/Cluster/ClusterFeature.cpp b/arangod/Cluster/ClusterFeature.cpp index 368bab69a7..8fad62843f 100644 --- a/arangod/Cluster/ClusterFeature.cpp +++ b/arangod/Cluster/ClusterFeature.cpp @@ -245,10 +245,6 @@ void ClusterFeature::validateOptions(std::shared_ptr options) { FATAL_ERROR_EXIT(); } ServerState::instance()->setRole(_requestedRole); - - if (ServerState::isCoordinator(_requestedRole)) { - setUnregisterOnShutdown(true); - } } } diff --git a/arangod/Cluster/ServerState.cpp b/arangod/Cluster/ServerState.cpp index 9d38c3297c..4db9f7e4f7 100644 --- a/arangod/Cluster/ServerState.cpp +++ b/arangod/Cluster/ServerState.cpp @@ -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);