Merge branch 'cassandra-2.2' into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/4cf97f42 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/4cf97f42 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/4cf97f42 Branch: refs/heads/cassandra-3.0 Commit: 4cf97f4241e134bd820b4add4132e2e7b6243941 Parents: 1c27abf cd46ca1 Author: Aleksey Yeschenko <alek...@apache.org> Authored: Fri Aug 21 16:44:10 2015 +0300 Committer: Aleksey Yeschenko <alek...@apache.org> Committed: Fri Aug 21 16:44:10 2015 +0300 ---------------------------------------------------------------------- src/java/org/apache/cassandra/service/StartupChecks.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/4cf97f42/src/java/org/apache/cassandra/service/StartupChecks.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/service/StartupChecks.java index 1c07b52,4934dea..eca0c7e --- a/src/java/org/apache/cassandra/service/StartupChecks.java +++ b/src/java/org/apache/cassandra/service/StartupChecks.java @@@ -179,30 -179,33 +179,30 @@@ public class StartupCheck } }; - public static final StartupCheck checkDataDirs = new StartupCheck() + public static final StartupCheck checkDataDirs = () -> { - public void execute() throws StartupException + // check all directories(data, commitlog, saved cache) for existence and permission + Iterable<String> dirs = Iterables.concat(Arrays.asList(DatabaseDescriptor.getAllDataFileLocations()), + Arrays.asList(DatabaseDescriptor.getCommitLogLocation(), + DatabaseDescriptor.getSavedCachesLocation(), + DatabaseDescriptor.getHintsDirectory().getAbsolutePath())); + for (String dataDir : dirs) { - // check all directories(data, commitlog, saved cache) for existence and permission - Iterable<String> dirs = Iterables.concat(Arrays.asList(DatabaseDescriptor.getAllDataFileLocations()), - Arrays.asList(DatabaseDescriptor.getCommitLogLocation(), - DatabaseDescriptor.getSavedCachesLocation())); - for (String dataDir : dirs) - { - logger.debug("Checking directory {}", dataDir); - File dir = new File(dataDir); - - // check that directories exist. - if (!dir.exists()) - { - logger.warn("Directory {} doesn't exist", dataDir); - // if they don't, failing their creation, stop cassandra. - if (!dir.mkdirs()) - throw new StartupException(3, "Has no permission to create directory "+ dataDir); - } - - // if directories exist verify their permissions - if (!Directories.verifyFullPermissions(dir, dataDir)) - throw new StartupException(3, "Insufficient permissions on directory " + dataDir); + logger.debug("Checking directory {}", dataDir); + File dir = new File(dataDir); + // check that directories exist. + if (!dir.exists()) + { - logger.error("Directory {} doesn't exist", dataDir); ++ logger.warn("Directory {} doesn't exist", dataDir); + // if they don't, failing their creation, stop cassandra. + if (!dir.mkdirs()) + throw new StartupException(3, "Has no permission to create directory "+ dataDir); } + + // if directories exist verify their permissions + if (!Directories.verifyFullPermissions(dir, dataDir)) + throw new StartupException(3, "Insufficient permissions on directory " + dataDir); } };