未验证 提交 4084140f 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #17252 from taosdata/fix/TD-19254-D

fix: coverity scan for sma and tfs
...@@ -161,10 +161,12 @@ static int32_t tdProcessRSmaSyncPreCommitImpl(SSma *pSma) { ...@@ -161,10 +161,12 @@ static int32_t tdProcessRSmaSyncPreCommitImpl(SSma *pSma) {
* @return int32_t * @return int32_t
*/ */
static int32_t tdProcessRSmaSyncCommitImpl(SSma *pSma) { static int32_t tdProcessRSmaSyncCommitImpl(SSma *pSma) {
#if 0
SSmaEnv *pSmaEnv = SMA_RSMA_ENV(pSma); SSmaEnv *pSmaEnv = SMA_RSMA_ENV(pSma);
if (!pSmaEnv) { if (!pSmaEnv) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
#endif
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
...@@ -1932,7 +1932,8 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) { ...@@ -1932,7 +1932,8 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
int8_t oldStat = atomic_val_compare_exchange_8(RSMA_COMMIT_STAT(pRSmaStat), 0, 2); int8_t oldStat = atomic_val_compare_exchange_8(RSMA_COMMIT_STAT(pRSmaStat), 0, 2);
if (oldStat == 0 || if (oldStat == 0 ||
((oldStat == 2) && atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat)) < TASK_TRIGGER_STAT_PAUSED)) { ((oldStat == 2) && atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat)) < TASK_TRIGGER_STAT_PAUSED)) {
atomic_fetch_add_32(&pRSmaStat->nFetchAll, 1); int32_t oldVal = atomic_fetch_add_32(&pRSmaStat->nFetchAll, 1);
ASSERT(oldVal >= 0);
tdRSmaFetchAllResult(pSma, pInfo); tdRSmaFetchAllResult(pSma, pInfo);
if (0 == atomic_sub_fetch_32(&pRSmaStat->nFetchAll, 1)) { if (0 == atomic_sub_fetch_32(&pRSmaStat->nFetchAll, 1)) {
atomic_store_8(RSMA_COMMIT_STAT(pRSmaStat), 0); atomic_store_8(RSMA_COMMIT_STAT(pRSmaStat), 0);
......
...@@ -373,7 +373,11 @@ int32_t rsmaSnapWriterClose(SRSmaSnapWriter** ppWriter, int8_t rollback) { ...@@ -373,7 +373,11 @@ int32_t rsmaSnapWriterClose(SRSmaSnapWriter** ppWriter, int8_t rollback) {
// TODO: rsma1/rsma2 // TODO: rsma1/rsma2
// qtaskinfo // qtaskinfo
if (pWriter->pQTaskFWriter) { if (pWriter->pQTaskFWriter) {
taosRemoveFile(pWriter->pQTaskFWriter->fname); if (taosRemoveFile(pWriter->pQTaskFWriter->fname) != 0) {
smaWarn("vgId:%d, vnode snapshot rsma writer failed to remove %s since %s", SMA_VID(pWriter->pSma),
pWriter->pQTaskFWriter->fname ? pWriter->pQTaskFWriter->fname : "NULL",
tstrerror(TAOS_SYSTEM_ERROR(errno)));
}
} }
} else { } else {
// rsma1/rsma2 // rsma1/rsma2
......
...@@ -57,7 +57,7 @@ typedef struct { ...@@ -57,7 +57,7 @@ typedef struct {
typedef struct STfsDir { typedef struct STfsDir {
SDiskIter iter; SDiskIter iter;
SDiskID did; SDiskID did;
char dirname[TSDB_FILENAME_LEN]; char dirName[TSDB_FILENAME_LEN];
STfsFile tfile; STfsFile tfile;
TdDirPtr pDir; TdDirPtr pDir;
STfs *pTfs; STfs *pTfs;
......
...@@ -332,7 +332,7 @@ STfsDir *tfsOpendir(STfs *pTfs, const char *rname) { ...@@ -332,7 +332,7 @@ STfsDir *tfsOpendir(STfs *pTfs, const char *rname) {
SDiskID diskId = {.id = 0, .level = 0}; SDiskID diskId = {.id = 0, .level = 0};
pDir->iter.pDisk = TFS_DISK_AT(pTfs, diskId); pDir->iter.pDisk = TFS_DISK_AT(pTfs, diskId);
pDir->pTfs = pTfs; pDir->pTfs = pTfs;
tstrncpy(pDir->dirname, rname, TSDB_FILENAME_LEN); tstrncpy(pDir->dirName, rname, TSDB_FILENAME_LEN);
if (tfsOpendirImpl(pTfs, pDir) < 0) { if (tfsOpendirImpl(pTfs, pDir) < 0) {
taosMemoryFree(pDir); taosMemoryFree(pDir);
...@@ -354,10 +354,10 @@ const STfsFile *tfsReaddir(STfsDir *pTfsDir) { ...@@ -354,10 +354,10 @@ const STfsFile *tfsReaddir(STfsDir *pTfsDir) {
char *name = taosGetDirEntryName(pDirEntry); char *name = taosGetDirEntryName(pDirEntry);
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) continue; if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) continue;
if (pTfsDir->dirname == NULL || pTfsDir->dirname[0] == 0) { if (pTfsDir->dirName[0] == 0) {
snprintf(bname, TMPNAME_LEN * 2, "%s", name); snprintf(bname, TMPNAME_LEN * 2, "%s", name);
} else { } else {
snprintf(bname, TMPNAME_LEN * 2, "%s%s%s", pTfsDir->dirname, TD_DIRSEP, name); snprintf(bname, TMPNAME_LEN * 2, "%s%s%s", pTfsDir->dirName, TD_DIRSEP, name);
} }
tfsInitFile(pTfsDir->pTfs, &pTfsDir->tfile, pTfsDir->did, bname); tfsInitFile(pTfsDir->pTfs, &pTfsDir->tfile, pTfsDir->did, bname);
...@@ -523,9 +523,9 @@ static int32_t tfsOpendirImpl(STfs *pTfs, STfsDir *pTfsDir) { ...@@ -523,9 +523,9 @@ static int32_t tfsOpendirImpl(STfs *pTfs, STfsDir *pTfsDir) {
pTfsDir->did.id = pDisk->id; pTfsDir->did.id = pDisk->id;
if (pDisk->path == NULL || pDisk->path[0] == 0) { if (pDisk->path == NULL || pDisk->path[0] == 0) {
snprintf(adir, TMPNAME_LEN * 2, "%s", pTfsDir->dirname); snprintf(adir, TMPNAME_LEN * 2, "%s", pTfsDir->dirName);
} else { } else {
snprintf(adir, TMPNAME_LEN * 2, "%s%s%s", pDisk->path, TD_DIRSEP, pTfsDir->dirname); snprintf(adir, TMPNAME_LEN * 2, "%s%s%s", pDisk->path, TD_DIRSEP, pTfsDir->dirName);
} }
pTfsDir->pDir = taosOpenDir(adir); pTfsDir->pDir = taosOpenDir(adir);
if (pTfsDir->pDir != NULL) break; if (pTfsDir->pDir != NULL) break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册