This is an automated email from the ASF dual-hosted git repository.
sanpwc pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new d8637e13ae IGNITE-22771 Create new System configuration root (#4119)
d8637e13ae is described below
commit d8637e13ae6c0e03ee3825bc56769435627d6653
Author: Cyrill <[email protected]>
AuthorDate: Mon Aug 5 21:48:42 2024 +0300
IGNITE-22771 Create new System configuration root (#4119)
---
.../repl/executor/ItIgnitePicocliCommandsTest.java | 3 +-
.../org/apache/ignite/internal/util/LazyPath.java | 80 ++++++++++++++++
modules/metastorage/build.gradle | 1 +
.../server/raft/ItMetaStorageRaftGroupTest.java | 10 +-
modules/partition-replicator/build.gradle | 1 +
.../replicator/ItReplicaLifecycleTest.java | 17 +++-
.../configuration/RaftConfigurationSchema.java | 4 -
modules/raft/build.gradle | 3 +
.../raft/server/ItJraftServerLogPathTest.java | 41 +++++---
.../raft/server/ItSimpleCounterServerTest.java | 2 +-
.../ignite/raft/server/RaftServerAbstractTest.java | 6 +-
.../java/org/apache/ignite/internal/raft/Loza.java | 8 +-
.../internal/raft/server/impl/JraftServerImpl.java | 7 +-
.../storage/impl/DefaultLogStorageFactory.java | 14 +--
.../raft/storage/logit/LogitLogStorageFactory.java | 14 +--
.../raft/util/SharedLogStorageFactoryUtils.java | 30 ++----
.../jraft/storage/impl/LogStorageBenchmark.java | 3 +-
.../jraft/storage/logit/LogitLogStorageTest.java | 3 +-
.../ignite/internal/raft/TestLozaFactory.java | 15 ++-
.../raft/server/TestJraftServerFactory.java | 44 ++++++---
.../service/ItAbstractListenerSnapshotTest.java | 6 +-
modules/replicator/build.gradle | 2 +
.../AbstractTopologyAwareGroupServiceTest.java | 6 +-
.../inmemory/ItRaftStorageVolatilityTest.java | 4 +-
.../runner/app/ItIgniteNodeRestartTest.java | 18 +++-
.../org/apache/ignite/internal/app/IgniteImpl.java | 85 +++++------------
.../configuration/ComponentWorkingDir.java | 81 ++++++++++++++++
.../ignite/internal/configuration/IgnitePaths.java | 105 +++++++++++++++++++++
.../SystemLocalConfigurationModule.java | 42 +++++++++
.../SystemLocalConfigurationSchema.java | 46 +++++++++
.../ignite/internal/storage/DataStorageModule.java | 4 +-
.../internal/storage/DataStorageModules.java | 4 +-
.../internal/storage/DataStorageModulesTest.java | 3 +-
.../storage/impl/TestDataStorageModule.java | 4 +-
.../PersistentPageMemoryDataStorageModule.java | 4 +-
.../PersistentPageMemoryStorageEngine.java | 8 +-
.../VolatilePageMemoryDataStorageModule.java | 4 +-
.../PersistentPageMemoryMvTableStorageTest.java | 3 +-
.../PersistentPageMemoryStorageEngineTest.java | 3 +-
.../PersistentPageMemoryHashIndexStorageTest.java | 3 +-
...PersistentPageMemorySortedIndexStorageTest.java | 3 +-
...ageMemoryMvPartitionStorageConcurrencyTest.java | 3 +-
...rsistentPageMemoryMvPartitionStorageGcTest.java | 3 +-
...PersistentPageMemoryMvPartitionStorageTest.java | 3 +-
.../storage/rocksdb/RocksDbDataStorageModule.java | 4 +-
.../storage/rocksdb/RocksDbStorageEngine.java | 7 +-
.../RocksDbMvPartitionStorageConcurrencyTest.java | 3 +-
.../rocksdb/RocksDbMvPartitionStorageGcTest.java | 3 +-
.../rocksdb/RocksDbMvPartitionStorageTest.java | 3 +-
.../storage/rocksdb/RocksDbMvTableStorageTest.java | 3 +-
.../rocksdb/engine/RocksDbStorageEngineTest.java | 3 +-
.../rocksdb/index/RocksDbHashIndexStorageTest.java | 3 +-
.../index/RocksDbSortedIndexStorageTest.java | 3 +-
.../instance/SharedRocksDbInstanceTest.java | 3 +-
.../rebalance/ItRebalanceDistributedTest.java | 17 +++-
.../internal/table/distributed/TableManager.java | 6 +-
.../distributed/TableManagerRecoveryTest.java | 13 ++-
.../table/distributed/TableManagerTest.java | 10 +-
.../PersistentPageMemoryGcUpdateHandlerTest.java | 3 +-
.../distributed/gc/RocksDbGcUpdateHandlerTest.java | 9 +-
.../state/rocksdb/TxStateRocksDbSharedStorage.java | 11 ++-
.../state/rocksdb/RocksDbTxStateStorageTest.java | 4 +-
.../vault/persistence/PersistentVaultService.java | 6 +-
63 files changed, 648 insertions(+), 219 deletions(-)
diff --git
a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java
b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java
index 99fa4560a1..5ba08769b1 100644
---
a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java
+++
b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java
@@ -277,7 +277,8 @@ public class ItIgnitePicocliCommandsTest extends
CliIntegrationTest {
"storage",
"criticalWorkers",
"sql",
- "failureHandler"
+ "failureHandler",
+ "system"
)
);
}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/util/LazyPath.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/LazyPath.java
new file mode 100644
index 0000000000..63ee1624ba
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/LazyPath.java
@@ -0,0 +1,80 @@
+/*
+ * 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.util;
+
+import java.nio.file.Path;
+import java.util.function.Supplier;
+
+/**
+ * A {@link Lazy} for {@link Path}.
+ *
+ * <p>Use this class to defer initialization of {@link Path} until it is
needed.
+ */
+public class LazyPath extends Lazy<Path> {
+
+ private LazyPath(Supplier<Path> supplier) {
+ super(supplier);
+ }
+
+ /**
+ * Create a new instance for a path.
+ *
+ * @param defaultPath Path.
+ */
+ public static LazyPath create(Path defaultPath) {
+ return new LazyPath(() -> defaultPath);
+ }
+
+ /**
+ * Create a new instance from {@code pathSupplier} if it returns a
nonempty value, otherwise use {@code defaultPathSupplier}.
+ *
+ * @param pathSupplier Path supplier.
+ * @param defaultPathSupplier Default path supplier.
+ */
+ public static LazyPath create(Supplier<String> pathSupplier,
Supplier<Path> defaultPathSupplier) {
+ return new LazyPath(() -> pathOrDefault(pathSupplier.get(),
defaultPathSupplier));
+ }
+
+ /**
+ * Resolve the other path against this one.
+ */
+ public LazyPath resolveLazy(Path other) {
+ return new LazyPath(() -> get().resolve(other));
+ }
+
+ /**
+ * Resolve the other path against this one.
+ */
+ public LazyPath resolveLazy(String other) {
+ return new LazyPath(() -> get().resolve(other));
+ }
+
+ @Override
+ public Path get() {
+ return super.get();
+ }
+
+ private static Path pathOrDefault(String value, Supplier<Path>
defaultPathSupplier) {
+ return value.isEmpty() ? defaultPathSupplier.get() : Path.of(value);
+ }
+
+ @Override
+ public String toString() {
+ return get().toString();
+ }
+}
diff --git a/modules/metastorage/build.gradle b/modules/metastorage/build.gradle
index c6900a8721..8e8b77728e 100644
--- a/modules/metastorage/build.gradle
+++ b/modules/metastorage/build.gradle
@@ -61,6 +61,7 @@ dependencies {
integrationTestImplementation project(":ignite-vault")
integrationTestImplementation project(":ignite-security")
integrationTestImplementation project(':ignite-metrics')
+ integrationTestImplementation project(':ignite-runner')
integrationTestImplementation testFixtures(project(':ignite-core'))
integrationTestImplementation testFixtures(project(':ignite-network'))
integrationTestImplementation testFixtures(project(':ignite-raft'))
diff --git
a/modules/metastorage/src/integrationTest/java/org/apache/ignite/internal/metastorage/server/raft/ItMetaStorageRaftGroupTest.java
b/modules/metastorage/src/integrationTest/java/org/apache/ignite/internal/metastorage/server/raft/ItMetaStorageRaftGroupTest.java
index e1ce03451d..375f708164 100644
---
a/modules/metastorage/src/integrationTest/java/org/apache/ignite/internal/metastorage/server/raft/ItMetaStorageRaftGroupTest.java
+++
b/modules/metastorage/src/integrationTest/java/org/apache/ignite/internal/metastorage/server/raft/ItMetaStorageRaftGroupTest.java
@@ -43,6 +43,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
+import org.apache.ignite.internal.configuration.SystemLocalConfiguration;
import
org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
import
org.apache.ignite.internal.configuration.testframework.InjectConfiguration;
import org.apache.ignite.internal.lang.ByteArray;
@@ -155,6 +156,9 @@ public class ItMetaStorageRaftGroupTest extends
IgniteAbstractTest {
@InjectConfiguration
private RaftConfiguration raftConfiguration;
+ @InjectConfiguration
+ private SystemLocalConfiguration systemConfiguration;
+
/**
* Run {@code NODES} cluster nodes.
*/
@@ -380,7 +384,7 @@ public class ItMetaStorageRaftGroupTest extends
IgniteAbstractTest {
metaStorageRaftSrv1 = TestJraftServerFactory.create(
cluster.get(0),
workDir.resolve("node1"),
- raftConfiguration,
+ systemConfiguration,
opt1,
new RaftGroupEventsClientListener()
);
@@ -388,7 +392,7 @@ public class ItMetaStorageRaftGroupTest extends
IgniteAbstractTest {
metaStorageRaftSrv2 = TestJraftServerFactory.create(
cluster.get(1),
workDir.resolve("node2"),
- raftConfiguration,
+ systemConfiguration,
opt2,
new RaftGroupEventsClientListener()
);
@@ -396,7 +400,7 @@ public class ItMetaStorageRaftGroupTest extends
IgniteAbstractTest {
metaStorageRaftSrv3 = TestJraftServerFactory.create(
cluster.get(2),
workDir.resolve("node3"),
- raftConfiguration,
+ systemConfiguration,
opt3,
new RaftGroupEventsClientListener()
);
diff --git a/modules/partition-replicator/build.gradle
b/modules/partition-replicator/build.gradle
index b6b52014b8..67632b6ee1 100644
--- a/modules/partition-replicator/build.gradle
+++ b/modules/partition-replicator/build.gradle
@@ -74,6 +74,7 @@ dependencies {
integrationTestImplementation project(':ignite-page-memory')
integrationTestImplementation project(':ignite-placement-driver')
integrationTestImplementation project(':ignite-affinity')
+ integrationTestImplementation project(':ignite-runner')
}
description = 'ignite-partition-replicator'
diff --git
a/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java
b/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java
index 40e4ebbe97..e9e8b15460 100644
---
a/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java
+++
b/modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItReplicaLifecycleTest.java
@@ -24,6 +24,7 @@ import static
org.apache.ignite.internal.BaseIgniteRestartTest.createVault;
import static
org.apache.ignite.internal.TestDefaultProfilesNames.DEFAULT_TEST_PROFILE_NAME;
import static
org.apache.ignite.internal.catalog.CatalogService.DEFAULT_STORAGE_PROFILE;
import static
org.apache.ignite.internal.catalog.commands.CatalogUtils.defaultZoneIdOpt;
+import static
org.apache.ignite.internal.configuration.IgnitePaths.partitionsPath;
import static
org.apache.ignite.internal.distributionzones.DistributionZonesTestUtil.alterZone;
import static
org.apache.ignite.internal.distributionzones.DistributionZonesTestUtil.assertValueInStorage;
import static
org.apache.ignite.internal.distributionzones.rebalance.RebalanceUtil.REBALANCE_SCHEDULER_POOL_SIZE;
@@ -86,9 +87,11 @@ import
org.apache.ignite.internal.cluster.management.topology.LogicalTopologyImp
import
org.apache.ignite.internal.cluster.management.topology.LogicalTopologyServiceImpl;
import
org.apache.ignite.internal.cluster.management.topology.api.LogicalTopologySnapshot;
import org.apache.ignite.internal.components.LogSyncer;
+import org.apache.ignite.internal.configuration.ComponentWorkingDir;
import org.apache.ignite.internal.configuration.ConfigurationManager;
import org.apache.ignite.internal.configuration.ConfigurationRegistry;
import org.apache.ignite.internal.configuration.ConfigurationTreeGenerator;
+import org.apache.ignite.internal.configuration.SystemLocalConfiguration;
import
org.apache.ignite.internal.configuration.storage.DistributedConfigurationStorage;
import
org.apache.ignite.internal.configuration.storage.LocalFileConfigurationStorage;
import
org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
@@ -176,6 +179,7 @@ import org.apache.ignite.internal.tx.impl.TxManagerImpl;
import org.apache.ignite.internal.tx.message.TxMessageGroup;
import org.apache.ignite.internal.tx.message.WriteIntentSwitchReplicaRequest;
import org.apache.ignite.internal.tx.test.TestLocalRwTxCounter;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.internal.vault.VaultManager;
import org.apache.ignite.network.ClusterNode;
import org.apache.ignite.network.NetworkAddress;
@@ -215,6 +219,9 @@ public class ItReplicaLifecycleTest extends
BaseIgniteAbstractTest {
@InjectConfiguration
private static RaftConfiguration raftConfiguration;
+ @InjectConfiguration
+ private static SystemLocalConfiguration systemConfiguration;
+
@InjectConfiguration
private static ClusterManagementConfiguration
clusterManagementConfiguration;
@@ -910,13 +917,15 @@ public class ItReplicaLifecycleTest extends
BaseIgniteAbstractTest {
var raftGroupEventsClientListener = new
RaftGroupEventsClientListener();
- logStorageFactory =
SharedLogStorageFactoryUtils.create(clusterService.nodeName(), dir,
raftConfiguration);
+ ComponentWorkingDir partitionsWorkDir =
partitionsPath(systemConfiguration, dir);
+
+ logStorageFactory =
SharedLogStorageFactoryUtils.create(clusterService.nodeName(),
partitionsWorkDir.raftLogPath());
raftManager = new Loza(
clusterService,
new NoOpMetricManager(),
raftConfiguration,
- dir,
+ partitionsWorkDir.metaPath(),
hybridClock,
raftGroupEventsClientListener,
logStorageFactory
@@ -1043,7 +1052,7 @@ public class ItReplicaLifecycleTest extends
BaseIgniteAbstractTest {
dataStorageModules.createStorageEngines(
name,
nodeCfgMgr.configurationRegistry(),
- dir.resolve("storage"),
+ LazyPath.create(dir.resolve("storage")),
null,
failureProcessor,
logSyncer,
@@ -1152,7 +1161,7 @@ public class ItReplicaLifecycleTest extends
BaseIgniteAbstractTest {
replicaSvc,
txManager,
dataStorageMgr,
- storagePath,
+ LazyPath.create(storagePath),
metaStorageManager,
schemaManager,
threadPoolsManager.tableIoExecutor(),
diff --git
a/modules/raft-api/src/main/java/org/apache/ignite/internal/raft/configuration/RaftConfigurationSchema.java
b/modules/raft-api/src/main/java/org/apache/ignite/internal/raft/configuration/RaftConfigurationSchema.java
index 4a699daf00..5b7191b236 100644
---
a/modules/raft-api/src/main/java/org/apache/ignite/internal/raft/configuration/RaftConfigurationSchema.java
+++
b/modules/raft-api/src/main/java/org/apache/ignite/internal/raft/configuration/RaftConfigurationSchema.java
@@ -83,8 +83,4 @@ public class RaftConfigurationSchema {
*/
@Value(hasDefault = true)
public boolean logYieldStrategy = false;
-
- /** Directory where log is stored. By default "log" subfolder of data
storage path is used. */
- @Value(hasDefault = true)
- public String logPath = "";
}
diff --git a/modules/raft/build.gradle b/modules/raft/build.gradle
index 8f3c2fcbad..c1451d9d45 100644
--- a/modules/raft/build.gradle
+++ b/modules/raft/build.gradle
@@ -75,6 +75,8 @@ dependencies {
testFixturesImplementation project(':ignite-core')
testFixturesImplementation project(':ignite-network')
testFixturesImplementation project(':ignite-raft-api')
+ // TODO https://issues.apache.org/jira/browse/IGNITE-22564 runner should
not be in test fixtures
+ testFixturesImplementation project(':ignite-runner')
testFixturesImplementation(testFixtures(project(':ignite-configuration')))
testFixturesImplementation(testFixtures(project(':ignite-core')))
testFixturesImplementation(testFixtures(project(':ignite-metrics')))
@@ -96,6 +98,7 @@ dependencies {
integrationTestImplementation testFixtures(project(':ignite-raft'))
integrationTestImplementation project(':ignite-raft-api')
integrationTestImplementation project(':ignite-failure-handler')
+ integrationTestImplementation project(':ignite-runner')
integrationTestImplementation libs.jetbrains.annotations
integrationTestImplementation libs.dropwizard.metrics
integrationTestImplementation libs.disruptor
diff --git
a/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItJraftServerLogPathTest.java
b/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItJraftServerLogPathTest.java
index 60015efcf7..fcf452d040 100644
---
a/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItJraftServerLogPathTest.java
+++
b/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItJraftServerLogPathTest.java
@@ -26,9 +26,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
+import org.apache.ignite.internal.configuration.SystemLocalConfiguration;
import org.apache.ignite.internal.manager.ComponentContext;
import org.apache.ignite.internal.network.ClusterService;
-import org.apache.ignite.internal.raft.configuration.RaftConfiguration;
import org.apache.ignite.internal.raft.server.TestJraftServerFactory;
import org.apache.ignite.internal.raft.server.impl.JraftServerImpl;
import org.apache.ignite.internal.raft.storage.logit.LogitLogStorageFactory;
@@ -56,47 +56,58 @@ class ItJraftServerLogPathTest extends
RaftServerAbstractTest {
assertThat(server.stopAsync(new ComponentContext()),
willCompleteSuccessfully());
}
+ @Test
+ @WithSystemProperty(key =
SharedLogStorageFactoryUtils.LOGIT_STORAGE_ENABLED_PROPERTY, value = "false")
+ void testCustomLogPath() {
+ Path partitionsLogPath = workDir.resolve("partitions_log");
+
assertThat(systemConfiguration.partitionsLogPath().update(partitionsLogPath.toString()),
willCompleteSuccessfully());
+
+ server = startServer(systemConfiguration);
+
+ assertTrue(Files.exists(partitionsLogPath));
+ }
+
@Test
@WithSystemProperty(key =
SharedLogStorageFactoryUtils.LOGIT_STORAGE_ENABLED_PROPERTY, value = "false")
void testDefaultFactory() {
- Path logPath = workDir.resolve("db/log");
- assertThat(raftConfiguration.logPath().update(logPath.toString()),
willCompleteSuccessfully());
+ Path partitionsPath = workDir.resolve("custom_partitions");
+
assertThat(systemConfiguration.partitionsBasePath().update(partitionsPath.toString()),
willCompleteSuccessfully());
- server = startServer(raftConfiguration);
+ server = startServer(systemConfiguration);
- assertTrue(Files.exists(logPath));
+ assertTrue(Files.exists(partitionsPath));
}
@Test
@WithSystemProperty(key =
SharedLogStorageFactoryUtils.LOGIT_STORAGE_ENABLED_PROPERTY, value = "true")
void testLogitFactory() {
- Path logPath = workDir.resolve("db/log");
- assertThat(raftConfiguration.logPath().update(logPath.toString()),
willCompleteSuccessfully());
+ Path partitionsPath = workDir.resolve("custom_partitions");
+
assertThat(systemConfiguration.partitionsBasePath().update(partitionsPath.toString()),
willCompleteSuccessfully());
- server = startServer(raftConfiguration);
+ server = startServer(systemConfiguration);
LogitLogStorageFactory factory = (LogitLogStorageFactory)
server.getLogStorageFactory();
- assertEquals(logPath.resolve("log-1"),
factory.resolveLogStoragePath("1"));
+ assertEquals(partitionsPath.resolve("log").resolve("log-1"),
factory.resolveLogStoragePath("1"));
}
@Test
@WithSystemProperty(key =
SharedLogStorageFactoryUtils.LOGIT_STORAGE_ENABLED_PROPERTY, value = "false")
void testDefaultLogPathDefaultFactory() {
- server = startServer(raftConfiguration);
+ server = startServer(systemConfiguration);
- assertTrue(Files.exists(dataPath.resolve("log")));
+ assertTrue(Files.exists(dataPath.resolve("partitions/log")));
}
@Test
@WithSystemProperty(key =
SharedLogStorageFactoryUtils.LOGIT_STORAGE_ENABLED_PROPERTY, value = "true")
void testDefaultLogPathLogitFactory() {
- server = startServer(raftConfiguration);
+ server = startServer(systemConfiguration);
LogitLogStorageFactory factory = (LogitLogStorageFactory)
server.getLogStorageFactory();
- assertEquals(dataPath.resolve("log/log-1"),
factory.resolveLogStoragePath("1"));
+ assertEquals(dataPath.resolve("partitions/log/log-1"),
factory.resolveLogStoragePath("1"));
}
- private JraftServerImpl startServer(RaftConfiguration raftConfiguration) {
+ private JraftServerImpl startServer(SystemLocalConfiguration
systemConfiguration) {
var addr = new NetworkAddress(getLocalAddress(), PORT);
ClusterService service = clusterService(PORT, List.of(addr), true);
@@ -104,7 +115,7 @@ class ItJraftServerLogPathTest extends
RaftServerAbstractTest {
JraftServerImpl server = TestJraftServerFactory.create(
service,
dataPath,
- raftConfiguration,
+ systemConfiguration,
new NodeOptions(),
new RaftGroupEventsClientListener()
);
diff --git
a/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItSimpleCounterServerTest.java
b/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItSimpleCounterServerTest.java
index 52ea438d4c..221009ced8 100644
---
a/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItSimpleCounterServerTest.java
+++
b/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItSimpleCounterServerTest.java
@@ -102,7 +102,7 @@ class ItSimpleCounterServerTest extends
RaftServerAbstractTest {
service = clusterService(PORT, List.of(addr), true);
- server = TestJraftServerFactory.create(service, workDir,
raftConfiguration);
+ server = TestJraftServerFactory.create(service, workDir,
systemConfiguration);
assertThat(server.startAsync(new ComponentContext()),
willCompleteSuccessfully());
diff --git
a/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/RaftServerAbstractTest.java
b/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/RaftServerAbstractTest.java
index 0abd7e4327..8cb2dc575d 100644
---
a/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/RaftServerAbstractTest.java
+++
b/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/RaftServerAbstractTest.java
@@ -24,6 +24,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
+import org.apache.ignite.internal.configuration.SystemLocalConfiguration;
import
org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
import
org.apache.ignite.internal.configuration.testframework.InjectConfiguration;
import org.apache.ignite.internal.manager.ComponentContext;
@@ -58,6 +59,9 @@ abstract class RaftServerAbstractTest extends
IgniteAbstractTest {
@InjectConfiguration
protected RaftConfiguration raftConfiguration;
+ @InjectConfiguration
+ protected SystemLocalConfiguration systemConfiguration;
+
/** Test info. */
TestInfo testInfo;
@@ -98,6 +102,6 @@ abstract class RaftServerAbstractTest extends
IgniteAbstractTest {
protected JraftServerImpl jraftServer(int idx, ClusterService service,
NodeOptions opts) {
Path dataPath = workDir.resolve("node" + idx);
- return TestJraftServerFactory.create(service, dataPath,
raftConfiguration, opts);
+ return TestJraftServerFactory.create(service, dataPath,
systemConfiguration, opts);
}
}
diff --git
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/Loza.java
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/Loza.java
index 09e718f582..0543969734 100644
--- a/modules/raft/src/main/java/org/apache/ignite/internal/raft/Loza.java
+++ b/modules/raft/src/main/java/org/apache/ignite/internal/raft/Loza.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.raft;
import static java.util.Objects.requireNonNullElse;
import static
org.apache.ignite.internal.util.CompletableFutures.nullCompletedFuture;
-import java.nio.file.Path;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ScheduledExecutorService;
@@ -54,6 +53,7 @@ import
org.apache.ignite.internal.replicator.ReplicationGroupId;
import org.apache.ignite.internal.thread.NamedThreadFactory;
import org.apache.ignite.internal.util.IgniteSpinBusyLock;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.raft.jraft.RaftMessagesFactory;
import org.apache.ignite.raft.jraft.option.NodeOptions;
import org.apache.ignite.raft.jraft.rpc.impl.ActionRequestInterceptor;
@@ -117,7 +117,7 @@ public class Loza implements RaftManager {
ClusterService clusterNetSvc,
MetricManager metricManager,
RaftConfiguration raftConfiguration,
- Path dataPath,
+ LazyPath dataPath,
HybridClock clock,
RaftGroupEventsClientListener raftGroupEventsClientListener,
LogStorageFactory defaultLogStorageFactory
@@ -143,7 +143,7 @@ public class Loza implements RaftManager {
/**
* Sets {@link AppendEntriesRequestInterceptor} to use. Should only be
called from the same thread that is used
- * to {@link #startAsync()} the component.
+ * to {@link #startAsync(ComponentContext)} the component.
*
* @param appendEntriesRequestInterceptor Interceptor to use.
*/
@@ -153,7 +153,7 @@ public class Loza implements RaftManager {
/**
* Sets {@link ActionRequestInterceptor} to use. Should only be called
from the same thread that is used
- * to {@link #startAsync()} the component.
+ * to {@link #startAsync(ComponentContext)} the component.
*
* @param actionRequestInterceptor Interceptor to use.
*/
diff --git
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/server/impl/JraftServerImpl.java
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/server/impl/JraftServerImpl.java
index 2c0ee7a116..5256a6653b 100644
---
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/server/impl/JraftServerImpl.java
+++
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/server/impl/JraftServerImpl.java
@@ -65,6 +65,7 @@ import
org.apache.ignite.internal.raft.storage.impl.IgniteJraftServiceFactory;
import
org.apache.ignite.internal.raft.storage.impl.StripeAwareLogManager.Stripe;
import org.apache.ignite.internal.replicator.ReplicationGroupId;
import org.apache.ignite.internal.thread.IgniteThreadFactory;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.raft.jraft.Closure;
import org.apache.ignite.raft.jraft.Iterator;
import org.apache.ignite.raft.jraft.JRaftUtils;
@@ -107,7 +108,7 @@ public class JraftServerImpl implements RaftServer {
private final ClusterService service;
/** Data path. */
- private final Path dataPath;
+ private final LazyPath dataPath;
/** Log storage provider. */
private final LogStorageFactory logStorageFactory;
@@ -155,7 +156,7 @@ public class JraftServerImpl implements RaftServer {
*/
public JraftServerImpl(
ClusterService service,
- Path dataPath,
+ LazyPath dataPath,
NodeOptions opts,
RaftGroupEventsClientListener raftGroupEventsClientListener,
LogStorageFactory logStorageFactory
@@ -415,7 +416,7 @@ public class JraftServerImpl implements RaftServer {
* @return The path to persistence folder.
*/
public Path getServerDataPath(RaftNodeId nodeId) {
- return this.dataPath.resolve(nodeIdStr(nodeId));
+ return this.dataPath.get().resolve(nodeIdStr(nodeId));
}
private static String nodeIdStr(RaftNodeId nodeId) {
diff --git
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java
index bee66827d9..e94a7e207f 100644
---
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java
+++
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/DefaultLogStorageFactory.java
@@ -30,13 +30,13 @@ import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.function.Supplier;
import org.apache.ignite.internal.logger.IgniteLogger;
import org.apache.ignite.internal.logger.Loggers;
import org.apache.ignite.internal.manager.ComponentContext;
import org.apache.ignite.internal.raft.storage.LogStorageFactory;
import org.apache.ignite.internal.rocksdb.RocksUtils;
import org.apache.ignite.internal.thread.NamedThreadFactory;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.raft.jraft.option.RaftOptions;
import org.apache.ignite.raft.jraft.storage.LogStorage;
import org.apache.ignite.raft.jraft.util.ExecutorServiceHelper;
@@ -62,7 +62,7 @@ public class DefaultLogStorageFactory implements
LogStorageFactory {
private static final IgniteLogger LOG =
Loggers.forClass(DefaultLogStorageFactory.class);
/** Function to get path to the log storage. */
- private final Supplier<Path> logPathSupplier;
+ private final LazyPath lazyLogPath;
/** Executor for shared storages. */
private final ExecutorService executorService;
@@ -99,16 +99,16 @@ public class DefaultLogStorageFactory implements
LogStorageFactory {
*/
@TestOnly
public DefaultLogStorageFactory(Path path) {
- this("test", () -> path);
+ this("test", LazyPath.create(path));
}
/**
* Constructor.
*
- * @param logPathSupplier Function to get path to the log storage.
+ * @param lazyLogPath Function to get path to the log storage.
*/
- public DefaultLogStorageFactory(String nodeName, Supplier<Path>
logPathSupplier) {
- this.logPathSupplier = logPathSupplier;
+ public DefaultLogStorageFactory(String nodeName, LazyPath lazyLogPath) {
+ this.lazyLogPath = lazyLogPath;
executorService = Executors.newSingleThreadExecutor(
NamedThreadFactory.create(nodeName,
"raft-shared-log-storage-pool", LOG)
@@ -127,7 +127,7 @@ public class DefaultLogStorageFactory implements
LogStorageFactory {
}
private void start() {
- Path logPath = logPathSupplier.get();
+ Path logPath = lazyLogPath.get();
try {
Files.createDirectories(logPath);
diff --git
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/logit/LogitLogStorageFactory.java
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/logit/LogitLogStorageFactory.java
index fad0442c28..a27b4f5c73 100644
---
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/logit/LogitLogStorageFactory.java
+++
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/logit/LogitLogStorageFactory.java
@@ -23,7 +23,6 @@ import java.nio.file.Path;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
-import java.util.function.Supplier;
import org.apache.ignite.internal.lang.IgniteInternalException;
import org.apache.ignite.internal.logger.IgniteLogger;
import org.apache.ignite.internal.logger.Loggers;
@@ -31,6 +30,7 @@ import org.apache.ignite.internal.manager.ComponentContext;
import org.apache.ignite.internal.raft.storage.LogStorageFactory;
import org.apache.ignite.internal.thread.NamedThreadFactory;
import org.apache.ignite.internal.util.FeatureChecker;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.raft.jraft.option.RaftOptions;
import org.apache.ignite.raft.jraft.storage.LogStorage;
import org.apache.ignite.raft.jraft.storage.logit.option.StoreOptions;
@@ -53,17 +53,17 @@ public class LogitLogStorageFactory implements
LogStorageFactory {
private final StoreOptions storeOptions;
- /** Function to get base location of all log storages, created by this
factory. */
- private final Supplier<Path> logPathSupplier;
+ /** Base location of all log storages. */
+ private final LazyPath logPath;
/**
* Constructor.
*
- * @param logPathSupplier Function to get base path of all log storages,
created by this factory.
+ * @param logPath Function to get base path of all log storages, created
by this factory.
* @param storeOptions Logit log storage options.
*/
- public LogitLogStorageFactory(String nodeName, StoreOptions storeOptions,
Supplier<Path> logPathSupplier) {
- this.logPathSupplier = logPathSupplier;
+ public LogitLogStorageFactory(String nodeName, StoreOptions storeOptions,
LazyPath logPath) {
+ this.logPath = logPath;
this.storeOptions = storeOptions;
checkpointExecutor = Executors.newSingleThreadScheduledExecutor(
NamedThreadFactory.create(nodeName,
"logit-checkpoint-executor", LOG)
@@ -108,6 +108,6 @@ public class LogitLogStorageFactory implements
LogStorageFactory {
/** Returns path to log storage by group ID. */
public Path resolveLogStoragePath(String groupId) {
- return logPathSupplier.get().resolve(LOG_DIR_PREFIX + groupId);
+ return logPath.get().resolve(LOG_DIR_PREFIX + groupId);
}
}
diff --git
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/util/SharedLogStorageFactoryUtils.java
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/util/SharedLogStorageFactoryUtils.java
index c8f25bcf26..7d68423a42 100644
---
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/util/SharedLogStorageFactoryUtils.java
+++
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/util/SharedLogStorageFactoryUtils.java
@@ -17,42 +17,26 @@
package org.apache.ignite.internal.raft.util;
-import java.nio.file.Path;
-import java.util.function.BiFunction;
-import java.util.function.Supplier;
import org.apache.ignite.internal.lang.IgniteSystemProperties;
-import org.apache.ignite.internal.raft.configuration.RaftConfiguration;
import org.apache.ignite.internal.raft.storage.LogStorageFactory;
import org.apache.ignite.internal.raft.storage.impl.DefaultLogStorageFactory;
import org.apache.ignite.internal.raft.storage.logit.LogitLogStorageFactory;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.raft.jraft.storage.logit.option.StoreOptions;
/** Utility methods for creating {@link LogStorageFactory}is for the Shared
Log. */
public class SharedLogStorageFactoryUtils {
/**
- * Enables logit log storage. {@code false} by default.
- * This is a temporary property, that should only be used for testing and
comparing the two storages.
+ * Enables logit log storage. {@code false} by default. This is a
temporary property, that should only be used for testing and comparing
+ * the two storages.
*/
public static final String LOGIT_STORAGE_ENABLED_PROPERTY =
"LOGIT_STORAGE_ENABLED";
/** Creates a LogStorageFactory with the {@link DefaultLogStorageFactory}
implementation. */
- public static LogStorageFactory create(String nodeName, Path workDir,
RaftConfiguration raftConfiguration) {
- return create(nodeName, workDir, raftConfiguration,
DefaultLogStorageFactory::new);
- }
-
- /** Creates a LogStorageFactory with the provided factory or the {@link
LogitLogStorageFactory} implementation. */
- public static LogStorageFactory create(
- String nodeName,
- Path workDir,
- RaftConfiguration raftConfiguration,
- BiFunction<String, Supplier<Path>, LogStorageFactory> baseFactory
- ) {
- Supplier<Path> logStoragePath = () ->
raftConfiguration.logPath().value().isEmpty()
- ? workDir.resolve("log")
- : Path.of(raftConfiguration.logPath().value());
-
+ public static LogStorageFactory create(String nodeName, LazyPath
lazyLogStoragePath) {
return
IgniteSystemProperties.getBoolean(LOGIT_STORAGE_ENABLED_PROPERTY, false)
- ? new LogitLogStorageFactory(nodeName, new StoreOptions(),
logStoragePath)
- : baseFactory.apply(nodeName, logStoragePath);
+ ? new LogitLogStorageFactory(nodeName, new StoreOptions(),
lazyLogStoragePath)
+ : new DefaultLogStorageFactory(nodeName, lazyLogStoragePath);
}
+
}
diff --git
a/modules/raft/src/test/java/org/apache/ignite/raft/jraft/storage/impl/LogStorageBenchmark.java
b/modules/raft/src/test/java/org/apache/ignite/raft/jraft/storage/impl/LogStorageBenchmark.java
index 2c194430eb..905eb1ca1d 100644
---
a/modules/raft/src/test/java/org/apache/ignite/raft/jraft/storage/impl/LogStorageBenchmark.java
+++
b/modules/raft/src/test/java/org/apache/ignite/raft/jraft/storage/impl/LogStorageBenchmark.java
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.manager.ComponentContext;
import org.apache.ignite.internal.raft.storage.LogStorageFactory;
import org.apache.ignite.internal.raft.storage.logit.LogitLogStorageFactory;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.raft.jraft.conf.ConfigurationManager;
import org.apache.ignite.raft.jraft.entity.EnumOutter;
import org.apache.ignite.raft.jraft.entity.LogEntry;
@@ -154,7 +155,7 @@ public class LogStorageBenchmark {
int totalLogs = 100 * 1024;
// LogStorageFactory logStorageFactory = new
DefaultLogStorageFactory(testPath);
- LogStorageFactory logStorageFactory = new
LogitLogStorageFactory("test", new StoreOptions(), () -> testPath);
+ LogStorageFactory logStorageFactory = new
LogitLogStorageFactory("test", new StoreOptions(), LazyPath.create(testPath));
assertThat(logStorageFactory.startAsync(new ComponentContext()),
willCompleteSuccessfully());
try {
diff --git
a/modules/raft/src/test/java/org/apache/ignite/raft/jraft/storage/logit/LogitLogStorageTest.java
b/modules/raft/src/test/java/org/apache/ignite/raft/jraft/storage/logit/LogitLogStorageTest.java
index 9eed60a3bd..2d11aa3e58 100644
---
a/modules/raft/src/test/java/org/apache/ignite/raft/jraft/storage/logit/LogitLogStorageTest.java
+++
b/modules/raft/src/test/java/org/apache/ignite/raft/jraft/storage/logit/LogitLogStorageTest.java
@@ -26,6 +26,7 @@ import java.util.List;
import org.apache.ignite.internal.manager.ComponentContext;
import org.apache.ignite.internal.raft.storage.logit.LogitLogStorageFactory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.raft.jraft.entity.EnumOutter;
import org.apache.ignite.raft.jraft.entity.LogEntry;
import org.apache.ignite.raft.jraft.option.RaftOptions;
@@ -49,7 +50,7 @@ public class LogitLogStorageTest extends BaseLogStorageTest {
@BeforeEach
@Override
public void setup() throws Exception {
- logStorageFactory = new LogitLogStorageFactory("test",
testStoreOptions(), () -> path);
+ logStorageFactory = new LogitLogStorageFactory("test",
testStoreOptions(), LazyPath.create(path));
assertThat(logStorageFactory.startAsync(new ComponentContext()),
willCompleteSuccessfully());
super.setup();
diff --git
a/modules/raft/src/testFixtures/java/org/apache/ignite/internal/raft/TestLozaFactory.java
b/modules/raft/src/testFixtures/java/org/apache/ignite/internal/raft/TestLozaFactory.java
index cb15069071..9162812763 100644
---
a/modules/raft/src/testFixtures/java/org/apache/ignite/internal/raft/TestLozaFactory.java
+++
b/modules/raft/src/testFixtures/java/org/apache/ignite/internal/raft/TestLozaFactory.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.raft;
import java.nio.file.Path;
import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.internal.configuration.ComponentWorkingDir;
import org.apache.ignite.internal.hlc.HybridClock;
import org.apache.ignite.internal.manager.ComponentContext;
import org.apache.ignite.internal.metrics.NoOpMetricManager;
@@ -26,6 +27,7 @@ import org.apache.ignite.internal.network.ClusterService;
import org.apache.ignite.internal.raft.configuration.RaftConfiguration;
import org.apache.ignite.internal.raft.storage.LogStorageFactory;
import org.apache.ignite.internal.raft.util.SharedLogStorageFactoryUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.raft.jraft.rpc.impl.RaftGroupEventsClientListener;
/** Utilities for creating {@link Loza} instances. */
@@ -36,7 +38,7 @@ public class TestLozaFactory {
/**
* Factory method for {@link Loza}.
- * Uses the default logStorageFactory, {@link
SharedLogStorageFactoryUtils#create(String, Path, RaftConfiguration)},
+ * Uses the default logStorageFactory, {@link
SharedLogStorageFactoryUtils#create(String, LazyPath)},
* and automatically wraps it in the Loza instance start/stop methods.
*
* @param clusterNetSvc Cluster network service.
@@ -55,7 +57,7 @@ public class TestLozaFactory {
/**
* Factory method for {@link Loza}.
- * Uses the default logStorageFactory, {@link
SharedLogStorageFactoryUtils#create(String, Path, RaftConfiguration)},
+ * Uses the default logStorageFactory, {@link
SharedLogStorageFactoryUtils#create(String, LazyPath)},
* and automatically wraps it in the Loza instance start/stop methods.
*
* @param clusterNetSvc Cluster network service.
@@ -71,12 +73,17 @@ public class TestLozaFactory {
HybridClock clock,
RaftGroupEventsClientListener raftGroupEventsClientListener
) {
- LogStorageFactory logStorageFactory =
SharedLogStorageFactoryUtils.create(clusterNetSvc.nodeName(), dataPath,
raftConfig);
+ ComponentWorkingDir partitionsBaseDir = new
ComponentWorkingDir(dataPath);
+
+ LogStorageFactory logStorageFactory =
SharedLogStorageFactoryUtils.create(
+ clusterNetSvc.nodeName(),
+ partitionsBaseDir.raftLogPath()
+ );
return new Loza(
clusterNetSvc,
new NoOpMetricManager(),
raftConfig,
- dataPath,
+ partitionsBaseDir.metaPath(),
clock,
raftGroupEventsClientListener,
logStorageFactory) {
diff --git
a/modules/raft/src/testFixtures/java/org/apache/ignite/internal/raft/server/TestJraftServerFactory.java
b/modules/raft/src/testFixtures/java/org/apache/ignite/internal/raft/server/TestJraftServerFactory.java
index 5760dd8559..95bf82e98d 100644
---
a/modules/raft/src/testFixtures/java/org/apache/ignite/internal/raft/server/TestJraftServerFactory.java
+++
b/modules/raft/src/testFixtures/java/org/apache/ignite/internal/raft/server/TestJraftServerFactory.java
@@ -17,14 +17,18 @@
package org.apache.ignite.internal.raft.server;
+import static
org.apache.ignite.internal.configuration.IgnitePaths.partitionsPath;
+
import java.nio.file.Path;
import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.internal.configuration.ComponentWorkingDir;
+import org.apache.ignite.internal.configuration.SystemLocalConfiguration;
import org.apache.ignite.internal.manager.ComponentContext;
import org.apache.ignite.internal.network.ClusterService;
-import org.apache.ignite.internal.raft.configuration.RaftConfiguration;
import org.apache.ignite.internal.raft.server.impl.JraftServerImpl;
import org.apache.ignite.internal.raft.storage.LogStorageFactory;
import org.apache.ignite.internal.raft.util.SharedLogStorageFactoryUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.raft.jraft.option.NodeOptions;
import org.apache.ignite.raft.jraft.rpc.impl.RaftGroupEventsClientListener;
@@ -36,34 +40,37 @@ public class TestJraftServerFactory {
/**
* Factory method for {@link JraftServerImpl}.
- * Uses the default logStorageFactory, {@link
SharedLogStorageFactoryUtils#create(String, Path, RaftConfiguration)},
+ * Uses the default logStorageFactory, {@link
SharedLogStorageFactoryUtils#create(String, LazyPath)},
* and automatically wraps it in the JraftServerImpl instance start/stop
methods.
*
* @param service Cluster service.
* @param dataPath Data path.
- * @param raftConfiguration Raft configuration.
*/
- public static JraftServerImpl create(ClusterService service, Path
dataPath, RaftConfiguration raftConfiguration) {
- return create(service, dataPath, raftConfiguration, new NodeOptions(),
new RaftGroupEventsClientListener());
+ public static JraftServerImpl create(ClusterService service, Path
dataPath, SystemLocalConfiguration systemConfiguration) {
+ return create(service, dataPath, systemConfiguration, new
NodeOptions(), new RaftGroupEventsClientListener());
}
/**
* Factory method for {@link JraftServerImpl}.
- * Uses the default logStorageFactory, {@link
SharedLogStorageFactoryUtils#create(String, Path, RaftConfiguration)},
+ * Uses the default logStorageFactory, {@link
SharedLogStorageFactoryUtils#create(String, LazyPath)},
* and automatically wraps it in the JraftServerImpl instance start/stop
methods.
*
* @param service Cluster service.
* @param dataPath Data path.
* @param opts Node Options.
- * @param raftConfiguration Raft configuration.
*/
- public static JraftServerImpl create(ClusterService service, Path
dataPath, RaftConfiguration raftConfiguration, NodeOptions opts) {
- return create(service, dataPath, raftConfiguration, opts, new
RaftGroupEventsClientListener());
+ public static JraftServerImpl create(
+ ClusterService service,
+ Path dataPath,
+ SystemLocalConfiguration systemConfiguration,
+ NodeOptions opts
+ ) {
+ return create(service, dataPath, systemConfiguration, opts, new
RaftGroupEventsClientListener());
}
/**
* Factory method for {@link JraftServerImpl}.
- * Uses the default logStorageFactory, {@link
SharedLogStorageFactoryUtils#create(String, Path, RaftConfiguration)},
+ * Uses the default logStorageFactory, {@link
SharedLogStorageFactoryUtils#create(String, LazyPath)},
* and automatically wraps it in the JraftServerImpl instance start/stop
methods.
*
* @param service Cluster service.
@@ -73,12 +80,23 @@ public class TestJraftServerFactory {
public static JraftServerImpl create(
ClusterService service,
Path dataPath,
- RaftConfiguration raftConfiguration,
+ SystemLocalConfiguration systemConfiguration,
NodeOptions opts,
RaftGroupEventsClientListener raftGroupEventsClientListener
) {
- LogStorageFactory defaultLogStorageFactory =
SharedLogStorageFactoryUtils.create(service.nodeName(), dataPath,
raftConfiguration);
- return new JraftServerImpl(service, dataPath, opts,
raftGroupEventsClientListener, defaultLogStorageFactory) {
+ ComponentWorkingDir partitionsWorkDir =
partitionsPath(systemConfiguration, dataPath);
+
+ LogStorageFactory defaultLogStorageFactory =
SharedLogStorageFactoryUtils.create(
+ service.nodeName(),
+ partitionsWorkDir.raftLogPath()
+ );
+ return new JraftServerImpl(
+ service,
+ partitionsWorkDir.metaPath(),
+ opts,
+ raftGroupEventsClientListener,
+ defaultLogStorageFactory
+ ) {
@Override
public CompletableFuture<Void> startAsync(ComponentContext
componentContext) {
return
defaultLogStorageFactory.startAsync(componentContext).thenCompose(none ->
super.startAsync(componentContext));
diff --git
a/modules/raft/src/testFixtures/java/org/apache/ignite/internal/raft/service/ItAbstractListenerSnapshotTest.java
b/modules/raft/src/testFixtures/java/org/apache/ignite/internal/raft/service/ItAbstractListenerSnapshotTest.java
index 01e8aebd08..d89332478e 100644
---
a/modules/raft/src/testFixtures/java/org/apache/ignite/internal/raft/service/ItAbstractListenerSnapshotTest.java
+++
b/modules/raft/src/testFixtures/java/org/apache/ignite/internal/raft/service/ItAbstractListenerSnapshotTest.java
@@ -42,6 +42,7 @@ import java.util.function.BooleanSupplier;
import java.util.function.Function;
import java.util.stream.IntStream;
import java.util.stream.Stream;
+import org.apache.ignite.internal.configuration.SystemLocalConfiguration;
import
org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
import
org.apache.ignite.internal.configuration.testframework.InjectConfiguration;
import org.apache.ignite.internal.logger.IgniteLogger;
@@ -109,6 +110,9 @@ public abstract class ItAbstractListenerSnapshotTest<T
extends RaftGroupListener
@InjectConfiguration
private RaftConfiguration raftConfiguration;
+ @InjectConfiguration
+ protected SystemLocalConfiguration systemConfiguration;
+
/**
* Create executor for raft group services.
*/
@@ -428,7 +432,7 @@ public abstract class ItAbstractListenerSnapshotTest<T
extends RaftGroupListener
Path jraft = workDir.resolve("jraft" + idx);
- JraftServerImpl server = TestJraftServerFactory.create(service, jraft,
raftConfiguration);
+ JraftServerImpl server = TestJraftServerFactory.create(service, jraft,
systemConfiguration);
assertThat(server.startAsync(new ComponentContext()),
willCompleteSuccessfully());
diff --git a/modules/replicator/build.gradle b/modules/replicator/build.gradle
index f7913ba019..5581839275 100644
--- a/modules/replicator/build.gradle
+++ b/modules/replicator/build.gradle
@@ -68,6 +68,8 @@ dependencies {
testFixturesImplementation project(':ignite-raft-api')
testFixturesImplementation project(':ignite-core')
testFixturesImplementation project(':ignite-cluster-management')
+ // TODO https://issues.apache.org/jira/browse/IGNITE-22564 runner should
not be in test fixtures
+ testFixturesImplementation project(':ignite-runner')
testFixturesImplementation testFixtures(project(':ignite-core'))
testFixturesImplementation testFixtures(project(':ignite-network'))
testFixturesImplementation testFixtures(project(':ignite-configuration:'))
diff --git
a/modules/replicator/src/testFixtures/java/org/apache/ignite/internal/raft/client/AbstractTopologyAwareGroupServiceTest.java
b/modules/replicator/src/testFixtures/java/org/apache/ignite/internal/raft/client/AbstractTopologyAwareGroupServiceTest.java
index 7bbde8465b..b27171f44b 100644
---
a/modules/replicator/src/testFixtures/java/org/apache/ignite/internal/raft/client/AbstractTopologyAwareGroupServiceTest.java
+++
b/modules/replicator/src/testFixtures/java/org/apache/ignite/internal/raft/client/AbstractTopologyAwareGroupServiceTest.java
@@ -41,6 +41,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Predicate;
import
org.apache.ignite.internal.cluster.management.topology.api.LogicalTopologyService;
+import org.apache.ignite.internal.configuration.SystemLocalConfiguration;
import
org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
import
org.apache.ignite.internal.configuration.testframework.InjectConfiguration;
import org.apache.ignite.internal.lang.IgniteBiTuple;
@@ -107,6 +108,9 @@ public abstract class AbstractTopologyAwareGroupServiceTest
extends IgniteAbstra
@InjectConfiguration
protected RaftConfiguration raftConfiguration;
+ @InjectConfiguration
+ protected SystemLocalConfiguration systemConfiguration;
+
@AfterEach
protected void tearDown() throws Exception {
IgniteUtils.shutdownAndAwaitTermination(executor, 10,
TimeUnit.SECONDS);
@@ -433,7 +437,7 @@ public abstract class AbstractTopologyAwareGroupServiceTest
extends IgniteAbstra
var raftServer = TestJraftServerFactory.create(
cluster,
dataPath,
- raftConfiguration,
+ systemConfiguration,
nodeOptions,
eventsClientListener
);
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/inmemory/ItRaftStorageVolatilityTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/inmemory/ItRaftStorageVolatilityTest.java
index c650961e77..f96e99e88c 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/inmemory/ItRaftStorageVolatilityTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/inmemory/ItRaftStorageVolatilityTest.java
@@ -124,7 +124,7 @@ class ItRaftStorageVolatilityTest extends
ClusterPerTestIntegrationTest {
stopNode(0);
- Path logRocksDbDir = workDir.resolve(nodeName).resolve("log");
+ Path logRocksDbDir =
workDir.resolve(nodeName).resolve("partitions/log");
List<ColumnFamilyDescriptor> cfDescriptors = List.of(
// Column family to store configuration log entry.
@@ -184,7 +184,7 @@ class ItRaftStorageVolatilityTest extends
ClusterPerTestIntegrationTest {
stopNode(0);
- Path logRocksDbDir = workDir.resolve(nodeName).resolve("log");
+ Path logRocksDbDir =
workDir.resolve(nodeName).resolve("partitions/log");
List<ColumnFamilyDescriptor> cfDescriptors = List.of(
// Column family to store configuration log entry.
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java
index c06c0deff5..e99441fae7 100644
---
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java
@@ -24,6 +24,7 @@ import static
org.apache.ignite.internal.TestWrappers.unwrapTableImpl;
import static org.apache.ignite.internal.TestWrappers.unwrapTableManager;
import static org.apache.ignite.internal.TestWrappers.unwrapTableViewInternal;
import static
org.apache.ignite.internal.catalog.CatalogService.DEFAULT_STORAGE_PROFILE;
+import static
org.apache.ignite.internal.configuration.IgnitePaths.partitionsPath;
import static
org.apache.ignite.internal.distributionzones.DistributionZonesTestUtil.alterZone;
import static
org.apache.ignite.internal.distributionzones.rebalance.RebalanceUtil.REBALANCE_SCHEDULER_POOL_SIZE;
import static
org.apache.ignite.internal.distributionzones.rebalance.RebalanceUtil.STABLE_ASSIGNMENTS_PREFIX;
@@ -105,11 +106,13 @@ import
org.apache.ignite.internal.cluster.management.topology.LogicalTopologyImp
import
org.apache.ignite.internal.cluster.management.topology.LogicalTopologyServiceImpl;
import org.apache.ignite.internal.cluster.management.topology.api.LogicalNode;
import org.apache.ignite.internal.components.LogSyncer;
+import org.apache.ignite.internal.configuration.ComponentWorkingDir;
import org.apache.ignite.internal.configuration.ConfigurationManager;
import org.apache.ignite.internal.configuration.ConfigurationModules;
import org.apache.ignite.internal.configuration.ConfigurationRegistry;
import org.apache.ignite.internal.configuration.ConfigurationTreeGenerator;
import org.apache.ignite.internal.configuration.NodeConfigWriteException;
+import org.apache.ignite.internal.configuration.SystemLocalConfiguration;
import
org.apache.ignite.internal.configuration.storage.DistributedConfigurationStorage;
import
org.apache.ignite.internal.configuration.storage.LocalFileConfigurationStorage;
import
org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
@@ -209,6 +212,7 @@ import org.apache.ignite.internal.tx.message.TxMessageGroup;
import org.apache.ignite.internal.tx.test.TestLocalRwTxCounter;
import org.apache.ignite.internal.util.ByteUtils;
import org.apache.ignite.internal.util.Cursor;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.internal.vault.VaultManager;
import org.apache.ignite.internal.worker.CriticalWorkerWatchdog;
import
org.apache.ignite.internal.worker.configuration.CriticalWorkersConfiguration;
@@ -257,6 +261,9 @@ public class ItIgniteNodeRestartTest extends
BaseIgniteRestartTest {
@InjectConfiguration("mock: " + RAFT_CFG)
private static RaftConfiguration raftConfiguration;
+ @InjectConfiguration
+ private static SystemLocalConfiguration systemConfiguration;
+
@InjectConfiguration
private static ClusterManagementConfiguration
clusterManagementConfiguration;
@@ -375,7 +382,10 @@ public class ItIgniteNodeRestartTest extends
BaseIgniteRestartTest {
var raftGroupEventsClientListener = new
RaftGroupEventsClientListener();
- LogStorageFactory logStorageFactory =
SharedLogStorageFactoryUtils.create(clusterSvc.nodeName(), dir,
raftConfiguration);
+ ComponentWorkingDir partitionsWorkDir =
partitionsPath(systemConfiguration, dir);
+
+ LogStorageFactory logStorageFactory =
+ SharedLogStorageFactoryUtils.create(clusterSvc.nodeName(),
partitionsWorkDir.raftLogPath());
var raftMgr = TestLozaFactory.create(
clusterSvc,
@@ -584,11 +594,13 @@ public class ItIgniteNodeRestartTest extends
BaseIgniteRestartTest {
LogSyncer logSyncer = logStorageFactory;
+ LazyPath lazyStoragePath = LazyPath.create(storagePath);
+
DataStorageManager dataStorageManager = new DataStorageManager(
dataStorageModules.createStorageEngines(
name,
nodeCfgMgr.configurationRegistry(),
- storagePath,
+ lazyStoragePath,
null,
failureProcessor,
logSyncer,
@@ -650,7 +662,7 @@ public class ItIgniteNodeRestartTest extends
BaseIgniteRestartTest {
replicaService,
txManager,
dataStorageManager,
- storagePath,
+ lazyStoragePath,
metaStorageMgr,
schemaManager,
threadPoolsManager.tableIoExecutor(),
diff --git
a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
index 47ce9163ca..949ebf20d5 100644
---
a/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
+++
b/modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java
@@ -20,6 +20,10 @@ package org.apache.ignite.internal.app;
import static java.util.concurrent.CompletableFuture.completedFuture;
import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.stream.Collectors.toSet;
+import static org.apache.ignite.internal.configuration.IgnitePaths.cmgDbPath;
+import static
org.apache.ignite.internal.configuration.IgnitePaths.metastorageDbPath;
+import static
org.apache.ignite.internal.configuration.IgnitePaths.partitionsPath;
+import static org.apache.ignite.internal.configuration.IgnitePaths.vaultPath;
import static
org.apache.ignite.internal.distributionzones.rebalance.RebalanceUtil.REBALANCE_SCHEDULER_POOL_SIZE;
import static org.apache.ignite.internal.thread.ThreadOperation.STORAGE_READ;
import static org.apache.ignite.internal.thread.ThreadOperation.STORAGE_WRITE;
@@ -27,10 +31,7 @@ import static
org.apache.ignite.internal.util.CompletableFutures.nullCompletedFu
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
-import java.io.IOException;
-import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -95,6 +96,7 @@ import
org.apache.ignite.internal.compute.executor.ComputeExecutorImpl;
import org.apache.ignite.internal.compute.loader.JobClassLoaderFactory;
import org.apache.ignite.internal.compute.loader.JobContextManager;
import org.apache.ignite.internal.compute.state.InMemoryComputeStateMachine;
+import org.apache.ignite.internal.configuration.ComponentWorkingDir;
import
org.apache.ignite.internal.configuration.ConfigurationDynamicDefaultsPatcherImpl;
import org.apache.ignite.internal.configuration.ConfigurationManager;
import org.apache.ignite.internal.configuration.ConfigurationModules;
@@ -102,6 +104,7 @@ import
org.apache.ignite.internal.configuration.ConfigurationRegistry;
import org.apache.ignite.internal.configuration.ConfigurationTreeGenerator;
import org.apache.ignite.internal.configuration.JdbcPortProviderImpl;
import org.apache.ignite.internal.configuration.ServiceLoaderModulesProvider;
+import org.apache.ignite.internal.configuration.SystemLocalConfiguration;
import org.apache.ignite.internal.configuration.hocon.HoconConverter;
import org.apache.ignite.internal.configuration.storage.ConfigurationStorage;
import
org.apache.ignite.internal.configuration.storage.DistributedConfigurationStorage;
@@ -232,8 +235,8 @@ import
org.apache.ignite.internal.tx.impl.TransactionIdGenerator;
import org.apache.ignite.internal.tx.impl.TransactionInflights;
import org.apache.ignite.internal.tx.impl.TxManagerImpl;
import org.apache.ignite.internal.tx.message.TxMessageGroup;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.internal.vault.VaultManager;
-import org.apache.ignite.internal.vault.VaultService;
import org.apache.ignite.internal.vault.persistence.PersistentVaultService;
import org.apache.ignite.internal.worker.CriticalWorkerWatchdog;
import org.apache.ignite.internal.worker.ThreadAssertions;
@@ -256,26 +259,6 @@ public class IgniteImpl implements Ignite {
/** The logger. */
private static final IgniteLogger LOG = Loggers.forClass(IgniteImpl.class);
- /**
- * Path to the persistent storage used by the {@link VaultService}
component.
- */
- private static final Path VAULT_DB_PATH = Paths.get("vault");
-
- /**
- * Path to the persistent storage used by the {@link MetaStorageManager}
component.
- */
- private static final Path METASTORAGE_DB_PATH = Paths.get("metastorage");
-
- /**
- * Path to the persistent storage used by the {@link
ClusterManagementGroupManager} component.
- */
- private static final Path CMG_DB_PATH = Paths.get("cmg");
-
- /**
- * Path for the partitions persistent storage.
- */
- private static final Path PARTITIONS_STORE_PATH = Paths.get("db");
-
/** Ignite node name. */
private final String name;
@@ -442,7 +425,7 @@ public class IgniteImpl implements Ignite {
threadPoolsManager = new ThreadPoolsManager(name);
- vaultMgr = createVault(workDir);
+ vaultMgr = new VaultManager(new
PersistentVaultService(vaultPath(workDir)));
metricManager = new MetricManagerImpl();
@@ -512,16 +495,21 @@ public class IgniteImpl implements Ignite {
RaftConfiguration raftConfiguration =
nodeConfigRegistry.getConfiguration(RaftConfiguration.KEY);
+ SystemLocalConfiguration systemConfiguration =
nodeConfigRegistry.getConfiguration(SystemLocalConfiguration.KEY);
+
// TODO https://issues.apache.org/jira/browse/IGNITE-19051
RaftGroupEventsClientListener raftGroupEventsClientListener = new
RaftGroupEventsClientListener();
- logStorageFactory =
SharedLogStorageFactoryUtils.create(clusterSvc.nodeName(), workDir,
raftConfiguration);
+ ComponentWorkingDir partitionsWorkDir =
partitionsPath(systemConfiguration, workDir);
+
+ logStorageFactory =
+ SharedLogStorageFactoryUtils.create(clusterSvc.nodeName(),
partitionsWorkDir.raftLogPath());
raftMgr = new Loza(
clusterSvc,
metricManager,
raftConfiguration,
- workDir,
+ partitionsWorkDir.metaPath(),
clock,
raftGroupEventsClientListener,
logStorageFactory
@@ -536,7 +524,9 @@ public class IgniteImpl implements Ignite {
);
// TODO: IGNITE-16841 - use common RocksDB instance to store cluster
state as well.
- clusterStateStorage = new
RocksDbClusterStateStorage(workDir.resolve(CMG_DB_PATH), name);
+ Path cmgDbPath = cmgDbPath(workDir);
+
+ clusterStateStorage = new RocksDbClusterStateStorage(cmgDbPath, name);
var logicalTopology = new LogicalTopologyImpl(clusterStateStorage);
@@ -593,12 +583,14 @@ public class IgniteImpl implements Ignite {
raftGroupEventsClientListener
);
+ Path metastorageDbPath = metastorageDbPath(workDir);
+
metaStorageMgr = new MetaStorageManagerImpl(
clusterSvc,
cmgMgr,
logicalTopologyService,
raftMgr,
- new RocksDbKeyValueStorage(name,
workDir.resolve(METASTORAGE_DB_PATH), failureProcessor),
+ new RocksDbKeyValueStorage(name, metastorageDbPath,
failureProcessor),
clock,
topologyAwareRaftGroupServiceFactory,
metricManager
@@ -693,7 +685,7 @@ public class IgniteImpl implements Ignite {
ServiceLoader.load(DataStorageModule.class,
serviceProviderClassLoader)
);
- Path storagePath = getPartitionsStorePath(workDir);
+ LazyPath storagePath = partitionsWorkDir.dbPath();
GcConfiguration gcConfig =
clusterConfigRegistry.getConfiguration(GcConfiguration.KEY);
@@ -1553,39 +1545,6 @@ public class IgniteImpl implements Ignite {
);
}
- /**
- * Starts the Vault component.
- */
- private static VaultManager createVault(Path workDir) {
- Path vaultPath = workDir.resolve(VAULT_DB_PATH);
-
- try {
- Files.createDirectories(vaultPath);
- } catch (IOException e) {
- throw new IgniteInternalException(e);
- }
-
- return new VaultManager(new PersistentVaultService(vaultPath));
- }
-
- /**
- * Returns a path to the partitions store directory. Creates a directory
if it doesn't exist.
- *
- * @param workDir Ignite work directory.
- * @return Partitions store path.
- */
- private static Path getPartitionsStorePath(Path workDir) {
- Path partitionsStore = workDir.resolve(PARTITIONS_STORE_PATH);
-
- try {
- Files.createDirectories(partitionsStore);
- } catch (IOException e) {
- throw new IgniteInternalException("Failed to create directory for
partitions storage: " + e.getMessage(), e);
- }
-
- return partitionsStore;
- }
-
@TestOnly
public Loza raftManager() {
return raftMgr;
diff --git
a/modules/runner/src/main/java/org/apache/ignite/internal/configuration/ComponentWorkingDir.java
b/modules/runner/src/main/java/org/apache/ignite/internal/configuration/ComponentWorkingDir.java
new file mode 100644
index 0000000000..71ae0b60cc
--- /dev/null
+++
b/modules/runner/src/main/java/org/apache/ignite/internal/configuration/ComponentWorkingDir.java
@@ -0,0 +1,81 @@
+/*
+ * 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.configuration;
+
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import org.apache.ignite.internal.util.LazyPath;
+
+/**
+ * Working dir subtree structure representation for components.
+ */
+public class ComponentWorkingDir {
+ /**
+ * Path for the persistent storage.
+ */
+ private static final Path STORAGE_PATH = Paths.get("db");
+
+ /**
+ * Path for the raft log.
+ */
+ private static final Path RAFT_LOG_PATH = Paths.get("log");
+
+ /**
+ * Path for the metadata.
+ */
+ private static final Path METADATA_PATH = Paths.get("meta");
+
+ private final LazyPath basePath;
+
+ public ComponentWorkingDir(LazyPath basePath) {
+ this.basePath = basePath;
+ }
+
+ public ComponentWorkingDir(Path basePath) {
+ this(LazyPath.create(basePath));
+ }
+
+ /**
+ * Returns base path for the component.
+ */
+ public LazyPath basePath() {
+ return basePath;
+ }
+
+ /**
+ * Returns metadata path for the component. A subdirectory in the base
path.
+ */
+ public LazyPath metaPath() {
+ return basePath.resolveLazy(METADATA_PATH);
+ }
+
+ /**
+ * Returns raft log path for the component. A subdirectory in the base
path.
+ */
+ public LazyPath raftLogPath() {
+ return basePath.resolveLazy(RAFT_LOG_PATH);
+ }
+
+ /**
+ * Returns storage path for the component. A subdirectory in the base path.
+ */
+ public LazyPath dbPath() {
+ return basePath.resolveLazy(STORAGE_PATH);
+ }
+}
diff --git
a/modules/runner/src/main/java/org/apache/ignite/internal/configuration/IgnitePaths.java
b/modules/runner/src/main/java/org/apache/ignite/internal/configuration/IgnitePaths.java
new file mode 100644
index 0000000000..efbcea104b
--- /dev/null
+++
b/modules/runner/src/main/java/org/apache/ignite/internal/configuration/IgnitePaths.java
@@ -0,0 +1,105 @@
+/*
+ * 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.configuration;
+
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.function.Supplier;
+import org.apache.ignite.configuration.ConfigurationValue;
+import org.apache.ignite.internal.util.LazyPath;
+
+/**
+ * Manages storage paths for Ignite.
+ */
+public class IgnitePaths {
+
+ /**
+ * Path to the base directory of the partitions data.
+ */
+ private static final Path PARTITIONS_BASE_PATH = Paths.get("partitions");
+
+ /**
+ * Path to the persistent storage used by the VaultService component.
+ */
+ private static final Path VAULT_DB_PATH = Paths.get("vault");
+
+ /**
+ * Path to the persistent storage used by the MetaStorageManager component.
+ */
+ private static final Path METASTORAGE_DB_PATH = Paths.get("metastorage");
+
+ /**
+ * Path to the persistent storage used by the
ClusterManagementGroupManager component.
+ */
+ private static final Path CMG_DB_PATH = Paths.get("cmg");
+
+ /**
+ * Directory where partition data is stored. By default "partitions"
subfolder of data storage path is used.
+ *
+ * @param systemConfiguration System configuration.
+ * @param workDir Ignite working dir. Will be used as a default place to
store partitions dir, if it is not set in the
+ * configuration.
+ * @return Working dir subtree structure representation for partitions.
+ */
+ public static ComponentWorkingDir partitionsPath(SystemLocalConfiguration
systemConfiguration, Path workDir) {
+ LazyPath basePath = lazy(systemConfiguration.partitionsBasePath(), ()
-> workDir.resolve(PARTITIONS_BASE_PATH));
+
+ return new ComponentWorkingDir(basePath) {
+ @Override
+ public LazyPath raftLogPath() {
+ return lazy(systemConfiguration.partitionsLogPath(), () ->
super.raftLogPath().get());
+ }
+ };
+ }
+
+ /**
+ * Path to Metastorage store.
+ *
+ * @param workDir Ignite working dir.
+ */
+ public static Path metastorageDbPath(Path workDir) {
+ return workDir.resolve(METASTORAGE_DB_PATH);
+ }
+
+ /**
+ * Path to CMG store.
+ *
+ * @param workDir Ignite working dir.
+ */
+ public static Path cmgDbPath(Path workDir) {
+ return workDir.resolve(CMG_DB_PATH);
+ }
+
+ /**
+ * Path to Vault store.
+ *
+ * @param workDir Ignite working dir.
+ */
+ public static Path vaultPath(Path workDir) {
+ return workDir.resolve(VAULT_DB_PATH);
+ }
+
+ private IgnitePaths() {
+ // No-op.
+ }
+
+ private static LazyPath lazy(ConfigurationValue<String> value,
Supplier<Path> defaultPath) {
+ return LazyPath.create(value::value, defaultPath);
+ }
+}
diff --git
a/modules/runner/src/main/java/org/apache/ignite/internal/configuration/SystemLocalConfigurationModule.java
b/modules/runner/src/main/java/org/apache/ignite/internal/configuration/SystemLocalConfigurationModule.java
new file mode 100644
index 0000000000..ebc36a849d
--- /dev/null
+++
b/modules/runner/src/main/java/org/apache/ignite/internal/configuration/SystemLocalConfigurationModule.java
@@ -0,0 +1,42 @@
+/*
+ * 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.configuration;
+
+import com.google.auto.service.AutoService;
+import java.util.Collection;
+import java.util.Collections;
+import org.apache.ignite.configuration.ConfigurationModule;
+import org.apache.ignite.configuration.RootKey;
+import org.apache.ignite.configuration.annotation.ConfigurationType;
+
+/**
+ * {@link ConfigurationModule} for node-local system configuration.
+ */
+@AutoService(ConfigurationModule.class)
+public class SystemLocalConfigurationModule implements ConfigurationModule {
+
+ @Override
+ public ConfigurationType type() {
+ return ConfigurationType.LOCAL;
+ }
+
+ @Override
+ public Collection<RootKey<?, ?>> rootKeys() {
+ return Collections.singleton(SystemLocalConfiguration.KEY);
+ }
+}
diff --git
a/modules/runner/src/main/java/org/apache/ignite/internal/configuration/SystemLocalConfigurationSchema.java
b/modules/runner/src/main/java/org/apache/ignite/internal/configuration/SystemLocalConfigurationSchema.java
new file mode 100644
index 0000000000..4ce395fb68
--- /dev/null
+++
b/modules/runner/src/main/java/org/apache/ignite/internal/configuration/SystemLocalConfigurationSchema.java
@@ -0,0 +1,46 @@
+/*
+ * 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.configuration;
+
+import org.apache.ignite.configuration.annotation.ConfigurationRoot;
+import org.apache.ignite.configuration.annotation.ConfigurationType;
+import org.apache.ignite.configuration.annotation.Value;
+
+/**
+ * System Configuration schema.
+ */
+@ConfigurationRoot(rootName = "system", type = ConfigurationType.LOCAL)
+public class SystemLocalConfigurationSchema {
+
+ /**
+ * Directory where partition data is stored. By default "partitions"
subfolder of data storage path is used.
+ *
+ * <pre>
+ * The internal directory structure contains:
+ * - `log` directory - raft log directory.
+ * - `meta` directory - raft meta directory (raft log metadata and
snapshots).
+ * - `db` directory - persistent storage directory.
+ * </pre>
+ */
+ @Value(hasDefault = true)
+ public String partitionsBasePath = "";
+
+ /** Directory where log is stored. By default "log" subfolder of partition
base path is used. */
+ @Value(hasDefault = true)
+ public String partitionsLogPath = "";
+}
diff --git
a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/DataStorageModule.java
b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/DataStorageModule.java
index a97fcb692c..f058f44269 100644
---
a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/DataStorageModule.java
+++
b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/DataStorageModule.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.storage;
-import java.nio.file.Path;
import org.apache.ignite.internal.components.LogSyncer;
import org.apache.ignite.internal.components.LongJvmPauseDetector;
import org.apache.ignite.internal.configuration.ConfigurationRegistry;
@@ -25,6 +24,7 @@ import org.apache.ignite.internal.failure.FailureProcessor;
import org.apache.ignite.internal.hlc.HybridClock;
import
org.apache.ignite.internal.storage.configurations.StorageProfileConfiguration;
import org.apache.ignite.internal.storage.engine.StorageEngine;
+import org.apache.ignite.internal.util.LazyPath;
import org.jetbrains.annotations.Nullable;
/**
@@ -53,7 +53,7 @@ public interface DataStorageModule {
StorageEngine createEngine(
String igniteInstanceName,
ConfigurationRegistry configRegistry,
- Path storagePath,
+ LazyPath storagePath,
@Nullable LongJvmPauseDetector longJvmPauseDetector,
FailureProcessor failureProcessor,
LogSyncer logSyncer,
diff --git
a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/DataStorageModules.java
b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/DataStorageModules.java
index b2b6369cc7..6f46c66faf 100644
---
a/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/DataStorageModules.java
+++
b/modules/storage-api/src/main/java/org/apache/ignite/internal/storage/DataStorageModules.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.storage;
import static java.util.stream.Collectors.toUnmodifiableMap;
-import java.nio.file.Path;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -30,6 +29,7 @@ import
org.apache.ignite.internal.configuration.ConfigurationRegistry;
import org.apache.ignite.internal.failure.FailureProcessor;
import org.apache.ignite.internal.hlc.HybridClock;
import org.apache.ignite.internal.storage.engine.StorageEngine;
+import org.apache.ignite.internal.util.LazyPath;
import org.jetbrains.annotations.Nullable;
/**
@@ -84,7 +84,7 @@ public class DataStorageModules {
public Map<String, StorageEngine> createStorageEngines(
String igniteInstanceName,
ConfigurationRegistry configRegistry,
- Path storagePath,
+ LazyPath storagePath,
@Nullable LongJvmPauseDetector longJvmPauseDetector,
FailureProcessor failureProcessor,
LogSyncer logSyncer,
diff --git
a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/DataStorageModulesTest.java
b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/DataStorageModulesTest.java
index 7f09d43fff..12f875114d 100644
---
a/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/DataStorageModulesTest.java
+++
b/modules/storage-api/src/test/java/org/apache/ignite/internal/storage/DataStorageModulesTest.java
@@ -38,6 +38,7 @@ import
org.apache.ignite.internal.storage.engine.StorageEngine;
import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -78,7 +79,7 @@ public class DataStorageModulesTest extends
BaseIgniteAbstractTest {
Map<String, StorageEngine> engines =
dataStorageModules.createStorageEngines(
"test",
mock(ConfigurationRegistry.class),
- workDir,
+ LazyPath.create(workDir),
null,
mock(FailureProcessor.class),
mock(LogSyncer.class),
diff --git
a/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/impl/TestDataStorageModule.java
b/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/impl/TestDataStorageModule.java
index 299186637a..c390fef8b3 100644
---
a/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/impl/TestDataStorageModule.java
+++
b/modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/impl/TestDataStorageModule.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.storage.impl;
import static
org.apache.ignite.internal.storage.impl.TestStorageEngine.ENGINE_NAME;
import com.google.auto.service.AutoService;
-import java.nio.file.Path;
import org.apache.ignite.internal.components.LogSyncer;
import org.apache.ignite.internal.components.LongJvmPauseDetector;
import org.apache.ignite.internal.configuration.ConfigurationRegistry;
@@ -29,6 +28,7 @@ import org.apache.ignite.internal.hlc.HybridClock;
import org.apache.ignite.internal.storage.DataStorageModule;
import org.apache.ignite.internal.storage.StorageException;
import org.apache.ignite.internal.storage.engine.StorageEngine;
+import org.apache.ignite.internal.util.LazyPath;
import org.jetbrains.annotations.Nullable;
/**
@@ -45,7 +45,7 @@ public class TestDataStorageModule implements
DataStorageModule {
public StorageEngine createEngine(
String igniteInstanceName,
ConfigurationRegistry configRegistry,
- Path storagePath,
+ LazyPath storagePath,
@Nullable LongJvmPauseDetector longJvmPauseDetector,
FailureProcessor failureProcessor,
LogSyncer logSyncer,
diff --git
a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryDataStorageModule.java
b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryDataStorageModule.java
index c7b0bf43a9..6dc56bbad4 100644
---
a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryDataStorageModule.java
+++
b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryDataStorageModule.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.storage.pagememory;
import static
org.apache.ignite.internal.storage.pagememory.PersistentPageMemoryStorageEngine.ENGINE_NAME;
import com.google.auto.service.AutoService;
-import java.nio.file.Path;
import org.apache.ignite.internal.components.LogSyncer;
import org.apache.ignite.internal.components.LongJvmPauseDetector;
import org.apache.ignite.internal.configuration.ConfigurationRegistry;
@@ -33,6 +32,7 @@ import
org.apache.ignite.internal.storage.configurations.StorageConfiguration;
import org.apache.ignite.internal.storage.engine.StorageEngine;
import
org.apache.ignite.internal.storage.pagememory.configuration.schema.PersistentPageMemoryStorageEngineConfiguration;
import
org.apache.ignite.internal.storage.pagememory.configuration.schema.PersistentPageMemoryStorageEngineExtensionConfiguration;
+import org.apache.ignite.internal.util.LazyPath;
import org.jetbrains.annotations.Nullable;
/**
@@ -49,7 +49,7 @@ public class PersistentPageMemoryDataStorageModule implements
DataStorageModule
public StorageEngine createEngine(
String igniteInstanceName,
ConfigurationRegistry configRegistry,
- Path storagePath,
+ LazyPath storagePath,
@Nullable LongJvmPauseDetector longJvmPauseDetector,
FailureProcessor failureProcessor,
LogSyncer logSyncer,
diff --git
a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryStorageEngine.java
b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryStorageEngine.java
index b0f6a4f33f..c4edd357fa 100644
---
a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryStorageEngine.java
+++
b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryStorageEngine.java
@@ -54,6 +54,7 @@ import
org.apache.ignite.internal.storage.engine.StorageTableDescriptor;
import org.apache.ignite.internal.storage.index.StorageIndexDescriptorSupplier;
import
org.apache.ignite.internal.storage.pagememory.configuration.schema.PersistentPageMemoryStorageEngineConfiguration;
import org.apache.ignite.internal.thread.NamedThreadFactory;
+import org.apache.ignite.internal.util.LazyPath;
import org.jetbrains.annotations.Nullable;
/** Storage engine implementation based on {@link PersistentPageMemory}. */
@@ -78,7 +79,7 @@ public class PersistentPageMemoryStorageEngine extends
AbstractPageMemoryStorage
private final PageIoRegistry ioRegistry;
- private final Path storagePath;
+ private final LazyPath storagePath;
@Nullable
private final LongJvmPauseDetector longJvmPauseDetector;
@@ -118,7 +119,7 @@ public class PersistentPageMemoryStorageEngine extends
AbstractPageMemoryStorage
PersistentPageMemoryStorageEngineConfiguration engineConfig,
StorageConfiguration storageConfig,
PageIoRegistry ioRegistry,
- Path storagePath,
+ LazyPath storagePath,
@Nullable LongJvmPauseDetector longJvmPauseDetector,
FailureProcessor failureProcessor,
LogSyncer logSyncer,
@@ -157,7 +158,8 @@ public class PersistentPageMemoryStorageEngine extends
AbstractPageMemoryStorage
? new AsyncFileIoFactory()
: new RandomAccessFileIoFactory();
- filePageStoreManager =
createFilePageStoreManager(igniteInstanceName, storagePath, fileIoFactory,
pageSize, failureProcessor);
+ filePageStoreManager =
+ createFilePageStoreManager(igniteInstanceName,
storagePath.get(), fileIoFactory, pageSize, failureProcessor);
filePageStoreManager.start();
} catch (IgniteInternalCheckedException e) {
diff --git
a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryDataStorageModule.java
b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryDataStorageModule.java
index 944a064240..6213abe24e 100644
---
a/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryDataStorageModule.java
+++
b/modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryDataStorageModule.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.storage.pagememory;
import static
org.apache.ignite.internal.storage.pagememory.VolatilePageMemoryStorageEngine.ENGINE_NAME;
import com.google.auto.service.AutoService;
-import java.nio.file.Path;
import org.apache.ignite.internal.components.LogSyncer;
import org.apache.ignite.internal.components.LongJvmPauseDetector;
import org.apache.ignite.internal.configuration.ConfigurationRegistry;
@@ -33,6 +32,7 @@ import
org.apache.ignite.internal.storage.configurations.StorageConfiguration;
import org.apache.ignite.internal.storage.engine.StorageEngine;
import
org.apache.ignite.internal.storage.pagememory.configuration.schema.VolatilePageMemoryStorageEngineConfiguration;
import
org.apache.ignite.internal.storage.pagememory.configuration.schema.VolatilePageMemoryStorageEngineExtensionConfiguration;
+import org.apache.ignite.internal.util.LazyPath;
import org.jetbrains.annotations.Nullable;
/**
@@ -49,7 +49,7 @@ public class VolatilePageMemoryDataStorageModule implements
DataStorageModule {
public StorageEngine createEngine(
String igniteInstanceName,
ConfigurationRegistry configRegistry,
- Path storagePath,
+ LazyPath storagePath,
@Nullable LongJvmPauseDetector longJvmPauseDetector,
FailureProcessor failureProcessor,
LogSyncer logSyncer,
diff --git
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryMvTableStorageTest.java
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryMvTableStorageTest.java
index e904140934..31bcff45b0 100644
---
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryMvTableStorageTest.java
+++
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryMvTableStorageTest.java
@@ -41,6 +41,7 @@ import
org.apache.ignite.internal.storage.pagememory.configuration.schema.Persis
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -71,7 +72,7 @@ public class PersistentPageMemoryMvTableStorageTest extends
AbstractMvTableStora
engineConfig,
storageConfig,
ioRegistry,
- workDir,
+ LazyPath.create(workDir),
null,
mock(FailureProcessor.class),
mock(LogSyncer.class),
diff --git
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/engine/PersistentPageMemoryStorageEngineTest.java
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/engine/PersistentPageMemoryStorageEngineTest.java
index e0491d3a73..3518c33299 100644
---
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/engine/PersistentPageMemoryStorageEngineTest.java
+++
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/engine/PersistentPageMemoryStorageEngineTest.java
@@ -30,6 +30,7 @@ import
org.apache.ignite.internal.storage.pagememory.PersistentPageMemoryStorage
import
org.apache.ignite.internal.storage.pagememory.configuration.schema.PersistentPageMemoryStorageEngineConfiguration;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.extension.ExtendWith;
/**
@@ -57,7 +58,7 @@ public class PersistentPageMemoryStorageEngineTest extends
AbstractStorageEngine
engineConfig,
storageConfig,
ioRegistry,
- workDir,
+ LazyPath.create(workDir),
null,
mock(FailureProcessor.class),
logSyncer,
diff --git
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/index/PersistentPageMemoryHashIndexStorageTest.java
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/index/PersistentPageMemoryHashIndexStorageTest.java
index 3403711e83..02130c4ef0 100644
---
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/index/PersistentPageMemoryHashIndexStorageTest.java
+++
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/index/PersistentPageMemoryHashIndexStorageTest.java
@@ -35,6 +35,7 @@ import
org.apache.ignite.internal.storage.pagememory.PersistentPageMemoryStorage
import
org.apache.ignite.internal.storage.pagememory.configuration.schema.PersistentPageMemoryStorageEngineConfiguration;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -64,7 +65,7 @@ class PersistentPageMemoryHashIndexStorageTest extends
AbstractPageMemoryHashInd
engineConfig,
storageConfig,
ioRegistry,
- workDir,
+ LazyPath.create(workDir),
null,
mock(FailureProcessor.class),
mock(LogSyncer.class),
diff --git
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/index/PersistentPageMemorySortedIndexStorageTest.java
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/index/PersistentPageMemorySortedIndexStorageTest.java
index 2e0640fca4..3673baee71 100644
---
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/index/PersistentPageMemorySortedIndexStorageTest.java
+++
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/index/PersistentPageMemorySortedIndexStorageTest.java
@@ -35,6 +35,7 @@ import
org.apache.ignite.internal.storage.pagememory.PersistentPageMemoryStorage
import
org.apache.ignite.internal.storage.pagememory.configuration.schema.PersistentPageMemoryStorageEngineConfiguration;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -63,7 +64,7 @@ class PersistentPageMemorySortedIndexStorageTest extends
AbstractPageMemorySorte
engineConfig,
storageConfig,
ioRegistry,
- workDir,
+ LazyPath.create(workDir),
null,
mock(FailureProcessor.class),
mock(LogSyncer.class),
diff --git
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageConcurrencyTest.java
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageConcurrencyTest.java
index f3da9bf91e..e34dfe1e75 100644
---
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageConcurrencyTest.java
+++
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageConcurrencyTest.java
@@ -36,6 +36,7 @@ import
org.apache.ignite.internal.storage.pagememory.configuration.schema.Persis
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -63,7 +64,7 @@ class PersistentPageMemoryMvPartitionStorageConcurrencyTest
extends AbstractMvPa
engineConfig,
storageConfig,
ioRegistry,
- workDir,
+ LazyPath.create(workDir),
null,
mock(FailureProcessor.class),
mock(LogSyncer.class),
diff --git
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageGcTest.java
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageGcTest.java
index 6f5f97a581..80c03806eb 100644
---
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageGcTest.java
+++
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageGcTest.java
@@ -36,6 +36,7 @@ import
org.apache.ignite.internal.storage.pagememory.configuration.schema.Persis
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -63,7 +64,7 @@ class PersistentPageMemoryMvPartitionStorageGcTest extends
AbstractMvPartitionSt
engineConfig,
storageConfig,
ioRegistry,
- workDir,
+ LazyPath.create(workDir),
null,
mock(FailureProcessor.class),
mock(LogSyncer.class),
diff --git
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageTest.java
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageTest.java
index b9c42ec411..8d5d1ebad9 100644
---
a/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageTest.java
+++
b/modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageTest.java
@@ -44,6 +44,7 @@ import
org.apache.ignite.internal.storage.pagememory.configuration.schema.Persis
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -75,7 +76,7 @@ class PersistentPageMemoryMvPartitionStorageTest extends
AbstractPageMemoryMvPar
engineConfig,
storageConfig,
ioRegistry,
- workDir,
+ LazyPath.create(workDir),
null,
mock(FailureProcessor.class),
mock(LogSyncer.class),
diff --git
a/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbDataStorageModule.java
b/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbDataStorageModule.java
index d8e9f7d344..6d410fc87b 100644
---
a/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbDataStorageModule.java
+++
b/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbDataStorageModule.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.storage.rocksdb;
import static
org.apache.ignite.internal.storage.rocksdb.RocksDbStorageEngine.ENGINE_NAME;
import com.google.auto.service.AutoService;
-import java.nio.file.Path;
import org.apache.ignite.internal.components.LogSyncer;
import org.apache.ignite.internal.components.LongJvmPauseDetector;
import org.apache.ignite.internal.configuration.ConfigurationRegistry;
@@ -32,6 +31,7 @@ import
org.apache.ignite.internal.storage.configurations.StorageConfiguration;
import org.apache.ignite.internal.storage.engine.StorageEngine;
import
org.apache.ignite.internal.storage.rocksdb.configuration.schema.RocksDbStorageEngineConfiguration;
import
org.apache.ignite.internal.storage.rocksdb.configuration.schema.RocksDbStorageEngineExtensionConfiguration;
+import org.apache.ignite.internal.util.LazyPath;
import org.jetbrains.annotations.Nullable;
/**
@@ -48,7 +48,7 @@ public class RocksDbDataStorageModule implements
DataStorageModule {
public StorageEngine createEngine(
String igniteInstanceName,
ConfigurationRegistry configRegistry,
- Path storagePath,
+ LazyPath storagePath,
@Nullable LongJvmPauseDetector longJvmPauseDetector,
FailureProcessor failureProcessor,
LogSyncer logSyncer,
diff --git
a/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbStorageEngine.java
b/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbStorageEngine.java
index 75003c9327..428eedbafe 100644
---
a/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbStorageEngine.java
+++
b/modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbStorageEngine.java
@@ -40,6 +40,7 @@ import
org.apache.ignite.internal.storage.rocksdb.instance.SharedRocksDbInstance
import
org.apache.ignite.internal.storage.rocksdb.instance.SharedRocksDbInstanceCreator;
import org.apache.ignite.internal.thread.NamedThreadFactory;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.rocksdb.RocksDB;
/**
@@ -75,7 +76,7 @@ public class RocksDbStorageEngine implements StorageEngine {
private final StorageConfiguration storageConfiguration;
- private final Path storagePath;
+ private final LazyPath storagePath;
private final ExecutorService threadPool;
@@ -101,7 +102,7 @@ public class RocksDbStorageEngine implements StorageEngine {
String nodeName,
RocksDbStorageEngineConfiguration engineConfig,
StorageConfiguration storageConfiguration,
- Path storagePath,
+ LazyPath storagePath,
LogSyncer logSyncer
) {
this.engineConfig = engineConfig;
@@ -174,7 +175,7 @@ public class RocksDbStorageEngine implements StorageEngine {
}
private SharedRocksDbInstance newRocksDbInstance(String profileName,
RocksDbStorageProfile profile) {
- Path dbPath = storagePath.resolve("rocksdb-" + profileName);
+ Path dbPath = storagePath.get().resolve("rocksdb-" + profileName);
try {
return new SharedRocksDbInstanceCreator().create(this, profile,
dbPath);
diff --git
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageConcurrencyTest.java
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageConcurrencyTest.java
index fd4bb95a14..88a51c78cf 100644
---
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageConcurrencyTest.java
+++
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageConcurrencyTest.java
@@ -31,6 +31,7 @@ import
org.apache.ignite.internal.storage.rocksdb.configuration.schema.RocksDbSt
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -52,7 +53,7 @@ public class RocksDbMvPartitionStorageConcurrencyTest extends
AbstractMvPartitio
@InjectConfiguration("mock.profiles.default = {engine = rocksdb,
size = 16777216, writeBufferSize = 16777216}")
StorageConfiguration storageConfiguration
) {
- engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, workDir, mock(LogSyncer.class));
+ engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, LazyPath.create(workDir), mock(LogSyncer.class));
engine.start();
diff --git
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageGcTest.java
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageGcTest.java
index 21b714beb6..2cc5b0f5e9 100644
---
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageGcTest.java
+++
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageGcTest.java
@@ -31,6 +31,7 @@ import
org.apache.ignite.internal.storage.rocksdb.configuration.schema.RocksDbSt
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -52,7 +53,7 @@ public class RocksDbMvPartitionStorageGcTest extends
AbstractMvPartitionStorageG
@InjectConfiguration("mock.profiles.default = {engine = rocksdb,
size = 16777216, writeBufferSize = 16777216}")
StorageConfiguration storageConfiguration
) {
- engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, workDir, mock(LogSyncer.class));
+ engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, LazyPath.create(workDir), mock(LogSyncer.class));
engine.start();
diff --git
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageTest.java
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageTest.java
index 1562fda94a..2571c80876 100644
---
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageTest.java
+++
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvPartitionStorageTest.java
@@ -31,6 +31,7 @@ import
org.apache.ignite.internal.storage.rocksdb.configuration.schema.RocksDbSt
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -52,7 +53,7 @@ public class RocksDbMvPartitionStorageTest extends
AbstractMvPartitionStorageTes
@InjectConfiguration("mock.profiles.default = {engine = rocksdb,
size = 16777216, writeBufferSize = 16777216}")
StorageConfiguration storageConfiguration
) {
- engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, workDir, mock(LogSyncer.class));
+ engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, LazyPath.create(workDir), mock(LogSyncer.class));
engine.start();
diff --git
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvTableStorageTest.java
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvTableStorageTest.java
index 52f90af41d..91a2186487 100644
---
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvTableStorageTest.java
+++
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/RocksDbMvTableStorageTest.java
@@ -41,6 +41,7 @@ import
org.apache.ignite.internal.storage.rocksdb.configuration.schema.RocksDbSt
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -61,7 +62,7 @@ public class RocksDbMvTableStorageTest extends
AbstractMvTableStorageTest {
@InjectConfiguration("mock.profiles.default {engine = rocksdb,
size = 16777216, writeBufferSize = 16777216}")
StorageConfiguration storageConfiguration
) {
- engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, workDir, mock(LogSyncer.class));
+ engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, LazyPath.create(workDir), mock(LogSyncer.class));
engine.start();
diff --git
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/engine/RocksDbStorageEngineTest.java
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/engine/RocksDbStorageEngineTest.java
index 77904b0f15..d2588a9f66 100644
---
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/engine/RocksDbStorageEngineTest.java
+++
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/engine/RocksDbStorageEngineTest.java
@@ -26,6 +26,7 @@ import
org.apache.ignite.internal.storage.rocksdb.RocksDbStorageEngine;
import
org.apache.ignite.internal.storage.rocksdb.configuration.schema.RocksDbStorageEngineConfiguration;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.extension.ExtendWith;
/**
@@ -48,7 +49,7 @@ public class RocksDbStorageEngineTest extends
AbstractStorageEngineTest {
"test",
engineConfiguration,
storageConfiguration,
- workDir,
+ LazyPath.create(workDir),
logSyncer
);
}
diff --git
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/index/RocksDbHashIndexStorageTest.java
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/index/RocksDbHashIndexStorageTest.java
index 024ac7572f..7b8bcd1c4b 100644
---
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/index/RocksDbHashIndexStorageTest.java
+++
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/index/RocksDbHashIndexStorageTest.java
@@ -33,6 +33,7 @@ import
org.apache.ignite.internal.storage.rocksdb.RocksDbStorageEngine;
import
org.apache.ignite.internal.storage.rocksdb.configuration.schema.RocksDbStorageEngineConfiguration;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -53,7 +54,7 @@ public class RocksDbHashIndexStorageTest extends
AbstractHashIndexStorageTest {
@InjectConfiguration("mock.profiles.default = {engine = rocksdb,
size = 16777216, writeBufferSize = 16777216}")
StorageConfiguration storageConfiguration
) {
- engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, workDir, mock(LogSyncer.class));
+ engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, LazyPath.create(workDir), mock(LogSyncer.class));
engine.start();
diff --git
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/index/RocksDbSortedIndexStorageTest.java
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/index/RocksDbSortedIndexStorageTest.java
index 043998e049..eb0ddd8775 100644
---
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/index/RocksDbSortedIndexStorageTest.java
+++
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/index/RocksDbSortedIndexStorageTest.java
@@ -33,6 +33,7 @@ import
org.apache.ignite.internal.storage.rocksdb.RocksDbStorageEngine;
import
org.apache.ignite.internal.storage.rocksdb.configuration.schema.RocksDbStorageEngineConfiguration;
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -53,7 +54,7 @@ public class RocksDbSortedIndexStorageTest extends
AbstractSortedIndexStorageTes
@InjectConfiguration("mock.profiles.default = {engine = rocksdb,
size = 16777216, writeBufferSize = 16777216}")
StorageConfiguration storageConfiguration
) {
- engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, workDir, mock(LogSyncer.class));
+ engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, LazyPath.create(workDir), mock(LogSyncer.class));
engine.start();
diff --git
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/instance/SharedRocksDbInstanceTest.java
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/instance/SharedRocksDbInstanceTest.java
index 2c72278daf..90b312327c 100644
---
a/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/instance/SharedRocksDbInstanceTest.java
+++
b/modules/storage-rocksdb/src/test/java/org/apache/ignite/internal/storage/rocksdb/instance/SharedRocksDbInstanceTest.java
@@ -56,6 +56,7 @@ import
org.apache.ignite.internal.storage.rocksdb.configuration.schema.RocksDbSt
import org.apache.ignite.internal.testframework.IgniteAbstractTest;
import org.apache.ignite.internal.type.NativeTypes;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.RepeatedTest;
@@ -80,7 +81,7 @@ class SharedRocksDbInstanceTest extends IgniteAbstractTest {
StorageConfiguration storageConfiguration,
@InjectConfiguration RocksDbStorageEngineConfiguration engineConfig
) throws Exception {
- engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, workDir, mock(LogSyncer.class));
+ engine = new RocksDbStorageEngine("test", engineConfig,
storageConfiguration, LazyPath.create(workDir), mock(LogSyncer.class));
engine.start();
diff --git
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java
index c5abadb475..718d77b6b6 100644
---
a/modules/table/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java
+++
b/modules/table/src/integrationTest/java/org/apache/ignite/internal/rebalance/ItRebalanceDistributedTest.java
@@ -24,6 +24,7 @@ import static java.util.concurrent.TimeUnit.SECONDS;
import static java.util.stream.Collectors.toSet;
import static
org.apache.ignite.internal.TestDefaultProfilesNames.DEFAULT_TEST_PROFILE_NAME;
import static
org.apache.ignite.internal.catalog.CatalogService.DEFAULT_STORAGE_PROFILE;
+import static
org.apache.ignite.internal.configuration.IgnitePaths.partitionsPath;
import static
org.apache.ignite.internal.distributionzones.rebalance.RebalanceUtil.REBALANCE_SCHEDULER_POOL_SIZE;
import static
org.apache.ignite.internal.distributionzones.rebalance.RebalanceUtil.STABLE_ASSIGNMENTS_PREFIX;
import static
org.apache.ignite.internal.distributionzones.rebalance.RebalanceUtil.extractPartitionNumber;
@@ -110,9 +111,11 @@ import
org.apache.ignite.internal.cluster.management.topology.LogicalTopologyImp
import
org.apache.ignite.internal.cluster.management.topology.LogicalTopologyServiceImpl;
import
org.apache.ignite.internal.cluster.management.topology.api.LogicalTopologySnapshot;
import org.apache.ignite.internal.components.LogSyncer;
+import org.apache.ignite.internal.configuration.ComponentWorkingDir;
import org.apache.ignite.internal.configuration.ConfigurationManager;
import org.apache.ignite.internal.configuration.ConfigurationRegistry;
import org.apache.ignite.internal.configuration.ConfigurationTreeGenerator;
+import org.apache.ignite.internal.configuration.SystemLocalConfiguration;
import
org.apache.ignite.internal.configuration.storage.DistributedConfigurationStorage;
import
org.apache.ignite.internal.configuration.storage.LocalFileConfigurationStorage;
import
org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
@@ -215,6 +218,7 @@ import org.apache.ignite.internal.tx.message.TxMessageGroup;
import org.apache.ignite.internal.tx.storage.state.TxStateTableStorage;
import
org.apache.ignite.internal.tx.storage.state.test.TestTxStateTableStorage;
import org.apache.ignite.internal.tx.test.TestLocalRwTxCounter;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.internal.util.PendingComparableValuesTracker;
import org.apache.ignite.internal.vault.VaultManager;
import org.apache.ignite.internal.vault.persistence.PersistentVaultService;
@@ -268,6 +272,9 @@ public class ItRebalanceDistributedTest extends
BaseIgniteAbstractTest {
@InjectConfiguration
private static RaftConfiguration raftConfiguration;
+ @InjectConfiguration
+ private static SystemLocalConfiguration systemConfiguration;
+
@InjectConfiguration
private static ClusterManagementConfiguration
clusterManagementConfiguration;
@@ -1128,13 +1135,15 @@ public class ItRebalanceDistributedTest extends
BaseIgniteAbstractTest {
var raftGroupEventsClientListener = new
RaftGroupEventsClientListener();
- logStorageFactory =
SharedLogStorageFactoryUtils.create(clusterService.nodeName(), dir,
raftConfiguration);
+ ComponentWorkingDir partitionsWorkDir =
partitionsPath(systemConfiguration, dir);
+
+ logStorageFactory =
SharedLogStorageFactoryUtils.create(clusterService.nodeName(),
partitionsWorkDir.raftLogPath());
raftManager = spy(new Loza(
clusterService,
metricManager,
raftConfiguration,
- dir,
+ partitionsWorkDir.metaPath(),
hybridClock,
raftGroupEventsClientListener,
logStorageFactory
@@ -1248,7 +1257,7 @@ public class ItRebalanceDistributedTest extends
BaseIgniteAbstractTest {
dataStorageModules.createStorageEngines(
name,
nodeCfgMgr.configurationRegistry(),
- dir.resolve("storage"),
+ LazyPath.create(dir.resolve("storage")),
null,
failureProcessor,
logSyncer,
@@ -1343,7 +1352,7 @@ public class ItRebalanceDistributedTest extends
BaseIgniteAbstractTest {
replicaSvc,
txManager,
dataStorageMgr,
- storagePath,
+ LazyPath.create(storagePath),
metaStorageManager,
schemaManager,
threadPoolsManager.tableIoExecutor(),
diff --git
a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
index 613f457ca3..ec5b1d6c67 100644
---
a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
+++
b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
@@ -64,7 +64,6 @@ import static
org.apache.ignite.internal.util.IgniteUtils.shutdownAndAwaitTermin
import static org.apache.ignite.lang.ErrorGroups.Common.INTERNAL_ERR;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
-import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -215,6 +214,7 @@ import org.apache.ignite.internal.util.ExceptionUtils;
import org.apache.ignite.internal.util.IgniteSpinBusyLock;
import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.Lazy;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.internal.util.PendingComparableValuesTracker;
import org.apache.ignite.internal.utils.RebalanceUtilEx;
import org.apache.ignite.internal.worker.ThreadAssertions;
@@ -455,7 +455,7 @@ public class TableManager implements IgniteTablesInternal,
IgniteComponent {
ReplicaService replicaSvc,
TxManager txManager,
DataStorageManager dataStorageMgr,
- Path storagePath,
+ LazyPath storagePath,
MetaStorageManager metaStorageMgr,
SchemaManager schemaManager,
ExecutorService ioExecutor,
@@ -570,7 +570,7 @@ public class TableManager implements IgniteTablesInternal,
IgniteComponent {
startVv = new IncrementalVersionedValue<>(registry);
sharedTxStateStorage = new TxStateRocksDbSharedStorage(
- storagePath.resolve(TX_STATE_DIR),
+ storagePath.resolveLazy(TX_STATE_DIR),
txStateStorageScheduledPool,
txStateStoragePool,
logSyncer,
diff --git
a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerRecoveryTest.java
b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerRecoveryTest.java
index b3a9d13c8c..7016e7d666 100644
---
a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerRecoveryTest.java
+++
b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerRecoveryTest.java
@@ -126,6 +126,7 @@ import
org.apache.ignite.internal.tx.configuration.TransactionConfiguration;
import org.apache.ignite.internal.tx.impl.RemotelyTriggeredResourceRegistry;
import org.apache.ignite.internal.tx.impl.TransactionInflights;
import org.apache.ignite.internal.tx.storage.state.TxStateTableStorage;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.internal.util.PendingComparableValuesTracker;
import org.apache.ignite.network.ClusterNode;
import org.apache.ignite.network.NetworkAddress;
@@ -321,6 +322,10 @@ public class TableManagerRecoveryTest extends
IgniteAbstractTest {
indexMetaStorage = new IndexMetaStorage(catalogManager, lowWatermark,
metaStorageManager);
+ LazyPath storagePath = LazyPath.create(workDir);
+
+ dsm = createDataStorageManager(mock(ConfigurationRegistry.class),
storagePath, storageConfiguration, dataStorageModule, clock);
+
tableManager = new TableManager(
NODE_NAME,
revisionUpdater,
@@ -334,8 +339,8 @@ public class TableManagerRecoveryTest extends
IgniteAbstractTest {
null,
null,
tm,
- dsm =
createDataStorageManager(mock(ConfigurationRegistry.class), workDir,
storageConfiguration, dataStorageModule, clock),
- workDir,
+ dsm,
+ storagePath,
metaStorageManager,
sm = new SchemaManager(revisionUpdater, catalogManager),
partitionOperationsExecutor,
@@ -421,7 +426,7 @@ public class TableManagerRecoveryTest extends
IgniteAbstractTest {
private static DataStorageManager createDataStorageManager(
ConfigurationRegistry mockedRegistry,
- Path storagePath,
+ LazyPath storagePath,
StorageConfiguration config,
DataStorageModule dataStorageModule,
HybridClock clock
@@ -484,7 +489,7 @@ public class TableManagerRecoveryTest extends
IgniteAbstractTest {
public StorageEngine createEngine(
String igniteInstanceName,
ConfigurationRegistry configRegistry,
- Path storagePath,
+ LazyPath storagePath,
@Nullable LongJvmPauseDetector longJvmPauseDetector,
FailureProcessor failureProcessor,
LogSyncer logSyncer,
diff --git
a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java
b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java
index 0f184e46f8..7dd883acdd 100644
---
a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java
+++
b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/TableManagerTest.java
@@ -58,7 +58,6 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import java.nio.file.Path;
import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -139,6 +138,7 @@ import
org.apache.ignite.internal.tx.storage.state.TxStateStorage;
import org.apache.ignite.internal.tx.storage.state.TxStateTableStorage;
import org.apache.ignite.internal.util.CursorUtils;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.apache.ignite.network.ClusterNode;
import org.apache.ignite.network.NetworkAddress;
import org.apache.ignite.sql.IgniteSql;
@@ -804,6 +804,8 @@ public class TableManagerTest extends IgniteAbstractTest {
Consumer<MvTableStorage> tableStorageDecorator,
Consumer<TxStateTableStorage> txStateTableStorageDecorator
) {
+ LazyPath storagePath = LazyPath.create(workDir);
+
var tableManager = new TableManager(
NODE_NAME,
revisionUpdater,
@@ -817,8 +819,8 @@ public class TableManagerTest extends IgniteAbstractTest {
null,
null,
tm,
- dsm = createDataStorageManager(configRegistry, workDir),
- workDir,
+ dsm = createDataStorageManager(configRegistry, storagePath),
+ storagePath,
msm,
sm = new SchemaManager(revisionUpdater, catalogManager),
partitionOperationsExecutor,
@@ -874,7 +876,7 @@ public class TableManagerTest extends IgniteAbstractTest {
private DataStorageManager createDataStorageManager(
ConfigurationRegistry mockedRegistry,
- Path storagePath
+ LazyPath storagePath
) {
when(mockedRegistry.getConfiguration(StorageConfiguration.KEY)).thenReturn(storageConfiguration);
diff --git
a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/gc/PersistentPageMemoryGcUpdateHandlerTest.java
b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/gc/PersistentPageMemoryGcUpdateHandlerTest.java
index 15073c8915..7373c93738 100644
---
a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/gc/PersistentPageMemoryGcUpdateHandlerTest.java
+++
b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/gc/PersistentPageMemoryGcUpdateHandlerTest.java
@@ -37,6 +37,7 @@ import
org.apache.ignite.internal.storage.pagememory.configuration.schema.Persis
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInfo;
@@ -69,7 +70,7 @@ class PersistentPageMemoryGcUpdateHandlerTest extends
AbstractGcUpdateHandlerTes
engineConfig,
storageConfig,
ioRegistry,
- workDir,
+ LazyPath.create(workDir),
new LongJvmPauseDetector(nodeName),
mock(FailureProcessor.class),
mock(LogSyncer.class),
diff --git
a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/gc/RocksDbGcUpdateHandlerTest.java
b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/gc/RocksDbGcUpdateHandlerTest.java
index fdabbf533c..fb7d97ea2e 100644
---
a/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/gc/RocksDbGcUpdateHandlerTest.java
+++
b/modules/table/src/test/java/org/apache/ignite/internal/table/distributed/gc/RocksDbGcUpdateHandlerTest.java
@@ -34,6 +34,7 @@ import
org.apache.ignite.internal.storage.rocksdb.configuration.schema.RocksDbSt
import org.apache.ignite.internal.testframework.WorkDirectory;
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInfo;
@@ -55,7 +56,13 @@ class RocksDbGcUpdateHandlerTest extends
AbstractGcUpdateHandlerTest {
@InjectConfiguration("mock.profiles.default.engine = rocksdb")
StorageConfiguration storageConfiguration
) {
- engine = new RocksDbStorageEngine(testNodeName(testInfo, 0),
engineConfig, storageConfiguration, workDir, mock(LogSyncer.class));
+ engine = new RocksDbStorageEngine(
+ testNodeName(testInfo, 0),
+ engineConfig,
+ storageConfiguration,
+ LazyPath.create(workDir),
+ mock(LogSyncer.class)
+ );
engine.start();
diff --git
a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/storage/state/rocksdb/TxStateRocksDbSharedStorage.java
b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/storage/state/rocksdb/TxStateRocksDbSharedStorage.java
index b956e36a9f..4056a81782 100644
---
a/modules/transactions/src/main/java/org/apache/ignite/internal/tx/storage/state/rocksdb/TxStateRocksDbSharedStorage.java
+++
b/modules/transactions/src/main/java/org/apache/ignite/internal/tx/storage/state/rocksdb/TxStateRocksDbSharedStorage.java
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.components.LogSyncer;
import org.apache.ignite.internal.lang.IgniteInternalException;
import org.apache.ignite.internal.rocksdb.flush.RocksDbFlusher;
import org.apache.ignite.internal.util.IgniteSpinBusyLock;
+import org.apache.ignite.internal.util.LazyPath;
import org.rocksdb.ColumnFamilyDescriptor;
import org.rocksdb.ColumnFamilyHandle;
import org.rocksdb.ColumnFamilyOptions;
@@ -70,7 +71,7 @@ public class TxStateRocksDbSharedStorage implements
ManuallyCloseable {
final ReadOptions readOptions = new ReadOptions();
/** Database path. */
- private final Path dbPath;
+ private final LazyPath dbPath;
/** RocksDB flusher instance. */
private volatile RocksDbFlusher flusher;
@@ -105,7 +106,7 @@ public class TxStateRocksDbSharedStorage implements
ManuallyCloseable {
* @see RocksDbFlusher
*/
public TxStateRocksDbSharedStorage(
- Path dbPath,
+ LazyPath dbPath,
ScheduledExecutorService scheduledExecutor,
ExecutorService threadPool,
LogSyncer logSyncer,
@@ -139,7 +140,9 @@ public class TxStateRocksDbSharedStorage implements
ManuallyCloseable {
*/
public void start() {
try {
- Files.createDirectories(dbPath);
+ Path path = dbPath.get();
+
+ Files.createDirectories(path);
flusher = new RocksDbFlusher(
busyLock,
@@ -158,7 +161,7 @@ public class TxStateRocksDbSharedStorage implements
ManuallyCloseable {
List<ColumnFamilyDescriptor> cfDescriptors;
try (Options opts = new Options()) {
- cfDescriptors = RocksDB.listColumnFamilies(opts,
dbPath.toAbsolutePath().toString())
+ cfDescriptors = RocksDB.listColumnFamilies(opts,
path.toAbsolutePath().toString())
.stream()
.map(nameBytes -> new
ColumnFamilyDescriptor(nameBytes, new ColumnFamilyOptions()))
.collect(toList());
diff --git
a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/storage/state/rocksdb/RocksDbTxStateStorageTest.java
b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/storage/state/rocksdb/RocksDbTxStateStorageTest.java
index 5bd183ddb1..dcf15dfeee 100644
---
a/modules/transactions/src/test/java/org/apache/ignite/internal/tx/storage/state/rocksdb/RocksDbTxStateStorageTest.java
+++
b/modules/transactions/src/test/java/org/apache/ignite/internal/tx/storage/state/rocksdb/RocksDbTxStateStorageTest.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.tx.TxMeta;
import org.apache.ignite.internal.tx.storage.state.AbstractTxStateStorageTest;
import org.apache.ignite.internal.tx.storage.state.TxStateStorage;
import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.LazyPath;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -68,7 +69,8 @@ public class RocksDbTxStateStorageTest extends
AbstractTxStateStorageTest {
@Override
@BeforeEach
protected void beforeTest() {
- sharedStorage = new TxStateRocksDbSharedStorage(workDir,
scheduledExecutor, executor, mock(LogSyncer.class), () -> 0);
+ sharedStorage =
+ new TxStateRocksDbSharedStorage(LazyPath.create(workDir),
scheduledExecutor, executor, mock(LogSyncer.class), () -> 0);
sharedStorage.start();
super.beforeTest();
diff --git
a/modules/vault/src/main/java/org/apache/ignite/internal/vault/persistence/PersistentVaultService.java
b/modules/vault/src/main/java/org/apache/ignite/internal/vault/persistence/PersistentVaultService.java
index 047cb8d7b0..0e7ceaa9eb 100644
---
a/modules/vault/src/main/java/org/apache/ignite/internal/vault/persistence/PersistentVaultService.java
+++
b/modules/vault/src/main/java/org/apache/ignite/internal/vault/persistence/PersistentVaultService.java
@@ -17,6 +17,8 @@
package org.apache.ignite.internal.vault.persistence;
+import java.io.IOException;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
import org.apache.ignite.internal.lang.ByteArray;
@@ -87,8 +89,10 @@ public class PersistentVaultService implements VaultService {
@Override
public void start() {
try {
+ Files.createDirectories(path);
+
db = RocksDB.open(options, path.toString());
- } catch (RocksDBException e) {
+ } catch (IOException | RocksDBException e) {
throw new IgniteInternalException(e);
}
}