mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'sharding' of ssh://github.com/triAGENS/ArangoDB into sharding
This commit is contained in:
commit
69c3456e1d
|
@ -807,7 +807,7 @@ void ClusterInfo::loadCurrentCollections (bool acquireLock) {
|
|||
|
||||
// Now take note of this shard and its responsible server:
|
||||
std::string DBserver = triagens::basics::JsonHelper::getStringValue
|
||||
(json, "DBserver", "");
|
||||
(json, "DBServer", "");
|
||||
if (DBserver != "") {
|
||||
_shardIds.insert(make_pair<ShardID, ServerID>(shardID, DBserver));
|
||||
}
|
||||
|
|
|
@ -595,7 +595,7 @@ namespace triagens {
|
|||
if (it != _jsons.end()) {
|
||||
TRI_json_t* _json = _jsons.begin()->second;
|
||||
return triagens::basics::JsonHelper::getStringValue
|
||||
(_json, "DBserver", "");
|
||||
(_json, "DBServer", "");
|
||||
}
|
||||
return string("");
|
||||
}
|
||||
|
|
|
@ -845,8 +845,7 @@ static v8::Handle<v8::Value> JS_GetCollectionInfoCurrentClusterInfo (v8::Argumen
|
|||
result->Set(v8::String::New("waitForSync"), v8::Boolean::New(cic.waitForSync(shardID)));
|
||||
result->Set(v8::String::New("journalSize"), v8::Number::New(cic.journalSize(shardID)));
|
||||
const std::string serverID = cic.responsibleServer(shardID);
|
||||
result->Set(v8::String::New("responsibleServer"),
|
||||
v8::String::New(serverID.c_str(), serverID.size()));
|
||||
result->Set(v8::String::New("DBServer"), v8::String::New(serverID.c_str(), serverID.size()));
|
||||
|
||||
// TODO: fill "indexes"
|
||||
v8::Handle<v8::Array> indexes = v8::Array::New();
|
||||
|
|
|
@ -248,6 +248,9 @@ function createLocalDatabases (plannedDatabases) {
|
|||
|
||||
try {
|
||||
db._createDatabase(payload.name);
|
||||
payload.error = false;
|
||||
payload.errorNum = 0;
|
||||
payload.errorMessage = "no error";
|
||||
}
|
||||
catch (err) {
|
||||
payload.error = true;
|
||||
|
@ -426,7 +429,7 @@ function createLocalCollections (plannedCollections) {
|
|||
payload.errorMessage = err2.errorMessage;
|
||||
}
|
||||
|
||||
payload.DBserver = ourselves;
|
||||
payload.DBServer = ourselves;
|
||||
writeLocked({ part: "Current" },
|
||||
createCollectionAgency,
|
||||
[ database, shard, payload ]);
|
||||
|
@ -449,6 +452,10 @@ function createLocalCollections (plannedCollections) {
|
|||
shard);
|
||||
db._collection(shard).load();
|
||||
}
|
||||
payload.error = false;
|
||||
payload.errorNum = 0;
|
||||
payload.errorMessage = "no error";
|
||||
payload.DBServer = ourselves;
|
||||
|
||||
writeLocked({ part: "Current" },
|
||||
createCollectionAgency,
|
||||
|
@ -483,7 +490,7 @@ function createLocalCollections (plannedCollections) {
|
|||
payload.errorMessage = err3.errorMessage;
|
||||
}
|
||||
|
||||
payload.DBserver = ourselves;
|
||||
payload.DBServer = ourselves;
|
||||
writeLocked({ part: "Current" },
|
||||
createCollectionAgency,
|
||||
[ database, shard, payload ]);
|
||||
|
@ -608,12 +615,14 @@ function cleanupCurrentCollections (plannedCollections) {
|
|||
if (collections.hasOwnProperty(collection)) {
|
||||
var shards = collections[collection];
|
||||
var shard;
|
||||
|
||||
|
||||
for (shard in shards) {
|
||||
if (shards.hasOwnProperty(shard)) {
|
||||
if (! shardMap.hasOwnProperty(shard) ||
|
||||
shardMap[shard] !== ourselves) {
|
||||
|
||||
|
||||
if (shards[shard].DBServer === ourselves &&
|
||||
(! shardMap.hasOwnProperty(shard) ||
|
||||
shardMap[shard] !== ourselves)) {
|
||||
// found a shard we are entered for but that we don't have locally
|
||||
console.info("cleaning up entry for unknown shard '%s' of '%s/%s",
|
||||
shard,
|
||||
database,
|
||||
|
|
Loading…
Reference in New Issue