fix: align firstVer with lastVer too if no WAL logs exist

This commit is contained in:
Benguang Zhao 2022-11-22 23:41:58 +08:00
parent b80095dc87
commit 95f8e96eb5
1 changed files with 3 additions and 0 deletions

View File

@ -285,6 +285,9 @@ void walAlignVersions(SWal* pWal) {
if (pWal->vers.lastVer < pWal->vers.snapshotVer) {
wWarn("vgId:%d, lastVer:%" PRId64 " is less than snapshotVer:%" PRId64 ". align with it.", pWal->cfg.vgId,
pWal->vers.lastVer, pWal->vers.snapshotVer);
if (pWal->vers.lastVer < pWal->vers.firstVer) {
pWal->vers.firstVer = pWal->vers.snapshotVer + 1;
}
pWal->vers.lastVer = pWal->vers.snapshotVer;
}
if (pWal->vers.commitVer < pWal->vers.snapshotVer) {