diff --git a/arangod/Agency/Agent.cpp b/arangod/Agency/Agent.cpp index 6a3bca70ff..f8c76f40bf 100644 --- a/arangod/Agency/Agent.cpp +++ b/arangod/Agency/Agent.cpp @@ -935,7 +935,7 @@ void Agent::beginShutdown() { } // Stop inception process - if (_inception != nullptr) { + if (size() > 1 && _inception != nullptr) { _inception->beginShutdown(); } @@ -943,13 +943,14 @@ void Agent::beginShutdown() { _spearhead.beginShutdown(); _readDB.beginShutdown(); - if (_inception != nullptr) { + if (size() > 1 && _inception != nullptr) { int counter = 0; while (_inception->isRunning()) { usleep(100000); // emit warning after 5 seconds if (++counter == 10 * 5) { - LOG_TOPIC(WARN, Logger::AGENCY) << "waiting for inception thread to finish"; + LOG_TOPIC(WARN, Logger::AGENCY) + << "waiting for inception thread to finish"; } } } diff --git a/js/server/tests/resilience/moving-shards-cluster.js b/js/server/tests/resilience/moving-shards-cluster.js index 80628cc2fa..39948d741e 100644 --- a/js/server/tests/resilience/moving-shards-cluster.js +++ b/js/server/tests/resilience/moving-shards-cluster.js @@ -36,6 +36,16 @@ const _ = require("lodash"); const wait = require("internal").wait; const supervisionState = require("@arangodb/cluster").supervisionState; +function getDBServers() { + var tmp = global.ArangoClusterInfo.getDBServers(); + var servers = []; + for (var i = 0; i < tmp.length; ++i) { + servers[i] = tmp[i].serverId; + } + return servers; +} + +const servers = getDBServers(); //////////////////////////////////////////////////////////////////////////////// /// @brief test suite @@ -46,7 +56,7 @@ function MovingShardsSuite () { var cn = "UnitTestMovingShards"; var count = 0; var c = []; - var dbservers = global.ArangoClusterInfo.getDBServers(); + var dbservers = getDBServers(); //////////////////////////////////////////////////////////////////////////////// /// @brief find out servers for a collection @@ -242,7 +252,7 @@ function MovingShardsSuite () { var request = require("@arangodb/request"); var endpointToURL = require("@arangodb/cluster").endpointToURL; var url = endpointToURL(coordEndpoint); - var numberOfDBServers = global.ArangoClusterInfo.getDBServers().length; + var numberOfDBServers = servers.length; var body = {"cleanedServers":[], "numberOfDBServers":numberOfDBServers}; try { var res = request({ method: "PUT", @@ -378,7 +388,7 @@ function MovingShardsSuite () { //////////////////////////////////////////////////////////////////////////////// testSetup : function () { - dbservers = global.ArangoClusterInfo.getDBServers(); + dbservers = getDBServers(); assertTrue(waitForSynchronousReplication("_system")); }, @@ -388,7 +398,7 @@ function MovingShardsSuite () { testShrinkNoReplication : function() { assertTrue(waitForSynchronousReplication("_system")); - var _dbservers = global.ArangoClusterInfo.getDBServers(); + var _dbservers = servers; _dbservers.sort(); assertTrue(shrinkCluster(4)); assertTrue(testServerEmpty(_dbservers[4], true));