mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/arangodb into devel
This commit is contained in:
commit
4afac13a4c
|
@ -357,7 +357,7 @@ static int distributeBabyOnShards(
|
|||
// We have invalid input at this point.
|
||||
// However we can work with the other babies.
|
||||
// This is for compatibility with single server
|
||||
// We just asign it to any shard and pretend the user has given a key
|
||||
// We just assign it to any shard and pretend the user has given a key
|
||||
std::shared_ptr<std::vector<ShardID>> shards = ci->getShardList(collid);
|
||||
shardID = shards->at(0);
|
||||
userSpecifiedKey = true;
|
||||
|
@ -1789,7 +1789,20 @@ int getFilteredEdgesOnCoordinator(
|
|||
std::shared_ptr<LogicalCollection> collinfo =
|
||||
ci->getCollection(dbname, collname);
|
||||
|
||||
auto shards = collinfo->shardIds();
|
||||
std::shared_ptr<std::unordered_map<std::string, std::vector<std::string>>> shards;
|
||||
if (collinfo->isSmart() && collinfo->type() == TRI_COL_TYPE_EDGE) {
|
||||
auto names = collinfo->realNamesForRead();
|
||||
shards = std::make_shared<std::unordered_map<std::string, std::vector<std::string>>>();
|
||||
for (auto const& n : names) {
|
||||
collinfo = ci->getCollection(dbname, n);
|
||||
auto smap = collinfo->shardIds();
|
||||
for (auto const& x : *smap) {
|
||||
shards->insert(x);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
shards = collinfo->shardIds();
|
||||
}
|
||||
std::string queryParameters = "?vertex=" + StringUtils::urlEncode(vertex);
|
||||
if (direction == TRI_EDGE_IN) {
|
||||
queryParameters += "&direction=in";
|
||||
|
|
|
@ -794,11 +794,24 @@ static void JS_DocumentVocbaseCol(
|
|||
}
|
||||
|
||||
|
||||
#ifndef USE_ENTERPRISE
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief unloads a collection, case of a coordinator in a cluster
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int ULVocbaseColCoordinator(std::string const& databaseName,
|
||||
std::string const& collectionCID,
|
||||
TRI_vocbase_col_status_e status) {
|
||||
|
||||
return ClusterInfo::instance()->setCollectionStatusCoordinator(
|
||||
databaseName, collectionCID, status);
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief drops a collection, case of a coordinator in a cluster
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef USE_ENTERPRISE
|
||||
static void DropVocbaseColCoordinator(
|
||||
v8::FunctionCallbackInfo<v8::Value> const& args,
|
||||
arangodb::LogicalCollection* collection) {
|
||||
|
@ -988,37 +1001,41 @@ static void JS_LoadVocbaseCol(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
}
|
||||
|
||||
if (ServerState::instance()->isCoordinator()) {
|
||||
std::string const databaseName(collection->dbName());
|
||||
std::string const cid = collection->cid_as_string();
|
||||
|
||||
int res = ClusterInfo::instance()->setCollectionStatusCoordinator(
|
||||
databaseName, cid, TRI_VOC_COL_STATUS_LOADED);
|
||||
|
||||
int res =
|
||||
#ifdef USE_ENTERPRISE
|
||||
ULVocbaseColCoordinatorEnterprise(
|
||||
collection->dbName(), collection->cid_as_string(),
|
||||
TRI_VOC_COL_STATUS_LOADED);
|
||||
#else
|
||||
ULVocbaseColCoordinator(
|
||||
collection->dbName(), collection->cid_as_string(),
|
||||
TRI_VOC_COL_STATUS_LOADED);
|
||||
#endif
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_V8_THROW_EXCEPTION(res);
|
||||
}
|
||||
|
||||
TRI_V8_RETURN_UNDEFINED();
|
||||
}
|
||||
|
||||
SingleCollectionTransaction trx(
|
||||
V8TransactionContext::Create(collection->vocbase(), true),
|
||||
collection->cid(), TRI_TRANSACTION_READ);
|
||||
|
||||
V8TransactionContext::Create(collection->vocbase(), true),
|
||||
collection->cid(), TRI_TRANSACTION_READ);
|
||||
|
||||
int res = trx.begin();
|
||||
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_V8_THROW_EXCEPTION(res);
|
||||
}
|
||||
|
||||
|
||||
res = trx.finish(res);
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
TRI_V8_THROW_EXCEPTION(res);
|
||||
}
|
||||
|
||||
|
||||
TRI_V8_RETURN_UNDEFINED();
|
||||
TRI_V8_TRY_CATCH_END
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2415,11 +2432,18 @@ static void JS_UnloadVocbaseCol(
|
|||
int res;
|
||||
|
||||
if (ServerState::instance()->isCoordinator()) {
|
||||
std::string const databaseName(collection->dbName());
|
||||
|
||||
res = ClusterInfo::instance()->setCollectionStatusCoordinator(
|
||||
databaseName, collection->cid_as_string(),
|
||||
|
||||
res =
|
||||
#ifdef USE_ENTERPRISE
|
||||
ULVocbaseColCoordinatorEnterprise(
|
||||
collection->dbName(), collection->cid_as_string(),
|
||||
TRI_VOC_COL_STATUS_UNLOADED);
|
||||
#else
|
||||
ULVocbaseColCoordinator(
|
||||
collection->dbName(), collection->cid_as_string(),
|
||||
TRI_VOC_COL_STATUS_UNLOADED);
|
||||
#endif
|
||||
|
||||
} else {
|
||||
res = collection->vocbase()->unloadCollection(collection, false);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "Basics/Common.h"
|
||||
#include "Utils/CollectionNameResolver.h"
|
||||
#include "V8Server/v8-vocbase.h"
|
||||
#include "VocBase/vocbase.h"
|
||||
|
||||
namespace arangodb {
|
||||
class LogicalCollection;
|
||||
|
@ -65,5 +66,11 @@ void TRI_InitV8Collection(v8::Handle<v8::Context> context,
|
|||
void DropVocbaseColCoordinatorEnterprise(
|
||||
v8::FunctionCallbackInfo<v8::Value> const& args,
|
||||
arangodb::LogicalCollection* collection);
|
||||
|
||||
int ULVocbaseColCoordinatorEnterprise(std::string const& databaseName,
|
||||
std::string const& collectionCID,
|
||||
TRI_vocbase_col_status_e status);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue