Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-24421 Move checkpoint dir to NodeFileTree #11854

Merged
merged 33 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ead5a26
IGNITE-24130 Move binaryMetadata, marshaller directories logic to Ign…
nizhikov Jan 30, 2025
035a4da
IGNITE-24130 Move binaryMetadata, marshaller directories logic to Ign…
nizhikov Jan 30, 2025
4fc6b65
IGNITE-24130 Move binaryMetadata, marshaller directories logic to Ign…
nizhikov Jan 30, 2025
465d37b
IGNITE-24130 Sonar fixes
nizhikov Jan 30, 2025
dacad64
IGNITE-24317
nizhikov Jan 30, 2025
ad65c95
IGNITE-24317
nizhikov Jan 30, 2025
a3c34b7
IGNITE-24317
nizhikov Jan 30, 2025
7c87066
IGNITE-24317 Test fix
nizhikov Jan 30, 2025
a3db974
IGNITE-24317 Test fix
nizhikov Jan 30, 2025
600b9ca
IGNITE-24317 Test fix
nizhikov Jan 30, 2025
bf44f70
Merge branch 'IGNITE-24317-meta-new' into IGNITE-24317-wal-new
nizhikov Jan 30, 2025
0ea8c6c
IGNITE-24317 Snapshots root and snapshots temp moved to
nizhikov Jan 30, 2025
9acc882
IGNITE-24317 Snapshots root and snapshots temp moved to
nizhikov Jan 30, 2025
4686032
IGNITE-24317 Review fixes
nizhikov Feb 5, 2025
cc3cc8b
IGNITE-24317 Review fixes
nizhikov Feb 5, 2025
5af4195
Merge branch 'master' into IGNITE-24317-snapshot-shared
nizhikov Feb 5, 2025
a957644
IGNITE-24317 Review fixes
nizhikov Feb 5, 2025
ac9cfb4
IGNITE-24317 Review fixes
nizhikov Feb 5, 2025
d619550
IGNITE-24419 Move snapshots temp and root to NodeFileTree
nizhikov Feb 5, 2025
4675eed
IGNITE-24419 Move snapshots temp and root to NodeFileTree
nizhikov Feb 5, 2025
3e4f988
IGNITE-24419 Move snapshots temp and root to NodeFileTree
nizhikov Feb 5, 2025
cec72fb
IGNITE-24419 Move snapshots temp and root to NodeFileTree
nizhikov Feb 5, 2025
a2d8bc1
IGNITE-24419 Move checkpoint dir to NodeFileTree
nizhikov Feb 5, 2025
66c1e11
IGNITE-24419 Move checkpoint dir to NodeFileTree
nizhikov Feb 5, 2025
353efc9
IGNITE-24419 Move checkpoint dir to NodeFileTree
nizhikov Feb 5, 2025
a99fa55
IGNITE-24419 Move checkpoint dir to NodeFileTree
nizhikov Feb 5, 2025
e9fa5b0
Merge branch 'master' into IGNITE-24421
nizhikov Feb 6, 2025
2569efd
IGNITE-24421 Merge fix
nizhikov Feb 6, 2025
4bc835f
IGNITE-24421 Merge fix
nizhikov Feb 6, 2025
ee6b0d5
IGNITE-24421 Merge fix
nizhikov Feb 6, 2025
13825a5
IGNITE-24421 Merge fix
nizhikov Feb 6, 2025
c624940
IGNITE-24421 Sonar fixes
nizhikov Feb 6, 2025
8b7c69f
IGNITE-24421 Sonar fixes
nizhikov Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.ignite.internal.benchmarks.jol;

