imay commented on a change in pull request #1624: Fix tablet restore api in 
BE(#1623)
URL: https://github.com/apache/incubator-doris/pull/1624#discussion_r312801552
 
 

 ##########
 File path: be/src/http/action/restore_tablet_action.cpp
 ##########
 @@ -185,31 +176,48 @@ Status RestoreTabletAction::_restore(const std::string& 
key, int64_t tablet_id,
         return s;
     }
     // create hard link for files in 
/root_path/data/shard/tablet_id/schema_hash
+    s = _create_hard_link_recursive(latest_tablet_path, 
restore_schema_hash_path);
+    if (!s.ok()) {
+        s = FileUtils::remove_all(restore_schema_hash_path);
+        if (!s.ok()) {
+            LOG(WARNING) << "remove invalid tablet path:" << 
restore_schema_hash_path << " failed";
+        }
+    }
+    std::string restore_shard_path = 
store->get_absolute_shard_path(std::to_string(tablet_meta.shard_id()));
+    Status status = _reload_tablet(key, restore_shard_path, tablet_id, 
schema_hash);
+    return status;
+}
+
+Status RestoreTabletAction::_create_hard_link_recursive(const std::string& 
src, const std::string& dst) {
     std::vector<std::string> files;
-    s = FileUtils::scan_dir(latest_tablet_path, &files);
+    Status s = FileUtils::scan_dir(src, &files);
 
 Review comment:
   RETURN_IF_ERROR

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to