yiguolei opened a new pull request, #71297: URL: https://github.com/apache/doris/pull/71297
### Background Doris uses internal authentication tokens for trusted FE and BE requests. The FE Master currently generates tokens in memory, and BE heartbeats carry the current raw token. Callers attach that token to existing RPC or HTTP requests. ### What problem does this PR solve? Issue Number: None Related PR: None PR Type: Enhancement Problem Summary: An immediately activated replacement can reach callers before receivers, while Master changes lose the previous in-memory token state. This change persists a token list and active ID, distributes replacements before activation, and preserves the existing raw-token request format. The diff includes FE persistence, heartbeat coordination, BE storage, compatibility handling, unit tests, and a design document with boundary examples. ### Details - **Change map:** 26 files; 676 production lines, 430 test lines, 785 documentation lines, and no generated files (additions plus deletions). Production changes cover FE state persistence and heartbeat coordination, BE synchronized token storage and existing caller getters, and optional Thrift fields. Tests cover state transitions, recovery, compatibility, and malformed/stale updates. The document records the agreed protocol and its limits. - **Before and after:** Previously, rotation immediately exposed a new in-memory token. Now Master commits `[T0, T1]` with `T0` active, distributes it, then commits activation of `T1` after heartbeat progress or timeout. Both FE and BE progress use Master-local request timestamps; no rotation ID or FE replay-position barrier is added. - **Configs and defaults:** Add mutable, Master-only `token_rotation_wait_timeout_second=60` to bound the wait for unavailable nodes. Existing rotation period and retained-token count settings remain; preparation temporarily adds one candidate. - **Impact on existing users:** Existing SQL, privileges, and raw-token callers remain unchanged; `auth_token` equals the active token's value. Upgrade BE first, then FE; the new Master starts the mechanism automatically. Existing heartbeat journal operations and optional Image fields carry state. Old-version Master re-election and recovery of historical tokens from the first old Master are outside this change's continuity guarantee. - **Behavior change:** Token activation and eviction become committed state transitions. A successful FE ping does not prove replay completion; raw-token misses still delegate to Master. Timeout activation can temporarily fail requests from lagging/offline nodes. Business-request signing is deferred. ### Testing Local static checks passed: `git diff --cached --check`, clang-format 16 through the repository formatting driver on changed C++ files, and `build-support/check-build-hygiene.sh`. Thrift field IDs were compared with master and branches 3.1, 4.0, 4.1, and 4.2. Added FE/BE unit cases for preparation, activation, timestamp ordering, timeout, persistence failures, recovery, eviction, legacy compatibility, malformed updates, and concurrent BE reads. Existing token and heartbeat tests were adapted. Tests were inspected, not executed; builds, Maven/Checkstyle, clang-tidy, unit tests, regression tests, and live failover/rolling-upgrade validation were not run, following the author's preference. CI execution has not been observed. ### Notes for Reviewers Start with FE `TokenManager`. Reusing `OP_HEARTBEAT` avoids a new journal operation. BE `token_journal_id` only rejects out-of-order snapshots; it is not a rotation-completion criterion. The design document includes the timeout, restart, first-upgrade, and rollback boundaries. ### Release note Internal token rotation persists FE state and distributes replacements before activation while retaining raw-token RPC compatibility. A new 60-second wait timeout bounds rotation progress when nodes are unavailable. ### Check List (For Author) - Behavior changed: Yes (see Details). - Does this need documentation: Yes; the design document is included. Plan a website configuration and upgrade note before release. - Pre-submission status: Partially verified: builds, unit tests, and live failover/rolling-upgrade validation were not run. ### AI Disclosure - Tool: OpenAI Codex (GPT-6) - Generated: implementation, unit tests, design document, and PR description. - Human review: not stated -- 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]
