Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-15222: userfiles dir will only be created in SolrCloud mode (#121)

Mike Drobf94d3471c3d5
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 7a5cd5ca81b..cccc19323e0 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -287,6 +287,8 @@ Other Changes
* SOLR-15369: PackageStoreAPI will only be loaded in SolrCloud mode (Mike Drob)
+* SOLR-15222: userfiles dir will only be created in SolrCloud mode (Mike Drob)
+
Bug Fixes
---------------------
* SOLR-14546: Fix for a relatively hard to hit issue in OverseerTaskProcessor that could lead to out of order execution
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index a47dc9bbfdb..998a8229afc 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -409,13 +409,6 @@ public class CoreContainer {
this.allowPaths = allowPathBuilder.build();
this.allowListUrlChecker = AllowListUrlChecker.create(config);
-
- Path userFilesPath = getUserFilesPath(); // TODO make configurable on cfg?
- try {
- Files.createDirectories(userFilesPath); // does nothing if already exists
- } catch (Exception e) {
- log.warn("Unable to create [{}]. Features requiring this directory may fail.", userFilesPath, e);
- }
}
@SuppressWarnings({"unchecked"})
@@ -873,6 +866,8 @@ public class CoreContainer {
metricManager.loadClusterReporters(metricReporters, this);
}
+ // Do this before cores get created
+ createUserFilesDirectory();
// setup executor to load cores in parallel
ExecutorService coreLoadExecutor = MetricUtils.instrumentedExecutorService(
@@ -982,6 +977,17 @@ public class CoreContainer {
status |= LOAD_COMPLETE | INITIAL_CORE_LOAD_COMPLETE;
}
+ private void createUserFilesDirectory() {
+ if (isZooKeeperAware()) {
+ Path userFilesPath = getUserFilesPath(); // TODO make configurable on cfg?
+ try {
+ Files.createDirectories(userFilesPath); // does nothing if already exists
+ } catch (Exception e) {
+ log.warn("Unable to create [{}]. Features requiring this directory may fail.", userFilesPath, e);
+ }
+ }
+ }
+
// MetricsHistoryHandler supports both cloud and standalone configs
@SuppressWarnings({"unchecked"})
private void createMetricsHistoryHandler() {