airborne12 commented on code in PR #71217:
URL: https://github.com/apache/doris/pull/71217#discussion_r4808674991


##########
be/src/storage/tablet/tablet.h:
##########
@@ -582,6 +586,9 @@ class Tablet final : public BaseTablet {
     std::mutex _cumulative_compaction_lock;
     std::shared_timed_mutex _migration_lock;
     std::mutex _build_inverted_index_lock;
+    // Index id to the newest index change job that has run on it, in memory 
only.
+    // Guarded by _build_inverted_index_lock.
+    std::unordered_map<int64_t, int64_t> _index_change_job_ids;

Review Comment:
   Confirmed and fixed in 0601831b021.
   
   The per-`(tablet_id, index_id)` high-water marks now live in 
`TabletManager::tablets_shard` under a dedicated leaf mutex 
`lock_for_index_change_jobs`, and `Tablet::record_index_change_job` delegates 
to `TabletManager::record_index_change_job`. `TabletManager::_drop_tablet` 
clears the entry only when `is_drop_table_or_partition` is true, so local disk 
migration (`EngineStorageMigrationTask::_reload_tablet`), snapshot/header 
reloads, and replica rebalance/re-clone on the same BE all preserve the fence.
   
   Test: 
`IndexBuilderTest.RejectsRequestOfOlderIndexChangeJobAfterTabletMigration` runs 
BUILD job 20 on the original tablet, migrates it to a second `DataDir` via 
`EngineStorageMigrationTask` (confirming a fresh `Tablet` instance in 
`TabletManager`), checks that a late DROP of older job 10 is rejected with 
`CANCELLED` while keeping both rowsets' indexes intact, checks that newer DROP 
job 30 succeeds, and verifies that replica-only `drop_tablet(..., false)` 
preserves the fence while `drop_tablet(..., true)` clears it. Fails before the 
fix and passes after.



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