Skip to content

Commit

Permalink
obstack support aarch64 (#711)
Browse files Browse the repository at this point in the history
* fix: major_hold_scene dmesg get

 add: version check task

* rca disconnection support env  'from' 'to'

* rca disconnection support env  'from' 'to'

* rca disconnection support env  'from' 'to'

* add check core_file is exist by kernel.core_pattern

* update check task: cluster.datafile_next

* rename DockerFile.dev && check ~/.bashrc exist

* fix major_hold download file

* add check add network_speed

* fix check task

* fix check task

* fix analyze_log when ret_key not exist, error_code_info is also not exist.

* fix analyze_log when ret_key not exist, error_code_info is also not exist.

* change find_cmd

* DBA_OB_TASK_OPT_STAT_GATHER_HISTORY. This view has been introduced since version 4.2.0.

* fix check task obld_version format

* fix check task old_version format

* fix check task old_version format

* after downland the file, clear the tmp package file

* fix delete GatherLogOnNode tmp_dir

* add check task

* obstack support aarch64

* obstack support aarch64

* obstack support aarch64

* obstack support aarch64

* obstack support aarch64

* obstack support aarch64
  • Loading branch information
wayyoungboy authored Jan 23, 2025
1 parent 3a4bf65 commit d4966bd
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 12 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,7 @@ jobs:
source activate obdiag
pwd
ls -lh
export RELEASE=`date +%Y%m%d%H%M`
sed -i 's/pip install -r requirements3.txt/curl https:\/\/bootstrap.pypa.io\/get-pip.py -o get-pip.py\n\
python3 get-pip.py\n\
pip3 install -r requirements3.txt/' ./rpm/oceanbase-diagnostic-tool.spec
python3 -m pip install --upgrade pip wheel
cat ./rpm/oceanbase-diagnostic-tool.spec
python3 --version
rpmbuild -bb ./rpm/oceanbase-diagnostic-tool.spec
bash dev_helper.sh pack
- name: Find rpm
run: |
Expand Down
Binary file removed dependencies/bin/obstack_x86_64_7
Binary file not shown.
37 changes: 37 additions & 0 deletions dev_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ WORK_DIR=$(readlink -f "$(dirname ${BASH_SOURCE[0]})")

build_rpm() {
clean_old_rpm_data
download_obstack
export RELEASE=`date +%Y%m%d%H%M`
sed -i 's/pip install -r requirements3.txt/curl https:\/\/bootstrap.pypa.io\/get-pip.py -o get-pip.py\n\
python3 get-pip.py\n\
Expand All @@ -15,6 +16,37 @@ pip3 install -r requirements3.txt/' ./rpm/oceanbase-diagnostic-tool.spec
find ~/rpmbuild -name oceanbase-diagnostic-tool-*.rpm
}

download_obstack() {
echo "check obstack"
mkdir -p ./dependencies/bin
# download obstack
if [ -f ./dependencies/bin/obstack_aarch64 ]; then
echo "obstack_aarch64 exist, skip download"
return
else
echo "downland aarch64 obstack."
obutils_aarch64_url="https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/observer/v4.3.5_CE/oceanbase-ce-utils-4.3.5.0-100000202024123117.el7.aarch64.rpm"
wget ${obutils_aarch64_url} -O ./obutils.rpm
rpm2cpio obutils.rpm | cpio -idv
cp -f ./usr/bin/obstack ./dependencies/bin/obstack_aarch64
rm -rf ./usr
rm -rf obutils.rpm
fi
if [ -f ./dependencies/bin/obstack_x86_64 ]; then
echo "obstack_x86_64 exist, skip download"
return
else
echo "downland x64 obstack."
obutils_x64_url="https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/observer/v4.3.5_CE/oceanbase-ce-utils-4.3.5.0-100000202024123117.el7.x86_64.rpm"
wget ${obutils_x64_url} -O ./obutils.rpm
rpm2cpio obutils.rpm | cpio -idv
cp -f ./usr/bin/obstack ./dependencies/bin/obstack_x86_64
rm -rf ./usr
rm -rf obutils.rpm
fi
}


clean_old_rpm_data() {
rm -rf ./rpmbuild
rm -rf ./build
Expand Down Expand Up @@ -108,6 +140,7 @@ initialize_environment() {
copy_file
check_python_version
install_requirements
download_obstack

source ${WORK_DIR}/rpm/init_obdiag_cmd.sh

Expand All @@ -124,6 +157,7 @@ show_help() {
echo " clean - Clean result files"
echo " init - Initialize dev environment"
echo " format - Format code with black"
echo " download_obstack - Download obstack"
}

format_code() {
Expand All @@ -150,6 +184,9 @@ case "$1" in
format)
format_code
;;
download_obstack)
download_obstack
;;
*)
show_help
;;
Expand Down
2 changes: 1 addition & 1 deletion src/common/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def is_support_arch(ssh_client):
Determine if it is a supported operating system
:return:
"""
support_arch_list = ["i386", "i486", "i586", "alpha", "x86_64"]
support_arch_list = ["i386", "i486", "i586", "alpha", "x86_64", "aarch64"]
cmd = "arch"
try:
arch_info = ssh_client.exec_cmd(cmd)
Expand Down
5 changes: 3 additions & 2 deletions src/common/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ def __setattr__(self, name, value):

const.GATHER_LOG_TEMPORARY_DIR_DEFAULT = "/tmp"

const.OBSTACK2_DEFAULT_INSTALL_PATH = '/tmp/obstack_x86_64_7'
const.OBSTACK2_LOCAL_STORED_PATH = "./dependencies/bin/obstack_x86_64_7"
const.OBSTACK2_DEFAULT_INSTALL_PATH = '/tmp/obstack'
const.OBSTACK2_LOCAL_STORED_PATH_AARCH64 = "./dependencies/bin/obstack_aarch64"
const.OBSTACK2_LOCAL_STORED_PATH_X86_64 = "./dependencies/bin/obstack_x86_64"

# 限制收集任务的并发线程数量 10
const.GATHER_THREADS_LIMIT = 10
Expand Down
11 changes: 10 additions & 1 deletion src/handler/gather/gather_obstack2.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,16 @@ def __handle_from_node(self, local_stored_path, node):
absPath = os.path.dirname(sys.executable)
else:
absPath = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
obstack2_local_stored_full_path = os.path.join(absPath, const.OBSTACK2_LOCAL_STORED_PATH)
# check node is x86_64 or aarch64
node_arch = ssh_client.exec_cmd("arch")
if node_arch == "aarch64":
obstack2_local_stored_full_path = os.path.join(absPath, const.OBSTACK2_LOCAL_STORED_PATH_AARCH64)
elif node_arch == "x86_64":
obstack2_local_stored_full_path = os.path.join(absPath, const.OBSTACK2_LOCAL_STORED_PATH_X86_64)
else:
self.stdio.warn("node:{1} arch {0} not support gather obstack. obdiag will try use x86 obstack".format(node_arch, ssh_client.get_name()))
obstack2_local_stored_full_path = os.path.join(absPath, const.OBSTACK2_LOCAL_STORED_PATH_X86_64)

upload_file(ssh_client, obstack2_local_stored_full_path, const.OBSTACK2_DEFAULT_INSTALL_PATH, self.context.stdio)
self.stdio.verbose("Installation of obstack2 is completed and gather begins ...")

Expand Down

0 comments on commit d4966bd

Please sign in to comment.