mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'sharding' of github.com:triAGENS/ArangoDB into sharding
This commit is contained in:
commit
db4a7813cf
|
@ -1112,12 +1112,12 @@ int createEdgeOnCoordinator (
|
|||
// Send a synchronous request to that shard using ClusterComm:
|
||||
ClusterCommResult* res;
|
||||
map<string, string> headers;
|
||||
res = cc->syncRequest("", TRI_NewTickServer(), "shard:"+shardID,
|
||||
res = cc->syncRequest("", TRI_NewTickServer(), "shard:" + shardID,
|
||||
triagens::rest::HttpRequest::HTTP_REQUEST_POST,
|
||||
"/_db/"+dbname+"/_api/edge?collection="+
|
||||
StringUtils::urlEncode(shardID)+"&waitForSync="+
|
||||
(waitForSync ? "true" : "false")+
|
||||
"&from="+StringUtils::urlEncode(from)+"&to="+StringUtils::urlEncode(to),
|
||||
"/_db/" + dbname + "/_api/edge?collection=" +
|
||||
StringUtils::urlEncode(shardID) + "&waitForSync=" +
|
||||
(waitForSync ? "true" : "false") +
|
||||
"&from=" + StringUtils::urlEncode(from) + "&to=" + StringUtils::urlEncode(to),
|
||||
body, headers, 60.0);
|
||||
|
||||
if (res->status == CL_COMM_TIMEOUT) {
|
||||
|
|
|
@ -229,8 +229,7 @@ bool RestEdgeHandler::createDocument () {
|
|||
#ifdef TRI_ENABLE_CLUSTER
|
||||
if (ServerState::instance()->isCoordinator()) {
|
||||
// json will be freed inside!
|
||||
return createDocumentCoordinator(collection, waitForSync, json,
|
||||
from, to);
|
||||
return createDocumentCoordinator(collection, waitForSync, json, from, to);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -7687,6 +7687,24 @@ static v8::Handle<v8::Value> SaveVocbaseColCoordinator (TRI_vocbase_col_t* colle
|
|||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief extract a key from a v8 object
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static string GetId (v8::Handle<v8::Value> const& arg) {
|
||||
if (arg->IsObject() && ! arg->IsArray()) {
|
||||
v8::Local<v8::Object> obj = arg->ToObject();
|
||||
|
||||
TRI_v8_global_t* v8g = (TRI_v8_global_t*) v8::Isolate::GetCurrent()->GetData();
|
||||
|
||||
if (obj->Has(v8g->_IdKey)) {
|
||||
return TRI_ObjectToString(obj->Get(v8g->_IdKey));
|
||||
}
|
||||
}
|
||||
|
||||
return TRI_ObjectToString(arg);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief saves an edge, coordinator case in a cluster
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -7706,11 +7724,14 @@ static v8::Handle<v8::Value> SaveEdgeColCoordinator (TRI_vocbase_col_t* collecti
|
|||
if (argv.Length() < 3 || argv.Length() > 4) {
|
||||
TRI_V8_EXCEPTION_USAGE(scope, "save(<from>, <to>, <data>, [<waitForSync>])");
|
||||
}
|
||||
string _from = TRI_ObjectToString(argv[0]);
|
||||
string _to = TRI_ObjectToString(argv[1]);
|
||||
|
||||
string _from = GetId(argv[0]);
|
||||
string _to = GetId(argv[1]);
|
||||
|
||||
TRI_json_t* json = TRI_ObjectToJson(argv[2]);
|
||||
|
||||
const bool waitForSync = ExtractForceSync(argv, 3);
|
||||
if (!TRI_IsArrayJson(json)) {
|
||||
if (! TRI_IsArrayJson(json)) {
|
||||
if (0 != json) {
|
||||
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue