diff --git a/src/dnode/src/dnodeMClient.c b/src/dnode/src/dnodeMClient.c index d8220fe846350665f90782e0ae65004d815b9dd2..226a47f9752ab3270ba44f33df04b898625288d8 100644 --- a/src/dnode/src/dnodeMClient.c +++ b/src/dnode/src/dnodeMClient.c @@ -41,11 +41,11 @@ int32_t dnodeInitMClient() { tsDnodeMClientRpc = rpcOpen(&rpcInit); if (tsDnodeMClientRpc == NULL) { - dError("failed to init connection from mgmt"); + dError("failed to init mnode rpc client"); return -1; } - dPrint("client connection to mgmt is opened"); + dPrint("mnode rpc client is opened"); return 0; } diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index c7ac3fdaee4d74e1d9622d06e9ed230c3e7681bd..e547faa7a042af8908d2696a4bf505d16d178f9a 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -80,13 +80,6 @@ int32_t dnodeInitMgmt() { } taosTmrReset(dnodeSendStatusMsg, 500, NULL, tsDnodeTmr, &tsStatusTimer); - SMDCreateVnodeMsg cfg; - cfg.cfg.vgId = 1; - cfg.cfg.precision = 0; - cfg.vnode = 1; - cfg.cfg.maxSessions = 1000; - cfg.cfg.daysPerFile = 10; - return dnodeOpenVnodes(); } @@ -171,8 +164,8 @@ static int32_t dnodeOpenVnodes() { int32_t vnode = atoi(de->d_name + 5); if (vnode == 0) continue; - char vnodeDir[TSDB_FILENAME_LEN]; - sprintf(vnodeDir, "%s/%s", tsVnodeDir, de->d_name); + char vnodeDir[TSDB_FILENAME_LEN * 3]; + snprintf(vnodeDir, TSDB_FILENAME_LEN * 3, "%s/%s", tsVnodeDir, de->d_name); int32_t code = dnodeOpenVnode(vnode, vnodeDir); if (code == 0) { numOfVnodes++; @@ -181,7 +174,7 @@ static int32_t dnodeOpenVnodes() { } closedir(dir); - dPrint("all vnodes is opened, num:%d", numOfVnodes); + dPrint("dnode mgmt is opened, vnodes:%d", numOfVnodes); return TSDB_CODE_SUCCESS; } @@ -189,7 +182,7 @@ typedef void (*CleanupFp)(char *); static void dnodeCleanupVnodes() { int32_t num = taosGetIntHashSize(tsDnodeVnodesHash); taosCleanUpIntHashWithFp(tsDnodeVnodesHash, (CleanupFp)dnodeCleanupVnode); - dPrint("all vnodes is opened, num:%d", num); + dPrint("dnode mgmt is closed, vnodes:%d", num); } static int32_t dnodeOpenVnode(int32_t vnode, char *rootDir) { @@ -401,10 +394,11 @@ static void dnodeProcessAlterStreamMsg(SRpcMsg *pMsg) { } static void dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) { -// SCfgDnodeMsg *pCfg = (SCfgDnodeMsg *)pCont; -// -// int32_t code = tsCfgDynamicOptions(pCfg->config); -// dnodeSendRspToMnode(pConn, msgType + 1, code, NULL, 0); + SMDCfgDnodeMsg *pCfg = (SMDCfgDnodeMsg *)pMsg->pCont; + int32_t code = tsCfgDynamicOptions(pCfg->config); + + SRpcMsg rpcRsp = {.handle = pMsg->handle, .pCont = NULL, .contLen = 0, .code = code, .msgType = 0}; + rpcSendResponse(&rpcRsp); } static void dnodeSendStatusMsg(void *handle, void *tmrId) { diff --git a/src/dnode/src/dnodeMnode.c b/src/dnode/src/dnodeMnode.c index 971e7b37f518d0b3cbe4b4c6df72579e996a9461..da47e4e49cede34dac50f421e419b504b4b48181 100644 --- a/src/dnode/src/dnodeMnode.c +++ b/src/dnode/src/dnodeMnode.c @@ -40,41 +40,41 @@ int32_t dnodeInitMnode() { memset(&rpcInit, 0, sizeof(rpcInit)); rpcInit.localIp = tsAnyIp ? "0.0.0.0" : tsPrivateIp; rpcInit.localPort = tsDnodeMnodePort; - rpcInit.label = "DND-mgmt"; + rpcInit.label = "DND-mnode"; rpcInit.numOfThreads = 1; rpcInit.cfp = dnodeProcessMsgFromMnode; rpcInit.sessions = TSDB_SESSIONS_PER_DNODE; rpcInit.connType = TAOS_CONN_SERVER; - rpcInit.idleTime = tsShellActivityTimer * 1500; + rpcInit.idleTime = tsShellActivityTimer * 1000; tsDnodeMnodeRpc = rpcOpen(&rpcInit); if (tsDnodeMnodeRpc == NULL) { - dError("failed to init connection from mgmt"); + dError("failed to init mnode rpc server"); return -1; } - dPrint("connection to mgmt is opened"); + dPrint("mnode rpc server is opened"); return 0; } void dnodeCleanupMnode() { if (tsDnodeMnodeRpc) { rpcClose(tsDnodeMnodeRpc); + tsDnodeMnodeRpc = NULL; } } static void dnodeProcessMsgFromMnode(SRpcMsg *pMsg) { SRpcMsg rspMsg; - - rspMsg.handle = pMsg->handle; - rspMsg.pCont = NULL; + rspMsg.handle = pMsg->handle; + rspMsg.pCont = NULL; rspMsg.contLen = 0; if (dnodeGetRunStatus() != TSDB_DNODE_RUN_STATUS_RUNING) { rspMsg.code = TSDB_CODE_NOT_READY; rpcSendResponse(&rspMsg); rpcFreeCont(pMsg->pCont); - dTrace("conn:%p, query msg is ignored since dnode not running", pMsg->handle); + dTrace("thandle:%p, query msg is ignored since dnode not running", pMsg->handle); return; } diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c index 4f855c7804264ddf065614a17cfce017f3c55ecf..951d43c34b88a2da659aa7429f37defb50837fb8 100644 --- a/src/dnode/src/dnodeShell.c +++ b/src/dnode/src/dnodeShell.c @@ -53,15 +53,15 @@ int32_t dnodeInitShell() { rpcInit.sessions = TSDB_SESSIONS_PER_DNODE; rpcInit.connType = TAOS_CONN_SERVER; rpcInit.idleTime = tsShellActivityTimer * 1500; - rpcInit.afp = + rpcInit.afp = dnodeRetrieveUserAuthInfo; tsDnodeShellRpc = rpcOpen(&rpcInit); if (tsDnodeShellRpc == NULL) { - dError("failed to init connection from shell"); + dError("failed to init shell rpc server"); return -1; } - dPrint("connection to shell is opened"); + dPrint("shell rpc server is opened"); return 0; } diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index c48b4477e5021dcead416b36d6c86b3823de10b6..fcd9e5823120fadc0701380204a32c16baf01c82 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -44,6 +44,7 @@ static int32_t mgmtRetrieveConfigs(SShowObj *pShow, char *data, int32_t rows, vo static int32_t mgmtGetVnodeMeta(STableMeta *pMeta, SShowObj *pShow, void *pConn); static int32_t mgmtRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows, void *pConn); static void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg); +static void mgmtProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) ; void mgmtSetDnodeMaxVnodes(SDnodeObj *pDnode) { int32_t maxVnodes = pDnode->numOfCores * tsNumOfVnodesPerCore; @@ -435,6 +436,8 @@ int32_t mgmtInitDnodes() { mgmtAddShellShowMetaHandle(TSDB_MGMT_TABLE_VNODES, mgmtGetVnodeMeta); mgmtAddShellShowRetrieveHandle(TSDB_MGMT_TABLE_VNODES, mgmtRetrieveVnodes); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_CONFIG_DNODE, mgmtProcessCfgDnodeMsg); + mgmtAddDClientRspHandle(TSDB_MSG_TYPE_MD_CONFIG_DNODE_RSP, mgmtProcessCfgDnodeMsgRsp); + if (mgmtInitDnodesFp) { return mgmtInitDnodesFp(); @@ -532,6 +535,11 @@ void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg) { if (mgmtCheckRedirect(pMsg->thandle)) return; SCMCfgDnodeMsg *pCmCfgDnode = pMsg->pCont; + if (pCmCfgDnode->ip[0] == 0) { + strcpy(pCmCfgDnode->ip, tsPrivateIp); + } else { + strcpy(pCmCfgDnode->ip, pCmCfgDnode->ip); + } uint32_t dnodeIp = inet_addr(pCmCfgDnode->ip); if (strcmp(pMsg->pUser->pAcct->user, "root") != 0) { @@ -558,3 +566,7 @@ void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg) { rpcSendResponse(&rpcRsp); } + +static void mgmtProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) { + mTrace("cfg vnode rsp is received"); +} \ No newline at end of file diff --git a/src/util/src/tglobalcfg.c b/src/util/src/tglobalcfg.c index 5ba878c5983fe3813bd533c8723eeddfad7c247c..bbea30207cfbb275caf37673afd925bea63559d7 100644 --- a/src/util/src/tglobalcfg.c +++ b/src/util/src/tglobalcfg.c @@ -135,7 +135,7 @@ int tsOfflineThreshold = 864000; // seconds 10days int tsMgmtEqualVnodeNum = 4; int tsEnableHttpModule = 1; -int tsEnableMonitorModule = 1; +int tsEnableMonitorModule = 0; int tsRestRowLimit = 10240; int tsMaxSQLStringLen = TSDB_MAX_SQL_LEN;