add unit gc check in upgrade_checker.py

This commit is contained in:
zhaoyiping0622 2024-11-28 11:16:29 +00:00 committed by ob-robot
parent 6d57ccdcf4
commit 03791b2a96
3 changed files with 33 additions and 3 deletions

View File

@ -429,7 +429,7 @@ def check_cluster_status(query_cur):
fail_list.append('{0} tablet is merging, please check'.format(results[0][0]))
logging.info('check cluster status success')
# 5. 检查是否有异常租户(creating,延迟删除,恢复中)
# 5. 检查是否有异常租户(creating,延迟删除,恢复中,租户unit有残留)
def check_tenant_status(query_cur):
# check tenant schema
@ -460,6 +460,16 @@ def check_tenant_status(query_cur):
else:
logging.info('check tenant lock status success')
# check all deleted tenant's unit is freed
(desc, results) = query_cur.exec_query("select count(*) from oceanbase.gv$ob_units a, oceanbase.__all_tenant_history b where b.is_deleted = 1 and a.tenant_id = b.tenant_id")
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 deleted tenant with unit not freed')
else:
logging.info('check deleted tenant unit gc success')
# 6. 检查无恢复任务
def check_restore_job_exist(query_cur):
(desc, results) = query_cur.exec_query("""select count(1) from CDB_OB_RESTORE_PROGRESS""")

View File

@ -2078,7 +2078,7 @@
# fail_list.append('{0} tablet is merging, please check'.format(results[0][0]))
# logging.info('check cluster status success')
#
## 5. 检查是否有异常租户(creating,延迟删除,恢复中)
## 5. 检查是否有异常租户(creating,延迟删除,恢复中,租户unit有残留)
#def check_tenant_status(query_cur):
#
# # check tenant schema
@ -2109,6 +2109,16 @@
# else:
# logging.info('check tenant lock status success')
#
# # check all deleted tenant's unit is freed
# (desc, results) = query_cur.exec_query("select count(*) from oceanbase.gv$ob_units a, oceanbase.__all_tenant_history b where b.is_deleted = 1 and a.tenant_id = b.tenant_id")
# 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 deleted tenant with unit not freed')
# else:
# logging.info('check deleted tenant unit gc success')
#
#
## 6. 检查无恢复任务
#def check_restore_job_exist(query_cur):
# (desc, results) = query_cur.exec_query("""select count(1) from CDB_OB_RESTORE_PROGRESS""")

View File

@ -2078,7 +2078,7 @@
# fail_list.append('{0} tablet is merging, please check'.format(results[0][0]))
# logging.info('check cluster status success')
#
## 5. 检查是否有异常租户(creating,延迟删除,恢复中)
## 5. 检查是否有异常租户(creating,延迟删除,恢复中,租户unit有残留)
#def check_tenant_status(query_cur):
#
# # check tenant schema
@ -2109,6 +2109,16 @@
# else:
# logging.info('check tenant lock status success')
#
# # check all deleted tenant's unit is freed
# (desc, results) = query_cur.exec_query("select count(*) from oceanbase.gv$ob_units a, oceanbase.__all_tenant_history b where b.is_deleted = 1 and a.tenant_id = b.tenant_id")
# 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 deleted tenant with unit not freed')
# else:
# logging.info('check deleted tenant unit gc success')
#
#
## 6. 检查无恢复任务
#def check_restore_job_exist(query_cur):
# (desc, results) = query_cur.exec_query("""select count(1) from CDB_OB_RESTORE_PROGRESS""")