You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/11/11 01:33:37 UTC

[lucene-solr] branch reference_impl_dev updated (763f3ea -> b32af2c)

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a change to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


    from 763f3ea  @1154 Only set active leader in Slice.
     new 3c700b4  @1155 debug logging
     new b32af2c  @1156 tweak close check and logging.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/solr/cloud/LeaderElector.java  | 25 +++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)


[lucene-solr] 02/02: @1156 tweak close check and logging.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit b32af2c1529e86cd345f1c2ca4113dd8be1f2565
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Nov 10 19:19:28 2020 -0600

    @1156 tweak close check and logging.
---
 .../src/java/org/apache/solr/cloud/LeaderElector.java     | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

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 35b3b25..2913f7f 100644
--- a/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
+++ b/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
@@ -105,9 +105,12 @@ public class LeaderElector implements Closeable {
    */
   private synchronized boolean checkIfIamLeader(final ElectionContext context, boolean replacement) throws KeeperException,
           InterruptedException, IOException {
-    if (checkClosed(context)) return false;
+    //if (checkClosed(context)) return false;
 
     log.info("Check if I am leader {}", context.getClass().getSimpleName());
+    if (isClosed) {
+      log.info("elector is closed, won't join election");
+    }
 
     ParWork.getRootSharedExecutor().submit(() -> {
       context.checkIfIamLeaderFired();
@@ -280,8 +283,10 @@ public class LeaderElector implements Closeable {
    * @return sequential node number
    */
   public synchronized boolean joinElection(ElectionContext context, boolean replacement,boolean joinAtHead) throws KeeperException, InterruptedException, IOException {
-    if (checkClosed(context)) return false;
-
+    //if (checkClosed(context)) return false;
+    if (isClosed) {
+      log.info("elector is closed, won't join election");
+    }
     ParWork.getRootSharedExecutor().submit(() -> {
       context.joinedElectionFired();
     });
@@ -318,7 +323,7 @@ public class LeaderElector implements Closeable {
                       CreateMode.EPHEMERAL_SEQUENTIAL, false);
         }
 
-        if (log.isDebugEnabled()) log.debug("Joined leadership election with path: {}", leaderSeqPath);
+        log.info("Joined leadership election with path: {}", leaderSeqPath);
         context.leaderSeqPath = leaderSeqPath;
         cont = false;
       } catch (ConnectionLossException e) {
@@ -357,6 +362,8 @@ public class LeaderElector implements Closeable {
 
     int seq = getSeq(context.leaderSeqPath);
 
+    log.info("Do checkIfIamLeader");
+
     boolean tryagain = checkIfIamLeader(context, replacement);
 
     if (tryagain) {


[lucene-solr] 01/02: @1155 debug logging

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 3c700b49cb35a0ec553ef29e8df921f63aeb55c1
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Nov 10 18:59:12 2020 -0600

    @1155 debug logging
---
 solr/core/src/java/org/apache/solr/cloud/LeaderElector.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

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 809ea03..35b3b25 100644
--- a/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
+++ b/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java
@@ -166,7 +166,7 @@ public class LeaderElector implements Closeable {
       }
 
     } else {
-      log.info("I am not the leader - watch the node below me {}", context.getClass().getSimpleName());
+      log.info("I am not the leader (leaderSeqNodeName={}) - watch the node below me {} seqs={}", leaderSeqNodeName, context.getClass().getSimpleName(), seqs);
       String toWatch = seqs.get(0);
       for (String node : seqs) {
         if (leaderSeqNodeName.equals(node)) {
@@ -383,6 +383,14 @@ public class LeaderElector implements Closeable {
 
   @Override
   public void close() throws IOException {
+    if (context != null) {
+      try {
+        context.cancelElection();
+      } catch (Exception e) {
+        log.warn("Exception canceling election", e);
+      }
+      context.close();
+    }
     IOUtils.closeQuietly(watcher);
     this.isClosed = true;
   }