Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.1.0 update #668

Merged
merged 5 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion plugins/rca/disconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

"""
@time: 2024/03/11
@file: disconnection_scene.py
@file: disconnection.py
@desc:
"""
import re
Expand Down Expand Up @@ -68,9 +68,20 @@ def __execute_obproxy_one_node(self, node):
self.gather_log.set_parameters("nodes_list", [node])
self.gather_log.set_parameters("target", "obproxy")
self.gather_log.set_parameters("scope", "obproxy_diagnosis")
# get log time
log_time_tag = None
if self.input_parameters.get("since") is not None:
since = self.input_parameters.get("since")
self.gather_log.set_parameters("since", since)
log_time_tag = "since: {0}".format(since)
if self.input_parameters.get("from") is not None and self.input_parameters.get("to") is not None:
from_time = self.input_parameters.get("from")
to_time = self.input_parameters.get("to")
self.gather_log.set_parameters("from", from_time)
self.gather_log.set_parameters("to", to_time)
log_time_tag = "from {0}, to {1}".format(from_time, to_time)
if log_time_tag is not None:
self.record.add_record("on node: {1} get log_time:{0}".format(log_time_tag, node.get("ip")))
self.work_path = self.store_dir
logs_name = self.gather_log.execute()
if len(logs_name) == 0:
Expand Down
11 changes: 6 additions & 5 deletions plugins/rca/major_hold.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def execute(self):
err_tenant_ids = []
self.record.add_record("check major task is error or not")
try:
COMPACTING_data = self.ob_connector.execute_sql_return_cursor_dictionary('select * from oceanbase.CDB_OB_MAJOR_COMPACTION where IS_ERROR="YES";').fetchall()
sql = 'select * from oceanbase.CDB_OB_MAJOR_COMPACTION where IS_ERROR="YES";'
COMPACTING_data = self.ob_connector.execute_sql_return_cursor_dictionary(sql).fetchall()
if len(COMPACTING_data) == 0:
self.record.add_record("CDB_OB_MAJOR_COMPACTION is not exist IS_ERROR='YES'")
else:
Expand All @@ -62,7 +63,7 @@ def execute(self):
CDB_OB_MAJOR_COMPACTION_err_tenant_ids.append(str(data.get('TENANT_ID')))
self.record.add_record("CDB_OB_MAJOR_COMPACTION have IS_ERROR='YES',the tenant_ids are {0}".format(err_tenant_ids))
err_tenant_ids.extend(CDB_OB_MAJOR_COMPACTION_err_tenant_ids)
self.record.add_record("check on CDB_OB_MAJOR_COMPACTION IS_ERROR is 'YES'.\n sql:{0}".format(sql), result=err_tenant_ids)
self.record.add_record("check on CDB_OB_MAJOR_COMPACTION IS_ERROR is 'YES'.\n sql:{0}".format(sql))
except Exception as e:
self.stdio.warn("MajorHoldScene execute CDB_OB_MAJOR_COMPACTION panic: {0}".format(e))
raise RCAExecuteException("MajorHoldScene execute CDB_OB_MAJOR_COMPACTION panic: {0}".format(e))
Expand Down Expand Up @@ -206,9 +207,9 @@ def execute(self):
# all node execute
for observer_node in self.observer_nodes:
ssh_client = observer_node["ssher"]
ssh_client.exec_cmd("dmesg -T > /tmp/dmesg_{0}.log".format(ssh_client.get_name()))
ssh_client.download("/tmp/dmesg_{0}.log".format(ssh_client.get_name()), self.local_path + "/dmesg_log")
tenant_record.add_record("download /tmp/dmesg_{0}.log to {1}".format(ssh_client.get_name(), self.local_path + "/dmesg_log"))
ssh_client.exec_cmd("dmesg -T > /tmp/dmesg_{0}.log".format(observer_node.get_name()))
ssh_client.download("/tmp/dmesg_{0}.log".format(observer_node.get_name()), self.local_path + "/dmesg_log")
tenant_record.add_record("download /tmp/dmesg_{0}.log to {1}".format(observer_node.get_name(), self.local_path + "/dmesg_log"))
except Exception as e:
self.stdio.warn("MajorHoldScene execute 6 get dmesg exception: {0}".format(e))
tenant_record.add_suggest("send the {0} to the oceanbase community".format(self.local_path))
Expand Down
26 changes: 24 additions & 2 deletions src/handler/gather/step/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
@desc:
"""
from src.common.ssh_client.ssh import SshClient
from src.common.tool import Util
from src.handler.gather.gather_component_log import GatherComponentLogHandler
from src.common.stdio import SafeStdio
from src.handler.gather.step.ssh import SshHandler
Expand All @@ -39,6 +40,7 @@ def __init__(self, context, step, node, cluster, report_path, task_variable_dict
self.report_path = report_path
self.env = env
self.node_number = node_number
self.options = self.context.options

def execute(self):
self.stdio.verbose("step: {0}".format(self.step))
Expand Down Expand Up @@ -69,7 +71,17 @@ def execute(self):
elif self.step["type"] == "log" and (skip_type != "ssh"):
if self.node.get("host_type") and self.node.get("host_type") == "OBSERVER":
handler = GatherComponentLogHandler()
handler.init(self.context, target="observer", grep=self.step.get("grep"), nodes=[self.node], store_dir=self.report_path, is_scene=True)
handler.init(
self.context,
target="observer",
grep=self.step.get("grep"),
nodes=[self.node],
store_dir=self.report_path,
from_option=Util.get_option(self.options, 'from'),
to_option=Util.get_option(self.options, 'to'),
since=Util.get_option(self.options, 'since'),
is_scene=True,
)
handler.handle()
else:
self.stdio.verbose("node host_type is {0} not OBSERVER, skipping gather log".format(self.node.get("host_type")))
Expand All @@ -78,7 +90,17 @@ def execute(self):
self.context.set_variable('filter_nodes_list', [self.node])
self.context.set_variable('gather_grep', self.step.get("grep"))
handler = GatherComponentLogHandler()
handler.init(self.context, target="obproxy", grep=self.step.get("grep"), nodes=[self.node], store_dir=self.report_path, is_scene=True)
handler.init(
self.context,
target="obproxy",
grep=self.step.get("grep"),
nodes=[self.node],
store_dir=self.report_path,
from_option=Util.get_option(self.options, 'from'),
to_option=Util.get_option(self.options, 'to'),
since=Util.get_option(self.options, 'since'),
is_scene=True,
)
handler.handle()
else:
self.stdio.verbose("node host_type is {0} not OBPROXY, skipping gather log".format(self.node.get("host_type")))
Expand Down
Loading