gavinchou commented on code in PR #59754:
URL: https://github.com/apache/doris/pull/59754#discussion_r2705510644


##########
be/src/cloud/cloud_tablet.cpp:
##########
@@ -1736,5 +1738,177 @@ void CloudTablet::add_warmed_up_rowset(const RowsetId& 
rowset_id) {
             .start_tp = std::chrono::steady_clock::now()};
 }
 
+void CloudTablet::clear_unused_visible_pending_rowsets() {
+    int64_t cur_max_version = max_version().second;
+    int32_t max_version_count = max_version_config();
+    int64_t current_time = std::chrono::duration_cast<std::chrono::seconds>(
+                                   
std::chrono::system_clock::now().time_since_epoch())
+                                   .count();
+    {
+        std::unique_lock<std::mutex> wlock(_visible_pending_rs_lock);
+        for (auto it = _visible_pending_rs_map.begin(); it != 
_visible_pending_rs_map.end();) {
+            if (int64_t version = it->first, expiration_time = 
it->second.expiration_time;
+                version <= cur_max_version || expiration_time < current_time) {
+                it = _visible_pending_rs_map.erase(it);
+            } else {
+                ++it;
+            }
+        }
+
+        while (!_visible_pending_rs_map.empty() &&
+               _visible_pending_rs_map.size() > max_version_count) {
+            _visible_pending_rs_map.erase(--_visible_pending_rs_map.end());
+        }
+    }
+}
+
+void CloudTablet::try_make_committed_rs_visible(int64_t txn_id, int64_t 
visible_version,
+                                                int64_t 
version_update_time_ms) {
+    if (enable_unique_key_merge_on_write()) {
+        try_make_committed_rs_visible_for_mow(txn_id, visible_version, 
version_update_time_ms);
+    } else {

Review Comment:
   return after dealing with mow to reduce unnecessary large block of `else` 
and indention.
   ```suggestion
       if (enable_unique_key_merge_on_write()) {
           try_make_committed_rs_visible_for_mow(txn_id, visible_version, 
version_update_time_ms);
           return;
       }
   ```



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