diff --git a/arangod/Aql/QueryList.cpp b/arangod/Aql/QueryList.cpp index e32e2d7a40..c4af566fa1 100644 --- a/arangod/Aql/QueryList.cpp +++ b/arangod/Aql/QueryList.cpp @@ -29,6 +29,7 @@ #include "Aql/QueryList.h" #include "Aql/Query.h" +#include "Basics/logging.h" #include "Basics/ReadLocker.h" #include "Basics/WriteLocker.h" #include "VocBase/vocbase.h" @@ -216,15 +217,21 @@ void QueryList::remove (Query const* query, //////////////////////////////////////////////////////////////////////////////// int QueryList::kill (TRI_voc_tick_t id) { - WRITE_LOCKER(_lock); + { + WRITE_LOCKER(_lock); - auto it = _current.find(id); + auto it = _current.find(id); - if (it == _current.end()) { - return TRI_ERROR_QUERY_NOT_FOUND; + if (it == _current.end()) { + return TRI_ERROR_QUERY_NOT_FOUND; + } + + const_cast((*it).second->query)->killed(true); } + + // log outside the lock + LOG_WARNING("killing AQL query '%llu'", (unsigned long long) id); - const_cast((*it).second->query)->killed(true); return TRI_ERROR_NO_ERROR; } diff --git a/arangod/Aql/QueryList.h b/arangod/Aql/QueryList.h index 0f6b9d00b8..870d43901b 100644 --- a/arangod/Aql/QueryList.h +++ b/arangod/Aql/QueryList.h @@ -101,6 +101,8 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// /// @brief whether or not queries are tracked +/// we're not using a lock here for performance reasons - thus concurrent +/// modifications of this variable are possible but are considered unharmful //////////////////////////////////////////////////////////////////////////////// inline bool enabled () const { @@ -109,6 +111,8 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// /// @brief toggle query tracking +/// we're not using a lock here for performance reasons - thus concurrent +/// modifications of this variable are possible but are considered unharmful //////////////////////////////////////////////////////////////////////////////// inline void enabled (bool value) { @@ -117,6 +121,8 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// /// @brief whether or not slow queries are tracked +/// we're not using a lock here for performance reasons - thus concurrent +/// modifications of this variable are possible but are considered unharmful //////////////////////////////////////////////////////////////////////////////// inline bool trackSlowQueries () const { @@ -125,6 +131,8 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// /// @brief toggle slow query tracking +/// we're not using a lock here for performance reasons - thus concurrent +/// modifications of this variable are possible but are considered unharmful //////////////////////////////////////////////////////////////////////////////// inline void trackSlowQueries (bool value) { @@ -133,6 +141,8 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// /// @brief threshold for slow queries (in seconds) +/// we're not using a lock here for performance reasons - thus concurrent +/// modifications of this variable are possible but are considered unharmful //////////////////////////////////////////////////////////////////////////////// inline double slowQueryThreshold () const { @@ -141,6 +151,8 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// /// @brief set the slow query threshold +/// we're not using a lock here for performance reasons - thus concurrent +/// modifications of this variable are possible but are considered unharmful //////////////////////////////////////////////////////////////////////////////// inline void slowQueryThreshold (double value) { @@ -153,6 +165,8 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// /// @brief return the max number of slow queries to keep +/// we're not using a lock here for performance reasons - thus concurrent +/// modifications of this variable are possible but are considered unharmful //////////////////////////////////////////////////////////////////////////////// inline size_t maxSlowQueries () const { @@ -161,6 +175,8 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// /// @brief set the max number of slow queries to keep +/// we're not using a lock here for performance reasons - thus concurrent +/// modifications of this variable are possible but are considered unharmful //////////////////////////////////////////////////////////////////////////////// inline void maxSlowQueries (size_t value) { @@ -173,6 +189,8 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// /// @brief return the max length of query strings that are stored / returned +/// we're not using a lock here for performance reasons - thus concurrent +/// modifications of this variable are possible but are considered unharmful //////////////////////////////////////////////////////////////////////////////// inline size_t maxQueryStringLength () const { @@ -181,6 +199,8 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// /// @brief set the max length of query strings that are stored / returned +/// we're not using a lock here for performance reasons - thus concurrent +/// modifications of this variable are possible but are considered unharmful //////////////////////////////////////////////////////////////////////////////// inline void maxQueryStringLength (size_t value) {