chaoyli commented on a change in pull request #454: Refactor Tablet and 
TabletMeta
URL: https://github.com/apache/incubator-doris/pull/454#discussion_r243523192
 
 

 ##########
 File path: be/src/olap/tablet.cpp
 ##########
 @@ -1126,490 +215,46 @@ void Tablet::get_missing_versions_with_header_locked(
     for (const Version& version : existing_versions) {
         if (version.first > last_version + 1) {
             for (int64_t i = last_version + 1; i < version.first; ++i) {
-                missing_versions->emplace_back(i, i);
+                missed_versions->emplace_back(i, i);
             }
         }
         last_version = version.second;
-        if (until_version <= last_version) {
+        if (spec_version <= last_version) {
             break;
         }
     }
     for (int64_t i = last_version + 1; i <= until_version; ++i) {
-        missing_versions->emplace_back(i, i);
-    }
-}
-
-const PDelta* Tablet::least_complete_version(
-    const vector<Version>& missing_versions) const {
-
-    const PDelta* least_delta = nullptr;
-    if (!missing_versions.empty()) {
-        Version version = missing_versions.front();
-        for (int i = 0; i < _tablet_meta->file_delta_size(); ++i) {
-            const PDelta* delta = _tablet_meta->get_delta(i);
-            if (delta->end_version() == version.first - 1) {
-                LOG(INFO) << "find least complete version. tablet=" << 
full_name() << ", "
-                    << "version=" << delta->start_version() << "-" << 
delta->end_version() << ", "
-                    << "version_hash=" << delta->version_hash() << ", "
-                    << "first_missing_version=" << version.first << "-" << 
version.second;
-                least_delta = delta;
-                break;
-            }
-        }
-    } else {
-        least_delta = lastest_version();
-    }
-
-    return least_delta;
-}
-
-OLAPStatus Tablet::is_push_for_delete(
-    int64_t transaction_id, bool* is_push_for_delete) const {
-
-    const PPendingDelta* pending_delta = 
_tablet_meta->get_pending_delta(transaction_id);
-    if (pending_delta == nullptr) {
-        LOG(WARNING) << "pending segment_group not found when check push for 
delete. [tablet=" << full_name()
-                     << " transaction_id=" << transaction_id << "]";
-        return OLAP_ERR_TRANSACTION_NOT_EXIST;
+        spec_versions->emplace_back(i, i);
     }
-    *is_push_for_delete  = pending_delta->has_delete_condition();
-    return OLAP_SUCCESS;
 }
 
-SegmentGroup* Tablet::_construct_segment_group_from_version(const PDelta* 
delta, int32_t segment_group_id) {
-    VLOG(3) << "begin to construct segment_group from version."
-            << "tablet=" << full_name() << ", "
-            << "version=" << delta->start_version() << "-" << 
delta->end_version() << ", "
-            << "version_hash=" << delta->version_hash();
-    Version version(delta->start_version(), delta->end_version());
-    const PSegmentGroup* psegment_group = nullptr;
-    if (segment_group_id == -1) {
-        // Previous FileVersionMessage will be convert to PDelta and 
PSegmentGroup.
-        // In PSegmentGroup, this is segment_group_id is set to minus one.
-        // When to get it, should used segment_group + 1 as index.
-        psegment_group = &(delta->segment_group().Get(segment_group_id + 1));
-    } else {
-        psegment_group = &(delta->segment_group().Get(segment_group_id));
-    }
-    SegmentGroup* segment_group = new SegmentGroup(this, version, 
delta->version_hash(),
-                                false, segment_group_id, 
psegment_group->num_segments());
-    if (psegment_group->has_empty()) {
-        segment_group->set_empty(psegment_group->empty());
-    }
-    DCHECK(segment_group != nullptr) << "malloc error when construct 
segment_group."
-            << "tablet=" << full_name() << ", "
-            << "version=" << version.first << "-" << version.second << ", "
-            << "version_hash=" << delta->version_hash();
-    OLAPStatus res = segment_group->validate();
-    if (res != OLAP_SUCCESS) {
-        SAFE_DELETE(segment_group);
-        return nullptr;
-    }
-
-    if (psegment_group->column_pruning_size() != 0) {
-        if (_num_key_fields != psegment_group->column_pruning_size()) {
-            LOG(WARNING) << "column pruning size error, " << "tablet=" << 
full_name() << ", "
-                << "version=" << version.first << "-" << version.second << ", "
-                << "version_hash=" << delta->version_hash() << ", "
-                << "column_pruning_size=" << 
psegment_group->column_pruning_size() << ", "
-                << "num_key_fields=" << _num_key_fields;
-            SAFE_DELETE(segment_group);
-            return nullptr;
-        }
-        vector<pair<string, string>> column_statistic_strings(_num_key_fields);
-        std::vector<bool> null_vec(_num_key_fields);
-        for (size_t j = 0; j < _num_key_fields; ++j) {
-            ColumnPruning column_pruning = psegment_group->column_pruning(j);
-            column_statistic_strings[j].first = column_pruning.min();
-            column_statistic_strings[j].second = column_pruning.max();
-            if (column_pruning.has_null_flag()) {
-                null_vec[j] = column_pruning.null_flag();
-            } else {
-                null_vec[j] = false;
-            }
-        }
-
-        res = segment_group->add_column_statistics(column_statistic_strings, 
null_vec);
-        if (res != OLAP_SUCCESS) {
-            SAFE_DELETE(segment_group);
-            return nullptr;
-        }
-    }
-
-    res = segment_group->load();
-    if (res != OLAP_SUCCESS) {
-        LOG(WARNING) << "fail to load segment_group. res=" << res << ", "
-                     << "tablet=" << full_name() << ", "
-                     << "version=" << version.first << "-" << version.second 
<< ", "
-                     << "version_hash=" << delta->version_hash();
-        SAFE_DELETE(segment_group);
-        return nullptr;
-    }
-
-    VLOG(3) << "finish to construct segment_group from version."
-            << "tablet=" << full_name() << ", "
-            << "version=" << version.first << "-" << version.second;
-    return segment_group;
-}
-
-OLAPStatus Tablet::_create_hard_link(const string& from, const string& to,
-                                        vector<string>* linked_success_files) {
-    if (link(from.c_str(), to.c_str()) != 0) {
-        LOG(WARNING) << "fail to create hard link. from=" << from << ", "
-                     << "to=" << to << ", " << "errno=" << Errno::no();
-        return OLAP_ERR_OS_ERROR;
-    }
-    linked_success_files->push_back(to);
-    VLOG(3) << "success to create hard link. [from=" << from << " to=" << to 
<< "]";
-    return OLAP_SUCCESS;
+NewStatus Tablet::modify_rowsets(vector<Rowset*>& to_add, vector<Rowset*>& 
to_delete) {
+    return Status::OK();
 }
 
-OLAPStatus Tablet::clone_data(const TabletMeta& clone_tablet_meta,
-                                 const vector<const PDelta*>& clone_deltas,
-                                 const vector<Version>& versions_to_delete) {
-    LOG(INFO) << "begin to clone data to tablet. tablet=" << full_name() << ", 
"
-              << "clone_versions_size=" << clone_deltas.size() << ", "
-              << "versions_to_delete_size=" << versions_to_delete.size();
-    OLAPStatus res = OLAP_SUCCESS;
-    version_olap_index_map_t tmp_data_sources;
-
-    do {
-        // load new local tablet_meta to operate on
-        TabletMeta new_local_tablet_meta;
-        TabletMetaManager::get_header(_store, _tablet_id, _schema_hash, 
&new_local_tablet_meta);
-
-        // delete versions from new local tablet_meta
-        for (const Version& version : versions_to_delete) {
-            res = new_local_tablet_meta.delete_version(version);
-            if (res != OLAP_SUCCESS) {
-                LOG(WARNING) << "failed to delete version from new local 
tablet_meta. [tablet=" << full_name()
-                             << " version=" << version.first << "-" << 
version.second << "]";
-                break;
-            }
-            LOG(INFO) << "delete version from new local tablet_meta when 
clone. [tablet='" << full_name()
-                      << "', version=" << version.first << "-" << 
version.second << "]";
-        }
+Rowset* Tablet::get_largest_rowset() {
 
 Review comment:
   Change it to rowset_with_largest_size.

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