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

   ### What problem does this PR solve?
   
   Concurrent UPDATE and light schema changes can fail during FE analysis with 
`ConcurrentModificationException`. `UpdateCommand.completeQueryPlan()` copies 
the column-name TreeMap and reads the schema without holding the table read 
lock, while light schema changes clear and rebuild that metadata under the 
table write lock.
   
   Hold the target table read lock throughout UPDATE logical-plan completion 
and release it in `finally`, before INSERT planning or execution. This protects 
all schema reads in the method and covers EXPLAIN UPDATE through the same entry 
point.
   
   ### Release note
   
   Prevent intermittent UPDATE analysis failures during concurrent light schema 
changes.
   
   ### Check List (For Author)
   
   - Test:
     - [x] Unit Test
     - Add a deterministic test that attempts a write-locked schema rebuild 
after the real column-name TreeMap iterator has read its first entry. The 
unpatched master fails with `ConcurrentModificationException` (1 test, 1 error).
     - With the fix, `bash run-fe-ut.sh --run 
org.apache.doris.nereids.trees.plans.UpdateCommandTest` passes all 7 tests, 
including partial-update planning and lock release after successful planning or 
an analysis error.
     - FE Checkstyle passes with zero violations; `git diff --check` passes.
     - Full `build.sh --fe` validation is blocked at the native dependency 
preflight by missing `libpaimon_c.a` and `paimon_rust/paimon.h`; the 
automatically triggered thirdparty rebuild was stopped. No live-cluster SQL or 
longrun test was performed.
   - Behavior changed:
     - [x] Yes. UPDATE logical-plan completion protects metadata reads against 
schema-change writers.
   - Does this need documentation?
     - [x] No.
   
   ### 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]

Reply via email to