mirror of https://gitee.com/bigwinds/arangodb
issue 465.4: remove unused functions (#6398)
This commit is contained in:
parent
c4d878ece8
commit
d365c7cfd5
|
@ -63,25 +63,13 @@ transaction::Methods* AqlTransaction::clone(
|
||||||
/// @brief add a collection to the transaction
|
/// @brief add a collection to the transaction
|
||||||
Result AqlTransaction::processCollection(aql::Collection* collection) {
|
Result AqlTransaction::processCollection(aql::Collection* collection) {
|
||||||
if (ServerState::instance()->isCoordinator()) {
|
if (ServerState::instance()->isCoordinator()) {
|
||||||
return processCollectionCoordinator(collection);
|
auto cid = resolver()->getCollectionId(collection->name());
|
||||||
|
|
||||||
|
return addCollection(cid, collection->name(), collection->accessType());
|
||||||
}
|
}
|
||||||
return processCollectionNormal(collection);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief add a coordinator collection to the transaction
|
|
||||||
|
|
||||||
Result AqlTransaction::processCollectionCoordinator(
|
|
||||||
aql::Collection* collection) {
|
|
||||||
TRI_voc_cid_t cid = resolver()->getCollectionId(collection->name());
|
|
||||||
|
|
||||||
return addCollection(cid, collection->name(), collection->accessType());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @brief add a regular collection to the transaction
|
|
||||||
|
|
||||||
Result AqlTransaction::processCollectionNormal(aql::Collection* collection) {
|
|
||||||
TRI_voc_cid_t cid = 0;
|
TRI_voc_cid_t cid = 0;
|
||||||
auto col = resolver()->getCollectionStruct(collection->name());
|
auto col = resolver()->getCollection(collection->name());
|
||||||
|
|
||||||
if (col != nullptr) {
|
if (col != nullptr) {
|
||||||
cid = col->id();
|
cid = col->id();
|
||||||
|
|
|
@ -66,12 +66,6 @@ class AqlTransaction : public transaction::Methods {
|
||||||
/// @brief add a collection to the transaction
|
/// @brief add a collection to the transaction
|
||||||
Result processCollection(aql::Collection*);
|
Result processCollection(aql::Collection*);
|
||||||
|
|
||||||
/// @brief add a coordinator collection to the transaction
|
|
||||||
Result processCollectionCoordinator(aql::Collection*);
|
|
||||||
|
|
||||||
/// @brief add a regular collection to the transaction
|
|
||||||
Result processCollectionNormal(aql::Collection* collection);
|
|
||||||
|
|
||||||
/// @brief documentCollection
|
/// @brief documentCollection
|
||||||
LogicalCollection* documentCollection(TRI_voc_cid_t cid);
|
LogicalCollection* documentCollection(TRI_voc_cid_t cid);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "RestServer/DatabasePathFeature.h"
|
#include "RestServer/DatabasePathFeature.h"
|
||||||
#include "StorageEngine/TransactionState.h"
|
#include "StorageEngine/TransactionState.h"
|
||||||
#include "Transaction/Methods.h"
|
#include "Transaction/Methods.h"
|
||||||
|
#include "VocBase/LogicalCollection.h"
|
||||||
#include "VocBase/vocbase.h"
|
#include "VocBase/vocbase.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -618,14 +619,15 @@ PrimaryKeyIndexReader* IResearchViewDBServer::snapshot(
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (auto& shardId : shards) {
|
for (auto& shardId : shards) {
|
||||||
auto const cid = resolver->getCollectionIdLocal(shardId);
|
auto shard = resolver->getCollection(shardId);
|
||||||
|
|
||||||
if (0 == cid) {
|
if (!shard) {
|
||||||
LOG_TOPIC(ERR, arangodb::iresearch::TOPIC)
|
LOG_TOPIC(ERR, arangodb::iresearch::TOPIC)
|
||||||
<< "failed to find shard by id '" << shardId << "', skipping it";
|
<< "failed to find shard by id '" << shardId << "', skipping it";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto cid = shard->id();
|
||||||
auto const shardView = _collections.find(cid);
|
auto const shardView = _collections.find(cid);
|
||||||
|
|
||||||
if (shardView == _collections.end()) {
|
if (shardView == _collections.end()) {
|
||||||
|
|
|
@ -286,7 +286,7 @@ bool RestEdgesHandler::readEdges() {
|
||||||
if (ServerState::instance()->isDBServer()) {
|
if (ServerState::instance()->isDBServer()) {
|
||||||
// If we are a DBserver, we want to use the cluster-wide collection
|
// If we are a DBserver, we want to use the cluster-wide collection
|
||||||
// name for error reporting:
|
// name for error reporting:
|
||||||
collectionName = trx->resolver()->getCollectionName(trx->cid());
|
collectionName = trx->resolver()->getCollectionNameCluster(trx->cid());
|
||||||
}
|
}
|
||||||
generateTransactionError(collectionName, res, "");
|
generateTransactionError(collectionName, res, "");
|
||||||
return false;
|
return false;
|
||||||
|
@ -437,7 +437,7 @@ bool RestEdgesHandler::readEdgesForMultipleVertices() {
|
||||||
if (ServerState::instance()->isDBServer()) {
|
if (ServerState::instance()->isDBServer()) {
|
||||||
// If we are a DBserver, we want to use the cluster-wide collection
|
// If we are a DBserver, we want to use the cluster-wide collection
|
||||||
// name for error reporting:
|
// name for error reporting:
|
||||||
collectionName = trx->resolver()->getCollectionName(trx->cid());
|
collectionName = trx->resolver()->getCollectionNameCluster(trx->cid());
|
||||||
}
|
}
|
||||||
generateTransactionError(collectionName, res, "");
|
generateTransactionError(collectionName, res, "");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -61,6 +61,8 @@ class CollectionNameResolver {
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief look up a collection struct for a collection id
|
/// @brief look up a collection struct for a collection id
|
||||||
|
/// @return the local collection on dbserver / standalone
|
||||||
|
/// the cluster collection on coordinator
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
std::shared_ptr<LogicalCollection> getCollection(
|
std::shared_ptr<LogicalCollection> getCollection(
|
||||||
TRI_voc_cid_t id
|
TRI_voc_cid_t id
|
||||||
|
@ -69,6 +71,8 @@ class CollectionNameResolver {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief look up a collection struct for a
|
/// @brief look up a collection struct for a
|
||||||
/// collection name, stringified id (or uuid for dbserver / standalone)
|
/// collection name, stringified id (or uuid for dbserver / standalone)
|
||||||
|
/// @return the local collection on dbserver / standalone
|
||||||
|
/// the cluster collection on coordinator
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
std::shared_ptr<LogicalCollection> getCollection(
|
std::shared_ptr<LogicalCollection> getCollection(
|
||||||
std::string const& nameOrId
|
std::string const& nameOrId
|
||||||
|
@ -99,6 +103,8 @@ class CollectionNameResolver {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
TRI_voc_cid_t getCollectionId(std::string const& name) const;
|
TRI_voc_cid_t getCollectionId(std::string const& name) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief look up a collection struct for a collection name
|
/// @brief look up a collection struct for a collection name
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -106,6 +112,8 @@ class CollectionNameResolver {
|
||||||
std::string const& name
|
std::string const& name
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief look up a collection name for a collection id, this implements
|
/// @brief look up a collection name for a collection id, this implements
|
||||||
/// some magic in the cluster case: a DBserver in a cluster will automatically
|
/// some magic in the cluster case: a DBserver in a cluster will automatically
|
||||||
|
@ -128,6 +136,8 @@ class CollectionNameResolver {
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief look up a data-source struct for a data-source id
|
/// @brief look up a data-source struct for a data-source id
|
||||||
|
/// @return the local data-source on dbserver / standalone
|
||||||
|
/// the cluster data-source on coordinator
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
std::shared_ptr<LogicalDataSource> getDataSource(
|
std::shared_ptr<LogicalDataSource> getDataSource(
|
||||||
TRI_voc_cid_t id
|
TRI_voc_cid_t id
|
||||||
|
@ -136,6 +146,8 @@ class CollectionNameResolver {
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief look up a data-source struct for a
|
/// @brief look up a data-source struct for a
|
||||||
/// data-source name, stringified id (or uuid for dbserver/standalone)
|
/// data-source name, stringified id (or uuid for dbserver/standalone)
|
||||||
|
/// @return the local data-source on dbserver / standalone
|
||||||
|
/// the cluster data-source on coordinator
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
std::shared_ptr<LogicalDataSource> getDataSource(
|
std::shared_ptr<LogicalDataSource> getDataSource(
|
||||||
std::string const& nameOrId
|
std::string const& nameOrId
|
||||||
|
@ -143,12 +155,16 @@ class CollectionNameResolver {
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief look up a view struct for a view id
|
/// @brief look up a view struct for a view id
|
||||||
|
/// @return the local view on dbserver / standalone
|
||||||
|
/// the cluster view on coordinator
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
std::shared_ptr<LogicalView> getView(TRI_voc_cid_t id) const;
|
std::shared_ptr<LogicalView> getView(TRI_voc_cid_t id) const;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief look up a view struct for a
|
/// @brief look up a view struct for a
|
||||||
/// view name, stringified id (or uuid for dbserver / standalone)
|
/// view name, stringified id (or uuid for dbserver / standalone)
|
||||||
|
/// @return the local view on dbserver / standalone
|
||||||
|
/// the cluster view on coordinator
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
std::shared_ptr<LogicalView> getView(
|
std::shared_ptr<LogicalView> getView(
|
||||||
std::string const& nameOrId
|
std::string const& nameOrId
|
||||||
|
|
|
@ -172,7 +172,6 @@ static std::string ExtractIdString(v8::Isolate* isolate,
|
||||||
|
|
||||||
static int ParseDocumentOrDocumentHandle(
|
static int ParseDocumentOrDocumentHandle(
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
TRI_vocbase_t* vocbase,
|
|
||||||
CollectionNameResolver const* resolver,
|
CollectionNameResolver const* resolver,
|
||||||
std::shared_ptr<arangodb::LogicalCollection>& collection,
|
std::shared_ptr<arangodb::LogicalCollection>& collection,
|
||||||
std::string& collectionName,
|
std::string& collectionName,
|
||||||
|
@ -211,16 +210,8 @@ static int ParseDocumentOrDocumentHandle(
|
||||||
if (collection == nullptr) {
|
if (collection == nullptr) {
|
||||||
// no collection object was passed, now check the user-supplied collection
|
// no collection object was passed, now check the user-supplied collection
|
||||||
// name
|
// name
|
||||||
if (ServerState::instance()->isCoordinator()) {
|
collection = resolver->getCollection(collectionName);
|
||||||
ClusterInfo* ci = ClusterInfo::instance();
|
|
||||||
try {
|
|
||||||
collection = ci->getCollection(vocbase->name(), collectionName);
|
|
||||||
} catch (...) {
|
|
||||||
return TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
collection = resolver->getCollectionStruct(collectionName);
|
|
||||||
}
|
|
||||||
if (collection == nullptr) {
|
if (collection == nullptr) {
|
||||||
// collection not found
|
// collection not found
|
||||||
return TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND;
|
return TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND;
|
||||||
|
@ -344,7 +335,6 @@ static void ExistsVocbaseVPack(
|
||||||
|
|
||||||
res = ParseDocumentOrDocumentHandle(
|
res = ParseDocumentOrDocumentHandle(
|
||||||
isolate,
|
isolate,
|
||||||
vocbase,
|
|
||||||
&(transactionContext->resolver()),
|
&(transactionContext->resolver()),
|
||||||
collection,
|
collection,
|
||||||
collectionName,
|
collectionName,
|
||||||
|
@ -511,7 +501,6 @@ static void DocumentVocbase(
|
||||||
VPackObjectBuilder guard(&builder);
|
VPackObjectBuilder guard(&builder);
|
||||||
int res = ParseDocumentOrDocumentHandle(
|
int res = ParseDocumentOrDocumentHandle(
|
||||||
isolate,
|
isolate,
|
||||||
&vocbase,
|
|
||||||
&(transactionContext->resolver()),
|
&(transactionContext->resolver()),
|
||||||
collection,
|
collection,
|
||||||
collectionName,
|
collectionName,
|
||||||
|
@ -749,7 +738,6 @@ static void RemoveVocbase(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||||
VPackObjectBuilder guard(&builder);
|
VPackObjectBuilder guard(&builder);
|
||||||
int res = ParseDocumentOrDocumentHandle(
|
int res = ParseDocumentOrDocumentHandle(
|
||||||
isolate,
|
isolate,
|
||||||
&vocbase,
|
|
||||||
&(transactionContext->resolver()),
|
&(transactionContext->resolver()),
|
||||||
collection,
|
collection,
|
||||||
collectionName,
|
collectionName,
|
||||||
|
@ -1733,7 +1721,6 @@ static void ModifyVocbase(TRI_voc_document_operation_e operation,
|
||||||
|
|
||||||
res = ParseDocumentOrDocumentHandle(
|
res = ParseDocumentOrDocumentHandle(
|
||||||
isolate,
|
isolate,
|
||||||
&vocbase,
|
|
||||||
&(transactionContext->resolver()),
|
&(transactionContext->resolver()),
|
||||||
collection,
|
collection,
|
||||||
collectionName,
|
collectionName,
|
||||||
|
|
Loading…
Reference in New Issue