提交 e53540b5 编写于 作者: S Shengliang Guan

rpc config

上级 10a21ba8
...@@ -55,23 +55,8 @@ extern float tsStreamComputDelayRatio; // the delayed computing ration of the ...@@ -55,23 +55,8 @@ extern float tsStreamComputDelayRatio; // the delayed computing ration of the
extern int32_t tsProjectExecInterval; extern int32_t tsProjectExecInterval;
extern int64_t tsMaxRetentWindow; extern int64_t tsMaxRetentWindow;
// system info
extern uint32_t tsVersion;
// lossy
extern char tsLossyColumns[];
extern double tsFPrecision;
extern double tsDPrecision;
extern uint32_t tsMaxRange;
extern uint32_t tsCurRange;
extern char tsCompressor[];
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize) #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
void taosInitGlobalCfg();
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);
......
...@@ -32,6 +32,8 @@ typedef struct { ...@@ -32,6 +32,8 @@ typedef struct {
uint16_t numOfCommitThreads; uint16_t numOfCommitThreads;
bool enableTelem; bool enableTelem;
bool printAuth; bool printAuth;
int32_t rpcTimer;
int32_t rpcMaxTime;
char timezone[TSDB_TIMEZONE_LEN]; char timezone[TSDB_TIMEZONE_LEN];
char locale[TSDB_LOCALE_LEN]; char locale[TSDB_LOCALE_LEN];
char charset[TSDB_LOCALE_LEN]; char charset[TSDB_LOCALE_LEN];
......
...@@ -81,9 +81,15 @@ typedef struct SRpcInit { ...@@ -81,9 +81,15 @@ typedef struct SRpcInit {
void *parent; void *parent;
} SRpcInit; } SRpcInit;
int32_t rpcInit(); typedef struct {
int32_t rpcTimer;
int32_t rpcMaxTime;
int32_t sver;
} SRpcCfg;
int32_t rpcInit(SRpcCfg *pCfg);
void rpcCleanup(); void rpcCleanup();
void * rpcOpen(const SRpcInit *pRpc); void *rpcOpen(const SRpcInit *pRpc);
void rpcClose(void *); void rpcClose(void *);
void * rpcMallocCont(int contLen); void * rpcMallocCont(int contLen);
void rpcFreeCont(void *pCont); void rpcFreeCont(void *pCont);
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "clientInt.h" #include "clientInt.h"
#include "ulog.h" #include "ulog.h"
// todo refact // todo refact
SConfig *tscCfg; SConfig *tscCfg;
static int32_t tscLoadCfg(SConfig *pConfig, const char *inputCfgDir, const char *envFile, const char *apolloUrl) { static int32_t tscLoadCfg(SConfig *pConfig, const char *inputCfgDir, const char *envFile, const char *apolloUrl) {
...@@ -125,7 +125,7 @@ static int32_t tscAddEpCfg(SConfig *pCfg) { ...@@ -125,7 +125,7 @@ static int32_t tscAddEpCfg(SConfig *pCfg) {
return -1; return -1;
} }
if (cfgAddString(pCfg, "fqdn", defaultFqdn) != 0) return -1; if (cfgAddString(pCfg, "fqdn", defaultFqdn) != 0) return -1;
int32_t defaultServerPort = 6030; int32_t defaultServerPort = 6030;
if (cfgAddInt32(pCfg, "serverPort", defaultServerPort, 1, 65056) != 0) return -1; if (cfgAddInt32(pCfg, "serverPort", defaultServerPort, 1, 65056) != 0) return -1;
...@@ -142,11 +142,10 @@ static int32_t tscAddEpCfg(SConfig *pCfg) { ...@@ -142,11 +142,10 @@ static int32_t tscAddEpCfg(SConfig *pCfg) {
static int32_t tscAddCfg(SConfig *pCfg) { static int32_t tscAddCfg(SConfig *pCfg) {
if (tscAddEpCfg(pCfg) != 0) return -1; if (tscAddEpCfg(pCfg) != 0) return -1;
// if (cfgAddString(pCfg, "buildinfo", buildinfo) != 0) return -1; // if (cfgAddString(pCfg, "buildinfo", buildinfo) != 0) return -1;
// if (cfgAddString(pCfg, "gitinfo", gitinfo) != 0) return -1; // if (cfgAddString(pCfg, "gitinfo", gitinfo) != 0) return -1;
// if (cfgAddString(pCfg, "version", version) != 0) return -1; // if (cfgAddString(pCfg, "version", version) != 0) return -1;
// if (cfgAddDir(pCfg, "dataDir", tsDataDir) != 0) return -1; // if (cfgAddDir(pCfg, "dataDir", tsDataDir) != 0) return -1;
if (cfgAddTimezone(pCfg, "timezone", "") != 0) return -1; if (cfgAddTimezone(pCfg, "timezone", "") != 0) return -1;
if (cfgAddLocale(pCfg, "locale", "") != 0) return -1; if (cfgAddLocale(pCfg, "locale", "") != 0) return -1;
...@@ -160,7 +159,8 @@ static int32_t tscAddCfg(SConfig *pCfg) { ...@@ -160,7 +159,8 @@ static int32_t tscAddCfg(SConfig *pCfg) {
if (cfgAddFloat(pCfg, "numOfThreadsPerCore", 1, 0, 10) != 0) return -1; if (cfgAddFloat(pCfg, "numOfThreadsPerCore", 1, 0, 10) != 0) return -1;
if (cfgAddFloat(pCfg, "ratioOfQueryCores", 1, 0, 5) != 0) return -1; if (cfgAddFloat(pCfg, "ratioOfQueryCores", 1, 0, 5) != 0) return -1;
if (cfgAddInt32(pCfg, "shellActivityTimer", 3, 1, 120) != 0) return -1; if (cfgAddInt32(pCfg, "shellActivityTimer", 3, 1, 120) != 0) return -1;
if (cfgAddInt32(pCfg, "rpcTimer", 300, 100, 3000) != 0) return -1;
if (cfgAddInt32(pCfg, "rpcMaxTime", 600, 100, 7200) != 0) return -1;
if (cfgAddInt32(pCfg, "maxConnections", 50000, 1, 100000) != 0) return -1; if (cfgAddInt32(pCfg, "maxConnections", 50000, 1, 100000) != 0) return -1;
return 0; return 0;
} }
...@@ -169,8 +169,6 @@ int32_t tscCheckCfg(SConfig *pCfg) { ...@@ -169,8 +169,6 @@ int32_t tscCheckCfg(SConfig *pCfg) {
bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval; bool enableCore = cfgGetItem(pCfg, "enableCoreFile")->bval;
taosSetCoreDump(enableCore); taosSetCoreDump(enableCore);
return 0; return 0;
} }
......
...@@ -223,7 +223,11 @@ void taos_init_imp(void) { ...@@ -223,7 +223,11 @@ void taos_init_imp(void) {
initMsgHandleFp(); initMsgHandleFp();
initQueryModuleMsgHandle(); initQueryModuleMsgHandle();
rpcInit(); SRpcCfg rpcCfg = {0};
rpcCfg.rpcTimer = cfgGetItem(tscCfg, "rpcTimer")->i32;
rpcCfg.rpcMaxTime = cfgGetItem(tscCfg, "rpcMaxTime")->i32;
rpcCfg.sver = 30000000;
rpcInit(&rpcCfg);
SCatalogCfg cfg = {.maxDBCacheNum = 100, .maxTblCacheNum = 100}; SCatalogCfg cfg = {.maxDBCacheNum = 100, .maxTblCacheNum = 100};
catalogInit(&cfg); catalogInit(&cfg);
......
...@@ -49,7 +49,7 @@ int main(int argc, char** argv) { ...@@ -49,7 +49,7 @@ int main(int argc, char** argv) {
} }
TEST(testCase, driverInit_Test) { TEST(testCase, driverInit_Test) {
taosInitGlobalCfg(); // taosInitGlobalCfg();
// taos_init(); // taos_init();
} }
......
...@@ -34,7 +34,7 @@ int main(int argc, char** argv) { ...@@ -34,7 +34,7 @@ int main(int argc, char** argv) {
} }
TEST(testCase, driverInit_Test) { TEST(testCase, driverInit_Test) {
taosInitGlobalCfg(); // taosInitGlobalCfg();
// taos_init(); // taos_init();
} }
......
...@@ -118,23 +118,6 @@ bool tsdbForceKeepFile = false; ...@@ -118,23 +118,6 @@ bool tsdbForceKeepFile = false;
*/ */
int64_t tsTickPerDay[] = {86400000L, 86400000000L, 86400000000000L}; int64_t tsTickPerDay[] = {86400000L, 86400000000L, 86400000000000L};
// system info
int32_t tsTotalMemoryMB = 0;
uint32_t tsVersion = 0;
//
// lossy compress 6
//
char tsLossyColumns[32] = ""; // "float|double" means all float and double columns can be lossy compressed. set empty
// can close lossy compress.
// below option can take effect when tsLossyColumns not empty
double tsFPrecision = 1E-8; // float column precision
double tsDPrecision = 1E-16; // double column precision
uint32_t tsMaxRange = 500; // max range
uint32_t tsCurRange = 100; // range
char tsCompressor[32] = "ZSTD_COMPRESSOR"; // ZSTD_COMPRESSOR or GZIP_COMPRESSOR
int32_t (*monStartSystemFp)() = NULL; int32_t (*monStartSystemFp)() = NULL;
void (*monStopSystemFp)() = NULL; void (*monStopSystemFp)() = NULL;
void (*monExecuteSQLFp)(char *sql) = NULL; void (*monExecuteSQLFp)(char *sql) = NULL;
...@@ -529,8 +512,6 @@ static void doInitGlobalConfig(void) { ...@@ -529,8 +512,6 @@ static void doInitGlobalConfig(void) {
#endif #endif
} }
void taosInitGlobalCfg() { pthread_once(&tsInitGlobalCfgOnce, doInitGlobalConfig); }
/* /*
* alter dnode 1 balance "vnode:1-dnode:2" * alter dnode 1 balance "vnode:1-dnode:2"
*/ */
......
...@@ -80,6 +80,9 @@ static int32_t dmnAddDnodeCfg(SConfig *pCfg) { ...@@ -80,6 +80,9 @@ static int32_t dmnAddDnodeCfg(SConfig *pCfg) {
if (cfgAddFloat(pCfg, "ratioOfQueryCores", 1, 0, 5) != 0) return -1; if (cfgAddFloat(pCfg, "ratioOfQueryCores", 1, 0, 5) != 0) return -1;
if (cfgAddInt32(pCfg, "maxShellConns", 50000, 10, 50000000) != 0) return -1; if (cfgAddInt32(pCfg, "maxShellConns", 50000, 10, 50000000) != 0) return -1;
if (cfgAddInt32(pCfg, "shellActivityTimer", 3, 1, 120) != 0) return -1; if (cfgAddInt32(pCfg, "shellActivityTimer", 3, 1, 120) != 0) return -1;
if (cfgAddInt32(pCfg, "rpcTimer", 300, 100, 3000) != 0) return -1;
if (cfgAddInt32(pCfg, "rpcMaxTime", 600, 100, 7200) != 0) return -1;
return 0; return 0;
} }
...@@ -184,6 +187,8 @@ SDnodeEnvCfg dmnGetEnvCfg(SConfig *pCfg) { ...@@ -184,6 +187,8 @@ SDnodeEnvCfg dmnGetEnvCfg(SConfig *pCfg) {
envCfg.numOfCores = cfgGetItem(pCfg, "numOfCores")->i32; envCfg.numOfCores = cfgGetItem(pCfg, "numOfCores")->i32;
envCfg.numOfCommitThreads = (uint16_t)cfgGetItem(pCfg, "numOfCommitThreads")->i32; envCfg.numOfCommitThreads = (uint16_t)cfgGetItem(pCfg, "numOfCommitThreads")->i32;
envCfg.enableTelem = cfgGetItem(pCfg, "telemetryReporting")->bval; envCfg.enableTelem = cfgGetItem(pCfg, "telemetryReporting")->bval;
envCfg.rpcMaxTime = cfgGetItem(pCfg, "rpcMaxTime")->i32;
envCfg.rpcTimer = cfgGetItem(pCfg, "rpcTimer")->i32;
return envCfg; return envCfg;
} }
......
...@@ -270,7 +270,8 @@ int32_t dndInit(const SDnodeEnvCfg *pCfg) { ...@@ -270,7 +270,8 @@ int32_t dndInit(const SDnodeEnvCfg *pCfg) {
taosBlockSIGPIPE(); taosBlockSIGPIPE();
taosResolveCRC(); taosResolveCRC();
if (rpcInit() != 0) { SRpcCfg rpcCfg = {.rpcTimer = pCfg->rpcTimer, .rpcMaxTime = pCfg->rpcMaxTime, .sver = pCfg->sver};
if (rpcInit(&rpcCfg) != 0) {
dError("failed to init rpc since %s", terrstr()); dError("failed to init rpc since %s", terrstr());
dndCleanup(); dndCleanup();
return -1; return -1;
......
...@@ -43,6 +43,8 @@ void Testbase::Init(const char* path, int16_t port) { ...@@ -43,6 +43,8 @@ void Testbase::Init(const char* path, int16_t port) {
SDnodeEnvCfg cfg = {0}; SDnodeEnvCfg cfg = {0};
cfg.numOfCommitThreads = 1; cfg.numOfCommitThreads = 1;
cfg.numOfCores = 1; cfg.numOfCores = 1;
cfg.rpcMaxTime = 600;
cfg.rpcTimer = 300;
dndInit(&cfg); dndInit(&cfg);
char fqdn[] = "localhost"; char fqdn[] = "localhost";
......
...@@ -146,8 +146,9 @@ typedef struct SRpcConn { ...@@ -146,8 +146,9 @@ typedef struct SRpcConn {
static int tsRpcRefId = -1; static int tsRpcRefId = -1;
static int32_t tsRpcNum = 0; static int32_t tsRpcNum = 0;
int32_t tsRpcTimer = 300; int32_t tsRpcTimer = 300;
int32_t tsRpcMaxTime = 600; // seconds; int32_t tsRpcMaxTime = 600; // seconds;
uint32_t tsVersion = 0;
// static pthread_once_t tsRpcInit = PTHREAD_ONCE_INIT; // static pthread_once_t tsRpcInit = PTHREAD_ONCE_INIT;
...@@ -228,7 +229,9 @@ static void rpcInitImp(void) { ...@@ -228,7 +229,9 @@ static void rpcInitImp(void) {
tsFqdnHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); tsFqdnHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
} }
int32_t rpcInit(void) { int32_t rpcInit(SRpcCfg *pCfg) {
tsRpcTimer = pCfg->rpcTimer;
tsRpcMaxTime = pCfg->rpcMaxTime;
pthread_once(&tsRpcInitOnce, rpcInitImp); pthread_once(&tsRpcInitOnce, rpcInitImp);
return 0; return 0;
} }
......
...@@ -82,6 +82,8 @@ char tsDataDir[PATH_MAX] = "/var/lib/taos"; ...@@ -82,6 +82,8 @@ char tsDataDir[PATH_MAX] = "/var/lib/taos";
char tsLogDir[PATH_MAX] = "/var/log/taos"; char tsLogDir[PATH_MAX] = "/var/log/taos";
char tsTempDir[PATH_MAX] = "/tmp/"; char tsTempDir[PATH_MAX] = "/tmp/";
void osInit() {} void osInit() {
srand(taosSafeRand());
}
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册