diff --git a/tools/upgrade/do_upgrade_post.py b/tools/upgrade/do_upgrade_post.py index 53bda07e26..bb738ee5ab 100755 --- a/tools/upgrade/do_upgrade_post.py +++ b/tools/upgrade/do_upgrade_post.py @@ -74,7 +74,7 @@ def do_upgrade(my_host, my_port, my_user, my_passwd, timeout, my_module_set, upg if run_modules.MODULE_HEALTH_CHECK in my_module_set: logging.info('================begin to run health check action ===============') - upgrade_health_checker.do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout) + upgrade_health_checker.do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, False) # need_check_major_status = False logging.info('================succeed to run health check action ===============') if run_modules.MODULE_END_ROLLING_UPGRADE in my_module_set: diff --git a/tools/upgrade/do_upgrade_pre.py b/tools/upgrade/do_upgrade_pre.py index 4ab86e18c8..8b8bd60294 100755 --- a/tools/upgrade/do_upgrade_pre.py +++ b/tools/upgrade/do_upgrade_pre.py @@ -96,7 +96,7 @@ def do_upgrade(my_host, my_port, my_user, my_passwd, timeout, my_module_set, upg if run_modules.MODULE_HEALTH_CHECK in my_module_set: logging.info('================begin to run health check action ===============') - upgrade_health_checker.do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout) + upgrade_health_checker.do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, True) # need_check_major_status = True logging.info('================succeed to run health check action ===============') except Exception, e: diff --git a/tools/upgrade/special_upgrade_action_pre.py b/tools/upgrade/special_upgrade_action_pre.py index 1cd519e6dd..d8e68be6c9 100755 --- a/tools/upgrade/special_upgrade_action_pre.py +++ b/tools/upgrade/special_upgrade_action_pre.py @@ -28,6 +28,14 @@ def do_special_upgrade(conn, cur, timeout, user, passwd): # when upgrade across version, disable enable_ddl/major_freeze if current_version != target_version: actions.set_parameter(cur, 'enable_ddl', 'False', timeout) + actions.set_parameter(cur, 'enable_major_freeze', 'False', timeout) + actions.set_tenant_parameter(cur, '_enable_adaptive_compaction', 'False', timeout) + # wait scheduler in storage to notice adaptive_compaction is switched to false + time.sleep(60 * 2) + query_cur = actions.QueryCursor(cur) + wait_major_timeout = 600 + upgrade_health_checker.check_major_merge(query_cur, wait_major_timeout) + actions.do_suspend_merge(cur, timeout) # When upgrading from a version prior to 4.2 to version 4.2, the bloom_filter should be disabled. # The param _bloom_filter_enabled is no longer in use as of version 4.2, there is no need to enable it again. if actions.get_version(current_version) < actions.get_version('4.2.0.0')\ diff --git a/tools/upgrade/upgrade_checker.py b/tools/upgrade/upgrade_checker.py index f2366634c8..31332086c6 100755 --- a/tools/upgrade/upgrade_checker.py +++ b/tools/upgrade/upgrade_checker.py @@ -411,6 +411,9 @@ def check_cluster_status(query_cur): (desc, results) = query_cur.exec_query("""select count(1) from CDB_OB_MAJOR_COMPACTION where (GLOBAL_BROADCAST_SCN > LAST_SCN or STATUS != 'IDLE')""") if results[0][0] > 0 : fail_list.append('{0} tenant is merging, please check'.format(results[0][0])) + (desc, results) = query_cur.exec_query("""select /*+ query_timeout(1000000000) */ count(1) from __all_virtual_tablet_compaction_info where max_received_scn > finished_scn and max_received_scn > 0""") + if results[0][0] > 0 : + fail_list.append('{0} tablet is merging, please check'.format(results[0][0])) logging.info('check cluster status success') # 5. 检查是否有异常租户(creating,延迟删除,恢复中) diff --git a/tools/upgrade/upgrade_health_checker.py b/tools/upgrade/upgrade_health_checker.py index 1c84427722..1c41fa068d 100755 --- a/tools/upgrade/upgrade_health_checker.py +++ b/tools/upgrade/upgrade_health_checker.py @@ -393,7 +393,7 @@ def check_until_timeout(query_cur, sql, value, timeout): time.sleep(10) # 开始健康检查 -def do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, zone = ''): +def do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, need_check_major_status, zone = ''): try: conn = mysql.connector.connect(user = my_user, password = my_passwd, @@ -410,6 +410,8 @@ def do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, zone check_paxos_replica(query_cur, timeout) check_schema_status(query_cur, timeout) check_server_version_by_zone(query_cur, zone) + if True == need_check_major_status: + check_major_merge(query_cur, timeout) except Exception, e: logging.exception('run error') raise e @@ -444,7 +446,7 @@ if __name__ == '__main__': zone = get_opt_zone() logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", log-file=\"%s\", timeout=%s, zone=\"%s\"', \ host, port, user, password.replace('"', '\\"'), log_filename, timeout, zone) - do_check(host, port, user, password, upgrade_params, timeout, zone) + do_check(host, port, user, password, upgrade_params, timeout, False, zone) # need_check_major_status = False except mysql.connector.Error, e: logging.exception('mysql connctor error') raise e diff --git a/tools/upgrade/upgrade_post.py b/tools/upgrade/upgrade_post.py index cd85639744..a17c1673bc 100755 --- a/tools/upgrade/upgrade_post.py +++ b/tools/upgrade/upgrade_post.py @@ -674,7 +674,7 @@ # # if run_modules.MODULE_HEALTH_CHECK in my_module_set: # logging.info('================begin to run health check action ===============') -# upgrade_health_checker.do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout) +# upgrade_health_checker.do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, False) # need_check_major_status = False # logging.info('================succeed to run health check action ===============') # # if run_modules.MODULE_END_ROLLING_UPGRADE in my_module_set: @@ -869,7 +869,7 @@ # # if run_modules.MODULE_HEALTH_CHECK in my_module_set: # logging.info('================begin to run health check action ===============') -# upgrade_health_checker.do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout) +# upgrade_health_checker.do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, True) # need_check_major_status = True # logging.info('================succeed to run health check action ===============') # # except Exception, e: @@ -1355,6 +1355,14 @@ # # when upgrade across version, disable enable_ddl/major_freeze # if current_version != target_version: # actions.set_parameter(cur, 'enable_ddl', 'False', timeout) +# actions.set_parameter(cur, 'enable_major_freeze', 'False', timeout) +# actions.set_tenant_parameter(cur, '_enable_adaptive_compaction', 'False', timeout) +# # wait scheduler in storage to notice adaptive_compaction is switched to false +# time.sleep(60 * 2) +# query_cur = actions.QueryCursor(cur) +# wait_major_timeout = 600 +# upgrade_health_checker.check_major_merge(query_cur, wait_major_timeout) +# actions.do_suspend_merge(cur, timeout) # # When upgrading from a version prior to 4.2 to version 4.2, the bloom_filter should be disabled. # # The param _bloom_filter_enabled is no longer in use as of version 4.2, there is no need to enable it again. # if actions.get_version(current_version) < actions.get_version('4.2.0.0')\ @@ -2063,6 +2071,9 @@ # (desc, results) = query_cur.exec_query("""select count(1) from CDB_OB_MAJOR_COMPACTION where (GLOBAL_BROADCAST_SCN > LAST_SCN or STATUS != 'IDLE')""") # if results[0][0] > 0 : # fail_list.append('{0} tenant is merging, please check'.format(results[0][0])) +# (desc, results) = query_cur.exec_query("""select /*+ query_timeout(1000000000) */ count(1) from __all_virtual_tablet_compaction_info where max_received_scn > finished_scn and max_received_scn > 0""") +# if results[0][0] > 0 : +# fail_list.append('{0} tablet is merging, please check'.format(results[0][0])) # logging.info('check cluster status success') # ## 5. 检查是否有异常租户(creating,延迟删除,恢复中) @@ -2858,7 +2869,7 @@ # time.sleep(10) # ## 开始健康检查 -#def do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, zone = ''): +#def do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, need_check_major_status, zone = ''): # try: # conn = mysql.connector.connect(user = my_user, # password = my_passwd, @@ -2875,6 +2886,8 @@ # check_paxos_replica(query_cur, timeout) # check_schema_status(query_cur, timeout) # check_server_version_by_zone(query_cur, zone) +# if True == need_check_major_status: +# check_major_merge(query_cur, timeout) # except Exception, e: # logging.exception('run error') # raise e @@ -2909,7 +2922,7 @@ # zone = get_opt_zone() # logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", log-file=\"%s\", timeout=%s, zone=\"%s\"', \ # host, port, user, password.replace('"', '\\"'), log_filename, timeout, zone) -# do_check(host, port, user, password, upgrade_params, timeout, zone) +# do_check(host, port, user, password, upgrade_params, timeout, False, zone) # need_check_major_status = False # except mysql.connector.Error, e: # logging.exception('mysql connctor error') # raise e @@ -3051,6 +3064,7 @@ # enable_ddl(cur, timeout) # enable_rebalance(cur, timeout) # enable_rereplication(cur, timeout) +# enable_major_freeze(cur, timeout) # except Exception, e: # logging.exception('run error') # raise e diff --git a/tools/upgrade/upgrade_post_checker.py b/tools/upgrade/upgrade_post_checker.py index 77e18b1d36..21175cb60d 100755 --- a/tools/upgrade/upgrade_post_checker.py +++ b/tools/upgrade/upgrade_post_checker.py @@ -130,6 +130,7 @@ def do_check(conn, cur, query_cur, timeout): enable_ddl(cur, timeout) enable_rebalance(cur, timeout) enable_rereplication(cur, timeout) + enable_major_freeze(cur, timeout) except Exception, e: logging.exception('run error') raise e diff --git a/tools/upgrade/upgrade_pre.py b/tools/upgrade/upgrade_pre.py index b781585fc8..5786d475c4 100755 --- a/tools/upgrade/upgrade_pre.py +++ b/tools/upgrade/upgrade_pre.py @@ -674,7 +674,7 @@ # # if run_modules.MODULE_HEALTH_CHECK in my_module_set: # logging.info('================begin to run health check action ===============') -# upgrade_health_checker.do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout) +# upgrade_health_checker.do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, False) # need_check_major_status = False # logging.info('================succeed to run health check action ===============') # # if run_modules.MODULE_END_ROLLING_UPGRADE in my_module_set: @@ -869,7 +869,7 @@ # # if run_modules.MODULE_HEALTH_CHECK in my_module_set: # logging.info('================begin to run health check action ===============') -# upgrade_health_checker.do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout) +# upgrade_health_checker.do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, True) # need_check_major_status = True # logging.info('================succeed to run health check action ===============') # # except Exception, e: @@ -1355,6 +1355,14 @@ # # when upgrade across version, disable enable_ddl/major_freeze # if current_version != target_version: # actions.set_parameter(cur, 'enable_ddl', 'False', timeout) +# actions.set_parameter(cur, 'enable_major_freeze', 'False', timeout) +# actions.set_tenant_parameter(cur, '_enable_adaptive_compaction', 'False', timeout) +# # wait scheduler in storage to notice adaptive_compaction is switched to false +# time.sleep(60 * 2) +# query_cur = actions.QueryCursor(cur) +# wait_major_timeout = 600 +# upgrade_health_checker.check_major_merge(query_cur, wait_major_timeout) +# actions.do_suspend_merge(cur, timeout) # # When upgrading from a version prior to 4.2 to version 4.2, the bloom_filter should be disabled. # # The param _bloom_filter_enabled is no longer in use as of version 4.2, there is no need to enable it again. # if actions.get_version(current_version) < actions.get_version('4.2.0.0')\ @@ -2063,6 +2071,9 @@ # (desc, results) = query_cur.exec_query("""select count(1) from CDB_OB_MAJOR_COMPACTION where (GLOBAL_BROADCAST_SCN > LAST_SCN or STATUS != 'IDLE')""") # if results[0][0] > 0 : # fail_list.append('{0} tenant is merging, please check'.format(results[0][0])) +# (desc, results) = query_cur.exec_query("""select /*+ query_timeout(1000000000) */ count(1) from __all_virtual_tablet_compaction_info where max_received_scn > finished_scn and max_received_scn > 0""") +# if results[0][0] > 0 : +# fail_list.append('{0} tablet is merging, please check'.format(results[0][0])) # logging.info('check cluster status success') # ## 5. 检查是否有异常租户(creating,延迟删除,恢复中) @@ -2858,7 +2869,7 @@ # time.sleep(10) # ## 开始健康检查 -#def do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, zone = ''): +#def do_check(my_host, my_port, my_user, my_passwd, upgrade_params, timeout, need_check_major_status, zone = ''): # try: # conn = mysql.connector.connect(user = my_user, # password = my_passwd, @@ -2875,6 +2886,8 @@ # check_paxos_replica(query_cur, timeout) # check_schema_status(query_cur, timeout) # check_server_version_by_zone(query_cur, zone) +# if True == need_check_major_status: +# check_major_merge(query_cur, timeout) # except Exception, e: # logging.exception('run error') # raise e @@ -2909,7 +2922,7 @@ # zone = get_opt_zone() # logging.info('parameters from cmd: host=\"%s\", port=%s, user=\"%s\", password=\"%s\", log-file=\"%s\", timeout=%s, zone=\"%s\"', \ # host, port, user, password.replace('"', '\\"'), log_filename, timeout, zone) -# do_check(host, port, user, password, upgrade_params, timeout, zone) +# do_check(host, port, user, password, upgrade_params, timeout, False, zone) # need_check_major_status = False # except mysql.connector.Error, e: # logging.exception('mysql connctor error') # raise e @@ -3051,6 +3064,7 @@ # enable_ddl(cur, timeout) # enable_rebalance(cur, timeout) # enable_rereplication(cur, timeout) +# enable_major_freeze(cur, timeout) # except Exception, e: # logging.exception('run error') # raise e