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

Signed-off-by: Kevin Risden <krisden@apache.org>
This commit is contained in:
Kevin Risden 2019-03-30 15:45:36 -04:00
parent 1204d212d1
commit a99cec0402
No known key found for this signature in database
GPG Key ID: 040FAE3292C5F73F
3 changed files with 9 additions and 29 deletions

View File

@ -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
----------------------

View File

@ -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) {

View File

@ -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
}
/**