Fixed memory leak, IgnitePdsRecoveryAfterFileCorruptionTest.testPageRecoveryAfterFileCorruption - Fixes
@@ -47,6 +47,7 @@ import org.apache.ignite.internal.pagemem.PageIdUtils;
import org.apache.ignite.internal.pagemem.PageUtils;
import org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager;
import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
+import org.apache.ignite.internal.pagemem.wal.WALIterator;
import org.apache.ignite.internal.pagemem.wal.WALPointer;
import org.apache.ignite.internal.pagemem.wal.record.CheckpointRecord;
import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot;
@@ -670,7 +671,8 @@ public class PageMemoryImpl implements PageMemoryEx {
ByteBuffer curPage = null;
ByteBuffer lastValidPage = null;
- for (IgniteBiTuple<WALPointer, WALRecord> tuple : walMgr.replay(null)) {
+ try (WALIterator it = walMgr.replay(null)) {
+ for (IgniteBiTuple<WALPointer, WALRecord> tuple : it) {
switch (tuple.getValue().type()) {
case PAGE_RECORD:
PageSnapshot snapshot = (PageSnapshot)tuple.getValue();
@@ -721,6 +723,7 @@ public class PageMemoryImpl implements PageMemoryEx {
}
}
}
+ }
ByteBuffer restored = curPage == null ? lastValidPage : curPage;
