diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c index 82fc286a949d4a668f66419cf1f7f1f7e6ca2067..2ae9faf7df613ba3e1bde8a5a7a9ed52f8f3fc7d 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c @@ -135,7 +135,7 @@ _OVER: if (content != NULL) taosMemoryFree(content); if (root != NULL) cJSON_Delete(root); if (pFile != NULL) taosCloseFile(&pFile); - if (*ppCfgs == NULL && pCfgs != NULL) taosMemoryFree(pCfgs); + if (code != 0) taosMemoryFree(pCfgs); terrno = code; return code; @@ -157,6 +157,11 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { int32_t numOfVnodes = 0; SVnodeObj **pVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes); + if (pVnodes == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + ret = -1; + goto _OVER; + } int32_t len = 0; int32_t maxLen = MAX_CONTENT_LEN; diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index 19ed2cbc88eb8c283f95857d1f1857592b9e7828..bcc2e358d6a1f4d1c4b1b7d2352734ff78df609c 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -384,7 +384,7 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) { for (int32_t v = 0; v < numOfVnodes; ++v) { int32_t t = v % threadNum; SVnodeThread *pThread = &threads[t]; - if (pThread->ppVnodes != NULL) { + if (pThread->ppVnodes != NULL && ppVnodes != NULL) { pThread->ppVnodes[pThread->vnodeNum++] = ppVnodes[v]; } } diff --git a/source/dnode/mnode/impl/src/mndAcct.c b/source/dnode/mnode/impl/src/mndAcct.c index 65857367f99e7a91816177e4d1c1dddf923b74ee..ffa5dc6d0bdb1ce6589bf3f73dbe22f9d0d455b8 100644 --- a/source/dnode/mnode/impl/src/mndAcct.c +++ b/source/dnode/mnode/impl/src/mndAcct.c @@ -77,7 +77,7 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) { SSdbRaw *pRaw = mndAcctActionEncode(&acctObj); if (pRaw == NULL) return -1; - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); mInfo("acct:%s, will be created when deploying, raw:%p", acctObj.acct, pRaw); diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c index 3502ecf604b63eb9891c345bc3693c04477bef04..348c8f4cb857da63f4ec3976004046b909e96eee 100644 --- a/source/dnode/mnode/impl/src/mndCluster.c +++ b/source/dnode/mnode/impl/src/mndCluster.c @@ -231,7 +231,7 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) { SSdbRaw *pRaw = mndClusterActionEncode(&clusterObj); if (pRaw == NULL) return -1; - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); mInfo("cluster:%" PRId64 ", will be created when deploying, raw:%p", clusterObj.id, pRaw); @@ -248,7 +248,7 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) { mndTransDrop(pTrans); return -1; } - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); if (mndTransPrepare(pMnode, pTrans) != 0) { mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); @@ -326,7 +326,7 @@ static int32_t mndProcessUptimeTimer(SRpcMsg *pReq) { mndTransDrop(pTrans); return -1; } - sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); if (mndTransPrepare(pMnode, pTrans) != 0) { mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 1d70f43834d0ca89f112b666822adab2db42a2d1..9f0cb0b51005337e0d3b3ba976f5713847bcb778 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -730,7 +730,7 @@ static int32_t mndSetAlterDbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pOl return -1; } - sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY); return 0; } @@ -742,7 +742,7 @@ static int32_t mndSetAlterDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p return -1; } - sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); return 0; } @@ -938,7 +938,7 @@ static int32_t mndSetDropDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD sdbRelease(pSdb, pVgroup); return -1; } - sdbSetRawStatus(pVgRaw, SDB_STATUS_DROPPED); + (void)sdbSetRawStatus(pVgRaw, SDB_STATUS_DROPPED); } sdbRelease(pSdb, pVgroup); @@ -956,7 +956,7 @@ static int32_t mndSetDropDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD sdbRelease(pSdb, pStbRaw); return -1; } - sdbSetRawStatus(pStbRaw, SDB_STATUS_DROPPED); + (void)sdbSetRawStatus(pStbRaw, SDB_STATUS_DROPPED); } sdbRelease(pSdb, pStb); @@ -1052,7 +1052,7 @@ static int32_t mndDropDb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb) { mError("trans:%d, failed to append redo log since %s", pTrans->id, terrstr()); goto _OVER; } - sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); } int32_t rspLen = 0; diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index c8995eb6bc9ed5d7fd38aafb7caba258b8517519..94317f7ac8d1c252afcdbcdaa2dae84d2a62fda9 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -101,7 +101,8 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) { dnodeObj.createdTime = taosGetTimestampMs(); dnodeObj.updateTime = dnodeObj.createdTime; dnodeObj.port = tsServerPort; - memcpy(&dnodeObj.fqdn, tsLocalFqdn, TSDB_FQDN_LEN); + tstrncpy(dnodeObj.fqdn, tsLocalFqdn, TSDB_FQDN_LEN); + dnodeObj.fqdn[TSDB_FQDN_LEN - 1] = 0; snprintf(dnodeObj.ep, TSDB_EP_LEN - 1, "%s:%u", dnodeObj.fqdn, dnodeObj.port); pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, NULL, "create-dnode"); @@ -110,7 +111,7 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) { pRaw = mndDnodeActionEncode(&dnodeObj); if (pRaw == NULL || mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER; - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); pRaw = NULL; if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; @@ -190,7 +191,10 @@ _OVER: static int32_t mndDnodeActionInsert(SSdb *pSdb, SDnodeObj *pDnode) { mTrace("dnode:%d, perform insert action, row:%p", pDnode->id, pDnode); pDnode->offlineReason = DND_REASON_STATUS_NOT_RECEIVED; - snprintf(pDnode->ep, TSDB_EP_LEN - 1, "%s:%u", pDnode->fqdn, pDnode->port); + + char ep[TSDB_EP_LEN] = {0}; + snprintf(ep, TSDB_EP_LEN - 1, "%s:%u", pDnode->fqdn, pDnode->port); + tstrncpy(pDnode->ep, ep, TSDB_EP_LEN); return 0; } @@ -275,7 +279,7 @@ void mndGetDnodeData(SMnode *pMnode, SArray *pDnodeEps) { SDnodeEp dnodeEp = {0}; dnodeEp.id = pDnode->id; dnodeEp.ep.port = pDnode->port; - memcpy(dnodeEp.ep.fqdn, pDnode->fqdn, TSDB_FQDN_LEN); + tstrncpy(dnodeEp.ep.fqdn, pDnode->fqdn, TSDB_FQDN_LEN); sdbRelease(pSdb, pDnode); dnodeEp.isMnode = 0; @@ -485,7 +489,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC dnodeObj.createdTime = taosGetTimestampMs(); dnodeObj.updateTime = dnodeObj.createdTime; dnodeObj.port = pCreate->port; - memcpy(dnodeObj.fqdn, pCreate->fqdn, TSDB_FQDN_LEN); + tstrncpy(dnodeObj.fqdn, pCreate->fqdn, TSDB_FQDN_LEN); snprintf(dnodeObj.ep, TSDB_EP_LEN - 1, "%s:%u", dnodeObj.fqdn, dnodeObj.port); pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq, "create-dnode"); @@ -494,7 +498,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC pRaw = mndDnodeActionEncode(&dnodeObj); if (pRaw == NULL || mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER; - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); pRaw = NULL; if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; @@ -675,13 +679,13 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM pRaw = mndDnodeActionEncode(pDnode); if (pRaw == NULL) goto _OVER; if (mndTransAppendRedolog(pTrans, pRaw) != 0) goto _OVER; - sdbSetRawStatus(pRaw, SDB_STATUS_DROPPING); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_DROPPING); pRaw = NULL; pRaw = mndDnodeActionEncode(pDnode); if (pRaw == NULL) goto _OVER; if (mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER; - sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED); pRaw = NULL; if (pMObj != NULL) { diff --git a/source/dnode/mnode/impl/src/mndFunc.c b/source/dnode/mnode/impl/src/mndFunc.c index ccab4774e24a9ca11d717ac175aeca863a9bbd07..c9b22fad3aa71e5881a821a4b1f84464f8d120c4 100644 --- a/source/dnode/mnode/impl/src/mndFunc.c +++ b/source/dnode/mnode/impl/src/mndFunc.c @@ -259,17 +259,17 @@ static int32_t mndDropFunc(SMnode *pMnode, SRpcMsg *pReq, SFuncObj *pFunc) { SSdbRaw *pRedoRaw = mndFuncActionEncode(pFunc); if (pRedoRaw == NULL) goto _OVER; if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) goto _OVER; - sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPING); + (void)sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPING); SSdbRaw *pUndoRaw = mndFuncActionEncode(pFunc); if (pUndoRaw == NULL) goto _OVER; if (mndTransAppendUndolog(pTrans, pUndoRaw) != 0) goto _OVER; - sdbSetRawStatus(pUndoRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pUndoRaw, SDB_STATUS_READY); SSdbRaw *pCommitRaw = mndFuncActionEncode(pFunc); if (pCommitRaw == NULL) goto _OVER; if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) goto _OVER; - sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED); + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED); if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER; diff --git a/source/dnode/mnode/impl/src/mndOffset.c b/source/dnode/mnode/impl/src/mndOffset.c index 797aa88670fc2ac7f83ace7d59851ef9b7874f6c..2ada3e00bb4e9c9f216cef86d373e03b0fba904a 100644 --- a/source/dnode/mnode/impl/src/mndOffset.c +++ b/source/dnode/mnode/impl/src/mndOffset.c @@ -161,7 +161,7 @@ int32_t mndCreateOffsets(STrans *pTrans, const char *cgroup, const char *topicNa if (pOffsetRaw == NULL) { return -1; } - sdbSetRawStatus(pOffsetRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pOffsetRaw, SDB_STATUS_READY); // commit log or redo log? if (mndTransAppendRedolog(pTrans, pOffsetRaw) < 0) { return -1; @@ -208,7 +208,7 @@ static int32_t mndProcessCommitOffsetReq(SRpcMsg *pMsg) { } pOffsetObj->offset = pOffset->offset; SSdbRaw *pOffsetRaw = mndOffsetActionEncode(pOffsetObj); - sdbSetRawStatus(pOffsetRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pOffsetRaw, SDB_STATUS_READY); mndTransAppendCommitlog(pTrans, pOffsetRaw); if (create) { taosMemoryFree(pOffsetObj); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index ea889e700174bc62f561768bb6f4543184327bfe..70e134a0889a1c42e79375741c8bdf3e6a5611d1 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -406,7 +406,7 @@ int32_t mndPersistStream(SMnode *pMnode, STrans *pTrans, SStreamObj *pStream) { mError("trans:%d, failed to append commit log since %s", pTrans->id, terrstr()); return -1; } - sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); return 0; } @@ -417,7 +417,7 @@ int32_t mndPersistDropStreamLog(SMnode *pMnode, STrans *pTrans, SStreamObj *pStr mndTransDrop(pTrans); return -1; } - sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED); + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED); return 0; } @@ -433,7 +433,7 @@ static int32_t mndSetStreamRecover(SMnode *pMnode, STrans *pTrans, const SStream mndTransDrop(pTrans); return -1; } - sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); return 0; } diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index ce195454f8d6746dce07c33fe92e15abb85a50e4..5d3a2be79aa8c9a1669d10390e03cd102a89769b 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -459,7 +459,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq * mndTransDrop(pTrans); return -1; } - sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); if (topicObj.ntbUid != 0) { STqCheckInfo info; @@ -596,7 +596,7 @@ static int32_t mndDropTopic(SMnode *pMnode, STrans *pTrans, SRpcMsg *pReq, SMqTo mndTransDrop(pTrans); return -1; } - sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED); + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED); if (mndTransPrepare(pMnode, pTrans) != 0) { mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); @@ -777,7 +777,7 @@ static int32_t mndRetrieveTopic(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl int32_t cols = 0; char topicName[TSDB_TOPIC_NAME_LEN + VARSTR_HEADER_SIZE + 5] = {0}; - strcpy(varDataVal(topicName), mndGetDbStr(pTopic->name)); + tstrncpy(varDataVal(topicName), mndGetDbStr(pTopic->name), sizeof(topicName) - 2); /*tNameFromString(&n, pTopic->name, T_NAME_ACCT | T_NAME_DB);*/ /*tNameGetDbName(&n, varDataVal(topicName));*/ varDataSetLen(topicName, strlen(varDataVal(topicName))); diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 455b71ace9fdc52bd4b1fc8a3e04d363273ed23c..b3ca03b33ae526e0bac13312ea461f9b1a947628 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -435,7 +435,9 @@ _OVER: return NULL; } - mTrace("trans:%d, decode from raw:%p, row:%p", pTrans->id, pRaw, pTrans); + if (pTrans != NULL) { + mTrace("trans:%d, decode from raw:%p, row:%p", pTrans->id, pRaw, pTrans); + } return pRow; } @@ -769,7 +771,7 @@ static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) { mError("trans:%d, failed to encode while sync trans since %s", pTrans->id, terrstr()); return -1; } - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); mInfo("trans:%d, sync to other mnodes, stage:%s", pTrans->id, mndTransStr(pTrans->stage)); int32_t code = mndSyncPropose(pMnode, pRaw, pTrans->id); @@ -1431,7 +1433,7 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) { mError("trans:%d, failed to encode while finish trans since %s", pTrans->id, terrstr()); return false; } - sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED); int32_t code = sdbWrite(pMnode->pSdb, pRaw); if (code != 0) { diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index fecdfb12ba2b8712794ad13e3ec19e7d33441e10..9f4b9fc2de36950267e6727bc7c031c27d3b3603 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -77,7 +77,7 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char SSdbRaw *pRaw = mndUserActionEncode(&userObj); if (pRaw == NULL) return -1; - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); mInfo("user:%s, will be created when deploying, raw:%p", userObj.user, pRaw); @@ -94,7 +94,7 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char mndTransDrop(pTrans); return -1; } - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); if (mndTransPrepare(pMnode, pTrans) != 0) { mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); @@ -313,7 +313,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate mndTransDrop(pTrans); return -1; } - sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); if (mndTransPrepare(pMnode, pTrans) != 0) { mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); @@ -397,7 +397,7 @@ static int32_t mndAlterUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SRpc mndTransDrop(pTrans); return -1; } - sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY); if (mndTransPrepare(pMnode, pTrans) != 0) { mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); @@ -612,7 +612,7 @@ static int32_t mndDropUser(SMnode *pMnode, SRpcMsg *pReq, SUserObj *pUser) { mndTransDrop(pTrans); return -1; } - sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED); + (void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED); if (mndTransPrepare(pMnode, pTrans) != 0) { mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index a0f01f41d89496c7b6036e960e49b3b10537b9e2..a31bf6b8e24201d5923a958bf4fb21c88d492eea 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -1115,14 +1115,14 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, { SSdbRaw *pRaw = mndVgroupActionEncode(&newVg); if (pRaw == NULL || mndTransAppendRedolog(pTrans, pRaw) != 0) return -1; - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); pRaw = NULL; } { SSdbRaw *pRaw = mndVgroupActionEncode(&newVg); if (pRaw == NULL || mndTransAppendCommitlog(pTrans, pRaw) != 0) return -1; - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); pRaw = NULL; } @@ -1304,14 +1304,14 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, { pRaw = mndVgroupActionEncode(&newVg); if (pRaw == NULL || mndTransAppendRedolog(pTrans, pRaw) != 0) goto _OVER; - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); pRaw = NULL; } { pRaw = mndVgroupActionEncode(&newVg); if (pRaw == NULL || mndTransAppendCommitlog(pTrans, pRaw) != 0) goto _OVER; - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); pRaw = NULL; } @@ -1579,7 +1579,7 @@ int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, S sdbFreeRaw(pVgRaw); return -1; } - sdbSetRawStatus(pVgRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY); } { @@ -1589,7 +1589,7 @@ int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, S sdbFreeRaw(pVgRaw); return -1; } - sdbSetRawStatus(pVgRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pVgRaw, SDB_STATUS_READY); } } @@ -1704,7 +1704,7 @@ static int32_t mndSetBalanceVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SD sdbFreeRaw(pRaw); return -1; } - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); } { @@ -1713,7 +1713,7 @@ static int32_t mndSetBalanceVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SD sdbFreeRaw(pRaw); return -1; } - sdbSetRawStatus(pRaw, SDB_STATUS_READY); + (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY); } mInfo("vgId:%d, vgroup info after balance, replica:%d", newVg.vgId, newVg.replica); diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c index b5cfa7b0f68fc4e4b4683f83e0dc72fff373aa8e..3df0fcee172611d2dbd4af1b37dfc858b6967360 100644 --- a/source/dnode/mnode/sdb/src/sdbFile.c +++ b/source/dnode/mnode/sdb/src/sdbFile.c @@ -619,8 +619,8 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, i int32_t code = 0; if (!isApply) { - sdbCloseIter(pIter); mInfo("sdbiter:%p, not apply to sdb", pIter); + sdbCloseIter(pIter); return 0; } diff --git a/source/util/src/tuuid.c b/source/util/src/tuuid.c index d192b1229d79e9a77ac3ea5291024060c6f6102c..8652652024ac5aca5e7f0bdf5f22ce416bbd8d3d 100644 --- a/source/util/src/tuuid.c +++ b/source/util/src/tuuid.c @@ -39,8 +39,8 @@ int32_t tGenIdPI32(void) { int64_t tGenIdPI64(void) { if (tUUIDHashId == 0) { - char uid[64]; - int32_t code = taosGetSystemUUID(uid, tListLen(uid)); + char uid[65] = {0}; + int32_t code = taosGetSystemUUID(uid, 64); if (code != TSDB_CODE_SUCCESS) { terrno = TAOS_SYSTEM_ERROR(errno); } else { diff --git a/utils/tsim/src/simExe.c b/utils/tsim/src/simExe.c index 5bb53287db18b25135e1cbb75fbe338b806fba74..4fe5fdf67257365461652522f1b621ece41b5356 100644 --- a/utils/tsim/src/simExe.c +++ b/utils/tsim/src/simExe.c @@ -237,9 +237,9 @@ int32_t simExecuteExpression(SScript *script, char *exp) { int32_t var3Len = 0; int32_t val0 = 0; int32_t val1 = 0; - char t0[1024] = {0}; - char t1[1024] = {0}; - char t2[1024] = {0}; + char t0[2048] = {0}; + char t1[2048] = {0}; + char t2[2048] = {0}; char t3[2048] = {0}; int32_t result = 0; @@ -256,7 +256,7 @@ int32_t simExecuteExpression(SScript *script, char *exp) { } if (var2[0] == '$') { - tstrncpy(t1, simGetVariable(script, var2 + 1, var2Len - 1), 1024); + tstrncpy(t1, simGetVariable(script, var2 + 1, var2Len - 1), sizeof(t1)); } else { memcpy(t1, var2, var2Len); t1[var2Len] = 0; @@ -266,7 +266,7 @@ int32_t simExecuteExpression(SScript *script, char *exp) { rest = paGetToken(rest, &var3, &var3Len); if (var3[0] == '$') - strcpy(t2, simGetVariable(script, var3 + 1, var3Len - 1)); + tstrncpy(t2, simGetVariable(script, var3 + 1, var3Len - 1), sizeof(t2)); else { memcpy(t2, var3, var3Len); t2[var3Len] = 0; @@ -291,7 +291,7 @@ int32_t simExecuteExpression(SScript *script, char *exp) { sprintf(t3, "%s%s", t1, t2); } } else { - strcpy(t3, t1); + tstrncpy(t3, t1, sizeof(t3)); } result = 0;