提交 cfc63289 编写于 作者: H Haojun Liao

[td-10564] refactor and add test cases.

上级 770e0331
...@@ -185,7 +185,7 @@ extern SDiskCfg tsDiskCfg[]; ...@@ -185,7 +185,7 @@ extern SDiskCfg tsDiskCfg[];
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize) #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
void taosInitGlobalCfg(); void taosInitGlobalCfg();
int32_t taosCheckGlobalCfg(); int32_t taosCheckAndPrintCfg();
int32_t taosCfgDynamicOptions(char *msg); int32_t taosCfgDynamicOptions(char *msg);
bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t *dnodeId); bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t *dnodeId);
void taosAddDataDir(int index, char *v1, int level, int primary); void taosAddDataDir(int index, char *v1, int level, int primary);
......
...@@ -57,7 +57,7 @@ int64_t taosGetPthreadId(pthread_t thread); ...@@ -57,7 +57,7 @@ int64_t taosGetPthreadId(pthread_t thread);
void taosResetPthread(pthread_t* thread); void taosResetPthread(pthread_t* thread);
bool taosComparePthread(pthread_t first, pthread_t second); bool taosComparePthread(pthread_t first, pthread_t second);
int32_t taosGetPId(); int32_t taosGetPId();
int32_t taosGetCurrentAPPName(char* name, int32_t* len); int32_t taosGetAppName(char* name, int32_t* len);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
extern "C" { extern "C" {
#endif #endif
#define TSDB_CFG_MAX_NUM 123 #define TSDB_CFG_MAX_NUM 119
#define TSDB_CFG_PRINT_LEN 23 #define TSDB_CFG_PRINT_LEN 23
#define TSDB_CFG_OPTION_LEN 24 #define TSDB_CFG_OPTION_LEN 24
#define TSDB_CFG_VALUE_LEN 41 #define TSDB_CFG_VALUE_LEN 41
...@@ -83,11 +83,11 @@ extern int32_t tsGlobalConfigNum; ...@@ -83,11 +83,11 @@ extern int32_t tsGlobalConfigNum;
extern char * tsCfgStatusStr[]; extern char * tsCfgStatusStr[];
void taosReadGlobalLogCfg(); void taosReadGlobalLogCfg();
int32_t taosReadGlobalCfg(); int32_t taosReadCfgFromFile();
void taosPrintGlobalCfg(); void taosPrintCfg();
void taosDumpGlobalCfg(); void taosDumpGlobalCfg();
void taosInitConfigOption(SGlobalCfg cfg); void taosAddConfigOption(SGlobalCfg cfg);
SGlobalCfg *taosGetConfigOption(const char *option); SGlobalCfg *taosGetConfigOption(const char *option);
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -10,3 +10,5 @@ target_link_libraries( ...@@ -10,3 +10,5 @@ target_link_libraries(
INTERFACE api INTERFACE api
PRIVATE os util common transport parser PRIVATE os util common transport parser
) )
ADD_SUBDIRECTORY(test)
\ No newline at end of file
...@@ -61,7 +61,7 @@ typedef struct SAppInstInfo { ...@@ -61,7 +61,7 @@ typedef struct SAppInstInfo {
typedef struct SAppInfo { typedef struct SAppInfo {
int64_t startTime; int64_t startTime;
char appName[TSDB_APPNAME_LEN]; char appName[TSDB_APP_NAME_LEN];
char *ep; char *ep;
int32_t pid; int32_t pid;
int32_t numOfThreads; int32_t numOfThreads;
...@@ -102,11 +102,23 @@ typedef struct SRequestObj { ...@@ -102,11 +102,23 @@ typedef struct SRequestObj {
void *pInfo; // sql parse info, generated by parser module void *pInfo; // sql parse info, generated by parser module
} SRequestObj; } 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* createTscObj(const char* user, const char* auth, const char *ip, uint32_t port);
void destroyTscObj(void* pTscObj); 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); 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 #ifdef __cplusplus
} }
#endif #endif
......
...@@ -13,11 +13,52 @@ ...@@ -13,11 +13,52 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
//#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) {}
...@@ -33,11 +33,9 @@ static bool validateDbName(const char* db) { ...@@ -33,11 +33,9 @@ static bool validateDbName(const char* db) {
return stringLengthCheck(db, TSDB_DB_NAME_LEN - 1); 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) { 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)) { if (!validateUserName(user)) {
terrno = TSDB_CODE_TSC_INVALID_USER_LENGTH; terrno = TSDB_CODE_TSC_INVALID_USER_LENGTH;
return NULL; return NULL;
...@@ -81,34 +79,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, ...@@ -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); return 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;
} }
int initEpSetFromCfg(const char *firstEp, const char *secondEp, SRpcCorEpSet *pEpSet) { int initEpSetFromCfg(const char *firstEp, const char *secondEp, SRpcCorEpSet *pEpSet) {
...@@ -147,7 +118,7 @@ int initEpSetFromCfg(const char *firstEp, const char *secondEp, SRpcCorEpSet *pE ...@@ -147,7 +118,7 @@ int initEpSetFromCfg(const char *firstEp, const char *secondEp, SRpcCorEpSet *pE
return 0; 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) { if (taos_init() != TSDB_CODE_SUCCESS) {
return NULL; return NULL;
} }
...@@ -155,36 +126,40 @@ SRequestObj* taosConnectImpl(const char *ip, const char *user, const char *auth, ...@@ -155,36 +126,40 @@ SRequestObj* taosConnectImpl(const char *ip, const char *user, const char *auth,
STscObj *pObj = createTscObj(user, auth, ip, port); STscObj *pObj = createTscObj(user, auth, ip, port);
if (NULL == pObj) { if (NULL == pObj) {
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
return NULL; return pObj;
} }
SRequestObj *pRequest = (SRequestObj *)calloc(1, sizeof(SRequestObj)); // void *pRpcObj = NULL;
if (NULL == pRequest) { //
// 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; terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
free(pObj);
return NULL;
} }
void *pRpcObj = NULL; // 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);
char rpcKey[512] = {0}; taos_free_result(pRequest);
snprintf(rpcKey, sizeof(rpcKey), "%s:%s:%s:%d", user, auth, ip, port); taos_close(pObj);
if (tscAcquireRpc(rpcKey, user, auth, &pRpcObj) != 0) {
terrno = TSDB_CODE_RPC_NETWORK_UNAVAIL;
return NULL; return NULL;
} }
pObj->pRpcObj = (SRpcObj *)pRpcObj; // tscDebug("0x%"PRIx64" connection is opening, rpcObj: %p, dnodeConn:%p", pObj, pObj->pRpcObj,
// pObj->pRpcObj->pDnodeConn);
pRequest->pTscObj = pObj; destroyRequest(pRequest);
pRequest->body.fp = fp; return pObj;
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;
} }
\ No newline at end of file
...@@ -31,14 +31,12 @@ ...@@ -31,14 +31,12 @@
#define TSC_VAR_RELEASED 0 #define TSC_VAR_RELEASED 0
SAppInfo appInfo; SAppInfo appInfo;
int32_t sentinel = TSC_VAR_NOT_RELEASE;
int32_t tscReqRef = -1; int32_t tscReqRef = -1;
void *tscQhandle; void *tscQhandle;
int32_t tscConnRef = -1; int32_t tscConnRef = -1;
void *tscRpcCache; // TODO removed from here. 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_once_t tscinit = PTHREAD_ONCE_INIT;
static pthread_mutex_t setConfMutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t setConfMutex = PTHREAD_MUTEX_INITIALIZER;
...@@ -104,7 +102,6 @@ void* tscAcquireRpc(const char *key, const char *user, const char *secretEncrypt ...@@ -104,7 +102,6 @@ void* tscAcquireRpc(const char *key, const char *user, const char *secretEncrypt
pthread_mutex_unlock(&rpcObjMutex); pthread_mutex_unlock(&rpcObjMutex);
return pRpcObj; return pRpcObj;
#endif #endif
} }
void destroyTscObj(void *pTscObj) { void destroyTscObj(void *pTscObj) {
...@@ -139,6 +136,72 @@ void* createTscObj(const char* user, const char* auth, const char *ip, uint32_t ...@@ -139,6 +136,72 @@ void* createTscObj(const char* user, const char* auth, const char *ip, uint32_t
tstrncpy(pObj->pass, auth, len); tstrncpy(pObj->pass, auth, len);
pthread_mutex_init(&pObj->mutex, NULL); 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() { static void tscInitLogFile() {
...@@ -167,11 +230,10 @@ void taos_init_imp(void) { ...@@ -167,11 +230,10 @@ void taos_init_imp(void) {
deltaToUtcInitOnce(); deltaToUtcInitOnce();
taosInitGlobalCfg(); taosInitGlobalCfg();
taosReadGlobalCfg(); taosReadCfgFromFile();
tscInitLogFile(); tscInitLogFile();
if (taosCheckAndPrintCfg()) {
if (taosCheckGlobalCfg()) {
tscInitRes = -1; tscInitRes = -1;
return; return;
} }
...@@ -179,8 +241,7 @@ void taos_init_imp(void) { ...@@ -179,8 +241,7 @@ void taos_init_imp(void) {
taosInitNotes(); taosInitNotes();
rpcInit(); rpcInit();
tscDebug("starting to initialize TAOS client ..."); tscDebug("starting to initialize TAOS client ...\nLocal End Point is:%s", tsLocalEp);
tscDebug("Local End Point is:%s", tsLocalEp);
taosSetCoreDump(true); taosSetCoreDump(true);
...@@ -202,55 +263,16 @@ void taos_init_imp(void) { ...@@ -202,55 +263,16 @@ void taos_init_imp(void) {
pthread_mutex_init(&rpcObjMutex, NULL); pthread_mutex_init(&rpcObjMutex, NULL);
tscConnRef = taosOpenRef(200, destroyTscObj); tscConnRef = taosOpenRef(200, destroyTscObj);
tscReqRef = taosOpenRef(40960, tscFreeRegisteredSqlObj); tscReqRef = taosOpenRef(40960, destroyRequest);
taosGetCurrentAPPName(appInfo.appName, NULL); taosGetAppName(appInfo.appName, NULL);
appInfo.pid = taosGetPId(); appInfo.pid = taosGetPId();
appInfo.startTime = taosGetTimestampMs(); appInfo.startTime = taosGetTimestampMs();
tscDebug("client is initialized successfully"); tscDebug("client is initialized successfully");
} }
int taos_init() { int taos_options_imp(TSDB_OPTION option, const char *pStr) {
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) {
SGlobalCfg *cfg = NULL; SGlobalCfg *cfg = NULL;
switch (option) { switch (option) {
...@@ -405,22 +427,6 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) { ...@@ -405,22 +427,6 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
return 0; 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 #if 0
#include "cJSON.h" #include "cJSON.h"
static setConfRet taos_set_config_imp(const char *config){ static setConfRet taos_set_config_imp(const char *config){
......
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <gtest/gtest.h>
#include <iostream>
#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
#include "os.h"
#include "tep.h"
#include "tglobal.h"
int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port) { int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port) {
*port = 0; *port = 0;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "tutil.h" #include "tutil.h"
#include "ttimezone.h" #include "ttimezone.h"
#include "tlocale.h" #include "tlocale.h"
#include "tep.h"
// cluster // cluster
char tsFirst[TSDB_EP_LEN] = {0}; char tsFirst[TSDB_EP_LEN] = {0};
...@@ -325,7 +326,7 @@ int32_t taosCfgDynamicOptions(char *msg) { ...@@ -325,7 +326,7 @@ int32_t taosCfgDynamicOptions(char *msg) {
if (strncasecmp(option, "resetlog", 8) == 0) { if (strncasecmp(option, "resetlog", 8) == 0) {
taosResetLog(); taosResetLog();
taosPrintGlobalCfg(); taosPrintCfg();
return 0; return 0;
} }
...@@ -389,7 +390,7 @@ static void doInitGlobalConfig(void) { ...@@ -389,7 +390,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_EP_LEN; cfg.ptrLength = TSDB_EP_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "secondEp"; cfg.option = "secondEp";
cfg.ptr = tsSecond; cfg.ptr = tsSecond;
...@@ -399,7 +400,7 @@ static void doInitGlobalConfig(void) { ...@@ -399,7 +400,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_EP_LEN; cfg.ptrLength = TSDB_EP_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "fqdn"; cfg.option = "fqdn";
cfg.ptr = tsLocalFqdn; cfg.ptr = tsLocalFqdn;
...@@ -409,7 +410,7 @@ static void doInitGlobalConfig(void) { ...@@ -409,7 +410,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_FQDN_LEN; cfg.ptrLength = TSDB_FQDN_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// port // port
cfg.option = "serverPort"; cfg.option = "serverPort";
...@@ -420,7 +421,7 @@ static void doInitGlobalConfig(void) { ...@@ -420,7 +421,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 65056; cfg.maxValue = 65056;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// directory // directory
cfg.option = "configDir"; cfg.option = "configDir";
...@@ -431,7 +432,7 @@ static void doInitGlobalConfig(void) { ...@@ -431,7 +432,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_FILENAME_LEN; cfg.ptrLength = TSDB_FILENAME_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "logDir"; cfg.option = "logDir";
cfg.ptr = tsLogDir; cfg.ptr = tsLogDir;
...@@ -441,7 +442,7 @@ static void doInitGlobalConfig(void) { ...@@ -441,7 +442,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_FILENAME_LEN; cfg.ptrLength = TSDB_FILENAME_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "scriptDir"; cfg.option = "scriptDir";
cfg.ptr = tsScriptDir; cfg.ptr = tsScriptDir;
...@@ -451,7 +452,7 @@ static void doInitGlobalConfig(void) { ...@@ -451,7 +452,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_FILENAME_LEN; cfg.ptrLength = TSDB_FILENAME_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "dataDir"; cfg.option = "dataDir";
cfg.ptr = tsDataDir; cfg.ptr = tsDataDir;
...@@ -461,7 +462,7 @@ static void doInitGlobalConfig(void) { ...@@ -461,7 +462,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_FILENAME_LEN; cfg.ptrLength = TSDB_FILENAME_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "arbitrator"; cfg.option = "arbitrator";
cfg.ptr = tsArbitrator; cfg.ptr = tsArbitrator;
...@@ -471,7 +472,7 @@ static void doInitGlobalConfig(void) { ...@@ -471,7 +472,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_EP_LEN; cfg.ptrLength = TSDB_EP_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// dnode configs // dnode configs
cfg.option = "numOfThreadsPerCore"; cfg.option = "numOfThreadsPerCore";
...@@ -482,7 +483,7 @@ static void doInitGlobalConfig(void) { ...@@ -482,7 +483,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10; cfg.maxValue = 10;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "numOfCommitThreads"; cfg.option = "numOfCommitThreads";
cfg.ptr = &tsNumOfCommitThreads; cfg.ptr = &tsNumOfCommitThreads;
...@@ -492,7 +493,7 @@ static void doInitGlobalConfig(void) { ...@@ -492,7 +493,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 100; cfg.maxValue = 100;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "ratioOfQueryCores"; cfg.option = "ratioOfQueryCores";
cfg.ptr = &tsRatioOfQueryCores; cfg.ptr = &tsRatioOfQueryCores;
...@@ -502,7 +503,7 @@ static void doInitGlobalConfig(void) { ...@@ -502,7 +503,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 2.0f; cfg.maxValue = 2.0f;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "maxNumOfDistinctRes"; cfg.option = "maxNumOfDistinctRes";
cfg.ptr = &tsMaxNumOfDistinctResults; cfg.ptr = &tsMaxNumOfDistinctResults;
...@@ -512,7 +513,7 @@ static void doInitGlobalConfig(void) { ...@@ -512,7 +513,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10000*10000; cfg.maxValue = 10000*10000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "numOfMnodes"; cfg.option = "numOfMnodes";
cfg.ptr = &tsNumOfMnodes; cfg.ptr = &tsNumOfMnodes;
...@@ -522,7 +523,7 @@ static void doInitGlobalConfig(void) { ...@@ -522,7 +523,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 3; cfg.maxValue = 3;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "vnodeBak"; cfg.option = "vnodeBak";
cfg.ptr = &tsEnableVnodeBak; cfg.ptr = &tsEnableVnodeBak;
...@@ -532,7 +533,7 @@ static void doInitGlobalConfig(void) { ...@@ -532,7 +533,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 1; cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "telemetryReporting"; cfg.option = "telemetryReporting";
cfg.ptr = &tsEnableTelemetryReporting; cfg.ptr = &tsEnableTelemetryReporting;
...@@ -542,7 +543,7 @@ static void doInitGlobalConfig(void) { ...@@ -542,7 +543,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 1; cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "balance"; cfg.option = "balance";
cfg.ptr = &tsEnableBalance; cfg.ptr = &tsEnableBalance;
...@@ -552,7 +553,7 @@ static void doInitGlobalConfig(void) { ...@@ -552,7 +553,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 1; cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "balanceInterval"; cfg.option = "balanceInterval";
cfg.ptr = &tsBalanceInterval; cfg.ptr = &tsBalanceInterval;
...@@ -562,7 +563,7 @@ static void doInitGlobalConfig(void) { ...@@ -562,7 +563,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 30000; cfg.maxValue = 30000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// 0-any; 1-mnode; 2-vnode // 0-any; 1-mnode; 2-vnode
cfg.option = "role"; cfg.option = "role";
...@@ -573,7 +574,7 @@ static void doInitGlobalConfig(void) { ...@@ -573,7 +574,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 2; cfg.maxValue = 2;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// timer // timer
cfg.option = "maxTmrCtrl"; cfg.option = "maxTmrCtrl";
...@@ -584,7 +585,7 @@ static void doInitGlobalConfig(void) { ...@@ -584,7 +585,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 2048; cfg.maxValue = 2048;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "monitorInterval"; cfg.option = "monitorInterval";
cfg.ptr = &tsMonitorInterval; cfg.ptr = &tsMonitorInterval;
...@@ -594,7 +595,7 @@ static void doInitGlobalConfig(void) { ...@@ -594,7 +595,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 600; cfg.maxValue = 600;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_SECOND; cfg.unitType = TAOS_CFG_UTYPE_SECOND;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "offlineThreshold"; cfg.option = "offlineThreshold";
cfg.ptr = &tsOfflineThreshold; cfg.ptr = &tsOfflineThreshold;
...@@ -604,7 +605,7 @@ static void doInitGlobalConfig(void) { ...@@ -604,7 +605,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 86400 * 365; cfg.maxValue = 86400 * 365;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_SECOND; cfg.unitType = TAOS_CFG_UTYPE_SECOND;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "rpcTimer"; cfg.option = "rpcTimer";
cfg.ptr = &tsRpcTimer; cfg.ptr = &tsRpcTimer;
...@@ -614,7 +615,7 @@ static void doInitGlobalConfig(void) { ...@@ -614,7 +615,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 3000; cfg.maxValue = 3000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS; cfg.unitType = TAOS_CFG_UTYPE_MS;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "rpcForceTcp"; cfg.option = "rpcForceTcp";
cfg.ptr = &tsRpcForceTcp; cfg.ptr = &tsRpcForceTcp;
...@@ -624,7 +625,7 @@ static void doInitGlobalConfig(void) { ...@@ -624,7 +625,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "rpcMaxTime"; cfg.option = "rpcMaxTime";
cfg.ptr = &tsRpcMaxTime; cfg.ptr = &tsRpcMaxTime;
...@@ -634,7 +635,7 @@ static void doInitGlobalConfig(void) { ...@@ -634,7 +635,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 7200; cfg.maxValue = 7200;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_SECOND; cfg.unitType = TAOS_CFG_UTYPE_SECOND;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "statusInterval"; cfg.option = "statusInterval";
cfg.ptr = &tsStatusInterval; cfg.ptr = &tsStatusInterval;
...@@ -644,7 +645,7 @@ static void doInitGlobalConfig(void) { ...@@ -644,7 +645,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10; cfg.maxValue = 10;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_SECOND; cfg.unitType = TAOS_CFG_UTYPE_SECOND;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "shellActivityTimer"; cfg.option = "shellActivityTimer";
cfg.ptr = &tsShellActivityTimer; cfg.ptr = &tsShellActivityTimer;
...@@ -654,7 +655,7 @@ static void doInitGlobalConfig(void) { ...@@ -654,7 +655,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 120; cfg.maxValue = 120;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_SECOND; cfg.unitType = TAOS_CFG_UTYPE_SECOND;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "minSlidingTime"; cfg.option = "minSlidingTime";
cfg.ptr = &tsMinSlidingTime; cfg.ptr = &tsMinSlidingTime;
...@@ -664,7 +665,7 @@ static void doInitGlobalConfig(void) { ...@@ -664,7 +665,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1000000; cfg.maxValue = 1000000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS; cfg.unitType = TAOS_CFG_UTYPE_MS;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "minIntervalTime"; cfg.option = "minIntervalTime";
cfg.ptr = &tsMinIntervalTime; cfg.ptr = &tsMinIntervalTime;
...@@ -674,7 +675,7 @@ static void doInitGlobalConfig(void) { ...@@ -674,7 +675,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1000000; cfg.maxValue = 1000000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS; cfg.unitType = TAOS_CFG_UTYPE_MS;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "maxStreamCompDelay"; cfg.option = "maxStreamCompDelay";
cfg.ptr = &tsMaxStreamComputDelay; cfg.ptr = &tsMaxStreamComputDelay;
...@@ -684,7 +685,7 @@ static void doInitGlobalConfig(void) { ...@@ -684,7 +685,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1000000000; cfg.maxValue = 1000000000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS; cfg.unitType = TAOS_CFG_UTYPE_MS;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "maxFirstStreamCompDelay"; cfg.option = "maxFirstStreamCompDelay";
cfg.ptr = &tsStreamCompStartDelay; cfg.ptr = &tsStreamCompStartDelay;
...@@ -694,7 +695,7 @@ static void doInitGlobalConfig(void) { ...@@ -694,7 +695,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1000000000; cfg.maxValue = 1000000000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS; cfg.unitType = TAOS_CFG_UTYPE_MS;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "retryStreamCompDelay"; cfg.option = "retryStreamCompDelay";
cfg.ptr = &tsRetryStreamCompDelay; cfg.ptr = &tsRetryStreamCompDelay;
...@@ -705,7 +706,7 @@ static void doInitGlobalConfig(void) { ...@@ -705,7 +706,7 @@ static void doInitGlobalConfig(void) {
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MS; cfg.unitType = TAOS_CFG_UTYPE_MS;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "streamCompDelayRatio"; cfg.option = "streamCompDelayRatio";
cfg.ptr = &tsStreamComputDelayRatio; cfg.ptr = &tsStreamComputDelayRatio;
cfg.valType = TAOS_CFG_VTYPE_FLOAT; cfg.valType = TAOS_CFG_VTYPE_FLOAT;
...@@ -714,7 +715,7 @@ static void doInitGlobalConfig(void) { ...@@ -714,7 +715,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0.9f; cfg.maxValue = 0.9f;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "maxVgroupsPerDb"; cfg.option = "maxVgroupsPerDb";
cfg.ptr = &tsMaxVgroupsPerDb; cfg.ptr = &tsMaxVgroupsPerDb;
...@@ -724,7 +725,7 @@ static void doInitGlobalConfig(void) { ...@@ -724,7 +725,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 8192; cfg.maxValue = 8192;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// database configs // database configs
cfg.option = "maxTablesPerVnode"; cfg.option = "maxTablesPerVnode";
...@@ -735,7 +736,7 @@ static void doInitGlobalConfig(void) { ...@@ -735,7 +736,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_TABLES; cfg.maxValue = TSDB_MAX_TABLES;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "minTablesPerVnode"; cfg.option = "minTablesPerVnode";
cfg.ptr = &tsMinTablePerVnode; cfg.ptr = &tsMinTablePerVnode;
...@@ -745,7 +746,7 @@ static void doInitGlobalConfig(void) { ...@@ -745,7 +746,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_TABLES; cfg.maxValue = TSDB_MAX_TABLES;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "tableIncStepPerVnode"; cfg.option = "tableIncStepPerVnode";
cfg.ptr = &tsTableIncStepPerVnode; cfg.ptr = &tsTableIncStepPerVnode;
...@@ -755,7 +756,7 @@ static void doInitGlobalConfig(void) { ...@@ -755,7 +756,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_TABLES; cfg.maxValue = TSDB_MAX_TABLES;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "cache"; cfg.option = "cache";
cfg.ptr = &tsCacheBlockSize; cfg.ptr = &tsCacheBlockSize;
...@@ -765,7 +766,7 @@ static void doInitGlobalConfig(void) { ...@@ -765,7 +766,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_CACHE_BLOCK_SIZE; cfg.maxValue = TSDB_MAX_CACHE_BLOCK_SIZE;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_MB; cfg.unitType = TAOS_CFG_UTYPE_MB;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "blocks"; cfg.option = "blocks";
cfg.ptr = &tsBlocksPerVnode; cfg.ptr = &tsBlocksPerVnode;
...@@ -775,7 +776,7 @@ static void doInitGlobalConfig(void) { ...@@ -775,7 +776,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_TOTAL_BLOCKS; cfg.maxValue = TSDB_MAX_TOTAL_BLOCKS;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "days"; cfg.option = "days";
cfg.ptr = &tsDaysPerFile; cfg.ptr = &tsDaysPerFile;
...@@ -785,7 +786,7 @@ static void doInitGlobalConfig(void) { ...@@ -785,7 +786,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_DAYS_PER_FILE; cfg.maxValue = TSDB_MAX_DAYS_PER_FILE;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "keep"; cfg.option = "keep";
cfg.ptr = &tsDaysToKeep; cfg.ptr = &tsDaysToKeep;
...@@ -795,7 +796,7 @@ static void doInitGlobalConfig(void) { ...@@ -795,7 +796,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_KEEP; cfg.maxValue = TSDB_MAX_KEEP;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "minRows"; cfg.option = "minRows";
cfg.ptr = &tsMinRowsInFileBlock; cfg.ptr = &tsMinRowsInFileBlock;
...@@ -805,7 +806,7 @@ static void doInitGlobalConfig(void) { ...@@ -805,7 +806,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_MIN_ROW_FBLOCK; cfg.maxValue = TSDB_MAX_MIN_ROW_FBLOCK;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "maxRows"; cfg.option = "maxRows";
cfg.ptr = &tsMaxRowsInFileBlock; cfg.ptr = &tsMaxRowsInFileBlock;
...@@ -815,7 +816,7 @@ static void doInitGlobalConfig(void) { ...@@ -815,7 +816,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_MAX_ROW_FBLOCK; cfg.maxValue = TSDB_MAX_MAX_ROW_FBLOCK;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "precision"; cfg.option = "precision";
cfg.ptr = &tsTimePrecision; cfg.ptr = &tsTimePrecision;
...@@ -825,7 +826,7 @@ static void doInitGlobalConfig(void) { ...@@ -825,7 +826,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_PRECISION; cfg.maxValue = TSDB_MAX_PRECISION;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "comp"; cfg.option = "comp";
cfg.ptr = &tsCompression; cfg.ptr = &tsCompression;
...@@ -835,7 +836,7 @@ static void doInitGlobalConfig(void) { ...@@ -835,7 +836,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_COMP_LEVEL; cfg.maxValue = TSDB_MAX_COMP_LEVEL;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "walLevel"; cfg.option = "walLevel";
cfg.ptr = &tsWAL; cfg.ptr = &tsWAL;
...@@ -845,7 +846,7 @@ static void doInitGlobalConfig(void) { ...@@ -845,7 +846,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_WAL_LEVEL; cfg.maxValue = TSDB_MAX_WAL_LEVEL;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "fsync"; cfg.option = "fsync";
cfg.ptr = &tsFsyncPeriod; cfg.ptr = &tsFsyncPeriod;
...@@ -855,7 +856,7 @@ static void doInitGlobalConfig(void) { ...@@ -855,7 +856,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_FSYNC_PERIOD; cfg.maxValue = TSDB_MAX_FSYNC_PERIOD;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "replica"; cfg.option = "replica";
cfg.ptr = &tsReplications; cfg.ptr = &tsReplications;
...@@ -865,7 +866,7 @@ static void doInitGlobalConfig(void) { ...@@ -865,7 +866,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_DB_REPLICA_OPTION; cfg.maxValue = TSDB_MAX_DB_REPLICA_OPTION;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "partitions"; cfg.option = "partitions";
cfg.ptr = &tsPartitons; cfg.ptr = &tsPartitons;
...@@ -875,7 +876,7 @@ static void doInitGlobalConfig(void) { ...@@ -875,7 +876,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_DB_PARTITON_OPTION; cfg.maxValue = TSDB_MAX_DB_PARTITON_OPTION;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "quorum"; cfg.option = "quorum";
cfg.ptr = &tsQuorum; cfg.ptr = &tsQuorum;
...@@ -885,7 +886,7 @@ static void doInitGlobalConfig(void) { ...@@ -885,7 +886,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_DB_QUORUM_OPTION; cfg.maxValue = TSDB_MAX_DB_QUORUM_OPTION;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "update"; cfg.option = "update";
cfg.ptr = &tsUpdate; cfg.ptr = &tsUpdate;
...@@ -895,7 +896,7 @@ static void doInitGlobalConfig(void) { ...@@ -895,7 +896,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_DB_UPDATE; cfg.maxValue = TSDB_MAX_DB_UPDATE;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "cachelast"; cfg.option = "cachelast";
cfg.ptr = &tsCacheLastRow; cfg.ptr = &tsCacheLastRow;
...@@ -905,7 +906,7 @@ static void doInitGlobalConfig(void) { ...@@ -905,7 +906,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_DB_CACHE_LAST_ROW; cfg.maxValue = TSDB_MAX_DB_CACHE_LAST_ROW;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "mqttHostName"; cfg.option = "mqttHostName";
cfg.ptr = tsMqttHostName; cfg.ptr = tsMqttHostName;
...@@ -915,7 +916,7 @@ static void doInitGlobalConfig(void) { ...@@ -915,7 +916,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_MQTT_HOSTNAME_LEN; cfg.ptrLength = TSDB_MQTT_HOSTNAME_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "mqttPort"; cfg.option = "mqttPort";
cfg.ptr = tsMqttPort; cfg.ptr = tsMqttPort;
...@@ -925,7 +926,7 @@ static void doInitGlobalConfig(void) { ...@@ -925,7 +926,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_MQTT_PORT_LEN; cfg.ptrLength = TSDB_MQTT_PORT_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "mqttTopic"; cfg.option = "mqttTopic";
cfg.ptr = tsMqttTopic; cfg.ptr = tsMqttTopic;
...@@ -935,7 +936,7 @@ static void doInitGlobalConfig(void) { ...@@ -935,7 +936,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_MQTT_TOPIC_LEN; cfg.ptrLength = TSDB_MQTT_TOPIC_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "compressMsgSize"; cfg.option = "compressMsgSize";
cfg.ptr = &tsCompressMsgSize; cfg.ptr = &tsCompressMsgSize;
...@@ -945,7 +946,7 @@ static void doInitGlobalConfig(void) { ...@@ -945,7 +946,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 100000000.0f; cfg.maxValue = 100000000.0f;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "compressColData"; cfg.option = "compressColData";
cfg.ptr = &tsCompressColData; cfg.ptr = &tsCompressColData;
...@@ -955,7 +956,7 @@ static void doInitGlobalConfig(void) { ...@@ -955,7 +956,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 100000000.0f; cfg.maxValue = 100000000.0f;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "maxSQLLength"; cfg.option = "maxSQLLength";
cfg.ptr = &tsMaxSQLStringLen; cfg.ptr = &tsMaxSQLStringLen;
...@@ -965,7 +966,7 @@ static void doInitGlobalConfig(void) { ...@@ -965,7 +966,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_ALLOWED_SQL_LEN; cfg.maxValue = TSDB_MAX_ALLOWED_SQL_LEN;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_BYTE; cfg.unitType = TAOS_CFG_UTYPE_BYTE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "maxWildCardsLength"; cfg.option = "maxWildCardsLength";
cfg.ptr = &tsMaxWildCardsLen; cfg.ptr = &tsMaxWildCardsLen;
...@@ -975,7 +976,7 @@ static void doInitGlobalConfig(void) { ...@@ -975,7 +976,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_FIELD_LEN; cfg.maxValue = TSDB_MAX_FIELD_LEN;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_BYTE; cfg.unitType = TAOS_CFG_UTYPE_BYTE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "maxRegexStringLen"; cfg.option = "maxRegexStringLen";
cfg.ptr = &tsMaxRegexStringLen; cfg.ptr = &tsMaxRegexStringLen;
...@@ -985,7 +986,7 @@ static void doInitGlobalConfig(void) { ...@@ -985,7 +986,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_FIELD_LEN; cfg.maxValue = TSDB_MAX_FIELD_LEN;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_BYTE; cfg.unitType = TAOS_CFG_UTYPE_BYTE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "maxNumOfOrderedRes"; cfg.option = "maxNumOfOrderedRes";
cfg.ptr = &tsMaxNumOfOrderedResults; cfg.ptr = &tsMaxNumOfOrderedResults;
...@@ -995,7 +996,7 @@ static void doInitGlobalConfig(void) { ...@@ -995,7 +996,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = TSDB_MAX_ALLOWED_SQL_LEN; cfg.maxValue = TSDB_MAX_ALLOWED_SQL_LEN;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "queryBufferSize"; cfg.option = "queryBufferSize";
cfg.ptr = &tsQueryBufferSize; cfg.ptr = &tsQueryBufferSize;
...@@ -1005,7 +1006,7 @@ static void doInitGlobalConfig(void) { ...@@ -1005,7 +1006,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 500000000000.0f; cfg.maxValue = 500000000000.0f;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_BYTE; cfg.unitType = TAOS_CFG_UTYPE_BYTE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "retrieveBlockingModel"; cfg.option = "retrieveBlockingModel";
cfg.ptr = &tsRetrieveBlockingModel; cfg.ptr = &tsRetrieveBlockingModel;
...@@ -1015,7 +1016,7 @@ static void doInitGlobalConfig(void) { ...@@ -1015,7 +1016,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 1; cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "keepColumnName"; cfg.option = "keepColumnName";
cfg.ptr = &tsKeepOriginalColumnName; cfg.ptr = &tsKeepOriginalColumnName;
...@@ -1025,7 +1026,7 @@ static void doInitGlobalConfig(void) { ...@@ -1025,7 +1026,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 1; cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// locale & charset // locale & charset
cfg.option = "timezone"; cfg.option = "timezone";
...@@ -1036,7 +1037,7 @@ static void doInitGlobalConfig(void) { ...@@ -1036,7 +1037,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_TIMEZONE_LEN; cfg.ptrLength = TSDB_TIMEZONE_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "locale"; cfg.option = "locale";
cfg.ptr = tsLocale; cfg.ptr = tsLocale;
...@@ -1046,7 +1047,7 @@ static void doInitGlobalConfig(void) { ...@@ -1046,7 +1047,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_LOCALE_LEN; cfg.ptrLength = TSDB_LOCALE_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "charset"; cfg.option = "charset";
cfg.ptr = tsCharset; cfg.ptr = tsCharset;
...@@ -1056,7 +1057,7 @@ static void doInitGlobalConfig(void) { ...@@ -1056,7 +1057,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = TSDB_LOCALE_LEN; cfg.ptrLength = TSDB_LOCALE_LEN;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// connect configs // connect configs
cfg.option = "maxShellConns"; cfg.option = "maxShellConns";
...@@ -1067,7 +1068,7 @@ static void doInitGlobalConfig(void) { ...@@ -1067,7 +1068,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 50000000; cfg.maxValue = 50000000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "maxConnections"; cfg.option = "maxConnections";
cfg.ptr = &tsMaxConnections; cfg.ptr = &tsMaxConnections;
...@@ -1077,7 +1078,7 @@ static void doInitGlobalConfig(void) { ...@@ -1077,7 +1078,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 100000; cfg.maxValue = 100000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "minimalLogDirGB"; cfg.option = "minimalLogDirGB";
cfg.ptr = &tsMinimalLogDirGB; cfg.ptr = &tsMinimalLogDirGB;
...@@ -1087,7 +1088,7 @@ static void doInitGlobalConfig(void) { ...@@ -1087,7 +1088,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10000000; cfg.maxValue = 10000000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_GB; cfg.unitType = TAOS_CFG_UTYPE_GB;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "minimalTmpDirGB"; cfg.option = "minimalTmpDirGB";
cfg.ptr = &tsReservedTmpDirectorySpace; cfg.ptr = &tsReservedTmpDirectorySpace;
...@@ -1097,7 +1098,7 @@ static void doInitGlobalConfig(void) { ...@@ -1097,7 +1098,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10000000; cfg.maxValue = 10000000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_GB; cfg.unitType = TAOS_CFG_UTYPE_GB;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "minimalDataDirGB"; cfg.option = "minimalDataDirGB";
cfg.ptr = &tsMinimalDataDirGB; cfg.ptr = &tsMinimalDataDirGB;
...@@ -1107,7 +1108,7 @@ static void doInitGlobalConfig(void) { ...@@ -1107,7 +1108,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10000000; cfg.maxValue = 10000000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_GB; cfg.unitType = TAOS_CFG_UTYPE_GB;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// module configs // module configs
cfg.option = "mnodeEqualVnodeNum"; cfg.option = "mnodeEqualVnodeNum";
...@@ -1118,7 +1119,7 @@ static void doInitGlobalConfig(void) { ...@@ -1118,7 +1119,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1000; cfg.maxValue = 1000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// module configs // module configs
cfg.option = "flowctrl"; cfg.option = "flowctrl";
...@@ -1129,7 +1130,7 @@ static void doInitGlobalConfig(void) { ...@@ -1129,7 +1130,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "slaveQuery"; cfg.option = "slaveQuery";
cfg.ptr = &tsEnableSlaveQuery; cfg.ptr = &tsEnableSlaveQuery;
...@@ -1139,7 +1140,7 @@ static void doInitGlobalConfig(void) { ...@@ -1139,7 +1140,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "adjustMaster"; cfg.option = "adjustMaster";
cfg.ptr = &tsEnableAdjustMaster; cfg.ptr = &tsEnableAdjustMaster;
...@@ -1149,7 +1150,7 @@ static void doInitGlobalConfig(void) { ...@@ -1149,7 +1150,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "mqtt"; cfg.option = "mqtt";
cfg.ptr = &tsEnableMqttModule; cfg.ptr = &tsEnableMqttModule;
...@@ -1159,7 +1160,7 @@ static void doInitGlobalConfig(void) { ...@@ -1159,7 +1160,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 1; cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "monitor"; cfg.option = "monitor";
cfg.ptr = &tsEnableMonitorModule; cfg.ptr = &tsEnableMonitorModule;
...@@ -1169,7 +1170,7 @@ static void doInitGlobalConfig(void) { ...@@ -1169,7 +1170,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 1; cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "stream"; cfg.option = "stream";
cfg.ptr = &tsEnableStream; cfg.ptr = &tsEnableStream;
...@@ -1179,7 +1180,7 @@ static void doInitGlobalConfig(void) { ...@@ -1179,7 +1180,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 1; cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "topicBianryLen"; cfg.option = "topicBianryLen";
cfg.ptr = &tsTopicBianryLen; cfg.ptr = &tsTopicBianryLen;
...@@ -1189,7 +1190,7 @@ static void doInitGlobalConfig(void) { ...@@ -1189,7 +1190,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 16000; cfg.maxValue = 16000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "telegrafUseFieldNum"; cfg.option = "telegrafUseFieldNum";
cfg.ptr = &tsTelegrafUseFieldNum; cfg.ptr = &tsTelegrafUseFieldNum;
...@@ -1199,7 +1200,7 @@ static void doInitGlobalConfig(void) { ...@@ -1199,7 +1200,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 1; cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "restfulRowLimit"; cfg.option = "restfulRowLimit";
cfg.ptr = &tsRestRowLimit; cfg.ptr = &tsRestRowLimit;
...@@ -1209,7 +1210,7 @@ static void doInitGlobalConfig(void) { ...@@ -1209,7 +1210,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 10000000; cfg.maxValue = 10000000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// debug flag // debug flag
cfg.option = "numOfLogLines"; cfg.option = "numOfLogLines";
...@@ -1220,7 +1221,7 @@ static void doInitGlobalConfig(void) { ...@@ -1220,7 +1221,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 2000000000; cfg.maxValue = 2000000000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "logKeepDays"; cfg.option = "logKeepDays";
cfg.ptr = &tsLogKeepDays; cfg.ptr = &tsLogKeepDays;
...@@ -1230,7 +1231,7 @@ static void doInitGlobalConfig(void) { ...@@ -1230,7 +1231,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 365000; cfg.maxValue = 365000;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "asyncLog"; cfg.option = "asyncLog";
cfg.ptr = &tsAsyncLog; cfg.ptr = &tsAsyncLog;
...@@ -1240,7 +1241,7 @@ static void doInitGlobalConfig(void) { ...@@ -1240,7 +1241,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "debugFlag"; cfg.option = "debugFlag";
cfg.ptr = &debugFlag; cfg.ptr = &debugFlag;
...@@ -1250,7 +1251,7 @@ static void doInitGlobalConfig(void) { ...@@ -1250,7 +1251,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "mDebugFlag"; cfg.option = "mDebugFlag";
cfg.ptr = &mDebugFlag; cfg.ptr = &mDebugFlag;
...@@ -1260,7 +1261,7 @@ static void doInitGlobalConfig(void) { ...@@ -1260,7 +1261,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "dDebugFlag"; cfg.option = "dDebugFlag";
cfg.ptr = &dDebugFlag; cfg.ptr = &dDebugFlag;
...@@ -1270,7 +1271,7 @@ static void doInitGlobalConfig(void) { ...@@ -1270,7 +1271,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "sDebugFlag"; cfg.option = "sDebugFlag";
cfg.ptr = &sDebugFlag; cfg.ptr = &sDebugFlag;
...@@ -1280,7 +1281,7 @@ static void doInitGlobalConfig(void) { ...@@ -1280,7 +1281,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "wDebugFlag"; cfg.option = "wDebugFlag";
cfg.ptr = &wDebugFlag; cfg.ptr = &wDebugFlag;
...@@ -1290,7 +1291,7 @@ static void doInitGlobalConfig(void) { ...@@ -1290,7 +1291,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "sdbDebugFlag"; cfg.option = "sdbDebugFlag";
...@@ -1301,7 +1302,7 @@ static void doInitGlobalConfig(void) { ...@@ -1301,7 +1302,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "rpcDebugFlag"; cfg.option = "rpcDebugFlag";
cfg.ptr = &rpcDebugFlag; cfg.ptr = &rpcDebugFlag;
...@@ -1311,7 +1312,7 @@ static void doInitGlobalConfig(void) { ...@@ -1311,7 +1312,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "tmrDebugFlag"; cfg.option = "tmrDebugFlag";
cfg.ptr = &tmrDebugFlag; cfg.ptr = &tmrDebugFlag;
...@@ -1321,7 +1322,7 @@ static void doInitGlobalConfig(void) { ...@@ -1321,7 +1322,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "cDebugFlag"; cfg.option = "cDebugFlag";
cfg.ptr = &cDebugFlag; cfg.ptr = &cDebugFlag;
...@@ -1331,7 +1332,7 @@ static void doInitGlobalConfig(void) { ...@@ -1331,7 +1332,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "jniDebugFlag"; cfg.option = "jniDebugFlag";
cfg.ptr = &jniDebugFlag; cfg.ptr = &jniDebugFlag;
...@@ -1341,7 +1342,7 @@ static void doInitGlobalConfig(void) { ...@@ -1341,7 +1342,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "odbcDebugFlag"; cfg.option = "odbcDebugFlag";
cfg.ptr = &odbcDebugFlag; cfg.ptr = &odbcDebugFlag;
...@@ -1351,7 +1352,7 @@ static void doInitGlobalConfig(void) { ...@@ -1351,7 +1352,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "uDebugFlag"; cfg.option = "uDebugFlag";
cfg.ptr = &uDebugFlag; cfg.ptr = &uDebugFlag;
...@@ -1361,7 +1362,7 @@ static void doInitGlobalConfig(void) { ...@@ -1361,7 +1362,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "httpDebugFlag"; cfg.option = "httpDebugFlag";
cfg.ptr = &httpDebugFlag; cfg.ptr = &httpDebugFlag;
...@@ -1371,7 +1372,7 @@ static void doInitGlobalConfig(void) { ...@@ -1371,7 +1372,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "mqttDebugFlag"; cfg.option = "mqttDebugFlag";
cfg.ptr = &mqttDebugFlag; cfg.ptr = &mqttDebugFlag;
...@@ -1381,7 +1382,7 @@ static void doInitGlobalConfig(void) { ...@@ -1381,7 +1382,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "monDebugFlag"; cfg.option = "monDebugFlag";
cfg.ptr = &monDebugFlag; cfg.ptr = &monDebugFlag;
...@@ -1391,7 +1392,7 @@ static void doInitGlobalConfig(void) { ...@@ -1391,7 +1392,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "qDebugFlag"; cfg.option = "qDebugFlag";
cfg.ptr = &qDebugFlag; cfg.ptr = &qDebugFlag;
...@@ -1401,7 +1402,7 @@ static void doInitGlobalConfig(void) { ...@@ -1401,7 +1402,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "vDebugFlag"; cfg.option = "vDebugFlag";
cfg.ptr = &vDebugFlag; cfg.ptr = &vDebugFlag;
...@@ -1411,7 +1412,7 @@ static void doInitGlobalConfig(void) { ...@@ -1411,7 +1412,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "tsdbDebugFlag"; cfg.option = "tsdbDebugFlag";
cfg.ptr = &tsdbDebugFlag; cfg.ptr = &tsdbDebugFlag;
...@@ -1421,7 +1422,7 @@ static void doInitGlobalConfig(void) { ...@@ -1421,7 +1422,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "cqDebugFlag"; cfg.option = "cqDebugFlag";
cfg.ptr = &cqDebugFlag; cfg.ptr = &cqDebugFlag;
...@@ -1431,7 +1432,7 @@ static void doInitGlobalConfig(void) { ...@@ -1431,7 +1432,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 255; cfg.maxValue = 255;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "enableRecordSql"; cfg.option = "enableRecordSql";
cfg.ptr = &tsTscEnableRecordSql; cfg.ptr = &tsTscEnableRecordSql;
...@@ -1441,7 +1442,7 @@ static void doInitGlobalConfig(void) { ...@@ -1441,7 +1442,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "enableCoreFile"; cfg.option = "enableCoreFile";
cfg.ptr = &tsEnableCoreFile; cfg.ptr = &tsEnableCoreFile;
...@@ -1451,7 +1452,7 @@ static void doInitGlobalConfig(void) { ...@@ -1451,7 +1452,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// version info // version info
cfg.option = "gitinfo"; cfg.option = "gitinfo";
...@@ -1462,7 +1463,7 @@ static void doInitGlobalConfig(void) { ...@@ -1462,7 +1463,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "gitinfoOfInternal"; cfg.option = "gitinfoOfInternal";
cfg.ptr = gitinfoOfInternal; cfg.ptr = gitinfoOfInternal;
...@@ -1472,7 +1473,7 @@ static void doInitGlobalConfig(void) { ...@@ -1472,7 +1473,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "buildinfo"; cfg.option = "buildinfo";
cfg.ptr = buildinfo; cfg.ptr = buildinfo;
...@@ -1482,7 +1483,7 @@ static void doInitGlobalConfig(void) { ...@@ -1482,7 +1483,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "version"; cfg.option = "version";
cfg.ptr = version; cfg.ptr = version;
...@@ -1492,7 +1493,7 @@ static void doInitGlobalConfig(void) { ...@@ -1492,7 +1493,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "maxBinaryDisplayWidth"; cfg.option = "maxBinaryDisplayWidth";
cfg.ptr = &tsMaxBinaryDisplayWidth; cfg.ptr = &tsMaxBinaryDisplayWidth;
...@@ -1502,7 +1503,7 @@ static void doInitGlobalConfig(void) { ...@@ -1502,7 +1503,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 65536; cfg.maxValue = 65536;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "tempDir"; cfg.option = "tempDir";
cfg.ptr = tsTempDir; cfg.ptr = tsTempDir;
...@@ -1512,7 +1513,7 @@ static void doInitGlobalConfig(void) { ...@@ -1512,7 +1513,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = PATH_MAX; cfg.ptrLength = PATH_MAX;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "tsdbMetaCompactRatio"; cfg.option = "tsdbMetaCompactRatio";
cfg.ptr = &tsTsdbMetaCompactRatio; cfg.ptr = &tsTsdbMetaCompactRatio;
...@@ -1522,7 +1523,7 @@ static void doInitGlobalConfig(void) { ...@@ -1522,7 +1523,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 100; cfg.maxValue = 100;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
// enable kill long query // enable kill long query
cfg.option = "deadLockKillQuery"; cfg.option = "deadLockKillQuery";
...@@ -1533,7 +1534,7 @@ static void doInitGlobalConfig(void) { ...@@ -1533,7 +1534,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 1; cfg.maxValue = 1;
cfg.ptrLength = 1; cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
#ifdef TD_TSZ #ifdef TD_TSZ
// lossy compress // lossy compress
...@@ -1545,7 +1546,7 @@ static void doInitGlobalConfig(void) { ...@@ -1545,7 +1546,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 0; cfg.maxValue = 0;
cfg.ptrLength = tListLen(lossyColumns); cfg.ptrLength = tListLen(lossyColumns);
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "fPrecision"; cfg.option = "fPrecision";
cfg.ptr = &fPrecision; cfg.ptr = &fPrecision;
...@@ -1557,7 +1558,7 @@ static void doInitGlobalConfig(void) { ...@@ -1557,7 +1558,7 @@ static void doInitGlobalConfig(void) {
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "dPrecision"; cfg.option = "dPrecision";
cfg.ptr = &dPrecision; cfg.ptr = &dPrecision;
...@@ -1567,7 +1568,7 @@ static void doInitGlobalConfig(void) { ...@@ -1567,7 +1568,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = MAX_FLOAT; cfg.maxValue = MAX_FLOAT;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "maxRange"; cfg.option = "maxRange";
cfg.ptr = &maxRange; cfg.ptr = &maxRange;
...@@ -1577,7 +1578,7 @@ static void doInitGlobalConfig(void) { ...@@ -1577,7 +1578,7 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 65536; cfg.maxValue = 65536;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
cfg.option = "range"; cfg.option = "range";
cfg.ptr = &curRange; cfg.ptr = &curRange;
...@@ -1587,10 +1588,10 @@ static void doInitGlobalConfig(void) { ...@@ -1587,10 +1588,10 @@ static void doInitGlobalConfig(void) {
cfg.maxValue = 65536; cfg.maxValue = 65536;
cfg.ptrLength = 0; cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosAddConfigOption(cfg);
assert(tsGlobalConfigNum == TSDB_CFG_MAX_NUM); assert(tsGlobalConfigNum == TSDB_CFG_MAX_NUM);
#else #else
assert(tsGlobalConfigNum == TSDB_CFG_MAX_NUM - 5); assert(tsGlobalConfigNum == (TSDB_CFG_MAX_NUM - 5));
#endif #endif
} }
...@@ -1599,7 +1600,7 @@ void taosInitGlobalCfg() { ...@@ -1599,7 +1600,7 @@ void taosInitGlobalCfg() {
pthread_once(&tsInitGlobalCfgOnce, doInitGlobalConfig); pthread_once(&tsInitGlobalCfgOnce, doInitGlobalConfig);
} }
int32_t taosCheckGlobalCfg() { int32_t taosCheckAndPrintCfg() {
char fqdn[TSDB_FQDN_LEN]; char fqdn[TSDB_FQDN_LEN];
uint16_t port; uint16_t port;
...@@ -1653,30 +1654,13 @@ int32_t taosCheckGlobalCfg() { ...@@ -1653,30 +1654,13 @@ int32_t taosCheckGlobalCfg() {
tsMaxTablePerVnode = tsMinTablePerVnode; 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) { if (tsQueryBufferSize >= 0) {
tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL; tsQueryBufferSizeBytes = tsQueryBufferSize * 1048576UL;
} }
uInfo(" check global cfg completed"); uInfo(" check global cfg completed");
uInfo("=================================="); uInfo("==================================");
taosPrintGlobalCfg(); taosPrintCfg();
return 0; return 0;
} }
......
...@@ -117,7 +117,7 @@ int dmnReadConfig(const char *path) { ...@@ -117,7 +117,7 @@ int dmnReadConfig(const char *path) {
return -1; return -1;
} }
if (taosCheckGlobalCfg() != 0) { if (taosCheckAndPrintCfg() != 0) {
uError("failed to check global config"); uError("failed to check global config");
return -1; return -1;
} }
......
...@@ -42,7 +42,7 @@ bool taosComparePthread(pthread_t first, pthread_t second) { return first.p == s ...@@ -42,7 +42,7 @@ bool taosComparePthread(pthread_t first, pthread_t second) { return first.p == s
int32_t taosGetPId() { return GetCurrentProcessId(); } 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}; char filepath[1024] = {0};
GetModuleFileName(NULL, filepath, MAX_PATH); GetModuleFileName(NULL, filepath, MAX_PATH);
...@@ -358,7 +358,7 @@ bool taosComparePthread(pthread_t first, pthread_t second) { return pthread_equa ...@@ -358,7 +358,7 @@ bool taosComparePthread(pthread_t first, pthread_t second) { return pthread_equa
int32_t taosGetPId() { return (int32_t)getpid(); } 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]; char buf[PATH_MAX + 1];
buf[0] = '\0'; buf[0] = '\0';
proc_name(getpid(), buf, sizeof(buf) - 1); proc_name(getpid(), buf, sizeof(buf) - 1);
...@@ -392,7 +392,7 @@ void taosResetPthread(pthread_t* thread) { *thread = 0; } ...@@ -392,7 +392,7 @@ void taosResetPthread(pthread_t* thread) { *thread = 0; }
bool taosComparePthread(pthread_t first, pthread_t second) { return first == second; } bool taosComparePthread(pthread_t first, pthread_t second) { return first == second; }
int32_t taosGetPId() { return getpid(); } 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"; const char* self = "/proc/self/exe";
char path[PATH_MAX] = {0}; char path[PATH_MAX] = {0};
......
...@@ -714,7 +714,7 @@ static void taosGetSystemLocale() { // get and set default locale ...@@ -714,7 +714,7 @@ static void taosGetSystemLocale() { // get and set default locale
//printf("locale not configured, set to system default:%s", tsLocale); //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); char *str = strrchr(tsLocale, sep);
if (str != NULL) { if (str != NULL) {
str++; str++;
...@@ -1118,13 +1118,13 @@ char *taosGetCmdlineByPID(int pid) { ...@@ -1118,13 +1118,13 @@ char *taosGetCmdlineByPID(int pid) {
SysNameInfo taosGetSysNameInfo() { SysNameInfo taosGetSysNameInfo() {
SysNameInfo info = {0}; SysNameInfo info = {0};
struct utsname buf; struct utsname uts;
if (!uname(&buf)) { if (!uname(&uts)) {
info.sysname = buf.sysname; info.sysname = strdup(uts.sysname);
info.sysname == buf.nodename; info.nodename = strdup(uts.nodename);
info.sysname = buf.release; info.release = strdup(uts.release);
info.sysname = buf.version; info.version = strdup(uts.version);
info.sysname = buf.machine; info.machine = strdup(uts.machine);
} }
return info; return info;
......
...@@ -282,7 +282,7 @@ static void taosReadConfigOption(const char *option, char *value, char *value2, ...@@ -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; tsGlobalConfig[tsGlobalConfigNum++] = cfg;
} }
...@@ -335,7 +335,7 @@ void taosReadGlobalLogCfg() { ...@@ -335,7 +335,7 @@ void taosReadGlobalLogCfg() {
fclose(fp); fclose(fp);
} }
int32_t taosReadGlobalCfg() { int32_t taosReadCfgFromFile() {
char * line, *option, *value, *value2, *value3; char * line, *option, *value, *value2, *value3;
int olen, vlen, vlen2, vlen3; int olen, vlen, vlen2, vlen3;
char fileName[PATH_MAX] = {0}; char fileName[PATH_MAX] = {0};
...@@ -396,7 +396,7 @@ int32_t taosReadGlobalCfg() { ...@@ -396,7 +396,7 @@ int32_t taosReadGlobalCfg() {
return 0; return 0;
} }
void taosPrintGlobalCfg() { void taosPrintCfg() {
uInfo(" taos config & system info:"); uInfo(" taos config & system info:");
uInfo("=================================="); uInfo("==================================");
...@@ -443,7 +443,6 @@ void taosPrintGlobalCfg() { ...@@ -443,7 +443,6 @@ void taosPrintGlobalCfg() {
} }
taosPrintOsInfo(); taosPrintOsInfo();
// taosPrintDataDirCfg();
uInfo("=================================="); uInfo("==================================");
} }
......
...@@ -112,7 +112,7 @@ static int32_t taosPushLogBuffer(SLogBuff *tLogBuff, char *msg, int32_t msgLen ...@@ -112,7 +112,7 @@ static int32_t taosPushLogBuffer(SLogBuff *tLogBuff, char *msg, int32_t msgLen
static SLogBuff *taosLogBuffNew(int32_t bufSize); static SLogBuff *taosLogBuffNew(int32_t bufSize);
static void taosCloseLogByFd(int32_t oldFd); static void taosCloseLogByFd(int32_t oldFd);
static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum); 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 taosCompressFile(char *srcFileName, char *destFileName);
static int32_t taosStartLog() { static int32_t taosStartLog() {
...@@ -222,7 +222,7 @@ static void *taosThreadToOpenNewFile(void *param) { ...@@ -222,7 +222,7 @@ static void *taosThreadToOpenNewFile(void *param) {
uInfo(" new log file:%d is opened", tsLogObj.flag); uInfo(" new log file:%d is opened", tsLogObj.flag);
uInfo("=================================="); uInfo("==================================");
taosPrintGlobalCfg(); taosPrintCfg();
taosKeepOldLog(keepName); taosKeepOldLog(keepName);
return NULL; return NULL;
......
...@@ -20,12 +20,10 @@ ...@@ -20,12 +20,10 @@
#include "tutil.h" #include "tutil.h"
#include "taoserror.h" #include "taoserror.h"
extern int8_t tscEmbedded; #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 tmrFatal(...) { if (tmrDebugFlag & DEBUG_FATAL) { taosPrintLog("TMR FATAL ", tscEmbedded ? 255 : tmrDebugFlag, __VA_ARGS__); }} #define tmrWarn(...) { if (tmrDebugFlag & DEBUG_WARN) { taosPrintLog("TMR WARN ", tmrDebugFlag, __VA_ARGS__); }}
#define tmrError(...) { if (tmrDebugFlag & DEBUG_ERROR) { taosPrintLog("TMR ERROR ", tscEmbedded ? 255 : tmrDebugFlag, __VA_ARGS__); }} #define tmrInfo(...) { if (tmrDebugFlag & DEBUG_INFO) { taosPrintLog("TMR ", 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 tmrDebug(...) { if (tmrDebugFlag & DEBUG_DEBUG) { 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__); }} #define tmrTrace(...) { if (tmrDebugFlag & DEBUG_TRACE) { taosPrintLog("TMR ", tmrDebugFlag, __VA_ARGS__); }}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册