[bugfix](restore) add partition id into convert_rowset_ids() (#24834)

This commit is contained in:
DeadlineFen
2023-09-25 20:07:24 +08:00
committed by GitHub
parent 9dff620471
commit 6502da8917
8 changed files with 14 additions and 7 deletions

View File

@ -348,7 +348,8 @@ Status SingleReplicaCompaction::_fetch_rowset(const TReplicaInfo& addr, const st
if (status.ok()) {
// change all rowset ids because they maybe its id same with local rowset
auto olap_st = SnapshotManager::instance()->convert_rowset_ids(
local_path, _tablet->tablet_id(), _tablet->replica_id(), _tablet->schema_hash());
local_path, _tablet->tablet_id(), _tablet->replica_id(), _tablet->partition_id(),
_tablet->schema_hash());
if (!olap_st.ok()) {
LOG(WARNING) << "fail to convert rowset ids, path=" << local_path
<< ", tablet_id=" << _tablet->tablet_id() << ", error=" << olap_st;

View File

@ -125,7 +125,8 @@ Status SnapshotManager::release_snapshot(const string& snapshot_path) {
}
Status SnapshotManager::convert_rowset_ids(const std::string& clone_dir, int64_t tablet_id,
int64_t replica_id, const int32_t& schema_hash) {
int64_t replica_id, int64_t partition_id,
const int32_t& schema_hash) {
SCOPED_CONSUME_MEM_TRACKER(_mem_tracker);
Status res = Status::OK();
// check clone dir existed
@ -160,6 +161,9 @@ Status SnapshotManager::convert_rowset_ids(const std::string& clone_dir, int64_t
new_tablet_meta_pb.set_tablet_id(tablet_id);
*new_tablet_meta_pb.mutable_tablet_uid() = TabletUid::gen_uid().to_proto();
new_tablet_meta_pb.set_replica_id(replica_id);
if (partition_id != -1) {
new_tablet_meta_pb.set_partition_id(partition_id);
}
new_tablet_meta_pb.set_schema_hash(schema_hash);
TabletSchemaSPtr tablet_schema;
tablet_schema =

View File

@ -55,7 +55,7 @@ public:
static SnapshotManager* instance();
Status convert_rowset_ids(const std::string& clone_dir, int64_t tablet_id, int64_t replica_id,
const int32_t& schema_hash);
int64_t partition_id, const int32_t& schema_hash);
private:
SnapshotManager() : _snapshot_base_id(0) {

View File

@ -323,7 +323,7 @@ Status EngineCloneTask::_make_and_download_snapshots(DataDir& data_dir,
// change all rowset ids because they maybe its id same with local rowset
status = SnapshotManager::instance()->convert_rowset_ids(
local_data_path, _clone_req.tablet_id, _clone_req.replica_id,
_clone_req.schema_hash);
_clone_req.partition_id, _clone_req.schema_hash);
} else {
LOG_WARNING("failed to download snapshot from remote BE")
.tag("url", remote_url_prefix)

View File

@ -151,8 +151,8 @@ Status EngineStorageMigrationTask::_gen_and_write_header_to_hdr_file(
// it will change rowset id and its create time
// rowset create time is useful when load tablet from meta to check which tablet is the tablet to load
return SnapshotManager::instance()->convert_rowset_ids(full_path, tablet_id,
_tablet->replica_id(), schema_hash);
return SnapshotManager::instance()->convert_rowset_ids(
full_path, tablet_id, _tablet->replica_id(), _tablet->partition_id(), schema_hash);
}
Status EngineStorageMigrationTask::_reload_tablet(const std::string& full_path) {

View File

@ -697,7 +697,7 @@ Status SnapshotLoader::move(const std::string& snapshot_path, TabletSharedPtr ta
// rename the rowset ids and tabletid info in rowset meta
Status convert_status = SnapshotManager::instance()->convert_rowset_ids(
snapshot_path, tablet_id, tablet->replica_id(), schema_hash);
snapshot_path, tablet_id, tablet->replica_id(), tablet->partition_id(), schema_hash);
if (!convert_status.ok()) {
std::stringstream ss;
ss << "failed to convert rowsetids in snapshot: " << snapshot_path

View File

@ -85,6 +85,7 @@ public class CloneTask extends AgentTask {
request.setStorageMedium(storageMedium);
request.setCommittedVersion(visibleVersion);
request.setTaskVersion(taskVersion);
request.setPartitionId(partitionId);
if (taskVersion == VERSION_2) {
request.setSrcPathHash(srcPathHash);
request.setDestPathHash(destPathHash);

View File

@ -262,6 +262,7 @@ struct TCloneReq {
9: optional i64 dest_path_hash;
10: optional i32 timeout_s;
11: optional Types.TReplicaId replica_id = 0
12: optional i64 partition_id
}
struct TCompactionReq {