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/09/16 13:33:56 UTC

lucene-solr:branch_6x: SOLR-9522: Improve error handling in ZKPropertiesWriter

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 8352ff21c -> f728a646f


SOLR-9522: Improve error handling in ZKPropertiesWriter


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

Branch: refs/heads/branch_6x
Commit: f728a646f388733cfb57f8d4d9a0d9217f42fd38
Parents: 8352ff2
Author: Varun Thacker <va...@apache.org>
Authored: Fri Sep 16 18:47:06 2016 +0530
Committer: Varun Thacker <va...@apache.org>
Committed: Fri Sep 16 19:03:37 2016 +0530

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  2 ++
 .../handler/dataimport/ZKPropertiesWriter.java  | 20 +++++++-------------
 2 files changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f728a646/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index e841845..d4a1ae5 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -102,6 +102,8 @@ Bug Fixes
 * SOLR-9507: CoreContainer threads now correctly set their MDC logging values
   (Alan Woodward)
 
+* SOLR-9522: Improve error handling in ZKPropertiesWriter (Varun Thacker)
+
 Optimizations
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f728a646/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ZKPropertiesWriter.java
----------------------------------------------------------------------
diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ZKPropertiesWriter.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ZKPropertiesWriter.java
index 0bde409..2d54872 100644
--- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ZKPropertiesWriter.java
+++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/ZKPropertiesWriter.java
@@ -44,14 +44,12 @@ public class ZKPropertiesWriter extends SimplePropertiesWriter {
   @Override
   public void init(DataImporter dataImporter, Map<String, String> params) {
     super.init(dataImporter, params);    
-    zkClient = dataImporter.getCore().getCoreDescriptor().getCoreContainer()
-        .getZkController().getZkClient();
+    zkClient = dataImporter.getCore().getCoreDescriptor().getCoreContainer().getZkController().getZkClient();
   }
   
   @Override
   protected void findDirectory(DataImporter dataImporter, Map<String, String> params) {
-    String collection = dataImporter.getCore().getCoreDescriptor()
-        .getCloudDescriptor().getCollectionName();
+    String collection = dataImporter.getCore().getCoreDescriptor().getCloudDescriptor().getCollectionName();
     path = "/configs/" + collection + "/" + filename;
   }
   
@@ -74,13 +72,9 @@ public class ZKPropertiesWriter extends SimplePropertiesWriter {
         } catch (NodeExistsException e) {}
       }
       zkClient.setData(path, bytes, false);
-    } catch (InterruptedException e) {
-      Thread.currentThread().interrupt();
-      log.warn(
-          "Could not persist properties to " + path + " :" + e.getClass(), e);
     } catch (Exception e) {
-      log.warn(
-          "Could not persist properties to " + path + " :" + e.getClass(), e);
+      SolrZkClient.checkInterrupted(e);
+      log.warn("Could not persist properties to " + path + " :" + e.getClass(), e);
     }
   }
   
@@ -88,13 +82,13 @@ public class ZKPropertiesWriter extends SimplePropertiesWriter {
   public Map<String, Object> readIndexerProperties() {
     Properties props = new Properties();
     try {
-      byte[] data = zkClient.getData(path, null, null, false);
+      byte[] data = zkClient.getData(path, null, null, true);
       if (data != null) {
         props.load(new StringReader(new String(data, StandardCharsets.UTF_8)));
       }
     } catch (Exception e) {
-      log.warn(
-          "Could not read DIH properties from " + path + " :" + e.getClass(), e);
+      SolrZkClient.checkInterrupted(e);
+      log.warn("Could not read DIH properties from " + path + " :" + e.getClass(), e);
     }
     return propertiesToMap(props);
   }