zclllyybb opened a new pull request, #65476: URL: https://github.com/apache/doris/pull/65476
### What problem does this PR solve? Issue Number: [DORIS-26748](https://issues.apache.org/jira/browse/DORIS-26748) Related PR: None Problem Summary: A dictionary refresh can retain a `Dictionary` object while `DROP DATABASE` removes its owner database. The old path repeatedly recovered the database through `dictionary.getDatabase()` and checked existence by database/name, so it could either dereference a null database or accept a newly created dictionary with the same name. This change establishes one insert-target invariant: resolve the database and table/dictionary together, then carry that exact pair through authorization, sink binding, retry validation, and executor construction. Dictionary loads additionally validate canonical dictionary identity by ID before planning and after execution. Database drop now removes dictionary IDs from the canonical map, matching replay behavior and preventing same-name ABA. Ordinary internal-table inserts keep their existing table read-lock/write-lock and transaction ordering. The paired target only closes the pre-lock metadata lookup window and adds database ID to retry validation. ### Release note Fix concurrent dictionary refresh and database drop returning an internal null-pointer error or accepting stale dictionary metadata. ### Check List (For Author) - Test - [x] Regression test - [x] Unit Test - [x] Manual test (targeted isolated FE/BE cluster race) - [ ] 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. - [x] Yes. Concurrent target removal now returns a deterministic analysis error instead of an internal null-pointer error; same-name recreation is treated as a different dictionary generation. - Does this need documentation? - [x] No. - [ ] Yes. ### Validation - Before fix: `InsertTargetDropRaceTest` reproduced 2 failures, both caused by a null database dereference. - `./run-fe-ut.sh --run org.apache.doris.nereids.trees.plans.commands.insert.InsertTargetDropRaceTest` - `./run-regression-test.sh --run -f regression-test/suites/dictionary_p0/test_create_drop_sync.groovy` - `./build.sh --fe` - `./build.sh --be` ### 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]
