TD-1762
This commit is contained in:
parent
d2c852c8e9
commit
580df53561
|
@ -23,13 +23,13 @@
|
||||||
#include "vnodeVersion.h"
|
#include "vnodeVersion.h"
|
||||||
|
|
||||||
int32_t vnodeReadVersion(SVnodeObj *pVnode) {
|
int32_t vnodeReadVersion(SVnodeObj *pVnode) {
|
||||||
int32_t ret = TSDB_CODE_SUCCESS;
|
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
int32_t maxLen = 100;
|
int32_t maxLen = 100;
|
||||||
char * content = calloc(1, maxLen + 1);
|
char * content = calloc(1, maxLen + 1);
|
||||||
cJSON * root = NULL;
|
cJSON * root = NULL;
|
||||||
FILE * fp = NULL;
|
FILE * fp = NULL;
|
||||||
|
|
||||||
|
terrno = TSDB_CODE_VND_INVALID_VRESION_FILE;
|
||||||
char file[TSDB_FILENAME_LEN + 30] = {0};
|
char file[TSDB_FILENAME_LEN + 30] = {0};
|
||||||
sprintf(file, "%s/vnode%d/version.json", tsVnodeDir, pVnode->vgId);
|
sprintf(file, "%s/vnode%d/version.json", tsVnodeDir, pVnode->vgId);
|
||||||
|
|
||||||
|
@ -37,14 +37,14 @@ int32_t vnodeReadVersion(SVnodeObj *pVnode) {
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
vError("vgId:%d, failed to read %s, error:%s", pVnode->vgId, file, strerror(errno));
|
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 {
|
} else {
|
||||||
ret = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
goto PARSE_VER_ERROR;
|
goto PARSE_VER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(content, 1, maxLen, fp);
|
len = fread(content, 1, maxLen, fp);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
vError("vgId:%d, failed to read %s, content is null", pVnode->vgId, file);
|
vError("vgId:%d, failed to read %s, content is null", pVnode->vgId, file);
|
||||||
goto PARSE_VER_ERROR;
|
goto PARSE_VER_ERROR;
|
||||||
|
@ -63,16 +63,15 @@ int32_t vnodeReadVersion(SVnodeObj *pVnode) {
|
||||||
}
|
}
|
||||||
pVnode->version = ver->valueint;
|
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);
|
vInfo("vgId:%d, read %s successfully, version:%" PRId64, pVnode->vgId, file, pVnode->version);
|
||||||
|
|
||||||
PARSE_VER_ERROR:
|
PARSE_VER_ERROR:
|
||||||
if (content != NULL) free(content);
|
if (content != NULL) free(content);
|
||||||
if (root != NULL) cJSON_Delete(root);
|
if (root != NULL) cJSON_Delete(root);
|
||||||
if (fp != NULL) fclose(fp);
|
if (fp != NULL) fclose(fp);
|
||||||
terrno = 0;
|
|
||||||
|
|
||||||
return ret;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
|
int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
|
||||||
|
|
|
@ -204,7 +204,6 @@ static int32_t vnodeProcessUpdateTagValMsg(SVnodeObj *pVnode, void *pCont, SRspR
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vnodeWriteCqMsgToQueue(void *param, void *data, int type) {
|
int vnodeWriteCqMsgToQueue(void *param, void *data, int type) {
|
||||||
SVnodeObj *pVnode = param;
|
SVnodeObj *pVnode = param;
|
||||||
SWalHead * pHead = data;
|
SWalHead * pHead = data;
|
||||||
|
@ -222,7 +221,6 @@ int vnodeWriteCqMsgToQueue(void *param, void *data, int type) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int vnodeWriteToQueue(void *param, void *data, int type) {
|
int vnodeWriteToQueue(void *param, void *data, int type) {
|
||||||
SVnodeObj *pVnode = param;
|
SVnodeObj *pVnode = param;
|
||||||
SWalHead * pHead = data;
|
SWalHead * pHead = data;
|
||||||
|
|
Loading…
Reference in New Issue