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
|
||||
|
||||
|
||||
!SUBSECTION Disable AQL query tracking
|
||||
@startDocuBlock databaseDisableQueryTracking
|
||||
|
||||
|
||||
!SUBSECTION Index threads
|
||||
@startDocuBlock indexThreads
|
||||
|
||||
|
|
|
@ -694,13 +694,18 @@ EnumerateCollectionBlock::EnumerateCollectionBlock (ExecutionEngine* engine,
|
|||
_atBeginning(false),
|
||||
_random(ep->_random) {
|
||||
|
||||
auto trxCollection = _trx->trxCollection(_collection->cid());
|
||||
if (trxCollection != nullptr) {
|
||||
_trx->orderBarrier(trxCollection);
|
||||
}
|
||||
|
||||
if (_random) {
|
||||
// random scan
|
||||
_scanner = new RandomCollectionScanner(_trx, _trx->trxCollection(_collection->cid()));
|
||||
_scanner = new RandomCollectionScanner(_trx, trxCollection);
|
||||
}
|
||||
else {
|
||||
// default: linear scan
|
||||
_scanner = new LinearCollectionScanner(_trx, _trx->trxCollection(_collection->cid()));
|
||||
_scanner = new LinearCollectionScanner(_trx, trxCollection);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -912,7 +917,12 @@ IndexRangeBlock::IndexRangeBlock (ExecutionEngine* engine,
|
|||
_posInRanges(0),
|
||||
_sortCoords(),
|
||||
_freeCondition(true) {
|
||||
|
||||
|
||||
auto trxCollection = _trx->trxCollection(_collection->cid());
|
||||
if (trxCollection != nullptr) {
|
||||
_trx->orderBarrier(trxCollection);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < en->_ranges.size(); i++) {
|
||||
_condition->emplace_back(IndexAndCondition());
|
||||
for (auto ri: en->_ranges[i]) {
|
||||
|
@ -3575,6 +3585,11 @@ ModificationBlock::ModificationBlock (ExecutionEngine* engine,
|
|||
: ExecutionBlock(engine, ep),
|
||||
_outReg(ExecutionNode::MaxRegisterId),
|
||||
_collection(ep->_collection) {
|
||||
|
||||
auto trxCollection = _trx->trxCollection(_collection->cid());
|
||||
if (trxCollection != nullptr) {
|
||||
_trx->orderBarrier(trxCollection);
|
||||
}
|
||||
|
||||
if (ep->_outVariable != nullptr) {
|
||||
/*
|
||||
|
|
|
@ -86,10 +86,13 @@ Profile::Profile (Query* query)
|
|||
stamp(TRI_microtime()) {
|
||||
|
||||
auto queryList = static_cast<QueryList*>(query->vocbase()->_queries);
|
||||
try {
|
||||
queryList->insert(query, stamp);
|
||||
}
|
||||
catch (...) {
|
||||
|
||||
if (queryList != nullptr) {
|
||||
try {
|
||||
queryList->insert(query, stamp);
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +102,14 @@ Profile::Profile (Query* query)
|
|||
|
||||
Profile::~Profile () {
|
||||
auto queryList = static_cast<QueryList*>(query->vocbase()->_queries);
|
||||
queryList->remove(query, stamp);
|
||||
|
||||
if (queryList != nullptr) {
|
||||
try {
|
||||
queryList->remove(query, stamp);
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -134,6 +144,12 @@ TRI_json_t* Profile::toJson (TRI_memory_zone_t*) {
|
|||
// --SECTION-- class Query
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not query tracking is disabled globally
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool Query::DoDisableQueryTracking = false;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- constructors / destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -504,6 +504,22 @@ namespace triagens {
|
|||
|
||||
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
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -663,6 +679,12 @@ namespace triagens {
|
|||
|
||||
bool _killed;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief whether or not query tracking is disabled globally
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool DoDisableQueryTracking;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ QueryList::QueryList (TRI_vocbase_t*)
|
|||
_current(),
|
||||
_slow(),
|
||||
_slowCount(0),
|
||||
_enabled(true),
|
||||
_enabled(! Query::DisableQueryTracking()),
|
||||
_trackSlowQueries(true),
|
||||
_slowQueryThreshold(QueryList::DefaultSlowQueryThreshold),
|
||||
_maxSlowQueries(QueryList::DefaultMaxSlowQueries),
|
||||
|
@ -116,7 +116,7 @@ QueryList::~QueryList () {
|
|||
void QueryList::insert (Query const* query,
|
||||
double stamp) {
|
||||
// no query string
|
||||
if (query->queryString() == nullptr || ! _enabled) {
|
||||
if (! _enabled || query == nullptr || query->queryString() == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ void QueryList::insert (Query const* query,
|
|||
void QueryList::remove (Query const* query,
|
||||
double now) {
|
||||
// no query string
|
||||
if (query->queryString() == nullptr || ! _enabled) {
|
||||
if (! _enabled || query == nullptr || query->queryString() == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "Admin/ApplicationAdminServer.h"
|
||||
#include "Admin/RestHandlerCreator.h"
|
||||
#include "Admin/RestShutdownHandler.h"
|
||||
#include "Aql/Query.h"
|
||||
#include "Basics/FileUtils.h"
|
||||
#include "Basics/Nonce.h"
|
||||
#include "Basics/ProgramOptions.h"
|
||||
|
@ -288,6 +289,7 @@ ArangoServer::ArangoServer (int argc, char** argv)
|
|||
_defaultWaitForSync(false),
|
||||
_forceSyncProperties(true),
|
||||
_disableReplicationApplier(false),
|
||||
_disableQueryTracking(false),
|
||||
_server(nullptr),
|
||||
_queryRegistry(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.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.disable-query-tracking", &_disableQueryTracking, "turn off AQL query tracking by default")
|
||||
("database.index-threads", &_indexThreads, "threads to start for parallel background index creation")
|
||||
;
|
||||
|
||||
|
@ -671,6 +674,10 @@ void ArangoServer::buildApplicationServer () {
|
|||
// testing disables authentication
|
||||
_disableAuthentication = true;
|
||||
}
|
||||
|
||||
// set global query tracking flag
|
||||
triagens::aql::Query::DisableQueryTracking(_disableQueryTracking);
|
||||
|
||||
|
||||
// .............................................................................
|
||||
// now run arangod
|
||||
|
|
|
@ -470,6 +470,19 @@ namespace triagens {
|
|||
|
||||
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
|
||||
///
|
||||
|
|
|
@ -127,6 +127,17 @@ function ahuacatlQueryCollectionTestSuite () {
|
|||
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
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue