lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject [10/53] [abbrv] lucene-solr git commit: SOLR-8695: Ensure ZK watchers are not triggering our watch logic on connection events and make this handling more consistent.
Date Wed, 24 Feb 2016 06:12:17 GMT
SOLR-8695: Ensure ZK watchers are not triggering our watch logic on connection events and make
this handling more consistent.


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

Branch: refs/heads/apiv2
Commit: e30d638c51f9c6cf9d462741d05e91302ff4b56d
Parents: 32fbca6
Author: markrmiller <markrmiller@apache.org>
Authored: Fri Feb 19 14:36:53 2016 -0500
Committer: markrmiller <markrmiller@apache.org>
Committed: Fri Feb 19 14:36:53 2016 -0500

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  3 +++
 .../org/apache/solr/cloud/LeaderElector.java    |  3 +--
 .../apache/solr/cloud/OverseerTaskQueue.java    | 10 +++++---
 .../org/apache/solr/cloud/ZkController.java     |  3 ++-
 .../solr/handler/CdcrBufferStateManager.java    |  1 +
 .../solr/handler/CdcrLeaderStateManager.java    |  1 +
 .../solr/handler/CdcrProcessStateManager.java   |  1 +
 .../handler/admin/ZookeeperInfoHandler.java     |  4 +++
 .../apache/solr/common/cloud/ZkStateReader.java | 26 ++++++++------------
 9 files changed, 29 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e30d638c/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c0c8856..f64f552 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -184,6 +184,9 @@ Bug Fixes
 
 * SOLR-8694: DistributedMap/Queue can create too many Watchers and some code simplification.

   (Scott Blum via Mark Miller)
