Skip to content

Commit

Permalink
GG-22513 [GG-21485] [IGNITE-10522] Fix checkpoint tmp files doesn't n…
Browse files Browse the repository at this point in the history
…ot removed on start node - Fixes apache#5571.

Signed-off-by: Dmitriy Govorukhin <dmitriy.govorukhin@gmail.com>

(cherry picked from commit 472889d)
(cherry picked from commit 0e3f89c)
  • Loading branch information
akalash authored and antonovsergey93 committed Aug 27, 2019
1 parent 9b0719e commit 7b0851c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
import static org.apache.ignite.internal.LongJVMPauseDetector.DEFAULT_JVM_PAUSE_DETECTOR_THRESHOLD;
import static org.apache.ignite.internal.pagemem.PageIdUtils.partId;
import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.CHECKPOINT_RECORD;
import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.TMP_FILE_MATCHER;
import static org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.fromOrdinal;
import static org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO.getType;
import static org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO.getVersion;
Expand Down Expand Up @@ -575,10 +576,7 @@ private DataRegionConfiguration createMetastoreDataRegionConfig(DataStorageConfi
*/
public void cleanupTempCheckpointDirectory() throws IgniteCheckedException {
try {
try (DirectoryStream<Path> files = Files.newDirectoryStream(
cpDir.toPath(),
path -> path.endsWith(FilePageStoreManager.TMP_SUFFIX))
) {
try (DirectoryStream<Path> files = Files.newDirectoryStream(cpDir.toPath(), TMP_FILE_MATCHER::matches)) {
for (Path path : files)
Files.delete(path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -126,6 +128,10 @@ public class FilePageStoreManager extends GridCacheSharedManagerAdapter implemen
/** */
public static final String META_STORAGE_NAME = "metastorage";

/** Matcher for searching of *.tmp files. */
public static final PathMatcher TMP_FILE_MATCHER =
FileSystems.getDefault().getPathMatcher("glob:**" + TMP_SUFFIX);

/** Marshaller. */
private static final Marshaller marshaller = new JdkMarshaller();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3545,7 +3545,7 @@ public static boolean delete(Path path) {
}
}

if (path.endsWith("jar")) {
if (path.toFile().getName().endsWith("jar")) {
try {
// Why do we do this?
new JarFile(path.toString(), false).close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.ignite.testframework.junits;

import javax.cache.configuration.Factory;
import javax.cache.configuration.FactoryBuilder;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.lang.reflect.Field;
Expand All @@ -41,8 +43,6 @@
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import javax.cache.configuration.Factory;
import javax.cache.configuration.FactoryBuilder;
import junit.framework.TestCase;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
Expand Down

0 comments on commit 7b0851c

Please sign in to comment.