Gabriel39 opened a new pull request, #71174:
URL: https://github.com/apache/doris/pull/71174

   ### Background
   
   The FE plans SQL and sends execution work and JDBC connectivity tests to BEs 
over private RPC. Preparing JDBC scans or Java UDF expressions can initialize 
external code before execution starts. External tablet readers instead obtain 
an opaque plan from the FE HTTP query-plan API.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: None
   PR Type: Enhancement
   
   Problem Summary:
   
   Require FE-issued authorization before a BE prepares execution plans, tests 
JDBC, or initializes standalone query expressions. Signatures bind the 
operation, target backend, timestamp and complete request; the additional entry 
points and key distribution account for the production changes. A BE 
configuration, `enable_internal_rpc_request_auth`, enables checks by default 
and requires restart to change, with an explicit legacy setting for rolling 
upgrades.
   
   ### Details
   
   - **Change map:** Production/protocol code: +614/-55 lines; tests: +919/-5; 
no generated files or documentation changes.
   
   | Part | Changed lines | Purpose and starting point |
   | --- | --- | --- |
   | FE authority and discovery | 174 | Per-process keys, public-key heartbeat 
distribution and journal/image replay; `InternalRpcRequestSigner`, 
`HeartbeatMgr`, `Frontend`. |
   | Execution boundaries | 367 | Streaming request hashes, target-identity 
lookup and pre-queue validation for normal/two-phase plans, JDBC tests, Group 
Commit, point queries and constant folding. |
   | Opaque scan compatibility | 128 | Preserve the legacy outer plan and 
execute its authenticated inner bytes, avoiding Java/C++ Thrift map-order 
differences. |
   
   - **Before and after:** Unsigned execution requests previously entered the 
business handlers. They now return `NOT_AUTHORIZED` before queueing or creating 
query/load state. Valid FE-issued requests use the existing execution handlers.
   - **Configs and defaults:** `enable_internal_rpc_request_auth` is an 
immutable BE boolean, default `true`. RPC authorizations expire after 60 
seconds, allow up to 30 seconds of future clock skew, and bind the backend ID. 
Exported scan plans are valid for 15 minutes across their tablet backends.
   - **Impact on existing users:** SQL and stored catalog definitions keep 
their existing meaning. For BE-first upgrades, start upgraded BEs with the 
explicit legacy setting, upgrade all FEs, wait for public-key heartbeat 
propagation, then restart BEs with checks enabled. Older BEs ignore the 
optional Thrift additions. Scanner clients keep forwarding the opaque plan 
unchanged and must refresh expired plans. Custom remote-worker providers must 
furnish destination-cluster authorization; local identity is never attached to 
remote channels.
   
   ### Testing
   
   - Local FE preset: 24 tests passed across signer/client, target replacement, 
public-key replay, private-heartbeat compatibility and HTTP query-plan suites.
   - ASAN native signing utility: 6 tests passed, including 
payload/method/target/time tampering and buffer boundaries.
   - Java protobuf 4.33.4 to C++ protobuf 3.21.11/OpenSSL interoperability: 8 
fixtures passed, covering all seven RPCs and binary scan plans.
   - Full BE ASAN preset: 22 tests passed across request handlers, a real 
HTTP/2 gRPC loopback, key publication/replacement and the signing utility. 
Unsigned requests are rejected before queueing; signed requests reach the 
existing handlers.
   - Live external-database JDBC regressions, multi-node rolling/failover 
integration and a throughput benchmark for the added signing/hash work were not 
run locally.
   
   ### Notes for Reviewers
   
   - Public keys follow the existing private-heartbeat authority; FE private 
keys remain process-local. Bounded retries can reuse an authorization within 
its validity window.
   - Opaque plans contain one additional serialized copy to preserve older 
readers and authenticate the exact FE bytes. New BEs execute only that inner 
copy.
   - Point queries and constant folding open Java UDF expressions without an 
existing query context, so guarding fragment submission alone would leave 
execution paths uncovered.
   
   ### Release note
   
   BEs require signed FE execution requests by default. During a BE-first 
rolling upgrade, use `enable_internal_rpc_request_auth=false` until all FEs 
support signing and publish their keys, then enable checks with a BE restart. 
Keep clocks synchronized and refresh exported scanner plans within 15 minutes.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: Yes (plan: document the BE setting, 
rolling-upgrade sequence, heartbeat trust, clock skew and scanner-plan lifetime 
in apache/doris-website).
   - Pre-submission status: Partially verified: local FE/BE and 
interoperability checks pass; live external-database, multi-node 
upgrade/failover and throughput tests remain unrun.
   
   ### AI Disclosure
   
   - Tool: Codex (GPT-6)
   - Generated: Code, tests and this description.
   - Human review: not stated
   - Prompts: Harden JDBC test and normal query execution entry points on 
master; perform local reviews and fix findings until the review converges 
before submitting the PR.
   


-- 
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]

Reply via email to