lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r1668957 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/cloud/ solr/core/src/java/org/apache/solr/handler/admin/ solr/core/src/test/org/apache/solr/cloud/
Date Tue, 24 Mar 2015 19:05:31 GMT
Author: shalin
Date: Tue Mar 24 19:05:31 2015
New Revision: 1668957

URL: http://svn.apache.org/r1668957
Log:
SOLR-7294: Migrate API fails with 'Invalid status request: notfoundretried 6times' message

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1668957&r1=1668956&r2=1668957&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Tue Mar 24 19:05:31 2015
@@ -229,6 +229,9 @@ Bug Fixes
 * SOLR-7248: In legacyCloud=false mode we should check if the core was hosted on the same
node before registering it
   (Varun Thacker, Noble Paul, Mark Miller)
 
+* SOLR-7294: Migrate API fails with 'Invalid status request: notfoundretried 6times' message.
+  (Jessica Cheng Mallet, shalin)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java?rev=1668957&r1=1668956&r2=1668957&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
Tue Mar 24 19:05:31 2015
@@ -1593,9 +1593,7 @@ public class OverseerCollectionProcessor
         cmd.setOnlyIfLeader(true);
 
         ModifiableSolrParams p = new ModifiableSolrParams(cmd.getParams());
-        setupAsyncRequest(asyncId, requestMap, p, nodeName);
-
-        sendShardRequest(nodeName, p, shardHandler);
+        sendShardRequest(nodeName, p, shardHandler, asyncId, requestMap);
       }
 
       collectShardResponses(results, true,
@@ -1618,9 +1616,8 @@ public class OverseerCollectionProcessor
         params.add(CoreAdminParams.TARGET_CORE, subShardName);
       }
       params.set(CoreAdminParams.RANGES, rangesStr);
-      setupAsyncRequest(asyncId, requestMap, params, parentShardLeader.getNodeName());
 
-      sendShardRequest(parentShardLeader.getNodeName(), params, shardHandler);
+      sendShardRequest(parentShardLeader.getNodeName(), params, shardHandler, asyncId, requestMap);
 
       collectShardResponses(results, true, "SPLITSHARD failed to invoke SPLIT core admin
command",
           shardHandler);
@@ -1638,9 +1635,7 @@ public class OverseerCollectionProcessor
         params.set(CoreAdminParams.ACTION, CoreAdminAction.REQUESTAPPLYUPDATES.toString());
         params.set(CoreAdminParams.NAME, subShardName);
 
-        setupAsyncRequest(asyncId, requestMap, params, nodeName);
-
-        sendShardRequest(nodeName, params, shardHandler);
+        sendShardRequest(nodeName, params, shardHandler, asyncId, requestMap);
       }
 
       collectShardResponses(results, true,
@@ -1721,9 +1716,7 @@ public class OverseerCollectionProcessor
           cmd.setOnlyIfLeader(true);
           ModifiableSolrParams p = new ModifiableSolrParams(cmd.getParams());
 
-          setupAsyncRequest(asyncId, requestMap, p, nodeName);
-
-          sendShardRequest(nodeName, p, shardHandler);
+          sendShardRequest(nodeName, p, shardHandler, asyncId, requestMap);
 
         }
       }
@@ -2030,9 +2023,8 @@ public class OverseerCollectionProcessor
     params.set(CoreAdminParams.ACTION, CoreAdminAction.REQUESTBUFFERUPDATES.toString());
     params.set(CoreAdminParams.NAME, targetLeader.getStr("core"));
     String nodeName = targetLeader.getNodeName();
-    setupAsyncRequest(asyncId, requestMap, params, nodeName);
 
-    sendShardRequest(targetLeader.getNodeName(), params, shardHandler);
+    sendShardRequest(targetLeader.getNodeName(), params, shardHandler, asyncId, requestMap);
 
     collectShardResponses(results, true, "MIGRATE failed to request node to buffer updates",
         shardHandler);
@@ -2109,7 +2101,8 @@ public class OverseerCollectionProcessor
     cmd.setState(ZkStateReader.ACTIVE);
     cmd.setCheckLive(true);
     cmd.setOnlyIfLeader(true);
