You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by va...@apache.org on 2016/08/21 19:40:18 UTC

lucene-solr:branch_6x: SOLR-9428: Improve logging to log root cause

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 8aab2d2e5 -> 141ccdefd


SOLR-9428: Improve logging to log root cause


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/141ccdef
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/141ccdef
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/141ccdef

Branch: refs/heads/branch_6x
Commit: 141ccdefd0902a2ce6f66073e76782607b75a968
Parents: 8aab2d2
Author: Varun Thacker <va...@apache.org>
Authored: Mon Aug 22 01:08:36 2016 +0530
Committer: Varun Thacker <va...@apache.org>
Committed: Mon Aug 22 01:09:50 2016 +0530

----------------------------------------------------------------------
 .../java/org/apache/solr/rest/ManagedResourceStorage.java   | 9 +++++----
 .../java/org/apache/solr/common/cloud/ZkStateReader.java    | 6 ++----
 2 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/141ccdef/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java b/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java
index 230bf44..9db2fd2 100644
--- a/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java
+++ b/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java
@@ -84,7 +84,7 @@ public abstract class ManagedResourceStorage {
    * whether the core is running in cloud mode as well as initArgs. 
    */
   public static StorageIO newStorageIO(String collection, SolrResourceLoader resourceLoader, NamedList<String> initArgs) {
-    StorageIO storageIO = null;
+    StorageIO storageIO;
 
     SolrZkClient zkClient = null;
     String zkConfigName = null;
@@ -94,9 +94,10 @@ public abstract class ManagedResourceStorage {
         zkConfigName = ((ZkSolrResourceLoader)resourceLoader).getZkController().
             getZkStateReader().readConfigName(collection);
       } catch (Exception e) {
-        log.error("Failed to get config name for collection {} due to: {}", 
-            collection, e.toString());
-      } 
+        log.error("Failed to get config name due to", e);
+        throw new SolrException(ErrorCode.SERVER_ERROR,
+            "Failed to load config name for collection:" + collection  + " due to: ", e);
+      }
       if (zkConfigName == null) {
         throw new SolrException(ErrorCode.SERVER_ERROR, 
             "Could not find config name for collection:" + collection);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/141ccdef/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index a3de324..b89da93 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -192,10 +192,8 @@ public class ZkStateReader implements Closeable {
       } else {
         throw new ZooKeeperException(ErrorCode.INVALID_STATE, "No config data found at path: " + path);
       }
-    } catch (KeeperException e) {
-      throw new SolrException(ErrorCode.SERVER_ERROR, "Error loading config name for collection " + collection, e);
-    } catch (InterruptedException e) {
-      Thread.currentThread().interrupt();
+    } catch (KeeperException| InterruptedException e) {
+      SolrZkClient.checkInterrupted(e);
       throw new SolrException(ErrorCode.SERVER_ERROR, "Error loading config name for collection " + collection, e);
     }