lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1521239 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/CHANGES.txt solr/solrj/ solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java
Date Mon, 09 Sep 2013 18:47:36 GMT
Author: markrmiller
Date: Mon Sep  9 18:47:35 2013
New Revision: 1521239

URL: http://svn.apache.org/r1521239
Log:
SOLR-5215: Fix possibility of deadlock in ZooKeeper ConnectionManager.

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/CHANGES.txt
    lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java

Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1521239&r1=1521238&r2=1521239&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Mon Sep  9 18:47:35 2013
@@ -68,15 +68,22 @@ New Features
   the "ie" (input encoding) parameter, e.g. "select?q=m%FCller&ie=ISO-8859-1".
   The default is UTF-8. To change the encoding of POSTed content, use the
   "Content-Type" HTTP header.  (Uwe Schindler, David Smiley)
+  
 * SOLR-4221: Custom sharding (Noble Paul)
-* SOLR-4808: Persist and use router,replicationFactor and maxShardsPerNode at Collection
and Shard level (Noble Paul, Shalin Mangar)
+
+* SOLR-4808: Persist and use router,replicationFactor and maxShardsPerNode at Collection

+  and Shard level (Noble Paul, Shalin Mangar)
+
 * SOLR-5006: CREATESHARD command for 'implicit' shards (Noble Paul)
+
 * SOLR-5017: Allow sharding based on the value of a field (Noble Paul)
+
 * SOLR-4222: create custom sharded collection via collections API (Noble Paul)
-* SOLR-5156: Enhance ZkCLI to allow uploading of arbitrary files to ZK.
-* SOLR-4718: Allow solr.xml to be stored in ZooKeeper
-* SOLR-5156: Enhance ZkCLI to allow uploading of arbitrary files to ZK.
-err
+
+* SOLR-4718: Allow solr.xml to be stored in ZooKeeper. (Mark Miller, Erick Erickson)
+
+* SOLR-5156: Enhance ZkCLI to allow uploading of arbitrary files to ZK. (Erick Erickson)
+
 * SOLR-5165: Single-valued docValues fields no longer require a default value.
   Additionally they work with sortMissingFirst, sortMissingLast, facet.missing, 
   exists() in function queries, etc.  (Robert Muir)
@@ -158,6 +165,9 @@ Bug Fixes
 * SOLR-5206: Fixed OpenExchangeRatesOrgProvider to use refreshInterval correctly
   (Catalin, hossman)
 
+* SOLR-5215: Fix possibility of deadlock in ZooKeeper ConnectionManager.
+  (Mark Miller, Ricardo Merizalde)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java?rev=1521239&r1=1521238&r2=1521239&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java
(original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java
Mon Sep  9 18:47:35 2013
@@ -37,16 +37,14 @@ class ConnectionManager implements Watch
   private boolean connected;
 
   private final ZkClientConnectionStrategy connectionStrategy;
-  
-  private Object connectionUpdateLock = new Object();
 
-  private String zkServerAddress;
+  private final String zkServerAddress;
 
-  private int zkClientTimeout;
+  private final int zkClientTimeout;
 
-  private SolrZkClient client;
+  private final SolrZkClient client;
 
-  private OnReconnect onReconnect;
+  private final OnReconnect onReconnect;
 
   private volatile boolean isClosed = false;
 
@@ -92,37 +90,35 @@ class ConnectionManager implements Watch
             new ZkClientConnectionStrategy.ZkUpdate() {
               @Override
               public void update(SolrZooKeeper keeper) {
-                // if keeper does not replace oldKeeper we must be sure to close it
-                synchronized (connectionUpdateLock) {
-                  try {
-                    waitForConnected(Long.MAX_VALUE);
-                  } catch (Exception e1) {
-                    closeKeeper(keeper);
-                    throw new RuntimeException(e1);
-                  }
-                  log.info("Connection with ZooKeeper reestablished.");
-                  try {
-                    client.updateKeeper(keeper);
-                  } catch (InterruptedException e) {
-                    closeKeeper(keeper);
-                    Thread.currentThread().interrupt();
-                    // we must have been asked to stop
-                    throw new RuntimeException(e);
-                  } catch(Throwable t) {
-                    closeKeeper(keeper);
-                    throw new RuntimeException(t);
-                  }
-      
-                  if (onReconnect != null) {
-                    onReconnect.command();
-                  }
-                  synchronized (ConnectionManager.this) {
-                    ConnectionManager.this.connected = true;
-                  }
+                try {
+                  waitForConnected(Long.MAX_VALUE);
+                } catch (Exception e1) {
+                  closeKeeper(keeper);
+                  throw new RuntimeException(e1);
+                }
+                
+                log.info("Connection with ZooKeeper reestablished.");
+                try {
+                  client.updateKeeper(keeper);
+                } catch (InterruptedException e) {
+                  closeKeeper(keeper);
+                  Thread.currentThread().interrupt();
+                  // we must have been asked to stop
+                  throw new RuntimeException(e);
+                } catch (Throwable t) {
+                  closeKeeper(keeper);
+                  throw new RuntimeException(t);
+                }
+                
+                if (onReconnect != null) {
+                  onReconnect.command();
+                }
+                
+                synchronized (ConnectionManager.this) {
+                  ConnectionManager.this.connected = true;
                 }
                 
               }
-
             });
       } catch (Exception e) {
         SolrException.log(log, "", e);



Mime
View raw message