mirror of https://gitee.com/bigwinds/arangodb
added flag for disabling query tracking `--database.disable-query-tracking`
Conflicts: arangod/RestServer/ArangoServer.cpp Conflicts: Documentation/Books/Users/ConfigureArango/Arangod.mdpp arangod/RestServer/ArangoServer.cpp
This commit is contained in:
parent
8342953730
commit
ce0a543d25
|
@ -94,6 +94,10 @@ the option *--disable-figures*.
|
||||||
@startDocuBlock databaseForceSyncProperties
|
@startDocuBlock databaseForceSyncProperties
|
||||||
|
|
||||||
|
|
||||||
|
!SUBSECTION Disable AQL query tracking
|
||||||
|
@startDocuBlock databaseDisableQueryTracking
|
||||||
|
|
||||||
|
|
||||||
!SUBSECTION Index threads
|
!SUBSECTION Index threads
|
||||||
@startDocuBlock indexThreads
|
@startDocuBlock indexThreads
|
||||||
|
|
||||||
|
|
|
@ -694,13 +694,18 @@ EnumerateCollectionBlock::EnumerateCollectionBlock (ExecutionEngine* engine,
|
||||||
_atBeginning(false),
|
_atBeginning(false),
|
||||||
_random(ep->_random) {
|
_random(ep->_random) {
|
||||||
|
|
||||||
|
auto trxCollection = _trx->trxCollection(_collection->cid());
|
||||||
|
if (trxCollection != nullptr) {
|
||||||
|
_trx->orderBarrier(trxCollection);
|
||||||
|
}
|
||||||
|
|
||||||
if (_random) {
|
if (_random) {
|
||||||
// random scan
|
// random scan
|
||||||
_scanner = new RandomCollectionScanner(_trx, _trx->trxCollection(_collection->cid()));
|
_scanner = new RandomCollectionScanner(_trx, trxCollection);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// default: linear scan
|
// default: linear scan
|
||||||
_scanner = new LinearCollectionScanner(_trx, _trx->trxCollection(_collection->cid()));
|
_scanner = new LinearCollectionScanner(_trx, trxCollection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -913,6 +918,11 @@ IndexRangeBlock::IndexRangeBlock (ExecutionEngine* engine,
|
||||||
_sortCoords(),
|
_sortCoords(),
|
||||||
_freeCondition(true) {
|
_freeCondition(true) {
|
||||||
|
|
||||||
|
auto trxCollection = _trx->trxCollection(_collection->cid());
|
||||||
|
if (trxCollection != nullptr) {
|
||||||
|
_trx->orderBarrier(trxCollection);
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < en->_ranges.size(); i++) {
|
for (size_t i = 0; i < en->_ranges.size(); i++) {
|
||||||
_condition->emplace_back(IndexAndCondition());
|
_condition->emplace_back(IndexAndCondition());
|
||||||
for (auto ri: en->_ranges[i]) {
|
for (auto ri: en->_ranges[i]) {
|
||||||
|
@ -3576,6 +3586,11 @@ ModificationBlock::ModificationBlock (ExecutionEngine* engine,
|
||||||
_outReg(ExecutionNode::MaxRegisterId),
|
_outReg(ExecutionNode::MaxRegisterId),
|
||||||
_collection(ep->_collection) {
|
_collection(ep->_collection) {
|
||||||
|
|
||||||
|
auto trxCollection = _trx->trxCollection(_collection->cid());
|
||||||
|
if (trxCollection != nullptr) {
|
||||||
|
_trx->orderBarrier(trxCollection);
|
||||||
|
}
|
||||||
|
|
||||||
if (ep->_outVariable != nullptr) {
|
if (ep->_outVariable != nullptr) {
|
||||||
/*
|
/*
|
||||||
auto const& registerPlan = ep->getRegisterPlan()->varInfo;
|
auto const& registerPlan = ep->getRegisterPlan()->varInfo;
|
||||||
|
|
|
@ -86,11 +86,14 @@ Profile::Profile (Query* query)
|
||||||
stamp(TRI_microtime()) {
|
stamp(TRI_microtime()) {
|
||||||
|
|
||||||
auto queryList = static_cast<QueryList*>(query->vocbase()->_queries);
|
auto queryList = static_cast<QueryList*>(query->vocbase()->_queries);
|
||||||
|
|
||||||
|
if (queryList != nullptr) {
|
||||||
try {
|
try {
|
||||||
queryList->insert(query, stamp);
|
queryList->insert(query, stamp);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -99,7 +102,14 @@ Profile::Profile (Query* query)
|
||||||
|
|
||||||
Profile::~Profile () {
|
Profile::~Profile () {
|
||||||
auto queryList = static_cast<QueryList*>(query->vocbase()->_queries);
|
auto queryList = static_cast<QueryList*>(query->vocbase()->_queries);
|
||||||
|
|
||||||
|
if (queryList != nullptr) {
|
||||||
|
try {
|
||||||
queryList->remove(query, stamp);
|
queryList->remove(query, stamp);
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -134,6 +144,12 @@ TRI_json_t* Profile::toJson (TRI_memory_zone_t*) {
|
||||||
// --SECTION-- class Query
|
// --SECTION-- class Query
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief whether or not query tracking is disabled globally
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool Query::DoDisableQueryTracking = false;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- constructors / destructors
|
// --SECTION-- constructors / destructors
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
|
@ -504,6 +504,22 @@ namespace triagens {
|
||||||
|
|
||||||
triagens::arango::TransactionContext* createTransactionContext ();
|
triagens::arango::TransactionContext* createTransactionContext ();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief fetch the global query tracking value
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static bool DisableQueryTracking () {
|
||||||
|
return DoDisableQueryTracking;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief turn off tracking globally
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static void DisableQueryTracking (bool value) {
|
||||||
|
DoDisableQueryTracking = value;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- private variables
|
// --SECTION-- private variables
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -663,6 +679,12 @@ namespace triagens {
|
||||||
|
|
||||||
bool _killed;
|
bool _killed;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief whether or not query tracking is disabled globally
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static bool DoDisableQueryTracking;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ QueryList::QueryList (TRI_vocbase_t*)
|
||||||
_current(),
|
_current(),
|
||||||
_slow(),
|
_slow(),
|
||||||
_slowCount(0),
|
_slowCount(0),
|
||||||
_enabled(true),
|
_enabled(! Query::DisableQueryTracking()),
|
||||||
_trackSlowQueries(true),
|
_trackSlowQueries(true),
|
||||||
_slowQueryThreshold(QueryList::DefaultSlowQueryThreshold),
|
_slowQueryThreshold(QueryList::DefaultSlowQueryThreshold),
|
||||||
_maxSlowQueries(QueryList::DefaultMaxSlowQueries),
|
_maxSlowQueries(QueryList::DefaultMaxSlowQueries),
|
||||||
|
@ -116,7 +116,7 @@ QueryList::~QueryList () {
|
||||||
void QueryList::insert (Query const* query,
|
void QueryList::insert (Query const* query,
|
||||||
double stamp) {
|
double stamp) {
|
||||||
// no query string
|
// no query string
|
||||||
if (query->queryString() == nullptr || ! _enabled) {
|
if (! _enabled || query == nullptr || query->queryString() == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ void QueryList::insert (Query const* query,
|
||||||
void QueryList::remove (Query const* query,
|
void QueryList::remove (Query const* query,
|
||||||
double now) {
|
double now) {
|
||||||
// no query string
|
// no query string
|
||||||
if (query->queryString() == nullptr || ! _enabled) {
|
if (! _enabled || query == nullptr || query->queryString() == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "Admin/ApplicationAdminServer.h"
|
#include "Admin/ApplicationAdminServer.h"
|
||||||
#include "Admin/RestHandlerCreator.h"
|
#include "Admin/RestHandlerCreator.h"
|
||||||
#include "Admin/RestShutdownHandler.h"
|
#include "Admin/RestShutdownHandler.h"
|
||||||
|
#include "Aql/Query.h"
|
||||||
#include "Basics/FileUtils.h"
|
#include "Basics/FileUtils.h"
|
||||||
#include "Basics/Nonce.h"
|
#include "Basics/Nonce.h"
|
||||||
#include "Basics/ProgramOptions.h"
|
#include "Basics/ProgramOptions.h"
|
||||||
|
@ -288,6 +289,7 @@ ArangoServer::ArangoServer (int argc, char** argv)
|
||||||
_defaultWaitForSync(false),
|
_defaultWaitForSync(false),
|
||||||
_forceSyncProperties(true),
|
_forceSyncProperties(true),
|
||||||
_disableReplicationApplier(false),
|
_disableReplicationApplier(false),
|
||||||
|
_disableQueryTracking(false),
|
||||||
_server(nullptr),
|
_server(nullptr),
|
||||||
_queryRegistry(nullptr),
|
_queryRegistry(nullptr),
|
||||||
_pairForAql(nullptr),
|
_pairForAql(nullptr),
|
||||||
|
@ -530,6 +532,7 @@ void ArangoServer::buildApplicationServer () {
|
||||||
("database.maximal-journal-size", &_defaultMaximalSize, "default maximal journal size, can be overwritten when creating a collection")
|
("database.maximal-journal-size", &_defaultMaximalSize, "default maximal journal size, can be overwritten when creating a collection")
|
||||||
("database.wait-for-sync", &_defaultWaitForSync, "default wait-for-sync behavior, can be overwritten when creating a collection")
|
("database.wait-for-sync", &_defaultWaitForSync, "default wait-for-sync behavior, can be overwritten when creating a collection")
|
||||||
("database.force-sync-properties", &_forceSyncProperties, "force syncing of collection properties to disk, will use waitForSync value of collection when turned off")
|
("database.force-sync-properties", &_forceSyncProperties, "force syncing of collection properties to disk, will use waitForSync value of collection when turned off")
|
||||||
|
("database.disable-query-tracking", &_disableQueryTracking, "turn off AQL query tracking by default")
|
||||||
("database.index-threads", &_indexThreads, "threads to start for parallel background index creation")
|
("database.index-threads", &_indexThreads, "threads to start for parallel background index creation")
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -672,6 +675,10 @@ void ArangoServer::buildApplicationServer () {
|
||||||
_disableAuthentication = true;
|
_disableAuthentication = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set global query tracking flag
|
||||||
|
triagens::aql::Query::DisableQueryTracking(_disableQueryTracking);
|
||||||
|
|
||||||
|
|
||||||
// .............................................................................
|
// .............................................................................
|
||||||
// now run arangod
|
// now run arangod
|
||||||
// .............................................................................
|
// .............................................................................
|
||||||
|
|
|
@ -470,6 +470,19 @@ namespace triagens {
|
||||||
|
|
||||||
bool _disableReplicationApplier;
|
bool _disableReplicationApplier;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief disable the query tracking feature
|
||||||
|
/// @startDocuBlock databaseDisableQueryTracking
|
||||||
|
/// `--database.disable-query-tracking flag`
|
||||||
|
///
|
||||||
|
/// If *true*, the server's query tracking feature will be disabled by default.
|
||||||
|
///
|
||||||
|
/// The default is *false*.
|
||||||
|
/// @endDocuBlock
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool _disableQueryTracking;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief unit tests
|
/// @brief unit tests
|
||||||
///
|
///
|
||||||
|
|
|
@ -127,6 +127,17 @@ function ahuacatlQueryCollectionTestSuite () {
|
||||||
internal.db._drop("UnitTestsAhuacatlUserRelations");
|
internal.db._drop("UnitTestsAhuacatlUserRelations");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief return a single value as part of a document
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
testFilterEmpty : function () {
|
||||||
|
var expected = [ ];
|
||||||
|
var actual = getQueryResults("FOR u in " + users.name() + " FILTER u.id < 0 SORT u.id RETURN { \"name\" : u.name }");
|
||||||
|
|
||||||
|
assertEqual(expected, actual);
|
||||||
|
},
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief return a single value as part of a document
|
/// @brief return a single value as part of a document
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue