zhannngchen commented on code in PR #20907:
URL: https://github.com/apache/doris/pull/20907#discussion_r1244953260


##########
be/src/olap/compaction.cpp:
##########
@@ -574,11 +575,47 @@ Status Compaction::modify_rowsets(const 
Merger::Statistics* stats) {
 
         RETURN_IF_ERROR(_tablet->check_rowid_conversion(_output_rowset, 
location_map));
         location_map.clear();
+
         {
             std::lock_guard<std::mutex> 
wrlock_(_tablet->get_rowset_update_lock());
             std::lock_guard<std::shared_mutex> 
wrlock(_tablet->get_header_lock());
             SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
 
+            // Here we will calculate all the rowsets delete bitmaps which are 
committed but not published to reduce the calculation pressure
+            // of publish phase.
+            // All rowsets which need to recalculate have been published so we 
don't need to acquire lock.
+            // Step1: collect this tablet's all committed rowsets' delete 
bitmaps
+            TxnManager::txn_tablet_map_t txn_tablet_map {};
+            
StorageEngine::instance()->txn_manager()->get_all_commit_tablet_txn_info_by_tablet(
+                    _tablet, txn_tablet_map);
+
+            // Step2: calculate all rowsets' delete bitmaps which are 
published during compaction.
+            int64_t cur_max_version = _tablet->max_version().second;
+            RowsetIdUnorderedSet rowset_ids = 
_tablet->all_rs_id(cur_max_version);
+            rowset_ids.insert(_output_rowset->rowset_id());
+            for (const auto& it : txn_tablet_map) {
+                for (const auto& tablet_load_it : it.second) {
+                    const TabletTxnInfo& tablet_txn_info = 
tablet_load_it.second;
+                    DeleteBitmap output_delete_bitmap(_tablet->tablet_id());
+                    RowLocation src;
+                    std::shared_ptr<Rowset> rowset = tablet_txn_info.rowset;
+                    src.rowset_id = rowset->rowset_id();
+                    for (uint32_t seg_id = 0; seg_id < rowset->num_segments(); 
++seg_id) {
+                        src.segment_id = seg_id;
+                        _tablet->convert_rowid(rowset, 
*tablet_txn_info.delete_bitmap, src,

Review Comment:
   can't use such delete bitmap directly



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to