rpc config

This commit is contained in:
Shengliang Guan 2022-02-24 18:16:22 +08:00
parent e321edbeb2
commit 955b89f3cb
5 changed files with 5 additions and 24 deletions

View File

@ -84,13 +84,7 @@ typedef struct SRpcInit {
void *parent; void *parent;
} SRpcInit; } SRpcInit;
typedef struct { int32_t rpcInit();
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 *);

View File

@ -225,11 +225,7 @@ void taos_init_imp(void) {
initMsgHandleFp(); initMsgHandleFp();
initQueryModuleMsgHandle(); initQueryModuleMsgHandle();
SRpcCfg rpcCfg = {0}; rpcInit();
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);

View File

@ -270,8 +270,7 @@ int32_t dndInit(const SDnodeEnvCfg *pCfg) {
taosBlockSIGPIPE(); taosBlockSIGPIPE();
taosResolveCRC(); taosResolveCRC();
SRpcCfg rpcCfg = {.rpcTimer = pCfg->rpcTimer, .rpcMaxTime = pCfg->rpcMaxTime, .sver = pCfg->sver}; if (rpcInit() != 0) {
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;

View File

@ -42,8 +42,6 @@ int tsRpcMaxRetry;
int tsRpcHeadSize; int tsRpcHeadSize;
int tsRpcOverhead; int tsRpcOverhead;
int32_t tsRpcForceTcp = 1; // disable this, means query, show command use udp protocol as default
SHashObj *tsFqdnHash; SHashObj *tsFqdnHash;
#ifndef USE_UV #ifndef USE_UV
@ -146,10 +144,6 @@ 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 tsRpcMaxTime = 600; // seconds;
uint32_t tsVersion = 0;
// static pthread_once_t tsRpcInit = PTHREAD_ONCE_INIT; // static pthread_once_t tsRpcInit = PTHREAD_ONCE_INIT;
// server:0 client:1 tcp:2 udp:0 // server:0 client:1 tcp:2 udp:0
@ -229,9 +223,7 @@ 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(SRpcCfg *pCfg) { int32_t rpcInit() {
tsRpcTimer = pCfg->rpcTimer;
tsRpcMaxTime = pCfg->rpcMaxTime;
pthread_once(&tsRpcInitOnce, rpcInitImp); pthread_once(&tsRpcInitOnce, rpcInitImp);
return 0; return 0;
} }

View File

@ -112,7 +112,7 @@ void rpcSendRedirectRsp(void* thandle, const SEpSet* pEpSet) {
int rpcReportProgress(void* pConn, char* pCont, int contLen) { return -1; } int rpcReportProgress(void* pConn, char* pCont, int contLen) { return -1; }
void rpcCancelRequest(int64_t rid) { return; } void rpcCancelRequest(int64_t rid) { return; }
int32_t rpcInit(SRpcCfg* pCfg) { int32_t rpcInit() {
// impl later // impl later
return 0; return 0;
} }