ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [27/50] [abbrv] ignite git commit: IGNITE-6100 Fixed memory leak, IgnitePdsRecoveryAfterFileCorruptionTest.testPageRecoveryAfterFileCorruption - Fixes #2466.
Date Mon, 21 Aug 2017 08:40:36 GMT
IGNITE-6100 Fixed memory leak, IgnitePdsRecoveryAfterFileCorruptionTest.testPageRecoveryAfterFileCorruption
- Fixes #2466.

Signed-off-by: Alexey Goncharuk <alexey.goncharuk@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/06ad010e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/06ad010e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/06ad010e

Branch: refs/heads/ignite-5578
Commit: 06ad010e92541e4e0f0cdcfe6c99ea8d4af69b70
Parents: 071c24c
Author: Dmitriy Govorukhin <dmitriy.govorukhin@gmail.com>
Authored: Thu Aug 17 17:07:29 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Thu Aug 17 17:07:29 2017 +0300

----------------------------------------------------------------------
 .../persistence/pagemem/PageMemoryImpl.java     | 71 ++++++++++----------
 1 file changed, 37 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/06ad010e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index 1b4cf81..b6e5f46 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -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,55 +671,57 @@ public class PageMemoryImpl implements PageMemoryEx {
             ByteBuffer curPage = null;
             ByteBuffer lastValidPage = null;
 
-            for (IgniteBiTuple<WALPointer, WALRecord> tuple : walMgr.replay(null))
{
-                switch (tuple.getValue().type()) {
-                    case PAGE_RECORD:
-                        PageSnapshot snapshot = (PageSnapshot)tuple.getValue();
+            try (WALIterator it = walMgr.replay(null)) {
+                for (IgniteBiTuple<WALPointer, WALRecord> tuple : it) {
+                    switch (tuple.getValue().type()) {
+                        case PAGE_RECORD:
+                            PageSnapshot snapshot = (PageSnapshot)tuple.getValue();
 
-                        if (snapshot.fullPageId().equals(fullId)) {
-                            if (tmpAddr == null) {
-                                assert snapshot.pageData().length <= pageSize() : snapshot.pageData().length;
+                            if (snapshot.fullPageId().equals(fullId)) {
+                                if (tmpAddr == null) {
+                                    assert snapshot.pageData().length <= pageSize() :
snapshot.pageData().length;
 
-                                tmpAddr = GridUnsafe.allocateMemory(pageSize());
-                            }
+                                    tmpAddr = GridUnsafe.allocateMemory(pageSize());
+                                }
 
-                            if (curPage == null)
-                                curPage = wrapPointer(tmpAddr, pageSize());
+                                if (curPage == null)
+                                    curPage = wrapPointer(tmpAddr, pageSize());
 
-                            PageUtils.putBytes(tmpAddr, 0, snapshot.pageData());
-                        }
+                                PageUtils.putBytes(tmpAddr, 0, snapshot.pageData());
+                            }
 
-                        break;
+                            break;
 
-                    case CHECKPOINT_RECORD:
-                        CheckpointRecord rec = (CheckpointRecord)tuple.getValue();
+                        case CHECKPOINT_RECORD:
+                            CheckpointRecord rec = (CheckpointRecord)tuple.getValue();
 
-                        assert !rec.end();
+                            assert !rec.end();
 
-                        if (curPage != null) {
-                            lastValidPage = curPage;
-                            curPage = null;
-                        }
+                            if (curPage != null) {
+                                lastValidPage = curPage;
+                                curPage = null;
+                            }
 
-                        break;
+                            break;
 
-                    case MEMORY_RECOVERY: // It means that previous checkpoint was broken.
-                        curPage = null;
+                        case MEMORY_RECOVERY: // It means that previous checkpoint was broken.
+                            curPage = null;
 
-                        break;
+                            break;
 
-                    default:
-                        if (tuple.getValue() instanceof PageDeltaRecord) {
-                            PageDeltaRecord deltaRecord = (PageDeltaRecord)tuple.getValue();
+                        default:
+                            if (tuple.getValue() instanceof PageDeltaRecord) {
+                                PageDeltaRecord deltaRecord = (PageDeltaRecord)tuple.getValue();
 
-                            if (curPage != null
-                                && deltaRecord.pageId() == fullId.pageId()
-                                && deltaRecord.groupId() == fullId.groupId()) {
-                                assert tmpAddr != null;
+                                if (curPage != null
+                                    && deltaRecord.pageId() == fullId.pageId()
+                                    && deltaRecord.groupId() == fullId.groupId())
{
+                                    assert tmpAddr != null;
 
-                                deltaRecord.applyDelta(this, tmpAddr);
+                                    deltaRecord.applyDelta(this, tmpAddr);
+                                }
                             }
-                        }
+                    }
                 }
             }
 


Mime
View raw message