diff --git a/src/dnode/src/dnodeCfg.c b/src/dnode/src/dnodeCfg.c index 19ebde163de1592e4d2438c17d1cb3b3bb0c865c..c4a1f6b450b9b980a770e5d5568e007ee5c908c6 100644 --- a/src/dnode/src/dnodeCfg.c +++ b/src/dnode/src/dnodeCfg.c @@ -32,7 +32,11 @@ static void dnodePrintCfg(SDnodeCfg *cfg); int32_t dnodeInitCfg() { pthread_mutex_init(&tsCfgMutex, NULL); dnodeResetCfg(NULL); - return dnodeReadCfg(); + int32_t ret = dnodeReadCfg(); + if (ret == 0) { + dInfo("dnode cfg is initialized"); + } + return ret; } void dnodeCleanupCfg() { pthread_mutex_destroy(&tsCfgMutex); } diff --git a/src/dnode/src/dnodeCheck.c b/src/dnode/src/dnodeCheck.c index b68c22df335a20ecdb3faa15a32de36430136da3..a9ee4ac649c2f4b2734ce7f0dd59004b08e2fb67 100644 --- a/src/dnode/src/dnodeCheck.c +++ b/src/dnode/src/dnodeCheck.c @@ -262,8 +262,6 @@ int32_t dnodeInitCheck() { } } + dInfo("dnode check is initialized"); return 0; } - - - diff --git a/src/dnode/src/dnodeEps.c b/src/dnode/src/dnodeEps.c index a97bf02cca5c69ab219074e407226b4e4e9a4ba2..9627333fc3e8e37ba55acb8f30e30177f5a44d23 100644 --- a/src/dnode/src/dnodeEps.c +++ b/src/dnode/src/dnodeEps.c @@ -35,7 +35,11 @@ int32_t dnodeInitEps() { pthread_mutex_init(&tsEpsMutex, NULL); tsEpsHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, true); dnodeResetEps(NULL); - return dnodeReadEps(); + int32_t ret = dnodeReadEps(); + if (ret == 0) { + dInfo("dnode eps is initialized"); + } + return ret; } void dnodeCleanupEps() { diff --git a/src/dnode/src/dnodeMInfos.c b/src/dnode/src/dnodeMInfos.c index 31e22514a39122cc45554797882a5911f482e4f0..0fbb9468691105085cad2abe53b45f45909c5c7d 100644 --- a/src/dnode/src/dnodeMInfos.c +++ b/src/dnode/src/dnodeMInfos.c @@ -34,7 +34,12 @@ static int32_t dnodeWriteMInfos(); int32_t dnodeInitMInfos() { pthread_mutex_init(&tsMInfosMutex, NULL); dnodeResetMInfos(NULL); - return dnodeReadMInfos(); + int32_t ret = dnodeReadMInfos(); + if (ret == 0) { + dInfo("dnode minfos is initialized"); + } + + return ret; } void dnodeCleanupMInfos() { pthread_mutex_destroy(&tsMInfosMutex); } diff --git a/src/dnode/src/dnodeMPeer.c b/src/dnode/src/dnodeMPeer.c index 8414d79a9815287dfdfae3af5cc123304745c56d..0da7ab74e45a27a15186014197ab3bf03ef867d0 100644 --- a/src/dnode/src/dnodeMPeer.c +++ b/src/dnode/src/dnodeMPeer.c @@ -58,7 +58,7 @@ int32_t dnodeInitMnodePeer() { dDebug("dnode mpeer worker:%d is created", i); } - dDebug("dnode mpeer is opened, workers:%d qset:%p", tsMPeerPool.maxNum, tsMPeerQset); + dDebug("dnode mpeer is initialized, workers:%d qset:%p", tsMPeerPool.maxNum, tsMPeerQset); return 0; } diff --git a/src/dnode/src/dnodeMRead.c b/src/dnode/src/dnodeMRead.c index fdcbb5889f766ddebdb3f1e56ccffa0b5b129552..4ad787f26e1b9e31a043644d710c6e6de5e354aa 100644 --- a/src/dnode/src/dnodeMRead.c +++ b/src/dnode/src/dnodeMRead.c @@ -60,7 +60,7 @@ int32_t dnodeInitMnodeRead() { dDebug("dnode mread worker:%d is created", i); } - dDebug("dnode mread is opened, workers:%d qset:%p", tsMReadPool.maxNum, tsMReadQset); + dDebug("dnode mread is initialized, workers:%d qset:%p", tsMReadPool.maxNum, tsMReadQset); return 0; } diff --git a/src/dnode/src/dnodeMWrite.c b/src/dnode/src/dnodeMWrite.c index 384a0fae75088197d7fb01dd67c6e1b9d38739cd..600688b9fd2cb5623b6bed492bbc6c420b55aa81 100644 --- a/src/dnode/src/dnodeMWrite.c +++ b/src/dnode/src/dnodeMWrite.c @@ -60,7 +60,7 @@ int32_t dnodeInitMnodeWrite() { dDebug("dnode mwrite worker:%d is created", i); } - dDebug("dnode mwrite is opened, workers:%d qset:%p", tsMWritePool.maxNum, tsMWriteQset); + dDebug("dnode mwrite is initialized, workers:%d qset:%p", tsMWritePool.maxNum, tsMWriteQset); return 0; } diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index 991ac8f9f92b6eef68edf633b1156997af8cfcbe..4731c813b82ac4629afbf278f93f92ea5d47f621 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -205,7 +205,7 @@ static int32_t dnodeInitStorage() { dnodeCheckDataDirOpenned(tsDnodeDir); - dInfo("storage directory is initialized"); + dInfo("dnode storage is initialized at %s", tsDnodeDir); return 0; } diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index c26b548fca12701bd32c7807d66ab0c63339a9cc..ace44f8161bec375f53be20c1c4467e408e8b7e9 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -79,7 +79,6 @@ int32_t dnodeInitMgmt() { dnodeAddClientRspHandle(TSDB_MSG_TYPE_DM_STATUS_RSP, dnodeProcessStatusRsp); tsRebootTime = taosGetTimestampSec(); - int32_t code = vnodeInitResources(); if (code != TSDB_CODE_SUCCESS) { dnodeCleanupMgmt(); diff --git a/src/dnode/src/dnodeModule.c b/src/dnode/src/dnodeModule.c index 4cc59ec40d3a9bac63827f9c48fafff9e5ba1054..bd9500ba51226d138fd3fe52f027d144d289681b 100644 --- a/src/dnode/src/dnodeModule.c +++ b/src/dnode/src/dnodeModule.c @@ -114,6 +114,7 @@ int32_t dnodeInitModules() { } } + dInfo("dnode modules is initialized"); return 0; } diff --git a/src/dnode/src/dnodePeer.c b/src/dnode/src/dnodePeer.c index 48efdf69c1c54fce5c14de16783b0fde3da56ccb..d2bb5d888dbd03ca0379103ed583e6d3aba05d75 100644 --- a/src/dnode/src/dnodePeer.c +++ b/src/dnode/src/dnodePeer.c @@ -72,7 +72,7 @@ int32_t dnodeInitServer() { return -1; } - dInfo("inter-dnodes RPC server is opened"); + dInfo("dnode inter-dnodes RPC server is initialized"); return 0; } @@ -137,7 +137,7 @@ int32_t dnodeInitClient() { return -1; } - dInfo("inter-dnodes rpc client is opened"); + dInfo("initialized inter-dnodes rpc client is initialized"); return 0; } diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c index 4c6c2100e048e9aaf23f4155d3c54604104a8f9b..ec561455033e043d46106c27b566b2eca30d5f02 100644 --- a/src/dnode/src/dnodeShell.c +++ b/src/dnode/src/dnodeShell.c @@ -97,7 +97,7 @@ int32_t dnodeInitShell() { return -1; } - dInfo("shell rpc server is opened"); + dInfo("dnode shell rpc server is initialized"); return 0; } diff --git a/src/dnode/src/dnodeTelemetry.c b/src/dnode/src/dnodeTelemetry.c index 4fdc0b8a73b58efa801f33ea99ffb7d123a72dcf..ab58e0470f31091683e6e66074c085c39535c894 100644 --- a/src/dnode/src/dnodeTelemetry.c +++ b/src/dnode/src/dnodeTelemetry.c @@ -299,6 +299,7 @@ int32_t dnodeInitTelemetry() { dTrace("failed to create telemetry thread, reason:%s", strerror(errno)); } + dInfo("dnode telemetry is initialized"); return 0; } diff --git a/src/dnode/src/dnodeVRead.c b/src/dnode/src/dnodeVRead.c index e61158ef30dddd6037af36c61be1fd522f8af10b..cd913cc100386f0145280b648adf193b0c508954 100644 --- a/src/dnode/src/dnodeVRead.c +++ b/src/dnode/src/dnodeVRead.c @@ -61,7 +61,7 @@ int32_t dnodeInitVnodeRead() { pWorker->workerId = i; } - dInfo("dnode read is opened, min worker:%d max worker:%d", readPool.min, readPool.max); + dInfo("dnode read is initialized, min worker:%d max worker:%d", readPool.min, readPool.max); return 0; } diff --git a/src/dnode/src/dnodeVWrite.c b/src/dnode/src/dnodeVWrite.c index f2740bf6b810197283926a602db4fc423067e231..d36c140f43668ec64a098873752ae60191b02b02 100644 --- a/src/dnode/src/dnodeVWrite.c +++ b/src/dnode/src/dnodeVWrite.c @@ -69,7 +69,7 @@ int32_t dnodeInitVnodeWrite() { wWorkerPool.writeWorker[i].workerId = i; } - dInfo("dnode write is opened, max worker %d", wWorkerPool.max); + dInfo("dnode write is initialized, max worker %d", wWorkerPool.max); return 0; } diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index c9e8b8c87a252d6eef4a05a4efad9999cd31ca0e..59c02ca3732bd3ef6069483959db41031e1c537f 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -440,9 +440,11 @@ static int32_t mnodeGetDnodeEpsSize() { return size; } -static void mnodeGetDnodeEpsData(SDnodeEps *pEps) { +static void mnodeGetDnodeEpsData(SDnodeEps *pEps, int32_t epsSize) { pthread_mutex_lock(&tsDnodeEpsMutex); - memcpy(pEps, tsDnodeEps, tsDnodeEpsSize); + if (epsSize == tsDnodeEpsSize) { + memcpy(pEps, tsDnodeEps, tsDnodeEpsSize); + } pthread_mutex_unlock(&tsDnodeEpsMutex); } @@ -451,6 +453,7 @@ static void mnodeUpdateDnodeEps() { int32_t totalDnodes = mnodeGetDnodesNum(); tsDnodeEpsSize = sizeof(SDnodeEps) + totalDnodes * sizeof(SDnodeEp); + free(tsDnodeEps); tsDnodeEps = calloc(1, tsDnodeEpsSize); tsDnodeEps->dnodeNum = htonl(totalDnodes); @@ -534,7 +537,10 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { } int32_t openVnodes = htons(pStatus->openVnodes); - int32_t contLen = sizeof(SDMStatusRsp) + openVnodes * sizeof(SDMVgroupAccess) + mnodeGetDnodeEpsSize(); + int32_t epsSize = mnodeGetDnodeEpsSize(); + int32_t vgAccessSize = openVnodes * sizeof(SDMVgroupAccess); + int32_t contLen = sizeof(SDMStatusRsp) + vgAccessSize + epsSize; + SDMStatusRsp *pRsp = rpcMallocCont(contLen); if (pRsp == NULL) { mnodeDecDnodeRef(pDnode); @@ -596,8 +602,8 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { mnodeDecDnodeRef(pDnode); - SDnodeEps *pEps = (SDnodeEps *)((char *)pAccess + openVnodes * sizeof(SDMVgroupAccess)); - mnodeGetDnodeEpsData(pEps); + SDnodeEps *pEps = (SDnodeEps *)((char *)pRsp + sizeof(SDMStatusRsp) + vgAccessSize); + mnodeGetDnodeEpsData(pEps, epsSize); pMsg->rpcRsp.len = contLen; pMsg->rpcRsp.rsp = pRsp; diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 6e9088d9fb82a80bb28857d563ad51f19594e6b7..680f162f70224625ab0e24f48e9b10d33c10cfbf 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -323,7 +323,7 @@ void *rpcMallocCont(int contLen) { tError("failed to malloc msg, size:%d", size); return NULL; } else { - tTrace("malloc mem: %p", start); + tTrace("malloc mem:%p size:%d", start, size); } return start + sizeof(SRpcReqContext) + sizeof(SRpcHead); @@ -1453,7 +1453,7 @@ static SRpcHead *rpcDecompressRpcMsg(SRpcHead *pHead) { pNewHead->msgLen = rpcMsgLenFromCont(origLen); rpcFreeMsg(pHead); // free the compressed message buffer pHead = pNewHead; - tTrace("decomp malloc mem: %p", temp); + tTrace("decomp malloc mem:%p", temp); } else { tError("failed to allocate memory to decompress msg, contLen:%d", contLen); } diff --git a/src/rpc/src/rpcTcp.c b/src/rpc/src/rpcTcp.c index bc8d360d39509ce9a2fdbe6a9dd883c5c5c99190..c6de398608e419f47cc734053d64bdc2d247f90a 100644 --- a/src/rpc/src/rpcTcp.c +++ b/src/rpc/src/rpcTcp.c @@ -437,12 +437,13 @@ static int taosReadTcpData(SFdObj *pFdObj, SRecvInfo *pInfo) { } msgLen = (int32_t)htonl((uint32_t)rpcHead.msgLen); - buffer = malloc(msgLen + tsRpcOverhead); + int32_t size = msgLen + tsRpcOverhead; + buffer = malloc(size); if (NULL == buffer) { tError("%s %p TCP malloc(size:%d) fail", pThreadObj->label, pFdObj->thandle, msgLen); return -1; } else { - tTrace("TCP malloc mem: %p", buffer); + tTrace("TCP malloc mem:%p size:%d", buffer, size); } msg = buffer + tsRpcOverhead; diff --git a/src/rpc/src/rpcUdp.c b/src/rpc/src/rpcUdp.c index 6f653046615f162c516b5eebf08995d30c6214d7..9bac2b1c192e1010fd3f796a635b401ae7372719 100644 --- a/src/rpc/src/rpcUdp.c +++ b/src/rpc/src/rpcUdp.c @@ -209,12 +209,13 @@ static void *taosRecvUdpData(void *param) { continue; } - char *tmsg = malloc(dataLen + tsRpcOverhead); + int32_t size = dataLen + tsRpcOverhead; + char *tmsg = malloc(size); if (NULL == tmsg) { tError("%s failed to allocate memory, size:%" PRId64, pConn->label, (int64_t)dataLen); continue; } else { - tTrace("UDP malloc mem: %p", tmsg); + tTrace("UDP malloc mem:%p size:%d", tmsg, size); } tmsg += tsRpcOverhead; // overhead for SRpcReqContext