Update eval_cancel_error logic to separate context canceled, timeout errors #7202
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why the changes in this PR are needed?
While the
eval_cancel_error: caller cancelled query execution
error is useful in identifying requests that stopped, I propose that it's a little too vague because it absorbs bothcontext.Canceled
andcontext.DeadlineExceeded
errors. It's useful to differentiate these errors as it gives a clue to whether the user intentionally stopped the request, or the request exeeded some deadline from the caller. Without a change similar to this, it's much more difficult to tell why a call toEval
failed.What are the changes in this PR?
This adds logic to
topdown/eval.go
to differentiate context errors. It has the sameeval_cancel_error
prefix as before, but can now return an error that gives more clues:Notes to assist PR review:
Further comments:
An alternative here could be just to return the
e.ctx.Err()
in the existing logic, but that does retain the more vague error message.