kangpinghuang commented on a change in pull request #596: Add implementation to 
tablet
URL: https://github.com/apache/incubator-doris/pull/596#discussion_r252103016
 
 

 ##########
 File path: be/src/olap/snapshot_manager.cpp
 ##########
 @@ -190,41 +192,11 @@ OLAPStatus SnapshotManager::_link_index_and_data_files(
         const vector<VersionEntity>& version_entity_vec) {
     OLAPStatus res = OLAP_SUCCESS;
 
-    std::stringstream prefix_stream;
-    prefix_stream << schema_hash_path << "/" << ref_tablet->tablet_id();
-    std::string tablet_path_prefix = prefix_stream.str();
-    for (const VersionEntity& entity : version_entity_vec) {
+    for (auto& entity : version_entity_vec) {
         Version version = entity.version;
-        VersionHash v_hash = entity.version_hash;
-        for (SegmentGroupEntity segment_group_entity : 
entity.segment_group_vec) {
-            int32_t segment_group_id = segment_group_entity.segment_group_id;
-            for (int seg_id = 0; seg_id < segment_group_entity.num_segments; 
++seg_id) {
-                std::string index_path =
-                    construct_index_file_path(tablet_path_prefix, version, 
v_hash, segment_group_id, seg_id);
-                std::string ref_tablet_index_path =
-                    ref_tablet->construct_index_file_path(version, v_hash, 
segment_group_id, seg_id);
-                res = _create_hard_link(ref_tablet_index_path, index_path);
-                if (res != OLAP_SUCCESS) {
-                    LOG(WARNING) << "fail to create hard link. "
-                        << " schema_hash_path=" << schema_hash_path
-                        << " from_path=" << ref_tablet_index_path
-                        << " to_path=" << index_path;
-                    return res;
-                }
-
-                std:: string data_path =
-                    construct_data_file_path(tablet_path_prefix, version, 
v_hash, segment_group_id, seg_id);
-                std::string ref_tablet_data_path =
-                    ref_tablet->construct_data_file_path(version, v_hash, 
segment_group_id, seg_id);
-                res = _create_hard_link(ref_tablet_data_path, data_path);
-                if (res != OLAP_SUCCESS) {
-                    LOG(WARNING) << "fail to create hard link."
-                        << "tablet_path_prefix=" << tablet_path_prefix
-                        << ", from_path=" << ref_tablet_data_path << ", 
to_path=" << data_path;
-                    return res;
-                }
-            }
-        }
+        const RowsetSharedPtr rowset = 
ref_tablet->get_rowset_by_version(version);
+        std::vector<std::string> success_files;
+        RETURN_NOT_OK(rowset->make_snapshot(&success_files));
 
 Review comment:
   this make_snapshot can not do snapshot as above. Add new api to realize it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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