1
0
Fork 0

Another snapshot.

This commit is contained in:
Max Neunhoeffer 2015-12-04 16:08:02 +01:00
parent 60df924ac1
commit 10ff104236
3 changed files with 30 additions and 17 deletions

View File

@ -1008,11 +1008,11 @@ static void insertIntoShardMap (ClusterInfo* ci,
else { else {
// Sorry we do not know the responsible shard yet // Sorry we do not know the responsible shard yet
// Ask all of them // Ask all of them
std::map<std::string, std::string> shardIds = collinfo->shardIds(); auto shardList = ci->getShardList(collid);
for (auto shard : shardIds) { for (auto const& shard : *shardList) {
auto it = shardMap.find(shard.first); auto it = shardMap.find(shard);
if (it == shardMap.end()) { if (it == shardMap.end()) {
shardMap.emplace(shard.first, std::vector<std::string>({splitId[1]})); shardMap.emplace(shard, std::vector<std::string>({splitId[1]}));
} }
else { else {
it->second.push_back(splitId[1]); it->second.push_back(splitId[1]);
@ -1261,8 +1261,7 @@ int getFilteredEdgesOnCoordinator (
ClusterCommResult* res; ClusterCommResult* res;
map<ShardID, ServerID> shards = collinfo->shardIds(); auto shards = collinfo->shardIds();
map<ShardID, ServerID>::iterator it;
CoordTransactionID coordTransactionID = TRI_NewTickServer(); CoordTransactionID coordTransactionID = TRI_NewTickServer();
std::string queryParameters = "?vertex=" + StringUtils::urlEncode(vertex); std::string queryParameters = "?vertex=" + StringUtils::urlEncode(vertex);
if (direction == TRI_EDGE_IN) { if (direction == TRI_EDGE_IN) {
@ -1281,11 +1280,11 @@ int getFilteredEdgesOnCoordinator (
} }
reqBodyString->append(body.toString()); reqBodyString->append(body.toString());
} }
for (it = shards.begin(); it != shards.end(); ++it) { for (auto const& p : *shards) {
map<string, string>* headers = new map<string, string>; map<string, string>* headers = new map<string, string>;
res = cc->asyncRequest("", coordTransactionID, "shard:" + it->first, res = cc->asyncRequest("", coordTransactionID, "shard:" + p.first,
triagens::rest::HttpRequest::HTTP_REQUEST_PUT, triagens::rest::HttpRequest::HTTP_REQUEST_PUT,
"/_db/" + StringUtils::urlEncode(dbname) + "/_api/edges/" + it->first + queryParameters, "/_db/" + StringUtils::urlEncode(dbname) + "/_api/edges/" + p.first + queryParameters,
reqBodyString, headers, nullptr, 3600.0); reqBodyString, headers, nullptr, 3600.0);
delete res; delete res;
} }
@ -1298,7 +1297,7 @@ int getFilteredEdgesOnCoordinator (
triagens::basics::Json documents(triagens::basics::Json::Array); triagens::basics::Json documents(triagens::basics::Json::Array);
for (count = (int) shards.size(); count > 0; count--) { for (count = (int) shards->size(); count > 0; count--) {
res = cc->wait( "", coordTransactionID, 0, "", 0.0); res = cc->wait( "", coordTransactionID, 0, "", 0.0);
if (res->status == CL_COMM_TIMEOUT) { if (res->status == CL_COMM_TIMEOUT) {
delete res; delete res;

View File

@ -1097,8 +1097,6 @@ static void CreateCollectionCoordinator (const v8::FunctionCallbackInfo<v8::Valu
} }
velocy("indexes", Value(ValueType::Array)); velocy("indexes", Value(ValueType::Array));
velocy.close();
velocy.close();
// create a dummy primary index // create a dummy primary index
TRI_document_collection_t* doc = nullptr; TRI_document_collection_t* doc = nullptr;
@ -1107,12 +1105,11 @@ static void CreateCollectionCoordinator (const v8::FunctionCallbackInfo<v8::Valu
auto idxJson = primaryIndex->toJson(TRI_UNKNOWN_MEM_ZONE, false); auto idxJson = primaryIndex->toJson(TRI_UNKNOWN_MEM_ZONE, false);
TRI_json_t* index = idxJson.json();
TRI_json_t* indexes; TRI_json_t* indexes;
TRI_json_t* json; TRI_json_t* json;
TRI_PushBack3ArrayJson(TRI_UNKNOWN_MEM_ZONE, indexes, TRI_CopyJson(TRI_UNKNOWN_MEM_ZONE, idxJson.json()));
if (collectionType == TRI_COL_TYPE_EDGE) { if (collectionType == TRI_COL_TYPE_EDGE) {
// create a dummy edge index // create a dummy edge index
std::unique_ptr<triagens::arango::EdgeIndex> edgeIndex(new triagens::arango::EdgeIndex(id, nullptr)); std::unique_ptr<triagens::arango::EdgeIndex> edgeIndex(new triagens::arango::EdgeIndex(id, nullptr));

View File

@ -299,8 +299,25 @@ namespace triagens {
catch (...) { catch (...) {
return std::shared_ptr<arangodb::velocypack::Builder>(); return std::shared_ptr<arangodb::velocypack::Builder>();
} }
return std::shared_ptr<arangodb::velocypack::Builder>(); return parser.steal();
// FIXME: activate return parser.steal(); }
////////////////////////////////////////////////////////////////////////////////
/// @brief TRI_json_t to VelocyPack, writing into an existing Builder
////////////////////////////////////////////////////////////////////////////////
static int toVelocyPack (
TRI_json_t const* json,
std::shared_ptr<arangodb::velocypack::Builder> builder) {
std::string tmp = toString(json);
arangodb::velocypack::Parser parser(builder);
try {
parser.parse(tmp);
}
catch (...) {
return TRI_ERROR_INTERNAL;
}
return TRI_ERROR_NO_ERROR;
} }
}; };