Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-13359: Make UpdateHandler support other prefixes (besides hdfs:/)

Kevin Risdena99cec040229
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b98b6403d5a..1b1a5415b92 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -102,8 +102,6 @@ New Features
a back-compat check of the .system collection to notify users of potential compatibility issues after
upgrades or schema changes. (ab)
-* SOLR-11473: Make HDFSDirectoryFactory support other prefixes (besides hdfs:/) (Kevin Risden)
-
Bug Fixes
----------------------
@@ -160,6 +158,10 @@ Improvements
* SOLR-9079: Remove commons-lang as a dependency (Kevin Risden)
+* SOLR-11473: Make HDFSDirectoryFactory support other prefixes (besides hdfs:/) (Kevin Risden)
+
+* SOLR-13359: Make UpdateHandler support other prefixes (besides hdfs:/) (Kevin Risden)
+
Other Changes
----------------------
diff --git a/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java b/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java
index 50e7a0c9014..2235f058a32 100644
--- a/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java
+++ b/solr/core/src/java/org/apache/solr/update/HdfsUpdateLog.java
@@ -58,7 +58,7 @@ public class HdfsUpdateLog extends UpdateLog {
public static AtomicLong INIT_FAILED_LOGS_COUNT = new AtomicLong();
public HdfsUpdateLog() {
- this.confDir = null;
+ this(null);
}
public HdfsUpdateLog(String confDir) {
diff --git a/solr/core/src/java/org/apache/solr/update/UpdateHandler.java b/solr/core/src/java/org/apache/solr/update/UpdateHandler.java
index ff94bfc547e..c8dbc10568c 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateHandler.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateHandler.java
@@ -16,7 +16,6 @@
*/
package org.apache.solr.update;
-
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.Set;
@@ -43,7 +42,6 @@ import org.slf4j.LoggerFactory;
*
* @since solr 0.9
*/
-
public abstract class UpdateHandler implements SolrInfoBean {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -123,47 +121,27 @@ public abstract class UpdateHandler implements SolrInfoBean {
parseEventListeners();
PluginInfo ulogPluginInfo = core.getSolrConfig().getPluginInfo(UpdateLog.class.getName());
-
// If this is a replica of type PULL, don't create the update log
boolean skipUpdateLog = core.getCoreDescriptor().getCloudDescriptor() != null && !core.getCoreDescriptor().getCloudDescriptor().requiresTransactionLog();
if (updateLog == null && ulogPluginInfo != null && ulogPluginInfo.isEnabled() && !skipUpdateLog) {
- String dataDir = (String)ulogPluginInfo.initArgs.get("dir");
-
- String ulogDir = core.getCoreDescriptor().getUlogDir();
- if (ulogDir != null) {
- dataDir = ulogDir;
- }
- if (dataDir == null || dataDir.length()==0) {
- dataDir = core.getDataDir();
- }
-
- if (dataDir != null && dataDir.startsWith("hdfs:/")) {
- DirectoryFactory dirFactory = core.getDirectoryFactory();
- if (dirFactory instanceof HdfsDirectoryFactory) {
- ulog = new HdfsUpdateLog(((HdfsDirectoryFactory)dirFactory).getConfDir());
- } else {
- ulog = new HdfsUpdateLog();
- }
-
+ DirectoryFactory dirFactory = core.getDirectoryFactory();
+ if (dirFactory instanceof HdfsDirectoryFactory) {
+ ulog = new HdfsUpdateLog(((HdfsDirectoryFactory)dirFactory).getConfDir());
} else {
String className = ulogPluginInfo.className == null ? UpdateLog.class.getName() : ulogPluginInfo.className;
ulog = core.getResourceLoader().newInstance(className, UpdateLog.class);
}
- if (!core.isReloaded() && !core.getDirectoryFactory().isPersistent()) {
+ if (!core.isReloaded() && !dirFactory.isPersistent()) {
ulog.clearLog(core, ulogPluginInfo);
}
log.info("Using UpdateLog implementation: " + ulog.getClass().getName());
-
ulog.init(ulogPluginInfo);
-
ulog.init(this, core);
} else {
ulog = updateLog;
}
- // ulog.init() when reusing an existing log is deferred (currently at the end of the DUH2 constructor
-
}
/**