-    sendShardRequest(tempSourceLeader.getNodeName(), new ModifiableSolrParams(cmd.getParams()),
shardHandler);
+    // we don't want this to happen asynchronously
+    sendShardRequest(tempSourceLeader.getNodeName(), new ModifiableSolrParams(cmd.getParams()),
shardHandler, null, null);
 
     collectShardResponses(results, true,
         "MIGRATE failed to create temp collection leader or timed out waiting for it to come
up",
@@ -2125,9 +2118,7 @@ public class OverseerCollectionProcessor
 
     String tempNodeName = sourceLeader.getNodeName();
 
-    setupAsyncRequest(asyncId, requestMap, params, tempNodeName);
-
-    sendShardRequest(tempNodeName, params, shardHandler);
+    sendShardRequest(tempNodeName, params, shardHandler, asyncId, requestMap);
     collectShardResponses(results, true, "MIGRATE failed to invoke SPLIT core admin command",
shardHandler);
     completeAsyncRequest(asyncId, requestMap, results);
 
@@ -2171,9 +2162,7 @@ public class OverseerCollectionProcessor
     cmd.setOnlyIfLeader(true);
     params = new ModifiableSolrParams(cmd.getParams());
 
-    setupAsyncRequest(asyncId, requestMap, params, tempSourceLeader.getNodeName());
-
-    sendShardRequest(tempSourceLeader.getNodeName(), params, shardHandler);
+    sendShardRequest(tempSourceLeader.getNodeName(), params, shardHandler, asyncId, requestMap);
 
     collectShardResponses(results, true,
         "MIGRATE failed to create temp collection replica or timed out waiting for them to
come up",
@@ -2188,9 +2177,7 @@ public class OverseerCollectionProcessor
     params.set(CoreAdminParams.CORE, targetLeader.getStr("core"));
     params.set(CoreAdminParams.SRC_CORE, tempCollectionReplica2);
 
-    setupAsyncRequest(asyncId, requestMap, params, sourceLeader.getNodeName());
-
-    sendShardRequest(targetLeader.getNodeName(), params, shardHandler);
+    sendShardRequest(targetLeader.getNodeName(), params, shardHandler, asyncId, requestMap);
     collectShardResponses(results, true,
         "MIGRATE failed to merge " + tempCollectionReplica2 +
             " to " + targetLeader.getStr("core") + " on node: " + targetLeader.getNodeName(),
@@ -2202,9 +2189,8 @@ public class OverseerCollectionProcessor
     params = new ModifiableSolrParams();
     params.set(CoreAdminParams.ACTION, CoreAdminAction.REQUESTAPPLYUPDATES.toString());
     params.set(CoreAdminParams.NAME, targetLeader.getStr("core"));
-    setupAsyncRequest(asyncId, requestMap, params, targetLeader.getNodeName());
 
-    sendShardRequest(targetLeader.getNodeName(), params, shardHandler);
+    sendShardRequest(targetLeader.getNodeName(), params, shardHandler, asyncId, requestMap);
     collectShardResponses(results, true,
         "MIGRATE failed to request node to apply buffered updates",
         shardHandler);
@@ -2230,14 +2216,6 @@ public class OverseerCollectionProcessor
     }
   }
 
-  private void setupAsyncRequest(String asyncId, HashMap<String, String> requestMap,
ModifiableSolrParams params, String nodeName) {
-    if(asyncId != null) {
-      String coreAdminAsyncId = asyncId + Math.abs(System.nanoTime());
-      params.set(ASYNC, coreAdminAsyncId);
-      requestMap.put(nodeName, coreAdminAsyncId);
-    }
-  }
-
   private DocRouter.Range intersect(DocRouter.Range a, DocRouter.Range b) {
     if (a == null || b == null || !a.overlaps(b)) {
       return null;
@@ -2252,7 +2230,13 @@ public class OverseerCollectionProcessor
     }
   }
 
-  private void sendShardRequest(String nodeName, ModifiableSolrParams params, ShardHandler
shardHandler) {
+  private void sendShardRequest(String nodeName, ModifiableSolrParams params, ShardHandler
shardHandler, String asyncId, Map<String, String> requestMap) {
+    if (asyncId != null) {
+      String coreAdminAsyncId = asyncId + Math.abs(System.nanoTime());
+      params.set(ASYNC, coreAdminAsyncId);
+      requestMap.put(nodeName, coreAdminAsyncId);
+    }
+
     ShardRequest sreq = new ShardRequest();
     params.set("qt", adminPath);
     sreq.purpose = 1;
@@ -2430,8 +2414,11 @@ public class OverseerCollectionProcessor
           params.set(CoreAdminParams.SHARD, sliceName);
           params.set(ZkStateReader.NUM_SHARDS_PROP, numSlices);
 
-          setupAsyncRequest(async, requestMap, params, nodeName);
-
+          if (async != null)  {
+            String coreAdminAsyncId = async + Math.abs(System.nanoTime());
+            params.add(ASYNC, coreAdminAsyncId);
+            requestMap.put(nodeName, coreAdminAsyncId);
+          }
           addPropertyParams(message, params);
 
           ShardRequest sreq = new ShardRequest();
@@ -2592,8 +2579,7 @@ public class OverseerCollectionProcessor
 
     // For tracking async calls.
     HashMap<String, String> requestMap = new HashMap<>();
-    setupAsyncRequest(asyncId, requestMap, params, node);
-    sendShardRequest(node, params, shardHandler);
+    sendShardRequest(node, params, shardHandler, asyncId, requestMap);
 
     collectShardResponses(results, true,
         "ADDREPLICA failed to create replica", shardHandler);
@@ -2778,7 +2764,7 @@ public class OverseerCollectionProcessor
           NamedList results = new NamedList();
           processResponse(results, srsp);
           String r = (String) srsp.getSolrResponse().getResponse().get("STATUS");
-          if(r.equals("running")) {
+          if (r.equals("running")) {
             log.debug("The task is still RUNNING, continuing to wait.");
             try {
               Thread.sleep(1000);
@@ -2787,7 +2773,7 @@ public class OverseerCollectionProcessor
             }
             continue;
 
-          } else if(r.equals("completed")) {
+          } else if (r.equals("completed")) {
             log.debug("The task is COMPLETED, returning");
             return srsp.getSolrResponse().getResponse();
           } else if (r.equals("failed")) {
@@ -2796,15 +2782,15 @@ public class OverseerCollectionProcessor
             return srsp.getSolrResponse().getResponse();
           } else if (r.equals("notfound")) {
             log.debug("The task is notfound, retry");
-            if(counter++ < 5) {
+            if (counter++ < 5) {
               try {
                 Thread.sleep(1000);
               } catch (InterruptedException e) {
               }
               break;
             }
-            throw new SolrException(ErrorCode.BAD_REQUEST, "Invalid status request: " + srsp.getSolrResponse().getResponse().get("STATUS")
+
-            "retried " + counter + "times");
+            throw new SolrException(ErrorCode.BAD_REQUEST, "Invalid status request for requestId:
" + requestId + "" + srsp.getSolrResponse().getResponse().get("STATUS") +
+                "retried " + counter + "times");
           } else {
             throw new SolrException(ErrorCode.BAD_REQUEST, "Invalid status request " + srsp.getSolrResponse().getResponse().get("STATUS"));
           }

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java?rev=1668957&r1=1668956&r2=1668957&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
Tue Mar 24 19:05:31 2015
@@ -94,8 +94,7 @@ import static org.apache.solr.common.clo
 public class CoreAdminHandler extends RequestHandlerBase {
   protected static Logger log = LoggerFactory.getLogger(CoreAdminHandler.class);
   protected final CoreContainer coreContainer;
-  protected static HashMap<String, Map<String, TaskObject>> requestStatusMap
=
-      new HashMap<String,Map<String, TaskObject>>();
+  protected final Map<String, Map<String, TaskObject>> requestStatusMap;
 
   protected final ExecutorService parallelExecutor = Executors.newFixedThreadPool(50,
       new DefaultSolrThreadFactory("parallelCoreAdminExecutor"));
@@ -108,17 +107,16 @@ public class CoreAdminHandler extends Re
   public static String RESPONSE_STATUS = "STATUS";
   public static String RESPONSE_MESSAGE = "msg";
 
-  static {
-    requestStatusMap.put(RUNNING, Collections.synchronizedMap(new LinkedHashMap<String,
TaskObject>()));
-    requestStatusMap.put(COMPLETED, Collections.synchronizedMap(new LinkedHashMap<String,
TaskObject>()));
-    requestStatusMap.put(FAILED, Collections.synchronizedMap(new LinkedHashMap<String,
TaskObject>()));
-  }
-
   public CoreAdminHandler() {
     super();
     // Unlike most request handlers, CoreContainer initialization 
     // should happen in the constructor...  
     this.coreContainer = null;
+    HashMap<String, Map<String, TaskObject>> map = new HashMap<>(3, 1.0f);
+    map.put(RUNNING, Collections.synchronizedMap(new LinkedHashMap<String, TaskObject>()));
+    map.put(COMPLETED, Collections.synchronizedMap(new LinkedHashMap<String, TaskObject>()));
+    map.put(FAILED, Collections.synchronizedMap(new LinkedHashMap<String, TaskObject>()));
+    requestStatusMap = Collections.unmodifiableMap(map);
   }
 
 
@@ -129,6 +127,11 @@ public class CoreAdminHandler extends Re
    */
   public CoreAdminHandler(final CoreContainer coreContainer) {
     this.coreContainer = coreContainer;
+    HashMap<String, Map<String, TaskObject>> map = new HashMap<>(3, 1.0f);
+    map.put(RUNNING, Collections.synchronizedMap(new LinkedHashMap<String, TaskObject>()));
+    map.put(COMPLETED, Collections.synchronizedMap(new LinkedHashMap<String, TaskObject>()));
+    map.put(FAILED, Collections.synchronizedMap(new LinkedHashMap<String, TaskObject>()));
+    requestStatusMap = Collections.unmodifiableMap(map);
   }
 
 

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java?rev=1668957&r1=1668956&r2=1668957&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java
Tue Mar 24 19:05:31 2015
@@ -50,25 +50,6 @@ public class MigrateRouteKeyTest extends
     schemaString = "schema15.xml";      // we need a string id
   }
 
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-    System.setProperty("solr.xml.persist", "true");
-  }
-
-  @Override
-  public void distribTearDown() throws Exception {
-    super.distribTearDown();
-
-    System.clearProperty("zkHost");
-    System.clearProperty("numShards");
-    System.clearProperty("solr.xml.persist");
-
-    // insurance
-    DirectUpdateHandler2.commitOnClose = true;
-  }
-
   @Test
   public void test() throws Exception {
     waitForThingsToLevelOut(15);



Mime
View raw message