diff --git a/be/src/olap/task/engine_clone_task.cpp b/be/src/olap/task/engine_clone_task.cpp index d25716ad31..997a5228c8 100644 --- a/be/src/olap/task/engine_clone_task.cpp +++ b/be/src/olap/task/engine_clone_task.cpp @@ -199,14 +199,13 @@ Status EngineCloneTask::_do_clone() { auto local_data_path = fmt::format("{}/{}", tablet->tablet_path(), CLONE_PREFIX); bool allow_incremental_clone = false; - int64_t specified_version = _clone_req.committed_version; + int64_t specified_version = _clone_req.version; if (tablet->enable_unique_key_merge_on_write()) { int64_t min_pending_ver = StorageEngine::instance()->get_pending_publish_min_version(tablet->tablet_id()); if (min_pending_ver - 1 < specified_version) { LOG(INFO) << "use min pending publish version for clone, min_pending_ver: " - << min_pending_ver - << " committed_version: " << _clone_req.committed_version; + << min_pending_ver << " visible_version: " << _clone_req.version; specified_version = min_pending_ver - 1; } } @@ -225,7 +224,7 @@ Status EngineCloneTask::_do_clone() { LOG(INFO) << "clone to existed tablet. missed_versions_size=" << missed_versions.size() << ", allow_incremental_clone=" << allow_incremental_clone << ", signature=" << _signature << ", tablet_id=" << _clone_req.tablet_id - << ", committed_version=" << _clone_req.committed_version + << ", visible_version=" << _clone_req.version << ", replica_id=" << _clone_req.replica_id; // try to download missing version from src backend. @@ -239,7 +238,7 @@ Status EngineCloneTask::_do_clone() { } else { LOG(INFO) << "clone tablet not exist, begin clone a new tablet from remote be. " << "signature=" << _signature << ", tablet_id=" << _clone_req.tablet_id - << ", committed_version=" << _clone_req.committed_version + << ", visible_version=" << _clone_req.version << ", req replica=" << _clone_req.replica_id; // create a new tablet in this be // Get local disk from olap @@ -294,8 +293,7 @@ Status EngineCloneTask::_set_tablet_info(bool is_new_tablet) { tablet_info.__set_replica_id(_clone_req.replica_id); tablet_info.__set_schema_hash(_clone_req.schema_hash); RETURN_IF_ERROR(StorageEngine::instance()->tablet_manager()->report_tablet_info(&tablet_info)); - if (_clone_req.__isset.committed_version && - tablet_info.version < _clone_req.committed_version) { + if (_clone_req.__isset.version && tablet_info.version < _clone_req.version) { // if it is a new tablet and clone failed, then remove the tablet // if it is incremental clone, then must not drop the tablet if (is_new_tablet) { @@ -306,13 +304,13 @@ Status EngineCloneTask::_set_tablet_info(bool is_new_tablet) { << ", replica_id:" << _clone_req.replica_id << ", schema_hash:" << _clone_req.schema_hash << ", signature:" << _signature << ", version:" << tablet_info.version - << ", expected_version: " << _clone_req.committed_version; + << ", expected_version: " << _clone_req.version; WARN_IF_ERROR(StorageEngine::instance()->tablet_manager()->drop_tablet( _clone_req.tablet_id, _clone_req.replica_id, false), "drop stale cloned table failed"); } return Status::InternalError("unexpected version. tablet version: {}, expected version: {}", - tablet_info.version, _clone_req.committed_version); + tablet_info.version, _clone_req.version); } LOG(INFO) << "clone get tablet info success. tablet_id:" << _clone_req.tablet_id << ", schema_hash:" << _clone_req.schema_hash << ", signature:" << _signature @@ -413,7 +411,7 @@ Status EngineCloneTask::_make_snapshot(const std::string& ip, int port, TTableId request.__set_tablet_id(tablet_id); request.__set_schema_hash(schema_hash); request.__set_preferred_snapshot_version(g_Types_constants.TPREFER_SNAPSHOT_REQ_VERSION); - request.__set_version(_clone_req.committed_version); + request.__set_version(_clone_req.version); request.__set_is_copy_binlog(true); // TODO: missing version composed of singleton delta. // if not, this place should be rewrote. @@ -577,8 +575,8 @@ Status EngineCloneTask::_download_files(DataDir* data_dir, const std::string& re /// This method will do the following things: /// 1. Linke all files from CLONE dir to tablet dir if file does not exist in tablet dir /// 2. Call _finish_xx_clone() to revise the tablet meta. -Status EngineCloneTask::_finish_clone(Tablet* tablet, const std::string& clone_dir, - int64_t committed_version, bool is_incremental_clone) { +Status EngineCloneTask::_finish_clone(Tablet* tablet, const std::string& clone_dir, int64_t version, + bool is_incremental_clone) { Defer remove_clone_dir {[&]() { std::filesystem::remove_all(clone_dir); }}; // check clone dir existed @@ -706,7 +704,7 @@ Status EngineCloneTask::_finish_clone(Tablet* tablet, const std::string& clone_d std::lock_guard wrlock(tablet->get_header_lock()); SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD); if (is_incremental_clone) { - status = _finish_incremental_clone(tablet, cloned_tablet_meta, committed_version); + status = _finish_incremental_clone(tablet, cloned_tablet_meta, version); } else { status = _finish_full_clone(tablet, cloned_tablet_meta); } @@ -725,17 +723,17 @@ Status EngineCloneTask::_finish_clone(Tablet* tablet, const std::string& clone_d /// 2. Revise the local tablet meta to add all incremental cloned rowset's meta. Status EngineCloneTask::_finish_incremental_clone(Tablet* tablet, const TabletMetaSharedPtr& cloned_tablet_meta, - int64_t committed_version) { + int64_t version) { LOG(INFO) << "begin to finish incremental clone. tablet=" << tablet->tablet_id() - << ", committed_version=" << committed_version + << ", visible_version=" << version << ", cloned_tablet_replica_id=" << cloned_tablet_meta->replica_id(); /// Get missing versions again from local tablet. /// We got it before outside the lock, so it has to be got again. std::vector missed_versions; - tablet->calc_missed_versions_unlocked(committed_version, &missed_versions); + tablet->calc_missed_versions_unlocked(version, &missed_versions); VLOG_NOTICE << "get missed versions again when finish incremental clone. " - << "tablet=" << tablet->tablet_id() << ", clone version=" << committed_version + << "tablet=" << tablet->tablet_id() << ", clone version=" << version << ", missed_versions_size=" << missed_versions.size(); // check missing versions exist in clone src diff --git a/be/src/olap/task/engine_clone_task.h b/be/src/olap/task/engine_clone_task.h index 9c79e5cadf..4f502ea50f 100644 --- a/be/src/olap/task/engine_clone_task.h +++ b/be/src/olap/task/engine_clone_task.h @@ -60,11 +60,11 @@ public: private: Status _do_clone(); - virtual Status _finish_clone(Tablet* tablet, const std::string& clone_dir, - int64_t committed_version, bool is_incremental_clone); + virtual Status _finish_clone(Tablet* tablet, const std::string& clone_dir, int64_t version, + bool is_incremental_clone); Status _finish_incremental_clone(Tablet* tablet, const TabletMetaSharedPtr& cloned_tablet_meta, - int64_t committed_version); + int64_t version); Status _finish_full_clone(Tablet* tablet, const TabletMetaSharedPtr& cloned_tablet_meta); diff --git a/fe/fe-core/src/main/java/org/apache/doris/task/CloneTask.java b/fe/fe-core/src/main/java/org/apache/doris/task/CloneTask.java index 4c06460cee..891ef99c6e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/task/CloneTask.java +++ b/fe/fe-core/src/main/java/org/apache/doris/task/CloneTask.java @@ -83,7 +83,7 @@ public class CloneTask extends AgentTask { TCloneReq request = new TCloneReq(tabletId, schemaHash, srcBackends); request.setReplicaId(replicaId); request.setStorageMedium(storageMedium); - request.setCommittedVersion(visibleVersion); + request.setVersion(visibleVersion); request.setTaskVersion(taskVersion); request.setPartitionId(partitionId); if (taskVersion == VERSION_2) { diff --git a/fe/fe-core/src/test/java/org/apache/doris/utframe/MockedBackendFactory.java b/fe/fe-core/src/test/java/org/apache/doris/utframe/MockedBackendFactory.java index f96a85253f..bd1ae4c69e 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/utframe/MockedBackendFactory.java +++ b/fe/fe-core/src/test/java/org/apache/doris/utframe/MockedBackendFactory.java @@ -248,8 +248,8 @@ public class MockedBackendFactory { } List tabletInfos = Lists.newArrayList(); - TTabletInfo tabletInfo = new TTabletInfo(req.tablet_id, req.schema_hash, req.committed_version, - req.committed_version_hash, 1, dataSize); + TTabletInfo tabletInfo = new TTabletInfo(req.tablet_id, req.schema_hash, req.version, + 0L, 1, dataSize); tabletInfo.setStorageMedium(req.storage_medium); tabletInfo.setPathHash(pathHash); tabletInfo.setUsed(true); diff --git a/gensrc/thrift/AgentService.thrift b/gensrc/thrift/AgentService.thrift index c83660e9b9..6f777675f3 100644 --- a/gensrc/thrift/AgentService.thrift +++ b/gensrc/thrift/AgentService.thrift @@ -258,7 +258,7 @@ struct TCloneReq { 3: required list src_backends 4: optional Types.TStorageMedium storage_medium // these are visible version(hash) actually - 5: optional Types.TVersion committed_version + 5: optional Types.TVersion version 6: optional Types.TVersionHash committed_version_hash // Deprecated 7: optional i32 task_version; 8: optional i64 src_path_hash;