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

 ##########
 File path: be/src/olap/snapshot_manager.cpp
 ##########
 @@ -453,46 +425,25 @@ OLAPStatus 
SnapshotManager::_create_incremental_snapshot_files(
             break;
         }
 
-        for (int64_t missing_version : request.missing_version) {
-
-            // find missing version
-            const PDelta* incremental_delta =
-                ref_tablet->get_incremental_delta(Version(missing_version, 
missing_version));
-            if (incremental_delta != nullptr) {
-                VLOG(3) << "success to find missing version when snapshot, "
+        for (int64_t missed_version : request.missing_version) {
+            Version version = { missed_version, missed_version };
+            const RowsetSharedPtr rowset = 
ref_tablet->get_rowset_by_version(version);
+            if (rowset != nullptr) {
+                VLOG(3) << "success to find miss version when snapshot, "
                         << "begin to link files. tablet_id=" << 
request.tablet_id
                         << ", schema_hash=" << request.schema_hash
-                        << ", version=" << missing_version;
-                // link files
-                for (uint32_t i = 0; i < 
incremental_delta->segment_group(0).num_segments(); i++) {
-                    int32_t segment_group_id = 
incremental_delta->segment_group(0).segment_group_id();
-                    string from = 
ref_tablet->construct_incremental_index_file_path(
-                                Version(missing_version, missing_version),
-                                incremental_delta->version_hash(), 
segment_group_id, i);
-                    string to = schema_full_path + '/' + 
basename(from.c_str());
-                    if ((res = _create_hard_link(from, to)) != OLAP_SUCCESS) {
-                        break;
-                    }
-
-                    from = ref_tablet->construct_incremental_data_file_path(
-                                Version(missing_version, missing_version),
-                                incremental_delta->version_hash(), 
segment_group_id, i);
-                    to = schema_full_path + '/' + basename(from.c_str());
-                    if ((res = _create_hard_link(from, to)) != OLAP_SUCCESS) {
-                        break;
-                    }
-                }
-
-                if (res != OLAP_SUCCESS) {
-                    break;
-                }
-
+                        << ", version=" << version.first << "-" << 
version.second;
+                std::vector<std::string> success_files;
+                res = rowset->make_snapshot(&success_files);
 
 Review comment:
   this should be modified

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