You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "yujun777 (via GitHub)" <gi...@apache.org> on 2026/04/28 10:09:18 UTC
[PR] [fix](audit) Mark internal query failures as ERR in audit log [doris]
yujun777 opened a new pull request, #62908:
URL: https://github.com/apache/doris/pull/62908
### What problem does this PR solve?
Issue Number: https://jira.selectdb-in.cc/browse/CIR-20019
Problem Summary:
When an internal query inside `StmtExecutor.executeInternalQuery()` failed (for example, the column-statistics gather SQL that ANALYZE issues against a user table when the underlying tablet hits a BE IO error), the audit_log entry recorded:
```
state=OK | error_code=0 | error_message=<empty> | return_rows=0
```
This is misleading: the gather query actually failed, but the audit log makes it look like it succeeded with zero rows. ANALYZE itself still surfaces the failure to the user, but the per-internal-query audit entries hide the root cause, complicating triage.
Root cause: `executeInternalQuery()` wraps the inner work in `try { ... } finally { AuditLogHelper.logAuditLog(context, ...) }`, but the inner catch handlers only re-throw the exception and never set `ConnectContext` state to ERR. The default OK state is therefore what gets logged.
Fix: add an outer `catch (Exception e)` around the inner try that, when state has not already been moved to ERR, records `ERR_INTERNAL_ERROR` together with the message (falling back to root-cause message when the exception message is empty), then re-throws so callers behave as before. The `setNereids/setIsQuery/setInternal` flags are also moved above the parse step so audit entries for parse/plan failures still carry the right metadata.
### Release note
Internal query failures are now correctly recorded as ERR in audit_log instead of misleadingly showing OK with empty error info.
### Check List (For Author)
- Test:
- Unit Test: `StmtExecutorInternalQueryTest#testExecuteInternalQuerySetsErrorStateOnFailure`
- Regression test: `fault_injection_p0/test_audit_log_internal_query_failure`
- Manual test: reproduced on a local cluster with the `LocalFileReader::read_at_impl.io_error` debug point; before the fix audit_log shows `state=OK / error_message=`, after the fix it shows `state=ERR / error_code=1815 / full IO_ERROR description`.
- Behavior changed: Yes (audit_log entries for failed internal queries now show ERR; previously they showed OK).
- Does this need documentation: No.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](audit) Mark internal query failures as ERR in audit log [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #62908:
URL: https://github.com/apache/doris/pull/62908#issuecomment-4334524537
PR approved by at least one committer and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](audit) Mark internal query failures as ERR in audit log [doris]
Posted by "yujun777 (via GitHub)" <gi...@apache.org>.
yujun777 commented on PR #62908:
URL: https://github.com/apache/doris/pull/62908#issuecomment-4334266842
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](audit) Mark internal query failures as ERR in audit log [doris]
Posted by "yujun777 (via GitHub)" <gi...@apache.org>.
yujun777 commented on PR #62908:
URL: https://github.com/apache/doris/pull/62908#issuecomment-4334267213
/review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](audit) Mark internal query failures as ERR in audit log [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #62908:
URL: https://github.com/apache/doris/pull/62908#issuecomment-4340481521
skip buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](audit) Mark internal query failures as ERR in audit log [doris]
Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on PR #62908:
URL: https://github.com/apache/doris/pull/62908#issuecomment-4340414407
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](audit) Mark internal query failures as ERR in audit log [doris]
Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on PR #62908:
URL: https://github.com/apache/doris/pull/62908#issuecomment-4340414598
/review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](audit) Mark internal query failures as ERR in audit log [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #62908:
URL: https://github.com/apache/doris/pull/62908#issuecomment-4340484030
skip buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](audit) Mark internal query failures as ERR in audit log [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen merged PR #62908:
URL: https://github.com/apache/doris/pull/62908
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [fix](audit) Mark internal query failures as ERR in audit log [doris]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #62908:
URL: https://github.com/apache/doris/pull/62908#issuecomment-4334524992
PR approved by anyone and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org