diff --git a/arangod/Aql/ShortestPathBlock.cpp b/arangod/Aql/ShortestPathBlock.cpp index d3925724a6..a555743a66 100644 --- a/arangod/Aql/ShortestPathBlock.cpp +++ b/arangod/Aql/ShortestPathBlock.cpp @@ -30,7 +30,6 @@ #include "Graph/ShortestPathResult.h" #include "Transaction/Methods.h" #include "Utils/OperationCursor.h" -#include "VocBase/EdgeCollectionInfo.h" #include "VocBase/LogicalCollection.h" #include "VocBase/ManagedDocumentResult.h" #include "VocBase/ticks.h" @@ -48,7 +47,7 @@ ShortestPathBlock::ShortestPathBlock(ExecutionEngine* engine, _vertexReg(ExecutionNode::MaxRegisterId), _edgeVar(nullptr), _edgeReg(ExecutionNode::MaxRegisterId), - _opts(nullptr), + _opts(static_cast(ep->options()), _posInPath(0), _pathLength(0), _path(nullptr), @@ -58,8 +57,7 @@ ShortestPathBlock::ShortestPathBlock(ExecutionEngine* engine, _useTargetRegister(false), _usedConstant(false), _engines(nullptr) { - _opts = static_cast(ep->options()); - _mmdr.reset(new ManagedDocumentResult); + TRI_ASSERT(_opts != nullptr); if (!ep->usesStartInVariable()) { _startVertexId = ep->getStartVertex(); diff --git a/arangod/Aql/ShortestPathBlock.h b/arangod/Aql/ShortestPathBlock.h index 0f59d959a2..c755303717 100644 --- a/arangod/Aql/ShortestPathBlock.h +++ b/arangod/Aql/ShortestPathBlock.h @@ -36,17 +36,11 @@ class ShortestPathFinder; class ShortestPathResult; } -namespace traverser { -class EdgeCollectionInfo; -} - namespace aql { class ShortestPathNode; class ShortestPathBlock : public ExecutionBlock { - friend struct EdgeWeightExpanderLocal; - friend struct EdgeWeightExpanderCluster; public: ShortestPathBlock(ExecutionEngine* engine, ShortestPathNode const* ep); @@ -96,8 +90,6 @@ class ShortestPathBlock : public ExecutionBlock { /// @brief Register for the edge output RegisterId _edgeReg; - std::unique_ptr _mmdr; - /// @brief options to compute the shortest path graph::ShortestPathOptions* _opts; diff --git a/arangod/Cluster/ClusterComm.cpp b/arangod/Cluster/ClusterComm.cpp index 6d1f35b0d2..66a67d02ae 100644 --- a/arangod/Cluster/ClusterComm.cpp +++ b/arangod/Cluster/ClusterComm.cpp @@ -1123,6 +1123,19 @@ void ClusterComm::addAuthorization(std::unordered_map* } } +std::vector ClusterComm::activeServerTickets(std::vector const& servers) { + std::vector tickets; + CONDITION_LOCKER(locker, somethingReceived); + for (auto const& it: responses) { + for (auto const& server: servers) { + if (it.second.result && it.second.result->serverID == server) { + tickets.push_back(it.first); + } + } + } + return tickets; +} + //////////////////////////////////////////////////////////////////////////////// /// @brief ClusterComm main loop //////////////////////////////////////////////////////////////////////////////// @@ -1130,18 +1143,10 @@ void ClusterComm::addAuthorization(std::unordered_map* void ClusterCommThread::abortRequestsToFailedServers() { ClusterInfo* ci = ClusterInfo::instance(); auto failedServers = ci->getFailedServers(); - std::vector failedServerEndpoints; - failedServerEndpoints.reserve(failedServers.size()); - - for (auto const& failedServer: failedServers) { - failedServerEndpoints.push_back(_cc->createCommunicatorDestination(ci->getServerEndpoint(failedServer), "/").url()); - } - - for (auto const& request: _cc->communicator()->requestsInProgress()) { - for (auto const& failedServerEndpoint: failedServerEndpoints) { - if (request->_destination.url().substr(0, failedServerEndpoint.length()) == failedServerEndpoint) { - _cc->communicator()->abortRequest(request->_ticketId); - } + if (failedServers.size() > 0) { + auto ticketIds = _cc->activeServerTickets(failedServers); + for (auto const& ticketId: ticketIds) { + _cc->communicator()->abortRequest(ticketId); } } } diff --git a/arangod/Cluster/ClusterComm.h b/arangod/Cluster/ClusterComm.h index 1f5d42967e..193b8bd418 100644 --- a/arangod/Cluster/ClusterComm.h +++ b/arangod/Cluster/ClusterComm.h @@ -616,6 +616,12 @@ class ClusterComm { void cleanupAllQueues(); + ////////////////////////////////////////////////////////////////////////////// + /// @brief activeServerTickets for a list of servers + ////////////////////////////////////////////////////////////////////////////// + + std::vector activeServerTickets(std::vector const& servers); + ////////////////////////////////////////////////////////////////////////////// /// @brief our background communications thread //////////////////////////////////////////////////////////////////////////////