pengxiangyu commented on code in PR #16803:
URL: https://github.com/apache/doris/pull/16803#discussion_r1108302426


##########
be/src/olap/tablet.cpp:
##########
@@ -1768,7 +1765,10 @@ Status Tablet::_cooldown_data(const 
std::shared_ptr<io::RemoteFileSystem>& dest_
     UniqueId cooldown_meta_id = UniqueId::gen_uid();
 
     // upload cooldowned rowset meta to remote fs
-    RETURN_IF_ERROR(_write_cooldown_meta(dest_fs.get(), cooldown_meta_id, 
new_rowset_meta.get()));
+    st = _write_cooldown_meta(dest_fs.get(), cooldown_meta_id, 
new_rowset_meta.get());
+    if (!st.ok()) {

Review Comment:
   no erase_pending_remote_rowset



##########
be/src/olap/tablet.cpp:
##########
@@ -1736,20 +1736,17 @@ Status Tablet::_cooldown_data(const 
std::shared_ptr<io::RemoteFileSystem>& dest_
         return Status::InternalError("cannot pick cooldown rowset in tablet 
{}", tablet_id());
     }
     RowsetId new_rowset_id = StorageEngine::instance()->next_rowset_id();
-
-    auto start = std::chrono::steady_clock::now();
-
+    add_pending_remote_rowset(new_rowset_id.to_string());
     Status st;
-    {
-        std::shared_lock slock(_remote_files_lock, std::try_to_lock);
-        if (!slock.owns_lock()) {
-            return Status::Status::Error<TRY_LOCK_FAILED>("try 
remote_files_lock failed");
+    Defer defer {[&] {
+        if (!st.ok()) {
+            erase_pending_remote_rowset(new_rowset_id.to_string());
+            // reclaim the incomplete rowset data in remote storage
+            record_unused_remote_rowset(new_rowset_id, dest_fs->id(), 
old_rowset->num_segments());
         }
-        st = old_rowset->upload_to(dest_fs.get(), new_rowset_id);
-    }
-    if (!st.ok()) {
-        // reclaim the incomplete rowset data in remote storage
-        record_unused_remote_rowset(new_rowset_id, dest_fs->id(), 
old_rowset->num_segments());
+    }};
+    auto start = std::chrono::steady_clock::now();
+    if (st = old_rowset->upload_to(dest_fs.get(), new_rowset_id); !st.ok()) {

Review Comment:
   no erase_pending_remote_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