[UPGRADE] Upgrade cluster_version/data_version to 4.2.0.0

This commit is contained in:
tino247 2023-04-18 03:44:59 +00:00 committed by ob-robot
parent 167d4b9724
commit 9a57e64e56
13 changed files with 159 additions and 157 deletions

View File

@ -4,7 +4,7 @@ include(cmake/Utils.cmake)
include(cmake/Env.cmake)
project("OceanBase_CE"
VERSION 4.1.0.0
VERSION 4.2.0.0
DESCRIPTION "OceanBase distributed database system"
HOMEPAGE_URL "https://open.oceanbase.com/"
LANGUAGES CXX C ASM)

View File

@ -1,4 +1,4 @@
Name: %NAME
Version:4.1.0.0
Version:4.2.0.0
Release: %RELEASE
BuildRequires: binutils = 2.30

View File

@ -569,10 +569,9 @@ int ObRestoreUtil::check_backup_set_version_match_(share::ObBackupSetFileDesc &b
if (!backup_file_desc.is_valid()) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(backup_file_desc));
} else if (CLUSTER_VERSION_4_0_0_0 > backup_file_desc.cluster_version_
|| CLUSTER_VERSION_4_1_0_0 < backup_file_desc.cluster_version_) { // TODO(chongrong.th) wait yanmu provide the check cluster version exist interface
} else if (!ObUpgradeChecker::check_cluster_version_exist(backup_file_desc.cluster_version_)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("data version are not exist", K(ret));
LOG_WARN("cluster version are not exist", K(ret));
LOG_USER_ERROR(OB_INVALID_ARGUMENT, "cluster version of backup set");
} else if (!ObUpgradeChecker::check_data_version_exist(backup_file_desc.tenant_compatible_)) {
ret = OB_INVALID_ARGUMENT;
@ -794,4 +793,4 @@ int ObRestoreUtil::check_physical_restore_finish(
}
}
return ret;
}
}

View File

