github-actions[bot] commented on code in PR #16258:
URL: https://github.com/apache/doris/pull/16258#discussion_r1098136797


##########
be/src/olap/tablet.cpp:
##########
@@ -1661,10 +1670,107 @@ Status Tablet::cooldown() {
     }
     DCHECK(atol(dest_fs->id().c_str()) == storage_policy->resource_id);
     DCHECK(dest_fs->type() != io::FileSystemType::LOCAL);
-    if (cooldown_replica_id == replica_id()) {
-        RETURN_IF_ERROR(_cooldown_data(dest_fs));
+
+    if (_need_deal_cooldown_delete && _cooldown_replica_id == 
_tablet_meta->replica_id()) {
+        RETURN_IF_ERROR(_deal_cooldown_delete_files(dest_fs));
+    }
+
+    if (_need_cooldown) {
+        if (cooldown_replica_id == replica_id()) {
+            RETURN_IF_ERROR(_cooldown_data(dest_fs));
+        } else {
+            RETURN_IF_ERROR(_follow_cooldowned_data(dest_fs, 
cooldown_replica_id));
+        }
+    }
+
+    return Status::OK();
+}
+
+bool Tablet::get_cooldown_delete_id(TUniqueId* cooldown_delete_id) {
+    std::unique_lock delete_lock(_cooldown_delete_lock, std::try_to_lock);
+    if (!delete_lock.owns_lock()) {
+        LOG(WARNING) << "Failed to own delete_lock. tablet=" << tablet_id();
+        return false;
+    }
+    if (!_cooldown_delete_flag && _cooldown_delete_files.size() > 0) {
+        *cooldown_delete_id = _cooldown_delete_id;
+        return true;
+    }
+    return false;
+}
+
+void Tablet::enable_cooldown_flag(const TUniqueId& cooldown_delete_id) {
+    std::unique_lock delete_lock(_cooldown_delete_lock, std::try_to_lock);
+    if (!delete_lock.owns_lock()) {
+        LOG(WARNING) << "Failed to own delete_lock. tablet=" << tablet_id();
+        return;
+    }
+    if (cooldown_delete_id == _cooldown_delete_id) {
+        _cooldown_delete_flag = true;
+    }
+}
+
+bool Tablet::need_deal_cooldown_delete() {
+    if (_cooldown_replica_id != _tablet_meta->replica_id()) {
+        _need_deal_cooldown_delete = false;
+        return false;
+    }
+    _need_deal_cooldown_delete = _cooldown_delete_flag
+            || time(nullptr) - _last_cooldown_delete_time >= 
config::cooldown_delete_interval_time_sec;
+    return _need_deal_cooldown_delete;
+}
+
+Status Tablet::_deal_cooldown_delete_files(const 
std::shared_ptr<io::RemoteFileSystem>& fs) {
+    std::map<std::string, bool> remote_segment_name_map;
+    {
+        std::shared_lock meta_rlock(_meta_lock);
+        for (auto& rs_meta : _tablet_meta->all_rs_metas()) {
+            if (rs_meta->is_local()) {
+                continue;
+            }
+            for (int i = 0; i < rs_meta->num_segments(); ++i) {
+                remote_segment_name_map.emplace(BetaRowset::segment_file_name(
+                        rs_meta->rowset_id().to_string(), i));
+            }
+        }
+    }

Review Comment:
   warning: too many arguments to function call, expected 2, have 3 
[clang-diagnostic-error]
   ```cpp
   ), i));
      ^
   ```
   **be/src/olap/rowset/beta_rowset.h:57:** 'segment_file_name' declared here
   ```cpp
       static std::string segment_file_name(const std::string& rowset_id, int 
segment_id);
                          ^
   ```
   



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