+  
+* SOLR-8695: Ensure ZK watchers are not triggering our watch logic on connection events and
+  make this handling more consistent. (Scott Blum via Mark Miller)
 
 Optimizations
 ----------------------

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e30d638c/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java b/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
index 056b4b9..af27f00 100644
--- a/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
+++ b/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
@@ -367,8 +367,7 @@ public  class LeaderElector {
 
     @Override
     public void process(WatchedEvent event) {
-      // session events are not change events,
-      // and do not remove the watcher
+      // session events are not change events, and do not remove the watcher
       if (EventType.None.equals(event.getType())) {
         return;
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e30d638c/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java
index ea219d3..cf9d583 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java
@@ -129,11 +129,13 @@ public class OverseerTaskQueue extends DistributedQueue {
 
     @Override
     public void process(WatchedEvent event) {
-      Event.EventType eventType = event.getType();
-      // None events are ignored
+      // session events are not change events, and do not remove the watcher
+      if (Event.EventType.None.equals(event.getType())) {
+        return;
+      }
       // If latchEventType is not null, only fire if the type matches
-      LOG.info("{} fired on path {} state {} latchEventType {}", eventType, event.getPath(),
event.getState(), latchEventType);
-      if (eventType != Event.EventType.None && (latchEventType == null || eventType
== latchEventType)) {
+      LOG.info("{} fired on path {} state {} latchEventType {}", event.getType(), event.getPath(),
event.getState(), latchEventType);
+      if (latchEventType == null || event.getType() == latchEventType) {
         synchronized (lock) {
           this.event = event;
           lock.notifyAll();

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e30d638c/solr/core/src/java/org/apache/solr/cloud/ZkController.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index e436716..7874e2b 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -2365,7 +2365,8 @@ public final class ZkController {
 
     @Override
     public void process(WatchedEvent event) {
-      if (event.getState() == Event.KeeperState.Disconnected || event.getState() == Event.KeeperState.Expired)
 {
+      // session events are not change events, and do not remove the watcher
+      if (Event.EventType.None.equals(event.getType())) {
         return;
       }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e30d638c/solr/core/src/java/org/apache/solr/handler/CdcrBufferStateManager.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/CdcrBufferStateManager.java b/solr/core/src/java/org/apache/solr/handler/CdcrBufferStateManager.java
index 18c7d05..713d6fc 100644
--- a/solr/core/src/java/org/apache/solr/handler/CdcrBufferStateManager.java
+++ b/solr/core/src/java/org/apache/solr/handler/CdcrBufferStateManager.java
@@ -154,6 +154,7 @@ class CdcrBufferStateManager extends CdcrStateManager {
       String shard = core.getCoreDescriptor().getCloudDescriptor().getShardId();
 
       log.info("The CDCR buffer state has changed: {} @ {}:{}", event, collectionName, shard);
+      // session events are not change events, and do not remove the watcher
       if (Event.EventType.None.equals(event.getType())) {
         return;
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e30d638c/solr/core/src/java/org/apache/solr/handler/CdcrLeaderStateManager.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/CdcrLeaderStateManager.java b/solr/core/src/java/org/apache/solr/handler/CdcrLeaderStateManager.java
index 59313d3..7d8ddc4 100644
--- a/solr/core/src/java/org/apache/solr/handler/CdcrLeaderStateManager.java
+++ b/solr/core/src/java/org/apache/solr/handler/CdcrLeaderStateManager.java
@@ -137,6 +137,7 @@ class CdcrLeaderStateManager extends CdcrStateManager {
       String shard = core.getCoreDescriptor().getCloudDescriptor().getShardId();
 
       log.debug("The leader state has changed: {} @ {}:{}", event, collectionName, shard);
+      // session events are not change events, and do not remove the watcher
       if (Event.EventType.None.equals(event.getType())) {
         return;
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e30d638c/solr/core/src/java/org/apache/solr/handler/CdcrProcessStateManager.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/CdcrProcessStateManager.java b/solr/core/src/java/org/apache/solr/handler/CdcrProcessStateManager.java
index 7630702..b1c8dda 100644
--- a/solr/core/src/java/org/apache/solr/handler/CdcrProcessStateManager.java
+++ b/solr/core/src/java/org/apache/solr/handler/CdcrProcessStateManager.java
@@ -154,6 +154,7 @@ class CdcrProcessStateManager extends CdcrStateManager {
       String shard = core.getCoreDescriptor().getCloudDescriptor().getShardId();
 
       log.info("The CDCR process state has changed: {} @ {}:{}", event, collectionName, shard);
+      // session events are not change events, and do not remove the watcher
       if (Event.EventType.None.equals(event.getType())) {
         return;
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e30d638c/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java
index 8bc2130..e2ce63d 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java
@@ -248,6 +248,10 @@ public final class ZookeeperInfoHandler extends RequestHandlerBase {
      */
     @Override
     public void process(WatchedEvent event) {
+      // session events are not change events, and do not remove the watcher
+      if (Event.EventType.None.equals(event.getType())) {
+        return;
+      }
       synchronized (this) {
         cachedCollections = null;
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e30d638c/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 bfe89e3..910b47e 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
@@ -306,8 +306,7 @@ public class ZkStateReader implements Closeable {
             
             @Override
             public void process(WatchedEvent event) {
-              // session events are not change events,
-              // and do not remove the watcher
+              // session events are not change events, and do not remove the watcher
               if (EventType.None.equals(event.getType())) {
                 return;
               }
@@ -359,8 +358,7 @@ public class ZkStateReader implements Closeable {
 
           @Override
           public void process(WatchedEvent event) {
-            // session events are not change events,
-            // and do not remove the watcher
+            // session events are not change events, and do not remove the watcher
             if (EventType.None.equals(event.getType())) {
               return;
             }
@@ -797,15 +795,14 @@ public class ZkStateReader implements Closeable {
 
     @Override
     public void process(WatchedEvent event) {
-      if (!interestingCollections.contains(coll)) {
-        // This collection is no longer interesting, stop watching.
-        LOG.info("Uninteresting collection [{}]", coll);
+      // session events are not change events, and do not remove the watcher
+      if (EventType.None.equals(event.getType())) {
         return;
       }
 
-      // session events are not change events,
-      // and do not remove the watcher
-      if (EventType.None.equals(event.getType())) {
+      if (!interestingCollections.contains(coll)) {
+        // This collection is no longer interesting, stop watching.
+        LOG.info("Uninteresting collection {}", coll);
         return;
       }
 
@@ -852,8 +849,7 @@ public class ZkStateReader implements Closeable {
 
     @Override
     public void process(WatchedEvent event) {
-      // session events are not change events,
-      // and do not remove the watcher
+      // session events are not change events, and do not remove the watcher
       if (EventType.None.equals(event.getType())) {
         return;
       }
@@ -890,8 +886,7 @@ public class ZkStateReader implements Closeable {
 
     @Override
     public void process(WatchedEvent event) {
-      // session events are not change events,
-      // and do not remove the watcher
+      // session events are not change events, and do not remove the watcher
       if (EventType.None.equals(event.getType())) {
         return;
       }
@@ -924,8 +919,7 @@ public class ZkStateReader implements Closeable {
 
     @Override
     public void process(WatchedEvent event) {
-      // session events are not change events,
-      // and do not remove the watcher
+      // session events are not change events, and do not remove the watcher
       if (EventType.None.equals(event.getType())) {
         return;
       }


Mime
View raw message