diff --git a/cmake/cmake.define b/cmake/cmake.define
index 10f2172541..5b65738c70 100644
--- a/cmake/cmake.define
+++ b/cmake/cmake.define
@@ -121,7 +121,7 @@ ELSE ()
MESSAGE(STATUS "Compile with Address Sanitizer!")
ELSE ()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -g3 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-reserved-user-defined-literal -Wno-literal-suffix -Werror=return-type -fPIC -gdwarf-2 -g3 -Wformat=2 -Wno-format-nonliteral -Wno-format-truncation -Wno-format-y2k")
ENDIF ()
# disable all assert
diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in
index 1c401ae80e..b2f335e1f7 100644
--- a/cmake/taosadapter_CMakeLists.txt.in
+++ b/cmake/taosadapter_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taosadapter
ExternalProject_Add(taosadapter
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
- GIT_TAG d8059ff
+ GIT_TAG cb1e89c
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in
index 3f7a43ab2d..aef89a2d42 100644
--- a/cmake/taostools_CMakeLists.txt.in
+++ b/cmake/taostools_CMakeLists.txt.in
@@ -2,7 +2,7 @@
# taos-tools
ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
- GIT_TAG e82b9fc
+ GIT_TAG d194dc9
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
diff --git a/docs/en/14-reference/14-taosKeeper.md b/docs/en/14-reference/14-taosKeeper.md
index 3c91cc15b3..895bd82e19 100644
--- a/docs/en/14-reference/14-taosKeeper.md
+++ b/docs/en/14-reference/14-taosKeeper.md
@@ -202,3 +202,20 @@ taos_cluster_info_dnodes_total{cluster_id="5981392874047724755"} 1
# TYPE taos_cluster_info_first_ep gauge
taos_cluster_info_first_ep{cluster_id="5981392874047724755",value="hlb:6030"} 1
```
+
+### check_health
+
+```
+$ curl -i http://127.0.0.1:6043/check_health
+```
+
+Response:
+
+```
+HTTP/1.1 200 OK
+Content-Type: application/json; charset=utf-8
+Date: Mon, 03 Apr 2023 07:20:38 GMT
+Content-Length: 19
+
+{"version":"1.0.0"}
+```
diff --git a/docs/en/20-third-party/01-grafana.mdx b/docs/en/20-third-party/01-grafana.mdx
index 5a2942b144..b0e9dea707 100644
--- a/docs/en/20-third-party/01-grafana.mdx
+++ b/docs/en/20-third-party/01-grafana.mdx
@@ -77,7 +77,7 @@ sudo -u grafana grafana-cli plugins install tdengine-datasource
You can also download zip files from [GitHub](https://github.com/taosdata/grafanaplugin/releases/tag/latest) or [Grafana](https://grafana.com/grafana/plugins/tdengine-datasource/?tab=installation) and install manually. The commands are as follows:
```bash
-GF_VERSION=3.2.7
+GF_VERSION=3.3.1
# from GitHub
wget https://github.com/taosdata/grafanaplugin/releases/download/v$GF_VERSION/tdengine-datasource-$GF_VERSION.zip
# from Grafana
diff --git a/docs/zh/05-get-started/index.md b/docs/zh/05-get-started/index.md
index 62eeb2f1c2..16172277b5 100644
--- a/docs/zh/05-get-started/index.md
+++ b/docs/zh/05-get-started/index.md
@@ -4,7 +4,7 @@ description: '快速设置 TDengine 环境并体验其高效写入和查询'
---
import xiaot from './xiaot.webp'
-import xiaot_new from './xiaot-new.webp'
+import xiaot_new from './xiaot-03.webp'
import channel from './channel.webp'
import official_account from './official-account.webp'
diff --git a/docs/zh/05-get-started/xiaot-03.webp b/docs/zh/05-get-started/xiaot-03.webp
new file mode 100644
index 0000000000..c115346e9e
Binary files /dev/null and b/docs/zh/05-get-started/xiaot-03.webp differ
diff --git a/docs/zh/08-connector/14-java.mdx b/docs/zh/08-connector/14-java.mdx
index 0a9bd56bfb..d1c1258365 100644
--- a/docs/zh/08-connector/14-java.mdx
+++ b/docs/zh/08-connector/14-java.mdx
@@ -17,7 +17,7 @@ import TabItem from '@theme/TabItem';
- JDBC 原生连接:Java 应用在物理节点 1(pnode1)上使用 TSDBDriver 直接调用客户端驱动(libtaos.so 或 taos.dll)的 API 将写入和查询请求发送到位于物理节点 2(pnode2)上的 taosd 实例。
- JDBC REST 连接:Java 应用通过 RestfulDriver 将 SQL 封装成一个 REST 请求,发送给物理节点 2 的 REST 服务器(taosAdapter),通过 REST 服务器请求 taosd 并返回结果。
-使用 REST 连接,不依赖 TDengine 客户端驱动,可以跨平台,更加方便灵活,但性能比原生连接器低约 30%。
+使用 REST 连接,不依赖 TDengine 客户端驱动,可以跨平台,更加方便灵活。
:::info
TDengine 的 JDBC 驱动实现尽可能与关系型数据库驱动保持一致,但 TDengine 与关系对象型数据库的使用场景和技术特征存在差异,所以`taos-jdbcdriver` 与传统的 JDBC driver 也存在一定差异。在使用时需要注意以下几点:
diff --git a/docs/zh/14-reference/07-tdinsight/index.mdx b/docs/zh/14-reference/07-tdinsight/index.mdx
index 8783d47f00..b4eda61ebd 100644
--- a/docs/zh/14-reference/07-tdinsight/index.mdx
+++ b/docs/zh/14-reference/07-tdinsight/index.mdx
@@ -43,8 +43,6 @@ sudo apt-get update
sudo apt-get install grafana
```
-### 在 CentOS / RHEL 上安装 Grafana
-
@@ -79,7 +77,37 @@ sudo yum install \
-
+### 安装 TDengine 数据源插件
+
+
+
+
+从 GitHub 安装 TDengine 最新版数据源插件。
+
+```bash
+get_latest_release() {
+ curl --silent "https://api.github.com/repos/taosdata/grafanaplugin/releases/latest" |
+ grep '"tag_name":' |
+ sed -E 's/.*"v([^"]+)".*/\1/'
+}
+TDENGINE_PLUGIN_VERSION=$(get_latest_release)
+sudo grafana-cli \
+ --pluginUrl https://github.com/taosdata/grafanaplugin/releases/download/v$TDENGINE_PLUGIN_VERSION/tdengine-datasource-$TDENGINE_PLUGIN_VERSION.zip \
+ plugins install tdengine-datasource
+```
+
+:::note
+3.1.6 和更早版本插件需要在配置文件 `/etc/grafana/grafana.ini` 中添加如下设置,以启用未签名插件。
+
+```ini
+[plugins]
+allow_loading_unsigned_plugins = tdengine-datasource
+```
+
+:::
+
+
+
我们提供了一个自动化安装脚本 [`TDinsight.sh`](https://github.com/taosdata/grafanaplugin/releases/latest/download/TDinsight.sh) 脚本以便用户快速进行安装配置。
@@ -175,33 +203,7 @@ sudo ./TDengine.sh -n TDengine-Env1 -a http://another:6041 -u root -p taosdata -
特别地,当您使用 Grafana Cloud 或其他组织时,`-O` 可用于设置组织 ID。 `-G` 可指定 Grafana 插件安装目录。 `-e` 参数将仪表盘设置为可编辑。
-
-
-### 安装 TDengine 数据源插件
-
-从 GitHub 安装 TDengine 最新版数据源插件。
-
-```bash
-get_latest_release() {
- curl --silent "https://api.github.com/repos/taosdata/grafanaplugin/releases/latest" |
- grep '"tag_name":' |
- sed -E 's/.*"v([^"]+)".*/\1/'
-}
-TDENGINE_PLUGIN_VERSION=$(get_latest_release)
-sudo grafana-cli \
- --pluginUrl https://github.com/taosdata/grafanaplugin/releases/download/v$TDENGINE_PLUGIN_VERSION/tdengine-datasource-$TDENGINE_PLUGIN_VERSION.zip \
- plugins install tdengine-datasource
-```
-
-:::note
-3.1.6 和更早版本插件需要在配置文件 `/etc/grafana/grafana.ini` 中添加如下设置,以启用未签名插件。
-
-```ini
-[plugins]
-allow_loading_unsigned_plugins = tdengine-datasource
-```
-
-:::
+
### 启动 Grafana 服务
@@ -233,8 +235,7 @@ sudo systemctl enable grafana-server

-
-
+
### 导入仪表盘
diff --git a/docs/zh/14-reference/14-taosKeeper.md b/docs/zh/14-reference/14-taosKeeper.md
index 2cdc24dfef..12b609584a 100644
--- a/docs/zh/14-reference/14-taosKeeper.md
+++ b/docs/zh/14-reference/14-taosKeeper.md
@@ -205,3 +205,20 @@ taos_cluster_info_dnodes_total{cluster_id="5981392874047724755"} 1
# TYPE taos_cluster_info_first_ep gauge
taos_cluster_info_first_ep{cluster_id="5981392874047724755",value="hlb:6030"} 1
```
+
+### check_health
+
+```
+$ curl -i http://127.0.0.1:6043/check_health
+```
+
+返回结果:
+
+```
+HTTP/1.1 200 OK
+Content-Type: application/json; charset=utf-8
+Date: Mon, 03 Apr 2023 07:20:38 GMT
+Content-Length: 19
+
+{"version":"1.0.0"}
+```
diff --git a/docs/zh/20-third-party/01-grafana.mdx b/docs/zh/20-third-party/01-grafana.mdx
index 5927dc4fca..7980736a1c 100644
--- a/docs/zh/20-third-party/01-grafana.mdx
+++ b/docs/zh/20-third-party/01-grafana.mdx
@@ -77,7 +77,7 @@ sudo -u grafana grafana-cli plugins install tdengine-datasource
或者从 [GitHub](https://github.com/taosdata/grafanaplugin/releases/tag/latest) 或 [Grafana](https://grafana.com/grafana/plugins/tdengine-datasource/?tab=installation) 下载 .zip 文件到本地并解压到 Grafana 插件目录。命令行下载示例如下:
```bash
-GF_VERSION=3.2.9
+GF_VERSION=3.3.1
# from GitHub
wget https://github.com/taosdata/grafanaplugin/releases/download/v$GF_VERSION/tdengine-datasource-$GF_VERSION.zip
# from Grafana
diff --git a/examples/lua/OpenResty/rest/tdpool/init.lua b/examples/lua/OpenResty/rest/tdpool/init.lua
index ebf8e91756..c0c6d56590 100644
--- a/examples/lua/OpenResty/rest/tdpool/init.lua
+++ b/examples/lua/OpenResty/rest/tdpool/init.lua
@@ -1,16 +1,15 @@
local _M = {}
local driver = require "luaconnector51"
-local water_mark = 0
-local occupied = 0
-local connection_pool = {}
+td_pool_watermark = 0
+td_pool_occupied = 0
+td_connection_pool = {}
-function _M.new(o,config)
+function _M.new(o, config)
o = o or {}
- o.connection_pool = connection_pool
- o.water_mark = water_mark
- o.occupied = occupied
- if #connection_pool == 0 then
-
+ o.connection_pool = td_connection_pool
+ o.watermark = td_pool_watermark
+ o.occupied = td_pool_occupied
+ if #td_connection_pool == 0 then
for i = 1, config.connection_pool_size do
local res = driver.connect(config)
if res.code ~= 0 then
@@ -18,8 +17,8 @@ function _M.new(o,config)
return nil
else
local object = {obj = res.conn, state = 0}
- table.insert(o.connection_pool,i, object)
- ngx.log(ngx.INFO, "add connection, now pool size:"..#(o.connection_pool))
+ table.insert(td_connection_pool, i, object)
+ ngx.log(ngx.INFO, "add connection, now pool size:"..#(td_connection_pool))
end
end
@@ -32,13 +31,13 @@ function _M:get_connection()
local connection_obj
- for i = 1, #connection_pool do
- connection_obj = connection_pool[i]
+ for i = 1, #td_connection_pool do
+ connection_obj = td_connection_pool[i]
if connection_obj.state == 0 then
connection_obj.state = 1
- occupied = occupied +1
- if occupied > water_mark then
- water_mark = occupied
+ td_pool_occupied = td_pool_occupied + 1
+ if td_pool_occupied > td_pool_watermark then
+ td_pool_watermark = td_pool_occupied
end
return connection_obj["obj"]
end
@@ -49,21 +48,27 @@ function _M:get_connection()
return nil
end
-function _M:get_water_mark()
+function _M:get_watermark()
- return water_mark
+ return td_pool_watermark
+end
+
+
+function _M:get_current_load()
+
+ return td_pool_occupied
end
function _M:release_connection(conn)
local connection_obj
- for i = 1, #connection_pool do
- connection_obj = connection_pool[i]
+ for i = 1, #td_connection_pool do
+ connection_obj = td_connection_pool[i]
if connection_obj["obj"] == conn then
connection_obj["state"] = 0
- occupied = occupied -1
+ td_pool_occupied = td_pool_occupied -1
return
end
end
diff --git a/examples/lua/OpenResty/rest/test.lua b/examples/lua/OpenResty/rest/test.lua
index 48aeef3fb4..cb4a1479f3 100644
--- a/examples/lua/OpenResty/rest/test.lua
+++ b/examples/lua/OpenResty/rest/test.lua
@@ -4,8 +4,21 @@ local Pool = require "tdpool"
local config = require "config"
ngx.say("start time:"..os.time())
-local pool = Pool.new(Pool,config)
-local conn = pool:get_connection()
+local pool = Pool.new(Pool, config)
+local another_pool = Pool.new(Pool, config)
+local conn, conn1, conn2
+conn = pool:get_connection()
+conn1 = pool:get_connection()
+conn2 = pool:get_connection()
+local temp_conn = another_pool:get_connection()
+ngx.say("pool size:"..config.connection_pool_size)
+ngx.say("pool watermark:"..pool:get_watermark())
+ngx.say("pool current load:"..pool:get_current_load())
+pool:release_connection(conn1)
+pool:release_connection(conn2)
+another_pool:release_connection(temp_conn)
+ngx.say("pool watermark:"..pool:get_watermark())
+ngx.say("pool current load:"..pool:get_current_load())
local res = driver.query(conn,"drop database if exists nginx")
if res.code ~=0 then
@@ -31,7 +44,6 @@ end
res = driver.query(conn,"create table m1 (ts timestamp, speed int,owner binary(20))")
if res.code ~=0 then
ngx.say("create table---failed: "..res.error)
-
else
ngx.say("create table--- pass.")
end
@@ -83,8 +95,5 @@ while not flag do
-- ngx.say("i am here once...")
ngx.sleep(0.001) -- time unit is second
end
-
-ngx.say("pool water_mark:"..pool:get_water_mark())
-
pool:release_connection(conn)
ngx.say("end time:"..os.time())
diff --git a/include/os/osDir.h b/include/os/osDir.h
index 73871602c5..55c7a15764 100644
--- a/include/os/osDir.h
+++ b/include/os/osDir.h
@@ -31,21 +31,49 @@
extern "C" {
#endif
+#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
+#include "cus_name.h"
+#endif
+
#ifdef WINDOWS
+
#define TD_TMP_DIR_PATH "C:\\Windows\\Temp\\"
+#ifdef CUS_NAME
+#define TD_CFG_DIR_PATH "C:\\"CUS_NAME"\\cfg\\"
+#define TD_DATA_DIR_PATH "C:\\"CUS_NAME"\\data\\"
+#define TD_LOG_DIR_PATH "C:\\"CUS_NAME"\\log\\"
+#else
#define TD_CFG_DIR_PATH "C:\\TDengine\\cfg\\"
#define TD_DATA_DIR_PATH "C:\\TDengine\\data\\"
#define TD_LOG_DIR_PATH "C:\\TDengine\\log\\"
+#endif // CUS_NAME
+
#elif defined(_TD_DARWIN_64)
+
+#ifdef CUS_PROMPT
+#define TD_TMP_DIR_PATH "/tmp/"CUS_PROMPT"d/"
+#define TD_CFG_DIR_PATH "/etc/"CUS_PROMPT"/"
+#define TD_DATA_DIR_PATH "/var/lib/"CUS_PROMPT"/"
+#define TD_LOG_DIR_PATH "/var/log/"CUS_PROMPT"/"
+#else
#define TD_TMP_DIR_PATH "/tmp/taosd/"
#define TD_CFG_DIR_PATH "/etc/taos/"
#define TD_DATA_DIR_PATH "/var/lib/taos/"
#define TD_LOG_DIR_PATH "/var/log/taos/"
+#endif // CUS_PROMPT
+
#else
+
#define TD_TMP_DIR_PATH "/tmp/"
+#ifdef CUS_PROMPT
+#define TD_CFG_DIR_PATH "/etc/"CUS_PROMPT"/"
+#define TD_DATA_DIR_PATH "/var/lib/"CUS_PROMPT"/"
+#define TD_LOG_DIR_PATH "/var/log/"CUS_PROMPT"/"
+#else
#define TD_CFG_DIR_PATH "/etc/taos/"
#define TD_DATA_DIR_PATH "/var/lib/taos/"
#define TD_LOG_DIR_PATH "/var/log/taos/"
+#endif // CUS_PROMPT
#endif
typedef struct TdDir *TdDirPtr;
diff --git a/include/util/cus_name.h b/include/util/cus_name.h
new file mode 100644
index 0000000000..16f677f855
--- /dev/null
+++ b/include/util/cus_name.h
@@ -0,0 +1,31 @@
+/*
+ * 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/tjson.h b/include/util/tjson.h
index af0b163986..6922930c13 100644
--- a/include/util/tjson.h
+++ b/include/util/tjson.h
@@ -25,7 +25,7 @@ extern "C" {
#define tjsonGetNumberValue(pJson, pName, val, code) \
do { \
- int64_t _tmp = 0; \
+ uint64_t _tmp = 0; \
code = tjsonGetBigIntValue(pJson, pName, &_tmp); \
val = _tmp; \
} while (0)
diff --git a/include/util/tutil.h b/include/util/tutil.h
index c8f1b29e10..e0801e5295 100644
--- a/include/util/tutil.h
+++ b/include/util/tutil.h
@@ -29,7 +29,7 @@ extern "C" {
int32_t strdequote(char *src);
size_t strtrim(char *src);
char *strnchr(const char *haystack, char needle, int32_t len, bool skipquote);
-TdUcs4 *wcsnchr(const TdUcs4 *haystack, TdUcs4 needle, size_t len);
+TdUcs4* wcsnchr(const TdUcs4* haystack, TdUcs4 needle, size_t len);
char **strsplit(char *src, const char *delim, int32_t *num);
char *strtolower(char *dst, const char *src);
@@ -37,11 +37,11 @@ char *strntolower(char *dst, const char *src, int32_t n);
char *strntolower_s(char *dst, const char *src, int32_t n);
int64_t strnatoi(char *num, int32_t len);
-size_t tstrncspn(const char *str, size_t ssize, const char *reject, size_t rsize);
-size_t twcsncspn(const TdUcs4 *wcs, size_t size, const TdUcs4 *reject, size_t rsize);
+size_t tstrncspn(const char *str, size_t ssize, const char *reject, size_t rsize);
+size_t twcsncspn(const TdUcs4 *wcs, size_t size, const TdUcs4 *reject, size_t rsize);
-char *strbetween(char *string, char *begin, char *end);
-char *paGetToken(char *src, char **token, int32_t *tokenLen);
+char *strbetween(char *string, char *begin, char *end);
+char *paGetToken(char *src, char **token, int32_t *tokenLen);
int32_t taosByteArrayToHexStr(char bytes[], int32_t len, char hexstr[]);
int32_t taosHexStrToByteArray(char hexstr[], char bytes[]);
@@ -92,26 +92,12 @@ static FORCE_INLINE int32_t taosGetTbHashVal(const char *tbname, int32_t tblen,
}
}
-#define TSDB_CHECK(condition, CODE, LINO, LABEL, ERRNO) \
- if (!(condition)) { \
- (CODE) = (ERRNO); \
- (LINO) = __LINE__; \
- goto LABEL; \
- }
-
#define TSDB_CHECK_CODE(CODE, LINO, LABEL) \
- if ((CODE)) { \
- (LINO) = __LINE__; \
+ if (CODE) { \
+ LINO = __LINE__; \
goto LABEL; \
}
-#define TSDB_CHECK_NULL(ptr, CODE, LINO, LABEL, ERRNO) \
- if ((ptr) == NULL) { \
- (CODE) = (ERRNO); \
- (LINO) = __LINE__; \
- goto LABEL; \
- }
-
#ifdef __cplusplus
}
#endif
diff --git a/packaging/cfg/taos.cfg b/packaging/cfg/taos.cfg
index a98dc5a236..2159899aa2 100644
--- a/packaging/cfg/taos.cfg
+++ b/packaging/cfg/taos.cfg
@@ -1,7 +1,6 @@
########################################################
# #
# Configuration #
-# Any questions, please email support@taosdata.com #
# #
########################################################
@@ -13,7 +12,7 @@
############### 1. Cluster End point ############################
-# The end point of the first dnode in the cluster to be connected to when this dnode or a CLI `taos` is started
+# The end point of the first dnode in the cluster to be connected to when this dnode or the CLI utility is started
# firstEp hostname:6030
# The end point of the second dnode to be connected to if the firstEp is not available
@@ -25,7 +24,7 @@
# The FQDN of the host on which this dnode will be started. It can be IP address
# fqdn hostname
-# The port for external access after this dnode is started
+# The port for external access after this dnode is started
# serverPort 6030
# The maximum number of connections a dnode can accept
@@ -96,7 +95,7 @@
# if free disk space is less than this value, this dnode will fail to start
# minimalDataDirGB 2.0
-# enable/disable system monitor
+# enable/disable system monitor
# monitor 1
# The following parameter is used to limit the maximum number of lines in log files.
@@ -114,8 +113,8 @@
# The following parameters are used for debug purpose only by this dnode.
# debugFlag is a 8 bits mask: FILE-SCREEN-UNUSED-HeartBeat-DUMP-TRACE_WARN-ERROR
-# Available debug levels are:
-# 131: output warning and error
+# Available debug levels are:
+# 131: output warning and error
# 135: output debug, warning and error
# 143: output trace, debug, warning and error to log
# 199: output debug, warning and error to both screen and file
@@ -130,7 +129,7 @@
# debug flag for util
# uDebugFlag 131
-# debug flag for rpc
+# debug flag for rpc
# rpcDebugFlag 131
# debug flag for jni
@@ -139,7 +138,7 @@
# debug flag for query
# qDebugFlag 131
-# debug flag for taosc driver
+# debug flag for client driver
# cDebugFlag 131
# debug flag for dnode messages
diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh
index 29160238ce..f30ec23b9f 100755
--- a/packaging/tools/makepkg.sh
+++ b/packaging/tools/makepkg.sh
@@ -234,7 +234,9 @@ if [ "$verMode" == "cluster" ]; then
sed -i "s/serverName2=\"taosd\"/serverName2=\"${serverName2}\"/g" remove_temp.sh
sed -i "s/clientName2=\"taos\"/clientName2=\"${clientName2}\"/g" remove_temp.sh
sed -i "s/productName2=\"TDengine\"/productName2=\"${productName2}\"/g" remove_temp.sh
- sed -i "s/emailName2=\"taosdata.com\"/emailName2=\"${cusEmail2}\"/g" remove_temp.sh
+ cusDomain=`echo "${cusEmail2}" | sed 's/^[^@]*@//'`
+ echo "domain is ${cusDomain}"
+ sed -i "s/emailName2=\"taosdata.com\"/emailName2=\"${cusDomain}\"/g" remove_temp.sh
mv remove_temp.sh ${install_dir}/bin/remove.sh
fi
if [ "$verMode" == "cloud" ]; then
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index de08ba66cc..874ac12f5c 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -30,6 +30,10 @@
#include "tsched.h"
#include "ttime.h"
+#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
+#include "cus_name.h"
+#endif
+
#define TSC_VAR_NOT_RELEASE 1
#define TSC_VAR_RELEASED 0
@@ -541,9 +545,15 @@ void taos_init_imp(void) {
deltaToUtcInitOnce();
- if (taosCreateLog("taoslog", 10, configDir, NULL, NULL, NULL, NULL, 1) != 0) {
+ char logDirName[64] = {0};
+#ifdef CUS_PROMPT
+ snprintf(logDirName, 64, "%slog", CUS_PROMPT);
+#else
+ snprintf(logDirName, 64, "taoslog");
+#endif
+ if (taosCreateLog(logDirName, 10, configDir, NULL, NULL, NULL, NULL, 1) != 0) {
// ignore create log failed, only print
- printf(" WARING: Create taoslog failed:%s. configDir=%s\n", strerror(errno), configDir);
+ printf(" WARING: Create %s failed:%s. configDir=%s\n", logDirName, strerror(errno), configDir);
}
if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 1) != 0) {
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index aeeec1d61c..1c2d533977 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -228,7 +228,11 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *input
taosExpandDir(inputCfgDir, cfgDir, PATH_MAX);
if (taosIsDir(cfgDir)) {
+#ifdef CUS_PROMPT
+ snprintf(cfgFile, sizeof(cfgFile), "%s" TD_DIRSEP "%s.cfg", CUS_PROMPT, cfgDir);
+#else
snprintf(cfgFile, sizeof(cfgFile), "%s" TD_DIRSEP "taos.cfg", cfgDir);
+#endif
} else {
tstrncpy(cfgFile, cfgDir, sizeof(cfgDir));
}
diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c
index b85d8d7746..5519d43012 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFS.c
+++ b/source/dnode/vnode/src/tsdb/tsdbFS.c
@@ -88,98 +88,6 @@ _exit:
return code;
}
-extern int32_t tsdbDelFileToJson(const SDelFile *pDelFile, cJSON *pJson);
-extern int32_t tsdbJsonToDelFile(const cJSON *pJson, SDelFile *pDelFile);
-extern int32_t tsdbDFileSetToJson(const SDFileSet *pSet, cJSON *pJson);
-extern int32_t tsdbJsonToDFileSet(const cJSON *pJson, SDFileSet *pDelFile);
-
-static int32_t tsdbFSToJsonStr(STsdbFS *pFS, char **ppStr) {
- int32_t code = 0;
- int32_t lino = 0;
- cJSON *pJson;
-
- ppStr[0] = NULL;
-
- pJson = cJSON_CreateObject();
- TSDB_CHECK_NULL(pJson, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
- // format version
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "format", 1), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
- // SDelFile
- if (pFS->pDelFile) {
- code = tsdbDelFileToJson(pFS->pDelFile, cJSON_AddObjectToObject(pJson, "del"));
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- // aDFileSet
- cJSON *aSetJson = cJSON_AddArrayToObject(pJson, "file set");
- TSDB_CHECK_NULL(aSetJson, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
- for (int32_t iSet = 0; iSet < taosArrayGetSize(pFS->aDFileSet); iSet++) {
- cJSON *pSetJson = cJSON_CreateObject();
- TSDB_CHECK_NULL(pSetJson, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
- cJSON_AddItemToArray(aSetJson, pSetJson);
-
- code = tsdbDFileSetToJson(taosArrayGet(pFS->aDFileSet, iSet), pSetJson);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- // print
- ppStr[0] = cJSON_Print(pJson);
- TSDB_CHECK_NULL(ppStr[0], code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
-_exit:
- cJSON_Delete(pJson);
- if (code) tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
- return code;
-}
-
-static int32_t tsdbJsonStrToFS(const char *pStr, STsdbFS *pFS) {
- int32_t code = 0;
- int32_t lino;
-
- cJSON *pJson = cJSON_Parse(pStr);
- TSDB_CHECK(pJson, code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
-
- const cJSON *pItem;
-
- // format version
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "format")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
-
- // SDelFile
- if (cJSON_IsObject(pItem = cJSON_GetObjectItem(pJson, "del"))) {
- pFS->pDelFile = (SDelFile *)taosMemoryCalloc(1, sizeof(SDelFile));
- TSDB_CHECK_NULL(pFS->pDelFile, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
- code = tsdbJsonToDelFile(pItem, pFS->pDelFile);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- pFS->pDelFile->nRef = 1;
- } else {
- pFS->pDelFile = NULL;
- }
-
- // aDFileSet
- taosArrayClear(pFS->aDFileSet);
-
- const cJSON *pSetJson;
- TSDB_CHECK(cJSON_IsArray(pItem = cJSON_GetObjectItem(pJson, "file set")), code, lino, _exit,
- TSDB_CODE_FILE_CORRUPTED);
- cJSON_ArrayForEach(pSetJson, pItem) {
- SDFileSet *pSet = (SDFileSet *)taosArrayReserve(pFS->aDFileSet, 1);
- TSDB_CHECK_NULL(pSet, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
- code = tsdbJsonToDFileSet(pSetJson, pSet);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
-_exit:
- cJSON_Delete(pJson);
- if (code) tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
- return code;
-}
-
static int32_t tsdbSaveFSToFile(STsdbFS *pFS, const char *fname) {
int32_t code = 0;
int32_t lino = 0;
@@ -224,84 +132,6 @@ _exit:
return code;
}
-static int32_t tsdbSaveFSToJsonFile(STsdbFS *pFS, const char *fname) {
- int32_t code;
- int32_t lino;
- char *pData;
-
- code = tsdbFSToJsonStr(pFS, &pData);
- if (code) return code;
-
- TdFilePtr pFD = taosOpenFile(fname, TD_FILE_WRITE | TD_FILE_CREATE | TD_FILE_TRUNC);
- if (pFD == NULL) {
- code = TAOS_SYSTEM_ERROR(errno);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- int64_t n = taosWriteFile(pFD, pData, strlen(pData) + 1);
- if (n < 0) {
- code = TAOS_SYSTEM_ERROR(errno);
- taosCloseFile(&pFD);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- if (taosFsyncFile(pFD) < 0) {
- code = TAOS_SYSTEM_ERROR(errno);
- taosCloseFile(&pFD);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- taosCloseFile(&pFD);
-
-_exit:
- taosMemoryFree(pData);
- if (code) {
- tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
- }
-
- return code;
-}
-
-static int32_t tsdbLoadFSFromJsonFile(const char *fname, STsdbFS *pFS) {
- int32_t code = 0;
- int32_t lino = 0;
- char *pData = NULL;
-
- TdFilePtr pFD = taosOpenFile(fname, TD_FILE_READ);
- if (pFD == NULL) {
- code = TAOS_SYSTEM_ERROR(errno);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- int64_t size;
- if (taosFStatFile(pFD, &size, NULL) < 0) {
- code = TAOS_SYSTEM_ERROR(errno);
- taosCloseFile(&pFD);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- if ((pData = taosMemoryMalloc(size)) == NULL) {
- code = TSDB_CODE_OUT_OF_MEMORY;
- taosCloseFile(&pFD);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- if (taosReadFile(pFD, pData, size) < 0) {
- code = TAOS_SYSTEM_ERROR(errno);
- taosCloseFile(&pFD);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
- taosCloseFile(&pFD);
-
- TSDB_CHECK_CODE(code = tsdbJsonStrToFS(pData, pFS), lino, _exit);
-
-_exit:
- if (pData) taosMemoryFree(pData);
- if (code) tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
- return code;
-}
-
int32_t tsdbFSCreate(STsdbFS *pFS) {
int32_t code = 0;
@@ -439,8 +269,7 @@ int32_t tDFileSetCmprFn(const void *p1, const void *p2) {
return 0;
}
-static void tsdbGetCurrentFName(STsdb *pTsdb, char *current, char *current_t, char *current_json,
- char *current_json_t) {
+static void tsdbGetCurrentFName(STsdb *pTsdb, char *current, char *current_t) {
SVnode *pVnode = pTsdb->pVnode;
if (pVnode->pTfs) {
if (current) {
@@ -451,14 +280,6 @@ static void tsdbGetCurrentFName(STsdb *pTsdb, char *current, char *current_t, ch
snprintf(current_t, TSDB_FILENAME_LEN - 1, "%s%s%s%sCURRENT.t", tfsGetPrimaryPath(pTsdb->pVnode->pTfs), TD_DIRSEP,
pTsdb->path, TD_DIRSEP);
}
- if (current_json) {
- snprintf(current_json, TSDB_FILENAME_LEN - 1, "%s%s%s%scurrent.json", tfsGetPrimaryPath(pTsdb->pVnode->pTfs),
- TD_DIRSEP, pTsdb->path, TD_DIRSEP);
- }
- if (current_json_t) {
- snprintf(current_json_t, TSDB_FILENAME_LEN - 1, "%s%s%s%scurrent.json.t", tfsGetPrimaryPath(pTsdb->pVnode->pTfs),
- TD_DIRSEP, pTsdb->path, TD_DIRSEP);
- }
} else {
if (current) {
snprintf(current, TSDB_FILENAME_LEN - 1, "%s%sCURRENT", pTsdb->path, TD_DIRSEP);
@@ -466,12 +287,6 @@ static void tsdbGetCurrentFName(STsdb *pTsdb, char *current, char *current_t, ch
if (current_t) {
snprintf(current_t, TSDB_FILENAME_LEN - 1, "%s%sCURRENT.t", pTsdb->path, TD_DIRSEP);
}
- if (current_json) {
- snprintf(current_json, TSDB_FILENAME_LEN - 1, "%s%scurrent.json", pTsdb->path, TD_DIRSEP);
- }
- if (current_json_t) {
- snprintf(current_json_t, TSDB_FILENAME_LEN - 1, "%s%scurrent.json.t", pTsdb->path, TD_DIRSEP);
- }
}
}
@@ -887,15 +702,20 @@ _exit:
return code;
}
-static int32_t tsdbFSCommitImpl(STsdb *pTsdb, const char *fname, const char *tfname, bool isJson) {
+// EXPOSED APIS ====================================================================================
+int32_t tsdbFSCommit(STsdb *pTsdb) {
int32_t code = 0;
int32_t lino = 0;
STsdbFS fs = {0};
- if (!taosCheckExistFile(tfname)) goto _exit;
+ char current[TSDB_FILENAME_LEN] = {0};
+ char current_t[TSDB_FILENAME_LEN] = {0};
+ tsdbGetCurrentFName(pTsdb, current, current_t);
+
+ if (!taosCheckExistFile(current_t)) goto _exit;
// rename the file
- if (taosRenameFile(tfname, fname) < 0) {
+ if (taosRenameFile(current_t, current) < 0) {
code = TAOS_SYSTEM_ERROR(errno);
TSDB_CHECK_CODE(code, lino, _exit);
}
@@ -904,11 +724,7 @@ static int32_t tsdbFSCommitImpl(STsdb *pTsdb, const char *fname, const char *tfn
code = tsdbFSCreate(&fs);
TSDB_CHECK_CODE(code, lino, _exit);
- if (isJson) {
- code = tsdbLoadFSFromJsonFile(fname, &fs);
- } else {
- code = tsdbLoadFSFromFile(fname, &fs);
- }
+ code = tsdbLoadFSFromFile(current, &fs);
TSDB_CHECK_CODE(code, lino, _exit);
// apply file change
@@ -923,19 +739,18 @@ _exit:
return code;
}
-// EXPOSED APIS ====================================================================================
-int32_t tsdbFSCommit(STsdb *pTsdb) {
- char current_json[TSDB_FILENAME_LEN] = {0};
- char current_json_t[TSDB_FILENAME_LEN] = {0};
- tsdbGetCurrentFName(pTsdb, NULL, NULL, current_json, current_json_t);
- return tsdbFSCommitImpl(pTsdb, current_json, current_json_t, true);
-}
-
int32_t tsdbFSRollback(STsdb *pTsdb) {
int32_t code = 0;
- char current_json_t[TSDB_FILENAME_LEN] = {0};
- tsdbGetCurrentFName(pTsdb, NULL, NULL, NULL, current_json_t);
- (void)taosRemoveFile(current_json_t);
+ int32_t lino = 0;
+
+ char current_t[TSDB_FILENAME_LEN] = {0};
+ tsdbGetCurrentFName(pTsdb, NULL, current_t);
+ (void)taosRemoveFile(current_t);
+
+_exit:
+ if (code) {
+ tsdbError("vgId:%d, %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, lino, tstrerror(errno));
+ }
return code;
}
@@ -951,33 +766,13 @@ int32_t tsdbFSOpen(STsdb *pTsdb, int8_t rollback) {
// open impl
char current[TSDB_FILENAME_LEN] = {0};
char current_t[TSDB_FILENAME_LEN] = {0};
- char current_json[TSDB_FILENAME_LEN] = {0};
- char current_json_t[TSDB_FILENAME_LEN] = {0};
- tsdbGetCurrentFName(pTsdb, current, current_t, current_json, current_json_t);
+ tsdbGetCurrentFName(pTsdb, current, current_t);
if (taosCheckExistFile(current)) {
- // CURRENT file exists
code = tsdbLoadFSFromFile(current, &pTsdb->fs);
TSDB_CHECK_CODE(code, lino, _exit);
if (taosCheckExistFile(current_t)) {
- if (rollback) {
- (void)taosRemoveFile(current_t);
- } else {
- code = tsdbFSCommitImpl(pTsdb, current, current_t, false);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
- }
-
- code = tsdbSaveFSToJsonFile(&pTsdb->fs, current_json);
- TSDB_CHECK_CODE(code, lino, _exit);
- (void)taosRemoveFile(current);
- } else if (taosCheckExistFile(current_json)) {
- // current.json exists
- code = tsdbLoadFSFromJsonFile(current_json, &pTsdb->fs);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- if (taosCheckExistFile(current_json_t)) {
if (rollback) {
code = tsdbFSRollback(pTsdb);
TSDB_CHECK_CODE(code, lino, _exit);
@@ -987,10 +782,11 @@ int32_t tsdbFSOpen(STsdb *pTsdb, int8_t rollback) {
}
}
} else {
- // empty TSDB
- ASSERT(!rollback);
- code = tsdbSaveFSToJsonFile(&pTsdb->fs, current_json);
+ // empty one
+ code = tsdbSaveFSToFile(&pTsdb->fs, current);
TSDB_CHECK_CODE(code, lino, _exit);
+
+ ASSERT(!rollback);
}
// scan and fix FS
@@ -1228,12 +1024,12 @@ _exit:
int32_t tsdbFSPrepareCommit(STsdb *pTsdb, STsdbFS *pFSNew) {
int32_t code = 0;
int32_t lino = 0;
- char current_json_t[TSDB_FILENAME_LEN];
+ char tfname[TSDB_FILENAME_LEN];
- tsdbGetCurrentFName(pTsdb, NULL, NULL, NULL, current_json_t);
+ tsdbGetCurrentFName(pTsdb, NULL, tfname);
- // generate current.json
- code = tsdbSaveFSToJsonFile(pFSNew, current_json_t);
+ // gnrt CURRENT.t
+ code = tsdbSaveFSToFile(pFSNew, tfname);
TSDB_CHECK_CODE(code, lino, _exit);
_exit:
diff --git a/source/dnode/vnode/src/tsdb/tsdbFile.c b/source/dnode/vnode/src/tsdb/tsdbFile.c
index 8b2b2caec7..d91475376b 100644
--- a/source/dnode/vnode/src/tsdb/tsdbFile.c
+++ b/source/dnode/vnode/src/tsdb/tsdbFile.c
@@ -92,11 +92,11 @@ static int32_t tGetSmaFile(uint8_t *p, SSmaFile *pSmaFile) {
}
// EXPOSED APIS ==================================================
-static char *getFileNamePrefix(STsdb *pTsdb, SDiskID did, int32_t fid, uint64_t commitId, char fname[]) {
- const char *p1 = tfsGetDiskPath(pTsdb->pVnode->pTfs, did);
- int32_t len = strlen(p1);
+static char* getFileNamePrefix(STsdb *pTsdb, SDiskID did, int32_t fid, uint64_t commitId, char fname[]) {
+ const char* p1 = tfsGetDiskPath(pTsdb->pVnode->pTfs, did);
+ int32_t len = strlen(p1);
- char *p = memcpy(fname, p1, len);
+ char* p = memcpy(fname, p1, len);
p += len;
*(p++) = TD_DIRSEP[0];
@@ -121,25 +121,25 @@ static char *getFileNamePrefix(STsdb *pTsdb, SDiskID did, int32_t fid, uint64_t
}
void tsdbHeadFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SHeadFile *pHeadF, char fname[]) {
- char *p = getFileNamePrefix(pTsdb, did, fid, pHeadF->commitID, fname);
+ char* p = getFileNamePrefix(pTsdb, did, fid, pHeadF->commitID, fname);
memcpy(p, ".head", 5);
p[5] = 0;
}
void tsdbDataFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SDataFile *pDataF, char fname[]) {
- char *p = getFileNamePrefix(pTsdb, did, fid, pDataF->commitID, fname);
+ char* p = getFileNamePrefix(pTsdb, did, fid, pDataF->commitID, fname);
memcpy(p, ".data", 5);
p[5] = 0;
}
void tsdbSttFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SSttFile *pSttF, char fname[]) {
- char *p = getFileNamePrefix(pTsdb, did, fid, pSttF->commitID, fname);
+ char* p = getFileNamePrefix(pTsdb, did, fid, pSttF->commitID, fname);
memcpy(p, ".stt", 4);
p[4] = 0;
}
void tsdbSmaFileName(STsdb *pTsdb, SDiskID did, int32_t fid, SSmaFile *pSmaF, char fname[]) {
- char *p = getFileNamePrefix(pTsdb, did, fid, pSmaF->commitID, fname);
+ char* p = getFileNamePrefix(pTsdb, did, fid, pSmaF->commitID, fname);
memcpy(p, ".sma", 4);
p[4] = 0;
}
@@ -280,272 +280,6 @@ int32_t tGetDFileSet(uint8_t *p, SDFileSet *pSet) {
return n;
}
-static int32_t tDiskIdToJson(const SDiskID *pDiskId, cJSON *pJson) {
- int32_t code = 0;
- int32_t lino;
-
- if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY;
-
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "level", pDiskId->level), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "id", pDiskId->id), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
-_exit:
- return code;
-}
-static int32_t tJsonToDiskId(const cJSON *pJson, SDiskID *pDiskId) {
- int32_t code = 0;
- int32_t lino;
-
- const cJSON *pItem;
-
- // level
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "level")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- pDiskId->level = (int32_t)pItem->valuedouble;
-
- // id
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "id")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- pDiskId->id = (int32_t)pItem->valuedouble;
-
-_exit:
- return code;
-}
-
-static int32_t tHeadFileToJson(const SHeadFile *pHeadF, cJSON *pJson) {
- int32_t code = 0;
- int32_t lino;
-
- if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY;
-
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "commit id", pHeadF->commitID), code, lino, _exit,
- TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "size", pHeadF->size), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "offset", pHeadF->offset), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
-_exit:
- return code;
-}
-
-static int32_t tJsonToHeadFile(const cJSON *pJson, SHeadFile *pHeadF) {
- int32_t code = 0;
- int32_t lino;
-
- const cJSON *pItem;
-
- // commit id
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "commit id")), code, lino, _exit,
- TSDB_CODE_FILE_CORRUPTED);
- pHeadF->commitID = (int64_t)pItem->valuedouble;
-
- // size
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "size")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- pHeadF->size = (int64_t)pItem->valuedouble;
-
- // offset
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "offset")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- pHeadF->offset = (int64_t)pItem->valuedouble;
-
-_exit:
- return code;
-}
-
-static int32_t tDataFileToJson(const SDataFile *pDataF, cJSON *pJson) {
- int32_t code = 0;
- int32_t lino;
-
- if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY;
-
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "commit id", pDataF->commitID), code, lino, _exit,
- TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "size", pDataF->size), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
-_exit:
- return code;
-}
-
-static int32_t tJsonToDataFile(const cJSON *pJson, SDataFile *pDataF) {
- int32_t code = 0;
- int32_t lino;
-
- const cJSON *pItem;
-
- // commit id
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "commit id")), code, lino, _exit,
- TSDB_CODE_FILE_CORRUPTED);
- pDataF->commitID = (int64_t)pItem->valuedouble;
-
- // size
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "size")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- pDataF->size = (int64_t)pItem->valuedouble;
-
-_exit:
- return code;
-}
-
-static int32_t tSmaFileToJson(const SSmaFile *pSmaF, cJSON *pJson) {
- int32_t code = 0;
- int32_t lino;
-
- if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY;
-
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "commit id", pSmaF->commitID), code, lino, _exit,
- TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "size", pSmaF->size), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
-_exit:
- return code;
-}
-
-static int32_t tJsonToSmaFile(const cJSON *pJson, SSmaFile *pSmaF) {
- int32_t code = 0;
- int32_t lino;
-
- // commit id
- const cJSON *pItem;
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "commit id")), code, lino, _exit,
- TSDB_CODE_FILE_CORRUPTED);
- pSmaF->commitID = (int64_t)pItem->valuedouble;
-
- // size
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "size")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- pSmaF->size = (int64_t)pItem->valuedouble;
-
-_exit:
- return code;
-}
-
-static int32_t tSttFileToJson(const SSttFile *pSttF, cJSON *pJson) {
- int32_t code = 0;
- int32_t lino;
-
- if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY;
-
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "commit id", pSttF->commitID), code, lino, _exit,
- TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "size", pSttF->size), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "offset", pSttF->offset), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
-_exit:
- return code;
-}
-
-static int32_t tJsonToSttFile(const cJSON *pJson, SSttFile *pSttF) {
- int32_t code = 0;
- int32_t lino;
-
- const cJSON *pItem;
-
- // commit id
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "commit id")), code, lino, _exit,
- TSDB_CODE_FILE_CORRUPTED);
- pSttF->commitID = (int64_t)pItem->valuedouble;
-
- // size
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "size")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- pSttF->size = (int64_t)pItem->valuedouble;
-
- // offset
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "offset")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- pSttF->offset = (int64_t)pItem->valuedouble;
-
-_exit:
- return code;
-}
-
-int32_t tsdbDFileSetToJson(const SDFileSet *pSet, cJSON *pJson) {
- int32_t code = 0;
- int32_t lino;
-
- if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY;
-
- code = tDiskIdToJson(&pSet->diskId, cJSON_AddObjectToObject(pJson, "disk id"));
- TSDB_CHECK_CODE(code, lino, _exit);
-
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "fid", pSet->fid), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
- // head
- code = tHeadFileToJson(pSet->pHeadF, cJSON_AddObjectToObject(pJson, "head"));
- TSDB_CHECK_CODE(code, lino, _exit);
-
- // data
- code = tDataFileToJson(pSet->pDataF, cJSON_AddObjectToObject(pJson, "data"));
- TSDB_CHECK_CODE(code, lino, _exit);
-
- // sma
- code = tSmaFileToJson(pSet->pSmaF, cJSON_AddObjectToObject(pJson, "sma"));
- TSDB_CHECK_CODE(code, lino, _exit);
-
- // stt array
- cJSON *aSttJson = cJSON_AddArrayToObject(pJson, "stt");
- TSDB_CHECK_NULL(aSttJson, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
- for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) {
- cJSON *pSttJson = cJSON_CreateObject();
- TSDB_CHECK_NULL(pSttJson, code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
-
- cJSON_AddItemToArray(aSttJson, pSttJson);
-
- code = tSttFileToJson(pSet->aSttF[iStt], pSttJson);
- TSDB_CHECK_CODE(code, lino, _exit);
- }
-
-_exit:
- return code;
-}
-
-int32_t tsdbJsonToDFileSet(const cJSON *pJson, SDFileSet *pSet) {
- int32_t code = 0;
- int32_t lino;
-
- const cJSON *pItem;
- // disk id
- TSDB_CHECK(cJSON_IsObject(pItem = cJSON_GetObjectItem(pJson, "disk id")), code, lino, _exit,
- TSDB_CODE_FILE_CORRUPTED);
- code = tJsonToDiskId(pItem, &pSet->diskId);
- TSDB_CHECK_CODE(code, lino, _exit);
-
- // fid
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "fid")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- pSet->fid = (int32_t)pItem->valuedouble;
-
- // head
- TSDB_CHECK(cJSON_IsObject(pItem = cJSON_GetObjectItem(pJson, "head")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- TSDB_CHECK_NULL(pSet->pHeadF = (SHeadFile *)taosMemoryMalloc(sizeof(SHeadFile)), code, lino, _exit,
- TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_CODE(code = tJsonToHeadFile(pItem, pSet->pHeadF), lino, _exit);
- pSet->pHeadF->nRef = 1;
-
- // data
- TSDB_CHECK(cJSON_IsObject(pItem = cJSON_GetObjectItem(pJson, "data")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- TSDB_CHECK_NULL(pSet->pDataF = (SDataFile *)taosMemoryMalloc(sizeof(SDataFile)), code, lino, _exit,
- TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_CODE(code = tJsonToDataFile(pItem, pSet->pDataF), lino, _exit);
- pSet->pDataF->nRef = 1;
-
- // sma
- TSDB_CHECK(cJSON_IsObject(pItem = cJSON_GetObjectItem(pJson, "sma")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- TSDB_CHECK_NULL(pSet->pSmaF = (SSmaFile *)taosMemoryMalloc(sizeof(SSmaFile)), code, lino, _exit,
- TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_CODE(code = tJsonToSmaFile(pItem, pSet->pSmaF), lino, _exit);
- pSet->pSmaF->nRef = 1;
-
- // stt array
- const cJSON *element;
- pSet->nSttF = 0;
- TSDB_CHECK(cJSON_IsArray(pItem = cJSON_GetObjectItem(pJson, "stt")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- cJSON_ArrayForEach(element, pItem) {
- TSDB_CHECK(cJSON_IsObject(element), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
-
- pSet->aSttF[pSet->nSttF] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
- TSDB_CHECK_NULL(pSet->aSttF[pSet->nSttF], code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_CODE(code = tJsonToSttFile(element, pSet->aSttF[pSet->nSttF]), lino, _exit);
- pSet->aSttF[pSet->nSttF]->nRef = 1;
- pSet->nSttF++;
- }
-
-_exit:
- if (code) tsdbError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
- return code;
-}
-
// SDelFile ===============================================
void tsdbDelFileName(STsdb *pTsdb, SDelFile *pFile, char fname[]) {
snprintf(fname, TSDB_FILENAME_LEN - 1, "%s%s%s%sv%dver%" PRId64 "%s", tfsGetPrimaryPath(pTsdb->pVnode->pTfs),
@@ -571,42 +305,3 @@ int32_t tGetDelFile(uint8_t *p, SDelFile *pDelFile) {
return n;
}
-
-int32_t tsdbDelFileToJson(const SDelFile *pDelFile, cJSON *pJson) {
- if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY;
-
- int32_t code = 0;
- int32_t lino;
-
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "commit id", pDelFile->commitID), code, lino, _exit,
- TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "size", pDelFile->size), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
- TSDB_CHECK_NULL(cJSON_AddNumberToObject(pJson, "offset", pDelFile->offset), code, lino, _exit,
- TSDB_CODE_OUT_OF_MEMORY);
-
-_exit:
- return code;
-}
-
-int32_t tsdbJsonToDelFile(const cJSON *pJson, SDelFile *pDelFile) {
- int32_t code = 0;
- int32_t lino;
-
- const cJSON *pItem;
-
- // commit id
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "commit id")), code, lino, _exit,
- TSDB_CODE_FILE_CORRUPTED);
- pDelFile->commitID = cJSON_GetNumberValue(pItem);
-
- // size
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "size")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- pDelFile->size = cJSON_GetNumberValue(pItem);
-
- // offset
- TSDB_CHECK(cJSON_IsNumber(pItem = cJSON_GetObjectItem(pJson, "offset")), code, lino, _exit, TSDB_CODE_FILE_CORRUPTED);
- pDelFile->offset = cJSON_GetNumberValue(pItem);
-
-_exit:
- return code;
-}
\ No newline at end of file
diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c
index 52309a7b35..84004ed3c1 100644
--- a/source/os/src/osSysinfo.c
+++ b/source/os/src/osSysinfo.c
@@ -17,6 +17,10 @@
#include "os.h"
#include "taoserror.h"
+#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
+#include "cus_name.h"
+#endif
+
#define PROCESS_ITEM 12
#define UUIDLEN37 37
@@ -252,7 +256,11 @@ int32_t taosGetEmail(char *email, int32_t maxLen) {
#ifdef WINDOWS
// ASSERT(0);
#elif defined(_TD_DARWIN_64)
+#ifdef CUS_PROMPT
+ const char *filepath = "/usr/local/"CUS_PROMPT"/email";
+#else
const char *filepath = "/usr/local/taos/email";
+#endif // CUS_PROMPT
TdFilePtr pFile = taosOpenFile(filepath, TD_FILE_READ);
if (pFile == NULL) return false;
@@ -264,8 +272,12 @@ int32_t taosGetEmail(char *email, int32_t maxLen) {
taosCloseFile(&pFile);
return 0;
+#else
+#ifdef CUS_PROMPT
+ const char *filepath = "/usr/local/"CUS_PROMPT"/email";
#else
const char *filepath = "/usr/local/taos/email";
+#endif // CUS_PROMPT
TdFilePtr pFile = taosOpenFile(filepath, TD_FILE_READ);
if (pFile == NULL) return false;
diff --git a/tests/system-test/0-others/show.py b/tests/system-test/0-others/show.py
index 3e176fe251..b284605a0e 100644
--- a/tests/system-test/0-others/show.py
+++ b/tests/system-test/0-others/show.py
@@ -28,7 +28,7 @@ class TDTestCase:
self.perf_param = ['apps','connections','consumers','queries','transactions']
self.perf_param_list = ['apps','connections','consumers','queries','trans']
self.dbname = "db"
- self.vgroups = 10
+ self.vgroups = 4
self.stbname = f'`{tdCom.getLongName(5)}`'
self.tbname = f'`{tdCom.getLongName(3)}`'
self.db_param = {
diff --git a/tests/system-test/0-others/taosdMonitor.py b/tests/system-test/0-others/taosdMonitor.py
index 944ff52d5b..8094c4e0f5 100644
--- a/tests/system-test/0-others/taosdMonitor.py
+++ b/tests/system-test/0-others/taosdMonitor.py
@@ -292,7 +292,7 @@ class TDTestCase:
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
tdSql.prepare()
# time.sleep(2)
- vgroups = "30"
+ vgroups = "4"
sql = "create database db3 vgroups " + vgroups
tdSql.query(sql)
sql = "create table db3.stb (ts timestamp, f int) tags (t int)"
diff --git a/tests/system-test/0-others/telemetry.py b/tests/system-test/0-others/telemetry.py
index bc5d276faa..3b6cb10509 100644
--- a/tests/system-test/0-others/telemetry.py
+++ b/tests/system-test/0-others/telemetry.py
@@ -181,7 +181,7 @@ class TDTestCase:
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
tdSql.prepare()
# time.sleep(2)
- vgroups = "30"
+ vgroups = "4"
sql = "create database db3 vgroups " + vgroups
tdSql.query(sql)
diff --git a/tools/shell/CMakeLists.txt b/tools/shell/CMakeLists.txt
index 600e33feab..7b1dc3a541 100644
--- a/tools/shell/CMakeLists.txt
+++ b/tools/shell/CMakeLists.txt
@@ -26,10 +26,6 @@ ELSE ()
SET(LINK_WEBSOCKET "")
ENDIF ()
-IF (CUS_NAME OR CUS_PROMPT OR CUS_EMAIL)
- ADD_DEFINITIONS(-I${CMAKE_CURRENT_SOURCE_DIR}/../../../enterprise/packaging)
-ENDIF (CUS_NAME OR CUS_PROMPT OR CUS_EMAIL)
-
IF (TD_LINUX AND TD_ALPINE)
SET(LINK_ARGP "/usr/lib/libargp.a")
ELSE ()
diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c
index 2b7d829652..f7008548f6 100644
--- a/tools/shell/src/shellArguments.c
+++ b/tools/shell/src/shellArguments.c
@@ -19,18 +19,6 @@
#include "shellInt.h"
-#ifndef CUS_NAME
- char cusName[] = "TDengine";
-#endif
-
-#ifndef CUS_PROMPT
- char cusPrompt[] = "taos";
-#endif
-
-#ifndef CUS_EMAIL
- char cusEmail[] = "";
-#endif
-
#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
#include "cus_name.h"
#endif
@@ -92,7 +80,11 @@ void shellPrintHelp() {
#endif
printf("%s%s%s%s\r\n", indent, "-w,", indent, SHELL_WIDTH);
printf("%s%s%s%s\r\n", indent, "-V,", indent, SHELL_VERSION);
- printf("\r\n\r\nReport bugs to %s.\r\n", cusEmail);
+#ifdef CUS_EMAIL
+ printf("\r\n\r\nReport bugs to %s.\r\n", CUS_EMAIL);
+#else
+ printf("\r\n\r\nReport bugs to %s.\r\n", "support@taosdata.com");
+#endif
}
#ifdef LINUX
@@ -104,7 +96,11 @@ void shellPrintHelp() {
#endif
const char *argp_program_version = version;
-const char *argp_program_bug_address = cusEmail;
+#ifdef CUS_EMAIL
+const char *argp_program_bug_address = CUS_EMAIL;
+#else
+const char *argp_program_bug_address = "support@taosdata.com";
+#endif
static struct argp_option shellOptions[] = {
{"host", 'h', "HOST", 0, SHELL_HOST},
@@ -414,10 +410,19 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) {
shell.info.clientVersion =
"Welcome to the %s Command Line Interface, Client Version:%s\r\n"
"Copyright (c) 2022 by %s, all rights reserved.\r\n\r\n";
- strcpy(shell.info.cusName, cusName);
- sprintf(shell.info.promptHeader, "%s> ", cusPrompt);
+#ifdef CUS_NAME
+ strcpy(shell.info.cusName, CUS_NAME);
+#else
+ strcpy(shell.info.cusName, "TDengine");
+#endif
char promptContinueFormat[32] = {0};
- sprintf(promptContinueFormat, "%%%zus> ", strlen(cusPrompt));
+#ifdef CUS_PROMPT
+ sprintf(shell.info.promptHeader, "%s> ", CUS_PROMPT);
+ sprintf(promptContinueFormat, "%%%zus> ", strlen(CUS_PROMPT));
+#else
+ sprintf(shell.info.promptHeader, "taos> ");
+ sprintf(promptContinueFormat, "%%%zus> ", strlen("taos"));
+#endif
sprintf(shell.info.promptContinue, promptContinueFormat, " ");
shell.info.promptSize = strlen(shell.info.promptHeader);
snprintf(shell.info.programVersion, sizeof(shell.info.programVersion),