You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2018/02/22 17:50:44 UTC
ignite git commit: IGNITE-7698 Fixed test hangup,
avoid to double lock page in case when restore is done - Fixes #3560.
Repository: ignite
Updated Branches:
refs/heads/master c8a77b273 -> 7288828c5
IGNITE-7698 Fixed test hangup, avoid to double lock page in case when restore is done - Fixes #3560.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7288828c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7288828c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7288828c
Branch: refs/heads/master
Commit: 7288828c595d5f6b9b59eae4d2c54d16d9770833
Parents: c8a77b2
Author: dpavlov <dp...@gridgain.com>
Authored: Thu Feb 22 20:50:11 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Feb 22 20:50:11 2018 +0300
----------------------------------------------------------------------
.../persistence/pagemem/PageMemoryImpl.java | 34 +++++++++++---------
1 file changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7288828c/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 e52d4fc..27c9b38 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
@@ -754,18 +754,22 @@ public class PageMemoryImpl implements PageMemoryEx {
assert lockedPageAbsPtr != -1 : "Page is expected to have a valid address [pageId=" + fullId +
", lockedPageAbsPtr=" + U.hexLong(lockedPageAbsPtr) + ']';
- try {
- long pageAddr = lockedPageAbsPtr + PAGE_OVERHEAD;
+ assert isPageWriteLocked(lockedPageAbsPtr) : "Page is expected to be locked: [pageId=" + fullId + "]";
+
+ long pageAddr = lockedPageAbsPtr + PAGE_OVERHEAD;
- ByteBuffer buf = wrapPointer(pageAddr, pageSize());
+ ByteBuffer buf = wrapPointer(pageAddr, pageSize());
+ try {
storeMgr.read(cacheId, pageId, buf);
}
catch (IgniteDataIntegrityViolationException ignore) {
U.warn(log, "Failed to read page (data integrity violation encountered, will try to " +
"restore using existing WAL) [fullPageId=" + fullId + ']');
- tryToRestorePage(fullId, lockedPageAbsPtr);
+ buf.rewind();
+
+ tryToRestorePage(fullId, buf);
}
finally {
rwLock.writeUnlock(lockedPageAbsPtr + PAGE_LOCK_OFFSET, OffheapReadWriteLock.TAG_LOCK_ALWAYS);
@@ -820,12 +824,17 @@ public class PageMemoryImpl implements PageMemoryEx {
}
/**
- * @param fullId Full id.
- * @param absPtr Absolute pointer.
+ * Restores page from WAL page snapshot & delta records.
+ *
+ * @param fullId Full page ID.
+ * @param buf Destination byte buffer. Note: synchronization to provide ByteBuffer safety should be done outside
+ * this method.
+ *
+ * @throws IgniteCheckedException If failed to start WAL iteration, if incorrect page type observed in data, etc.
+ * @throws AssertionError if it was not possible to restore page, page not found in WAL.
*/
- private void tryToRestorePage(FullPageId fullId, long absPtr) throws IgniteCheckedException {
+ private void tryToRestorePage(FullPageId fullId, ByteBuffer buf) throws IgniteCheckedException {
Long tmpAddr = null;
-
try {
ByteBuffer curPage = null;
ByteBuffer lastValidPage = null;
@@ -892,14 +901,7 @@ public class PageMemoryImpl implements PageMemoryEx {
fullId.groupId(), fullId.pageId()
));
- long pageAddr = writeLockPage(absPtr, fullId, false);
-
- try {
- pageBuffer(pageAddr).put(restored);
- }
- finally {
- writeUnlockPage(absPtr, fullId, null, true, false);
- }
+ buf.put(restored);
}
finally {
if (tmpAddr != null)