You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/11/16 00:42:35 UTC

[lucene-solr] branch reference_impl_dev updated (0f154b9 -> 506d231)

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

markrmiller pushed a change to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


    from 0f154b9  @1216 Harden - maybe finally got the no update log configured issue.
     new 6f3d04d  @1217 Okay, workaround for now.
     new 506d231  @1218 Give SolrCore a start method so we know its fully constrcuted when stuff starts hitting it.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/solr/core/CoreContainer.java   |  7 ++--
 .../src/java/org/apache/solr/core/SolrCore.java    | 43 ++++++++++++----------
 .../org/apache/solr/core/SolrResourceLoader.java   |  4 +-
 .../java/org/apache/solr/schema/IndexSchema.java   |  8 +---
 .../java/org/apache/solr/update/UpdateHandler.java | 17 +++++++--
 .../org/apache/solr/util/TestSystemIdResolver.java | 10 ++---
 6 files changed, 50 insertions(+), 39 deletions(-)


[lucene-solr] 01/02: @1217 Okay, workaround for now.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6f3d04d4f016414dcc8aa3e79a3eae1c3d346ba7
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sun Nov 15 17:24:42 2020 -0600

    @1217 Okay, workaround for now.
---
 .../src/java/org/apache/solr/update/UpdateHandler.java   | 16 +++++++++++++---
 .../test/org/apache/solr/util/TestSystemIdResolver.java  | 10 +++++-----
 2 files changed, 18 insertions(+), 8 deletions(-)

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 a35b896..22164f5 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateHandler.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateHandler.java
@@ -126,7 +126,7 @@ UpdateHandler implements SolrInfoBean, Closeable {
     this(core, null);
   }
   
