You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2017/12/14 07:58:12 UTC

[5/5] lucene-solr:jira/solr-11702: SOLR-11702: Improve error handling for ZkShardTerms

SOLR-11702: Improve error handling for ZkShardTerms


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

Branch: refs/heads/jira/solr-11702
Commit: f881a62a65f8230f97167142a32180e8c52ef7b9
Parents: e80554a
Author: Cao Manh Dat <da...@apache.org>
Authored: Thu Dec 14 14:56:19 2017 +0700
Committer: Cao Manh Dat <da...@apache.org>
Committed: Thu Dec 14 14:56:19 2017 +0700

----------------------------------------------------------------------
 solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f881a62a/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java b/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java
index 0a4cb9e..15e8c61 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java
@@ -181,7 +181,7 @@ public class ZkShardTerms implements AutoCloseable{
     } catch (NoSuchElementException e) {
       throw e;
     } catch (Exception e) {
-      e.printStackTrace();
+      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Error save shard term for collection:" + collection, e);
     }
     return false;
   }
@@ -228,8 +228,11 @@ public class ZkShardTerms implements AutoCloseable{
       version = data.getVersion();
       terms = (Map<String, Long>) Utils.fromJSON(data.getData());
       onTermUpdates();
-    } catch (Exception e) {
-      e.printStackTrace();
+    } catch (InterruptedException e) {
+      Thread.interrupted();
+      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Error updating shard term for collection:" + collection, e);
+    } catch (IOException | KeeperException e) {
+      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Error updating shard term for collection:" + collection, e);
     }
   }