You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/12/04 07:52:45 UTC
[7/9] ignite git commit: IGNITE-7091 Fixing assertion raising because
of serializer switch - Fixes #3128.
IGNITE-7091 Fixing assertion raising because of serializer switch - Fixes #3128.
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/6101fde4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6101fde4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6101fde4
Branch: refs/heads/ignite-zk
Commit: 6101fde4dc73431bf89cd01dfd828a10adad13ef
Parents: b13f088
Author: dpavlov <dp...@gridgain.com>
Authored: Mon Dec 4 09:31:56 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Dec 4 09:31:56 2017 +0300
----------------------------------------------------------------------
.../DummyPersistenceCompatibilityTest.java | 2 +-
.../wal/FileWriteAheadLogManager.java | 27 ++++++++++++++------
2 files changed, 20 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6101fde4/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
index 466b858..64a1cbf 100644
--- a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
+++ b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/DummyPersistenceCompatibilityTest.java
@@ -44,7 +44,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
*/
public class DummyPersistenceCompatibilityTest extends IgnitePersistenceCompatibilityAbstractTest {
/** */
- private static final String TEST_CACHE_NAME = DummyPersistenceCompatibilityTest.class.getSimpleName();
+ protected static final String TEST_CACHE_NAME = DummyPersistenceCompatibilityTest.class.getSimpleName();
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
http://git-wip-us.apache.org/repos/asf/ignite/blob/6101fde4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
index 948a8ae..5cb6b2f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
@@ -1381,13 +1381,19 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
/**
* @param absIdx Segment absolute index.
- * @return {@code True} if can read, {@code false} if work segment
+ * @return <ul><li>{@code True} if can read, no lock is held, </li><li>{@code false} if work segment, need
+ * release segment later, use {@link #releaseWorkSegment} for unlock</li> </ul>
*/
@SuppressWarnings("NonPrivateFieldAccessedInSynchronizedContext")
private boolean checkCanReadArchiveOrReserveWorkSegment(long absIdx) {
synchronized (this) {
- if (lastAbsArchivedIdx >= absIdx)
+ if (lastAbsArchivedIdx >= absIdx) {
+ if (log.isDebugEnabled())
+ log.debug("Not needed to reserve WAL segment: absIdx=" + absIdx + ";" +
+ " lastAbsArchivedIdx=" + lastAbsArchivedIdx);
+
return true;
+ }
Integer cur = locked.get(absIdx);
@@ -1410,7 +1416,8 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
synchronized (this) {
Integer cur = locked.get(absIdx);
- assert cur != null && cur > 0;
+ assert cur != null && cur > 0 : "WAL Segment with Index " + absIdx + " is not locked;" +
+ " lastAbsArchivedIdx = " + lastAbsArchivedIdx;
if (cur == 1) {
locked.remove(absIdx);
@@ -3070,10 +3077,13 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
nextHandle = null;
}
- if (nextHandle != null)
- nextHandle.workDir = !readArchive;
+ if (nextHandle == null) {
+ if (!readArchive)
+ releaseWorkSegment(curWalSegmIdx);
+ }
else
- releaseWorkSegment(curWalSegmIdx);
+ nextHandle.workDir = !readArchive;
+
curRec = null;
return nextHandle;
@@ -3081,8 +3091,9 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
/**
* @param absIdx Absolute index to check.
- * @return {@code True} if we can safely read the archive, {@code false} if the segment has not been archived
- * yet. In this case the corresponding work segment is reserved (will not be deleted until release).
+ * @return <ul><li> {@code True} if we can safely read the archive, </li> <li>{@code false} if the segment has
+ * not been archived yet. In this case the corresponding work segment is reserved (will not be deleted until
+ * release). Use {@link #releaseWorkSegment} for unlock </li></ul>
*/
private boolean canReadArchiveOrReserveWork(long absIdx) {
return archiver != null && archiver.checkCanReadArchiveOrReserveWorkSegment(absIdx);