1
0
Fork 0

Merge branch 'sharding' of ssh://github.com/triAGENS/ArangoDB into sharding

This commit is contained in:
Max Neunhoeffer 2014-01-23 13:01:15 +01:00
commit 69c3456e1d
4 changed files with 18 additions and 10 deletions

View File

@ -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));
}

View File

@ -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("");
}

View File

@ -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();

View File

@ -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 ]);
@ -611,9 +618,11 @@ function cleanupCurrentCollections (plannedCollections) {
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,