diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index caae669e4ac063995dbd54615c30cfd3214423b7..30bdc4eddc4ed1a417cb4f06e43847b8e7b192ac 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -324,12 +324,17 @@ int32_t walEndSnapshot(SWal *pWal) { // find files safe to delete SWalFileInfo *pInfo = taosArraySearch(pWal->fileInfoSet, &tmp, compareWalFileInfo, TD_LE); if (pInfo) { + SWalFileInfo *pLastFileInfo = taosArrayGetLast(pWal->fileInfoSet); + wDebug("vgId:%d, wal search found file info: first:%" PRId64 "last:%" PRId64, pWal->cfg.vgId, pInfo->firstVer, + pInfo->lastVer); if (ver >= pInfo->lastVer) { - //pInfo--; pInfo++; + wDebug("vgId:%d, wal remove advance one file: first:%" PRId64 "last:%" PRId64, pWal->cfg.vgId, pInfo->firstVer, + pInfo->lastVer); } - if (POINTER_DISTANCE(pInfo, pWal->fileInfoSet->pData) > 0) { - wDebug("vgId:%d, wal end remove for %" PRId64, pWal->cfg.vgId, pInfo->firstVer); + if (pInfo <= pLastFileInfo) { + wDebug("vgId:%d, wal end remove for first:%" PRId64 "last:%" PRId64, pWal->cfg.vgId, pInfo->firstVer, + pInfo->lastVer); } else { wDebug("vgId:%d, wal no remove", pWal->cfg.vgId); }