diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 00ad7a3d67ea6118a0ed9d2fe8bd10b988bdd350..a8f9362757128d7f88e2f03941024bd41431b657 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -327,7 +327,7 @@ int32_t walEndSnapshot(SWal *pWal) { wDebug("vgId:%d, wal check remove file %" PRId64 "(file size %" PRId64 " close ts %" PRId64 "), new tot size %" PRId64, pWal->cfg.vgId, iter->firstVer, iter->fileSize, iter->closeTs, newTotSize); - if (((pWal->cfg.retentionSize == 0) || (pWal->cfg.retentionSize != -1 && newTotSize > pWal->cfg.retentionSize)) || + if ((pWal->cfg.retentionSize != -1 && pWal->cfg.retentionSize != 0 && newTotSize > pWal->cfg.retentionSize) || ((pWal->cfg.retentionPeriod == 0) || (pWal->cfg.retentionPeriod != -1 && iter->closeTs != -1 && iter->closeTs + pWal->cfg.retentionPeriod < ts))) { // delete according to file size or close time