1
0
Fork 0

moveShard with distributeShardsLike

This commit is contained in:
Kaveh Vahedipour 2016-10-04 11:41:26 +02:00
parent c5ffd83fa4
commit 595fc9b84e
5 changed files with 7 additions and 33 deletions

View File

@ -241,27 +241,6 @@ bool CleanOutServer::start() {
return false;
}
template<class Iter>
struct iter_pair_range : std::pair<Iter,Iter> {
iter_pair_range(std::pair<Iter,Iter> const& x)
: std::pair<Iter,Iter>(x)
{}
Iter begin() const {return this->first;}
Iter end() const {return this->second;}
};
template<class Iter>
inline iter_pair_range<Iter> as_range(std::pair<Iter,Iter> const& x)
{ return iter_pair_range<Iter>(x); }
//template<class T, class S>
/*std::ostream& operator<< (std::ostream& os, std::multimap<std::string,std::string> const& mm) {
for (const auto& i : mm) {
os << i.first << ": " << i.second;
}
return os;
}*/
bool CleanOutServer::scheduleMoveShards() {
std::vector<std::string> availServers;
@ -307,11 +286,6 @@ bool CleanOutServer::scheduleMoveShards() {
}
}
LOG(WARN) << originals;
for (const auto& i : clones) {
LOG(WARN) << i.first << ": " << i.second;
}
for (const auto& original : originals) {
auto const& collection = (*(database.second))(original);

View File

@ -110,9 +110,7 @@ bool MoveShard::create() {
shardsLikeMe.push_back(opos->first);
}
}
} catch (std::exception const& e) {
LOG(WARN) << e.what();
}
} catch (...) {}
}
std::string path, now(timepointToString(std::chrono::system_clock::now()));

View File

@ -1076,6 +1076,8 @@ actions.defineHttp({
"body must be an object with string attributes 'database', 'collection', 'shard', 'fromServer' and 'toServer'");
return;
}
body.shards=[body.shard];
body.collections=[body.collection];
var r = require('@arangodb/cluster').moveShard(body);
if (r.error) {
actions.resultError(req, res, actions.HTTP_SERVICE_UNAVAILABLE, r);

View File

@ -168,8 +168,8 @@
var data = {
database: dbName,
collection: collectionName,
shard: shardName,
collections: [collectionName],
shards: [shardName],
fromServer: fromServer,
toServer: toServer
};

View File

@ -1784,8 +1784,8 @@ function moveShard (info) {
id = global.ArangoClusterInfo.uniqid();
var todo = { 'type': 'moveShard',
'database': info.database,
'collection': collInfo.id,
'shard': info.shard,
'collections': [collInfo.id],
'shards': [info.shard],
'fromServer': info.fromServer,
'toServer': info.toServer,
'jobId': id,