Repository: ignite Updated Branches: refs/heads/ignite-2.7 9d6e6ff39 -> 3355201f3
IGNITE-9760 Fixed NPE in WAL manager for FSYNC mode - Fixes #4888. Signed-off-by: Alexey Goncharuk <alexey.goncha...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3355201f Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3355201f Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3355201f Branch: refs/heads/ignite-2.7 Commit: 3355201f3e8cafd23b2250aaccccf3b91b8b8ed1 Parents: 9d6e6ff Author: Anton Kalashnikov <kaa....@yandex.ru> Authored: Tue Oct 2 19:07:36 2018 +0300 Committer: Alexey Goncharuk <alexey.goncha...@gmail.com> Committed: Tue Oct 2 19:08:55 2018 +0300 ---------------------------------------------------------------------- .../wal/FsyncModeFileWriteAheadLogManager.java | 7 +++-- .../wal/WalRolloverRecordLoggingFsyncTest.java | 32 ++++++++++++++++++++ .../WalRolloverRecordLoggingLogOnlyTest.java | 32 ++++++++++++++++++++ .../db/wal/WalRolloverRecordLoggingTest.java | 16 ++++++---- .../IgnitePdsWithIndexingCoreTestSuite.java | 6 ++-- 5 files changed, 83 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/3355201f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java index df8f4de..af76647 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FsyncModeFileWriteAheadLogManager.java @@ -2331,19 +2331,22 @@ public class FsyncModeFileWriteAheadLogManager extends GridCacheSharedManagerAda private abstract static class FileHandle { /** I/O interface for read/write operations with file */ protected SegmentIO fileIO; + /** Segment idx corresponded to fileIo*/ + final long segmentIdx; /** * @param fileIO I/O interface for read/write operations of FileHandle. */ - private FileHandle(SegmentIO fileIO) { + private FileHandle(@NotNull SegmentIO fileIO) { this.fileIO = fileIO; + this.segmentIdx = fileIO.getSegmentId(); } /** * @return Current segment id. */ public long getSegmentId(){ - return fileIO.getSegmentId(); + return segmentIdx; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/3355201f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingFsyncTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingFsyncTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingFsyncTest.java new file mode 100644 index 0000000..7454e5f --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingFsyncTest.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.persistence.db.wal; + +import org.apache.ignite.configuration.WALMode; +import org.jetbrains.annotations.NotNull; + +/** + * + */ +public class WalRolloverRecordLoggingFsyncTest extends WalRolloverRecordLoggingTest { + + /** {@inheritDoc} */ + @NotNull @Override public WALMode walMode() { + return WALMode.FSYNC; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/3355201f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingLogOnlyTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingLogOnlyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingLogOnlyTest.java new file mode 100644 index 0000000..765fdeb --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingLogOnlyTest.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.persistence.db.wal; + +import org.apache.ignite.configuration.WALMode; +import org.jetbrains.annotations.NotNull; + +/** + * + */ +public class WalRolloverRecordLoggingLogOnlyTest extends WalRolloverRecordLoggingTest { + + /** {@inheritDoc} */ + @NotNull @Override public WALMode walMode() { + return WALMode.LOG_ONLY; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/3355201f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingTest.java index 67caf63..395b03a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/WalRolloverRecordLoggingTest.java @@ -23,6 +23,7 @@ import org.apache.ignite.IgniteCheckedException; 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.StopNodeOrHaltFailureHandler; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgniteInternalFuture; @@ -36,13 +37,11 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; - -import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH; -import static org.apache.ignite.configuration.WALMode.LOG_ONLY; +import org.jetbrains.annotations.NotNull; /** * */ -public class WalRolloverRecordLoggingTest extends GridCommonAbstractTest { +public abstract class WalRolloverRecordLoggingTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -69,15 +68,20 @@ public class WalRolloverRecordLoggingTest extends GridCommonAbstractTest { .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setPersistenceEnabled(true) .setMaxSize(40 * 1024 * 1024)) - .setWalMode(LOG_ONLY) + .setWalMode(walMode()) .setWalSegmentSize(4 * 1024 * 1024) - .setWalArchivePath(DFLT_WAL_PATH)); + ); cfg.setFailureHandler(new StopNodeOrHaltFailureHandler(false, 0)); return cfg; } + /** + * @return Wal mode. + */ + @NotNull public abstract WALMode walMode(); + /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { stopAllGrids(); http://git-wip-us.apache.org/repos/asf/ignite/blob/3355201f/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java index caea388..e9159bf 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java +++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePdsWithIndexingCoreTestSuite.java @@ -40,7 +40,8 @@ import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalR import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalRecoveryWithCompactionTest; import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalPathsTest; import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalRecoveryTxLogicalRecordsTest; -import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalRolloverRecordLoggingTest; +import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalRolloverRecordLoggingFsyncTest; +import org.apache.ignite.internal.processors.cache.persistence.db.wal.WalRolloverRecordLoggingLogOnlyTest; /** * Test suite for tests that cover core PDS features and depend on indexing module. @@ -60,7 +61,8 @@ public class IgnitePdsWithIndexingCoreTestSuite extends TestSuite { suite.addTestSuite(PersistenceDirectoryWarningLoggingTest.class); suite.addTestSuite(WalPathsTest.class); suite.addTestSuite(WalRecoveryTxLogicalRecordsTest.class); - suite.addTestSuite(WalRolloverRecordLoggingTest.class); + suite.addTestSuite(WalRolloverRecordLoggingFsyncTest.class); + suite.addTestSuite(WalRolloverRecordLoggingLogOnlyTest.class); suite.addTestSuite(IgniteWalRecoveryTest.class); suite.addTestSuite(IgniteWalRecoveryWithCompactionTest.class);