AntiTopQuark commented on PR #66191:
URL: https://github.com/apache/doris/pull/66191#issuecomment-5434217323

   > [blocker] The row-binlog storage migration can race with an in-flight 
group load. The row-binlog builder retains a tablet shared pointer but does not 
register a separate transaction for that tablet. get_tablet_related_txns() only 
checks transaction-map keys and therefore cannot see either an active 
base-keyed group transaction or its nested attach_row_binlog. Migration reload 
replaces the tablet with a new UID/object, while commit/publish continues using 
the retained old object. Please add pair-aware transaction draining or lifetime 
migration locking, together with tests covering both pre-commit and 
committed-but-not-published windows.
   
   `get_tablet_related_txns()` now, when the queried tablet is not a map key, 
iterates each in-flight transaction and matches the attached row-binlog 
companion by tablet_id + tablet_uid:
   
   ```c++
   if (!is_related) {
       for (const auto& tablet_txn : it.second) {
           const auto& attached_tablet = 
tablet_txn.second->attach_row_binlog.tablet;
           if (attached_tablet != nullptr &&
               attached_tablet->tablet_id() == tablet_info.tablet_id &&
               attached_tablet->tablet_uid() == tablet_info.tablet_uid) {
               is_related = true;
               break;
           }
       }
   }
   ```
   
   Because EngineStorageMigrationTask::_check_running_txns() relies on this 
call, the migration now correctly detects the active base-keyed group 
transaction through its nested attach_row_binlog, and blocks/waits until the 
group load drains — no reload can swap the UID/object out from under an 
in-flight commit or publish.
   
   


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