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


##########
be/src/olap/compaction.cpp:
##########
@@ -574,16 +577,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
+            CommitTabletTxnInfoVec commit_tablet_txn_info_vec {};
+            
StorageEngine::instance()->txn_manager()->get_all_commit_tablet_txn_info_by_tablet(
+                    _tablet, commit_tablet_txn_info_vec);
+
+            // 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 : commit_tablet_txn_info_vec) {
+                DeleteBitmap output_delete_bitmap(_tablet->tablet_id());
+                const std::shared_ptr<Rowset>& rowset = it.rowset;
+                for (uint32_t seg_id = 0; seg_id < rowset->num_segments(); 
++seg_id) {
+                    _tablet->calc_compaction_output_rowset_delete_bitmap(
+                            std::vector<std::shared_ptr<Rowset>>(1, rowset), 
_rowid_conversion,

Review Comment:
   You used wrong input rowset?



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