0AyanamiRei opened a new pull request, #64604:
URL: https://github.com/apache/doris/pull/64604

   ### What problem does this PR solve?
   
   Issue Number: None
   
   Related PR: #57133
   
   Problem Summary:
   
   `BaseTabletsChannel::_write_block_data` can run concurrently with 
`incremental_open` for the same tablets channel. `_tablet_writers` is an 
`std::unordered_map` protected by `_tablet_writers_lock` when writers are 
inserted, but the tablet load rowset info lookup read the map without holding 
the lock.
   
   A concurrent `emplace` may rehash `_tablet_writers`, so the unlocked lookup 
can race with bucket reallocation. This patch protects the lookup with 
`_tablet_writers_lock` and avoids using unordered_map iterators after the lock 
is released. The actual writer operations still run outside 
`_tablet_writers_lock`, so the lock remains scoped to the map access.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [x] Unit Test
           - `./run-be-ut.sh --run --filter=LoadStreamMapPoolTest.*`
       - [x] Manual test (add detailed scripts or steps below)
           - `./build-support/check-format.sh`
           - `git diff --check`
           - Attempted `./build-support/run-clang-tidy.sh --build-dir 
be/build_Debug`; local analysis failed before checking the code because 
clang-tidy reported `malformed or corrupted AST file: 'malformed block record 
in AST file'` from the local compile database/PCH.
       - [ ] 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 <!-- Add your reason?  -->
   
   - Behavior changed:
       - [x] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   


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