You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kr...@apache.org on 2019/03/30 19:46:03 UTC

[lucene-solr] 01/01: SOLR-13359: Make UpdateHandler support other prefixes (besides hdfs:/)

This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch jira/solr-13359
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit d8ead4d70e19ef2c997907fa77d7ae7721c4c083
Author: Kevin Risden <kr...@apache.org>
AuthorDate: Sat Mar 30 15:45:36 2019 -0400

    SOLR-13359: Make UpdateHandler support other prefixes (besides hdfs:/)
    
    Signed-off-by: Kevin Risden <kr...@apache.org>
---
 solr/CHANGES.txt                                   |  6 +++--
 .../java/org/apache/solr/update/HdfsUpdateLog.java |  2 +-
 .../java/org/apache/solr/update/UpdateHandler.java | 30 +++-------------------
 3 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b98b640..1b1a541 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 50e7a0c..2235f05 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 ff94bfc..c8dbc10 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
-
   }
 
   /**