From 002d6a3bdde58c0c1d28212c896c357ae8a02eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A0=E7=A3=8A?= Date: Wed, 19 Jun 2024 11:56:15 +0800 Subject: [PATCH 1/2] update rca ddl_disk_full_scene --- handler/rca/scene/ddl_disk_full_scene.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/handler/rca/scene/ddl_disk_full_scene.py b/handler/rca/scene/ddl_disk_full_scene.py index e6bcb26a..db6bcb43 100644 --- a/handler/rca/scene/ddl_disk_full_scene.py +++ b/handler/rca/scene/ddl_disk_full_scene.py @@ -15,10 +15,9 @@ @file: ddl_disk_full_scene.py @desc: """ -import re from handler.rca.rca_exception import RCAInitException, RCAExecuteException -from handler.rca.rca_handler import RcaScene, RCA_ResultRecord +from handler.rca.rca_handler import RcaScene from common.tool import StringUtils @@ -108,12 +107,14 @@ def execute(self): ## if the action is not add_index # 获取各个节点上的源表大小,单位为B # self.stdio._call_stdio('start_loading', 'gstart query estimated_data_size, please wait some minutes...') + self.stdio.start_loading('start query estimated_data_size, please wait some minutes...') sql = "select svr_ip, svr_port, sum(original_size) as estimated_data_size from oceanbase.__all_virtual_tablet_sstable_macro_info where tablet_id in (select tablet_id from oceanbase.__all_virtual_tablet_to_table_history where table_id = {0}) and (svr_ip, svr_port) in (select svr_ip, svr_port from oceanbase.__all_virtual_ls_meta_table where role = 1) group by svr_ip, svr_port;".format( self.table_id ) self.verbose("execute_sql is {0}".format(sql)) tablet_size_data = self.ob_connector.execute_sql_return_cursor_dictionary(sql).fetchall() # self.stdio._call_stdio('stop_loading', 'succeed') + self.stdio.stop_loading('succeed') for item in tablet_size_data: tablet_size_data_ip = item["svr_ip"] tablet_size_data_port = item["svr_port"] From 581e2061f2a760534da7844c1701f67316695770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A0=E7=A3=8A?= Date: Wed, 19 Jun 2024 15:38:28 +0800 Subject: [PATCH 2/2] print traceback --- core.py | 4 +++- handler/checker/check_handler.py | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core.py b/core.py index ab8c7f98..9cccc54e 100644 --- a/core.py +++ b/core.py @@ -18,6 +18,7 @@ from __future__ import absolute_import, division, print_function import os +import traceback from optparse import Values from copy import copy @@ -319,7 +320,8 @@ def rca_run(self, opts): handler.handle() handler.execute() except Exception as e: - self.stdio.error(e) + self.stdio.error("rca run Exception: {0}".format(e)) + self.stdio.verbose(traceback.format_exc()) def rca_list(self, opts): config = self.config_manager diff --git a/handler/checker/check_handler.py b/handler/checker/check_handler.py index a08b49df..b7fa207a 100644 --- a/handler/checker/check_handler.py +++ b/handler/checker/check_handler.py @@ -18,7 +18,7 @@ import os import queue -import time +import traceback import yaml @@ -168,11 +168,15 @@ def handle(self): new_tasks[task_name] = task_value self.tasks = new_tasks self.stdio.verbose("tasks is {0}".format(self.tasks.keys())) + return True except Exception as e: - self.stdio.error(e) + self.stdio.error("Get package tasks failed. Error info is {0}".format(e)) + self.stdio.verbose(traceback.format_exc()) + return False # get all tasks def get_all_tasks(self): + self.stdio.verbose("get all tasks") current_path = self.tasks_base_path tasks = {} for root, dirs, files in os.walk(current_path): @@ -239,6 +243,7 @@ def execute(self): self.stdio.error("Report error :{0}".format(e)) except Exception as e: self.stdio.error("Internal error :{0}".format(e)) + self.stdio.verbose(traceback.format_exc()) class checkOBConnectorPool: