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

   ### Background
   
   Catalog initialization may perform remote IO while holding the catalog 
monitor. CatalogMgr separately serializes mutations and journal records. DROP 
and RENAME already avoid waiting for initialization under the global lock.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #69665 (existing removal coordination and cleanup), #71205 
(larger change being split), #71414 (independent SSRF foundation)
   PR Type: Bugfix
   
   Problem Summary:
   
   Live and replayed ALTER CATALOG property updates still wait for a catalog 
monitor while retaining the global manager write lock. When one catalog is slow 
to initialize, an unrelated catalog mutation cannot complete. Reuse the 
existing mutation coordination for ALTER, retain the identity/property snapshot 
retry, and release the catalog monitor before journal IO while preserving 
manager-level journal ordering.
   
   ### Details
   
   - **Change map:** Production Java +78/-39; FE unit tests +200/-5; SQL 
regression +80/-0; generated expected results +13/-0. Most additions verify 
concurrency and failure behavior.
   - **Frequency:** Intermittent when property update/replay overlaps slow 
initialization. Deterministic tests reproduce both live and replay stalls on 
master.
   - **Root cause:** CatalogMgr enters applyAlterCatalogProps under its write 
lock; validation/reset then acquires the catalog monitor already held by 
initialization. That wait pins the manager lock for every catalog.
   - **Why existing tests missed it:** Existing removal tests cover 
DROP/RENAME; existing DDL regression runs ALTER sequentially, without a 
controlled initialization overlap.
   - **Fix:** Apply the catalog mutation only after acquiring its monitor and a 
nonblocking manager write lock, retrying stale identities/property snapshots. 
Keep journal ordering under the manager lock after releasing the catalog 
monitor. Register detached resource cleanup after both locks are released, 
including journal failures.
   - **Behavior change:** The shared CatalogMgr property-update path applies to 
ExternalCatalog implementations using synchronized lazy initialization. SQL 
coverage uses HMS with meta.cache.max-weight and 
meta.cache.hive.file.max-weight. No SSRF rules are added.
   - **Other paths and branches:** Covers live property updates and replay. 
DROP/RENAME and startup migration remain covered. Legacy non-replay validation 
retains its lock scope. Based on master; release branches remain untested. 
Introducing PR unknown; the wait predates #69665.
   
   ### Testing
   
   - Deterministic baseline reproduction: both live/replay overlap cases block 
an unrelated catalog mutation on unmodified master; both pass with this change. 
A controlled journal-lock mutation also fails the new monitor assertion as 
intended.
   - FE UT: the standard nine-suite matrix passes 174 cases, followed by the 
final 20-case CatalogRemovalConcurrencyTest through run-fe-ut.sh, covering 
three additional snapshot/drop/replacement cases. The complete current 
nine-suite Maven run passes all 177 unique cases. Existing cleanup, rollback, 
routing, mapping migration and admission-gate tests are included.
   - FE build and Checkstyle pass; all 92 Checkstyle reports have zero errors. 
Packaged CatalogMgr classes match the compiled classes. Complete local 
self-review has no unresolved finding.
   - The new HMS SQL suite passes output generation and a separate comparison 
run. It verifies concurrent accepted updates (96MB/48MB), unchanged state after 
rejecting 256MB, an unrelated catalog comment, and a successful 32MB retry. The 
output is generated by the standard regression runner.
   - Runtime: this branch's independently built master FE with an isolated 
cached BE 4.0.8-rc02 distribution. A supplementary native master BE build could 
not complete because the installed Paimon Rust dependency lacks required APIs; 
it is not claimed passing. This PR changes no BE code. Owned services were 
stopped and runtime configuration restored.
   
   ### Notes for Reviewers
   
   This PR contains CatalogMgr coordination and its tests only. It adds no SSRF 
checks or connector configuration inventory and has no dependency on the 
separate admission-foundation change. The journal assertion specifically 
prevents adding a catalog-monitor wait around durable-log IO while keeping 
global ordering intact.
   
   ### Release note
   
   Catalog property updates no longer block unrelated catalog mutations while 
waiting for slow initialization of another catalog.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: No; no SQL syntax, configuration or 
persistence-format change.
   - Pre-submission status: Ready: FE unit tests, strict Checkstyle, FE package 
checks and targeted SQL regression pass. The native master BE build has the 
local dependency limitation described above.
   
   ### AI Disclosure
   
   - Tool: Codex
   - Generated: Code, tests and this description.
   - Human review: Pending. The coding agent completed local self-review; 
independent human review has not been claimed.
   


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