diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index f62d0e6897..845090826a 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -594,7 +594,12 @@ typedef struct { // NOTE: sizeof(SVnodeCfg) < TSDB_FILE_HEADER_LEN/4 typedef struct { char acct[TSDB_USER_LEN]; - char db[TSDB_METER_ID_LEN+2]; // 8bytes align + /* + * the message is too large, so it may will overwrite the cfg information in meterobj.v* + * recover to origin codes + */ + //char db[TSDB_METER_ID_LEN+2]; // 8bytes align + char db[TSDB_DB_NAME_LEN]; uint32_t vgId; int32_t maxSessions; int32_t cacheBlockSize; diff --git a/src/system/detail/src/vnodeMeter.c b/src/system/detail/src/vnodeMeter.c index d3f672a886..4195138a29 100644 --- a/src/system/detail/src/vnodeMeter.c +++ b/src/system/detail/src/vnodeMeter.c @@ -112,7 +112,7 @@ FILE *vnodeOpenMeterObjFile(int vnode) { fp = fopen(fileName, "r+"); if (fp != NULL) { if (vnodeCheckFileIntegrity(fp) < 0) { - dError("file:%s is corrupted, need to restore it first", fileName); + dError("file:%s is corrupted, need to restore it first, exit program", fileName); fclose(fp); // todo: how to recover @@ -376,7 +376,11 @@ int vnodeOpenMetersVnode(int vnode) { fseek(fp, TSDB_FILE_HEADER_LEN * 2 / 4, SEEK_SET); fread(&pVnode->cfg, sizeof(SVnodeCfg), 1, fp); + if (vnodeIsValidVnodeCfg(&pVnode->cfg) == false) { + dError("vid:%d, maxSessions:%d cacheBlockSize:%d replications:%d daysPerFile:%d daysToKeep:%d invalid, clear it", + vnode, pVnode->cfg.maxSessions, pVnode->cfg.cacheBlockSize, pVnode->cfg.replications, + pVnode->cfg.daysPerFile, pVnode->cfg.daysToKeep); pVnode->cfg.maxSessions = 0; // error in vnode file return 0; }