Skip to content

Commit

Permalink
support silent report
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaodong-ji committed Aug 23, 2024
1 parent c54ef98 commit b19f1c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ def analyze_fuction(self, function_type, opt):
self.set_context(function_type, 'analyze', config)
handler = AnalyzeIndexSpaceHandler(self.context)
handler.handle()
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data=handler.execute())
else:
self._call_stdio('error', 'Not support analyze function: {0}'.format(function_type))
return ObdiagResult(ObdiagResult.INPUT_ERROR_CODE, error_data='Not support analyze function: {0}'.format(function_type))
Expand Down
9 changes: 5 additions & 4 deletions handler/analyzer/analyze_index_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,18 @@ def handle(self):
node_result_map["estimated_index_space"] = target_server_estimated_index_size
node_result_map["available_disk_space"] = available_disk_space
self.result_map_list.append(node_result_map)
# if target_server_estimated_index_size > available_disk_space:
# self.stdio.print("the disk space of server({0}:{1}) disk is not enough. please add the server disk".format(target_server_ip, target_server_port))
# else:
# self.stdio.print("the disk space of server({0}:{1}) is enough. Don't warn. If there are still errors, please contact the OceanBase community.".format(target_server_ip, target_server_port))
self.export_report_table()
except Exception as e:
self.stdio.verbose("analyze index space error: {0}".format(e))
sys.exit()
finally:
self.stdio.verbose("end analyze index space")

def execute(self):
result_map = {}
result_map["result"] = self.result_map_list
return result_map

def export_report_table(self):
try:
report_index_space_tb = PrettyTable(["ip", "port", "estimated_index_space", "available_disk_space"])
Expand Down

0 comments on commit b19f1c9

Please sign in to comment.