This is an automated email from the ASF dual-hosted git repository. nizhikov pushed a commit to branch IGNITE-19950-snapshot-merge in repository https://gitbox.apache.org/repos/asf/ignite.git
commit 9ba028036dfe59ee4dd07f8a58f2f04945db9603 Author: nizhikov <nizhi...@apache.org> AuthorDate: Thu Jul 27 14:31:17 2023 +0300 IGNITE-19950 WIP --- .../org/apache/ignite/internal/IgniteKernal.java | 2 +- .../snapshot/IgniteSnapshotManager.java | 16 ++++--- .../IgniteClusterInMemorySnapshotSelfTest.java | 53 ---------------------- 3 files changed, 11 insertions(+), 60 deletions(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java index 403022aa8b7..e61a1a8772f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java @@ -1091,7 +1091,7 @@ public class IgniteKernal implements IgniteEx, Externalizable { startProcessor(new GridTaskSessionProcessor(ctx)); startProcessor(new GridJobProcessor(ctx)); startProcessor(new GridTaskProcessor(ctx)); - startProcessor(SCHEDULE.createOptional(ctx)); + startProcessor((GridProcessor)SCHEDULE.createOptional(ctx)); startProcessor(createComponent(IgniteRestProcessor.class, ctx)); startProcessor(new DataStreamProcessor(ctx)); startProcessor(new GridContinuousProcessor(ctx)); diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java index d54be4b5a35..f7dbf5a19a8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java @@ -296,9 +296,6 @@ public class IgniteSnapshotManager extends GridCacheSharedManagerAdapter /** Snapshot metafile extension. */ public static final String SNAPSHOT_METAFILE_EXT = ".smf"; - /** Dump metafile extension. */ - public static final String DUMP_METAFILE_EXT = ".dmf"; - /** Snapshot temporary metafile extension. */ public static final String SNAPSHOT_METAFILE_TMP_EXT = ".tmp"; @@ -369,6 +366,9 @@ public class IgniteSnapshotManager extends GridCacheSharedManagerAdapter /** Lock file for dump directory. */ public static final String DUMP_LOCK = "dump.lock"; + /** Dump metafile extension. */ + public static final String DUMP_METAFILE_EXT = ".dmf"; + /** * Local buffer to perform copy-on-write operations with pages for {@code SnapshotFutureTask.PageStoreSerialWriter}s. * It is important to have only one buffer per thread (instead of creating each buffer per @@ -548,7 +548,7 @@ public class IgniteSnapshotManager extends GridCacheSharedManagerAdapter tmpWorkDir = U.resolveWorkDirectory(pdsSettings.persistentStoreNodePath().getAbsolutePath(), DFLT_SNAPSHOT_TMP_DIR, true); U.ensureDirectory(locSnpDir, "snapshot work directory", log); - U.ensureDirectory(locDumpDir, "snapshot work directory", log); + U.ensureDirectory(locDumpDir, "dump work directory", log); U.ensureDirectory(tmpWorkDir, "temp directory for snapshot creation", log); ctx.internalSubscriptionProcessor().registerDistributedConfigurationListener( @@ -1211,7 +1211,7 @@ public class IgniteSnapshotManager extends GridCacheSharedManagerAdapter File smf = new File(snpDir, snapshotMetaFileName(cctx.localNode().consistentId().toString())); - storeSnapshotMeta(meta, smf); + storeSnapshotMeta(req.meta(), smf); log.info("Snapshot metafile has been created: " + smf.getAbsolutePath()); @@ -1468,7 +1468,7 @@ public class IgniteSnapshotManager extends GridCacheSharedManagerAdapter if (!isLocalNodeCoordinator(cctx.discovery())) snpReq.warnings(req.warnings()); - snpReq.<SnapshotMetadata>meta().warnings(Collections.unmodifiableList(req.warnings())); + snpReq.meta().warnings(Collections.unmodifiableList(req.warnings())); storeWarnings(snpReq); } @@ -4700,6 +4700,10 @@ public class IgniteSnapshotManager extends GridCacheSharedManagerAdapter /** * @param snpName Snapshot name. + * @param incremental If {@code true} then incremental snapshot must be created. + * @param onlyPrimary If {@code true} then only copy of primary partitions will be created. + * @param dump If {@code true} then cache dump must be created. + * @param cacheGroupNames Cache group names to include in dump. */ public CreateSnapshotCallable( String snpName, diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterInMemorySnapshotSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterInMemorySnapshotSelfTest.java deleted file mode 100644 index 5b001bb7891..00000000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterInMemorySnapshotSelfTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.snapshot; - -import java.util.stream.IntStream; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.configuration.DataRegionConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.internal.IgniteEx; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; -import org.junit.Test; - -import static org.apache.ignite.cluster.ClusterState.ACTIVE; - -/** */ -public class IgniteClusterInMemorySnapshotSelfTest extends GridCommonAbstractTest { - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - return super.getConfiguration(igniteInstanceName) - .setDataStorageConfiguration(new DataStorageConfiguration() - .setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true))); - } - - /** */ - @Test - public void testInMemorySnapshot() throws Exception { - try (IgniteEx ignite = startGrid(0)) { - ignite.cluster().state(ACTIVE); - - IgniteCache<Integer, Integer> cache = ignite.createCache(DEFAULT_CACHE_NAME); - - IntStream.range(0, 100).forEach(i -> cache.put(i, i)); - - ignite.snapshot().createSnapshot("snp").get(); - } - } -}