fix backup delete piece file incomplete
This commit is contained in:
		| @ -227,7 +227,7 @@ int ObBackupCleanTaskMgr::mark_backup_files_deleting_() | ||||
|   } | ||||
|   return ret;  | ||||
| } | ||||
| // file:///backup/backup_sets/backup_set_xx_xxx_xxxx_end_xxx; | ||||
| // file:///backup/backup_sets/backup_set_xx_xxx_xxxx_end_xxx.obbak | ||||
| int ObBackupCleanTaskMgr::try_delete_extern_set_end_file_() | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
| @ -265,7 +265,7 @@ int ObBackupCleanTaskMgr::try_delete_extern_piece_end_file_() | ||||
|     LOG_WARN("backup piece info is invalid", K(ret), K_(backup_piece_info));  | ||||
|   } else if (OB_FAIL(ObArchivePathUtil::get_piece_end_file_path( | ||||
|       backup_dest_, backup_piece_info_.key_.dest_id_, backup_piece_info_.key_.round_id_, | ||||
|       backup_piece_info_.key_.piece_id_, backup_piece_info_.end_scn_, end_path))) { | ||||
|       backup_piece_info_.key_.piece_id_, backup_piece_info_.checkpoint_scn_, end_path))) { | ||||
|     LOG_WARN("failed to get backup set end placeholder path", K(ret), K_(backup_piece_info)); | ||||
|   } else if (OB_FAIL(ObBackupCleanUtil::delete_backup_file(end_path, backup_dest_.get_storage_info()))) { | ||||
|     LOG_WARN("failed to delete backup file", K(ret), K_(task_attr), K(end_path)); | ||||
| @ -653,7 +653,7 @@ int ObBackupCleanTaskMgr::generate_ls_task_(const share::ObLSID &ls_id, share::O | ||||
|   } | ||||
|   return ret; | ||||
| } | ||||
| // file:///obbackup/backup_set_1_full/infos/locality_info | ||||
| // file:///obbackup/backup_set_1_full/infos/locality_info.obbak | ||||
| int ObBackupCleanTaskMgr::delete_tenant_locality_info_() | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
| @ -669,7 +669,7 @@ int ObBackupCleanTaskMgr::delete_tenant_locality_info_() | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full/infos/diagnose_info | ||||
| // file:///obbackup/backup_set_1_full/infos/diagnose_info.obbak | ||||
| int ObBackupCleanTaskMgr::delete_tenant_diagnose_info_() | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
| @ -701,7 +701,7 @@ int ObBackupCleanTaskMgr::delete_meta_info_dir_() | ||||
|   return ret;  | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/single_backup_set_info | ||||
| // file:///obbackup/backup_set_1_full/single_backup_set_info.obbak | ||||
| int ObBackupCleanTaskMgr::delete_single_backup_set_info_() | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
| @ -889,7 +889,7 @@ int ObBackupCleanTaskMgr::delete_backup_piece_start_file_() | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/[dest_id]_[round_id]_[piece_id]/single_piece_info | ||||
| // oss://archive/[dest_id]_[round_id]_[piece_id]/single_piece_info.obarc | ||||
| int ObBackupCleanTaskMgr::delete_single_piece_info_() | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
| @ -904,7 +904,21 @@ int ObBackupCleanTaskMgr::delete_single_piece_info_() | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/[dest_id]_[round_id]_[piece_id]/piece_file_info | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/tenant_archive_piece_infos.obarc | ||||
| int ObBackupCleanTaskMgr::delete_tenant_archive_piece_infos() | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   ObBackupPath path; | ||||
|   if (OB_FAIL(ObArchivePathUtil::get_tenant_archive_piece_infos_file_path(backup_dest_, backup_piece_info_.key_.dest_id_, | ||||
|       backup_piece_info_.key_.round_id_, backup_piece_info_.key_.piece_id_, path))) { | ||||
|     LOG_WARN("failed to get tenant archive piece infos path", K(ret)); | ||||
|   } else if (OB_FAIL(share::ObBackupCleanUtil::delete_backup_file(path, backup_dest_.get_storage_info()))) { | ||||
|     LOG_WARN("failed to delete backup file", K(ret), K(task_attr_), K(path)); | ||||
|   } | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/[dest_id]_[round_id]_[piece_id]/file_info.obarc | ||||
| int ObBackupCleanTaskMgr::delete_piece_info_file_() | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
| @ -955,15 +969,17 @@ int ObBackupCleanTaskMgr::delete_backup_piece_meta_info_files_() | ||||
|   ObBackupPath path; | ||||
|   if (!backup_piece_info_.is_valid()) { | ||||
|     ret = OB_ERR_UNEXPECTED; | ||||
|     LOG_WARN("backup set info is valid", K(ret));  | ||||
|     LOG_WARN("backup piece info is valid", K(ret)); | ||||
|   } else if (OB_FAIL(delete_single_piece_info_())) { | ||||
|     LOG_WARN("failed to set delete single piece info file", K(ret), K(backup_piece_info_));  | ||||
|     LOG_WARN("failed to delete single piece info file", K(ret), K(backup_piece_info_)); | ||||
|   } else if (OB_FAIL(delete_piece_info_file_())) { | ||||
|     LOG_WARN("failed to set delete info file", K(ret), K(backup_piece_info_)); | ||||
|     LOG_WARN("failed to delete info file", K(ret), K(backup_piece_info_)); | ||||
|   } else if (OB_FAIL(delete_tenant_archive_piece_infos())) { | ||||
|     LOG_WARN("failed to delete info file", K(ret), K(backup_piece_info_)); | ||||
|   } else if (OB_FAIL(delete_piece_inner_placeholder_file_())) { | ||||
|     LOG_WARN("failed to set delete piece inner placeholder file", K(ret), K(backup_piece_info_)); | ||||
|     LOG_WARN("failed to delete piece inner placeholder file", K(ret), K(backup_piece_info_)); | ||||
|   } else if (OB_FAIL(delete_piece_checkpoint_file_())) { | ||||
|     LOG_WARN("failed to set delete checkpoint file", K(ret), K(backup_piece_info_)); | ||||
|     LOG_WARN("failed to delete checkpoint file", K(ret), K(backup_piece_info_)); | ||||
|   } else if (OB_FAIL(ObArchivePathUtil::get_piece_dir_path( | ||||
|       backup_dest_, backup_piece_info_.key_.dest_id_, backup_piece_info_.key_.round_id_, | ||||
|       backup_piece_info_.key_.piece_id_, path))) { | ||||
|  | ||||
| @ -95,6 +95,7 @@ private: | ||||
|   int delete_backup_set_dir_(); | ||||
|   int delete_meta_info_dir_(); | ||||
|   int delete_single_piece_info_(); | ||||
|   int delete_tenant_archive_piece_infos(); | ||||
|   int delete_piece_info_file_(); | ||||
|   int delete_piece_inner_placeholder_file_(); | ||||
|   int delete_piece_checkpoint_file_(); | ||||
|  | ||||
| @ -75,7 +75,7 @@ int ObArchivePathUtil::get_rounds_dir_path(const ObBackupDest &dest, ObBackupPat | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/rounds/round_d[dest_id]r[round_id]_start | ||||
| // oss://archive/rounds/round_d[dest_id]r[round_id]_start.obarc | ||||
| int ObArchivePathUtil::get_round_start_file_path(const ObBackupDest &dest, const int64_t dest_id,  | ||||
|     const int64_t round_id, ObBackupPath &path) | ||||
| { | ||||
| @ -91,7 +91,7 @@ int ObArchivePathUtil::get_round_start_file_path(const ObBackupDest &dest, const | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/rounds/round_d[dest_id]r[round_id]_end | ||||
| // oss://archive/rounds/round_d[dest_id]r[round_id]_end.obarc | ||||
| int ObArchivePathUtil::get_round_end_file_path(const ObBackupDest &dest, const int64_t dest_id,  | ||||
|     const int64_t round_id, ObBackupPath &path) | ||||
| { | ||||
| @ -120,7 +120,7 @@ int ObArchivePathUtil::get_pieces_dir_path(const ObBackupDest &dest, ObBackupPat | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // // oss://archive/pieces/piece_d[dest_id]r[round_id]p[piece_id]_start_20220601T120000 | ||||
| // // oss://archive/pieces/piece_d[dest_id]r[round_id]p[piece_id]_start_20220601T120000.obarc | ||||
| int ObArchivePathUtil::get_piece_start_file_path(const ObBackupDest &dest, const int64_t dest_id,  | ||||
|     const int64_t round_id, const int64_t piece_id, const SCN &start_scn, | ||||
|     ObBackupPath &path) | ||||
| @ -141,7 +141,7 @@ int ObArchivePathUtil::get_piece_start_file_path(const ObBackupDest &dest, const | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/pieces/piece_d[dest_id]r[round_id]p[piece_id]_end_20220601T120000 | ||||
| // oss://archive/pieces/piece_d[dest_id]r[round_id]p[piece_id]_end_20220601T120000.obarc | ||||
| int ObArchivePathUtil::get_piece_end_file_path(const ObBackupDest &dest, const int64_t dest_id,  | ||||
|     const int64_t round_id, const int64_t piece_id, const SCN &end_scn, | ||||
|     ObBackupPath &path) | ||||
| @ -179,7 +179,7 @@ int ObArchivePathUtil::get_piece_dir_path(const ObBackupDest &dest, const int64_ | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/single_piece_info | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/single_piece_info.obarc | ||||
| int ObArchivePathUtil::get_single_piece_file_path(const ObBackupDest &dest, const int64_t dest_id,  | ||||
|     const int64_t round_id, const int64_t piece_id, ObBackupPath &path) | ||||
| { | ||||
| @ -207,7 +207,7 @@ int ObArchivePathUtil::get_piece_checkpoint_dir_path(const ObBackupDest &dest, c | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/checkpoint/checkpoint_info.[file_id] | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/checkpoint/checkpoint_info.[file_id].obarc | ||||
| int ObArchivePathUtil::get_piece_checkpoint_file_path(const ObBackupDest &dest, const int64_t dest_id,  | ||||
|     const int64_t round_id, const int64_t piece_id, const int64_t file_id, ObBackupPath &path) | ||||
| { | ||||
| @ -223,7 +223,7 @@ int ObArchivePathUtil::get_piece_checkpoint_file_path(const ObBackupDest &dest, | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/piece_d[dest_id]r[round_id]p[piece_id]_20220601T120000_20220602T120000 | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/piece_d[dest_id]r[round_id]p[piece_id]_20220601T120000_20220602T120000.obarc | ||||
| int ObArchivePathUtil::get_piece_inner_placeholder_file_path(const ObBackupDest &dest, const int64_t dest_id,  | ||||
|     const int64_t round_id, const int64_t piece_id, const SCN &start_scn, const SCN &end_scn, ObBackupPath &path) | ||||
| { | ||||
| @ -277,33 +277,33 @@ int ObArchivePathUtil::get_piece_ls_log_dir_path(const ObBackupDest &dest, const | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[ls_id]/ls_file_info | ||||
| int ObArchivePathUtil::get_single_ls_info_file_path(const ObBackupDest &dest, const int64_t dest_id,  | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[ls_id]/file_info.obarc | ||||
| int ObArchivePathUtil::get_ls_file_info_path(const ObBackupDest &dest, const int64_t dest_id, | ||||
|     const int64_t round_id, const int64_t piece_id, const ObLSID &ls_id, ObBackupPath &path) | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   if (OB_FAIL(get_piece_ls_dir_path_(dest, dest_id, round_id, piece_id, ls_id, path))) { | ||||
|     LOG_WARN("failed to get piece dir path", K(ret), K(dest), K(round_id), K(dest_id), K(piece_id), K(ls_id)); | ||||
|   } else if (OB_FAIL(path.join("ls_file_info", ObBackupFileSuffix::ARCHIVE))) { | ||||
|   } else if (OB_FAIL(path.join("file_info", ObBackupFileSuffix::ARCHIVE))) { | ||||
|     LOG_WARN("failed to join ls file info ", K(ret), K(path)); | ||||
|   } | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/piece_file_info | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/file_info.obarc | ||||
| int ObArchivePathUtil::get_piece_info_file_path(const ObBackupDest &dest, const int64_t dest_id,  | ||||
|     const int64_t round_id, const int64_t piece_id, ObBackupPath &path) | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   if (OB_FAIL(get_piece_dir_path(dest, dest_id, round_id, piece_id, path))) { | ||||
|     LOG_WARN("failed to get piece dir path", K(ret), K(dest), K(round_id), K(dest_id), K(piece_id)); | ||||
|   } else if (OB_FAIL(path.join("piece_file_info", ObBackupFileSuffix::ARCHIVE))) { | ||||
|   } else if (OB_FAIL(path.join("file_info", ObBackupFileSuffix::ARCHIVE))) { | ||||
|     LOG_WARN("failed to join piece info file", K(ret), K(path)); | ||||
|   } | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/tenant_archive_piece_infos | ||||
| // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/tenant_archive_piece_infos.obarc | ||||
| int ObArchivePathUtil::get_tenant_archive_piece_infos_file_path(const ObBackupDest &dest, const int64_t dest_id,  | ||||
|     const int64_t round_id, const int64_t piece_id, ObBackupPath &path) | ||||
| { | ||||
| @ -336,10 +336,9 @@ int ObArchivePathUtil::get_ls_meta_record_prefix(const ObBackupDest &dest, const | ||||
|     const ObArchiveLSMetaType &meta_type, ObBackupPath &prefix) | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   ObFixedLengthString<ObArchiveLSMetaType::MAX_TYPE_LEN> s(meta_type.get_type_str()); | ||||
|   if (OB_FAIL(get_piece_ls_dir_path_(dest, dest_id, round_id, piece_id, ls_id, prefix))) { | ||||
|     LOG_WARN("failed to get piece dir path", K(ret), K(dest), K(round_id), K(dest_id), K(piece_id), K(ls_id)); | ||||
|   } else if (OB_FAIL(prefix.join(::obsys::ObStringUtil::str_to_lower(s.ptr()), ObBackupFileSuffix::NONE))) { | ||||
|   } else if (OB_FAIL(prefix.join(meta_type.get_type_str(), ObBackupFileSuffix::NONE))) { | ||||
|     LOG_WARN("failed to join meta_type", K(ret), K(prefix)); | ||||
|   } | ||||
|   return ret; | ||||
|  | ||||
| @ -84,11 +84,11 @@ public: | ||||
|   static int get_piece_ls_log_dir_path(const ObBackupDest &dest, const int64_t dest_id, | ||||
|       const int64_t round_id, const int64_t piece_id, const ObLSID &ls_id, ObBackupPath &path); | ||||
|  | ||||
|   // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[ls_id]/ls_file_info.obarc | ||||
|   static int get_single_ls_info_file_path(const ObBackupDest &dest, const int64_t dest_id,  | ||||
|   // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[ls_id]/file_info.obarc | ||||
|   static int get_ls_file_info_path(const ObBackupDest &dest, const int64_t dest_id, | ||||
|       const int64_t round_id, const int64_t piece_id, const ObLSID &ls_id, ObBackupPath &path); | ||||
|  | ||||
|   // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/piece_file_info.obarc | ||||
|   // oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/file_info.obarc | ||||
|   static int get_piece_info_file_path(const ObBackupDest &dest, const int64_t dest_id,  | ||||
|       const int64_t round_id, const int64_t piece_id, ObBackupPath &path); | ||||
|    | ||||
|  | ||||
| @ -920,7 +920,7 @@ int ObArchiveStore::write_piece_inner_placeholder(const int64_t dest_id, const i | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/d[dest_id]r[round_id]p[piece_id]/[ls_id]/ls_file_info.obarc | ||||
| // oss://archive/d[dest_id]r[round_id]p[piece_id]/[ls_id]/file_info.obarc | ||||
| int ObArchiveStore::is_single_ls_info_file_exist(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, | ||||
|     const ObLSID &ls_id, bool &is_exist) const | ||||
| { | ||||
| @ -932,7 +932,7 @@ int ObArchiveStore::is_single_ls_info_file_exist(const int64_t dest_id, const in | ||||
|   if (!is_init()) { | ||||
|     ret = OB_NOT_INIT; | ||||
|     LOG_WARN("ObArchiveStore not init", K(ret)); | ||||
|   } else if (OB_FAIL(ObArchivePathUtil::get_single_ls_info_file_path(dest, dest_id, round_id, piece_id, ls_id,full_path))) { | ||||
|   } else if (OB_FAIL(ObArchivePathUtil::get_ls_file_info_path(dest, dest_id, round_id, piece_id, ls_id,full_path))) { | ||||
|     LOG_WARN("failed to get single ls info file path", K(ret), K(dest), K(dest_id), K(round_id), K(piece_id), K(ls_id)); | ||||
|   } else if (OB_FAIL(util.is_exist(full_path.get_ptr(), storage_info, is_exist))) { | ||||
|     LOG_WARN("failed to check single ls info file exist.", K(ret), K(dest), K(dest_id), K(round_id), K(piece_id), K(ls_id), K(full_path), K(storage_info)); | ||||
| @ -949,7 +949,7 @@ int ObArchiveStore::read_single_ls_info(const int64_t dest_id, const int64_t rou | ||||
|   if (!is_init()) { | ||||
|     ret = OB_NOT_INIT; | ||||
|     LOG_WARN("ObArchiveStore not init", K(ret)); | ||||
|   } else if (OB_FAIL(ObArchivePathUtil::get_single_ls_info_file_path(dest, dest_id, round_id, piece_id, ls_id, full_path))) { | ||||
|   } else if (OB_FAIL(ObArchivePathUtil::get_ls_file_info_path(dest, dest_id, round_id, piece_id, ls_id, full_path))) { | ||||
|     LOG_WARN("failed to get single ls info file path", K(ret), K(dest), K(dest_id), K(round_id), K(piece_id), K(ls_id)); | ||||
|   } else if (OB_FAIL(read_single_file(full_path.get_ptr(), desc))) { | ||||
|     LOG_WARN("failed to read single file", K(ret), K(full_path)); | ||||
| @ -965,7 +965,7 @@ int ObArchiveStore::write_single_ls_info(const int64_t dest_id, const int64_t ro | ||||
|   if (!is_init()) { | ||||
|     ret = OB_NOT_INIT; | ||||
|     LOG_WARN("ObArchiveStore not init", K(ret)); | ||||
|   } else if (OB_FAIL(ObArchivePathUtil::get_single_ls_info_file_path(dest, dest_id, round_id, piece_id, ls_id, full_path))) { | ||||
|   } else if (OB_FAIL(ObArchivePathUtil::get_ls_file_info_path(dest, dest_id, round_id, piece_id, ls_id, full_path))) { | ||||
|     LOG_WARN("failed to get single ls info file path", K(ret), K(dest), K(dest_id), K(round_id), K(piece_id), K(ls_id)); | ||||
|   } else if (OB_FAIL(write_single_file(full_path.get_ptr(), desc))) { | ||||
|     LOG_WARN("failed to write single file", K(ret), K(full_path)); | ||||
| @ -973,7 +973,7 @@ int ObArchiveStore::write_single_ls_info(const int64_t dest_id, const int64_t ro | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // oss://archive/d[dest_id]r[round_id]p[piece_id]/piece_file_info.obarc | ||||
| // oss://archive/d[dest_id]r[round_id]p[piece_id]/file_info.obarc | ||||
| int ObArchiveStore::is_piece_info_file_exist(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, bool &is_exist) const | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|  | ||||
| @ -325,12 +325,12 @@ class ObArchiveStore : public ObBackupStore | ||||
| public: | ||||
|   ObArchiveStore(); | ||||
|  | ||||
|   // oss://archive/rounds/round_d[dest_id]r[round_id]_start | ||||
|   // oss://archive/rounds/round_d[dest_id]r[round_id]_start.obarc | ||||
|   int is_round_start_file_exist(const int64_t dest_id, const int64_t round_id, bool &is_exist) const; | ||||
|   int read_round_start(const int64_t dest_id, const int64_t round_id, ObRoundStartDesc &desc) const; | ||||
|   int write_round_start(const int64_t dest_id, const int64_t round_id, const ObRoundStartDesc &desc) const; | ||||
|  | ||||
|   // oss://archive/rounds/round_d[dest_id]r[round_id]_end | ||||
|   // oss://archive/rounds/round_d[dest_id]r[round_id]_end.obarc | ||||
|   int is_round_end_file_exist(const int64_t dest_id, const int64_t round_id, bool &is_exist) const; | ||||
|   int read_round_end(const int64_t dest_id, const int64_t round_id, ObRoundEndDesc &desc) const; | ||||
|   int write_round_end(const int64_t dest_id, const int64_t round_id, const ObRoundEndDesc &desc) const; | ||||
| @ -343,7 +343,7 @@ public: | ||||
|   int write_piece_start(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, | ||||
|       const SCN &create_scn, const ObPieceStartDesc &desc) const; | ||||
|  | ||||
|   // oss://archive/pieces/piece_d[dest_id]r[round_id]p[piece_id]_end_20220601T120000 | ||||
|   // oss://archive/pieces/piece_d[dest_id]r[round_id]p[piece_id]_end_20220601T120000.obarc | ||||
|   int is_piece_end_file_exist(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, | ||||
|       const SCN &create_scn, bool &is_exist) const; | ||||
|   int read_piece_end(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, | ||||
| @ -351,34 +351,34 @@ public: | ||||
|   int write_piece_end(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, | ||||
|       const SCN &create_scn, const ObPieceEndDesc &desc) const; | ||||
|  | ||||
|   // oss://archive/d[dest_id]r[round_id]p[piece_id]/single_piece_info | ||||
|   // oss://archive/d[dest_id]r[round_id]p[piece_id]/single_piece_info.obarc | ||||
|   int is_single_piece_file_exist(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, bool &is_exist) const; | ||||
|   int read_single_piece(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, ObSinglePieceDesc &desc) const; | ||||
|   int write_single_piece(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, const ObSinglePieceDesc &desc) const; | ||||
|  | ||||
|   // oss://archive/d[dest_id]r[round_id]p[piece_id]/checkpoint/checkpoint_info.[file_id] | ||||
|   // oss://archive/d[dest_id]r[round_id]p[piece_id]/checkpoint/checkpoint_info.[file_id].obarc | ||||
|   int is_piece_checkpoint_file_exist(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, const int64_t file_id, bool &is_exist) const; | ||||
|   int read_piece_checkpoint(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, const int64_t file_id, ObPieceCheckpointDesc &desc) const; | ||||
|   int write_piece_checkpoint(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, const int64_t file_id, const ObPieceCheckpointDesc &desc) const; | ||||
|  | ||||
|   // oss://archive/d[dest_id]r[round_id]p[piece_id]/piece_d[dest_id]r[round_id]p[piece_id]_20220601T120000_20220602T120000 | ||||
|   // oss://archive/d[dest_id]r[round_id]p[piece_id]/piece_d[dest_id]r[round_id]p[piece_id]_20220601T120000_20220602T120000.obarc | ||||
|   int is_piece_inner_placeholder_file_exist(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, const SCN &start_scn, | ||||
|       const SCN &end_scn, bool &is_exist) const; | ||||
|   int read_piece_inner_placeholder(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, const SCN &start_scn, const SCN &end_scn, ObPieceInnerPlaceholderDesc &desc) const; | ||||
|   int write_piece_inner_placeholder(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, const SCN &start_scn, const SCN &end_scn, const ObPieceInnerPlaceholderDesc &desc) const; | ||||
|  | ||||
|   // oss://archive/d[dest_id]r[round_id]p[piece_id]/[ls_id]/ls_file_info | ||||
|   // oss://archive/d[dest_id]r[round_id]p[piece_id]/[ls_id]/file_info.obarc | ||||
|   int is_single_ls_info_file_exist(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, | ||||
|       const ObLSID &ls_id, bool &is_exist) const; | ||||
|   int read_single_ls_info(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, const ObLSID &ls_id, ObSingleLSInfoDesc &desc) const; | ||||
|   int write_single_ls_info(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, const ObLSID &ls_id, const ObSingleLSInfoDesc &desc) const; | ||||
|  | ||||
|   // oss://archive/d[dest_id]r[round_id]p[piece_id]/piece_file_info | ||||
|   // oss://archive/d[dest_id]r[round_id]p[piece_id]/file_info.obarc | ||||
|   int is_piece_info_file_exist(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, bool &is_exist) const; | ||||
|   int read_piece_info(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, ObPieceInfoDesc &desc) const; | ||||
|   int write_piece_info(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, const ObPieceInfoDesc &desc) const; | ||||
|  | ||||
|   // oss://archive/d[dest_id]r[round_id]p[piece_id]/tenant_archive_piece_infos | ||||
|   // oss://archive/d[dest_id]r[round_id]p[piece_id]/tenant_archive_piece_infos.obarc | ||||
|   int is_tenant_archive_piece_infos_file_exist(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, bool &is_exist) const; | ||||
|   int read_tenant_archive_piece_infos(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, ObTenantArchivePieceInfosDesc &desc) const; | ||||
|   int write_tenant_archive_piece_infos(const int64_t dest_id, const int64_t round_id, const int64_t piece_id, const ObTenantArchivePieceInfosDesc &desc) const; | ||||
|  | ||||
| @ -1134,11 +1134,36 @@ int ObArchiveLSMetaType::compare(const ObArchiveLSMetaType &other) const | ||||
|  | ||||
| const char *ObArchiveLSMetaType::get_type_str() const | ||||
| { | ||||
|   #define CHECK_TYPE_STR(x) case(Type::x): return #x | ||||
|   switch (type_) { | ||||
|     CHECK_TYPE_STR(SCHEMA_META); | ||||
|     default: | ||||
|       return "Invalid"; | ||||
|   const char *type_str = nullptr; | ||||
|   const char *meta_type_strs[] = { | ||||
|     "invalid", | ||||
|     "schema_meta", | ||||
|   }; | ||||
|   #undef CHECK_TYPE_STR | ||||
|   STATIC_ASSERT(Type::MAX_TYPE == ARRAYSIZEOF(meta_type_strs), "type count mismatch"); | ||||
|   if (type_ < Type::INVALID_TYPE || type_ >= Type::MAX_TYPE) { | ||||
|     type_str = "unknow"; | ||||
|   } else { | ||||
|     type_str = meta_type_strs[type_]; | ||||
|   } | ||||
|   return type_str; | ||||
| } | ||||
|  | ||||
| int ObArchiveLSMetaType::get_next_type() | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   switch (type_) { | ||||
|     case Type::INVALID_TYPE: { | ||||
|       type_ = Type::SCHEMA_META; | ||||
|       break; | ||||
|     }; | ||||
|     case Type::SCHEMA_META: { | ||||
|       ret = OB_ITER_END; | ||||
|       break; | ||||
|     }; | ||||
|     case Type::MAX_TYPE: { | ||||
|       ret = OB_ITER_END; | ||||
|       break; | ||||
|     }; | ||||
|   } | ||||
|   return ret; | ||||
| } | ||||
| @ -900,7 +900,7 @@ struct ObArchiveLSMetaType final | ||||
|   // so pay attention to give the type an appropriate name while the length of its name | ||||
|   // 'SMALLER' than then MAX_TYPE_LEN | ||||
|   static const int64_t MAX_TYPE_LEN = 100; | ||||
|   enum class Type : int64_t | ||||
|   enum Type : int64_t | ||||
|   { | ||||
|     INVALID_TYPE = 0, | ||||
|     // add task type here | ||||
| @ -918,6 +918,7 @@ struct ObArchiveLSMetaType final | ||||
|   bool operator==(const ObArchiveLSMetaType &other) const { return 0 == compare(other); } | ||||
|   bool operator!=(const ObArchiveLSMetaType &other) const { return !operator==(other); } | ||||
|   const char *get_type_str() const; | ||||
|   int get_next_type(); | ||||
|  | ||||
|   TO_STRING_KV("type", get_type_str()); | ||||
| }; | ||||
|  | ||||
| @ -542,7 +542,7 @@ int ObBackupPathUtil::get_backup_set_placeholder_end_failed_path( | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/ | ||||
| // file:///obbackup/backup_set_1_full/ | ||||
| int ObBackupPathUtil::get_backup_set_dir_path(const share::ObBackupDest &backup_set_dest, ObBackupPath &path) | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
| @ -553,7 +553,7 @@ int ObBackupPathUtil::get_backup_set_dir_path(const share::ObBackupDest &backup_ | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/ | ||||
| // file:///obbackup/backup_set_1_full/ | ||||
| int ObBackupPathUtil::get_backup_set_dir_path(const share::ObBackupDest &backup_tenant_dest,  | ||||
|     const share::ObBackupSetDesc &desc, share::ObBackupPath &backup_path) | ||||
| { | ||||
| @ -613,7 +613,7 @@ int ObBackupPathUtil::get_backup_set_inner_placeholder( | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/log_stream_1/ | ||||
| // file:///obbackup/backup_set_1_full/log_stream_1/ | ||||
| int ObBackupPathUtil::get_ls_backup_dir_path(const share::ObBackupDest &backup_set_dest, const share::ObLSID &ls_id,  | ||||
|     ObBackupPath &path) | ||||
| { | ||||
| @ -638,7 +638,7 @@ int ObBackupPathUtil::get_ls_backup_dir_path(const share::ObBackupDest &backup_s | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/log_stream_1/meta_info_turn_1/tablet_info.obbak | ||||
| // file:///obbackup/backup_set_1_full/log_stream_1/meta_info_turn_1/tablet_info.obbak | ||||
| int ObBackupPathUtil::get_ls_data_tablet_info_path(const share::ObBackupDest &backup_set_dest, | ||||
|     const share::ObLSID &ls_id, const int64_t turn_id, const int64_t retry_id, ObBackupPath &path) | ||||
| { | ||||
| @ -653,7 +653,7 @@ int ObBackupPathUtil::get_ls_data_tablet_info_path(const share::ObBackupDest &ba | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/log_stream_1/major_data_turn_1_retry_0/ | ||||
| // file:///obbackup/backup_set_1_full/log_stream_1/major_data_turn_1_retry_0/ | ||||
| int ObBackupPathUtil::get_ls_backup_data_dir_path(const share::ObBackupDest &backup_set_dest, | ||||
|     const share::ObLSID &ls_id, const ObBackupDataType &backup_data_type, | ||||
|     const int64_t turn_id, const int64_t retry_id, ObBackupPath &path) | ||||
| @ -668,7 +668,7 @@ int ObBackupPathUtil::get_ls_backup_data_dir_path(const share::ObBackupDest &bac | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/log_stream_1/major_data_turn_1_retry_0/ | ||||
| // file:///obbackup/backup_set_1_full/log_stream_1/major_data_turn_1_retry_0/ | ||||
| int ObBackupPathUtil::get_ls_backup_data_dir_path(const share::ObBackupDest &backup_tenant_dest, | ||||
|     const share::ObBackupSetDesc &desc, const share::ObLSID &ls_id, const share::ObBackupDataType &backup_data_type, | ||||
|     const int64_t turn_id, const int64_t retry_id, share::ObBackupPath &backup_path) | ||||
| @ -684,7 +684,7 @@ int ObBackupPathUtil::get_ls_backup_data_dir_path(const share::ObBackupDest &bac | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/log_stream_1/major_data_turn_1_retry_0/macro_block_data.1.obbak | ||||
| // file:///obbackup/backup_set_1_full/log_stream_1/major_data_turn_1_retry_0/macro_block_data.1.obbak | ||||
| int ObBackupPathUtil::get_macro_block_backup_path(const share::ObBackupDest &backup_set_dest, | ||||
|     const share::ObLSID &ls_id, const ObBackupDataType &backup_data_type, | ||||
|     const int64_t turn_id, const int64_t retry_id, const int64_t file_id, ObBackupPath &path) | ||||
| @ -717,7 +717,7 @@ int ObBackupPathUtil::get_macro_block_backup_path(const share::ObBackupDest &bac | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/log_stream_1/major_data_turn_1_retry_0/macro_range_index.obbak | ||||
| // file:///obbackup/backup_set_1_full/log_stream_1/major_data_turn_1_retry_0/macro_range_index.obbak | ||||
| int ObBackupPathUtil::get_ls_macro_range_index_backup_path(const share::ObBackupDest &backup_set_dest,  | ||||
|     const share::ObLSID &ls_id, const ObBackupDataType &backup_data_type, const int64_t turn_id,  | ||||
|     const int64_t retry_id, ObBackupPath &path) | ||||
| @ -750,7 +750,7 @@ int ObBackupPathUtil::get_ls_macro_range_index_backup_path(const share::ObBackup | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/log_stream_1/major_data_turn_1_retry_0/meta_index.obbak | ||||
| // file:///obbackup/backup_set_1_full/log_stream_1/major_data_turn_1_retry_0/meta_index.obbak | ||||
| int ObBackupPathUtil::get_ls_meta_index_backup_path(const share::ObBackupDest &backup_set_dest,  | ||||
|     const share::ObLSID &ls_id, const ObBackupDataType &backup_data_type, | ||||
|     const int64_t turn_id, const int64_t retry_id, const bool is_sec_meta, ObBackupPath &path) | ||||
| @ -784,7 +784,7 @@ int ObBackupPathUtil::get_ls_meta_index_backup_path(const share::ObBackupDest &b | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/infos/ | ||||
| // file:///obbackup/backup_set_1_full/infos/ | ||||
| int ObBackupPathUtil::get_ls_info_dir_path(const share::ObBackupDest &backup_set_dest, ObBackupPath &backup_path) | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
| @ -892,7 +892,7 @@ int ObBackupPathUtil::get_ls_meta_infos_path(const share::ObBackupDest &backup_s | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/tenant_backup_set_infos.obbak | ||||
| // file:///obbackup/backup_set_1_full/tenant_backup_set_infos.obbak | ||||
| int ObBackupPathUtil::get_tenant_backup_set_infos_path(const share::ObBackupDest &backup_set_dest,  | ||||
|     ObBackupPath &backup_path) | ||||
| { | ||||
| @ -918,7 +918,7 @@ int ObBackupPathUtil::get_tenant_backup_set_infos_path(const share::ObBackupDest | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/single_backup_set_info.obbak | ||||
| // file:///obbackup/backup_set_1_full/single_backup_set_info.obbak | ||||
| int ObBackupPathUtil::get_backup_set_info_path(const share::ObBackupDest &backup_set_dest, | ||||
|     ObBackupPath &backup_path) | ||||
| { | ||||
| @ -944,7 +944,7 @@ int ObBackupPathUtil::get_backup_set_info_path(const share::ObBackupDest &backup | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/infos/diagnose_info.obbak | ||||
| // file:///obbackup/backup_set_1_full/infos/diagnose_info.obbak | ||||
| int ObBackupPathUtil::get_diagnose_info_path(const share::ObBackupDest &backup_set_dest, | ||||
|     ObBackupPath &backup_path) | ||||
| { | ||||
| @ -970,7 +970,7 @@ int ObBackupPathUtil::get_diagnose_info_path(const share::ObBackupDest &backup_t | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/infos/locality_info.obbak | ||||
| // file:///obbackup/backup_set_1_full/infos/locality_info.obbak | ||||
| int ObBackupPathUtil::get_locality_info_path(const share::ObBackupDest &backup_set_dest, | ||||
|     ObBackupPath &backup_path) | ||||
| { | ||||
| @ -996,7 +996,7 @@ int ObBackupPathUtil::get_locality_info_path(const share::ObBackupDest &backup_t | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/log_stream_1/meta_info_turn_1_retry_0/ls_meta_info.obbak | ||||
| // file:///obbackup/backup_set_1_full/log_stream_1/meta_info_turn_1_retry_0/ls_meta_info.obbak | ||||
| int ObBackupPathUtil::get_ls_meta_info_backup_path(const share::ObBackupDest &backup_tenant_dest, | ||||
|     const ObBackupSetDesc &desc, const share::ObLSID &ls_id, const int64_t turn_id,  | ||||
|     const int64_t retry_id, ObBackupPath &backup_path) | ||||
| @ -1014,7 +1014,7 @@ int ObBackupPathUtil::get_ls_meta_info_backup_path(const share::ObBackupDest &ba | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/logstream_1/xxx_xxx_turn_1_retry_0/macro_range_index.obbak | ||||
| // file:///obbackup/backup_set_1_full/logstream_1/xxx_xxx_turn_1_retry_0/macro_range_index.obbak | ||||
| int ObBackupPathUtil::get_tenant_macro_range_index_backup_path(const share::ObBackupDest &backup_set_dest, | ||||
|     const ObBackupDataType &backup_data_type, const int64_t turn_id, const int64_t retry_id, ObBackupPath &path) | ||||
| { | ||||
| @ -1044,7 +1044,7 @@ int ObBackupPathUtil::get_tenant_macro_range_index_backup_path(const share::ObBa | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/logstream_1/xxx_xxx_turn_1_retry_0/meta_index.obbak | ||||
| // file:///obbackup/backup_set_1_full/logstream_1/xxx_xxx_turn_1_retry_0/meta_index.obbak | ||||
| int ObBackupPathUtil::get_tenant_meta_index_backup_path(const share::ObBackupDest &backup_set_dest, | ||||
|     const ObBackupDataType &backup_data_type, const int64_t turn_id, const int64_t retry_id, | ||||
|     const bool is_sec_meta, ObBackupPath &path) | ||||
| @ -1075,7 +1075,7 @@ int ObBackupPathUtil::get_tenant_meta_index_backup_path(const share::ObBackupDes | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file://obbackup/backup_set_1_full_20211231/infos/data_info_turn_1/tablet_log_stream_info.obbak | ||||
| // file://obbackup/backup_set_1_full/infos/data_info_turn_1/tablet_log_stream_info.obbak | ||||
| int ObBackupPathUtil::get_backup_data_tablet_ls_info_path(const share::ObBackupDest &backup_set_dest, | ||||
|     const uint64_t turn_id, ObBackupPath &path) | ||||
| { | ||||
| @ -1103,7 +1103,7 @@ int ObBackupPathUtil::get_deleted_tablet_info_path(const share::ObBackupDest &ba | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/log_stream_1/complement_log/ | ||||
| // file:///obbackup/backup_set_1_full/log_stream_1/complement_log/ | ||||
| int ObBackupPathUtil::get_ls_complement_log_dir_path(const share::ObBackupDest &backup_set_dest,  | ||||
|     const share::ObLSID &ls_id, ObBackupPath &backup_path) | ||||
| { | ||||
| @ -1130,7 +1130,7 @@ int ObBackupPathUtil::get_ls_complement_log_dir_path(const share::ObBackupDest & | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| // file:///obbackup/backup_set_1_full_20211231/log_stream_1/complement_log/1 | ||||
| // file:///obbackup/backup_set_1_full/log_stream_1/complement_log/1 | ||||
| int ObBackupPathUtil::get_ls_complement_log_backup_path(const share::ObBackupDest &backup_set_dest, | ||||
|     const share::ObLSID &ls_id, const int64_t file_id, ObBackupPath &path) | ||||
| { | ||||
|  | ||||
| @ -112,7 +112,7 @@ struct ObBackupPathUtil | ||||
|   static int get_ls_backup_dir_path(const share::ObBackupDest &backup_set_dest, | ||||
|        const share::ObBackupSetDesc &desc, const share::ObLSID &ls_id, share::ObBackupPath &backup_path); | ||||
|  | ||||
|   // file:///obbackup/backup_set_1_full_20211231/log_stream_1/meta_info_turn_1/tablet_info.obbak | ||||
|   // file:///obbackup/backup_set_1_full/log_stream_1/meta_info_turn_1/tablet_info.obbak | ||||
|   static int get_ls_data_tablet_info_path(const share::ObBackupDest &backup_set_dest, | ||||
|       const share::ObLSID &ls_id, const int64_t turn_id, const int64_t retry_id, | ||||
|       share::ObBackupPath &backup_path); | ||||
| @ -191,7 +191,7 @@ struct ObBackupPathUtil | ||||
|   static int get_tenant_backup_set_infos_path(const share::ObBackupDest &backup_tenant_dest, | ||||
|       const share::ObBackupSetDesc &desc, share::ObBackupPath &backup_path);   | ||||
|  | ||||
|  // file:///obbackup/backup_set_1_full_20211231/single_backup_set_info.obbak | ||||
|  // file:///obbackup/backup_set_1_full/single_backup_set_info.obbak | ||||
|   static int get_backup_set_info_path(const share::ObBackupDest &backup_set_dest, | ||||
|       share::ObBackupPath &backup_path);   | ||||
|  | ||||
| @ -212,12 +212,12 @@ struct ObBackupPathUtil | ||||
|   static int get_locality_info_path(const share::ObBackupDest &backup_tenant_dest, | ||||
|       share::ObBackupSetDesc &desc, share::ObBackupPath &backup_path);   | ||||
|  | ||||
|   // file:///obbackup/backup_set_1_full_20211231/log_stream_1/meta_info_turn_1_retry_0/ls_meta_info.obbak | ||||
|   // file:///obbackup/backup_set_1_full/log_stream_1/meta_info_turn_1_retry_0/ls_meta_info.obbak | ||||
|   static int get_ls_meta_info_backup_path(const share::ObBackupDest &backup_tenant_dest, | ||||
|       const share::ObBackupSetDesc &desc, const share::ObLSID &ls_id, const int64_t turn_id, | ||||
|       const int64_t retry_id, share::ObBackupPath &backup_path); | ||||
|  | ||||
|   // file:///obbackup/backup_set_1_full_20211231/logstream_1/xxx_xxx_turn_1_retry_0/macro_range_index.obbak | ||||
|   // file:///obbackup/backup_set_1_full/logstream_1/xxx_xxx_turn_1_retry_0/macro_range_index.obbak | ||||
|   static int get_tenant_macro_range_index_backup_path(const share::ObBackupDest &backup_set_dest, | ||||
|       const share::ObBackupDataType &backup_data_type, const int64_t turn_id, const int64_t retry_id, | ||||
|       share::ObBackupPath &backup_path); | ||||
| @ -226,7 +226,7 @@ struct ObBackupPathUtil | ||||
|       const share::ObBackupSetDesc &desc, const share::ObBackupDataType &backup_data_type, const int64_t turn_id, | ||||
|       const int64_t retry_id, share::ObBackupPath &backup_path); | ||||
|  | ||||
|   // file:///obbackup/backup_set_1_full_20211231/logstream_1/xxx_xxx_turn_1_retry_0/meta_index.obbak | ||||
|   // file:///obbackup/backup_set_1_full/logstream_1/xxx_xxx_turn_1_retry_0/meta_index.obbak | ||||
|   static int get_tenant_meta_index_backup_path(const share::ObBackupDest &backup_set_dest, | ||||
|       const share::ObBackupDataType &backup_data_type, const int64_t turn_id, const int64_t retry_id, | ||||
|       const bool is_sec_meta, share::ObBackupPath &backup_path); | ||||
| @ -235,7 +235,7 @@ struct ObBackupPathUtil | ||||
|       const share::ObBackupSetDesc &desc, const share::ObBackupDataType &backup_data_type, const int64_t turn_id, | ||||
|       const int64_t retry_id, const bool is_sec_meta, share::ObBackupPath &backup_path); | ||||
|  | ||||
|   // file://obbackup/backup_set_1_full_20211231/infos/data_info_turn_1/tablet_log_stream_info.obbak | ||||
|   // file://obbackup/backup_set_1_full/infos/data_info_turn_1/tablet_log_stream_info.obbak | ||||
|   static int get_backup_data_tablet_ls_info_path(const share::ObBackupDest &backup_set_dest, | ||||
|       const uint64_t turn_id, share::ObBackupPath &path); | ||||
|  | ||||
|  | ||||
| @ -588,7 +588,11 @@ int ObLSBackupCleanTask::do_ls_task() | ||||
| int ObLSBackupCleanTask::delete_backup_piece_ls_files_(const ObBackupPath &path) | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   if (OB_FAIL(ObBackupCleanUtil::delete_backup_dir_files(path, backup_dest_.get_storage_info()))) { | ||||
|   if (OB_FAIL(delete_piece_log_files_(path))) { | ||||
|     LOG_WARN("failed to delete log files", K(ret), K(path)); | ||||
|   } else if (OB_FAIL(delete_piece_ls_meta_files_(path))) { | ||||
|     LOG_WARN("failed to delete piece ls meta files", K(ret), K(path)); | ||||
|   } else if (OB_FAIL(ObBackupCleanUtil::delete_backup_dir_files(path, backup_dest_.get_storage_info()))) { | ||||
|     LOG_WARN("failed to delete backup log stream dir files", K(ret), K(path)); | ||||
|   } | ||||
|   return ret; | ||||
| @ -601,9 +605,9 @@ int ObLSBackupCleanTask::delete_complement_log_(const ObBackupPath &path) | ||||
|   if (OB_FAIL(complement_path.init(path.get_ptr()))) { | ||||
|     LOG_WARN("failed to init complement log path", K(ret), K(path)); | ||||
|   } else if (OB_FAIL(complement_path.join("complement_log", ObBackupFileSuffix::NONE))) { | ||||
|     LOG_WARN("failed to join complement log", K(ret), K(path)); | ||||
|   } else if (OB_FAIL(ObBackupCleanUtil::delete_backup_dir_files(path, backup_dest_.get_storage_info()))) { | ||||
|     LOG_WARN("failed to delete backup log stream dir files", K(ret), K(path)); | ||||
|     LOG_WARN("failed to join complement log", K(ret), K(complement_path)); | ||||
|   } else if (OB_FAIL(ObBackupCleanUtil::delete_backup_dir_files(complement_path, backup_dest_.get_storage_info()))) { | ||||
|     LOG_WARN("failed to delete backup log stream dir files", K(ret), K(complement_path)); | ||||
|   } else { | ||||
|     LOG_INFO("[BACKUP_CLEAN]success delete complement log", K(complement_path));  | ||||
|   }  | ||||
| @ -813,6 +817,52 @@ int ObLSBackupCleanTask::get_set_ls_path_(ObBackupPath &path) | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| int ObLSBackupCleanTask::delete_piece_log_files_(const ObBackupPath &path) | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   ObBackupPath log_path; | ||||
|   if (OB_FAIL(log_path.init(path.get_ptr()))) { | ||||
|     LOG_WARN("failed to init piece log path", K(ret), K(path)); | ||||
|   } else if (OB_FAIL(log_path.join("log", ObBackupFileSuffix::NONE))) { | ||||
|     LOG_WARN("failed to join log", K(ret), K(log_path)); | ||||
|   } else if (OB_FAIL(ObBackupCleanUtil::delete_backup_dir_files(log_path, backup_dest_.get_storage_info()))) { | ||||
|     LOG_WARN("failed to delete backup log stream dir files", K(ret), K(path)); | ||||
|   } else { | ||||
|     LOG_INFO("[BACKUP_CLEAN]success delete log files", K(log_path)); | ||||
|   } | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| int ObLSBackupCleanTask::delete_piece_ls_meta_files_(const ObBackupPath &path) | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|   ObBackupPath meta_path; | ||||
|   ObArchiveLSMetaType meta_type; | ||||
|   do { | ||||
|     meta_path.reset(); | ||||
|     if (OB_FAIL(meta_type.get_next_type())) { | ||||
|       if (OB_ITER_END == ret) { | ||||
|         ret = OB_SUCCESS; | ||||
|         break; | ||||
|       } else { | ||||
|         LOG_WARN("failed to get next type", K(ret), K(meta_type)); | ||||
|       } | ||||
|     } else if (!meta_type.is_valid()) { | ||||
|       ret = OB_ERR_UNEXPECTED; | ||||
|       LOG_WARN("meta type is invalid", K(ret), K(meta_type)); | ||||
|     } else if (OB_FAIL(meta_path.init(path.get_ptr()))) { | ||||
|       LOG_WARN("failed to init complement log path", K(ret), K(path)); | ||||
|     } else if (OB_FAIL(meta_path.join(meta_type.get_type_str(), ObBackupFileSuffix::NONE))) { | ||||
|       LOG_WARN("failed to join meta type", K(ret), K(path)); | ||||
|     } else if (OB_FAIL(ObBackupCleanUtil::delete_backup_dir_files(meta_path, backup_dest_.get_storage_info()))) { | ||||
|       LOG_WARN("failed to delete backup log stream dir files", K(ret), K(meta_path)); | ||||
|     } else { | ||||
|       LOG_INFO("[BACKUP_CLEAN]success delete meta files", K(meta_path)); | ||||
|     } | ||||
|   } while (OB_SUCC(ret)); | ||||
|   return ret; | ||||
| } | ||||
|  | ||||
| int ObLSBackupCleanTask::get_piece_ls_path(ObBackupPath &path) | ||||
| { | ||||
|   int ret = OB_SUCCESS; | ||||
|  | ||||
| @ -128,6 +128,8 @@ protected: | ||||
|   int delete_backup_set_ls_files_(const share::ObBackupPath &path);  | ||||
|   int get_set_ls_path_(share::ObBackupPath &path); | ||||
|   int get_piece_ls_path(share::ObBackupPath &path); | ||||
|   int delete_piece_ls_meta_files_(const share::ObBackupPath &path); | ||||
|   int delete_piece_log_files_(const share::ObBackupPath &path); | ||||
|   int delete_complement_log_(const share::ObBackupPath &path); | ||||
|   int delete_sys_data_(const share::ObBackupPath &path); | ||||
|   int delete_major_data_(const share::ObBackupPath &path); | ||||
|  | ||||
| @ -219,19 +219,19 @@ TEST_F(TestLogStreamBackup, test_backup_path) | ||||
|   ObBackupPath path; | ||||
|   const char *root_path = "file:///obbackup"; | ||||
|  | ||||
|   const char *expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full_20211231"; | ||||
|   const char *expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full"; | ||||
|   ret = ObBackupPathUtil::get_backup_set_dir_path(root_path, tenant_id_, backup_set_desc_, path); | ||||
|   ASSERT_EQ(OB_SUCCESS, ret); | ||||
|   LOG_INFO("dump path", K(path), K(expect_path)); | ||||
|   ASSERT_EQ(0, path.get_obstr().compare(expect_path)); | ||||
|  | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full_20211231/logstream_1"; | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full/logstream_1"; | ||||
|   ret = ObBackupPathUtil::get_ls_backup_dir_path(root_path, tenant_id_, backup_set_desc_, ls_id_, path); | ||||
|   ASSERT_EQ(OB_SUCCESS, ret); | ||||
|   LOG_INFO("dump path", K(path), K(expect_path)); | ||||
|   ASSERT_EQ(0, path.get_obstr().compare(expect_path)); | ||||
|  | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full_20211231/logstream_1/" | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full/logstream_1/" | ||||
|                 "major_data_turn_1_retry_0"; | ||||
|   ret = ObBackupPathUtil::get_ls_backup_data_dir_path( | ||||
|       root_path, tenant_id_, backup_set_desc_, ls_id_, backup_data_type_, turn_id_, retry_id_, path); | ||||
| @ -239,7 +239,7 @@ TEST_F(TestLogStreamBackup, test_backup_path) | ||||
|   LOG_INFO("dump path", K(path), K(expect_path)); | ||||
|   ASSERT_EQ(0, path.get_obstr().compare(expect_path)); | ||||
|  | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full_20211231/logstream_1/" | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full/logstream_1/" | ||||
|                 "major_data_turn_1_retry_0/macro_block_data.0"; | ||||
|   ret = ObBackupPathUtil::get_macro_block_backup_path( | ||||
|       root_path, tenant_id_, backup_set_desc_, ls_id_, backup_data_type_, turn_id_, retry_id_, file_id_, path); | ||||
| @ -247,7 +247,7 @@ TEST_F(TestLogStreamBackup, test_backup_path) | ||||
|   LOG_INFO("dump path", K(path), K(expect_path)); | ||||
|   ASSERT_EQ(0, path.get_obstr().compare(expect_path)); | ||||
|  | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full_20211231/logstream_1/" | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full/logstream_1/" | ||||
|                 "major_data_turn_1_retry_0/macro_range_index"; | ||||
|   ret = ObBackupPathUtil::get_ls_macro_range_index_backup_path( | ||||
|       root_path, tenant_id_, backup_set_desc_, ls_id_, backup_data_type_, turn_id_, retry_id_, path); | ||||
| @ -255,7 +255,7 @@ TEST_F(TestLogStreamBackup, test_backup_path) | ||||
|   LOG_INFO("dump path", K(path), K(expect_path)); | ||||
|   ASSERT_EQ(0, path.get_obstr().compare(expect_path)); | ||||
|  | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full_20211231/logstream_1/" | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full/logstream_1/" | ||||
|                 "major_data_turn_1_retry_0/meta_index"; | ||||
|   ret = ObBackupPathUtil::get_ls_meta_index_backup_path( | ||||
|       root_path, tenant_id_, backup_set_desc_, ls_id_, backup_data_type_, turn_id_, retry_id_, path); | ||||
| @ -263,13 +263,13 @@ TEST_F(TestLogStreamBackup, test_backup_path) | ||||
|   LOG_INFO("dump path", K(path), K(expect_path)); | ||||
|   ASSERT_EQ(0, path.get_obstr().compare(expect_path)); | ||||
|  | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full_20211231/infos/ls_meta_info"; | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full/infos/ls_meta_info"; | ||||
|   ret = ObBackupPathUtil::get_ls_meta_info_backup_path(root_path, tenant_id_, backup_set_desc_, path); | ||||
|   ASSERT_EQ(OB_SUCCESS, ret); | ||||
|   LOG_INFO("dump path", K(path), K(expect_path)); | ||||
|   ASSERT_EQ(0, path.get_obstr().compare(expect_path)); | ||||
|  | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full_20211231/infos/info_turn_1/" | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full/infos/info_turn_1/" | ||||
|                 "tenant_major_data_macro_range_index"; | ||||
|   ret = ObBackupPathUtil::get_tenant_macro_range_index_backup_path( | ||||
|       root_path, tenant_id_, backup_set_desc_, backup_data_type_, turn_id_, path); | ||||
| @ -277,7 +277,7 @@ TEST_F(TestLogStreamBackup, test_backup_path) | ||||
|   LOG_INFO("dump path", K(path), K(expect_path)); | ||||
|   ASSERT_EQ(0, path.get_obstr().compare(expect_path)); | ||||
|  | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full_20211231/infos/info_turn_1/" | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full/infos/info_turn_1/" | ||||
|                 "tenant_major_data_meta_index"; | ||||
|   ret = ObBackupPathUtil::get_tenant_meta_index_backup_path( | ||||
|       root_path, tenant_id_, backup_set_desc_, backup_data_type_, turn_id_, path); | ||||
| @ -285,7 +285,7 @@ TEST_F(TestLogStreamBackup, test_backup_path) | ||||
|   LOG_INFO("dump path", K(path), K(expect_path)); | ||||
|   ASSERT_EQ(0, path.get_obstr().compare(expect_path)); | ||||
|  | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full_20211231/logstream_1/complement_log/0"; | ||||
|   expect_path = "file:///obbackup/tenant_1_incarnation_1/data/backup_set_1_full/logstream_1/complement_log/0"; | ||||
|   ret = ObBackupPathUtil::get_ls_complement_log_backup_path( | ||||
|       root_path, tenant_id_, backup_set_desc_, ls_id_, file_id_, path); | ||||
|   ASSERT_EQ(OB_SUCCESS, ret); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 WenJinyu
					WenJinyu