[FEAT MERGE] change the semantics of tenant=all

This commit is contained in:
obdev
2023-08-31 03:10:42 +00:00
committed by ob-robot
parent 6f95b8a7ab
commit 03b37d3730
36 changed files with 1042 additions and 346 deletions

View File

@ -113,6 +113,22 @@
# and word_list[1].lower().startswith('@') and ':=' == word_list[2].lower()):
# raise MyError('sql must be update, key_word="{0}", sql="{1}"'.format(key_word, sql))
#
#def get_min_cluster_version(cur):
# min_cluster_version = 0
# sql = """select distinct value from oceanbase.GV$OB_PARAMETERS where name='min_observer_version'"""
# logging.info(sql)
# cur.execute(sql)
# results = cur.fetchall()
# if len(results) != 1:
# logging.exception('min_observer_version is not sync')
# raise e
# elif len(results[0]) != 1:
# logging.exception('column cnt not match')
# raise e
# else:
# min_cluster_version = get_version(results[0][0])
# return min_cluster_version
#
#def set_parameter(cur, parameter, value, timeout = 0):
# sql = """alter system set {0} = '{1}'""".format(parameter, value)
# logging.info(sql)
@ -120,9 +136,15 @@
# wait_parameter_sync(cur, False, parameter, value, timeout)
#
#def set_tenant_parameter(cur, parameter, value, timeout = 0):
# sql = """alter system set {0} = '{1}' tenant = 'all'""".format(parameter, value)
# logging.info(sql)
# cur.execute(sql)
# tenants_list = []
# if get_min_cluster_version(cur) < get_version("4.2.1.0"):
# tenants_list = ['all']
# else:
# tenants_list = ['sys', 'all_user', 'all_meta']
# for tenants in tenants_list:
# sql = """alter system set {0} = '{1}' tenant = '{2}'""".format(parameter, value, tenants)
# logging.info(sql)
# cur.execute(sql)
# wait_parameter_sync(cur, True, parameter, value, timeout)
#
#def get_ori_enable_ddl(cur, timeout):
@ -297,14 +319,26 @@
# wait_parameter_sync(cur, False, "enable_upgrade_mode", "False", timeout)
#
#def do_suspend_merge(cur, timeout):
# action_sql = "alter system suspend merge tenant = all"
# rollback_sql = "alter system resume merge tenant = all"
# tenants_list = []
# if get_min_cluster_version(cur) < get_version("4.2.1.0"):
# tenants_list = ['all']
# else:
# tenants_list = ['sys', 'all_user', 'all_meta']
# for tenants in tenants_list:
# action_sql = "alter system suspend merge tenant = {0}".format(tenants)
# rollback_sql = "alter system resume merge tenant = {0}".format(tenants)
# logging.info(action_sql)
# cur.execute(action_sql)
#
#def do_resume_merge(cur, timeout):
# action_sql = "alter system resume merge tenant = all"
# rollback_sql = "alter system suspend merge tenant = all"
# tenants_list = []
# if get_min_cluster_version(cur) < get_version("4.2.1.0"):
# tenants_list = ['all']
# else:
# tenants_list = ['sys', 'all_user', 'all_meta']
# for tenants in tenants_list:
# action_sql = "alter system resume merge tenant = {0}".format(tenants)
# rollback_sql = "alter system suspend merge tenant = {0}".format(tenants)
# logging.info(action_sql)
# cur.execute(action_sql)
#
@ -2110,6 +2144,16 @@
# fail_list.append('{0} schema not available, please check'.format(results[0][0]))
# logging.info('check schema status success')
#
## 16. 检查是否存在名为all/all_user/all_meta的租户
#def check_not_supported_tenant_name(query_cur):
# names = ["all", "all_user", "all_meta"]
# (desc, results) = query_cur.exec_query("""select tenant_name from oceanbase.DBA_OB_TENANTS""")
# for i in range(len(results)):
# if results[i][0].lower() in names:
# fail_list.append('a tenant named all/all_user/all_meta (case insensitive) cannot exist in the cluster, please rename the tenant')
# break
# logging.info('check special tenant name success')
#
## last check of do_check, make sure no function execute after check_fail_list
#def check_fail_list():
# if len(fail_list) != 0 :
@ -2151,6 +2195,7 @@
# check_observer_status(query_cur)
# check_schema_status(query_cur)
# check_server_version(query_cur)
# check_not_supported_tenant_name(query_cur)
# # all check func should execute before check_fail_list
# check_fail_list()
# modify_server_permanent_offline_time(cur)