chaoyli 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_r259709168
########## File path: be/src/olap/schema_change.cpp ########## @@ -1172,100 +1172,65 @@ OLAPStatus SchemaChangeHandler::_check_and_clear_schema_change_info( OLAPStatus SchemaChangeHandler::process_alter_tablet(AlterTabletType type, const TAlterTabletReq& request) { - OLAPStatus res = OLAP_SUCCESS; - LOG(INFO) << "begin to validate alter tablet request."; + LOG(INFO) << "begin to validate alter tablet request. base_tablet_id=" << request.base_tablet_id + << ", new_tablet_id=" << request.new_tablet_req.tablet_id; // 1. Lock schema_change_lock util schema change info is stored in tablet header if (!TabletManager::instance()->try_schema_change_lock(request.base_tablet_id)) { - OLAP_LOG_WARNING("failed to obtain schema change lock. [res=%d tablet=%ld]", - res, request.base_tablet_id); + LOG(WARNING) << "failed to obtain schema change lock. " + << "base_tablet=" << request.base_tablet_id; return OLAP_ERR_TRY_LOCK_FAILED; } // 2. Get base tablet - TabletSharedPtr ref_tablet = TabletManager::instance()->get_tablet( + TabletSharedPtr base_tablet = TabletManager::instance()->get_tablet( request.base_tablet_id, request.base_schema_hash); - if (ref_tablet.get() == NULL) { - OLAP_LOG_WARNING("fail to find base tablet. [base_tablet=%ld base_schema_hash=%d]", - request.base_tablet_id, request.base_schema_hash); + if (base_tablet == nullptr) { + LOG(WARNING) << "fail to find base tablet. base_tablet=" << request.base_tablet_id + << ", base_schema_hash=" << request.base_schema_hash; TabletManager::instance()->release_schema_change_lock(request.base_tablet_id); return OLAP_ERR_TABLE_NOT_FOUND; } // 3. Check if history schema change information exist, // if exist, it will be cleaned only when all delta versions converted - res = _check_and_clear_schema_change_info(ref_tablet, request); + OLAPStatus res = _check_and_clear_schema_change_info(base_tablet, request); if (res != OLAP_SUCCESS) { - OLAP_LOG_WARNING("failed to check and clear schema change info. [tablet='%s']", - ref_tablet->full_name().c_str()); + LOG(WARNING) << "failed to check and clear schema change info." + << " base_tablet=" << base_tablet->full_name(); TabletManager::instance()->release_schema_change_lock(request.base_tablet_id); return res; } // 4. return failed if new tablet already exist in StorageEngine. TabletSharedPtr new_tablet = TabletManager::instance()->get_tablet( request.new_tablet_req.tablet_id, request.new_tablet_req.tablet_schema.schema_hash); - if (new_tablet.get() != NULL) { - res = OLAP_SUCCESS; - } else { - res = _do_alter_tablet(type, ref_tablet, request); + if (new_tablet != nullptr) { + TabletManager::instance()->release_schema_change_lock(request.base_tablet_id); Review comment: Only call try_schema_change_lock() of base_tablet. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@doris.apache.org For additional commands, e-mail: dev-h...@doris.apache.org