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


##########
be/src/olap/tablet.cpp:
##########
@@ -1772,11 +1767,34 @@ Status check_version_continuity(const 
std::vector<RowsetMetaSharedPtr>& rs_metas
     return Status::OK();
 }
 
-Status Tablet::write_cooldown_meta() {
+// It's guaranteed the write cooldown meta task would be invoked at the end 
unless BE crashes
+// one tablet would at most have one async task to be done
+void Tablet::async_write_cooldown_meta() {
+    WriteCooldownMetaExecutors::GetInstance()->submit(tablet_id(), [this]() {
+        std::shared_lock cooldown_conf_rlock(_cooldown_conf_lock);
+        if (_cooldown_replica_id <= 0) { // wait for FE to push cooldown conf
+            LOG_INFO("tablet {} cancel write cooldown meta because invalid 
cooldown_replica_id",
+                     tablet_id());
+            return Status::OK();
+        }
+        auto [cooldown_replica_id, cooldown_term] = cooldown_conf();
+        if (cooldown_replica_id != replica_id()) {
+            LOG_INFO(
+                    "tablet {} cancel write cooldown meta because this replica 
is not cooldown "
+                    "replica",
+                    tablet_id());
+            return Status::OK();
+        }
+        return _write_cooldown_meta();
+    });
+}
+
+// hold SHARED `cooldown_conf_lock`
+Status Tablet::_write_cooldown_meta() {
     auto [cooldown_replica_id, cooldown_term] = cooldown_conf();
-    if (cooldown_replica_id != replica_id()) {
-        return Status::Aborted("this replica is not cooldown replica");
-    }
+
+    std::shared_ptr<io::RemoteFileSystem> fs;
+    RETURN_IF_ERROR(get_remote_file_system(storage_policy_id(), &fs));
 
     std::shared_ptr<io::RemoteFileSystem> fs;
     RETURN_IF_ERROR(get_remote_file_system(storage_policy_id(), &fs));

Review Comment:
   warning: redefinition of 'fs' [clang-diagnostic-error]
   ```cpp
   d_ptr<io::RemoteFileSystem> fs;
                               ^
   ```
   **be/src/olap/tablet.cpp:1796:** previous definition is here
   ```cpp
   d_ptr<io::RemoteFileSystem> fs;
                               ^
   ```
   



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