[BugFix] Record audit stats for async materialized view refresh#74954
Open
spaces-X wants to merge 1 commit into
Open
[BugFix] Record audit stats for async materialized view refresh#74954spaces-X wants to merge 1 commit into
spaces-X wants to merge 1 commit into
Conversation
Signed-off-by: WeiXiang <wx531766@alibaba-inc.com>
8c7ed7b to
4fed467
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Contributor
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
Contributor
[FE Incremental Coverage Report]✅ pass : 1 / 1 (100.00%) file detail
|
Contributor
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 I'm doing:
Close #74942
Async materialized view refresh audit-log entries lost the
CpuCostNs/MemCostBytes/ScanBytes/ScanRowsfields. This is a regression introduced by #56257, which centralized audit-stats writing intoStmtExecutor.recordExecStatsIntoContext()(only called fromexecute()/executeStmtWithExecPlan()/executeStmtWithResultQueue()) and removed the old fallback inConnectProcessor.auditAfterExec().MV refresh does not go through
execute(): it callsexecutor.handleDMLStmtWithProfile()directly, sorecordExecStatsIntoContext()is never invoked and the statistics never reach the audit-event builder, even though the data is available viaexecutor.getQueryStatisticsForAuditLog().What I'm doing:
Flush exec statistics into the audit-event builder on the MV-refresh path before
auditAfterExec, mirroring whatexecute()does in itsfinallyblock.recordExecStatsIntoContext()is madepublic(it lives inqe, the caller inscheduler).It is intentionally not placed inside
handleDMLStmtWithProfile():execute()also callshandleDMLStmtWithProfile()and then callsrecordExecStatsIntoContext()in its ownfinally, so flushing insidehandleDMLStmtWithProfile()would double-count for normalINSERTs (the builder uses accumulating
add*). The MV-refresh path uses a freshConnectContextwhose builder starts at the default-1, so a single explicit call is correct and not double-counted.What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: