backup in 4.1 and restore to 4.2
This commit is contained in:
@ -584,7 +584,7 @@ int ObBackupDataScheduler::start_tenant_backup_data_(const ObBackupJobAttr &job_
|
||||
LOG_WARN("[DATA_BACKUP]failed to get next job id", K(ret));
|
||||
} else if (OB_FAIL(get_next_backup_set_id(trans, new_job_attr.tenant_id_, new_job_attr.backup_set_id_))) {
|
||||
LOG_WARN("[DATA_BACKUP]failed to get next backup set id", K(ret));
|
||||
} else if (OB_FAIL(update_backup_type_(trans, new_job_attr.tenant_id_, new_job_attr.backup_set_id_,
|
||||
} else if (OB_FAIL(update_backup_type_if_need_(trans, new_job_attr.tenant_id_, new_job_attr.backup_set_id_,
|
||||
new_job_attr.backup_path_, new_job_attr.backup_type_))) {
|
||||
LOG_WARN("[DATA_BACKUP]failed to update backup type", K(ret), K(new_job_attr));
|
||||
} else if (OB_FAIL(new_job_attr.executor_tenant_id_.push_back(new_job_attr.tenant_id_))) {
|
||||
@ -763,7 +763,7 @@ int ObBackupDataScheduler::get_next_backup_set_id(common::ObISQLClient &trans, c
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObBackupDataScheduler::update_backup_type_(common::ObISQLClient &trans, const uint64_t tenant_id,
|
||||
int ObBackupDataScheduler::update_backup_type_if_need_(common::ObISQLClient &trans, const uint64_t tenant_id,
|
||||
const int64_t backup_set_id, const share::ObBackupPathString &backup_path, share::ObBackupType &backup_type)
|
||||
{
|
||||
// if backup type is inc backup but no prev backup set id.
|
||||
@ -771,6 +771,8 @@ int ObBackupDataScheduler::update_backup_type_(common::ObISQLClient &trans, cons
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t prev_full_backup_set_id = -1;
|
||||
int64_t pre_inc_backup_set_id = -1;
|
||||
ObBackupSetFileDesc pre_backup_set_desc;
|
||||
uint64_t data_version = 0;
|
||||
if (OB_FAIL(ObBackupSetFileOperator::get_prev_backup_set_id(
|
||||
trans, tenant_id, backup_set_id, backup_type, backup_path, prev_full_backup_set_id, pre_inc_backup_set_id))) {
|
||||
if (OB_ENTRY_NOT_EXIST == ret && backup_type.is_inc_backup()) {
|
||||
@ -779,6 +781,32 @@ int ObBackupDataScheduler::update_backup_type_(common::ObISQLClient &trans, cons
|
||||
} else {
|
||||
LOG_WARN("fail to get prev backup set id", K(ret), K(tenant_id), K(backup_set_id));
|
||||
}
|
||||
} else if (backup_type.is_full_backup()) {// full backup no need to check prev backup set's compatible
|
||||
} else if (OB_FAIL(ObBackupSetFileOperator::get_one_backup_set_file(trans, false, pre_inc_backup_set_id, 1, tenant_id, pre_backup_set_desc))) {
|
||||
LOG_WARN("failed to get one backup set file", K(ret), K(pre_inc_backup_set_id), K(tenant_id));
|
||||
} else if (OB_FAIL(ObShareUtil::fetch_current_data_version(trans, tenant_id, data_version))) {
|
||||
LOG_WARN("failed to get data version", K(ret), K(tenant_id));
|
||||
} else if (data_version != pre_backup_set_desc.tenant_compatible_) {
|
||||
ret = OB_BACKUP_CAN_NOT_START;
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
const int64_t USER_ERROR_MSG_LEN = 128;
|
||||
char pre_compatible_buf[OB_INNER_TABLE_BACKUP_TASK_CLUSTER_FORMAT_LENGTH] = "";
|
||||
char cur_compatible_buf[OB_INNER_TABLE_BACKUP_TASK_CLUSTER_FORMAT_LENGTH] = "";
|
||||
char user_error_msg_buf[USER_ERROR_MSG_LEN] = "";
|
||||
int64_t pos = ObClusterVersion::get_instance().print_version_str(
|
||||
pre_compatible_buf, OB_INNER_TABLE_BACKUP_TASK_CLUSTER_FORMAT_LENGTH, pre_backup_set_desc.tenant_compatible_);
|
||||
pos = ObClusterVersion::get_instance().print_version_str(
|
||||
cur_compatible_buf, OB_INNER_TABLE_BACKUP_TASK_CLUSTER_FORMAT_LENGTH, data_version);
|
||||
if (OB_TMP_FAIL(databuff_printf(user_error_msg_buf, USER_ERROR_MSG_LEN,
|
||||
"cross compatible incremental backup is not supported, "
|
||||
"previous backup set compatible is %.*s, current compatible is %.*s",
|
||||
static_cast<int>(OB_INNER_TABLE_BACKUP_TASK_CLUSTER_FORMAT_LENGTH), pre_compatible_buf,
|
||||
static_cast<int>(OB_INNER_TABLE_BACKUP_TASK_CLUSTER_FORMAT_LENGTH), cur_compatible_buf))) {
|
||||
LOG_WARN("failed to databuff printf", K(ret), K(tmp_ret));
|
||||
}
|
||||
LOG_USER_ERROR(OB_BACKUP_CAN_NOT_START, user_error_msg_buf);
|
||||
LOG_WARN("pre backup set's tenant compatible does not match, backup can't start",
|
||||
K(ret), K(tenant_id), K(data_version), K(pre_backup_set_desc));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user