未验证 提交 452f2247 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #17253 from taosdata/fix/TD-19245

fix: coverity issues
...@@ -297,7 +297,7 @@ typedef enum ELogicConditionType { ...@@ -297,7 +297,7 @@ typedef enum ELogicConditionType {
#define TSDB_MAX_BUFFER_PER_VNODE 16384 // unit MB #define TSDB_MAX_BUFFER_PER_VNODE 16384 // unit MB
#define TSDB_DEFAULT_BUFFER_PER_VNODE 96 #define TSDB_DEFAULT_BUFFER_PER_VNODE 96
#define TSDB_MIN_PAGES_PER_VNODE 64 #define TSDB_MIN_PAGES_PER_VNODE 64
#define TSDB_MAX_PAGES_PER_VNODE INT32_MAX #define TSDB_MAX_PAGES_PER_VNODE (INT32_MAX - 1)
#define TSDB_DEFAULT_PAGES_PER_VNODE 256 #define TSDB_DEFAULT_PAGES_PER_VNODE 256
#define TSDB_MIN_PAGESIZE_PER_VNODE 1 // unit KB #define TSDB_MIN_PAGESIZE_PER_VNODE 1 // unit KB
#define TSDB_MAX_PAGESIZE_PER_VNODE 16384 #define TSDB_MAX_PAGESIZE_PER_VNODE 16384
......
...@@ -145,7 +145,7 @@ _OVER: ...@@ -145,7 +145,7 @@ _OVER:
} }
int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
int32_t ret = 0; int32_t code = 0;
char file[PATH_MAX] = {0}; char file[PATH_MAX] = {0};
char realfile[PATH_MAX] = {0}; char realfile[PATH_MAX] = {0};
snprintf(file, sizeof(file), "%s%svnodes.json.bak", pMgmt->path, TD_DIRSEP); snprintf(file, sizeof(file), "%s%svnodes.json.bak", pMgmt->path, TD_DIRSEP);
...@@ -159,10 +159,10 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { ...@@ -159,10 +159,10 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
} }
int32_t numOfVnodes = 0; int32_t numOfVnodes = 0;
SVnodeObj **pVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes); SVnodeObj **ppVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes);
if (pVnodes == NULL) { if (ppVnodes == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
ret = -1; code = -1;
goto _OVER; goto _OVER;
} }
...@@ -171,14 +171,14 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) { ...@@ -171,14 +171,14 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
char *content = taosMemoryCalloc(1, maxLen + 1); char *content = taosMemoryCalloc(1, maxLen + 1);
if (content == NULL) { if (content == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
ret = -1; code = -1;
goto _OVER; goto _OVER;
} }
len += snprintf(content + len, maxLen - len, "{\n"); len += snprintf(content + len, maxLen - len, "{\n");
len += snprintf(content + len, maxLen - len, " \"vnodes\": [\n"); len += snprintf(content + len, maxLen - len, " \"vnodes\": [\n");
for (int32_t i = 0; i < numOfVnodes; ++i) { for (int32_t i = 0; i < numOfVnodes; ++i) {
SVnodeObj *pVnode = pVnodes[i]; SVnodeObj *pVnode = ppVnodes[i];
if (pVnode == NULL) continue; if (pVnode == NULL) continue;
len += snprintf(content + len, maxLen - len, " {\n"); len += snprintf(content + len, maxLen - len, " {\n");
...@@ -202,15 +202,17 @@ _OVER: ...@@ -202,15 +202,17 @@ _OVER:
taosMemoryFree(content); taosMemoryFree(content);
for (int32_t i = 0; i < numOfVnodes; ++i) { for (int32_t i = 0; i < numOfVnodes; ++i) {
SVnodeObj *pVnode = pVnodes[i]; SVnodeObj *pVnode = ppVnodes[i];
if (pVnode != NULL) {
vmReleaseVnode(pMgmt, pVnode); vmReleaseVnode(pMgmt, pVnode);
} }
}
if (pVnodes != NULL) { if (ppVnodes != NULL) {
taosMemoryFree(pVnodes); taosMemoryFree(ppVnodes);
} }
if (ret != 0) return -1; if (code != 0) return -1;
dDebug("successed to write %s, numOfVnodes:%d", realfile, numOfVnodes); dDebug("successed to write %s, numOfVnodes:%d", realfile, numOfVnodes);
return taosRenameFile(file, realfile); return taosRenameFile(file, realfile);
......
...@@ -104,7 +104,7 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) { ...@@ -104,7 +104,7 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) {
mndTransDrop(pTrans); mndTransDrop(pTrans);
return -1; return -1;
} }
sdbSetRawStatus(pRaw, SDB_STATUS_READY); (void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
if (mndTransPrepare(pMnode, pTrans) != 0) { if (mndTransPrepare(pMnode, pTrans) != 0) {
mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册