From 5f65600da2878f7ca4a7dd5b21bbe1d105f36087 Mon Sep 17 00:00:00 2001 From: james Date: Tue, 14 Jul 2026 15:16:29 +0800 Subject: [PATCH 1/4] fix tools Signed-off-by: james --- tools/openmldb_ops.py | 8 ++++---- tools/tool.py | 42 +++++++++++++++++++++--------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tools/openmldb_ops.py b/tools/openmldb_ops.py index 1c78f53de3f..7e6fc2c4457 100644 --- a/tools/openmldb_ops.py +++ b/tools/openmldb_ops.py @@ -275,7 +275,7 @@ def BalanceInDatabase(executor, endpoints, db): is_leader = True if record[4] == "leader" else False is_alive = True if record[5] == "yes" else False partition = Partition(record[0], record[1], record[2], record[3], is_leader, is_alive, record[6]) - all_dict.setdefault(partition.GetEndpoint(), []); + all_dict.setdefault(partition.GetEndpoint(), []) all_dict[partition.GetEndpoint()].append(partition) endpoint_partition_map.setdefault(partition.GetEndpoint(), set()) endpoint_partition_map[partition.GetEndpoint()].add(partition.GetKey()) @@ -283,13 +283,13 @@ def BalanceInDatabase(executor, endpoints, db): replica_map[partition.GetKey()] += 1 for endpoint in endpoints: if endpoint not in all_dict: - all_dict.setdefault(endpoint, []); + all_dict.setdefault(endpoint, []) endpoint_partition_map.setdefault(endpoint, set()) start_endpoint = random.choice(endpoints) while True: - migrate_out_endpoint = start_endpoint; - migrate_in_endpoint = start_endpoint; + migrate_out_endpoint = start_endpoint + migrate_in_endpoint = start_endpoint for endpoint in endpoints: if len(all_dict[endpoint]) > len(all_dict[migrate_out_endpoint]) : migrate_out_endpoint = endpoint if len(all_dict[endpoint]) < len(all_dict[migrate_in_endpoint]) : migrate_in_endpoint = endpoint diff --git a/tools/tool.py b/tools/tool.py index 4f92f2a4098..61eabe8566b 100644 --- a/tools/tool.py +++ b/tools/tool.py @@ -95,7 +95,7 @@ def __init__(self, openmldb_bin_path, zk_cluster, zk_root_path): def Connect(self): cmd = list(self.ns_base_cmd) cmd.append("--cmd=showns") - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if not status.OK() or status.GetMsg().find("zk client init failed") != -1: return Status(-1, "get ns failed") result = self.ParseResult(output) @@ -108,7 +108,7 @@ def Connect(self): self.endpoint_map[record[0]] = record[0] cmd = list(self.ns_base_cmd) cmd.append("--cmd=showtablet") - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if not status.OK(): return Status(-1, "get tablet failed") result = self.ParseResult(output) @@ -126,7 +126,7 @@ def Connect(self): "--interactive=false"] return Status() - def RunWithRetuncode(self, command, + def RunWithReturncode(self, command, universal_newlines = True, useshell = USE_SHELL, env = os.environ): @@ -147,7 +147,7 @@ def RunWithRetuncode(self, command, def GetNsLeader(self): cmd = list(self.ns_base_cmd) cmd.append("--cmd=showns") - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if status.OK(): result = self.ParseResult(output) for record in result: @@ -175,7 +175,7 @@ def ParseResult(self, output): def GetAutofailover(self): cmd = list(self.ns_base_cmd) cmd.append("--cmd=confget auto_failover") - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if not status.OK(): return status, None if output.find("true") != -1: @@ -185,13 +185,13 @@ def GetAutofailover(self): def SetAutofailover(self, value): cmd = list(self.ns_base_cmd) cmd.append("--cmd=confset auto_failover " + value) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) return status def GetAllDatabase(self): cmd = list(self.ns_base_cmd) cmd.append("--cmd=showdb") - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if not status.OK(): return status, None dbs = [] @@ -205,7 +205,7 @@ def GetTableInfo(self, database, table_name = ''): cmd = list(self.ns_base_cmd) cmd.append("--cmd=showtable " + table_name) cmd.append("--database=" + database) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if not status.OK(): return status, None result = [] @@ -260,7 +260,7 @@ def ParseTableInfoJson(self, table_info): def GetTablePartition(self, database, table_name): status, result = self.GetTableInfo(database, table_name) - if not status.OK: + if not status.OK(): return status, None return self.ParseTableInfo(result) @@ -278,7 +278,7 @@ def GetTableStatus(self, endpoint, tid = '', pid = ''): cmd = list(self.tablet_base_cmd) cmd.append("--endpoint=" + self.endpoint_map[endpoint]) cmd.append("--cmd=gettablestatus " + tid + " " + pid) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if not status.OK(): log.error("gettablestatus failed on " + str(cmd)) return status, None @@ -296,7 +296,7 @@ def GetTableStatus(self, endpoint, tid = '', pid = ''): def ShowTableStatus(self, pattern = '%'): cmd = list(self.sql_base_cmd) cmd.append("--cmd=show table status like '{pattern}';".format(pattern = pattern)) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if not status.OK(): log.error("show table status failed") return status, None @@ -352,7 +352,7 @@ def GetLeaderFollowerOffset(self, endpoint, tid, pid): cmd = list(self.tablet_base_cmd) cmd.append("--endpoint=" + self.endpoint_map[endpoint]) cmd.append("--cmd=getfollower {} {}".format(tid, pid)) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if not status.OK(): return status return Status(), self.ParseResult(output) @@ -361,7 +361,7 @@ def RecoverTablePartition(self, database, name, pid, endpoint, sync = False): cmd = list(self.ns_base_cmd) cmd.append("--cmd=recovertable {} {} {}".format(name, pid, endpoint)) cmd.append("--database=" + database) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if status.OK() and output.find("recover table ok") != -1: if sync and not self.WaitingOP(database, name, pid).OK(): return Status(-1, "recovertable failed") @@ -374,7 +374,7 @@ def UpdateTableAlive(self, database, name, pid, endpoint, is_alive): cmd = list(self.ns_base_cmd) cmd.append("--cmd=updatetablealive {} {} {} {}".format(name, pid, endpoint, is_alive)) cmd.append("--database=" + database) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if status.OK() and output.find("update ok") != -1: return Status() return Status(-1, "update table alive failed") @@ -383,7 +383,7 @@ def ChangeLeader(self, database, name, pid, endpoint = "auto", sync = False): cmd = list(self.ns_base_cmd) cmd.append("--cmd=changeleader {} {} {}".format(name, pid, endpoint)) cmd.append("--database=" + database) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if status.OK() and sync and not self.WaitingOP(database, name, pid).OK(): return Status(-1, "changer leader failed") return status @@ -392,7 +392,7 @@ def ShowOpStatus(self, database, name = '', pid = ''): cmd = list(self.ns_base_cmd) cmd.append("--cmd=showopstatus {} {} ".format(name, pid)) cmd.append("--database=" + database) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if not status.OK(): return status, None return Status(), self.ParseResult(output) @@ -401,7 +401,7 @@ def CancelOp(self, database, op_id): cmd = list(self.ns_base_cmd) cmd.append("--cmd=cancelop {}".format(op_id)) cmd.append("--database=" + database) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) return status def Migrate(self, database, name, pid, src_endpoint, desc_endpoint, sync = False): @@ -410,7 +410,7 @@ def Migrate(self, database, name, pid, src_endpoint, desc_endpoint, sync = False cmd = list(self.ns_base_cmd) cmd.append("--cmd=migrate {} {} {} {}".format(src_endpoint, name, pid, desc_endpoint)) cmd.append("--database=" + database) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if status.OK() and output.find("migrate ok") != -1: if sync and not self.WaitingOP(database, name, pid).OK(): return Status(-1, "migrate failed") @@ -420,7 +420,7 @@ def Migrate(self, database, name, pid, src_endpoint, desc_endpoint, sync = False def ShowTablet(self): cmd = list(self.ns_base_cmd) cmd.append("--cmd=showtablet") - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if not status.OK(): return status, None return Status(), self.ParseResult(output) @@ -429,7 +429,7 @@ def AddReplica(self, database, name, pid, endpoint, sync = False): cmd = list(self.ns_base_cmd) cmd.append("--cmd=addreplica {} {} {}".format(name, pid, endpoint)) cmd.append("--database=" + database) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if status.OK() and output.find("ok") != -1: if sync and not self.WaitingOP(database, name, pid).OK(): return Status(-1, "addreplica failed") @@ -440,7 +440,7 @@ def DelReplica(self, database, name, pid, endpoint, sync = False): cmd = list(self.ns_base_cmd) cmd.append("--cmd=delreplica {} {} {}".format(name, pid, endpoint)) cmd.append("--database=" + database) - status, output = self.RunWithRetuncode(cmd) + status, output = self.RunWithReturncode(cmd) if status.OK() and output.find("ok") != -1: if sync and not self.WaitingOP(database, name, pid).OK(): return Status(-1, "delreplica failed") From 896074169229ccd9cc1d38aac72c91b007756484 Mon Sep 17 00:00:00 2001 From: james Date: Tue, 21 Jul 2026 14:24:38 +0800 Subject: [PATCH 2/4] set safe.directory Signed-off-by: james --- .github/workflows/openmldb-tool.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/openmldb-tool.yml b/.github/workflows/openmldb-tool.yml index 3932b4c47f8..27ca819124a 100644 --- a/.github/workflows/openmldb-tool.yml +++ b/.github/workflows/openmldb-tool.yml @@ -73,6 +73,7 @@ jobs: apt-get update && apt-get install -y rsync - name: install openmldb run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" git fetch --tags --force VERSION=$(git describe --always --tags `git rev-list --tags --max-count=1`) VERSION=${VERSION#v} From 2e42dc2575cab73280baafb0a5ef895f278e901d Mon Sep 17 00:00:00 2001 From: james Date: Tue, 21 Jul 2026 14:32:57 +0800 Subject: [PATCH 3/4] fix package name Signed-off-by: james --- test/test-tool/openmldb-deploy/install.sh | 2 +- test/test-tool/openmldb-deploy/install_with_name.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-tool/openmldb-deploy/install.sh b/test/test-tool/openmldb-deploy/install.sh index a75cc21fec1..aafb4aa2bc4 100644 --- a/test/test-tool/openmldb-deploy/install.sh +++ b/test/test-tool/openmldb-deploy/install.sh @@ -21,7 +21,7 @@ if [[ -z ${VERSION} ]]; then VERSION=0.7.2 fi echo "version: ${VERSION}" -curl -SLo openmldb.tar.gz "https://github.com/4paradigm/OpenMLDB/releases/download/v${VERSION}/openmldb-${VERSION}-linux.tar.gz" +curl -SLo openmldb.tar.gz "https://github.com/4paradigm/OpenMLDB/releases/download/v${VERSION}/openmldb-${VERSION}-linux-x86_64.tar.gz" mkdir -p "openmldb" tar xzf openmldb.tar.gz -C "openmldb" --strip-components 1 pushd "openmldb" diff --git a/test/test-tool/openmldb-deploy/install_with_name.sh b/test/test-tool/openmldb-deploy/install_with_name.sh index a1525767a36..fc89fe3e507 100644 --- a/test/test-tool/openmldb-deploy/install_with_name.sh +++ b/test/test-tool/openmldb-deploy/install_with_name.sh @@ -21,7 +21,7 @@ if [[ -z ${VERSION} ]]; then VERSION=0.7.2 fi echo "version: ${VERSION}" -curl -SLo openmldb.tar.gz "https://github.com/4paradigm/OpenMLDB/releases/download/v${VERSION}/openmldb-${VERSION}-linux.tar.gz" +curl -SLo openmldb.tar.gz "https://github.com/4paradigm/OpenMLDB/releases/download/v${VERSION}/openmldb-${VERSION}-linux-x86_64.tar.gz" mkdir -p "openmldb" tar xzf openmldb.tar.gz -C "openmldb" --strip-components 1 pushd "openmldb" From 778360aea4af5d3222e0da6f216b027931b3a927 Mon Sep 17 00:00:00 2001 From: james Date: Tue, 21 Jul 2026 14:45:09 +0800 Subject: [PATCH 4/4] fix bash Signed-off-by: james --- .github/workflows/openmldb-tool.yml | 2 +- test/test-tool/openmldb-deploy/install_with_name.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/openmldb-tool.yml b/.github/workflows/openmldb-tool.yml index 27ca819124a..b4d191e69a5 100644 --- a/.github/workflows/openmldb-tool.yml +++ b/.github/workflows/openmldb-tool.yml @@ -81,7 +81,7 @@ jobs: - name: run test run: | cp -f tools/tool.py test/test-tool/openmldb-deploy/cases/ - cp -f tools/* openmldb/tools/ + cp -rf tools/* openmldb/tools/ python3 -m pytest test/test-tool/openmldb-deploy/cases --junit-xml=pytest.xml - name: clear env run: | diff --git a/test/test-tool/openmldb-deploy/install_with_name.sh b/test/test-tool/openmldb-deploy/install_with_name.sh index fc89fe3e507..5403c16302f 100644 --- a/test/test-tool/openmldb-deploy/install_with_name.sh +++ b/test/test-tool/openmldb-deploy/install_with_name.sh @@ -32,7 +32,7 @@ rm -f bin/*.sh /bin/cp -f ../test/test-tool/openmldb-deploy/hosts conf/hosts sed -i"" -e "s/OPENMLDB_VERSION=[0-9]\.[0-9]\.[0-9]/OPENMLDB_VERSION=${VERSION}/g" conf/openmldb-env.sh -sh sbin/deploy-all.sh +bash sbin/deploy-all.sh for (( i=0; i<=2; i++ )) do @@ -53,7 +53,7 @@ do echo "--use_name=true" >> ${conf_file} done -sh sbin/start-all.sh +bash sbin/start-all.sh popd pushd test/test-tool/openmldb-deploy