[UPGRADE] Forbid restoring tenant with unsupported data version

This commit is contained in:
tino247
2024-04-01 15:15:20 +00:00
committed by ob-robot
parent dd363f0336
commit 1c6016f108
3 changed files with 13 additions and 0 deletions

View File

@ -809,6 +809,11 @@ int ObRestoreUtil::check_backup_set_version_match_(share::ObBackupSetFileDesc &b
ret = OB_OP_NOT_ALLOW;
LOG_WARN("restore from version 4.0 is not allowd", K(ret), K(backup_file_desc.tenant_compatible_), K(data_version));
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "restore from version 4.0 is");
} else if (!ObUpgradeChecker::check_data_version_valid_for_backup(backup_file_desc.tenant_compatible_)) {
ret = OB_OP_NOT_ALLOW;
LOG_WARN("restore from backup with unsupported data version",
KR(ret), K(backup_file_desc.tenant_compatible_), K(data_version));
LOG_USER_ERROR(OB_OP_NOT_ALLOW, "restore from backup with unsupported data version is");
}
return ret;
}

View File

@ -99,6 +99,13 @@ bool ObUpgradeChecker::check_data_version_exist(
return bret;
}
// TODO: should correspond to upgrade YML file.
// For now, just consider the valid upgrade path for 4.x .
bool ObUpgradeChecker::check_data_version_valid_for_backup(const uint64_t data_version)
{
return DATA_VERSION_4_3_0_0 <= data_version;
}
//FIXME:(yanmu.ztl) cluster version should be discrete.
bool ObUpgradeChecker::check_cluster_version_exist(
const uint64_t version)

View File

@ -168,6 +168,7 @@ class ObUpgradeChecker
{
public:
static bool check_data_version_exist(const uint64_t version);
static bool check_data_version_valid_for_backup(const uint64_t data_version);
static bool check_cluster_version_exist(const uint64_t version);
static int get_data_version_by_cluster_version(
const uint64_t cluster_version,