mirror of https://gitee.com/bigwinds/arangodb
rename timeout to maxRuntime (#10552)
* rename timeout out maxRuntime * Update CHANGELOG Co-Authored-By: Jan <jsteemann@users.noreply.github.com>
This commit is contained in:
parent
fa2ebde506
commit
1cd71a8d11
|
@ -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.
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -276,8 +276,8 @@ Query* Query::clone(QueryPart part, bool withPlan) {
|
|||
}
|
||||
|
||||
bool Query::killed() const {
|
||||
if (_queryOptions.timeout > std::numeric_limits<double>::epsilon()) {
|
||||
if (TRI_microtime() > (_startTime + _queryOptions.timeout)) {
|
||||
if(_queryOptions.maxRuntime > std::numeric_limits<double>::epsilon()) {
|
||||
if(TRI_microtime() > (_startTime + _queryOptions.maxRuntime)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<size_t>();
|
||||
}
|
||||
|
||||
value = slice.get("timeout");
|
||||
value = slice.get("maxRuntime");
|
||||
if (value.isNumber()) {
|
||||
timeout = value.getNumber<double>();
|
||||
maxRuntime = value.getNumber<double>();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<uint32_t>(profile)));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue