diff --git a/include/common/tep.h b/include/common/tep.h
index bdc25f6b82..715a116bb7 100644
--- a/include/common/tep.h
+++ b/include/common/tep.h
@@ -1,6 +1,6 @@
#ifndef TDENGINE_TEP_H
#define TDENGINE_TEP_H
-int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port);
+int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port);
#endif // TDENGINE_TEP_H
diff --git a/include/common/tglobal.h b/include/common/tglobal.h
index df5f6b7c22..e66c66de07 100644
--- a/include/common/tglobal.h
+++ b/include/common/tglobal.h
@@ -185,7 +185,7 @@ extern SDiskCfg tsDiskCfg[];
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
void taosInitGlobalCfg();
-int32_t taosCheckGlobalCfg();
+int32_t taosCheckAndPrintCfg();
int32_t taosCfgDynamicOptions(char *msg);
bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t *dnodeId);
void taosAddDataDir(int index, char *v1, int level, int primary);
diff --git a/include/os/osSemaphore.h b/include/os/osSemaphore.h
index 86a9f10819..78112fc7a0 100644
--- a/include/os/osSemaphore.h
+++ b/include/os/osSemaphore.h
@@ -57,7 +57,7 @@ int64_t taosGetPthreadId(pthread_t thread);
void taosResetPthread(pthread_t* thread);
bool taosComparePthread(pthread_t first, pthread_t second);
int32_t taosGetPId();
-int32_t taosGetCurrentAPPName(char* name, int32_t* len);
+int32_t taosGetAppName(char* name, int32_t* len);
#ifdef __cplusplus
}
diff --git a/include/util/tconfig.h b/include/util/tconfig.h
index 15100423d5..18c21d238c 100644
--- a/include/util/tconfig.h
+++ b/include/util/tconfig.h
@@ -20,7 +20,7 @@
extern "C" {
#endif
-#define TSDB_CFG_MAX_NUM 123
+#define TSDB_CFG_MAX_NUM 119
#define TSDB_CFG_PRINT_LEN 23
#define TSDB_CFG_OPTION_LEN 24
#define TSDB_CFG_VALUE_LEN 41
@@ -83,11 +83,11 @@ extern int32_t tsGlobalConfigNum;
extern char * tsCfgStatusStr[];
void taosReadGlobalLogCfg();
-int32_t taosReadGlobalCfg();
-void taosPrintGlobalCfg();
+int32_t taosReadCfgFromFile();
+void taosPrintCfg();
void taosDumpGlobalCfg();
-void taosInitConfigOption(SGlobalCfg cfg);
+void taosAddConfigOption(SGlobalCfg cfg);
SGlobalCfg *taosGetConfigOption(const char *option);
#ifdef __cplusplus
diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt
index 5a47602dcd..1a67faea9f 100644
--- a/source/client/CMakeLists.txt
+++ b/source/client/CMakeLists.txt
@@ -10,3 +10,5 @@ target_link_libraries(
INTERFACE api
PRIVATE os util common transport parser
)
+
+ADD_SUBDIRECTORY(test)
\ No newline at end of file
diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h
index 27a1c92d92..4fed198ab6 100644
--- a/source/client/inc/clientInt.h
+++ b/source/client/inc/clientInt.h
@@ -61,7 +61,7 @@ typedef struct SAppInstInfo {
typedef struct SAppInfo {
int64_t startTime;
- char appName[TSDB_APPNAME_LEN];
+ char appName[TSDB_APP_NAME_LEN];
char *ep;
int32_t pid;
int32_t numOfThreads;
@@ -102,11 +102,23 @@ typedef struct SRequestObj {
void *pInfo; // sql parse info, generated by parser module
} SRequestObj;
+extern int32_t tscReqRef;
+extern void *tscQhandle;
+extern int32_t tscConnRef;
+extern void *tscRpcCache;
+extern pthread_mutex_t rpcObjMutex;
+
void* createTscObj(const char* user, const char* auth, const char *ip, uint32_t port);
void destroyTscObj(void* pTscObj);
+void* createRequest(STscObj* pObj, __taos_async_fn_t fp, void* param, int32_t type);
+void destroyRequest(void* p);
+
TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, const char *auth, const char *db, uint16_t port);
+void taos_init_imp(void);
+int taos_options_imp(TSDB_OPTION option, const char *pStr);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/client/src/client.c b/source/client/src/client.c
index b1663239e6..8aef77e9e7 100644
--- a/source/client/src/client.c
+++ b/source/client/src/client.c
@@ -13,11 +13,52 @@
* along with this program. If not, see .
*/
-//#include "taos.h"
+#include "os.h"
+#include "tdef.h"
-//TAOS_RES *taos_query(TAOS *taos, const char *sql) {
-//
-//}
+#include "tglobal.h"
+#include "clientInt.h"
+#include "tscLog.h"
+
+TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) {
+ int32_t p = (port != 0)? port:tsServerPort;
+
+ tscDebug("try to connect to %s:%u, user:%s db:%s", ip, p, user, db);
+ if (user == NULL) {
+ user = TSDB_DEFAULT_USER;
+ }
+
+ if (pass == NULL) {
+ pass = TSDB_DEFAULT_PASS;
+ }
+
+ return taos_connect_internal(ip, user, pass, NULL, db, p);
+}
+
+TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port) {
+ tscDebug("try to connect to %s:%u by auth, user:%s db:%s", ip, port, user, db);
+ if (user == NULL) {
+ user = TSDB_DEFAULT_USER;
+ }
+
+ if (auth == NULL) {
+ tscError("No auth info is given, failed to connect to server");
+ return NULL;
+ }
+
+ return taos_connect_internal(ip, user, NULL, auth, db, port);
+}
+
+TAOS *taos_connect_l(const char *ip, int ipLen, const char *user, int userLen, const char *pass, int passLen, const char *db, int dbLen, uint16_t port) {
+ char ipStr[TSDB_EP_LEN] = {0};
+ char dbStr[TSDB_DB_NAME_LEN] = {0};
+ char userStr[TSDB_USER_LEN] = {0};
+ char passStr[TSDB_KEY_LEN] = {0};
+
+ strncpy(ipStr, ip, MIN(TSDB_EP_LEN - 1, ipLen));
+ strncpy(userStr, user, MIN(TSDB_USER_LEN - 1, userLen));
+ strncpy(passStr, pass, MIN(TSDB_KEY_LEN - 1, passLen));
+ strncpy(dbStr, db, MIN(TSDB_DB_NAME_LEN - 1, dbLen));
+ return taos_connect(ipStr, userStr, passStr, dbStr, port);
+}
-int taos_init() { return 0; }
-void taos_cleanup(void) {}
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index e3e6e8d3ae..e7940e27b0 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -33,11 +33,9 @@ static bool validateDbName(const char* db) {
return stringLengthCheck(db, TSDB_DB_NAME_LEN - 1);
}
-static SRequestObj* taosConnectImpl(const char *ip, const char *user, const char *auth, const char *db, uint16_t port, __taos_async_fn_t fp, void *param);
+static STscObj* taosConnectImpl(const char *ip, const char *user, const char *auth, const char *db, uint16_t port, __taos_async_fn_t fp, void *param);
TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, const char *auth, const char *db, uint16_t port) {
- STscObj *pObj = NULL;
-
if (!validateUserName(user)) {
terrno = TSDB_CODE_TSC_INVALID_USER_LENGTH;
return NULL;
@@ -81,34 +79,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
}
}
- SRequestObj *pRequest = taosConnectImpl(ip, user, auth, db, port, NULL, NULL);
- if (pRequest != NULL) {
- pObj = pRequest->pTscObj;
-
- pRequest->body.fp = NULL;
- pRequest->body.param = pRequest;
-
-// tscBuildAndSendRequest(pRequest, NULL);
- tsem_wait(&pRequest->body.rspSem);
-
- if (pRequest->code != TSDB_CODE_SUCCESS) {
- if (pRequest->code == TSDB_CODE_RPC_FQDN_ERROR) {
- printf("taos connect failed, reason: %s\n\n", taos_errstr(pRequest));
- } else {
- printf("taos connect failed, reason: %s.\n\n", tstrerror(terrno));
- }
-
- taos_free_result(pRequest);
- taos_close(pObj);
- return NULL;
- }
-
-// tscDebug("%p DB connection is opening, rpcObj: %p, dnodeConn:%p", pObj, pObj->pRpcObj, pObj->pRpcObj->pDnodeConn);
- taos_free_result(pRequest);
- return pObj;
- }
-
- return NULL;
+ return taosConnectImpl(ip, user, auth, db, port, NULL, NULL);
}
int initEpSetFromCfg(const char *firstEp, const char *secondEp, SRpcCorEpSet *pEpSet) {
@@ -147,7 +118,7 @@ int initEpSetFromCfg(const char *firstEp, const char *secondEp, SRpcCorEpSet *pE
return 0;
}
-SRequestObj* taosConnectImpl(const char *ip, const char *user, const char *auth, const char *db, uint16_t port, __taos_async_fn_t fp, void *param) {
+STscObj* taosConnectImpl(const char *ip, const char *user, const char *auth, const char *db, uint16_t port, __taos_async_fn_t fp, void *param) {
if (taos_init() != TSDB_CODE_SUCCESS) {
return NULL;
}
@@ -155,36 +126,40 @@ SRequestObj* taosConnectImpl(const char *ip, const char *user, const char *auth,
STscObj *pObj = createTscObj(user, auth, ip, port);
if (NULL == pObj) {
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
- return NULL;
+ return pObj;
}
- SRequestObj *pRequest = (SRequestObj *)calloc(1, sizeof(SRequestObj));
- if (NULL == pRequest) {
+ // void *pRpcObj = NULL;
+ //
+ // char rpcKey[512] = {0};
+ // snprintf(rpcKey, sizeof(rpcKey), "%s:%s:%s:%d", user, auth, ip, port);
+ // if (tscAcquireRpc(rpcKey, user, auth, &pRpcObj) != 0) {
+ // terrno = TSDB_CODE_RPC_NETWORK_UNAVAIL;
+ // return NULL;
+ // }
+
+ SRequestObj *pRequest = createRequest(pObj, fp, param, TSDB_SQL_CONNECT);
+ if (pRequest == NULL) {
+ destroyTscObj(pObj);
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
- free(pObj);
+ }
+
+ // tscBuildAndSendRequest(pRequest, NULL);
+ // tsem_wait(&pRequest->body.rspSem);
+ if (pRequest->code != TSDB_CODE_SUCCESS) {
+ const char *errorMsg = (pRequest->code == TSDB_CODE_RPC_FQDN_ERROR)
+ ? taos_errstr(pRequest)
+ : tstrerror(terrno);
+
+ printf("connect failed, reason: %s\n\n", errorMsg);
+
+ taos_free_result(pRequest);
+ taos_close(pObj);
return NULL;
}
- void *pRpcObj = NULL;
-
- char rpcKey[512] = {0};
- snprintf(rpcKey, sizeof(rpcKey), "%s:%s:%s:%d", user, auth, ip, port);
- if (tscAcquireRpc(rpcKey, user, auth, &pRpcObj) != 0) {
- terrno = TSDB_CODE_RPC_NETWORK_UNAVAIL;
- return NULL;
- }
-
- pObj->pRpcObj = (SRpcObj *)pRpcObj;
-
- pRequest->pTscObj = pObj;
- pRequest->body.fp = fp;
- pRequest->body.param = param;
- pRequest->type = TSDB_SQL_CONNECT;
-
- tsem_init(&pRequest->body.rspSem, 0, 0);
-
- pObj->id = taosAddRef(tscConn, pObj);
- registerSqlObj(pRequest);
-
- return pRequest;
+// tscDebug("0x%"PRIx64" connection is opening, rpcObj: %p, dnodeConn:%p", pObj, pObj->pRpcObj,
+// pObj->pRpcObj->pDnodeConn);
+ destroyRequest(pRequest);
+ return pObj;
}
\ No newline at end of file
diff --git a/source/client/src/tscEnv.c b/source/client/src/tscEnv.c
index d77d8b1bec..26ae9a8006 100644
--- a/source/client/src/tscEnv.c
+++ b/source/client/src/tscEnv.c
@@ -31,14 +31,12 @@
#define TSC_VAR_RELEASED 0
SAppInfo appInfo;
-int32_t sentinel = TSC_VAR_NOT_RELEASE;
-
int32_t tscReqRef = -1;
void *tscQhandle;
int32_t tscConnRef = -1;
void *tscRpcCache; // TODO removed from here.
-static pthread_mutex_t rpcObjMutex; // mutex to protect open the rpc obj concurrently
+pthread_mutex_t rpcObjMutex; // mutex to protect open the rpc obj concurrently
static pthread_once_t tscinit = PTHREAD_ONCE_INIT;
static pthread_mutex_t setConfMutex = PTHREAD_MUTEX_INITIALIZER;
@@ -104,7 +102,6 @@ void* tscAcquireRpc(const char *key, const char *user, const char *secretEncrypt
pthread_mutex_unlock(&rpcObjMutex);
return pRpcObj;
#endif
-
}
void destroyTscObj(void *pTscObj) {
@@ -139,6 +136,72 @@ void* createTscObj(const char* user, const char* auth, const char *ip, uint32_t
tstrncpy(pObj->pass, auth, len);
pthread_mutex_init(&pObj->mutex, NULL);
+ pObj->id = taosAddRef(tscConnRef, pObj);
+}
+
+static void registerRequest(SRequestObj* pRequest) {
+ STscObj*pTscObj = (STscObj*) taosAcquireRef(tscConnRef, pRequest->pTscObj->id);
+ assert(pTscObj != NULL);
+
+ // connection has been released already, abort creating request.
+ pRequest->self = taosAddRef(tscReqRef, pRequest);
+
+ int32_t num = atomic_add_fetch_32(&pTscObj->numOfReqs, 1);
+
+ SInstanceActivity* pActivity = &pTscObj->pAppInfo->summary;
+ int32_t total = atomic_add_fetch_32(&pActivity->totalRequests, 1);
+ int32_t currentInst = atomic_add_fetch_32(&pActivity->currentRequests, 1);
+
+ tscDebug("0x%"PRIx64" new Request from 0x%"PRIx64", current:%d, app current:%d, total:%d", pRequest->self, pRequest->pTscObj->id, num, currentInst, total);
+}
+
+void* createRequest(STscObj* pObj, __taos_async_fn_t fp, void* param, int32_t type) {
+ assert(pObj != NULL);
+
+ SRequestObj *pRequest = (SRequestObj *)calloc(1, sizeof(SRequestObj));
+ if (NULL == pRequest) {
+ terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
+ return NULL;
+ }
+
+ // TODO generated request uuid
+ pRequest->requestId = 0;
+
+ pRequest->type = type;
+ pRequest->pTscObj = pObj;
+ pRequest->body.fp = fp;
+ pRequest->body.param = param;
+ tsem_init(&pRequest->body.rspSem, 0, 0);
+
+ registerRequest(pRequest);
+}
+
+static void deregisterRequest(SRequestObj* pRequest) {
+ assert(pRequest != NULL);
+
+ STscObj* pTscObj = pRequest->pTscObj;
+ SInstanceActivity* pActivity = &pTscObj->pAppInfo->summary;
+
+ taosReleaseRef(tscReqRef, pRequest->self);
+
+ int32_t currentInst = atomic_sub_fetch_32(&pActivity->currentRequests, 1);
+ int32_t num = atomic_sub_fetch_32(&pTscObj->numOfReqs, 1);
+
+ tscDebug("0x%"PRIx64" free Request from 0x%"PRIx64", current:%d, app current:%d", pRequest->self, pTscObj->id, num, currentInst);
+ taosReleaseRef(tscConnRef, pTscObj->id);
+}
+
+void destroyRequest(void* p) {
+ assert(p != NULL);
+ SRequestObj* pRequest = *(SRequestObj**)p;
+
+ assert(RID_VALID(pRequest->self));
+
+ tfree(pRequest->msgBuf);
+ tfree(pRequest->sqlstr);
+ tfree(pRequest->pInfo);
+
+ deregisterRequest(pRequest);
}
static void tscInitLogFile() {
@@ -167,11 +230,10 @@ void taos_init_imp(void) {
deltaToUtcInitOnce();
taosInitGlobalCfg();
- taosReadGlobalCfg();
+ taosReadCfgFromFile();
tscInitLogFile();
-
- if (taosCheckGlobalCfg()) {
+ if (taosCheckAndPrintCfg()) {
tscInitRes = -1;
return;
}
@@ -179,8 +241,7 @@ void taos_init_imp(void) {
taosInitNotes();
rpcInit();
- tscDebug("starting to initialize TAOS client ...");
- tscDebug("Local End Point is:%s", tsLocalEp);
+ tscDebug("starting to initialize TAOS client ...\nLocal End Point is:%s", tsLocalEp);
taosSetCoreDump(true);
@@ -202,55 +263,16 @@ void taos_init_imp(void) {
pthread_mutex_init(&rpcObjMutex, NULL);
tscConnRef = taosOpenRef(200, destroyTscObj);
- tscReqRef = taosOpenRef(40960, tscFreeRegisteredSqlObj);
+ tscReqRef = taosOpenRef(40960, destroyRequest);
- taosGetCurrentAPPName(appInfo.appName, NULL);
+ taosGetAppName(appInfo.appName, NULL);
appInfo.pid = taosGetPId();
appInfo.startTime = taosGetTimestampMs();
tscDebug("client is initialized successfully");
}
-int taos_init() {
- pthread_once(&tscinit, taos_init_imp);
- return tscInitRes;
-}
-
-// this function may be called by user or system, or by both simultaneously.
-void taos_cleanup(void) {
- tscDebug("start to cleanup client environment");
-
- if (atomic_val_compare_exchange_32(&sentinel, TSC_VAR_NOT_RELEASE, TSC_VAR_RELEASED) != TSC_VAR_NOT_RELEASE) {
- return;
- }
-
- int32_t id = tscReqRef;
- tscReqRef = -1;
- taosCloseRef(id);
-
- void* p = tscQhandle;
- tscQhandle = NULL;
- taosCleanUpScheduler(p);
-
- id = tscConnRef;
- tscConnRef = -1;
- taosCloseRef(id);
-
- p = tscRpcCache;
- tscRpcCache = NULL;
-
- if (p != NULL) {
- taosCacheCleanup(p);
- pthread_mutex_destroy(&rpcObjMutex);
- }
-
- pthread_mutex_destroy(&setConfMutex);
-
- rpcCleanup();
- taosCloseLog();
-}
-
-static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
+int taos_options_imp(TSDB_OPTION option, const char *pStr) {
SGlobalCfg *cfg = NULL;
switch (option) {
@@ -405,22 +427,6 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
return 0;
}
-int taos_options(TSDB_OPTION option, const void *arg, ...) {
- static int32_t lock = 0;
-
- for (int i = 1; atomic_val_compare_exchange_32(&lock, 0, 1) != 0; ++i) {
- if (i % 1000 == 0) {
- tscInfo("haven't acquire lock after spin %d times.", i);
- sched_yield();
- }
- }
-
- int ret = taos_options_imp(option, (const char*)arg);
-
- atomic_store_32(&lock, 0);
- return ret;
-}
-
#if 0
#include "cJSON.h"
static setConfRet taos_set_config_imp(const char *config){
diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp
index e69de29bb2..4f848a0750 100644
--- a/source/client/test/clientTests.cpp
+++ b/source/client/test/clientTests.cpp
@@ -0,0 +1,37 @@
+/*
+ * 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 .
+ */
+
+#include
+#include
+#include "tglobal.h"
+#pragma GCC diagnostic ignored "-Wwrite-strings"
+
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Wunused-variable"
+#pragma GCC diagnostic ignored "-Wsign-compare"
+
+#include "taos.h"
+
+namespace {
+} // namespace
+
+int main(int argc, char** argv) {
+ testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+
+TEST(testCase, driverInit_Test) {
+ taos_init();
+}
\ No newline at end of file
diff --git a/source/common/src/tep.c b/source/common/src/tep.c
index 7dda5f5f6f..3f500faf89 100644
--- a/source/common/src/tep.c
+++ b/source/common/src/tep.c
@@ -1,4 +1,6 @@
-
+#include "os.h"
+#include "tep.h"
+#include "tglobal.h"
int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port) {
*port = 0;
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index a2cbdbff4a..2e68fb2742 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -25,6 +25,7 @@
#include "tutil.h"
#include "ttimezone.h"
#include "tlocale.h"
+#include "tep.h"
// cluster
char tsFirst[TSDB_EP_LEN] = {0};
@@ -325,7 +326,7 @@ int32_t taosCfgDynamicOptions(char *msg) {
if (strncasecmp(option, "resetlog", 8) == 0) {
taosResetLog();
- taosPrintGlobalCfg();
+ taosPrintCfg();
return 0;
}
@@ -389,7 +390,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_EP_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "secondEp";
cfg.ptr = tsSecond;
@@ -399,7 +400,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_EP_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "fqdn";
cfg.ptr = tsLocalFqdn;
@@ -409,7 +410,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_FQDN_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// port
cfg.option = "serverPort";
@@ -420,7 +421,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 65056;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// directory
cfg.option = "configDir";
@@ -431,7 +432,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_FILENAME_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "logDir";
cfg.ptr = tsLogDir;
@@ -441,7 +442,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_FILENAME_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "scriptDir";
cfg.ptr = tsScriptDir;
@@ -451,7 +452,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_FILENAME_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "dataDir";
cfg.ptr = tsDataDir;
@@ -461,7 +462,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_FILENAME_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "arbitrator";
cfg.ptr = tsArbitrator;
@@ -471,7 +472,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_EP_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// dnode configs
cfg.option = "numOfThreadsPerCore";
@@ -482,7 +483,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "numOfCommitThreads";
cfg.ptr = &tsNumOfCommitThreads;
@@ -492,7 +493,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 100;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "ratioOfQueryCores";
cfg.ptr = &tsRatioOfQueryCores;
@@ -502,7 +503,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 2.0f;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "maxNumOfDistinctRes";
cfg.ptr = &tsMaxNumOfDistinctResults;
@@ -512,7 +513,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10000*10000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "numOfMnodes";
cfg.ptr = &tsNumOfMnodes;
@@ -522,7 +523,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 3;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "vnodeBak";
cfg.ptr = &tsEnableVnodeBak;
@@ -532,7 +533,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "telemetryReporting";
cfg.ptr = &tsEnableTelemetryReporting;
@@ -542,7 +543,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "balance";
cfg.ptr = &tsEnableBalance;
@@ -552,7 +553,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "balanceInterval";
cfg.ptr = &tsBalanceInterval;
@@ -562,7 +563,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 30000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// 0-any; 1-mnode; 2-vnode
cfg.option = "role";
@@ -573,7 +574,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 2;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// timer
cfg.option = "maxTmrCtrl";
@@ -584,7 +585,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 2048;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "monitorInterval";
cfg.ptr = &tsMonitorInterval;
@@ -594,7 +595,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 600;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_SECOND;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "offlineThreshold";
cfg.ptr = &tsOfflineThreshold;
@@ -604,7 +605,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 86400 * 365;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_SECOND;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "rpcTimer";
cfg.ptr = &tsRpcTimer;
@@ -614,7 +615,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 3000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "rpcForceTcp";
cfg.ptr = &tsRpcForceTcp;
@@ -624,7 +625,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "rpcMaxTime";
cfg.ptr = &tsRpcMaxTime;
@@ -634,7 +635,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 7200;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_SECOND;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "statusInterval";
cfg.ptr = &tsStatusInterval;
@@ -644,7 +645,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_SECOND;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "shellActivityTimer";
cfg.ptr = &tsShellActivityTimer;
@@ -654,7 +655,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 120;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_SECOND;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "minSlidingTime";
cfg.ptr = &tsMinSlidingTime;
@@ -664,7 +665,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "minIntervalTime";
cfg.ptr = &tsMinIntervalTime;
@@ -674,7 +675,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "maxStreamCompDelay";
cfg.ptr = &tsMaxStreamComputDelay;
@@ -684,7 +685,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1000000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "maxFirstStreamCompDelay";
cfg.ptr = &tsStreamCompStartDelay;
@@ -694,7 +695,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1000000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "retryStreamCompDelay";
cfg.ptr = &tsRetryStreamCompDelay;
@@ -705,7 +706,7 @@ static void doInitGlobalConfig(void) {
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "streamCompDelayRatio";
cfg.ptr = &tsStreamComputDelayRatio;
cfg.valType = TAOS_CFG_VTYPE_FLOAT;
@@ -714,7 +715,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0.9f;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "maxVgroupsPerDb";
cfg.ptr = &tsMaxVgroupsPerDb;
@@ -724,7 +725,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 8192;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// database configs
cfg.option = "maxTablesPerVnode";
@@ -735,7 +736,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_TABLES;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "minTablesPerVnode";
cfg.ptr = &tsMinTablePerVnode;
@@ -745,7 +746,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_TABLES;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "tableIncStepPerVnode";
cfg.ptr = &tsTableIncStepPerVnode;
@@ -755,7 +756,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_TABLES;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "cache";
cfg.ptr = &tsCacheBlockSize;
@@ -765,7 +766,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_CACHE_BLOCK_SIZE;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MB;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "blocks";
cfg.ptr = &tsBlocksPerVnode;
@@ -775,7 +776,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_TOTAL_BLOCKS;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "days";
cfg.ptr = &tsDaysPerFile;
@@ -785,7 +786,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_DAYS_PER_FILE;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "keep";
cfg.ptr = &tsDaysToKeep;
@@ -795,7 +796,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_KEEP;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "minRows";
cfg.ptr = &tsMinRowsInFileBlock;
@@ -805,7 +806,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_MIN_ROW_FBLOCK;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "maxRows";
cfg.ptr = &tsMaxRowsInFileBlock;
@@ -815,7 +816,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_MAX_ROW_FBLOCK;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "precision";
cfg.ptr = &tsTimePrecision;
@@ -825,7 +826,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_PRECISION;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "comp";
cfg.ptr = &tsCompression;
@@ -835,7 +836,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_COMP_LEVEL;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "walLevel";
cfg.ptr = &tsWAL;
@@ -845,7 +846,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_WAL_LEVEL;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "fsync";
cfg.ptr = &tsFsyncPeriod;
@@ -855,7 +856,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_FSYNC_PERIOD;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "replica";
cfg.ptr = &tsReplications;
@@ -865,7 +866,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_DB_REPLICA_OPTION;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "partitions";
cfg.ptr = &tsPartitons;
@@ -875,7 +876,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_DB_PARTITON_OPTION;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "quorum";
cfg.ptr = &tsQuorum;
@@ -885,7 +886,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_DB_QUORUM_OPTION;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "update";
cfg.ptr = &tsUpdate;
@@ -895,7 +896,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_DB_UPDATE;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "cachelast";
cfg.ptr = &tsCacheLastRow;
@@ -905,7 +906,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_DB_CACHE_LAST_ROW;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "mqttHostName";
cfg.ptr = tsMqttHostName;
@@ -915,7 +916,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_MQTT_HOSTNAME_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "mqttPort";
cfg.ptr = tsMqttPort;
@@ -925,7 +926,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_MQTT_PORT_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "mqttTopic";
cfg.ptr = tsMqttTopic;
@@ -935,7 +936,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_MQTT_TOPIC_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "compressMsgSize";
cfg.ptr = &tsCompressMsgSize;
@@ -945,7 +946,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 100000000.0f;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "compressColData";
cfg.ptr = &tsCompressColData;
@@ -955,7 +956,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 100000000.0f;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "maxSQLLength";
cfg.ptr = &tsMaxSQLStringLen;
@@ -965,7 +966,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_ALLOWED_SQL_LEN;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_BYTE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "maxWildCardsLength";
cfg.ptr = &tsMaxWildCardsLen;
@@ -975,7 +976,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_FIELD_LEN;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_BYTE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "maxRegexStringLen";
cfg.ptr = &tsMaxRegexStringLen;
@@ -985,7 +986,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_FIELD_LEN;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_BYTE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "maxNumOfOrderedRes";
cfg.ptr = &tsMaxNumOfOrderedResults;
@@ -995,7 +996,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_ALLOWED_SQL_LEN;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "queryBufferSize";
cfg.ptr = &tsQueryBufferSize;
@@ -1005,7 +1006,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 500000000000.0f;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_BYTE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "retrieveBlockingModel";
cfg.ptr = &tsRetrieveBlockingModel;
@@ -1015,7 +1016,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "keepColumnName";
cfg.ptr = &tsKeepOriginalColumnName;
@@ -1025,7 +1026,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// locale & charset
cfg.option = "timezone";
@@ -1036,7 +1037,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_TIMEZONE_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "locale";
cfg.ptr = tsLocale;
@@ -1046,7 +1047,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_LOCALE_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "charset";
cfg.ptr = tsCharset;
@@ -1056,7 +1057,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = TSDB_LOCALE_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// connect configs
cfg.option = "maxShellConns";
@@ -1067,7 +1068,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 50000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "maxConnections";
cfg.ptr = &tsMaxConnections;
@@ -1077,7 +1078,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 100000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "minimalLogDirGB";
cfg.ptr = &tsMinimalLogDirGB;
@@ -1087,7 +1088,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_GB;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "minimalTmpDirGB";
cfg.ptr = &tsReservedTmpDirectorySpace;
@@ -1097,7 +1098,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_GB;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "minimalDataDirGB";
cfg.ptr = &tsMinimalDataDirGB;
@@ -1107,7 +1108,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_GB;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// module configs
cfg.option = "mnodeEqualVnodeNum";
@@ -1118,7 +1119,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// module configs
cfg.option = "flowctrl";
@@ -1129,7 +1130,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "slaveQuery";
cfg.ptr = &tsEnableSlaveQuery;
@@ -1139,7 +1140,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "adjustMaster";
cfg.ptr = &tsEnableAdjustMaster;
@@ -1149,7 +1150,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "mqtt";
cfg.ptr = &tsEnableMqttModule;
@@ -1159,7 +1160,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "monitor";
cfg.ptr = &tsEnableMonitorModule;
@@ -1169,7 +1170,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "stream";
cfg.ptr = &tsEnableStream;
@@ -1179,7 +1180,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "topicBianryLen";
cfg.ptr = &tsTopicBianryLen;
@@ -1189,7 +1190,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 16000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "telegrafUseFieldNum";
cfg.ptr = &tsTelegrafUseFieldNum;
@@ -1199,7 +1200,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "restfulRowLimit";
cfg.ptr = &tsRestRowLimit;
@@ -1209,7 +1210,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// debug flag
cfg.option = "numOfLogLines";
@@ -1220,7 +1221,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 2000000000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "logKeepDays";
cfg.ptr = &tsLogKeepDays;
@@ -1230,7 +1231,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 365000;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "asyncLog";
cfg.ptr = &tsAsyncLog;
@@ -1240,7 +1241,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "debugFlag";
cfg.ptr = &debugFlag;
@@ -1250,7 +1251,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "mDebugFlag";
cfg.ptr = &mDebugFlag;
@@ -1260,7 +1261,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "dDebugFlag";
cfg.ptr = &dDebugFlag;
@@ -1270,7 +1271,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "sDebugFlag";
cfg.ptr = &sDebugFlag;
@@ -1280,7 +1281,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "wDebugFlag";
cfg.ptr = &wDebugFlag;
@@ -1290,7 +1291,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "sdbDebugFlag";
@@ -1301,7 +1302,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "rpcDebugFlag";
cfg.ptr = &rpcDebugFlag;
@@ -1311,7 +1312,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "tmrDebugFlag";
cfg.ptr = &tmrDebugFlag;
@@ -1321,7 +1322,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "cDebugFlag";
cfg.ptr = &cDebugFlag;
@@ -1331,7 +1332,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "jniDebugFlag";
cfg.ptr = &jniDebugFlag;
@@ -1341,7 +1342,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "odbcDebugFlag";
cfg.ptr = &odbcDebugFlag;
@@ -1351,7 +1352,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "uDebugFlag";
cfg.ptr = &uDebugFlag;
@@ -1361,7 +1362,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "httpDebugFlag";
cfg.ptr = &httpDebugFlag;
@@ -1371,7 +1372,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "mqttDebugFlag";
cfg.ptr = &mqttDebugFlag;
@@ -1381,7 +1382,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "monDebugFlag";
cfg.ptr = &monDebugFlag;
@@ -1391,7 +1392,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "qDebugFlag";
cfg.ptr = &qDebugFlag;
@@ -1401,7 +1402,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "vDebugFlag";
cfg.ptr = &vDebugFlag;
@@ -1411,7 +1412,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "tsdbDebugFlag";
cfg.ptr = &tsdbDebugFlag;
@@ -1421,7 +1422,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "cqDebugFlag";
cfg.ptr = &cqDebugFlag;
@@ -1431,7 +1432,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "enableRecordSql";
cfg.ptr = &tsTscEnableRecordSql;
@@ -1441,7 +1442,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "enableCoreFile";
cfg.ptr = &tsEnableCoreFile;
@@ -1451,7 +1452,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// version info
cfg.option = "gitinfo";
@@ -1462,7 +1463,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "gitinfoOfInternal";
cfg.ptr = gitinfoOfInternal;
@@ -1472,7 +1473,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "buildinfo";
cfg.ptr = buildinfo;
@@ -1482,7 +1483,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "version";
cfg.ptr = version;
@@ -1492,7 +1493,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "maxBinaryDisplayWidth";
cfg.ptr = &tsMaxBinaryDisplayWidth;
@@ -1502,7 +1503,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 65536;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "tempDir";
cfg.ptr = tsTempDir;
@@ -1512,7 +1513,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = PATH_MAX;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "tsdbMetaCompactRatio";
cfg.ptr = &tsTsdbMetaCompactRatio;
@@ -1522,7 +1523,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 100;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
// enable kill long query
cfg.option = "deadLockKillQuery";
@@ -1533,7 +1534,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1;
cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
#ifdef TD_TSZ
// lossy compress
@@ -1545,7 +1546,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0;
cfg.ptrLength = tListLen(lossyColumns);
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "fPrecision";
cfg.ptr = &fPrecision;
@@ -1557,7 +1558,7 @@ static void doInitGlobalConfig(void) {
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "dPrecision";
cfg.ptr = &dPrecision;
@@ -1567,7 +1568,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = MAX_FLOAT;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "maxRange";
cfg.ptr = &maxRange;
@@ -1577,7 +1578,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 65536;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
cfg.option = "range";
cfg.ptr = &curRange;
@@ -1587,10 +1588,10 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 65536;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
- taosInitConfigOption(cfg);
+ taosAddConfigOption(cfg);
assert(tsGlobalConfigNum == TSDB_CFG_MAX_NUM);
#else
- assert(tsGlobalConfigNum == TSDB_CFG_MAX_NUM - 5);
+ assert(tsGlobalConfigNum == (TSDB_CFG_MAX_NUM - 5));
#endif
}
@@ -1599,7 +1600,7 @@ void taosInitGlobalCfg() {
pthread_once(&tsInitGlobalCfgOnce, doInitGlobalConfig);
}
-int32_t taosCheckGlobalCfg() {
+int32_t taosCheckAndPrintCfg() {
char fqdn[TSDB_FQDN_LEN];
uint16_t port;
@@ -1653,30 +1654,13 @@ int32_t taosCheckGlobalCfg() {
tsMaxTablePerVnode = tsMinTablePerVnode;
}
- // todo refactor
- tsVersion = 0;
- for (int ver = 0, i = 0; i < TSDB_VERSION_LEN; ++i) {
- if (version[i] >= '0' && version[i] <= '9') {
- ver = ver * 10 + (version[i] - '0');
- } else if (version[i] == '.') {
- tsVersion |= ver & 0xFF;
- tsVersion <<= 8;
-
- ver = 0;
- } else if (version[i] == 0) {
- tsVersion |= ver & 0xFF;
-
- break;
- }
- }
-
if (tsQueryBufferSize >= 0) {
tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL;
}
uInfo(" check global cfg completed");
uInfo("==================================");
- taosPrintGlobalCfg();
+ taosPrintCfg();
return 0;
}
diff --git a/source/dnode/mgmt/daemon/src/daemon.c b/source/dnode/mgmt/daemon/src/daemon.c
index cf9a960062..32a5380ff8 100644
--- a/source/dnode/mgmt/daemon/src/daemon.c
+++ b/source/dnode/mgmt/daemon/src/daemon.c
@@ -117,7 +117,7 @@ int dmnReadConfig(const char *path) {
return -1;
}
- if (taosCheckGlobalCfg() != 0) {
+ if (taosCheckAndPrintCfg() != 0) {
uError("failed to check global config");
return -1;
}
diff --git a/source/os/src/osSemaphore.c b/source/os/src/osSemaphore.c
index 2385d10285..0d7066b5c8 100644
--- a/source/os/src/osSemaphore.c
+++ b/source/os/src/osSemaphore.c
@@ -42,7 +42,7 @@ bool taosComparePthread(pthread_t first, pthread_t second) { return first.p == s
int32_t taosGetPId() { return GetCurrentProcessId(); }
-int32_t taosGetCurrentAPPName(char* name, int32_t* len) {
+int32_t taosGetAppName(char* name, int32_t* len) {
char filepath[1024] = {0};
GetModuleFileName(NULL, filepath, MAX_PATH);
@@ -358,7 +358,7 @@ bool taosComparePthread(pthread_t first, pthread_t second) { return pthread_equa
int32_t taosGetPId() { return (int32_t)getpid(); }
-int32_t taosGetCurrentAPPName(char *name, int32_t *len) {
+int32_t taosGetAppName(char *name, int32_t *len) {
char buf[PATH_MAX + 1];
buf[0] = '\0';
proc_name(getpid(), buf, sizeof(buf) - 1);
@@ -392,7 +392,7 @@ void taosResetPthread(pthread_t* thread) { *thread = 0; }
bool taosComparePthread(pthread_t first, pthread_t second) { return first == second; }
int32_t taosGetPId() { return getpid(); }
-int32_t taosGetCurrentAPPName(char* name, int32_t* len) {
+int32_t taosGetAppName(char* name, int32_t* len) {
const char* self = "/proc/self/exe";
char path[PATH_MAX] = {0};
diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c
index ca817c4c1e..f892b4d8c0 100644
--- a/source/os/src/osSysinfo.c
+++ b/source/os/src/osSysinfo.c
@@ -714,7 +714,7 @@ static void taosGetSystemLocale() { // get and set default locale
//printf("locale not configured, set to system default:%s", tsLocale);
}
- /* if user does not specify the charset, extract it from locale */
+ // if user does not specify the charset, extract it from locale
char *str = strrchr(tsLocale, sep);
if (str != NULL) {
str++;
@@ -1118,13 +1118,13 @@ char *taosGetCmdlineByPID(int pid) {
SysNameInfo taosGetSysNameInfo() {
SysNameInfo info = {0};
- struct utsname buf;
- if (!uname(&buf)) {
- info.sysname = buf.sysname;
- info.sysname == buf.nodename;
- info.sysname = buf.release;
- info.sysname = buf.version;
- info.sysname = buf.machine;
+ struct utsname uts;
+ if (!uname(&uts)) {
+ info.sysname = strdup(uts.sysname);
+ info.nodename = strdup(uts.nodename);
+ info.release = strdup(uts.release);
+ info.version = strdup(uts.version);
+ info.machine = strdup(uts.machine);
}
return info;
diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c
index 8a6f389366..726247d450 100644
--- a/source/util/src/tconfig.c
+++ b/source/util/src/tconfig.c
@@ -282,7 +282,7 @@ static void taosReadConfigOption(const char *option, char *value, char *value2,
}
}
-void taosInitConfigOption(SGlobalCfg cfg) {
+void taosAddConfigOption(SGlobalCfg cfg) {
tsGlobalConfig[tsGlobalConfigNum++] = cfg;
}
@@ -335,7 +335,7 @@ void taosReadGlobalLogCfg() {
fclose(fp);
}
-int32_t taosReadGlobalCfg() {
+int32_t taosReadCfgFromFile() {
char * line, *option, *value, *value2, *value3;
int olen, vlen, vlen2, vlen3;
char fileName[PATH_MAX] = {0};
@@ -396,7 +396,7 @@ int32_t taosReadGlobalCfg() {
return 0;
}
-void taosPrintGlobalCfg() {
+void taosPrintCfg() {
uInfo(" taos config & system info:");
uInfo("==================================");
@@ -443,7 +443,6 @@ void taosPrintGlobalCfg() {
}
taosPrintOsInfo();
- // taosPrintDataDirCfg();
uInfo("==================================");
}
diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c
index e6cc3a53af..24293fe9d3 100644
--- a/source/util/src/tlog.c
+++ b/source/util/src/tlog.c
@@ -112,7 +112,7 @@ static int32_t taosPushLogBuffer(SLogBuff *tLogBuff, char *msg, int32_t msgLen
static SLogBuff *taosLogBuffNew(int32_t bufSize);
static void taosCloseLogByFd(int32_t oldFd);
static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum);
-extern void taosPrintGlobalCfg();
+extern void taosPrintCfg();
static int32_t taosCompressFile(char *srcFileName, char *destFileName);
static int32_t taosStartLog() {
@@ -222,7 +222,7 @@ static void *taosThreadToOpenNewFile(void *param) {
uInfo(" new log file:%d is opened", tsLogObj.flag);
uInfo("==================================");
- taosPrintGlobalCfg();
+ taosPrintCfg();
taosKeepOldLog(keepName);
return NULL;
diff --git a/source/util/src/ttimer.c b/source/util/src/ttimer.c
index 56186d9b24..1fdc2257d7 100644
--- a/source/util/src/ttimer.c
+++ b/source/util/src/ttimer.c
@@ -20,12 +20,10 @@
#include "tutil.h"
#include "taoserror.h"
-extern int8_t tscEmbedded;
-
-#define tmrFatal(...) { if (tmrDebugFlag & DEBUG_FATAL) { taosPrintLog("TMR FATAL ", tscEmbedded ? 255 : tmrDebugFlag, __VA_ARGS__); }}
-#define tmrError(...) { if (tmrDebugFlag & DEBUG_ERROR) { taosPrintLog("TMR ERROR ", tscEmbedded ? 255 : tmrDebugFlag, __VA_ARGS__); }}
-#define tmrWarn(...) { if (tmrDebugFlag & DEBUG_WARN) { taosPrintLog("TMR WARN ", tscEmbedded ? 255 : tmrDebugFlag, __VA_ARGS__); }}
-#define tmrInfo(...) { if (tmrDebugFlag & DEBUG_INFO) { taosPrintLog("TMR ", tscEmbedded ? 255 : tmrDebugFlag, __VA_ARGS__); }}
+#define tmrFatal(...) { if (tmrDebugFlag & DEBUG_FATAL) { taosPrintLog("TMR FATAL ", tmrDebugFlag, __VA_ARGS__); }}
+#define tmrError(...) { if (tmrDebugFlag & DEBUG_ERROR) { taosPrintLog("TMR ERROR ", tmrDebugFlag, __VA_ARGS__); }}
+#define tmrWarn(...) { if (tmrDebugFlag & DEBUG_WARN) { taosPrintLog("TMR WARN ", tmrDebugFlag, __VA_ARGS__); }}
+#define tmrInfo(...) { if (tmrDebugFlag & DEBUG_INFO) { taosPrintLog("TMR ", tmrDebugFlag, __VA_ARGS__); }}
#define tmrDebug(...) { if (tmrDebugFlag & DEBUG_DEBUG) { taosPrintLog("TMR ", tmrDebugFlag, __VA_ARGS__); }}
#define tmrTrace(...) { if (tmrDebugFlag & DEBUG_TRACE) { taosPrintLog("TMR ", tmrDebugFlag, __VA_ARGS__); }}