Skip to content

branch-4.1: [fix](fe) Return transaction insert execution errors (#67386) - #67925

Open
mymeiyi wants to merge 1 commit into
apache:branch-4.1from
mymeiyi:branch-4.1-pick-67386
Open

mymeiyi wants to merge 1 commit into
apache:branch-4.1from
mymeiyi:branch-4.1-pick-67386

Conversation

@mymeiyi

@mymeiyi mymeiyi commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

pick #67386

Transaction INSERT execution failures raised directly while dispatching fragments bypass ErrorReport. OlapTxnInsertExecutor catches these failures and aborts the subtransaction, but previously left QueryState successful, causing the client to receive Query OK. Set the INSERT error state when no earlier error exists so the failure reaches the client while preserving errors already reported by ErrorReport.
Copilot AI lite review requested due to automatic review settings September 14, 2026 02:58
@mymeiyi
mymeiyi requested a review from yiguolei as a code owner September 14, 2026 02:58
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@mymeiyi

mymeiyi commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Existing query error details can be overwritten by unconditional fallback handling in two executors.

Pull request overview

Fixes FE transaction INSERT failures being reported as successful queries and corrects cloud subtransaction abort metadata.

Changes:

  • Propagates transaction insert failures to clients.
  • Centralizes insert error-state handling.
  • Adds fragment failure regression coverage.
  • Corrects the cloud subtransaction count.
File summaries
File Summary Review finding
regression-test/suites/insert_p0/transaction/txn_insert_inject_case.groovy Adds fragment execution failure coverage.
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/OlapTxnInsertExecutor.java Reports transaction insert failures. Moderate: preserve existing ERR state and message instead of unconditionally setting ERR_UNKNOWN_ERROR (1 vote).
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/OlapInsertExecutor.java Centralizes insert error handling. Moderate: only apply fallback error handling when the query state is not already ERR (2 votes).
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/OlapGroupCommitInsertExecutor.java Reuses shared error handling.
fe/fe-core/src/main/java/org/apache/doris/cloud/transaction/CloudGlobalTransactionMgr.java Sends the correct subtransaction count.
Review details

Suppressed comments (2)

fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/OlapInsertExecutor.java:318

  • ErrorReport.reportDdlException() sets the query state to ERR before throwing, and executeSingleInsert then routes that throwable through onFail; this helper currently overwrites that existing code/message with ERR_UNKNOWN_ERROR. That loses the original timeout/coordinator error instead of preserving it as described in the PR. Only set the fallback error when the state is not already ERR.
    protected void setErrorState() {
        String firstErrorMsgPart = "";
        String urlPart = "";
        if (!Strings.isNullOrEmpty(coordinator.getFirstErrorMsg())) {
            firstErrorMsgPart = StringUtils.abbreviate(coordinator.getFirstErrorMsg(),

fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/OlapTxnInsertExecutor.java:90

  • This fallback is unconditional, so it overwrites any error already stored in QueryState (both the specific error code and message) with ERR_UNKNOWN_ERROR. That loses diagnostics from an earlier ErrorReport/completion path, contrary to the intended preservation behavior; only call setErrorState() when ctx.getState().getStateType() != MysqlStateType.ERR.
        setErrorState();
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants