fix invaild snapshotVer while repair wal meta file
This commit is contained in:
parent
b40db3fab1
commit
ca7f490e6d
|
@ -50,6 +50,7 @@ typedef struct {
|
||||||
int32_t rollPeriod; // secs
|
int32_t rollPeriod; // secs
|
||||||
int64_t retentionSize;
|
int64_t retentionSize;
|
||||||
int64_t segSize;
|
int64_t segSize;
|
||||||
|
int64_t committed;
|
||||||
EWalType level; // wal level
|
EWalType level; // wal level
|
||||||
int32_t encryptAlgorithm;
|
int32_t encryptAlgorithm;
|
||||||
char encryptKey[ENCRYPT_KEY_LEN + 1];
|
char encryptKey[ENCRYPT_KEY_LEN + 1];
|
||||||
|
|
|
@ -515,6 +515,7 @@ static int32_t mndInitWal(SMnode *pMnode) {
|
||||||
.fsyncPeriod = 0,
|
.fsyncPeriod = 0,
|
||||||
.rollPeriod = -1,
|
.rollPeriod = -1,
|
||||||
.segSize = -1,
|
.segSize = -1,
|
||||||
|
.committed = -1,
|
||||||
.retentionPeriod = 0,
|
.retentionPeriod = 0,
|
||||||
.retentionSize = 0,
|
.retentionSize = 0,
|
||||||
.level = TAOS_WAL_FSYNC,
|
.level = TAOS_WAL_FSYNC,
|
||||||
|
|
|
@ -45,6 +45,7 @@ const SVnodeCfg vnodeCfgDefault = {.vgId = -1,
|
||||||
.retentionPeriod = -1,
|
.retentionPeriod = -1,
|
||||||
.rollPeriod = 0,
|
.rollPeriod = 0,
|
||||||
.segSize = 0,
|
.segSize = 0,
|
||||||
|
.committed = 0,
|
||||||
.retentionSize = -1,
|
.retentionSize = -1,
|
||||||
.level = TAOS_WAL_WRITE,
|
.level = TAOS_WAL_WRITE,
|
||||||
.clearFiles = 0,
|
.clearFiles = 0,
|
||||||
|
|
|
@ -257,6 +257,7 @@ int vnodeLoadInfo(const char *dir, SVnodeInfo *pInfo) {
|
||||||
code = vnodeDecodeInfo(pData, pInfo);
|
code = vnodeDecodeInfo(pData, pInfo);
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
|
||||||
|
pInfo->config.walCfg.committed = pInfo->state.committed;
|
||||||
_exit:
|
_exit:
|
||||||
if (code) {
|
if (code) {
|
||||||
if (pFile) {
|
if (pFile) {
|
||||||
|
|
|
@ -282,6 +282,12 @@ static int32_t walRebuildFileInfoSet(SArray* metaLogList, SArray* actualLogList)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void walAlignVersions(SWal* pWal) {
|
static void walAlignVersions(SWal* pWal) {
|
||||||
|
if (pWal->cfg.committed > 0 && pWal->cfg.committed != pWal->vers.snapshotVer) {
|
||||||
|
wWarn("vgId:%d, snapshotVer:%" PRId64 " in wal is different from commited:%" PRId64
|
||||||
|
". in vnode/mnode. align with it.",
|
||||||
|
pWal->cfg.vgId, pWal->vers.snapshotVer, pWal->cfg.committed);
|
||||||
|
pWal->vers.snapshotVer = pWal->cfg.committed;
|
||||||
|
}
|
||||||
if (pWal->vers.firstVer > pWal->vers.snapshotVer + 1) {
|
if (pWal->vers.firstVer > pWal->vers.snapshotVer + 1) {
|
||||||
wWarn("vgId:%d, firstVer:%" PRId64 " is larger than snapshotVer:%" PRId64 " + 1. align with it.", pWal->cfg.vgId,
|
wWarn("vgId:%d, firstVer:%" PRId64 " is larger than snapshotVer:%" PRId64 " + 1. align with it.", pWal->cfg.vgId,
|
||||||
pWal->vers.firstVer, pWal->vers.snapshotVer);
|
pWal->vers.firstVer, pWal->vers.snapshotVer);
|
||||||
|
|
Loading…
Reference in New Issue