You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dg...@apache.org on 2019/08/16 11:47:18 UTC
[ignite] branch ignite-2.7.6 updated: IGNITE-12057 Fixed
persistence files are stored to temp dir
This is an automated email from the ASF dual-hosted git repository.
dgovorukhin pushed a commit to branch ignite-2.7.6
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/ignite-2.7.6 by this push:
new 2a6e62c IGNITE-12057 Fixed persistence files are stored to temp dir
2a6e62c is described below
commit 2a6e62c72ffa0474152020d31cbccce87bbf2824
Author: Anton Kalashnikov <ka...@yandex.ru>
AuthorDate: Fri Aug 16 14:43:24 2019 +0300
IGNITE-12057 Fixed persistence files are stored to temp dir
(cherry picked from commit e95c7b1)
---
.../java/org/apache/ignite/internal/IgnitionEx.java | 7 ++++++-
.../org/apache/ignite/internal/util/IgniteUtils.java | 18 ++++++++++++------
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 1e56cde..0418921 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -2172,8 +2172,10 @@ public class IgnitionEx {
// If user provided IGNITE_HOME - set it as a system property.
U.setIgniteHome(ggHome);
+ String userProvidedWorkDir = cfg.getWorkDirectory();
+
// Correctly resolve work directory and set it back to configuration.
- String workDir = U.workDirectory(cfg.getWorkDirectory(), ggHome);
+ String workDir = U.workDirectory(userProvidedWorkDir, ggHome);
myCfg.setWorkDirectory(workDir);
@@ -2197,6 +2199,9 @@ public class IgnitionEx {
myCfg.setGridLogger(cfgLog);
+ if(F.isEmpty(userProvidedWorkDir) && F.isEmpty(U.IGNITE_WORK_DIR))
+ log.warning("Ignite work directory is not provided, automatically resolved to: " + workDir);
+
// Check Ignite home folder (after log is available).
if (ggHome != null) {
File ggHomeFile = new File(ggHome);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 846d46b..9a547b5 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -329,6 +329,9 @@ public abstract class IgniteUtils {
/** Secure socket protocol to use. */
private static final String HTTPS_PROTOCOL = "TLS";
+ /** Default working directory name. */
+ private static final String DEFAULT_WORK_DIR = "work";
+
/** Correct Mbean cache name pattern. */
private static Pattern MBEAN_CACHE_NAME_PATTERN = Pattern.compile("^[a-zA-Z_0-9]+$");
@@ -9342,15 +9345,18 @@ public abstract class IgniteUtils {
else if (!F.isEmpty(IGNITE_WORK_DIR))
workDir = new File(IGNITE_WORK_DIR);
else if (!F.isEmpty(userIgniteHome))
- workDir = new File(userIgniteHome, "work");
+ workDir = new File(userIgniteHome, DEFAULT_WORK_DIR);
else {
- String tmpDirPath = System.getProperty("java.io.tmpdir");
+ String userDir = System.getProperty("user.dir");
- if (tmpDirPath == null)
- throw new IgniteCheckedException("Failed to create work directory in OS temp " +
- "(property 'java.io.tmpdir' is null).");
+ if (F.isEmpty(userDir))
+ throw new IgniteCheckedException(
+ "Failed to resolve Ignite work directory. Either IgniteConfiguration.setWorkDirectory or " +
+ "one of the system properties (" + IGNITE_HOME + ", " +
+ IgniteSystemProperties.IGNITE_WORK_DIR + ") must be explicitly set."
+ );
- workDir = new File(tmpDirPath, "ignite" + File.separator + "work");
+ workDir = new File(userDir, DEFAULT_WORK_DIR);
}
if (!workDir.isAbsolute())