1
0
Fork 0

Fix linter

This commit is contained in:
Andreas Streichardt 2017-05-24 14:53:06 +02:00
parent f08cae2028
commit b5fcd15214
3 changed files with 8 additions and 2 deletions

View File

@ -431,6 +431,7 @@ void ClusterInfo::loadPlan() {
decltype(_plannedDatabases) newDatabases;
decltype(_plannedCollections) newCollections;
decltype(_shards) newShards;
decltype(_shardServers) newShardServers;
decltype(_shardKeys) newShardKeys;
bool swapDatabases = false;
@ -518,6 +519,7 @@ void ClusterInfo::loadPlan() {
auto shards = std::make_shared<std::vector<std::string>>();
for (auto const& p : *shardIDs) {
shards->push_back(p.first);
newShardServers.emplace(p.first, p.second);
}
// Sort by the number in the shard ID ("s0000001" for example):
std::sort(shards->begin(), shards->end(),
@ -526,6 +528,7 @@ void ClusterInfo::loadPlan() {
std::strtol(b.c_str() + 1, nullptr, 10);
});
newShards.emplace(std::make_pair(collectionId, shards));
} catch (std::exception const& ex) {
// The plan contains invalid collection information.
// This should not happen in healthy situations.

View File

@ -628,6 +628,8 @@ class ClusterInfo {
std::unordered_map<CollectionID,
std::shared_ptr<std::vector<std::string>>>
_shardKeys; // from Plan/Collections/
std::unordered_map<ShardID, std::vector<ServerID>> _shardServers;
// The Current state:
AllCollectionsCurrent _currentCollections; // from Current/Collections/

View File

@ -26,6 +26,7 @@
// / @author Andreas Streichardt
// //////////////////////////////////////////////////////////////////////////////
const wait = require('internal').wait;
const db = require('internal').db;
const cluster = require('@arangodb/cluster');
const expect = require('chai').expect;
@ -207,7 +208,7 @@ describe('Cluster sync', function() {
let collections = db._collections();
expect(collections.map(collection => collection.name())).to.contain('s100001');
let count = 0;
while (db._collection('s100001').status() == ArangoCollection.STATUS_UNLOADING && count++ < 100) {
while (db._collection('s100001').status() === ArangoCollection.STATUS_UNLOADING && count++ < 100) {
wait(0.1);
}
expect(db._collection('s100001').status()).to.equal(ArangoCollection.STATUS_UNLOADED);
@ -260,7 +261,7 @@ describe('Cluster sync', function() {
cluster.executePlanForCollections(plan);
db._useDatabase('test');
let count = 0;
while (db._collection('s100001').status() == ArangoCollection.STATUS_UNLOADING && count++ < 100) {
while (db._collection('s100001').status() === ArangoCollection.STATUS_UNLOADING && count++ < 100) {
wait(0.1);
}
expect(db._collection('s100001').status()).to.equal(ArangoCollection.STATUS_UNLOADED);