From f4774273ee258f74528cbf862401a4b9ed2170ab Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Thu, 13 Feb 2025 10:12:36 +0800 Subject: [PATCH 01/11] enh: unified oem --version output --- tests/army/tools/benchmark/basic/commandline.py | 2 -- tests/army/tools/taosdump/ws/taosdumpEscapedDb.py | 1 - tools/taos-tools/src/benchCommandOpt.c | 2 +- tools/taos-tools/src/taosdump.c | 2 +- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/army/tools/benchmark/basic/commandline.py b/tests/army/tools/benchmark/basic/commandline.py index 0a60e1f876..6fb26364b7 100644 --- a/tests/army/tools/benchmark/basic/commandline.py +++ b/tests/army/tools/benchmark/basic/commandline.py @@ -35,8 +35,6 @@ class TDTestCase(TBase): tdLog.exit(f"checkVersion return lines count {len(outputs) != 3}") # version string len assert len(outputs[0]) > 27 - assert outputs[0][:22] == "taosBenchmark version:" - # commit id assert len(outputs[1]) > 43 assert outputs[1][:4] == "git:" diff --git a/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py b/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py index 6c535f794e..f9a0e31258 100644 --- a/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py +++ b/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py @@ -35,7 +35,6 @@ class TDTestCase(TBase): tdLog.exit(f"checkVersion return lines count {len(outputs) != 3}") # version string len assert len(outputs[0]) > 22 - assert outputs[0][:17] == "taosdump version:" # commit id assert len(outputs[1]) > 43 assert outputs[1][:4] == "git:" diff --git a/tools/taos-tools/src/benchCommandOpt.c b/tools/taos-tools/src/benchCommandOpt.c index 1968a731f5..1c072e0105 100644 --- a/tools/taos-tools/src/benchCommandOpt.c +++ b/tools/taos-tools/src/benchCommandOpt.c @@ -29,7 +29,7 @@ char *g_aggreFunc[] = {"*", "count(*)", "avg(C0)", "sum(C0)", void printVersion() { // version, macro define in src/CMakeLists.txt - printf("taosBenchmark version: %s\n", TD_VER_NUMBER); + printf("%s\n%sBenchmark version: %s\n", TD_PRODUCT_NAME, CUS_PROMPT, TD_VER_NUMBER); printf("git: %s\n", TAOSBENCHMARK_COMMIT_ID); printf("build: %s\n", BUILD_INFO); } diff --git a/tools/taos-tools/src/taosdump.c b/tools/taos-tools/src/taosdump.c index 8593752265..abe885054b 100644 --- a/tools/taos-tools/src/taosdump.c +++ b/tools/taos-tools/src/taosdump.c @@ -262,7 +262,7 @@ static void printVersion(FILE *file) { } // version, macro define in src/CMakeLists.txt - fprintf(file, "taosdump version: %s\n", TD_VER_NUMBER); + fprintf(file, "%s\n%sdump version: %s\n", TD_PRODUCT_NAME, CUS_PROMPT, TD_VER_NUMBER); fprintf(file, "git: %s\n", TAOSDUMP_COMMIT_ID); fprintf(file, "build: %s\n", BUILD_INFO); } From 400254820cf1b20423d5e25cd3dcab007403c0a5 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Thu, 13 Feb 2025 13:00:46 +0800 Subject: [PATCH 02/11] fix: remove cur_name.h content to tdef.h and del cur_name.h --- include/os/osDir.h | 3 --- include/util/cus_name.h | 31 -------------------------- include/util/tdef.h | 17 ++++++++++++++ source/client/src/clientEnv.c | 3 --- source/common/src/tglobal.c | 3 --- source/dnode/mgmt/exe/dmMain.c | 16 +------------ source/os/src/osSysinfo.c | 7 ------ tools/shell/src/shellArguments.c | 7 ------ tools/taos-tools/inc/dump.h | 17 +------------- tools/taos-tools/src/benchCommandOpt.c | 3 ++- tools/taos-tools/src/benchSys.c | 16 ------------- tools/taos-tools/src/taosdump.c | 1 + 12 files changed, 22 insertions(+), 102 deletions(-) delete mode 100644 include/util/cus_name.h diff --git a/include/os/osDir.h b/include/os/osDir.h index c0d8530b4f..351275113c 100644 --- a/include/os/osDir.h +++ b/include/os/osDir.h @@ -31,9 +31,6 @@ extern "C" { #endif -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) -#include "cus_name.h" -#endif #ifdef WINDOWS diff --git a/include/util/cus_name.h b/include/util/cus_name.h deleted file mode 100644 index 16f677f855..0000000000 --- a/include/util/cus_name.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#ifndef _CUS_NAME_H_ -#define _CUS_NAME_H_ - -#ifndef CUS_NAME -#define CUS_NAME "TDengine" -#endif - -#ifndef CUS_PROMPT -#define CUS_PROMPT "taos" -#endif - -#ifndef CUS_EMAIL -#define CUS_EMAIL "" -#endif - -#endif // _CUS_NAME_H_ diff --git a/include/util/tdef.h b/include/util/tdef.h index f08697b0d4..0b722bfeb2 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -79,6 +79,10 @@ extern const int32_t TYPE_BYTES[21]; #define TSDB_DEFAULT_PASS "taosdata" #endif + +// +// support OEM +// #ifndef TD_PRODUCT_NAME #ifdef TD_ENTERPRISE #define TD_PRODUCT_NAME "TDengine Enterprise Edition" @@ -87,6 +91,19 @@ extern const int32_t TYPE_BYTES[21]; #endif #endif +#ifndef CUS_NAME +#define CUS_NAME "TDengine" +#endif + +#ifndef CUS_PROMPT +#define CUS_PROMPT "taos" +#endif + +#ifndef CUS_EMAIL +#define CUS_EMAIL "" +#endif + + #define TSDB_TRUE 1 #define TSDB_FALSE 0 #define TSDB_OK 0 diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index b69585a356..e9381a1096 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -38,9 +38,6 @@ #include "tversion.h" #include "tconv.h" -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) -#include "cus_name.h" -#endif #ifndef CUS_PROMPT #define CUS_PROMPT "taos" diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 562256f311..223418feed 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -28,9 +28,6 @@ #include "tutil.h" -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) -#include "cus_name.h" -#endif #define CONFIG_PATH_LEN (TSDB_FILENAME_LEN + 12) #define CONFIG_FILE_LEN (CONFIG_PATH_LEN + 32) diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index b5eeb78b5e..edc15da02c 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -27,22 +27,8 @@ #include "dmUtil.h" #include "tcs.h" #include "qworker.h" +#include "tdef.h" -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) -#include "cus_name.h" -#else -#ifndef CUS_NAME -#define CUS_NAME "TDengine" -#endif - -#ifndef CUS_PROMPT -#define CUS_PROMPT "taos" -#endif - -#ifndef CUS_EMAIL -#define CUS_EMAIL "" -#endif -#endif // clang-format off #define DM_APOLLO_URL "The apollo string to use when configuring the server, such as: -a 'jsonFile:./tests/cfg.json', cfg.json text can be '{\"fqdn\":\"td1\"}'." #define DM_CFG_DIR "Configuration directory." diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 526f1a33e4..d101c6b6d9 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -17,13 +17,6 @@ #include "os.h" #include "taoserror.h" -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) -#include "cus_name.h" -#else -#ifndef CUS_PROMPT -#define CUS_PROMPT "taos" -#endif -#endif #define PROCESS_ITEM 12 #define UUIDLEN37 37 diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 88918a14ac..997c6485ea 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -20,13 +20,6 @@ #include "shellInt.h" #include "version.h" -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) -#include "cus_name.h" -#else -#ifndef CUS_PROMPT -#define CUS_PROMPT "taos" -#endif -#endif #define TAOS_CONSOLE_PROMPT_CONTINUE " -> " diff --git a/tools/taos-tools/inc/dump.h b/tools/taos-tools/inc/dump.h index 1050676af3..d08da38ee7 100644 --- a/tools/taos-tools/inc/dump.h +++ b/tools/taos-tools/inc/dump.h @@ -38,6 +38,7 @@ #include #include +#include #include #ifdef WEBSOCKET @@ -49,22 +50,6 @@ // ---------------- define ---------------- // -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) -#include -#else -#ifndef CUS_NAME - #define CUS_NAME "TDengine" -#endif - -#ifndef CUS_PROMPT - #define CUS_PROMPT "taos" -#endif - -#ifndef CUS_EMAIL - #define CUS_EMAIL "" -#endif -#endif - // use 256 as normal buffer length #define BUFFER_LEN 256 diff --git a/tools/taos-tools/src/benchCommandOpt.c b/tools/taos-tools/src/benchCommandOpt.c index 1c072e0105..d62e2712c1 100644 --- a/tools/taos-tools/src/benchCommandOpt.c +++ b/tools/taos-tools/src/benchCommandOpt.c @@ -10,7 +10,8 @@ * FITNESS FOR A PARTICULAR PURPOSE. */ -#include + #include // include/util/ + #include #include "benchLog.h" #include diff --git a/tools/taos-tools/src/benchSys.c b/tools/taos-tools/src/benchSys.c index 1a229f2cbd..4e512a5e72 100644 --- a/tools/taos-tools/src/benchSys.c +++ b/tools/taos-tools/src/benchSys.c @@ -21,23 +21,7 @@ #endif #endif -extern char version[]; -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) -#include "cus_name.h" -#else -#ifndef CUS_NAME -#define CUS_NAME "TDengine" -#endif - -#ifndef CUS_PROMPT -#define CUS_PROMPT "taos" -#endif - -#ifndef CUS_EMAIL -#define CUS_EMAIL "" -#endif -#endif #ifdef WINDOWS char g_configDir[MAX_PATH_LEN] = {0}; // "C:\\TDengine\\cfg"}; diff --git a/tools/taos-tools/src/taosdump.c b/tools/taos-tools/src/taosdump.c index abe885054b..43c9f3a0aa 100644 --- a/tools/taos-tools/src/taosdump.c +++ b/tools/taos-tools/src/taosdump.c @@ -11,6 +11,7 @@ #define _GNU_SOURCE +#include // include/util/ #include "dump.h" #include "dumpUtil.h" #ifdef WEBSOCKET From 22ca66b25cac35f13f4113bddb739c56dd4ffeed Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Thu, 13 Feb 2025 13:16:39 +0800 Subject: [PATCH 03/11] fix: restore cur_name.h --- include/os/osDir.h | 1 + include/util/cus_name.h | 42 ++++++++++++++++++++++++++ include/util/tdef.h | 26 +--------------- source/client/src/clientEnv.c | 4 +-- source/dnode/mgmt/exe/dmMain.c | 2 +- source/os/src/osSysinfo.c | 2 +- tools/shell/src/shellArguments.c | 1 + tools/taos-tools/src/benchCommandOpt.c | 2 +- tools/taos-tools/src/taosdump.c | 2 +- 9 files changed, 50 insertions(+), 32 deletions(-) create mode 100644 include/util/cus_name.h diff --git a/include/os/osDir.h b/include/os/osDir.h index 351275113c..99d3ebccde 100644 --- a/include/os/osDir.h +++ b/include/os/osDir.h @@ -31,6 +31,7 @@ extern "C" { #endif +#include "cus_name.h" #ifdef WINDOWS diff --git a/include/util/cus_name.h b/include/util/cus_name.h new file mode 100644 index 0000000000..fe05491742 --- /dev/null +++ b/include/util/cus_name.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _CUS_NAME_H_ +#define _CUS_NAME_H_ + +// +// support OEM +// +#ifndef TD_PRODUCT_NAME +#ifdef TD_ENTERPRISE +#define TD_PRODUCT_NAME "TDengine Enterprise Edition" +#else +#define TD_PRODUCT_NAME "TDengine Community Edition" +#endif +#endif + +#ifndef CUS_NAME +#define CUS_NAME "TDengine" +#endif + +#ifndef CUS_PROMPT +#define CUS_PROMPT "taos" +#endif + +#ifndef CUS_EMAIL +#define CUS_EMAIL "" +#endif + +#endif // _CUS_NAME_H_ diff --git a/include/util/tdef.h b/include/util/tdef.h index 0b722bfeb2..ccc4a6bafc 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -17,6 +17,7 @@ #define _TD_UTIL_DEF_H_ #include "os.h" +#include "cur_name.h" #ifdef __cplusplus extern "C" { @@ -79,31 +80,6 @@ extern const int32_t TYPE_BYTES[21]; #define TSDB_DEFAULT_PASS "taosdata" #endif - -// -// support OEM -// -#ifndef TD_PRODUCT_NAME -#ifdef TD_ENTERPRISE -#define TD_PRODUCT_NAME "TDengine Enterprise Edition" -#else -#define TD_PRODUCT_NAME "TDengine Community Edition" -#endif -#endif - -#ifndef CUS_NAME -#define CUS_NAME "TDengine" -#endif - -#ifndef CUS_PROMPT -#define CUS_PROMPT "taos" -#endif - -#ifndef CUS_EMAIL -#define CUS_EMAIL "" -#endif - - #define TSDB_TRUE 1 #define TSDB_FALSE 0 #define TSDB_OK 0 diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index e9381a1096..0d4af75d04 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -39,9 +39,7 @@ #include "tconv.h" -#ifndef CUS_PROMPT -#define CUS_PROMPT "taos" -#endif +#include "cus_name.h" #define TSC_VAR_NOT_RELEASE 1 #define TSC_VAR_RELEASED 0 diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index edc15da02c..51e4d86acb 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -27,7 +27,7 @@ #include "dmUtil.h" #include "tcs.h" #include "qworker.h" -#include "tdef.h" +#include "cus_name.h" // clang-format off #define DM_APOLLO_URL "The apollo string to use when configuring the server, such as: -a 'jsonFile:./tests/cfg.json', cfg.json text can be '{\"fqdn\":\"td1\"}'." diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index d101c6b6d9..6cb0e00b82 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -16,7 +16,7 @@ #define _DEFAULT_SOURCE #include "os.h" #include "taoserror.h" - +#include "cus_name.h" #define PROCESS_ITEM 12 #define UUIDLEN37 37 diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 997c6485ea..ba210850eb 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -17,6 +17,7 @@ #include #endif +#include "cus_name.h" #include "shellInt.h" #include "version.h" diff --git a/tools/taos-tools/src/benchCommandOpt.c b/tools/taos-tools/src/benchCommandOpt.c index d62e2712c1..8c18b54eac 100644 --- a/tools/taos-tools/src/benchCommandOpt.c +++ b/tools/taos-tools/src/benchCommandOpt.c @@ -10,7 +10,7 @@ * FITNESS FOR A PARTICULAR PURPOSE. */ - #include // include/util/ + #include "cus_name.h" // include/util/ #include #include "benchLog.h" #include diff --git a/tools/taos-tools/src/taosdump.c b/tools/taos-tools/src/taosdump.c index 43c9f3a0aa..d27812b67a 100644 --- a/tools/taos-tools/src/taosdump.c +++ b/tools/taos-tools/src/taosdump.c @@ -11,7 +11,7 @@ #define _GNU_SOURCE -#include // include/util/ +#include "cus_name.h" // include/util/ #include "dump.h" #include "dumpUtil.h" #ifdef WEBSOCKET From 8d9539f86ece855dade3e3df1f09ec910171b4e1 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Thu, 13 Feb 2025 13:33:38 +0800 Subject: [PATCH 04/11] fix: adjust ci case for four lines version output --- include/util/tdef.h | 2 +- tests/army/tools/benchmark/basic/commandline.py | 12 ++++++------ tests/army/tools/taosdump/ws/taosdumpEscapedDb.py | 12 ++++++------ tools/taos-tools/inc/dump.h | 1 - tools/taos-tools/src/benchSys.c | 1 + 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index ccc4a6bafc..6d346290bc 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -17,7 +17,7 @@ #define _TD_UTIL_DEF_H_ #include "os.h" -#include "cur_name.h" +#include "cus_name.h" #ifdef __cplusplus extern "C" { diff --git a/tests/army/tools/benchmark/basic/commandline.py b/tests/army/tools/benchmark/basic/commandline.py index 6fb26364b7..f7cd36d9f6 100644 --- a/tests/army/tools/benchmark/basic/commandline.py +++ b/tests/army/tools/benchmark/basic/commandline.py @@ -31,16 +31,16 @@ class TDTestCase(TBase): # run outputs = etool.runBinFile("taosBenchmark", "-V") print(outputs) - if len(outputs) != 3: + if len(outputs) != 4: tdLog.exit(f"checkVersion return lines count {len(outputs) != 3}") # version string len - assert len(outputs[0]) > 27 + assert len(outputs[1]) > 24 # commit id - assert len(outputs[1]) > 43 - assert outputs[1][:4] == "git:" + assert len(outputs[2]) > 43 + assert outputs[2][:4] == "git:" # build info - assert len(outputs[2]) > 36 - assert outputs[2][:6] == "build:" + assert len(outputs[3]) > 36 + assert outputs[3][:6] == "build:" tdLog.info("check taosBenchmark version successfully.") diff --git a/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py b/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py index f9a0e31258..982cd18002 100644 --- a/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py +++ b/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py @@ -31,16 +31,16 @@ class TDTestCase(TBase): # run outputs = etool.runBinFile("taosdump", "-V") print(outputs) - if len(outputs) != 3: + if len(outputs) != 4: tdLog.exit(f"checkVersion return lines count {len(outputs) != 3}") # version string len - assert len(outputs[0]) > 22 + assert len(outputs[1]) > 19 # commit id - assert len(outputs[1]) > 43 - assert outputs[1][:4] == "git:" + assert len(outputs[2]) > 43 + assert outputs[2][:4] == "git:" # build info - assert len(outputs[2]) > 36 - assert outputs[2][:6] == "build:" + assert len(outputs[3]) > 36 + assert outputs[3][:6] == "build:" tdLog.info("check taosdump version successfully.") diff --git a/tools/taos-tools/inc/dump.h b/tools/taos-tools/inc/dump.h index d08da38ee7..b21dca4343 100644 --- a/tools/taos-tools/inc/dump.h +++ b/tools/taos-tools/inc/dump.h @@ -38,7 +38,6 @@ #include #include -#include #include #ifdef WEBSOCKET diff --git a/tools/taos-tools/src/benchSys.c b/tools/taos-tools/src/benchSys.c index 4e512a5e72..9e29701515 100644 --- a/tools/taos-tools/src/benchSys.c +++ b/tools/taos-tools/src/benchSys.c @@ -12,6 +12,7 @@ #include #include #include "benchLog.h" +#include "cus_name.h" #ifdef LINUX #include From ea7be4bbc23ece74badf10bcc10cfd98a1bcad1e Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 14 Feb 2025 13:04:03 +0800 Subject: [PATCH 05/11] fix: enable CUS_NAME CUS_PROMPT CUS_EMAIL macro --- cmake/cmake.version | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmake/cmake.version b/cmake/cmake.version index ad78dbbc1e..15ef4833be 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -15,6 +15,18 @@ IF (TD_PRODUCT_NAME) ADD_DEFINITIONS(-DTD_PRODUCT_NAME="${TD_PRODUCT_NAME}") ENDIF () +IF (CUS_NAME) + ADD_DEFINITIONS(-DCUS_NAME="${CUS_NAME}") +ENDIF () + +IF (CUS_PROMPT) + ADD_DEFINITIONS(-DCUS_PROMPT="${CUS_PROMPT}") +ENDIF () + +IF (CUS_EMAIL) + ADD_DEFINITIONS(-DCUS_EMAIL="${CUS_EMAIL}") + + find_program(HAVE_GIT NAMES git) IF (DEFINED GITINFO) From 89d5444ed13955598624cb392a21c3fe99c5dd9b Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 14 Feb 2025 14:46:19 +0800 Subject: [PATCH 06/11] fix(stream): access value after null ptr check. --- source/libs/stream/src/streamMeta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index c2a758f490..7482c6229b 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -573,11 +573,11 @@ void streamMetaClear(SStreamMeta* pMeta) { } void streamMetaClose(SStreamMeta* pMeta) { - stDebug("vgId:%d start to close stream meta", pMeta->vgId); if (pMeta == NULL) { return; } + stDebug("vgId:%d start to close stream meta", pMeta->vgId); int32_t code = taosRemoveRef(streamMetaRefPool, pMeta->rid); if (code) { stError("vgId:%d failed to remove meta ref:%" PRId64 ", code:%s", pMeta->vgId, pMeta->rid, tstrerror(code)); From 0a101fc3c15caae89561f5bcfdafa616a9ea80f2 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 15 Feb 2025 00:05:24 +0800 Subject: [PATCH 07/11] fix(stream): add missing release --- source/dnode/vnode/src/tqCommon/tqCommon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index a73d7f849c..e9eda68cb3 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -1225,6 +1225,7 @@ int32_t tqStreamTaskProcessTaskResumeReq(void* handle, int64_t sversion, char* m streamMetaReleaseTask(pMeta, pHTask); } + streamMetaReleaseTask(pMeta, pTask); return TSDB_CODE_SUCCESS; } From eab2e60d75d0f1345d0a36ba943ac70b07fe0b75 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 15 Feb 2025 09:55:19 +0800 Subject: [PATCH 08/11] fix: lost ENDIF in make.version --- cmake/cmake.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/cmake.version b/cmake/cmake.version index 15ef4833be..52730e84e5 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -25,7 +25,7 @@ ENDIF () IF (CUS_EMAIL) ADD_DEFINITIONS(-DCUS_EMAIL="${CUS_EMAIL}") - +ENDIF () find_program(HAVE_GIT NAMES git) From 981e8e1101e456dcd4d263e538e0dddb5f8ee2e9 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sun, 16 Feb 2025 20:48:51 +0800 Subject: [PATCH 09/11] fix: log informat modify --- tests/army/tools/benchmark/basic/commandline.py | 2 +- tests/army/tools/taosdump/ws/taosdumpEscapedDb.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/army/tools/benchmark/basic/commandline.py b/tests/army/tools/benchmark/basic/commandline.py index f7cd36d9f6..94b812aed0 100644 --- a/tests/army/tools/benchmark/basic/commandline.py +++ b/tests/army/tools/benchmark/basic/commandline.py @@ -32,7 +32,7 @@ class TDTestCase(TBase): outputs = etool.runBinFile("taosBenchmark", "-V") print(outputs) if len(outputs) != 4: - tdLog.exit(f"checkVersion return lines count {len(outputs) != 3}") + tdLog.exit(f"checkVersion return lines count {len(outputs)} != 4") # version string len assert len(outputs[1]) > 24 # commit id diff --git a/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py b/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py index 982cd18002..f1bee5bab4 100644 --- a/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py +++ b/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py @@ -32,7 +32,7 @@ class TDTestCase(TBase): outputs = etool.runBinFile("taosdump", "-V") print(outputs) if len(outputs) != 4: - tdLog.exit(f"checkVersion return lines count {len(outputs) != 3}") + tdLog.exit(f"checkVersion return lines count {len(outputs)} != 4") # version string len assert len(outputs[1]) > 19 # commit id From acf6a6e9666c47c2812eb2894a02ec0f78c4eb7a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 17 Feb 2025 11:30:46 +0800 Subject: [PATCH 10/11] fix: compile error in lower gcc version --- source/os/src/osTimer.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/source/os/src/osTimer.c b/source/os/src/osTimer.c index fe3a0dcf95..98cbd968fc 100644 --- a/source/os/src/osTimer.c +++ b/source/os/src/osTimer.c @@ -78,11 +78,6 @@ void taos_block_sigalrm(void) { #include #include -static void taosDeleteTimer(void *tharg) { - timer_t *pTimer = tharg; - TAOS_SKIP_ERROR(timer_delete(*pTimer)); -} - static TdThread timerThread; static timer_t timerId; static volatile bool stopTimer = false; @@ -110,12 +105,10 @@ static void *taosProcessAlarmSignal(void *tharg) { sevent.sigev_signo = SIGALRM; if (timer_create(CLOCK_REALTIME, &sevent, &timerId) == -1) { - terrno = TAOS_SYSTEM_ERROR(errno); - return NULL; + terrno = TAOS_SYSTEM_ERROR(errno); + return NULL; } - taosThreadCleanupPush(taosDeleteTimer, &timerId); - do { struct itimerspec ts; ts.it_value.tv_sec = 0; @@ -128,7 +121,7 @@ static void *taosProcessAlarmSignal(void *tharg) { break; } - int signo; + int signo; int32_t code = 0; while (!stopTimer) { code = sigwait(&sigset, &signo); @@ -141,7 +134,7 @@ static void *taosProcessAlarmSignal(void *tharg) { } } while (0); - taosThreadCleanupPop(1); + timer_delete(timerId); return NULL; } From bf3e10c36e2aca09eb5d72fbec1eadcba696e00f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 17 Feb 2025 11:42:10 +0800 Subject: [PATCH 11/11] fix: compile errors --- source/os/src/osTimer.c | 12 +++++++++++- tools/shell/src/shellEngine.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/source/os/src/osTimer.c b/source/os/src/osTimer.c index 98cbd968fc..12a43925cd 100644 --- a/source/os/src/osTimer.c +++ b/source/os/src/osTimer.c @@ -78,10 +78,17 @@ void taos_block_sigalrm(void) { #include #include +static void taosDeleteTimer(void *tharg) { + timer_t *pTimer = tharg; + TAOS_SKIP_ERROR(timer_delete(*pTimer)); +} + static TdThread timerThread; static timer_t timerId; static volatile bool stopTimer = false; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" static void *taosProcessAlarmSignal(void *tharg) { // Block the signal sigset_t sigset; @@ -109,6 +116,8 @@ static void *taosProcessAlarmSignal(void *tharg) { return NULL; } + taosThreadCleanupPush(taosDeleteTimer, &timerId); + do { struct itimerspec ts; ts.it_value.tv_sec = 0; @@ -134,10 +143,11 @@ static void *taosProcessAlarmSignal(void *tharg) { } } while (0); - timer_delete(timerId); + taosThreadCleanupPop(1); return NULL; } +#pragma GCC diagnostic pop #endif int taosInitTimer(void (*callback)(int), int ms) { diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 37da47bae6..ebec4ca06c 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -1267,6 +1267,9 @@ void *shellCancelHandler(void *arg) { return NULL; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" + void *shellThreadLoop(void *arg) { setThreadName("shellThreadLoop"); taosGetOldTerminalMode(); @@ -1298,6 +1301,7 @@ void *shellThreadLoop(void *arg) { taosThreadCleanupPop(1); return NULL; } +#pragma GCC diagnostic pop int32_t shellExecute() { printf(shell.info.clientVersion, shell.info.cusName, taos_get_client_info(), shell.info.cusName);