import java.io.File;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -35,6 +36,7 @@
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.openjdk.jol.info.GraphLayout;
Expand Down Expand Up @@ -69,7 +71,7 @@ private void cleanPersistenceDir() throws Exception {

SharedFileTree sft = new SharedFileTree(U.defaultWorkDirectory());

U.delete(U.resolveWorkDirectory(U.defaultWorkDirectory(), "cp", false));
U.delete(new File(sft.root(), SharedFsCheckpointSpi.DFLT_ROOT));
U.delete(sft.marshaller().getParentFile());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.ignite.compatibility.testframework.junits.IgniteCompatibilityAbstractTest;
import org.apache.ignite.compatibility.testframework.util.CompatibilityTestsUtils;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointSpi;

import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
import static org.apache.ignite.internal.processors.cache.persistence.filename.SharedFileTree.BINARY_METADATA_DIR;
Expand All @@ -34,7 +35,7 @@
public abstract class IgnitePersistenceCompatibilityAbstractTest extends IgniteCompatibilityAbstractTest {
/** Persistence directories. */
private static final List<String> PERSISTENCE_DIRS
= Arrays.asList(DFLT_STORE_DIR, BINARY_METADATA_DIR, "cp", MARSHALLER_DIR);
= Arrays.asList(DFLT_STORE_DIR, BINARY_METADATA_DIR, SharedFsCheckpointSpi.DFLT_ROOT, MARSHALLER_DIR);

/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.apache.ignite.configuration.WALMode;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.processors.cache.GridCacheAbstractFullApiSelfTest;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.junit.Test;
Expand Down Expand Up @@ -122,14 +122,9 @@ private void doTestStartupWithOldVersion(String ver) throws Exception {

int expCompressedWalSegments = PAYLOAD_SIZE * ENTRIES * 4 / WAL_SEGMENT_SIZE - 1;

String nodeFolderName = ignite.context().pdsFolderResolver().resolveFolders().folderName();
NodeFileTree ft = ignite.context().pdsFolderResolver().fileTree();

File dbDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false);
File walDir = new File(dbDir, "wal");
File archiveDir = new File(walDir, "archive");
File nodeArchiveDir = new File(archiveDir, nodeFolderName);

File[] compressedSegments = nodeArchiveDir.listFiles(new FilenameFilter() {
File[] compressedSegments = ft.walArchive().listFiles(new FilenameFilter() {
@Override public boolean accept(File dir, String name) {
return name.endsWith(".wal.zip");
}
Expand All @@ -142,15 +137,12 @@ private void doTestStartupWithOldVersion(String ver) throws Exception {

stopAllGrids();

File nodeLfsDir = new File(dbDir, nodeFolderName);
File cpMarkersDir = new File(nodeLfsDir, "cp");

File[] cpMarkers = cpMarkersDir.listFiles();
File[] cpMarkers = ft.checkpoint().listFiles();

assertNotNull(cpMarkers);
assertTrue(cpMarkers.length > 0);

File cacheDir = new File(nodeLfsDir, "cache-" + TEST_CACHE_NAME);
File cacheDir = new File(ft.nodeStorage(), "cache-" + TEST_CACHE_NAME);
File[] partFiles = cacheDir.listFiles(new FilenameFilter() {
@Override public boolean accept(File dir, String name) {
return name.startsWith("part");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.apache.ignite.internal.management.cache.IdleVerifyResult;
import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
import org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIO;
import org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree;
import org.apache.ignite.internal.processors.compress.CompressionProcessor;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
Expand Down Expand Up @@ -288,10 +289,12 @@ public void testRestoreNotCompressed_OnGridWithoutCompression() throws Exception
continue;
}

U.delete(U.resolveWorkDirectory(dir.toString(), "cp", false));
U.delete(U.resolveWorkDirectory(dir.toString(), DFLT_STORE_DIR, false));
U.delete(nodeFileTree(dir.toString()).marshaller());
U.delete(nodeFileTree(dir.toString()).binaryMetaRoot());
NodeFileTree ft = nodeFileTree(dir.toString());

U.delete(ft.checkpoint());
U.delete(ft.nodeStorage().getParentFile());
U.delete(ft.marshaller());
U.delete(ft.binaryMetaRoot());
}
}
catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.T3;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.metric.MetricRegistry;
import org.apache.ignite.spi.communication.CommunicationSpi;
import org.apache.ignite.spi.metric.LongMetric;
Expand All @@ -49,7 +48,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
import static org.apache.ignite.internal.processors.metric.GridMetricManager.CLIENT_CONNECTOR_METRICS;
import static org.apache.ignite.internal.util.nio.GridNioServer.RECEIVED_BYTES_METRIC_NAME;
import static org.apache.ignite.internal.util.nio.GridNioServer.SENT_BYTES_METRIC_NAME;
Expand Down Expand Up @@ -361,10 +359,7 @@ private Consumption doTest(int cnt, Function<Integer, Object> keyGen, Function<I

mem += metrics.getTotalAllocatedSize();

String nodeFolder = ((IgniteEx)node).context().pdsFolderResolver().resolveFolders().folderName();

pers += FileUtils.sizeOfDirectory(
U.resolveWorkDirectory(U.defaultWorkDirectory(), DFLT_STORE_DIR + "/" + nodeFolder, false));
pers += FileUtils.sizeOfDirectory(((IgniteEx)node).context().pdsFolderResolver().fileTree().nodeStorage());

if (mode != ConsumptionTestMode.PERSISTENT)
assertEquals(0, pers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import org.apache.ignite.internal.pagemem.PageIdAllocator;
import org.apache.ignite.internal.processors.cache.persistence.IndexStorageImpl;
import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore;
import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
import org.apache.ignite.internal.processors.query.QueryUtils;
import org.apache.ignite.internal.util.GridStringBuilder;
Expand Down Expand Up @@ -228,7 +227,7 @@ protected void prepareWorkDir() throws Exception {
try (IgniteEx node = startGrid(0)) {
populateData(node, null);

workDir = ((FilePageStoreManager)node.context().cache().context().pageStore()).workDir();
workDir = node.context().pdsFolderResolver().fileTree().nodeStorage();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
import org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.dumpprocessors.ToFileDumpProcessor;
import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
import org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.DataStreamerUpdatesHandler;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager;
import org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotPartitionsVerifyTaskResult;
Expand Down Expand Up @@ -328,10 +329,7 @@ private File startGridAndPutNodeToMaintenance(CacheConfiguration[] cachesToStart
IgniteEx ig0 = startGrid(0);
IgniteEx ig1 = startGrid(1);

String ig1Folder = ig1.context().pdsFolderResolver().resolveFolders().folderName();
File dbDir = U.resolveWorkDirectory(ig1.configuration().getWorkDirectory(), "db", false);

File ig1LfsDir = new File(dbDir, ig1Folder);
NodeFileTree ft1 = ig1.context().pdsFolderResolver().fileTree();

ig0.cluster().baselineAutoAdjustEnabled(false);
ig0.cluster().state(ACTIVE);
Expand Down Expand Up @@ -362,7 +360,7 @@ private File startGridAndPutNodeToMaintenance(CacheConfiguration[] cachesToStart

stopGrid(1);

File[] cpMarkers = new File(ig1LfsDir, "cp").listFiles();
File[] cpMarkers = ft1.checkpoint().listFiles();

for (File cpMark : cpMarkers) {
if (cpMark.getName().contains("-END"))
Expand All @@ -371,7 +369,7 @@ private File startGridAndPutNodeToMaintenance(CacheConfiguration[] cachesToStart

assertThrows(log, () -> startGrid(1), Exception.class, null);

return ig1LfsDir;
return ft1.nodeStorage();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private PersistenceTaskResult backup(PersistenceTaskArg arg) {
MaintenanceRegistry mntcReg = ignite.context().maintenanceRegistry();
MaintenanceTask task = mntcReg.activeMaintenanceTask(CORRUPTED_DATA_FILES_MNTC_TASK_NAME);

File workDir = ((FilePageStoreManager)ignite.context().cache().context().pageStore()).workDir();
File workDir = ignite.context().pdsFolderResolver().fileTree().nodeStorage();

if (arg instanceof PersistenceBackupAllTaskArg)
return backupAll(workDir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@ private DataRegionConfiguration createDefragmentationMappingRegionConfig(long re
kernalCtx.cache(),
() -> cpFreqDeviation.getOrDefault(DEFAULT_CHECKPOINT_DEVIATION),
kernalCtx.pools().getSystemExecutorService(),
kernalCtx.marshallerContext().jdkMarshaller()
kernalCtx.marshallerContext().jdkMarshaller(),
kernalCtx.pdsFolderResolver().fileTree()
);

final NodeFileLockHolder preLocked = kernalCtx.pdsFolderResolver()
Expand Down Expand Up @@ -745,8 +746,9 @@ private void acquireFileLock(NodeFileLockHolder preLocked) throws IgniteCheckedE
if (cctx.kernalContext().clientNode())
return;

fileLockHolder = preLocked == null ?
new NodeFileLockHolder(storeMgr.workDir().getPath(), cctx.kernalContext(), log) : preLocked;
fileLockHolder = preLocked == null
? new NodeFileLockHolder(cctx.kernalContext().pdsFolderResolver().fileTree().nodeStorage().getPath(), cctx.kernalContext(), log)
: preLocked;

if (!fileLockHolder.isLocked()) {
if (log.isDebugEnabled())
Expand Down Expand Up @@ -1314,7 +1316,9 @@ else if (regCfg.getPageEvictionMode() != DataPageEvictionMode.DISABLED) {
"Invalid page store manager was created: " + cctx.pageStore();

Path anyIdxPartFile = IgniteUtils.searchFileRecursively(
((FilePageStoreManager)cctx.pageStore()).workDir().toPath(), FilePageStoreManager.INDEX_FILE_NAME);
cctx.kernalContext().pdsFolderResolver().fileTree().nodeStorage().toPath(),
FilePageStoreManager.INDEX_FILE_NAME
);

if (anyIdxPartFile != null) {
memCfg.setPageSize(resolvePageSizeFromPartitionFile(anyIdxPartFile));
Expand Down Expand Up @@ -1839,13 +1843,6 @@ private Map<Integer, Set<Integer>> partitionsApplicableForWalRebalance() {
return lastCheckpointEntry == null ? null : lastCheckpointEntry.checkpointMark();
}

/**
* @return Checkpoint directory.
*/
public File checkpointDirectory() {
return checkpointManager.checkpointDirectory();
}

/**
* @param lsnr Listener.
* @param dataRegion Data region for which listener is corresponded to.
Expand Down Expand Up @@ -1889,10 +1886,8 @@ private CheckpointStatus readCheckpointStatus() throws IgniteCheckedException {
if (mntcTask != null) {
log.warning("Maintenance task found, stop restoring memory");

File workDir = ((FilePageStoreManager)cctx.pageStore()).workDir();

mntcRegistry.registerWorkflowCallback(CORRUPTED_DATA_FILES_MNTC_TASK_NAME,
new CorruptedPdsMaintenanceCallback(workDir,
new CorruptedPdsMaintenanceCallback(cctx.kernalContext().pdsFolderResolver().fileTree().nodeStorage(),
Arrays.asList(mntcTask.parameters().split(Pattern.quote(File.separator))))
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.ignite.internal.processors.cache.persistence.checkpoint;

import java.io.File;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Collection;
Expand All @@ -38,6 +37,7 @@
import org.apache.ignite.internal.processors.cache.persistence.DataStorageMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
import org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryEx;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl;
import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer;
Expand Down Expand Up @@ -108,7 +108,7 @@ public class CheckpointManager {
* @param cpFreqDeviation Distributed checkpoint frequency deviation.
* @param checkpointMapSnapshotExecutor Checkpoint map snapshot executor.
* @param marsh JDK marshaller.
* @throws IgniteCheckedException if fail.
* @param ft Node file tree.
*/
public CheckpointManager(
Function<Class<?>, IgniteLogger> logger,
Expand All @@ -129,8 +129,9 @@ public CheckpointManager(
GridCacheProcessor cacheProcessor,
Supplier<Integer> cpFreqDeviation,
Executor checkpointMapSnapshotExecutor,
JdkMarshaller marsh
) throws IgniteCheckedException {
JdkMarshaller marsh,
NodeFileTree ft
) {
CheckpointHistory cpHistory = new CheckpointHistory(
persistenceCfg,
logger,
Expand All @@ -147,7 +148,7 @@ public CheckpointManager(
logger,
cpHistory,
ioFactory,
pageStoreManager.workDir().getAbsolutePath(),
ft,
lock,
checkpointMapSnapshotExecutor,
marsh
Expand Down Expand Up @@ -259,13 +260,6 @@ public void memoryRecoveryRecordPtr(WALPointer memoryRecoveryRecordPtr) {
checkpointWorkflow.memoryRecoveryRecordPtr(memoryRecoveryRecordPtr);
}

/**
* @return Checkpoint directory.
*/
public File checkpointDirectory() {
return checkpointMarkersStorage.cpDir;
}

/**
* @return Checkpoint storage.
*/
Expand Down
Loading