From 2a3c43abde74dab394ab6b9f30df0d21a3982842 Mon Sep 17 00:00:00 2001 From: slguan Date: Tue, 17 Mar 2020 19:22:30 +0800 Subject: [PATCH] [TD-10] change some log format --- src/dnode/src/dnodeMClient.c | 4 ++-- src/dnode/src/dnodeMgmt.c | 24 +++++++++--------------- src/dnode/src/dnodeMnode.c | 16 ++++++++-------- src/dnode/src/dnodeShell.c | 6 +++--- src/mnode/src/mgmtDnode.c | 12 ++++++++++++ src/util/src/tglobalcfg.c | 2 +- 6 files changed, 35 insertions(+), 29 deletions(-) diff --git a/src/dnode/src/dnodeMClient.c b/src/dnode/src/dnodeMClient.c index d8220fe846..226a47f975 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 c7ac3fdaee..e547faa7a0 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 971e7b37f5..da47e4e49c 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 4f855c7804..951d43c34b 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 c48b4477e5..fcd9e58231 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 5ba878c598..bbea30207c 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; -- GitLab