From e8b4e510d80e6ec163cb404da18c59d6f37dc41e Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Mon, 3 Aug 2015 10:17:34 +0200 Subject: [PATCH] Some reordering and better comments. --- arangod/Cluster/ClusterInfo.cpp | 7 +++--- arangod/Cluster/ClusterInfo.h | 43 ++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/arangod/Cluster/ClusterInfo.cpp b/arangod/Cluster/ClusterInfo.cpp index e325532f4d..8c400ce35f 100644 --- a/arangod/Cluster/ClusterInfo.cpp +++ b/arangod/Cluster/ClusterInfo.cpp @@ -264,12 +264,12 @@ ClusterInfo* ClusterInfo::instance () { ClusterInfo::ClusterInfo () : _agency(), - _plannedDatabases(), - _collectionsValid(false), - _currentDatabases(), _serversValid(false), _DBServersValid(false), _coordinatorsValid(false), + _plannedDatabases(), + _currentDatabases(), + _collectionsValid(false), _uniqid() { _uniqid._currentValue = _uniqid._upperValue = 0ULL; @@ -483,6 +483,7 @@ void ClusterInfo::clearCurrentDatabases () { /// @brief (re-)load the information about planned databases /// Usually one does not have to call this directly. //////////////////////////////////////////////////////////////////////////////// +// static const std::string prefixPlannedDatabases = "Plan/Databases"; void ClusterInfo::loadPlannedDatabases () { diff --git a/arangod/Cluster/ClusterInfo.h b/arangod/Cluster/ClusterInfo.h index 5c7c0cc68d..2b4b48bd04 100644 --- a/arangod/Cluster/ClusterInfo.h +++ b/arangod/Cluster/ClusterInfo.h @@ -1058,9 +1058,37 @@ namespace triagens { triagens::basics::ReadWriteLock _lock; // Cached data from the agency, we reload whenever necessary: + + // The servers, first all, we only need Current here: + std::unordered_map + _servers; // from Current/ServersRegistered + bool + _serversValid; + // The DBServers, also from Current: + std::unordered_map + _DBServers; // from Current/DBServers + bool _DBServersValid; + // The Coordinators, also from Current: + std::unordered_map + _coordinators; // from Current/Coordinators + bool _coordinatorsValid; + + // First the databases, there is Plan and Current information: std::unordered_map _plannedDatabases; // from Plan/Databases + std::unordered_map> + _currentDatabases; // from Current/Databases + // Finally, we need information about collections, again we have + // data from Plan and from Current. + // The information for _shards and _shardKeys are filled from the + // Plan (since they are fixed for the lifetime of the collection). + // _shardIds is filled from Current, since we have to be able to + // move shards between servers, and Plan contains who ought to be + // responsible and Current contains the actual current responsibility. + + // The Plan state: AllCollections _collections; // from Plan/Collections/ bool _collectionsValid; @@ -1072,24 +1100,11 @@ namespace triagens { std::shared_ptr>> _shardKeys; // from Plan/Collections/ - std::unordered_map> - _currentDatabases; // from Current/Databases - + // The Current state: AllCollectionsCurrent _collectionsCurrent; // from Current/Collections/ bool _collectionsCurrentValid; - std::unordered_map - _servers; // from Current/ServersRegistered - bool - _serversValid; - std::unordered_map - _DBServers; // from Current/DBServers - bool _DBServersValid; - std::unordered_map - _coordinators; // from Current/Coordinators - bool _coordinatorsValid; std::unordered_map _shardIds; // from Current/Collections/