Add subdir under logstream_N archive path

This commit is contained in:
obdev
2023-02-24 15:12:49 +00:00
committed by ob-robot
parent 8e6297fb78
commit 6fa2805ce9
4 changed files with 37 additions and 18 deletions

View File

@ -545,7 +545,7 @@ int ObArchiveSender::do_compensate_piece_(const ObLSID &id,
{
int ret = OB_SUCCESS;
share::ObBackupPath prefix;
if (OB_FAIL(share::ObArchivePathUtil::get_piece_ls_dir_path(backup_dest, station.get_round().dest_id_,
if (OB_FAIL(share::ObArchivePathUtil::get_piece_ls_log_dir_path(backup_dest, station.get_round().dest_id_,
station.get_round().round_, next_piece_id, id, prefix))) {
ARCHIVE_LOG(WARN, "get piece ls dir path failed", K(ret), K(id), K(next_piece_id), K(station));
} else {
@ -665,7 +665,7 @@ int ObArchiveSender::build_archive_prefix_if_needed_(const ObLSID &id,
share::ObBackupPath prefix;
if (pre_piece.is_valid() && pre_piece == cur_piece && piece_dir_exist) {
// just skip
} else if (OB_FAIL(share::ObArchivePathUtil::get_piece_ls_dir_path(backup_dest, station.get_round().dest_id_,
} else if (OB_FAIL(share::ObArchivePathUtil::get_piece_ls_log_dir_path(backup_dest, station.get_round().dest_id_,
station.get_round().round_, cur_piece.get_piece_id(), id, prefix))) {
ARCHIVE_LOG(WARN, "get piece ls dir path failed", K(ret), K(id),
K(cur_piece), K(station), K(backup_dest));

View File

@ -37,6 +37,8 @@ int ObArchivePathUtil::build_restore_prefix(const char *base,
ARCHIVE_LOG(WARN, "init prefix failed", K(ret), K(base));
} else if (OB_FAIL(prefix.join_ls(id))) {
ARCHIVE_LOG(WARN, "join ls failed", K(ret), K(id));
} else if (OB_FAIL(prefix.join("log", ObBackupFileSuffix::NONE))) {
ARCHIVE_LOG(WARN, "join log failed", K(ret), K(id));
} else {
ARCHIVE_LOG(INFO, "build restore prefix succ", K(prefix));
}
@ -50,14 +52,12 @@ int ObArchivePathUtil::build_restore_path(const char *base,
{
int ret = OB_SUCCESS;
path.reset();
if (OB_FAIL(path.init(base))) {
ARCHIVE_LOG(WARN, "init prefix failed", K(ret), K(base));
} else if (OB_FAIL(path.join_ls(id))) {
ARCHIVE_LOG(WARN, "join ls failed", K(ret), K(id));
if (OB_FAIL(build_restore_prefix(base, id, path))) {
ARCHIVE_LOG(WARN, "build restore prefix failed", K(ret), K(id), K(base));
} else if (OB_FAIL(path.join(file_id, ObBackupFileSuffix::ARCHIVE))) {
ARCHIVE_LOG(WARN, "join file_id failed", K(ret), K(id), K(file_id));
} else {
ARCHIVE_LOG(INFO, "build restore prefix succ", K(path));
ARCHIVE_LOG(INFO, "build restore path succ", K(path));
}
return ret;
}
@ -248,8 +248,8 @@ int ObArchivePathUtil::get_piece_inner_placeholder_file_path(const ObBackupDest
return ret;
}
// oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[ls_id]
int ObArchivePathUtil::get_piece_ls_dir_path(const ObBackupDest &dest, const int64_t dest_id,
// oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[ls_id]/
int ObArchivePathUtil::get_piece_ls_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)
{
int ret = OB_SUCCESS;
@ -264,12 +264,25 @@ int ObArchivePathUtil::get_piece_ls_dir_path(const ObBackupDest &dest, const int
return ret;
}
// oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[ls_id]/log/
int ObArchivePathUtil::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)
{
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("log", ObBackupFileSuffix::NONE))) {
LOG_WARN("failed to join log ", K(ret), K(path));
}
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,
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))) {
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))) {
LOG_WARN("failed to join ls file info ", K(ret), K(path));
@ -303,12 +316,12 @@ int ObArchivePathUtil::get_tenant_archive_piece_infos_file_path(const ObBackupDe
return ret;
}
// oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[%ld]/[file_id]
// oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[%ld]/log/[file_id]
int ObArchivePathUtil::get_ls_archive_file_path(const ObBackupDest &dest, const int64_t dest_id,
const int64_t round_id, const int64_t piece_id, const share::ObLSID &ls_id, const int64_t file_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))) {
if (OB_FAIL(get_piece_ls_log_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), K(file_id));
} else if (OB_FAIL(path.join(file_id, ObBackupFileSuffix::ARCHIVE))) {
LOG_WARN("failed to join file id", K(ret), K(path), K(file_id));
@ -324,7 +337,7 @@ int ObArchivePathUtil::get_ls_meta_record_prefix(const ObBackupDest &dest, const
{
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))) {
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))) {
LOG_WARN("failed to join meta_type", K(ret), K(prefix));

View File

@ -80,8 +80,8 @@ public:
const int64_t round_id, const int64_t piece_id, const SCN &start_scn,
const SCN &end_scn, ObBackupPath &path);
// oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[ls_id]
static int get_piece_ls_dir_path(const ObBackupDest &dest, const int64_t dest_id,
// oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[ls_id]/log/
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
@ -96,7 +96,7 @@ public:
static int 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);
// oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[%ld]/[file_id].obarc
// oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[%ld]/log/[file_id].obarc
static int get_ls_archive_file_path(const ObBackupDest &dest, const int64_t dest_id,
const int64_t round_id, const int64_t piece_id, const share::ObLSID &ls_id, const int64_t file_id, ObBackupPath &path);
@ -109,6 +109,12 @@ public:
static int get_ls_meta_record_path(const ObBackupDest &dest, const int64_t dest_id,
const int64_t round_id, const int64_t piece_id, const share::ObLSID &ls_id,
const ObArchiveLSMetaType &meta_type, const int64_t file_id, ObBackupPath &path);
private:
// oss://archive/piece_d[dest_id]r[round_id]p[piece_id]/logstream_[ls_id]/
static int get_piece_ls_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);
private:
static const char * const ROUNDS_DIR_PATH;

View File

@ -1340,7 +1340,7 @@ int ObArchiveStore::get_file_range_in_piece(const int64_t dest_id, const int64_t
if (!is_init()) {
ret = OB_NOT_INIT;
LOG_WARN("ObArchiveStore not init", K(ret));
} else if (OB_FAIL(ObArchivePathUtil::get_piece_ls_dir_path(dest, dest_id, round_id, piece_id, ls_id, piece_path))) {
} else if (OB_FAIL(ObArchivePathUtil::get_piece_ls_log_dir_path(dest, dest_id, round_id, piece_id, ls_id, piece_path))) {
LOG_WARN("get piece ls dir path failed", K(ret), K(dest), K(dest_id), K(round_id), K(piece_id), K(ls_id));
} else if (OB_FAIL(op.init(this))) {
LOG_WARN("ObPieceFileListFilter init failed", K(ret));
@ -1372,7 +1372,7 @@ int ObArchiveStore:: get_file_list_in_piece(const int64_t dest_id, const int64_t
if (!is_init()) {
ret = OB_NOT_INIT;
LOG_WARN("ObArchiveStore not init", K(ret));
} else if (OB_FAIL(ObArchivePathUtil::get_piece_ls_dir_path(dest, dest_id, round_id, piece_id, ls_id, piece_path))) {
} else if (OB_FAIL(ObArchivePathUtil::get_piece_ls_log_dir_path(dest, dest_id, round_id, piece_id, ls_id, piece_path))) {
LOG_WARN("get piece ls dir path failed", K(ret), K(dest), K(dest_id), K(round_id), K(piece_id), K(ls_id));
} else if (OB_FAIL(op.init(this, &filelist))) {
LOG_WARN("ObLSFileListOp init failed", K(ret));