You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2018/04/25 17:47:46 UTC
ignite git commit: IGNITE-8066 AssertionError while trying to archive
wal segment. - Fixes #3837.
Repository: ignite
Updated Branches:
refs/heads/master f97f9630d -> 1fb236935
IGNITE-8066 AssertionError while trying to archive wal segment. - Fixes #3837.
Signed-off-by: dpavlov <dp...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1fb23693
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1fb23693
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1fb23693
Branch: refs/heads/master
Commit: 1fb2369352ff88e9021ee995fa6e5a039c889955
Parents: f97f963
Author: Evgeny Stanilovskiy <es...@gridgain.com>
Authored: Wed Apr 25 20:46:47 2018 +0300
Committer: dpavlov <dp...@apache.org>
Committed: Wed Apr 25 20:46:47 2018 +0300
----------------------------------------------------------------------
.../GridCacheDatabaseSharedManager.java | 11 +++--
.../wal/IgniteWalHistoryReservationsTest.java | 49 ++++++++++++++++++--
2 files changed, 52 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1fb23693/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 1122e9b..7c23cad 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -780,6 +780,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
WALPointer restore = restoreMemory(status);
+ if (restore == null && status.endPtr != CheckpointStatus.NULL_PTR)
+ throw new StorageException("Restore wal pointer = " + restore + ", while status.endPtr = " + status.endPtr + ".");
+
// First, bring memory to the last consistent checkpoint state if needed.
// This method should return a pointer to the last valid record in the WAL.
@@ -800,7 +803,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
catch (StorageException | PersistentStorageIOException e) {
cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e));
- throw new IgniteCheckedException(e);
+ throw e;
}
finally {
checkpointReadUnlock();
@@ -1954,7 +1957,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
* @throws IgniteCheckedException If failed.
* @throws StorageException In case I/O error occurred during operations with storage.
*/
- private WALPointer restoreMemory(CheckpointStatus status) throws IgniteCheckedException {
+ private @Nullable WALPointer restoreMemory(CheckpointStatus status) throws IgniteCheckedException {
return restoreMemory(status, false, (PageMemoryEx)metaStorage.pageMemory());
}
@@ -1965,7 +1968,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
* @throws IgniteCheckedException If failed.
* @throws StorageException In case I/O error occurred during operations with storage.
*/
- private WALPointer restoreMemory(CheckpointStatus status, boolean storeOnly,
+ private @Nullable WALPointer restoreMemory(CheckpointStatus status, boolean storeOnly,
PageMemoryEx storePageMem) throws IgniteCheckedException {
assert !storeOnly || storePageMem != null;
@@ -2118,7 +2121,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
if (status.needRestoreMemory()) {
if (apply)
- throw new IgniteCheckedException("Failed to restore memory state (checkpoint marker is present " +
+ throw new StorageException("Failed to restore memory state (checkpoint marker is present " +
"on disk, but checkpoint record is missed in WAL) " +
"[cpStatus=" + status + ", lastRead=" + lastRead + "]");
http://git-wip-us.apache.org/repos/asf/ignite/blob/1fb23693/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
index 5ae16d2..e2c8bd1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java
@@ -18,10 +18,10 @@
package org.apache.ignite.internal.processors.cache.persistence.db.wal;
import java.util.Map;
+import java.util.concurrent.Callable;
import java.util.concurrent.locks.Lock;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -31,12 +31,11 @@ import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.failure.StopNodeFailureHandler;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
-import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
import org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
-import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -59,12 +58,15 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
cfg.setConsistentId("NODE$" + gridName.charAt(gridName.length() - 1));
+ cfg.setFailureHandler(new StopNodeFailureHandler());
+
DataStorageConfiguration memCfg = new DataStorageConfiguration()
.setDefaultDataRegionConfiguration(
new DataRegionConfiguration()
.setMaxSize(200 * 1024 * 1024)
.setPersistenceEnabled(true))
- .setWalMode(WALMode.LOG_ONLY);
+ .setWalMode(WALMode.LOG_ONLY)
+ .setWalSegmentSize(512 * 1024);
cfg.setDataStorageConfiguration(memCfg);
@@ -355,6 +357,45 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testWalHistoryPartiallyRemoved() throws Exception {
+ int entryCnt = 10_000;
+
+ IgniteEx ig0 = (IgniteEx) startGrids(2);
+
+ ig0.cluster().active(true);
+
+ IgniteCache<Integer, Integer> cache = ig0.cache("cache1");
+
+ for (int k = 0; k < entryCnt; k++)
+ cache.put(k, k);
+
+ GridTestUtils.runAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ forceCheckpoint();
+
+ return null;
+ }
+ });
+
+ String nodeId0 = U.maskForFileName(ig0.localNode().consistentId().toString());
+
+ String walArchPath = ig0.configuration().getDataStorageConfiguration().getWalArchivePath();
+
+ stopAllGrids();
+
+ U.delete(U.resolveWorkDirectory(U.defaultWorkDirectory(), walArchPath + "/" +
+ nodeId0, false));
+
+ startGrid(0);
+
+ Ignite ig1 = startGrid(1);
+
+ ig1.cluster().active(true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testNodeLeftDuringExchange() throws Exception {
System.setProperty(IGNITE_PDS_WAL_REBALANCE_THRESHOLD, "0");