morrySnow opened a new pull request, #68330:
URL: https://github.com/apache/doris/pull/68330
### What problem does this PR solve?
Issue Number: N/A
Related PR: #68302
Problem Summary:
If UNKNOWN interrupts a FE's first FOLLOWER/OBSERVER transition,
initialization returns early while the previous FE type is retained. The
replayer can subsequently set the metadata readiness/readability flags to true
before initialization has completed. This can release `waitForReady()` and
allow local reads while startup work is still incomplete. Clearing those flags
once does not close the race, since the replayer can set them again.
Add a process-local `startupInitialized` gate to `isReady()` and
`canRead()`. The state listener opens the gate only after a successful
MASTER/FOLLOWER/OBSERVER initialization and publication of the new FE type.
UNKNOWN handling cannot open it. Initialization's own waits continue to use
metadata readiness, avoiding a circular dependency.
Once initialization has completed, the gate stays open so an initialized FE
entering UNKNOWN retains its existing read policy and metadata freshness checks.
### Release note
Fix a race that could let an FE report ready or serve local reads before
startup initialization completed after an UNKNOWN state interruption.
### Check List (For Author)
- Test
- [x] Regression test
- [x] Unit Test
- [x] Manual test (details below)
- [ ] No need to test or manual test.
- Behavior changed:
- [ ] No.
- [x] Yes. An FE remains not ready and cannot serve local reads until
its first initialization completes.
- Does this need documentation?
- [x] No.
- [ ] Yes.
Validation:
- `./run-fe-ut.sh --run
org.apache.doris.catalog.EnvStateListenerTest,org.apache.doris.catalog.EnvTest,org.apache.doris.qe.StmtExecutorTest`:
34 tests passed.
- New deterministic tests cover INIT/UNKNOWN → FOLLOWER/OBSERVER interrupted
by UNKNOWN, actual replayer readiness updates, initialization retry/completion,
initialized UNKNOWN behavior, metadata expiry, and `ignore_meta_check`. With
the two serving gates disabled, all five new cases fail; they pass with the fix.
- `cd fe && mvn checkstyle:check -pl fe-core` and `git diff --check`: passed.
- Full FE build using `./build.sh --fe`: passed.
- Deployed the FE build to an existing single-FE sandbox and ran
`test_select_constant` and `test_numbers` through `run-regression-test.sh`:
both suites passed.
- Restarted the FE with the final commit build; verified its version, `SHOW
FRONTENDS` health, `/metrics`, and `SELECT COUNT(*), SUM(number) FROM
numbers("number"="1000")` returning `1000, 499500`. UNKNOWN interruption
interleavings are covered by unit tests; no multi-FE network-failure test was
run.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]