-
Notifications
You must be signed in to change notification settings - Fork 852
Fix query counter gauge #21785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Fix query counter gauge #21785
Conversation
arangod/Aql/Query.cpp
Outdated
auto& queryRegistryFeature = | ||
vocbase().server().getFeature<QueryRegistryFeature>(); | ||
queryRegistryFeature.trackQueryStart(); | ||
_isExecuting = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think moving it out of instantiatePlan()
is a good idea. More than that, I think it was actually incorrect before and only called in certain situations. But here is not the right place to call it, either:
The name of the function (execute()
) is somewhat misleading: it contains everything from parsing, optimization, instantiation, execution and cleanup. The execution part happens below in case ExecutionPhase::EXECUTE:
. But note that this function is also reentrant due to the WAITING mechanism, so it will be called multiple times (possibly a lot) during the execution of a query.
Also, there's executeV8()
, which is basically a re-implementation called from V8 contexts (e.g. Foxx microservices); so anything you add to execute()
, you probably need to do there as well.
I think we either need to look at where enterState(QueryExecutionState::ValueType::EXECUTION)
is called, or when _executionPhase = ExecutionPhase::EXECUTE
is set. These should (I think) be mostly the same, looking from the outside.
@jbajic I think this should also get a simple regression test. |
Scope & Purpose
The
arangodb_aql_current_query
metrics could underflow when going below 0 and show the number of queries currently executing. This fixes the issueChecklist
Related Information
(Please reference tickets / specification / other PRs etc)