Skip to content

[feature](fe) Add resource group success quorum check - #66751

Open
deardeng wants to merge 3 commits into
apache:masterfrom
deardeng:impl-quorum-load-fe
Open

[feature](fe) Add resource group success quorum check#66751
deardeng wants to merge 3 commits into
apache:masterfrom
deardeng:impl-quorum-load-fe

Conversation

@deardeng

@deardeng deardeng commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Related PR: #66680

Problem Summary: Load transaction commits only enforced the ordinary replica quorum and could therefore succeed without a configured minimum number of successful replicas in each availability resource group. Add a mutable FE configuration and enforce the per-resource group success floor in the centralized transaction commit check. Clamp each resource group requirement to the partition declared replica allocation so backend liveness changes and transient extra replicas do not weaken or inflate the commit requirement.

Release note

Add the mutable FE configuration resource_group_succ_quorum to require a minimum number of successful load replicas per availability zone.

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

### What problem does this PR solve?

Issue Number: None

Related PR: apache#66680

Problem Summary: Load transaction commits only enforced the ordinary replica quorum and could therefore succeed without a configured minimum number of successful replicas in each availability zone. Add a mutable FE configuration and enforce the per-AZ success floor in the centralized transaction commit check. Clamp each AZ requirement to the partition declared replica allocation so backend liveness changes and transient extra replicas do not weaken or inflate the commit requirement.

### Release note

Add the mutable FE configuration cross_az_succ_quorum to require a minimum number of successful load replicas per availability zone.

### Check List (For Author)

- Test: Unit Test
    - DatabaseTransactionMgrTest cross-AZ quorum, unavailable replica, and extra replica cases
- Behavior changed: Yes (when cross_az_succ_quorum is configured, FE rejects commits that do not meet the per-AZ success floor)
- Does this need documentation: No
@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?

@deardeng

Copy link
Copy Markdown
Contributor Author

run buildall

@deardeng

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot 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.

Requesting changes because the opt-in cross-AZ durability policy is not end-to-end safe yet.

Blocking findings:

  1. The FE adds a distribution-specific check after both BE writer generations have already finalized commit infos using only the ordinary scalar quorum, so a healthy slower required-AZ replica can be omitted permanently.
  2. Startup and mutable config updates accept malformed or duplicate policy entries, while the lazy parser silently drops or overwrites them and enforces a weaker policy.
  3. Commit classification reads a backend location tag that MODIFY BACKEND mutates without safe publication, so it can enforce the policy against stale topology.

Critical checkpoint conclusions:

  • Goal and proof: The local FE check expresses the requested floor, but the three findings mean the end-to-end goal is not accomplished; direct FE tests with fabricated commit infos do not prove the writer-to-commit path.
  • Scope and clarity: The three-file patch is locally focused and readable, but the required planner/BE producer handoff and validation boundary are missing.
  • Concurrency and locks: Config cache publication is safe for the supported replace-on-update path. Table locks stabilize partition/index metadata, but not backend tag publication; no additional lock-order or deadlock issue was found.
  • Lifecycle and statics: The process-static cache has a coherent replacement lifecycle, with no circular initialization or resource-release issue.
  • Dynamic configuration: The master observes replacement arrays promptly, but malformed values fail open. Master-only failover behavior otherwise matches adjacent mutable-config semantics.
  • Compatibility: No persisted or symbol format changes are introduced, but current and older BEs receive no AZ-aware completion criterion or capability fence, so rolling deployment is unsafe when the feature is enabled.
  • Parallel paths: Ordinary non-cloud transaction sources, local 2PC at precommit, and each subtransaction reach checkCommitStatus; final 2PC correctly preserves the prepared decision. Cloud uses a distinct meta-service transaction model. Auto-partition is exposed to the same writer handoff defect.
  • Conditions: Allocation clamping and the zero-requirement skip match the declared-allocation policy; dead, bad, missing, decommissioned, extra, and loaded schema-change replicas yielded no separate defect.
  • Test coverage: The added tests cover direct success/failure, clamping, unavailable/bad replicas, and an extra replica. They miss end-to-end v1/v2 delayed-remote behavior, startup/admin rejection, and the backend-topology concurrency boundary.
  • Test results: Compile, CheckStyle, and several static checks are green; FE UT and regression/performance jobs were still pending at review time. No local tests were run because this workflow is review-only.
  • Observability: Failure logs include transaction, tablet, table, partition, version, AZ, and replica detail. No separate logging/metrics blocker was found.
  • Transactions and persistence: The check runs before commit or precommit state advancement; no edit-log payload is added, and prepared-state failover semantics remain intact.
  • Writes and crashes: Existing atomic state transitions remain in place and no new leak/crash path was found, but the missing producer contract can turn a healthy load into a terminal commit failure.
  • FE/BE variables: The AZ requirement is not passed or translated into an equivalent requirement on either initial or auto-partition writer paths; this is the first blocking finding.
  • Performance: Parsing is amortized once per config replacement and backend tags are cached once per commit; no distinct material performance problem was found.
  • Other issues and user focus: No additional user focus was supplied, and the full-PR sweep found no valuable issue beyond the three inline findings.

Comment thread fe/fe-common/src/main/java/org/apache/doris/common/Config.java Outdated
Comment thread fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java Outdated
### What problem does this PR solve?

Issue Number: None

Related PR: apache#66751

Problem Summary: Backend location tags can be updated by MODIFY BACKEND while transaction commit threads read them. The plain locationTag reference had no Java memory-model publication edge, so readers could observe a stale availability-zone tag. Publish replacement Tag instances through a volatile reference and add a deterministic regression test for the required publication semantics.

### Release note

None

### Check List (For Author)

- Test: Unit Test
    - BackendTest#testLocationTagIsSafelyPublished
- Behavior changed: No (ensures existing backend location updates are visible across threads)
- Does this need documentation: No
@deardeng

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 89.66% (26/29) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 0.22% (1/459) 🎉
Increment coverage report
Complete coverage report

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Replace availability-zone terminology with the existing resource group concept for load success quorum configuration. Keep Config focused on the raw configuration declaration and move transaction-specific parsing, caching, and logging into DatabaseTransactionMgr without changing runtime behavior.

### Release note

None

### Check List (For Author)

- Test: Unit Test
    - ./run-fe-ut.sh --run org.apache.doris.transaction.DatabaseTransactionMgrTest (19 tests passed)
    - mvn checkstyle:check -pl fe-common,fe-core (0 violations)
- Behavior changed: No
- Does this need documentation: No
@deardeng deardeng changed the title [feature](fe) Add cross-AZ success quorum check [feature](fe) Add resource group success quorum check Aug 17, 2026
@deardeng

Copy link
Copy Markdown
Contributor Author

run buildall


@ConfField(mutable = true, masterOnly = true, description = "Minimum number of successfully written replicas "
+ "required in each resource group for a load job.")
public static volatile String[] resource_group_succ_quorum = {};

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.

usage example?

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.

how to configure it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

see fix be pr, it has 2 groovy case #66827

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