@ -282,11 +282,9 @@ int ObClusterVersion::get_tenant_data_version(
if (tenant_config.is_valid() && tenant_config->compatible.value_updated()) {
data_version = tenant_config->compatible;
} else if (is_sys_tenant(tenant_id)
|| is_meta_tenant(tenant_id)
|| get_cluster_version() <= CLUSTER_VERSION_4_1_0_0) {
// 1. For sys/meta tenant, circular dependency problem may exist when load tenant config from inner tables.
// For safety, data_version will fallback to last barrier data version until actual tenant config is loaded.
// 2. To compatible with upgrade path from 4.0 to 4.1
|| is_meta_tenant(tenant_id)) {
// For sys/meta tenant, circular dependency problem may exist when load tenant config from inner tables.
// For safety, data_version will fallback to last barrier data version until actual tenant config is loaded.
data_version = LAST_BARRIER_DATA_VERSION;
if (REACH_TIME_INTERVAL(60 * 1000 * 1000L)) {
share::ObTaskController::get().allow_next_syslog();

View File

@ -166,9 +166,10 @@ cal_version(const uint64_t major, const uint64_t minor, const uint64_t major_pat
#define CLUSTER_VERSION_3_2_3_0 (oceanbase::common::cal_version(3, 2, 3, 0))
#define CLUSTER_VERSION_4_0_0_0 (oceanbase::common::cal_version(4, 0, 0, 0))
#define CLUSTER_VERSION_4_1_0_0 (oceanbase::common::cal_version(4, 1, 0, 0))
#define CLUSTER_VERSION_4_2_0_0 (oceanbase::common::cal_version(4, 2, 0, 0))
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//TODO: If you update the above version, please update CLUSTER_CURRENT_VERSION.
#define CLUSTER_CURRENT_VERSION CLUSTER_VERSION_4_1_0_0
#define CLUSTER_CURRENT_VERSION CLUSTER_VERSION_4_2_0_0
#define GET_MIN_CLUSTER_VERSION() (oceanbase::common::ObClusterVersion::get_instance().get_cluster_version())
#define IS_CLUSTER_VERSION_BEFORE_4_1_0_0 (oceanbase::common::ObClusterVersion::get_instance().get_cluster_version() < CLUSTER_VERSION_4_1_0_0)
@ -179,10 +180,13 @@ cal_version(const uint64_t major, const uint64_t minor, const uint64_t major_pat
// 3. TODO: If you update data_version below, please update DATA_CURRENT_VERSION & ObUpgradeChecker too.
#define DATA_VERSION_4_0_0_0 (oceanbase::common::cal_version(4, 0, 0, 0))
#define DATA_VERSION_4_1_0_0 (oceanbase::common::cal_version(4, 1, 0, 0))
#define DATA_VERSION_4_2_0_0 (oceanbase::common::cal_version(4, 2, 0, 0))
#define DATA_CURRENT_VERSION DATA_VERSION_4_2_0_0
// ATTENSION !!!!!!!!!!!!!!!!!!!!!!!!!!!
// LAST_BARRIER_DATA_VERSION should be the latest barrier data version before DATA_CURRENT_VERSION
#define LAST_BARRIER_DATA_VERSION DATA_VERSION_4_1_0_0
// should check returned ret
#define LAST_BARRIER_DATA_VERSION DATA_VERSION_4_0_0_0
#define DATA_CURRENT_VERSION DATA_VERSION_4_1_0_0
#define GET_MIN_DATA_VERSION(tenant_id, data_version) (oceanbase::common::ObClusterVersion::get_instance().get_tenant_data_version((tenant_id), (data_version)))
#define TENANT_NEED_UPGRADE(tenant_id, need) (oceanbase::common::ObClusterVersion::get_instance().tenant_need_upgrade((tenant_id), (need)))
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

View File

@ -35,7 +35,8 @@ namespace share
{
const uint64_t ObUpgradeChecker::UPGRADE_PATH[DATA_VERSION_NUM] = {
CALC_VERSION(4UL, 0UL, 0UL, 0UL), // 4.0.0.0
CALC_VERSION(4UL, 1UL, 0UL, 0UL) // 4.1.0.0
CALC_VERSION(4UL, 1UL, 0UL, 0UL), // 4.1.0.0
CALC_VERSION(4UL, 2UL, 0UL, 0UL) // 4.2.0.0
};
int ObUpgradeChecker::get_data_version_by_cluster_version(
@ -44,14 +45,15 @@ int ObUpgradeChecker::get_data_version_by_cluster_version(
{
int ret = OB_SUCCESS;
switch (cluster_version) {
case CLUSTER_VERSION_4_0_0_0: {
data_version = DATA_VERSION_4_0_0_0;
break;
}
case CLUSTER_VERSION_4_1_0_0: {
data_version = DATA_VERSION_4_1_0_0;
break;
#define CONVERT_CLUSTER_VERSION_TO_DATA_VERSION(CLUSTER_VERSION, DATA_VERSION) \
case CLUSTER_VERSION : { \
data_version = DATA_VERSION; \
break; \
}
CONVERT_CLUSTER_VERSION_TO_DATA_VERSION(CLUSTER_VERSION_4_0_0_0, DATA_VERSION_4_0_0_0)
CONVERT_CLUSTER_VERSION_TO_DATA_VERSION(CLUSTER_VERSION_4_1_0_0, DATA_VERSION_4_1_0_0)
CONVERT_CLUSTER_VERSION_TO_DATA_VERSION(CLUSTER_VERSION_4_2_0_0, DATA_VERSION_4_2_0_0)
#undef CONVERT_CLUSTER_VERSION_TO_DATA_VERSION
default: {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid cluster_version", KR(ret), K(cluster_version));
@ -71,6 +73,14 @@ bool ObUpgradeChecker::check_data_version_exist(
return bret;
}
//FIXME:(yanmu.ztl) cluster version should be discrete.
bool ObUpgradeChecker::check_cluster_version_exist(
const uint64_t version)
{
return version >= CLUSTER_VERSION_4_0_0_0
&& version <= CLUSTER_CURRENT_VERSION;
}
#define FORMAT_STR(str) ObHexEscapeSqlStr(str.empty() ? ObString("") : str)
/*
@ -596,6 +606,7 @@ int ObUpgradeProcesserSet::init(
// order by data version asc
INIT_PROCESSOR_BY_VERSION(4, 0, 0, 0);
INIT_PROCESSOR_BY_VERSION(4, 1, 0, 0);
INIT_PROCESSOR_BY_VERSION(4, 2, 0, 0);
#undef INIT_PROCESSOR_BY_VERSION
inited_ = true;
}

View File

@ -165,11 +165,12 @@ class ObUpgradeChecker
{
public:
static bool check_data_version_exist(const uint64_t version);
static bool check_cluster_version_exist(const uint64_t version);
static int get_data_version_by_cluster_version(
const uint64_t cluster_version,
uint64_t &data_version);
public:
static const int64_t DATA_VERSION_NUM = 2;
static const int64_t DATA_VERSION_NUM = 3;
static const uint64_t UPGRADE_PATH[DATA_VERSION_NUM];
};
@ -188,6 +189,7 @@ private:
int init_rewrite_rule_version(const uint64_t tenant_id);
static int recompile_all_views_and_synonyms(const uint64_t tenant_id);
};
DEF_SIMPLE_UPGRARD_PROCESSER(4, 2, 0, 0)
/* =========== special upgrade processor end ============= */
/* =========== upgrade processor end ============= */

View File

@ -481,9 +481,9 @@ DEF_TIME(tablet_meta_table_check_interval, OB_CLUSTER_PARAMETER, "30m", "[1m,)",
"the time interval that observer compares tablet meta table with local ls replica info "
"and make adjustments to ensure the correctness of tablet meta table. Range: [1m,+∞)",
ObParameterAttr(Section::ROOT_SERVICE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_STR(min_observer_version, OB_CLUSTER_PARAMETER, "4.1.0.0", "the min observer version",
DEF_STR(min_observer_version, OB_CLUSTER_PARAMETER, "4.2.0.0", "the min observer version",
ObParameterAttr(Section::ROOT_SERVICE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_VERSION(compatible, OB_TENANT_PARAMETER, "4.1.0.0", "compatible version for persisted data",
DEF_VERSION(compatible, OB_TENANT_PARAMETER, "4.2.0.0", "compatible version for persisted data",
ObParameterAttr(Section::ROOT_SERVICE, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_BOOL(enable_ddl, OB_CLUSTER_PARAMETER, "True", "specifies whether DDL operation is turned on. "
"Value: True:turned on; False: turned off",

View File

@ -18,8 +18,8 @@ class SqlItem:
self.action_sql = action_sql
self.rollback_sql = rollback_sql
current_cluster_version = "4.1.0.0"
current_data_version = "4.1.0.0"
current_cluster_version = "4.2.0.0"
current_data_version = "4.2.0.0"
g_succ_sql_list = []
g_commit_sql_list = []

View File

@ -25,6 +25,12 @@
when_come_from: [4.0.0.0]
- version: 4.1.0.0
can_be_upgraded_to:
- 4.2.0.0
require_from_binary:
value: True
when_come_from: [4.0.0.0, 4.1.0.0]
- version: 4.2.0.0
can_be_upgraded_to:
- 4.3.0.0

View File

@ -336,7 +336,10 @@ def check_data_version(query_cur):
min_cluster_version = get_version(results[0][0])
# check data version
if min_cluster_version >= get_version("4.1.0.0"):
if min_cluster_version < get_version("4.1.0.0"):
# last barrier cluster version should be 4.1.0.0
fail_list.append('last barrier cluster version is 4.1.0.0. prohibit cluster upgrade from cluster version less than 4.1.0.0')
else:
data_version_str = ''
data_version = 0
# check compatible is same
@ -350,22 +353,26 @@ def check_data_version(query_cur):
data_version_str = results[0][0]
data_version = get_version(results[0][0])
# check target_data_version/current_data_version
sql = "select count(*) from oceanbase.__all_tenant"
(desc, results) = query_cur.exec_query(sql)
if len(results) != 1 or len(results[0]) != 1:
fail_list.append('result cnt not match')
if data_version < get_version("4.1.0.0"):
# last barrier data version should be 4.1.0.0
fail_list.append('last barrier data version is 4.1.0.0. prohibit cluster upgrade from data version less than 4.1.0.0')
else:
tenant_count = results[0][0]
sql = "select count(*) from __all_virtual_core_table where column_name in ('target_data_version', 'current_data_version') and column_value = {0}".format(data_version)
# check target_data_version/current_data_version
sql = "select count(*) from oceanbase.__all_tenant"
(desc, results) = query_cur.exec_query(sql)
if len(results) != 1 or len(results[0]) != 1:
fail_list.append('result cnt not match')
elif 2 * tenant_count != results[0][0]:
fail_list.append('target_data_version/current_data_version not match with {0}, tenant_cnt:{1}, result_cnt:{2}'.format(data_version_str, tenant_count, results[0][0]))
else:
logging.info("check data version success, all tenant's compatible/target_data_version/current_data_version is {0}".format(data_version_str))
tenant_count = results[0][0]
sql = "select count(*) from __all_virtual_core_table where column_name in ('target_data_version', 'current_data_version') and column_value = {0}".format(data_version)
(desc, results) = query_cur.exec_query(sql)
if len(results) != 1 or len(results[0]) != 1:
fail_list.append('result cnt not match')
elif 2 * tenant_count != results[0][0]:
fail_list.append('target_data_version/current_data_version not match with {0}, tenant_cnt:{1}, result_cnt:{2}'.format(data_version_str, tenant_count, results[0][0]))
else:
logging.info("check data version success, all tenant's compatible/target_data_version/current_data_version is {0}".format(data_version_str))
# 2. 检查paxos副本是否同步, paxos副本是否缺失
def check_paxos_replica(query_cur):
@ -398,38 +405,25 @@ def check_cluster_status(query_cur):
# 5. 检查是否有异常租户(creating,延迟删除,恢复中)
def check_tenant_status(query_cur):
min_cluster_version = 0
sql = """select distinct value from GV$OB_PARAMETERS where name='min_observer_version'"""
(desc, results) = query_cur.exec_query(sql)
if len(results) != 1:
fail_list.append('min_observer_version is not sync')
elif len(results[0]) != 1:
fail_list.append('column cnt not match')
# check tenant schema
(desc, results) = query_cur.exec_query("""select count(*) as count from DBA_OB_TENANTS where status != 'NORMAL'""")
if len(results) != 1 or len(results[0]) != 1:
fail_list.append('results len not match')
elif 0 != results[0][0]:
fail_list.append('has abnormal tenant, should stop')
else:
min_cluster_version = get_version(results[0][0])
logging.info('check tenant status success')
# check tenant schema
(desc, results) = query_cur.exec_query("""select count(*) as count from DBA_OB_TENANTS where status != 'NORMAL'""")
if len(results) != 1 or len(results[0]) != 1:
fail_list.append('results len not match')
elif 0 != results[0][0]:
fail_list.append('has abnormal tenant, should stop')
else:
logging.info('check tenant status success')
# check tenant info
# 1. don't support standby tenant upgrade from 4.0.0.0
# 2. don't support restore tenant upgrade
sub_sql = ''
if min_cluster_version >= get_version("4.1.0.0"):
sub_sql = """ and tenant_role != 'STANDBY'"""
(desc, results) = query_cur.exec_query("""select count(*) as count from oceanbase.__all_virtual_tenant_info where tenant_role != 'PRIMARY' {0}""".format(sub_sql))
if len(results) != 1 or len(results[0]) != 1:
fail_list.append('results len not match')
elif 0 != results[0][0]:
fail_list.append('has abnormal tenant info, should stop')
else:
logging.info('check tenant info success')
# check tenant info
# don't support restore tenant upgrade
(desc, results) = query_cur.exec_query("""select count(*) as count from oceanbase.__all_virtual_tenant_info where tenant_role != 'PRIMARY' and tenant_role != 'STANDBY'""")
if len(results) != 1 or len(results[0]) != 1:
fail_list.append('results len not match')
elif 0 != results[0][0]:
fail_list.append('has abnormal tenant info, should stop')
else:
logging.info('check tenant info success')
# 6. 检查无恢复任务
def check_restore_job_exist(query_cur):

View File

@ -26,8 +26,8 @@
# self.action_sql = action_sql
# self.rollback_sql = rollback_sql
#
#current_cluster_version = "4.1.0.0"
#current_data_version = "4.1.0.0"
#current_cluster_version = "4.2.0.0"
#current_data_version = "4.2.0.0"
#g_succ_sql_list = []
#g_commit_sql_list = []
#
@ -1843,7 +1843,10 @@
# min_cluster_version = get_version(results[0][0])
#
# # check data version
# if min_cluster_version >= get_version("4.1.0.0"):
# if min_cluster_version < get_version("4.1.0.0"):
# # last barrier cluster version should be 4.1.0.0
# fail_list.append('last barrier cluster version is 4.1.0.0. prohibit cluster upgrade from cluster version less than 4.1.0.0')
# else:
# data_version_str = ''
# data_version = 0
# # check compatible is same
@ -1857,22 +1860,26 @@
# data_version_str = results[0][0]
# data_version = get_version(results[0][0])
#
# # check target_data_version/current_data_version
# sql = "select count(*) from oceanbase.__all_tenant"
# (desc, results) = query_cur.exec_query(sql)
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('result cnt not match')
# if data_version < get_version("4.1.0.0"):
# # last barrier data version should be 4.1.0.0
# fail_list.append('last barrier data version is 4.1.0.0. prohibit cluster upgrade from data version less than 4.1.0.0')
# else:
# tenant_count = results[0][0]
#
# sql = "select count(*) from __all_virtual_core_table where column_name in ('target_data_version', 'current_data_version') and column_value = {0}".format(data_version)
# # check target_data_version/current_data_version
# sql = "select count(*) from oceanbase.__all_tenant"
# (desc, results) = query_cur.exec_query(sql)
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('result cnt not match')
# elif 2 * tenant_count != results[0][0]:
# fail_list.append('target_data_version/current_data_version not match with {0}, tenant_cnt:{1}, result_cnt:{2}'.format(data_version_str, tenant_count, results[0][0]))
# else:
# logging.info("check data version success, all tenant's compatible/target_data_version/current_data_version is {0}".format(data_version_str))
# tenant_count = results[0][0]
#
# sql = "select count(*) from __all_virtual_core_table where column_name in ('target_data_version', 'current_data_version') and column_value = {0}".format(data_version)
# (desc, results) = query_cur.exec_query(sql)
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('result cnt not match')
# elif 2 * tenant_count != results[0][0]:
# fail_list.append('target_data_version/current_data_version not match with {0}, tenant_cnt:{1}, result_cnt:{2}'.format(data_version_str, tenant_count, results[0][0]))
# else:
# logging.info("check data version success, all tenant's compatible/target_data_version/current_data_version is {0}".format(data_version_str))
#
## 2. 检查paxos副本是否同步, paxos副本是否缺失
#def check_paxos_replica(query_cur):
@ -1905,38 +1912,25 @@
#
## 5. 检查是否有异常租户(creating,延迟删除,恢复中)
#def check_tenant_status(query_cur):
# min_cluster_version = 0
# sql = """select distinct value from GV$OB_PARAMETERS where name='min_observer_version'"""
# (desc, results) = query_cur.exec_query(sql)
# if len(results) != 1:
# fail_list.append('min_observer_version is not sync')
# elif len(results[0]) != 1:
# fail_list.append('column cnt not match')
#
# # check tenant schema
# (desc, results) = query_cur.exec_query("""select count(*) as count from DBA_OB_TENANTS where status != 'NORMAL'""")
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('results len not match')
# elif 0 != results[0][0]:
# fail_list.append('has abnormal tenant, should stop')
# else:
# min_cluster_version = get_version(results[0][0])
# logging.info('check tenant status success')
#
# # check tenant schema
# (desc, results) = query_cur.exec_query("""select count(*) as count from DBA_OB_TENANTS where status != 'NORMAL'""")
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('results len not match')
# elif 0 != results[0][0]:
# fail_list.append('has abnormal tenant, should stop')
# else:
# logging.info('check tenant status success')
#
# # check tenant info
# # 1. don't support standby tenant upgrade from 4.0.0.0
# # 2. don't support restore tenant upgrade
# sub_sql = ''
# if min_cluster_version >= get_version("4.1.0.0"):
# sub_sql = """ and tenant_role != 'STANDBY'"""
# (desc, results) = query_cur.exec_query("""select count(*) as count from oceanbase.__all_virtual_tenant_info where tenant_role != 'PRIMARY' {0}""".format(sub_sql))
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('results len not match')
# elif 0 != results[0][0]:
# fail_list.append('has abnormal tenant info, should stop')
# else:
# logging.info('check tenant info success')
# # check tenant info
# # don't support restore tenant upgrade
# (desc, results) = query_cur.exec_query("""select count(*) as count from oceanbase.__all_virtual_tenant_info where tenant_role != 'PRIMARY' and tenant_role != 'STANDBY'""")
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('results len not match')
# elif 0 != results[0][0]:
# fail_list.append('has abnormal tenant info, should stop')
# else:
# logging.info('check tenant info success')
#
## 6. 检查无恢复任务
#def check_restore_job_exist(query_cur):

View File

@ -26,8 +26,8 @@
# self.action_sql = action_sql
# self.rollback_sql = rollback_sql
#
#current_cluster_version = "4.1.0.0"
#current_data_version = "4.1.0.0"
#current_cluster_version = "4.2.0.0"
#current_data_version = "4.2.0.0"
#g_succ_sql_list = []
#g_commit_sql_list = []
#
@ -1843,7 +1843,10 @@
# min_cluster_version = get_version(results[0][0])
#
# # check data version
# if min_cluster_version >= get_version("4.1.0.0"):
# if min_cluster_version < get_version("4.1.0.0"):
# # last barrier cluster version should be 4.1.0.0
# fail_list.append('last barrier cluster version is 4.1.0.0. prohibit cluster upgrade from cluster version less than 4.1.0.0')
# else:
# data_version_str = ''
# data_version = 0
# # check compatible is same
@ -1857,22 +1860,26 @@
# data_version_str = results[0][0]
# data_version = get_version(results[0][0])
#
# # check target_data_version/current_data_version
# sql = "select count(*) from oceanbase.__all_tenant"
# (desc, results) = query_cur.exec_query(sql)
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('result cnt not match')
# if data_version < get_version("4.1.0.0"):
# # last barrier data version should be 4.1.0.0
# fail_list.append('last barrier data version is 4.1.0.0. prohibit cluster upgrade from data version less than 4.1.0.0')
# else:
# tenant_count = results[0][0]
#
# sql = "select count(*) from __all_virtual_core_table where column_name in ('target_data_version', 'current_data_version') and column_value = {0}".format(data_version)
# # check target_data_version/current_data_version
# sql = "select count(*) from oceanbase.__all_tenant"
# (desc, results) = query_cur.exec_query(sql)
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('result cnt not match')
# elif 2 * tenant_count != results[0][0]:
# fail_list.append('target_data_version/current_data_version not match with {0}, tenant_cnt:{1}, result_cnt:{2}'.format(data_version_str, tenant_count, results[0][0]))
# else:
# logging.info("check data version success, all tenant's compatible/target_data_version/current_data_version is {0}".format(data_version_str))
# tenant_count = results[0][0]
#
# sql = "select count(*) from __all_virtual_core_table where column_name in ('target_data_version', 'current_data_version') and column_value = {0}".format(data_version)
# (desc, results) = query_cur.exec_query(sql)
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('result cnt not match')
# elif 2 * tenant_count != results[0][0]:
# fail_list.append('target_data_version/current_data_version not match with {0}, tenant_cnt:{1}, result_cnt:{2}'.format(data_version_str, tenant_count, results[0][0]))
# else:
# logging.info("check data version success, all tenant's compatible/target_data_version/current_data_version is {0}".format(data_version_str))
#
## 2. 检查paxos副本是否同步, paxos副本是否缺失
#def check_paxos_replica(query_cur):
@ -1905,38 +1912,25 @@
#
## 5. 检查是否有异常租户(creating,延迟删除,恢复中)
#def check_tenant_status(query_cur):
# min_cluster_version = 0
# sql = """select distinct value from GV$OB_PARAMETERS where name='min_observer_version'"""
# (desc, results) = query_cur.exec_query(sql)
# if len(results) != 1:
# fail_list.append('min_observer_version is not sync')
# elif len(results[0]) != 1:
# fail_list.append('column cnt not match')
#
# # check tenant schema
# (desc, results) = query_cur.exec_query("""select count(*) as count from DBA_OB_TENANTS where status != 'NORMAL'""")
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('results len not match')
# elif 0 != results[0][0]:
# fail_list.append('has abnormal tenant, should stop')
# else:
# min_cluster_version = get_version(results[0][0])
# logging.info('check tenant status success')
#
# # check tenant schema
# (desc, results) = query_cur.exec_query("""select count(*) as count from DBA_OB_TENANTS where status != 'NORMAL'""")
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('results len not match')
# elif 0 != results[0][0]:
# fail_list.append('has abnormal tenant, should stop')
# else:
# logging.info('check tenant status success')
#
# # check tenant info
# # 1. don't support standby tenant upgrade from 4.0.0.0
# # 2. don't support restore tenant upgrade
# sub_sql = ''
# if min_cluster_version >= get_version("4.1.0.0"):
# sub_sql = """ and tenant_role != 'STANDBY'"""
# (desc, results) = query_cur.exec_query("""select count(*) as count from oceanbase.__all_virtual_tenant_info where tenant_role != 'PRIMARY' {0}""".format(sub_sql))
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('results len not match')
# elif 0 != results[0][0]:
# fail_list.append('has abnormal tenant info, should stop')
# else:
# logging.info('check tenant info success')
# # check tenant info
# # don't support restore tenant upgrade
# (desc, results) = query_cur.exec_query("""select count(*) as count from oceanbase.__all_virtual_tenant_info where tenant_role != 'PRIMARY' and tenant_role != 'STANDBY'""")
# if len(results) != 1 or len(results[0]) != 1:
# fail_list.append('results len not match')
# elif 0 != results[0][0]:
# fail_list.append('has abnormal tenant info, should stop')
# else:
# logging.info('check tenant info success')
#
## 6. 检查无恢复任务
#def check_restore_job_exist(query_cur):