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

   ### What problem does this PR solve?
   
   Backport #64349 to branch-4.1.
   
   Shared `DeltaWriterV2` instances can be reused by multiple local sinks from 
the same load. Before this change, the shared writer stored the `RuntimeState*` 
from the sink that first created it. If that creator sink finished and its 
`RuntimeState` was destroyed while another local sink continued to reuse the 
shared writer, `DeltaWriterV2::write()` could access the destroyed state in the 
memtable flush-limit cancellation path, causing a BE crash or ASAN 
use-after-free.
   
   This PR removes the stored `RuntimeState*` from `DeltaWriterV2`. The shared 
writer keeps only the stable `WorkloadGroup` pointer needed by `MemTableWriter` 
initialization, and `VTabletWriterV2` passes a per-call cancel checker into 
`DeltaWriterV2::write()` so cancellation is evaluated against the current sink.
   
   Branch-4.1 adaptation:
   
   - keep the detailed delta-writer profile gate at the `VTabletWriterV2` call 
site before passing a profile into the shared writer;
   - construct the new BE test schema with branch-local test helpers and 
protobuf fields.
   
   ### Check List
   
   - [x] `git diff HEAD^ HEAD --check`
   - [x] `./run-be-ut.sh --run 
--filter=TestVTabletWriterV2.shared_delta_writer_should_not_access_destroyed_creator_runtime_state:DeltaWriterV2PoolTest.*
 -j100`
   
   ### Release note
   
   Fix a possible BE crash when shared delta writers are reused by multiple 
local sinks.
   


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