From 580df53561eae7bf67cdce9a39638875830e6a37 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 27 Oct 2020 12:09:29 +0000 Subject: [PATCH] TD-1762 --- src/vnode/src/vnodeVersion.c | 13 ++++++------- src/vnode/src/vnodeWrite.c | 2 -- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/vnode/src/vnodeVersion.c b/src/vnode/src/vnodeVersion.c index 2d251ec298..1d0695fb53 100644 --- a/src/vnode/src/vnodeVersion.c +++ b/src/vnode/src/vnodeVersion.c @@ -23,13 +23,13 @@ #include "vnodeVersion.h" int32_t vnodeReadVersion(SVnodeObj *pVnode) { - int32_t ret = TSDB_CODE_SUCCESS; int32_t len = 0; int32_t maxLen = 100; char * content = calloc(1, maxLen + 1); cJSON * root = NULL; FILE * fp = NULL; + terrno = TSDB_CODE_VND_INVALID_VRESION_FILE; char file[TSDB_FILENAME_LEN + 30] = {0}; sprintf(file, "%s/vnode%d/version.json", tsVnodeDir, pVnode->vgId); @@ -37,14 +37,14 @@ int32_t vnodeReadVersion(SVnodeObj *pVnode) { if (!fp) { if (errno != ENOENT) { vError("vgId:%d, failed to read %s, error:%s", pVnode->vgId, file, strerror(errno)); - ret = TAOS_SYSTEM_ERROR(errno); + terrno = TAOS_SYSTEM_ERROR(errno); } else { - ret = TSDB_CODE_SUCCESS; + terrno = TSDB_CODE_SUCCESS; } goto PARSE_VER_ERROR; } - fread(content, 1, maxLen, fp); + len = fread(content, 1, maxLen, fp); if (len <= 0) { vError("vgId:%d, failed to read %s, content is null", pVnode->vgId, file); goto PARSE_VER_ERROR; @@ -63,16 +63,15 @@ int32_t vnodeReadVersion(SVnodeObj *pVnode) { } pVnode->version = ver->valueint; - ret = TSDB_CODE_SUCCESS; + terrno = TSDB_CODE_SUCCESS; vInfo("vgId:%d, read %s successfully, version:%" PRId64, pVnode->vgId, file, pVnode->version); PARSE_VER_ERROR: if (content != NULL) free(content); if (root != NULL) cJSON_Delete(root); if (fp != NULL) fclose(fp); - terrno = 0; - return ret; + return terrno; } int32_t vnodeSaveVersion(SVnodeObj *pVnode) { diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 855df81a1b..c18a60d095 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -204,7 +204,6 @@ static int32_t vnodeProcessUpdateTagValMsg(SVnodeObj *pVnode, void *pCont, SRspR return TSDB_CODE_SUCCESS; } - int vnodeWriteCqMsgToQueue(void *param, void *data, int type) { SVnodeObj *pVnode = param; SWalHead * pHead = data; @@ -222,7 +221,6 @@ int vnodeWriteCqMsgToQueue(void *param, void *data, int type) { return 0; } - int vnodeWriteToQueue(void *param, void *data, int type) { SVnodeObj *pVnode = param; SWalHead * pHead = data; -- GitLab