From 1cd71a8d1145cd9135b3c7facfbf462657e9e199 Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Wed, 27 Nov 2019 15:08:50 +0100 Subject: [PATCH] rename timeout to maxRuntime (#10552) * rename timeout out maxRuntime * Update CHANGELOG Co-Authored-By: Jan --- CHANGELOG | 4 ++-- Documentation/DocuBlocks/Rest/Cursors/post_api_cursor.md | 4 ++-- arangod/Aql/Query.cpp | 4 ++-- arangod/Aql/Query.h | 2 +- arangod/Aql/QueryOptions.cpp | 8 ++++---- arangod/Aql/QueryOptions.h | 2 +- tests/js/server/aql/aql-options.js | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 410a9bf898..22c9ef92a4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -99,8 +99,8 @@ devel engine, but comes with a big performance penalty as all collections will be locked exclusively for writes. -* Added new timeout option for AQL queries. If a query does not finish execution - within the given time in seconds it will be killed. +* Added new maxRuntime option for queries. If a query does not finish execution within + the given time (in seconds) it will be killed. * Fixed undefined behaviour with creation of ArangoSearch links with custom analyzers in cluster environment. diff --git a/Documentation/DocuBlocks/Rest/Cursors/post_api_cursor.md b/Documentation/DocuBlocks/Rest/Cursors/post_api_cursor.md index 2308cfd62e..0eacad7233 100644 --- a/Documentation/DocuBlocks/Rest/Cursors/post_api_cursor.md +++ b/Documentation/DocuBlocks/Rest/Cursors/post_api_cursor.md @@ -107,8 +107,8 @@ to bring the satellite collections involved in the query into sync. The default value is *60.0* (seconds). When the max time has been reached the query will be stopped. -@RESTSTRUCT{timeout,post_api_cursor_opts,number,optional,double} -The query has to be executed within the given timeout or it will be killed. +@RESTSTRUCT{maxRuntime,post_api_cursor_opts,number,optional,double} +The query has to be executed within the given runtime or it will be killed. The value is specified in seconds. The default value is *0.0* (no timeout). @RESTSTRUCT{maxTransactionSize,post_api_cursor_opts,integer,optional,int64} diff --git a/arangod/Aql/Query.cpp b/arangod/Aql/Query.cpp index caf51304b6..7fb607ec65 100644 --- a/arangod/Aql/Query.cpp +++ b/arangod/Aql/Query.cpp @@ -276,8 +276,8 @@ Query* Query::clone(QueryPart part, bool withPlan) { } bool Query::killed() const { - if (_queryOptions.timeout > std::numeric_limits::epsilon()) { - if (TRI_microtime() > (_startTime + _queryOptions.timeout)) { + if(_queryOptions.maxRuntime > std::numeric_limits::epsilon()) { + if(TRI_microtime() > (_startTime + _queryOptions.maxRuntime)) { return true; } } diff --git a/arangod/Aql/Query.h b/arangod/Aql/Query.h index f945e0f6a6..afe6fa7d34 100644 --- a/arangod/Aql/Query.h +++ b/arangod/Aql/Query.h @@ -110,7 +110,7 @@ class Query { /// @brief whether or not the query is killed bool killed() const; - + void setKilled() { _killed = true; } /// @brief set the query to killed diff --git a/arangod/Aql/QueryOptions.cpp b/arangod/Aql/QueryOptions.cpp index 2289a74018..84dde23168 100644 --- a/arangod/Aql/QueryOptions.cpp +++ b/arangod/Aql/QueryOptions.cpp @@ -38,7 +38,7 @@ QueryOptions::QueryOptions() : memoryLimit(0), maxNumberOfPlans(0), maxWarningCount(10), - timeout(0), + maxRuntime(0), satelliteSyncWait(60.0), ttl(0), profile(PROFILE_LEVEL_NONE), @@ -104,9 +104,9 @@ void QueryOptions::fromVelocyPack(VPackSlice const& slice) { maxWarningCount = value.getNumber(); } - value = slice.get("timeout"); + value = slice.get("maxRuntime"); if (value.isNumber()) { - timeout = value.getNumber(); + maxRuntime = value.getNumber(); } @@ -221,7 +221,7 @@ void QueryOptions::toVelocyPack(VPackBuilder& builder, bool disableOptimizerRule builder.add("memoryLimit", VPackValue(memoryLimit)); builder.add("maxNumberOfPlans", VPackValue(maxNumberOfPlans)); builder.add("maxWarningCount", VPackValue(maxWarningCount)); - builder.add("timeout", VPackValue(timeout)); + builder.add("maxRuntime", VPackValue(maxRuntime)); builder.add("satelliteSyncWait", VPackValue(satelliteSyncWait)); builder.add("ttl", VPackValue(ttl)); builder.add("profile", VPackValue(static_cast(profile))); diff --git a/arangod/Aql/QueryOptions.h b/arangod/Aql/QueryOptions.h index 724e9286ab..04b5a640ef 100644 --- a/arangod/Aql/QueryOptions.h +++ b/arangod/Aql/QueryOptions.h @@ -61,7 +61,7 @@ struct QueryOptions { size_t memoryLimit; size_t maxNumberOfPlans; size_t maxWarningCount; - double timeout; // query has to execute within the given time or will be killed + double maxRuntime; // query has to execute within the given time or will be killed double satelliteSyncWait; double ttl; // time until query cursor expires - avoids coursors to // stick around for ever if client does not collect the data diff --git a/tests/js/server/aql/aql-options.js b/tests/js/server/aql/aql-options.js index 4258009608..17e2bbda76 100644 --- a/tests/js/server/aql/aql-options.js +++ b/tests/js/server/aql/aql-options.js @@ -41,12 +41,12 @@ function aqlOptionsTestSuite () { return { //////////////////////////////////////////////////////////////////////////////// -/// @brief test timeout option +/// @brief test maxRuntime option //////////////////////////////////////////////////////////////////////////////// - testTimeOut : function () { + testMaxRuntime : function () { try { - internal.db._query("LET x = SLEEP(10) RETURN 1", {} /*bind*/, { timeout : 1} /*options*/); + internal.db._query("LET x = SLEEP(10) RETURN 1", {} /*bind*/, { maxRuntime : 1} /*options*/); fail(); } catch (e) { assertEqual(e.errorNum, errors.ERROR_QUERY_KILLED.code);