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


##########
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() &&

Review Comment:
   add comment for the intention to keep smaller versions that can be added in 
the future.



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