mirror of https://gitee.com/bigwinds/arangodb
moveShard with distributeShardsLike
This commit is contained in:
parent
c5ffd83fa4
commit
595fc9b84e
|
@ -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);
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -168,8 +168,8 @@
|
|||
|
||||
var data = {
|
||||
database: dbName,
|
||||
collection: collectionName,
|
||||
shard: shardName,
|
||||
collections: [collectionName],
|
||||
shards: [shardName],
|
||||
fromServer: fromServer,
|
||||
toServer: toServer
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue