mirror of https://gitee.com/bigwinds/arangodb
Merge branch '3.4' of https://github.com/arangodb/arangodb into 3.4
This commit is contained in:
commit
435c014a15
|
@ -804,7 +804,7 @@ void Agent::load() {
|
|||
>();
|
||||
arangodb::SystemDatabaseFeature::ptr vocbase =
|
||||
sysDbFeature ? sysDbFeature->use() : nullptr;
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();
|
||||
|
||||
if (vocbase == nullptr) {
|
||||
LOG_TOPIC(FATAL, Logger::AGENCY) << "could not determine _system database";
|
||||
|
|
|
@ -893,7 +893,7 @@ bool State::loadCompacted() {
|
|||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
|
||||
aql::QueryResult queryResult = query.executeSync(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
aql::QueryResult queryResult = query.executeSync(QueryRegistryFeature::registry());
|
||||
|
||||
if (queryResult.code != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(queryResult.code, queryResult.details);
|
||||
|
@ -943,7 +943,7 @@ bool State::loadOrPersistConfiguration() {
|
|||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
|
||||
aql::QueryResult queryResult = query.executeSync(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
aql::QueryResult queryResult = query.executeSync(QueryRegistryFeature::registry());
|
||||
|
||||
if (queryResult.code != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(queryResult.code, queryResult.details);
|
||||
|
@ -1055,7 +1055,7 @@ bool State::loadRemaining() {
|
|||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
|
||||
aql::QueryResult queryResult = query.executeSync(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
aql::QueryResult queryResult = query.executeSync(QueryRegistryFeature::registry());
|
||||
|
||||
if (queryResult.code != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(queryResult.code, queryResult.details);
|
||||
|
@ -1270,7 +1270,7 @@ bool State::compactPersisted(index_t cind, index_t keep) {
|
|||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
|
||||
aql::QueryResult queryResult = query.executeSync(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
aql::QueryResult queryResult = query.executeSync(QueryRegistryFeature::registry());
|
||||
|
||||
if (queryResult.code != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(queryResult.code, queryResult.details);
|
||||
|
@ -1303,7 +1303,7 @@ bool State::removeObsolete(index_t cind) {
|
|||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
|
||||
aql::QueryResult queryResult = query.executeSync(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
aql::QueryResult queryResult = query.executeSync(QueryRegistryFeature::registry());
|
||||
|
||||
if (queryResult.code != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(queryResult.code, queryResult.details);
|
||||
|
@ -1464,13 +1464,13 @@ query_t State::allLogs() const {
|
|||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
|
||||
aql::QueryResult compqResult = compq.executeSync(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
aql::QueryResult compqResult = compq.executeSync(QueryRegistryFeature::registry());
|
||||
|
||||
if (compqResult.code != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(compqResult.code, compqResult.details);
|
||||
}
|
||||
|
||||
aql::QueryResult logsqResult = logsq.executeSync(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
aql::QueryResult logsqResult = logsq.executeSync(QueryRegistryFeature::registry());
|
||||
|
||||
if (logsqResult.code != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(logsqResult.code, logsqResult.details);
|
||||
|
@ -1561,7 +1561,7 @@ std::shared_ptr<VPackBuilder> State::latestAgencyState(
|
|||
arangodb::aql::Query query(false, vocbase, aql::QueryString(aql), nullptr,
|
||||
nullptr, arangodb::aql::PART_MAIN);
|
||||
|
||||
aql::QueryResult queryResult = query.executeSync(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
aql::QueryResult queryResult = query.executeSync(QueryRegistryFeature::registry());
|
||||
|
||||
if (queryResult.code != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(queryResult.code, queryResult.details);
|
||||
|
@ -1588,7 +1588,7 @@ std::shared_ptr<VPackBuilder> State::latestAgencyState(
|
|||
arangodb::aql::Query query2(false, vocbase, aql::QueryString(aql), nullptr,
|
||||
nullptr, arangodb::aql::PART_MAIN);
|
||||
|
||||
aql::QueryResult queryResult2 = query2.executeSync(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
aql::QueryResult queryResult2 = query2.executeSync(QueryRegistryFeature::registry());
|
||||
|
||||
if (queryResult2.code != TRI_ERROR_NO_ERROR) {
|
||||
THROW_ARANGO_EXCEPTION_MESSAGE(queryResult2.code, queryResult2.details);
|
||||
|
|
|
@ -966,8 +966,9 @@ Result EngineInfoContainerDBServer::buildEngines(
|
|||
}
|
||||
|
||||
double ttl = QueryRegistryFeature::DefaultQueryTTL;
|
||||
if (QueryRegistryFeature::QUERY_REGISTRY != nullptr) {
|
||||
ttl = QueryRegistryFeature::QUERY_REGISTRY->defaultTTL();
|
||||
auto* registry = QueryRegistryFeature::registry();
|
||||
if (registry != nullptr) {
|
||||
ttl = registry->defaultTTL();
|
||||
}
|
||||
TRI_ASSERT(ttl > 0);
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ QueryStreamCursor::QueryStreamCursor(
|
|||
_guard(vocbase),
|
||||
_exportCount(-1),
|
||||
_queryResultPos(0) {
|
||||
TRI_ASSERT(QueryRegistryFeature::QUERY_REGISTRY != nullptr);
|
||||
TRI_ASSERT(QueryRegistryFeature::registry() != nullptr);
|
||||
|
||||
_query = std::make_unique<Query>(
|
||||
false,
|
||||
|
@ -169,7 +169,7 @@ QueryStreamCursor::QueryStreamCursor(
|
|||
std::move(opts),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
_query->prepare(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
_query->prepare(QueryRegistryFeature::registry());
|
||||
TRI_ASSERT(_query->state() == aql::QueryExecutionState::ValueType::EXECUTION);
|
||||
|
||||
// we replaced the rocksdb export cursor with a stream AQL query
|
||||
|
|
|
@ -856,6 +856,7 @@ void ClusterComm::cleanupAllQueues() {
|
|||
|
||||
ClusterCommThread::ClusterCommThread() : Thread("ClusterComm"), _cc(nullptr) {
|
||||
_cc = ClusterComm::instance().get();
|
||||
_communicator = std::make_shared<communicator::Communicator>();
|
||||
}
|
||||
|
||||
ClusterCommThread::~ClusterCommThread() { shutdown(); }
|
||||
|
@ -1259,9 +1260,8 @@ void ClusterCommThread::abortRequestsToFailedServers() {
|
|||
}
|
||||
|
||||
void ClusterCommThread::run() {
|
||||
TRI_ASSERT(_communicator != nullptr);
|
||||
LOG_TOPIC(DEBUG, Logger::CLUSTER) << "starting ClusterComm thread";
|
||||
_communicator = std::make_shared<communicator::Communicator>();
|
||||
|
||||
auto lastAbortCheck = std::chrono::steady_clock::now();
|
||||
while (!isStopping()) {
|
||||
try {
|
||||
|
|
|
@ -285,9 +285,8 @@ void GeneralServerFeature::defineHandlers() {
|
|||
AuthenticationFeature>("Authentication");
|
||||
TRI_ASSERT(authentication != nullptr);
|
||||
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto traverserEngineRegistry =
|
||||
TraverserEngineRegistryFeature::TRAVERSER_ENGINE_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();
|
||||
auto traverserEngineRegistry = TraverserEngineRegistryFeature::registry();
|
||||
if (_combinedRegistries == nullptr) {
|
||||
_combinedRegistries = std::make_unique<std::pair<aql::QueryRegistry*, traverser::TraverserEngineRegistry*>> (queryRegistry, traverserEngineRegistry);
|
||||
} else {
|
||||
|
|
|
@ -434,7 +434,7 @@ Result GraphManager::applyOnAllGraphs(
|
|||
arangodb::aql::QueryString{"FOR g IN _graphs RETURN g"}, nullptr,
|
||||
nullptr, aql::PART_MAIN);
|
||||
aql::QueryResult queryResult =
|
||||
query.executeSync(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.executeSync(QueryRegistryFeature::registry());
|
||||
|
||||
if (queryResult.code != TRI_ERROR_NO_ERROR) {
|
||||
if (queryResult.code == TRI_ERROR_REQUEST_CANCELED ||
|
||||
|
@ -605,7 +605,7 @@ OperationResult GraphManager::readGraphByQuery(velocypack::Builder& builder,
|
|||
LOG_TOPIC(DEBUG, arangodb::Logger::GRAPHS)
|
||||
<< "starting to load graphs information";
|
||||
aql::QueryResult queryResult =
|
||||
query.executeSync(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.executeSync(QueryRegistryFeature::registry());
|
||||
|
||||
if (queryResult.code != TRI_ERROR_NO_ERROR) {
|
||||
if (queryResult.code == TRI_ERROR_REQUEST_CANCELED ||
|
||||
|
|
|
@ -834,7 +834,7 @@ OperationResult GraphOperations::removeEdgeOrVertex(
|
|||
nullptr, arangodb::aql::PART_DEPENDENT);
|
||||
query.setTransactionContext(context);
|
||||
|
||||
auto queryResult = query.executeSync(QueryRegistryFeature::QUERY_REGISTRY);
|
||||
auto queryResult = query.executeSync(QueryRegistryFeature::registry());
|
||||
|
||||
if (queryResult.code != TRI_ERROR_NO_ERROR) {
|
||||
return OperationResult(queryResult.code);
|
||||
|
|
|
@ -1307,7 +1307,7 @@ Result RestReplicationHandler::processRestoreUsersBatch(
|
|||
nullptr,
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();
|
||||
TRI_ASSERT(queryRegistry != nullptr);
|
||||
|
||||
aql::QueryResult queryResult = query.executeSync(queryRegistry);
|
||||
|
@ -2625,7 +2625,7 @@ Result RestReplicationHandler::createBlockingTransaction(aql::QueryId id,
|
|||
// we want to allow to cancel this operation while waiting
|
||||
// for the lock.
|
||||
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();
|
||||
if (queryRegistry == nullptr) {
|
||||
return {TRI_ERROR_SHUTTING_DOWN};
|
||||
}
|
||||
|
@ -2665,7 +2665,7 @@ ResultT<bool> RestReplicationHandler::isLockHeld(aql::QueryId id) const {
|
|||
// The query is only hold for long during initial locking
|
||||
// there it should return false.
|
||||
// In all other cases it is released quickly.
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();
|
||||
if (queryRegistry == nullptr) {
|
||||
return ResultT<bool>::error(TRI_ERROR_SHUTTING_DOWN);
|
||||
}
|
||||
|
@ -2686,7 +2686,7 @@ ResultT<bool> RestReplicationHandler::cancelBlockingTransaction(aql::QueryId id)
|
|||
// otherwise an unconditional destroy() would do.
|
||||
auto res = isLockHeld(id);
|
||||
if (res.ok()) {
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();
|
||||
if (queryRegistry == nullptr) {
|
||||
return ResultT<bool>::error(TRI_ERROR_SHUTTING_DOWN);
|
||||
}
|
||||
|
@ -2702,7 +2702,7 @@ ResultT<bool> RestReplicationHandler::cancelBlockingTransaction(aql::QueryId id)
|
|||
}
|
||||
|
||||
ResultT<std::string> RestReplicationHandler::computeCollectionChecksum(aql::QueryId id, LogicalCollection* col) const {
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();
|
||||
if (queryRegistry == nullptr) {
|
||||
return ResultT<std::string>::error(TRI_ERROR_SHUTTING_DOWN);
|
||||
}
|
||||
|
|
|
@ -87,8 +87,8 @@ void AqlFeature::stop() {
|
|||
// Wait until all AQL queries are done
|
||||
while (true) {
|
||||
try {
|
||||
QueryRegistryFeature::QUERY_REGISTRY->destroyAll();
|
||||
TraverserEngineRegistryFeature::TRAVERSER_ENGINE_REGISTRY->destroyAll();
|
||||
QueryRegistryFeature::registry()->destroyAll();
|
||||
TraverserEngineRegistryFeature::registry()->destroyAll();
|
||||
} catch (...) {
|
||||
// ignore errors here. if it fails, we'll try again in next round
|
||||
}
|
||||
|
@ -96,10 +96,8 @@ void AqlFeature::stop() {
|
|||
uint64_t m = ::leases.load();
|
||||
TRI_ASSERT((m & ::readyBit) == 0);
|
||||
|
||||
size_t n = QueryRegistryFeature::QUERY_REGISTRY->numberRegisteredQueries();
|
||||
size_t o = TraverserEngineRegistryFeature::TRAVERSER_ENGINE_REGISTRY
|
||||
->numberRegisteredEngines();
|
||||
|
||||
size_t n = QueryRegistryFeature::registry()->numberRegisteredQueries();
|
||||
size_t o = TraverserEngineRegistryFeature::registry()->numberRegisteredEngines();
|
||||
if (n == 0 && m == 0 && o == 0) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -181,13 +181,12 @@ void DatabaseManagerThread::run() {
|
|||
std::this_thread::sleep_for(std::chrono::microseconds(waitTime()));
|
||||
|
||||
// The following is only necessary after a wait:
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();
|
||||
if (queryRegistry != nullptr) {
|
||||
queryRegistry->expireQueries();
|
||||
}
|
||||
|
||||
auto engineRegistry
|
||||
= TraverserEngineRegistryFeature::TRAVERSER_ENGINE_REGISTRY;
|
||||
|
||||
auto engineRegistry = TraverserEngineRegistryFeature::registry();
|
||||
if (engineRegistry != nullptr) {
|
||||
engineRegistry->expireEngines();
|
||||
}
|
||||
|
@ -987,7 +986,7 @@ void DatabaseFeature::updateContexts() {
|
|||
auto* vocbase = useDatabase(TRI_VOC_SYSTEM_DATABASE);
|
||||
TRI_ASSERT(vocbase);
|
||||
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();;
|
||||
TRI_ASSERT(queryRegistry != nullptr);
|
||||
|
||||
dealer->defineContextUpdate(
|
||||
|
|
|
@ -35,7 +35,7 @@ using namespace arangodb::options;
|
|||
|
||||
namespace arangodb {
|
||||
|
||||
aql::QueryRegistry* QueryRegistryFeature::QUERY_REGISTRY = nullptr;
|
||||
std::atomic<aql::QueryRegistry*> QueryRegistryFeature::QUERY_REGISTRY{nullptr};
|
||||
|
||||
QueryRegistryFeature::QueryRegistryFeature(
|
||||
application_features::ApplicationServer& server
|
||||
|
@ -148,14 +148,14 @@ void QueryRegistryFeature::prepare() {
|
|||
|
||||
// create the query registery
|
||||
_queryRegistry.reset(new aql::QueryRegistry(_queryRegistryTTL));
|
||||
QUERY_REGISTRY = _queryRegistry.get();
|
||||
QUERY_REGISTRY.store(_queryRegistry.get(), std::memory_order_release);
|
||||
}
|
||||
|
||||
void QueryRegistryFeature::start() {}
|
||||
|
||||
void QueryRegistryFeature::unprepare() {
|
||||
// clear the query registery
|
||||
QUERY_REGISTRY = nullptr;
|
||||
QUERY_REGISTRY.store(nullptr, std::memory_order_release);
|
||||
}
|
||||
|
||||
} // arangodb
|
||||
|
|
|
@ -35,7 +35,10 @@ class QueryRegistry;
|
|||
|
||||
class QueryRegistryFeature final : public application_features::ApplicationFeature {
|
||||
public:
|
||||
static aql::QueryRegistry* QUERY_REGISTRY;
|
||||
|
||||
static aql::QueryRegistry* registry() {
|
||||
return QUERY_REGISTRY.load(std::memory_order_acquire);
|
||||
}
|
||||
static constexpr double DefaultQueryTTL = 600.0;
|
||||
|
||||
explicit QueryRegistryFeature(
|
||||
|
@ -73,6 +76,8 @@ class QueryRegistryFeature final : public application_features::ApplicationFeatu
|
|||
aql::QueryRegistry* queryRegistry() const { return _queryRegistry.get(); }
|
||||
|
||||
private:
|
||||
static std::atomic<aql::QueryRegistry*> QUERY_REGISTRY;
|
||||
|
||||
std::unique_ptr<aql::QueryRegistry> _queryRegistry;
|
||||
};
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ using namespace arangodb::application_features;
|
|||
|
||||
namespace arangodb {
|
||||
|
||||
traverser::TraverserEngineRegistry*
|
||||
TraverserEngineRegistryFeature::TRAVERSER_ENGINE_REGISTRY = nullptr;
|
||||
std::atomic<traverser::TraverserEngineRegistry*>
|
||||
TraverserEngineRegistryFeature::TRAVERSER_ENGINE_REGISTRY{nullptr};
|
||||
|
||||
TraverserEngineRegistryFeature::TraverserEngineRegistryFeature(
|
||||
application_features::ApplicationServer& server
|
||||
|
@ -49,13 +49,13 @@ void TraverserEngineRegistryFeature::validateOptions(
|
|||
void TraverserEngineRegistryFeature::prepare() {
|
||||
// create the engine registery
|
||||
_engineRegistry.reset(new traverser::TraverserEngineRegistry());
|
||||
TRAVERSER_ENGINE_REGISTRY = _engineRegistry.get();
|
||||
TRAVERSER_ENGINE_REGISTRY.store(_engineRegistry.get(), std::memory_order_release);
|
||||
}
|
||||
void TraverserEngineRegistryFeature::start() {
|
||||
}
|
||||
|
||||
void TraverserEngineRegistryFeature::unprepare() {
|
||||
TRAVERSER_ENGINE_REGISTRY = nullptr;
|
||||
TRAVERSER_ENGINE_REGISTRY.store(nullptr, std::memory_order_release);
|
||||
}
|
||||
|
||||
} // arangodb
|
||||
|
|
|
@ -36,7 +36,10 @@ class TraverserEngineRegistry;
|
|||
class TraverserEngineRegistryFeature final
|
||||
: public application_features::ApplicationFeature {
|
||||
public:
|
||||
static traverser::TraverserEngineRegistry* TRAVERSER_ENGINE_REGISTRY;
|
||||
|
||||
static traverser::TraverserEngineRegistry* registry() {
|
||||
return TRAVERSER_ENGINE_REGISTRY.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
explicit TraverserEngineRegistryFeature(
|
||||
application_features::ApplicationServer& server
|
||||
|
@ -54,8 +57,9 @@ class TraverserEngineRegistryFeature final
|
|||
|
||||
private:
|
||||
std::unique_ptr<traverser::TraverserEngineRegistry> _engineRegistry;
|
||||
static std::atomic<traverser::TraverserEngineRegistry*> TRAVERSER_ENGINE_REGISTRY;
|
||||
};
|
||||
|
||||
} // namespace arangodb
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -94,7 +94,8 @@ void RocksDBRecoveryManager::start() {
|
|||
|
||||
_db = ApplicationServer::getFeature<RocksDBEngine>("RocksDBEngine")->db();
|
||||
runRecovery();
|
||||
_inRecovery = false;
|
||||
// synchronizes with acquire inRecovery()
|
||||
_inRecovery.store(false, std::memory_order_release);
|
||||
|
||||
// notify everyone that recovery is now done
|
||||
auto databaseFeature =
|
||||
|
@ -116,8 +117,6 @@ void RocksDBRecoveryManager::runRecovery() {
|
|||
// now restore collection counts into collections
|
||||
}
|
||||
|
||||
bool RocksDBRecoveryManager::inRecovery() const { return _inRecovery; }
|
||||
|
||||
class WBReader final : public rocksdb::WriteBatch::Handler {
|
||||
public:
|
||||
|
||||
|
|
|
@ -49,7 +49,9 @@ class RocksDBRecoveryManager final
|
|||
void start() override;
|
||||
|
||||
void runRecovery();
|
||||
bool inRecovery() const;
|
||||
bool inRecovery() const {
|
||||
return _inRecovery.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
private:
|
||||
Result parseRocksWAL();
|
||||
|
@ -61,9 +63,9 @@ class RocksDBRecoveryManager final
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
rocksdb::TransactionDB* _db;
|
||||
|
||||
bool _inRecovery;
|
||||
std::atomic<bool> _inRecovery;
|
||||
};
|
||||
|
||||
} // namespace arangodb
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -38,7 +38,7 @@ void RocksDBRestHandlers::registerResources(
|
|||
rest::RestHandlerFactory* handlerFactory) {
|
||||
handlerFactory->addPrefixHandler(RestVocbaseBaseHandler::COLLECTION_PATH,
|
||||
RestHandlerCreator<RocksDBRestCollectionHandler>::createNoData);
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();;
|
||||
handlerFactory->addPrefixHandler("/_api/export",
|
||||
RestHandlerCreator<RocksDBRestExportHandler>::createData<aql::QueryRegistry*>, queryRegistry);
|
||||
handlerFactory->addPrefixHandler("/_api/replication",
|
||||
|
|
|
@ -98,7 +98,7 @@ Result arangodb::unregisterUserFunction(
|
|||
nullptr,
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();;
|
||||
aql::QueryResult queryResult = query.executeSync(queryRegistry);
|
||||
|
||||
if (queryResult.code != TRI_ERROR_NO_ERROR) {
|
||||
|
@ -170,7 +170,7 @@ Result arangodb::unregisterUserFunctionsGroup(
|
|||
nullptr,
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();;
|
||||
aql::QueryResult queryResult = query.executeSync(queryRegistry);
|
||||
|
||||
if (queryResult.code != TRI_ERROR_NO_ERROR) {
|
||||
|
@ -376,7 +376,7 @@ Result arangodb::toArrayUserFunctions(
|
|||
nullptr,
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();;
|
||||
aql::QueryResult queryResult = query.executeSync(queryRegistry);
|
||||
|
||||
if (queryResult.code != TRI_ERROR_NO_ERROR) {
|
||||
|
|
|
@ -628,7 +628,7 @@ Result Collections::revisionId(Context& ctxt, TRI_voc_rid_t& rid) {
|
|||
arangodb::aql::Query query(false, vocbase, aql::QueryString(q), binds,
|
||||
std::make_shared<VPackBuilder>(),
|
||||
arangodb::aql::PART_MAIN);
|
||||
auto queryRegistry = QueryRegistryFeature::QUERY_REGISTRY;
|
||||
auto queryRegistry = QueryRegistryFeature::registry();;
|
||||
TRI_ASSERT(queryRegistry != nullptr);
|
||||
aql::QueryResult queryResult = query.executeSync(queryRegistry);
|
||||
|
||||
|
|
|
@ -63,8 +63,11 @@ V8ClientConnection::V8ClientConnection()
|
|||
_vpackOptions.buildUnindexedObjects = true;
|
||||
_vpackOptions.buildUnindexedArrays = true;
|
||||
_builder.onFailure([this](int error, std::string const& msg) {
|
||||
_lastHttpReturnCode = 503;
|
||||
_lastErrorMessage = msg;
|
||||
std::unique_lock<std::mutex> guard(_lock, std::try_to_lock);
|
||||
if (guard) {
|
||||
_lastHttpReturnCode = 503;
|
||||
_lastErrorMessage = msg;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -81,8 +84,8 @@ void V8ClientConnection::createConnection() {
|
|||
req->timeout(std::chrono::seconds(30));
|
||||
try {
|
||||
auto res = newConnection->sendRequest(std::move(req));
|
||||
_lastHttpReturnCode = res->statusCode();
|
||||
|
||||
_lastHttpReturnCode = res->statusCode();
|
||||
if (_lastHttpReturnCode == 200) {
|
||||
_connection = std::move(newConnection);
|
||||
|
||||
|
@ -117,7 +120,7 @@ void V8ClientConnection::createConnection() {
|
|||
if (version.first < 3) {
|
||||
// major version of server is too low
|
||||
//_client->disconnect();
|
||||
shutdownConnection();
|
||||
shutdownConnection();
|
||||
_lastErrorMessage = "Server version number ('" + versionString +
|
||||
"') is too low. Expecting 3.0 or higher";
|
||||
return;
|
||||
|
@ -131,6 +134,7 @@ void V8ClientConnection::createConnection() {
|
|||
}
|
||||
|
||||
void V8ClientConnection::setInterrupted(bool interrupted) {
|
||||
std::lock_guard<std::mutex> guard(_lock);
|
||||
if (interrupted && _connection.get() != nullptr) {
|
||||
_connection->cancel();
|
||||
_connection.reset();
|
||||
|
@ -155,7 +159,8 @@ std::string V8ClientConnection::endpointSpecification() const {
|
|||
|
||||
void V8ClientConnection::connect(ClientFeature* client) {
|
||||
TRI_ASSERT(client);
|
||||
|
||||
std::lock_guard<std::mutex> guard(_lock);
|
||||
|
||||
_requestTimeout = std::chrono::duration<double>(client->requestTimeout());
|
||||
_databaseName = client->databaseName();
|
||||
_builder.endpoint(client->endpoint());
|
||||
|
@ -170,6 +175,8 @@ void V8ClientConnection::connect(ClientFeature* client) {
|
|||
}
|
||||
|
||||
void V8ClientConnection::reconnect(ClientFeature* client) {
|
||||
std::lock_guard<std::mutex> guard(_lock);
|
||||
|
||||
_requestTimeout = std::chrono::duration<double>(client->requestTimeout());
|
||||
_databaseName = client->databaseName();
|
||||
_builder.endpoint(client->endpoint());
|
||||
|
|
|
@ -134,9 +134,9 @@ class V8ClientConnection {
|
|||
std::string _databaseName;
|
||||
std::chrono::duration<double> _requestTimeout;
|
||||
|
||||
std::mutex _lock;
|
||||
int _lastHttpReturnCode;
|
||||
std::string _lastErrorMessage;
|
||||
|
||||
std::string _version;
|
||||
std::string _mode;
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ std::vector<std::function<void(LogMessage*)>> LogAppender::_loggers;
|
|||
bool LogAppender::_allowStdLogging = true;
|
||||
|
||||
void LogAppender::addLogger(std::function<void(LogMessage*)> func) {
|
||||
MUTEX_LOCKER(guard, _appendersLock); // to silence TSan
|
||||
_loggers.emplace_back(func);
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ TEST_CASE("ExecutionBlockMockTestSingle", "[iresearch]") {
|
|||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
arangodb::aql::AqlItemBlock data(&resMon, 100, 4);
|
||||
|
||||
|
@ -237,7 +237,7 @@ TEST_CASE("ExecutionBlockMockTestSingle", "[iresearch]") {
|
|||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
arangodb::aql::AqlItemBlock data(&resMon, 100, 4);
|
||||
|
||||
|
@ -285,7 +285,7 @@ TEST_CASE("ExecutionBlockMockTestSingle", "[iresearch]") {
|
|||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
arangodb::aql::AqlItemBlock data(&resMon, 100, 4);
|
||||
|
||||
|
@ -342,7 +342,7 @@ TEST_CASE("ExecutionBlockMockTestChain", "[iresearch]") {
|
|||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
// build chain:
|
||||
// Singleton <- MockBlock0 <- MockBlock1
|
||||
|
@ -406,7 +406,7 @@ TEST_CASE("ExecutionBlockMockTestChain", "[iresearch]") {
|
|||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
// build chain:
|
||||
// Singleton <- MockBlock0 <- MockBlock1
|
||||
|
@ -468,7 +468,7 @@ TEST_CASE("ExecutionBlockMockTestChain", "[iresearch]") {
|
|||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
// build chain:
|
||||
// Singleton <- MockBlock0 <- MockBlock1
|
||||
|
|
|
@ -4353,7 +4353,7 @@ SECTION("IResearchViewNode::createBlock") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
arangodb::aql::Variable const outVariable("variable", 0);
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ SECTION("construct") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
arangodb::aql::Variable const outVariable("variable", 0);
|
||||
|
||||
// no options
|
||||
|
@ -343,7 +343,7 @@ SECTION("constructFromVPackSingleServer") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
arangodb::aql::Variable const outVariable("variable", 0);
|
||||
|
||||
// missing 'viewId'
|
||||
|
@ -520,7 +520,7 @@ SECTION("clone") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
arangodb::aql::Variable const outVariable("variable", 0);
|
||||
|
||||
// no filter condition, no sort condition, no shards, no options
|
||||
|
@ -567,7 +567,7 @@ SECTION("clone") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
otherQuery.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
otherQuery.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
auto& cloned = dynamic_cast<arangodb::iresearch::IResearchViewNode&>(
|
||||
*node.clone(otherQuery.plan(), true, true)
|
||||
|
@ -596,7 +596,7 @@ SECTION("clone") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
otherQuery.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
otherQuery.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
node.plan()->nextId();
|
||||
auto& cloned = dynamic_cast<arangodb::iresearch::IResearchViewNode&>(
|
||||
|
@ -672,7 +672,7 @@ SECTION("clone") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
otherQuery.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
otherQuery.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
auto& cloned = dynamic_cast<arangodb::iresearch::IResearchViewNode&>(
|
||||
*node.clone(otherQuery.plan(), true, true)
|
||||
|
@ -701,7 +701,7 @@ SECTION("clone") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
otherQuery.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
otherQuery.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
node.plan()->nextId();
|
||||
auto& cloned = dynamic_cast<arangodb::iresearch::IResearchViewNode&>(
|
||||
|
@ -773,7 +773,7 @@ SECTION("clone") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
otherQuery.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
otherQuery.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
auto& cloned = dynamic_cast<arangodb::iresearch::IResearchViewNode&>(
|
||||
*node.clone(otherQuery.plan(), true, true)
|
||||
|
@ -805,7 +805,7 @@ SECTION("clone") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
otherQuery.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
otherQuery.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
node.plan()->nextId();
|
||||
auto& cloned = dynamic_cast<arangodb::iresearch::IResearchViewNode&>(
|
||||
|
@ -843,7 +843,7 @@ SECTION("serialize") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
arangodb::aql::Variable const outVariable("variable", 0);
|
||||
|
||||
|
@ -1066,7 +1066,7 @@ SECTION("collections") {
|
|||
query.addCollection(std::to_string(collection1->id()), arangodb::AccessMode::Type::READ);
|
||||
|
||||
// prepare query
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
arangodb::aql::Variable const outVariable("variable", 0);
|
||||
|
||||
|
@ -1113,7 +1113,7 @@ SECTION("createBlockSingleServer") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
// dummy engine
|
||||
arangodb::aql::ExecutionEngine engine(&query);
|
||||
|
@ -1188,7 +1188,7 @@ SECTION("createBlockCoordinator") {
|
|||
nullptr, arangodb::velocypack::Parser::fromJson("{}"),
|
||||
arangodb::aql::PART_MAIN
|
||||
);
|
||||
query.prepare(arangodb::QueryRegistryFeature::QUERY_REGISTRY);
|
||||
query.prepare(arangodb::QueryRegistryFeature::registry());
|
||||
|
||||
// dummy engine
|
||||
arangodb::aql::ExecutionEngine engine(&query);
|
||||
|
|
|
@ -220,7 +220,7 @@ arangodb::aql::QueryResult executeQuery(
|
|||
|
||||
arangodb::aql::QueryResult result;
|
||||
while (true) {
|
||||
auto state = query.execute(arangodb::QueryRegistryFeature::QUERY_REGISTRY, result);
|
||||
auto state = query.execute(arangodb::QueryRegistryFeature::registry(), result);
|
||||
if (state == arangodb::aql::ExecutionState::WAITING) {
|
||||
ss->waitForAsyncResponse();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue