mirror of https://gitee.com/bigwinds/arangodb
Fix linter
This commit is contained in:
parent
f08cae2028
commit
b5fcd15214
|
@ -431,6 +431,7 @@ void ClusterInfo::loadPlan() {
|
||||||
decltype(_plannedDatabases) newDatabases;
|
decltype(_plannedDatabases) newDatabases;
|
||||||
decltype(_plannedCollections) newCollections;
|
decltype(_plannedCollections) newCollections;
|
||||||
decltype(_shards) newShards;
|
decltype(_shards) newShards;
|
||||||
|
decltype(_shardServers) newShardServers;
|
||||||
decltype(_shardKeys) newShardKeys;
|
decltype(_shardKeys) newShardKeys;
|
||||||
|
|
||||||
bool swapDatabases = false;
|
bool swapDatabases = false;
|
||||||
|
@ -518,6 +519,7 @@ void ClusterInfo::loadPlan() {
|
||||||
auto shards = std::make_shared<std::vector<std::string>>();
|
auto shards = std::make_shared<std::vector<std::string>>();
|
||||||
for (auto const& p : *shardIDs) {
|
for (auto const& p : *shardIDs) {
|
||||||
shards->push_back(p.first);
|
shards->push_back(p.first);
|
||||||
|
newShardServers.emplace(p.first, p.second);
|
||||||
}
|
}
|
||||||
// Sort by the number in the shard ID ("s0000001" for example):
|
// Sort by the number in the shard ID ("s0000001" for example):
|
||||||
std::sort(shards->begin(), shards->end(),
|
std::sort(shards->begin(), shards->end(),
|
||||||
|
@ -526,6 +528,7 @@ void ClusterInfo::loadPlan() {
|
||||||
std::strtol(b.c_str() + 1, nullptr, 10);
|
std::strtol(b.c_str() + 1, nullptr, 10);
|
||||||
});
|
});
|
||||||
newShards.emplace(std::make_pair(collectionId, shards));
|
newShards.emplace(std::make_pair(collectionId, shards));
|
||||||
|
|
||||||
} catch (std::exception const& ex) {
|
} catch (std::exception const& ex) {
|
||||||
// The plan contains invalid collection information.
|
// The plan contains invalid collection information.
|
||||||
// This should not happen in healthy situations.
|
// This should not happen in healthy situations.
|
||||||
|
|
|
@ -629,6 +629,8 @@ class ClusterInfo {
|
||||||
std::shared_ptr<std::vector<std::string>>>
|
std::shared_ptr<std::vector<std::string>>>
|
||||||
_shardKeys; // from Plan/Collections/
|
_shardKeys; // from Plan/Collections/
|
||||||
|
|
||||||
|
std::unordered_map<ShardID, std::vector<ServerID>> _shardServers;
|
||||||
|
|
||||||
// The Current state:
|
// The Current state:
|
||||||
AllCollectionsCurrent _currentCollections; // from Current/Collections/
|
AllCollectionsCurrent _currentCollections; // from Current/Collections/
|
||||||
std::unordered_map<ShardID, std::shared_ptr<std::vector<ServerID>>>
|
std::unordered_map<ShardID, std::shared_ptr<std::vector<ServerID>>>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
// / @author Andreas Streichardt
|
// / @author Andreas Streichardt
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
const wait = require('internal').wait;
|
||||||
const db = require('internal').db;
|
const db = require('internal').db;
|
||||||
const cluster = require('@arangodb/cluster');
|
const cluster = require('@arangodb/cluster');
|
||||||
const expect = require('chai').expect;
|
const expect = require('chai').expect;
|
||||||
|
@ -207,7 +208,7 @@ describe('Cluster sync', function() {
|
||||||
let collections = db._collections();
|
let collections = db._collections();
|
||||||
expect(collections.map(collection => collection.name())).to.contain('s100001');
|
expect(collections.map(collection => collection.name())).to.contain('s100001');
|
||||||
let count = 0;
|
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);
|
wait(0.1);
|
||||||
}
|
}
|
||||||
expect(db._collection('s100001').status()).to.equal(ArangoCollection.STATUS_UNLOADED);
|
expect(db._collection('s100001').status()).to.equal(ArangoCollection.STATUS_UNLOADED);
|
||||||
|
@ -260,7 +261,7 @@ describe('Cluster sync', function() {
|
||||||
cluster.executePlanForCollections(plan);
|
cluster.executePlanForCollections(plan);
|
||||||
db._useDatabase('test');
|
db._useDatabase('test');
|
||||||
let count = 0;
|
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);
|
wait(0.1);
|
||||||
}
|
}
|
||||||
expect(db._collection('s100001').status()).to.equal(ArangoCollection.STATUS_UNLOADED);
|
expect(db._collection('s100001').status()).to.equal(ArangoCollection.STATUS_UNLOADED);
|
||||||
|
|
Loading…
Reference in New Issue