kangpinghuang commented on a change in pull request #656: Modify alter tablet 
implementation and change ColumnPruning to ZoneMap
URL: https://github.com/apache/incubator-doris/pull/656#discussion_r259689736
 
 

 ##########
 File path: be/src/olap/schema_change.cpp
 ##########
 @@ -1632,166 +1563,156 @@ OLAPStatus 
SchemaChangeHandler::schema_version_convert(
 }
 
 OLAPStatus SchemaChangeHandler::_get_versions_to_be_changed(
-        TabletSharedPtr ref_tablet,
+        TabletSharedPtr base_tablet,
         vector<Version>& versions_to_be_changed) {
-    int32_t request_version = 0;
-    RowsetSharedPtr rowset = ref_tablet->rowset_with_max_version();
-    if (rowset != NULL) {
-        request_version = rowset->version().second - 1;
-    } else {
-        LOG(WARNING) << "Table has no version. path=" << 
ref_tablet->full_name();
+    Version request_version = { -1, 0 };
+    RowsetSharedPtr rowset = base_tablet->rowset_with_max_version();
+    if (rowset == nullptr) {
+        LOG(WARNING) << "Tablet has no version. base_tablet=" << 
base_tablet->full_name();
         return OLAP_ERR_ALTER_DELTA_DOES_NOT_EXISTS;
+    } else {
+        request_version = rowset->version();
     }
 
-    // 最新版本的delta可以被重导覆盖,因此计算获取的路径中,
-    // 必须包含最新版本的delta
-    if (request_version >= 0) {
-        vector<Version> span_versions;
-        ref_tablet->capture_consistent_versions(Version(0, request_version), 
&span_versions);
-
-        // get all version list
-        vector<Version> all_versions;
-        ref_tablet->list_versions(&all_versions);
-        if (0 == all_versions.size()) {
-            LOG(WARNING) << "there'is no any version in the tablet. tablet=" 
<< ref_tablet->full_name();
-            return OLAP_ERR_VERSION_NOT_EXIST;
-        }
-
-        for (uint32_t i = 0; i < span_versions.size(); i++) {
-            versions_to_be_changed.push_back(span_versions[i]);
-        }
+    vector<Version> span_versions;
+    base_tablet->capture_consistent_versions(request_version, &span_versions);
+    for (uint32_t i = 0; i < span_versions.size(); i++) {
+        versions_to_be_changed.push_back(span_versions[i]);
     }
-    versions_to_be_changed.push_back(
-            Version(rowset->version().first, rowset->version().second));
 
     return OLAP_SUCCESS;
 }
 
 // 增加A->(B|C|...) 的schema_change信息
-OLAPStatus SchemaChangeHandler::_save_schema_change_info(
+OLAPStatus SchemaChangeHandler::_add_alter_tablet_task(
         AlterTabletType alter_tablet_type,
-        TabletSharedPtr ref_tablet,
+        TabletSharedPtr base_tablet,
         TabletSharedPtr new_tablet,
         const vector<Version>& versions_to_be_changed) {
 
     // check new tablet exists,
     // prevent to set base's status after new's dropping (clear base's status)
     if (TabletManager::instance()->get_tablet(
             new_tablet->tablet_id(), new_tablet->schema_hash()).get() == NULL) 
{
-        OLAP_LOG_WARNING("fail to find tablet before saving status. 
[tablet='%s']",
-                         new_tablet->full_name().c_str());
+        LOG(WARNING) << "new_tablet does not exist. tablet=" << 
new_tablet->full_name();
         return OLAP_ERR_TABLE_NOT_FOUND;
     }
 
-    OLAPStatus res = OLAP_SUCCESS;
-
     // 1. 在新表和旧表中添加schema change标志
-    ref_tablet->delete_alter_task();
-    ref_tablet->add_alter_task(new_tablet->tablet_id(),
-                               new_tablet->schema_hash(),
-                               versions_to_be_changed,
-                               alter_tablet_type);
+    base_tablet->delete_alter_task();
+    base_tablet->add_alter_task(new_tablet->tablet_id(),
 
 Review comment:
   there is bug in add_alter_task function, pls check 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