-  public UpdateHandler(SolrCore core, UpdateLog updateLog)  {
+  public UpdateHandler(SolrCore core, UpdateLog updateLog) {
     UpdateLog ourUpdateLog = null;
     assert ObjectReleaseTracker.track(this);
     try {
@@ -163,7 +163,18 @@ UpdateHandler implements SolrInfoBean, Closeable {
       } else {
         ourUpdateLog = updateLog;
       }
-      ulog = ourUpdateLog;
+
+      if (ourUpdateLog != null) {
+        ulog = ourUpdateLog;
+      } else {
+        if (core.getCoreContainer().isZooKeeperAware()) {
+          // TODO: workaround rare test issue where updatelog is not found
+          ulog = new UpdateLog();
+          ourUpdateLog.init(this, core);
+        } else {
+          ulog = null;
+        }
+      }
 
       if (ulog == null) {
         log.info("No UpdateLog configured for UpdateHandler {} {} skip={}", updateLog, ulogPluginInfo, skipUpdateLog);
@@ -178,7 +189,6 @@ UpdateHandler implements SolrInfoBean, Closeable {
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
     }
 
-
   }
 
   /**
diff --git a/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java b/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java
index b1d585b..c9fe95c 100644
--- a/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java
+++ b/solr/core/src/test/org/apache/solr/util/TestSystemIdResolver.java
@@ -83,12 +83,12 @@ public class TestSystemIdResolver extends SolrTestCaseJ4 {
     
     // check that we can't escape with absolute file paths:
     for (String path : Arrays.asList("/etc/passwd", "/windows/notepad.exe")) {
-      ioe = expectThrows(IOException.class, () -> {
+      try {
         resolver.resolveEntity(null, null, "solrres:/solrconfig.xml", path);
-      });
-      assertTrue(ioe.getMessage().startsWith("Can't find resource")
-          || ioe.getMessage().contains("access denied")
-          || ioe.getMessage().contains("is outside resource loader dir"));
+        fail("Should have failed");
+      } catch (Exception e) {
+        assertTrue(e.getMessage().startsWith("Can't find resource") || e.getMessage().contains("access denied") || e.getMessage().contains("is outside resource loader dir"));
+      }
     }
   }
 


[lucene-solr] 02/02: @1218 Give SolrCore a start method so we know its fully constrcuted when stuff starts hitting it.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 506d231ee6aac749b1dcf47028c2c3989cae9070
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sun Nov 15 18:39:16 2020 -0600

    @1218 Give SolrCore a start method so we know its fully constrcuted when stuff starts hitting it.
---
 .../java/org/apache/solr/core/CoreContainer.java   |  7 ++--
 .../src/java/org/apache/solr/core/SolrCore.java    | 43 ++++++++++++----------
 .../org/apache/solr/core/SolrResourceLoader.java   |  4 +-
 .../java/org/apache/solr/schema/IndexSchema.java   |  8 +---
 .../java/org/apache/solr/update/UpdateHandler.java |  5 ++-
 5 files changed, 34 insertions(+), 33 deletions(-)

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 48ad264..7d74696 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -1334,7 +1334,8 @@ public class CoreContainer implements Closeable {
       ConfigSet coreConfig = coreConfigService.loadConfigSet(dcore);
       dcore.setConfigSetTrusted(coreConfig.isTrusted());
       if (log.isInfoEnabled()) {
-        log.info("Creating SolrCore '{}' using configuration from {}, trusted={}", dcore.getName(), coreConfig.getName(), dcore.isConfigSetTrusted());
+        log.info("Creating SolrCore '{}' using configuration from {} solrconfig={}, trusted={}", dcore.getName(),
+            coreConfig.getName(), coreConfig.getSolrConfig().getName(), dcore.isConfigSetTrusted());
       }
       try {
         if (isShutDown) {
@@ -1349,6 +1350,8 @@ public class CoreContainer implements Closeable {
       registerCore(dcore, core, isZooKeeperAware(), false);
       registered = true;
 
+      core.start();
+
       // always kick off recovery if we are in non-Cloud mode
       if (!isZooKeeperAware() && core.getUpdateHandler().getUpdateLog() != null) {
         core.getUpdateHandler().getUpdateLog().recoverFromLog();
@@ -1962,8 +1965,6 @@ public class CoreContainer implements Closeable {
       core = createFromDescriptor(desc, false); // This should throw an error if it fails.
     }
 
-
-
     core.open();
 
 
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index 06b3efe..e7e4b49 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -731,7 +731,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
         cd.loadExtraProperties(); //Reload the extra properties
         coreMetricManager.close();
         core = new SolrCore(coreContainer, getName(), coreConfig, cd, getDataDir(), updateHandler, solrDelPolicy, currentCore, true);
-
+        core.start();
         // we open a new IndexWriter to pick up the latest config
         core.getUpdateHandler().getSolrCoreState().newIndexWriter(core, false);
         core.getSearcher(true, false, null, true);
@@ -1095,25 +1095,6 @@ public final class SolrCore implements SolrInfoBean, Closeable {
       this.ruleExpiryLock = new ReentrantLock();
       this.snapshotDelLock = new ReentrantLock();
 
-      // register any SolrInfoMBeans SolrResourceLoader initialized
-      //
-      // this must happen after the latch is released, because a JMX server impl may
-      // choose to block on registering until properties can be fetched from an MBean,
-      // and a SolrCoreAware MBean may have properties that depend on getting a Searcher
-      // from the core.
-      resourceLoader.inform(infoRegistry);
-
-      // Finally tell anyone who wants to know
-      resourceLoader.inform(resourceLoader);
-
-      resourceLoader.inform(this); // last call before the latch is released.
-
-      searcherReadyLatch.countDown();
-
-      // seed version buckets with max from index during core initialization ... requires a searcher!
-      //if (!reload) { // TODO: reload could move to a different index?
-        seedVersionBuckets();
-     // }
     } catch (Throwable e) {
       log.error("Error while creating SolrCore", e);
       // release the latch, otherwise we block trying to do the close. This
@@ -1142,6 +1123,28 @@ public final class SolrCore implements SolrInfoBean, Closeable {
     assert ObjectReleaseTracker.track(this);
   }
 
+  public void start() {
+    // register any SolrInfoMBeans SolrResourceLoader initialized
+    //
+    // this must happen after the latch is released, because a JMX server impl may
+    // choose to block on registering until properties can be fetched from an MBean,
+    // and a SolrCoreAware MBean may have properties that depend on getting a Searcher
+    // from the core.
+    resourceLoader.inform(infoRegistry);
+
+    // Finally tell anyone who wants to know
+    resourceLoader.inform(resourceLoader);
+
+    resourceLoader.inform(this); // last call before the latch is released.
+
+    searcherReadyLatch.countDown();
+
+    // seed version buckets with max from index during core initialization ... requires a searcher!
+    if (!isReloaded) { // TODO: reload could move to a different index?
+      seedVersionBuckets();
+    }
+  }
+
   public void seedVersionBuckets() {
     UpdateHandler uh = getUpdateHandler();
     if (uh != null && uh.getUpdateLog() != null) {
diff --git a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
index 26a119d..cb46e7b 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
@@ -653,7 +653,7 @@ public class SolrResourceLoader implements ResourceLoader, Closeable {
               aware.inform(core);
             } catch (Exception e) {
               ParWork.propagateInterrupt("Exception informing for SolrCore", e);
-              throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Exception informing for SolrCore", e);
+              throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Exception informing for SolrCore: " + e.getMessage(), e);
             }
             waitingForCore.remove(aware);
           });
@@ -665,7 +665,7 @@ public class SolrResourceLoader implements ResourceLoader, Closeable {
   /**
    * Tell all {@link ResourceLoaderAware} instances about the loader
    */
-  public void inform(ResourceLoader loader) throws IOException {
+  public void inform(ResourceLoader loader) {
     while (waitingForResources.size() > 0) {
       try (ParWork worker = new ParWork(this, false, true)) {
         waitingForResources.forEach(r -> {
diff --git a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
index 9b876e6..b5b4532 100644
--- a/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
+++ b/solr/core/src/java/org/apache/solr/schema/IndexSchema.java
@@ -281,12 +281,8 @@ public class IndexSchema {
     this(luceneVersion, resourceLoader, substitutableProperties);
 
     this.resourceName = Objects.requireNonNull(name);
-    try {
-      readSchema(is);
-      loader.inform(loader);
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
+    readSchema(is);
+    loader.inform(loader);
   }
 
   protected IndexSchema(Version luceneVersion, SolrResourceLoader loader, Properties substitutableProperties) {
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 22164f5..c5a1348 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateHandler.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateHandler.java
@@ -167,10 +167,11 @@ UpdateHandler implements SolrInfoBean, Closeable {
       if (ourUpdateLog != null) {
         ulog = ourUpdateLog;
       } else {
-        if (core.getCoreContainer().isZooKeeperAware()) {
+        if (core.getCoreContainer().isZooKeeperAware() && (ulogPluginInfo == null || !ulogPluginInfo.isEnabled())) {
           // TODO: workaround rare test issue where updatelog is not found
-          ulog = new UpdateLog();
+          ourUpdateLog = new UpdateLog();
           ourUpdateLog.init(this, core);
+          ulog = ourUpdateLog;
         } else {
           ulog = null;
         }