提交 723d5dd8 编写于 作者: O obdev 提交者: wangzelin.wzl

[CP] [BUGFIX] Use backuped frozen status to restore system tables

上级 2305711c
......@@ -13967,6 +13967,7 @@ int ObDDLService::do_create_tenant_partitions(const ObCreateTenantArg &arg,
int64_t non_paxos_replica_num = 0;
int64_t restore = REPLICA_NOT_RESTORE;
int64_t table_id = copy.get_table_id();
share::ObSimpleFrozenStatus new_frozen_status = frozen_status;
if (OB_FAIL(ret)) {
} else if (is_restore) { // physical restore
create_mode = OB_CREATE_TABLE_MODE_PHYSICAL_RESTORE;
......@@ -13977,6 +13978,12 @@ int ObDDLService::do_create_tenant_partitions(const ObCreateTenantArg &arg,
int hash_ret = restore_partition_map.get_refactored(extract_pure_id(table_id), status);
if (OB_SUCCESS == hash_ret) {
restore = status;
// For system tables in physical restore:
// 1. REPLICA_RESTORE_DATA: frozen_status will be overwrite by storage, so it's unuseful.
// 2. REPLICA_RESTORE_ARCHIVE_DATA: frozen_version will be overwrite so it's unuseful, but
// frozen_timestamp should come from backup info to filter clog.
// 3. REPLICA_NOT_RESTORE: frozen_status should come from restore cluster.
new_frozen_status = arg.restore_frozen_status_;
} else if (OB_HASH_NOT_EXIST == hash_ret) {
// create sys table in tenant space which were not backuped in lower version.
restore = REPLICA_NOT_RESTORE;
......@@ -14008,7 +14015,7 @@ int ObDDLService::do_create_tenant_partitions(const ObCreateTenantArg &arg,
is_standby,
create_mode,
restore,
frozen_status))) {
new_frozen_status))) {
LOG_WARN("fail to create partitions", K(ret));
} else {
} // no more to do
......@@ -380,6 +380,8 @@ int ObRestoreScheduler::fill_create_tenant_arg(const ObPhysicalRestoreJob &job,
arg.tenant_schema_.set_compatibility_mode(mode);
arg.if_not_exist_ = false;
arg.is_restore_ = true;
arg.restore_frozen_status_.frozen_version_ = job.restore_data_version_;
arg.restore_frozen_status_.frozen_timestamp_ = job.frozen_snapshot_version_;
if (OB_FAIL(assign_pool_list(job.pool_list_, arg.pool_list_))) {
LOG_WARN("fail to get pool list", K(ret), K(job));
}
......
......@@ -481,6 +481,7 @@ int ObCreateTenantArg::assign(const ObCreateTenantArg& other)
if_not_exist_ = other.if_not_exist_;
name_case_mode_ = other.name_case_mode_;
is_restore_ = other.is_restore_;
restore_frozen_status_ = other.restore_frozen_status_;
}
return ret;
}
......@@ -495,12 +496,13 @@ DEF_TO_STRING(ObCreateTenantArg)
K_(name_case_mode),
K_(is_restore),
K_(restore_pkeys),
K_(restore_log_pkeys));
K_(restore_log_pkeys),
K_(restore_frozen_status));
return pos;
}
OB_SERIALIZE_MEMBER((ObCreateTenantArg, ObDDLArg), tenant_schema_, pool_list_, if_not_exist_, sys_var_list_,
name_case_mode_, is_restore_, restore_pkeys_, restore_log_pkeys_);
name_case_mode_, is_restore_, restore_pkeys_, restore_log_pkeys_, restore_frozen_status_);
bool ObCreateTenantEndArg::is_valid() const
{
......
......@@ -526,7 +526,8 @@ public:
if_not_exist_(false),
sys_var_list_(),
name_case_mode_(common::OB_NAME_CASE_INVALID),
is_restore_(false)
is_restore_(false),
restore_frozen_status_()
{}
virtual ~ObCreateTenantArg(){};
bool is_valid() const;
......@@ -544,6 +545,7 @@ public:
// is_restore = REPLICA_RESTORE_DATA
common::ObSArray<ObPartitionKey> restore_log_pkeys_; // For physical restore, partitions that should be created with
// is_restore = REPLICA_RESTORE_ARCHIVE_DATA
share::ObSimpleFrozenStatus restore_frozen_status_;
};
struct ObCreateTenantEndArg : public ObDDLArg {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册