This is an automated email from the ASF dual-hosted git repository.
alexpl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 42226ad246b IGNITE-17867 Fix node start failure if cpMapSnapshot.bin
file is corrupted - Fixes #10619.
42226ad246b is described below
commit 42226ad246be341f7acf8b30732c16b77bcc4ae5
Author: Aleksey Plekhanov <[email protected]>
AuthorDate: Tue Apr 4 10:03:34 2023 +0300
IGNITE-17867 Fix node start failure if cpMapSnapshot.bin file is corrupted
- Fixes #10619.
Signed-off-by: Aleksey Plekhanov <[email protected]>
---
.../checkpoint/CheckpointMarkersStorage.java | 2 +-
.../IgnitePdsCheckpointMapSnapshotTest.java | 23 ++++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/checkpoint/CheckpointMarkersStorage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/checkpoint/CheckpointMarkersStorage.java
index 969c8c34e18..badbc9cc924 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/checkpoint/CheckpointMarkersStorage.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/checkpoint/CheckpointMarkersStorage.java
@@ -202,7 +202,7 @@ public class CheckpointMarkersStorage {
snap = JdkMarshaller.DEFAULT.unmarshal(bytes, null);
}
- catch (IOException e) {
+ catch (IOException | IgniteCheckedException e) {
log.error("Failed to unmarshal earliest checkpoint map
snapshot", e);
if (!IgniteUtils.delete(snapshotFile)) {
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCheckpointMapSnapshotTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCheckpointMapSnapshotTest.java
index 9d431e197f6..7f0f0d6bf40 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCheckpointMapSnapshotTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCheckpointMapSnapshotTest.java
@@ -152,6 +152,29 @@ public class IgnitePdsCheckpointMapSnapshotTest extends
GridCommonAbstractTest {
testRestart(true);
}
+ /**
+ * Tests that node can start successfully if checkpoint map snapshot is
corrupted.
+ */
+ @Test
+ public void testCorruptedCpMap() throws Exception {
+ IgniteEx grid = startGrid(0);
+
+ File cpDir = dbMgr(grid).checkpointManager.checkpointDirectory();
+
+ File cpSnapshotMap = new File(cpDir,
CheckpointMarkersStorage.EARLIEST_CP_SNAPSHOT_FILE);
+
+ if (cpSnapshotMap.exists())
+ cpSnapshotMap.delete();
+
+ cpSnapshotMap.createNewFile();
+
+ stopGrid(0);
+
+ grid = startGrid(0);
+
+ grid.cluster().state(ClusterState.ACTIVE);
+ }
+
/**
* Tests node restart after a series of checkpoints. Node should use a
checkpoint map snapshot if it is present.
*