lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tflo...@apache.org
Subject [2/6] lucene-solr:jira/solr-10233: Minor improvements to recovery code
Date Wed, 10 May 2017 22:09:56 GMT
Minor improvements to recovery code


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

Branch: refs/heads/jira/solr-10233
Commit: 507548a94e1f8e95e76f3a1d6a41a1d5b29210e5
Parents: d78946d
Author: Tomas Fernandez Lobbe <tflobbe@apache.org>
Authored: Tue May 9 13:04:59 2017 -0700
Committer: Tomas Fernandez Lobbe <tflobbe@apache.org>
Committed: Tue May 9 13:04:59 2017 -0700

----------------------------------------------------------------------
 solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java | 6 +-----
 solr/core/src/java/org/apache/solr/cloud/ZkController.java     | 3 +++
 .../src/java/org/apache/solr/handler/ReplicationHandler.java   | 4 ++++
 .../src/java/org/apache/solr/handler/admin/PrepRecoveryOp.java | 2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/507548a9/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
index 53b6f3e..3c8c1f4 100644
--- a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
+++ b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
@@ -330,6 +330,7 @@ public class RecoveryStrategy implements Runnable, Closeable {
         throw new SolrException(ErrorCode.SERVER_ERROR, "Cloud state still says we are leader.");
       }
       if (cloudDesc.isLeader()) {
+        assert cloudDesc.getReplicaType() != Replica.Type.PASSIVE;
         // we are now the leader - no one else must have been suitable
         LOG.warn("We have not yet recovered - but we are now the leader!");
         LOG.info("Finished recovery process.");
@@ -346,11 +347,6 @@ public class RecoveryStrategy implements Runnable, Closeable {
         LOG.info("Recovery for core {} has been closed", core.getName());
         break;
       }
-      
-      if (isClosed()) {
-        LOG.info("Recovery for core {} has been closed", core.getName());
-        break;
-      }
       LOG.info("Starting Replication Recovery.");
 
       try {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/507548a9/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 5fdd92c..11fff1f 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -892,6 +892,9 @@ public class ZkController {
         if (replica == null || replica.getType() != Type.PASSIVE) {
           joinElection(desc, afterExpiration, joinAtHead);
         } else if (replica.getType() == Type.PASSIVE) {
+          if (joinAtHead) {
+            log.warn("Replica {} was designated as preferred leader but it's type is {},
It won't join election", coreZkNodeName, Type.PASSIVE);
+          }
           log.debug("Replica {} skipping election because it's type is {}", coreZkNodeName,
Type.PASSIVE);
           startReplicationFromLeader(coreName, false);
         }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/507548a9/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
index 94ff189..90d33be 100644
--- a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
@@ -403,6 +403,10 @@ public class ReplicationHandler extends RequestHandlerBase implements
SolrCoreAw
     String masterUrl = solrParams == null ? null : solrParams.get(MASTER_URL);
     if (!indexFetchLock.tryLock())
       return IndexFetchResult.LOCK_OBTAIN_FAILED;
+    if (core.getCoreContainer().isShutDown()) {
+      LOG.warn("I was asked to replicate but CoreContainer is shutting down");
+      return IndexFetchResult.LOCK_OBTAIN_FAILED;//nocommit: different 
+    }
     try {
       if (masterUrl != null) {
         if (currentIndexFetcher != null && currentIndexFetcher != pollingIndexFetcher)
{

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/507548a9/solr/core/src/java/org/apache/solr/handler/admin/PrepRecoveryOp.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/PrepRecoveryOp.java b/solr/core/src/java/org/apache/solr/handler/admin/PrepRecoveryOp.java
index 8e5408b..39892b0 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/PrepRecoveryOp.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/PrepRecoveryOp.java
@@ -186,7 +186,7 @@ class PrepRecoveryOp implements CoreAdminHandler.CoreAdminOp {
         }
 
         // solrcloud_debug
-        if (log.isDebugEnabled()) {
+        if (log.isDebugEnabled() && core != null) {
           try {
             LocalSolrQueryRequest r = new LocalSolrQueryRequest(core,
                 new ModifiableSolrParams());


Mime
View raw message