From 9e314a4f52460d5411cd6760a5fd36f09e78eab6 Mon Sep 17 00:00:00 2001 From: Alexey Stelmak Date: Wed, 14 Nov 2018 11:49:18 +0300 Subject: [PATCH 1/2] StrictBoundsCheck exception --- .../reader/StandaloneWalRecordsIterator.java | 6 +++--- .../wal/reader/StrictBoundsCheckException.java | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StrictBoundsCheckException.java diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIterator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIterator.java index b6a3ed9261bbe..ae846e1703523 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIterator.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StandaloneWalRecordsIterator.java @@ -174,7 +174,7 @@ private static void strictCheck(List walFiles, FileWALPointer lo } if (idx == walFiles.size()) - throw new IgniteCheckedException("Wal segments not in bounds. loBoundIndex=" + lowBound.index() + + throw new StrictBoundsCheckException("Wal segments not in bounds. loBoundIndex=" + lowBound.index() + ", indexes=" + printIndexes(walFiles)); long curWalSegmIdx = walFiles.get(idx).idx(); @@ -185,11 +185,11 @@ private static void strictCheck(List walFiles, FileWALPointer lo assert desc != null; if (curWalSegmIdx != desc.idx()) - throw new IgniteCheckedException("Wal segment " + curWalSegmIdx + " not found in files " + printIndexes(walFiles)); + throw new StrictBoundsCheckException("Wal segment " + curWalSegmIdx + " not found in files " + printIndexes(walFiles)); } if (highBound.index() < Long.MAX_VALUE && curWalSegmIdx <= highBound.index()) - throw new IgniteCheckedException("Wal segments not in bounds. hiBoundIndex=" + highBound.index() + + throw new StrictBoundsCheckException("Wal segments not in bounds. hiBoundIndex=" + highBound.index() + ", indexes=" + printIndexes(walFiles)); } diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StrictBoundsCheckException.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StrictBoundsCheckException.java new file mode 100644 index 0000000000000..b34fcc33e0344 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/StrictBoundsCheckException.java @@ -0,0 +1,18 @@ +package org.apache.ignite.internal.processors.cache.persistence.wal.reader; + +import org.apache.ignite.IgniteCheckedException; + +/** + * This exception is used in checking boundaries (StandaloneWalRecordsIterator). + */ +public class StrictBoundsCheckException extends IgniteCheckedException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * @param mesg Message. + */ + public StrictBoundsCheckException(String mesg) { + super(mesg); + } +} From 8fe7cd7735620bcb2ec8da359e350d8ad53d95cc Mon Sep 17 00:00:00 2001 From: Alexey Stelmak Date: Thu, 15 Nov 2018 15:33:24 +0300 Subject: [PATCH 2/2] copy() must copy srictBounds check --- .../cache/persistence/wal/reader/IgniteWalIteratorFactory.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java index 1cc41c64954a6..c9912a432988a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/reader/IgniteWalIteratorFactory.java @@ -571,7 +571,8 @@ public IteratorParametersBuilder copy() { .marshallerMappingFileStoreDir(marshallerMappingFileStoreDir) .from(lowBound) .to(highBound) - .filter(filter); + .filter(filter) + .strictBoundsCheck(strictBoundsCheck); } /**