lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1367777 [14/14] - in /lucene/dev/branches/pforcodec_3892: ./ dev-tools/ dev-tools/eclipse/ dev-tools/maven/ dev-tools/scripts/ lucene/ lucene/analysis/ lucene/analysis/common/ lucene/analysis/common/src/java/org/apache/lucene/analysis/ar/ ...
Date Tue, 31 Jul 2012 20:59:01 GMT
Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/analysis/TestWordDelimiterFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/analysis/TestWordDelimiterFilterFactory.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/analysis/TestWordDelimiterFilterFactory.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/analysis/TestWordDelimiterFilterFactory.java Tue Jul 31 20:58:32 2012
@@ -1,3 +1,5 @@
+package org.apache.solr.analysis;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -15,8 +17,6 @@
  * limitations under the License.
  */
 
-package org.apache.solr.analysis;
-
 import java.io.StringReader;
 import java.util.HashMap;
 import java.util.Map;
@@ -25,6 +25,7 @@ import org.apache.lucene.analysis.BaseTo
 import org.apache.lucene.analysis.MockTokenizer;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.solr.SolrTestCaseJ4;
+import org.apache.lucene.analysis.miscellaneous.WordDelimiterFilterFactory;
 import org.apache.lucene.analysis.util.ResourceLoader;
 import org.apache.solr.core.SolrResourceLoader;
 import org.junit.BeforeClass;
@@ -33,6 +34,7 @@ import org.junit.Test;
 /**
  * New WordDelimiterFilter tests... most of the tests are in ConvertedLegacyTest
  */
+// TODO: add a low-level test for this factory
 public class TestWordDelimiterFilterFactory extends SolrTestCaseJ4 {
 
   @BeforeClass

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/ChaosMonkey.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/ChaosMonkey.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/ChaosMonkey.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/ChaosMonkey.java Tue Jul 31 20:58:32 2012
@@ -66,18 +66,13 @@ public class ChaosMonkey {
   private boolean expireSessions;
   private boolean causeConnectionLoss;
   private boolean aggressivelyKillLeaders;
-  private Map<String,SolrServer> shardToLeaderClient;
   private Map<String,CloudJettyRunner> shardToLeaderJetty;
   private long startTime;
   
   public ChaosMonkey(ZkTestServer zkServer, ZkStateReader zkStateReader,
       String collection, Map<String,List<CloudJettyRunner>> shardToJetty,
-      Map<String,List<SolrServer>> shardToClient,
-      Map<String,SolrServer> shardToLeaderClient,
       Map<String,CloudJettyRunner> shardToLeaderJetty) {
     this.shardToJetty = shardToJetty;
-    this.shardToClient = shardToClient;
-    this.shardToLeaderClient = shardToLeaderClient;
     this.shardToLeaderJetty = shardToLeaderJetty;
     this.zkServer = zkServer;
     this.zkStateReader = zkStateReader;
@@ -104,9 +99,9 @@ public class ChaosMonkey {
   public void expireRandomSession() throws KeeperException, InterruptedException {
     String sliceName = getRandomSlice();
     
-    JettySolrRunner jetty = getRandomJetty(sliceName, aggressivelyKillLeaders);
+    CloudJettyRunner jetty = getRandomJetty(sliceName, aggressivelyKillLeaders);
     if (jetty != null) {
-      expireSession(jetty);
+      expireSession(jetty.jetty);
       expires.incrementAndGet();
     }
   }
@@ -115,9 +110,9 @@ public class ChaosMonkey {
     monkeyLog("cause connection loss!");
     
     String sliceName = getRandomSlice();
-    JettySolrRunner jetty = getRandomJetty(sliceName, aggressivelyKillLeaders);
+    CloudJettyRunner jetty = getRandomJetty(sliceName, aggressivelyKillLeaders);
     if (jetty != null) {
-      causeConnectionLoss(jetty);
+      causeConnectionLoss(jetty.jetty);
       connloss.incrementAndGet();
     }
   }
@@ -135,23 +130,29 @@ public class ChaosMonkey {
     }
   }
 
-  public JettySolrRunner stopShard(String slice, int index) throws Exception {
-    JettySolrRunner jetty = shardToJetty.get(slice).get(index).jetty;
-    stopJetty(jetty);
-    return jetty;
+  public CloudJettyRunner stopShard(String slice, int index) throws Exception {
+    CloudJettyRunner cjetty = shardToJetty.get(slice).get(index);
+    stopJetty(cjetty);
+    return cjetty;
   }
 
-  public void stopJetty(JettySolrRunner jetty) throws Exception {
-    stop(jetty);
+  public void stopJetty(CloudJettyRunner cjetty) throws Exception {
+    stop(cjetty.jetty);
     stops.incrementAndGet();
   }
 
-  public void killJetty(JettySolrRunner jetty) throws Exception {
-    kill(jetty);
+  public void killJetty(CloudJettyRunner cjetty) throws Exception {
+    kill(cjetty);
     stops.incrementAndGet();
   }
   
-  public static void stop(JettySolrRunner jetty) throws Exception {
+  public void stopJetty(JettySolrRunner jetty) throws Exception {
+    stops.incrementAndGet();
+    stopJettySolrRunner(jetty);
+  }
+  
+  private static void stopJettySolrRunner(JettySolrRunner jetty) throws Exception {
+    
     monkeyLog("stop shard! " + jetty.getLocalPort());
     // get a clean shutdown so that no dirs are left open...
     FilterHolder fh = jetty.getDispatchFilter();
@@ -168,7 +169,8 @@ public class ChaosMonkey {
     }
   }
   
-  public static void kill(JettySolrRunner jetty) throws Exception {
+  public static void kill(CloudJettyRunner cjetty) throws Exception {
+    JettySolrRunner jetty = cjetty.jetty;
     monkeyLog("kill shard! " + jetty.getLocalPort());
     FilterHolder fh = jetty.getDispatchFilter();
     SolrDispatchFilter sdf = null;
@@ -189,7 +191,7 @@ public class ChaosMonkey {
   public void stopShard(String slice) throws Exception {
     List<CloudJettyRunner> jetties = shardToJetty.get(slice);
     for (CloudJettyRunner jetty : jetties) {
-      stopJetty(jetty.jetty);
+      stopJetty(jetty);
     }
   }
   
@@ -197,7 +199,7 @@ public class ChaosMonkey {
     List<CloudJettyRunner> jetties = shardToJetty.get(slice);
     for (CloudJettyRunner jetty : jetties) {
       if (!jetty.nodeName.equals(shardName)) {
-        stopJetty(jetty.jetty);
+        stopJetty(jetty);
       }
     }
   }
@@ -207,22 +209,22 @@ public class ChaosMonkey {
     return jetty;
   }
   
-  public JettySolrRunner stopRandomShard() throws Exception {
+  public CloudJettyRunner stopRandomShard() throws Exception {
     String sliceName = getRandomSlice();
     
     return stopRandomShard(sliceName);
   }
   
-  public JettySolrRunner stopRandomShard(String slice) throws Exception {
-    JettySolrRunner jetty = getRandomJetty(slice, aggressivelyKillLeaders);
-    if (jetty != null) {
-      stopJetty(jetty);
+  public CloudJettyRunner stopRandomShard(String slice) throws Exception {
+    CloudJettyRunner cjetty = getRandomJetty(slice, aggressivelyKillLeaders);
+    if (cjetty != null) {
+      stopJetty(cjetty);
     }
-    return jetty;
+    return cjetty;
   }
   
   
-  public JettySolrRunner killRandomShard() throws Exception {
+  public CloudJettyRunner killRandomShard() throws Exception {
     // add all the shards to a list
     String sliceName = getRandomSlice();
     
@@ -238,15 +240,15 @@ public class ChaosMonkey {
     return sliceName;
   }
   
-  public JettySolrRunner killRandomShard(String slice) throws Exception {
-    JettySolrRunner jetty = getRandomJetty(slice, aggressivelyKillLeaders);
-    if (jetty != null) {
-      killJetty(jetty);
+  public CloudJettyRunner killRandomShard(String slice) throws Exception {
+    CloudJettyRunner cjetty = getRandomJetty(slice, aggressivelyKillLeaders);
+    if (cjetty != null) {
+      killJetty(cjetty);
     }
-    return jetty;
+    return cjetty;
   }
   
-  public JettySolrRunner getRandomJetty(String slice, boolean aggressivelyKillLeaders) throws KeeperException, InterruptedException {
+  public CloudJettyRunner getRandomJetty(String slice, boolean aggressivelyKillLeaders) throws KeeperException, InterruptedException {
     
 
     int numRunning = 0;
@@ -301,15 +303,15 @@ public class ChaosMonkey {
     }
     Random random = LuceneTestCase.random();
     int chance = random.nextInt(10);
-    JettySolrRunner jetty;
+    CloudJettyRunner cjetty;
     if (chance <= 5 && aggressivelyKillLeaders) {
       // if killLeader, really aggressively go after leaders
-      jetty = shardToLeaderJetty.get(slice).jetty;
+      cjetty = shardToLeaderJetty.get(slice);
     } else {
       // get random shard
       List<CloudJettyRunner> jetties = shardToJetty.get(slice);
       int index = random.nextInt(jetties.size());
-      jetty = jetties.get(index).jetty;
+      cjetty = jetties.get(index);
       
       ZkNodeProps leader = zkStateReader.getLeaderProps(collection, slice);
       boolean isLeader = leader.get(ZkStateReader.NODE_NAME_PROP).equals(jetties.get(index).nodeName);
@@ -320,15 +322,16 @@ public class ChaosMonkey {
       } 
     }
 
-    if (jetty.getLocalPort() == -1) {
+    if (cjetty.jetty.getLocalPort() == -1) {
       // we can't kill the dead
       monkeyLog("abort! This guy is already dead");
       return null;
     }
     
     //System.out.println("num active:" + numActive + " for " + slice + " sac:" + jetty.getLocalPort());
-    monkeyLog("chose a victim! " + jetty.getLocalPort());
-    return jetty;
+    monkeyLog("chose a victim! " + cjetty.jetty.getLocalPort());
+  
+    return cjetty;
   }
   
   public SolrServer getRandomClient(String slice) throws KeeperException, InterruptedException {
@@ -353,7 +356,7 @@ public class ChaosMonkey {
     
     stop = false;
     new Thread() {
-      private List<JettySolrRunner> deadPool = new ArrayList<JettySolrRunner>();
+      private List<CloudJettyRunner> deadPool = new ArrayList<CloudJettyRunner>();
 
       @Override
       public void run() {
@@ -364,25 +367,9 @@ public class ChaosMonkey {
             if (random.nextBoolean()) {
              if (!deadPool.isEmpty()) {
                int index = random.nextInt(deadPool.size());
-               JettySolrRunner jetty = deadPool.get(index);
-               try {
-                 jetty.start();
-               } catch (BindException e) {
-                 jetty.stop();
-                 sleep(2000);
-                 try {
-                   jetty.start();
-                 } catch (BindException e2) {
-                   jetty.stop();
-                   sleep(5000);
-                   try {
-                     jetty.start();
-                   } catch (BindException e3) {
-                     // we coud not get the port
-                     jetty.stop();
-                     continue;
-                   }
-                 }
+               JettySolrRunner jetty = deadPool.get(index).jetty;
+               if (!ChaosMonkey.start(jetty)) {
+                 continue;
                }
                //System.out.println("started on port:" + jetty.getLocalPort());
                deadPool.remove(index);
@@ -402,16 +389,16 @@ public class ChaosMonkey {
               randomConnectionLoss();
             }
             
-            JettySolrRunner jetty;
+            CloudJettyRunner cjetty;
             if (random.nextBoolean()) {
-              jetty = stopRandomShard();
+              cjetty = stopRandomShard();
             } else {
-              jetty = killRandomShard();
+              cjetty = killRandomShard();
             }
-            if (jetty == null) {
+            if (cjetty == null) {
               // we cannot kill
             } else {
-              deadPool.add(jetty);
+              deadPool.add(cjetty);
             }
             
           } catch (InterruptedException e) {
@@ -441,4 +428,31 @@ public class ChaosMonkey {
     return starts.get();
   }
 
+  public static void stop(JettySolrRunner jetty) throws Exception {
+    stopJettySolrRunner(jetty);
+  }
+  
+  public static boolean start(JettySolrRunner jetty) throws Exception {
+    try {
+      jetty.start();
+    } catch (BindException e) {
+      jetty.stop();
+      Thread.sleep(2000);
+      try {
+        jetty.start();
+      } catch (BindException e2) {
+        jetty.stop();
+        Thread.sleep(5000);
+        try {
+          jetty.start();
+        } catch (BindException e3) {
+          // we coud not get the port
+          jetty.stop();
+          return false;
+        }
+      }
+    }
+    return true;
+  }
+
 }
\ No newline at end of file

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java Tue Jul 31 20:58:32 2012
@@ -87,7 +87,7 @@ public class ChaosMonkeyNothingIsSafeTes
       // as it's not supported for recovery
       // del("*:*");
       
-      List<StopableIndexingThread> threads = new ArrayList<StopableIndexingThread>();
+      List<StopableThread> threads = new ArrayList<StopableThread>();
       int threadCount = 1;
       int i = 0;
       for (i = 0; i < threadCount; i++) {
@@ -97,6 +97,14 @@ public class ChaosMonkeyNothingIsSafeTes
         indexThread.start();
       }
       
+      threadCount = 1;
+      i = 0;
+      for (i = 0; i < threadCount; i++) {
+        StopableSearchThread searchThread = new StopableSearchThread();
+        threads.add(searchThread);
+        searchThread.start();
+      }
+      
       FullThrottleStopableIndexingThread ftIndexThread = new FullThrottleStopableIndexingThread(
           clients, i * 50000, true);
       threads.add(ftIndexThread);
@@ -110,12 +118,12 @@ public class ChaosMonkeyNothingIsSafeTes
         chaosMonkey.stopTheMonkey();
       }
       
-      for (StopableIndexingThread indexThread : threads) {
+      for (StopableThread indexThread : threads) {
         indexThread.safeStop();
       }
       
       // wait for stop...
-      for (StopableIndexingThread indexThread : threads) {
+      for (StopableThread indexThread : threads) {
         indexThread.join();
       }
       

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java Tue Jul 31 20:58:32 2012
@@ -22,6 +22,9 @@ import java.util.List;
 
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.core.SolrCore;
+import org.apache.solr.servlet.SolrDispatchFilter;
+import org.apache.solr.update.DirectUpdateHandler2;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -35,7 +38,7 @@ public class ChaosMonkeySafeLeaderTest e
 
   @BeforeClass
   public static void beforeSuperClass() {
-    
+
   }
   
   @AfterClass
@@ -77,9 +80,10 @@ public class ChaosMonkeySafeLeaderTest e
     handle.put("QTime", SKIPVAL);
     handle.put("timestamp", SKIPVAL);
     
-    // we cannot do delete by query
-    // as it's not supported for recovery
-    //del("*:*");
+    // randomly turn on 5 seconds 'soft' commit
+    randomlyEnableAutoSoftCommit();
+
+    del("*:*");
     
     List<StopableIndexingThread> threads = new ArrayList<StopableIndexingThread>();
     int threadCount = 2;
@@ -116,6 +120,24 @@ public class ChaosMonkeySafeLeaderTest e
     
     if (VERBOSE) System.out.println("control docs:" + controlClient.query(new SolrQuery("*:*")).getResults().getNumFound() + "\n\n");
   }
+
+  private void randomlyEnableAutoSoftCommit() {
+    if (r.nextBoolean()) {
+      log.info("Turning on auto soft commit");
+      for (CloudJettyRunner jetty : shardToJetty.get("shard1")) {
+        SolrCore core = ((SolrDispatchFilter) jetty.jetty.getDispatchFilter()
+            .getFilter()).getCores().getCore("collection1");
+        try {
+          ((DirectUpdateHandler2) core.getUpdateHandler()).getCommitTracker()
+              .setTimeUpperBound(5000);
+        } finally {
+          core.close();
+        }
+      }
+    } else {
+      log.info("Not turning on auto soft commit");
+    }
+  }
   
   // skip the randoms - they can deadlock...
   protected void indexr(Object... fields) throws Exception {

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudTest.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/FullSolrCloudTest.java Tue Jul 31 20:58:32 2012
@@ -26,6 +26,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Random;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -66,7 +67,7 @@ import org.slf4j.LoggerFactory;
  */
 @Slow
 public class FullSolrCloudTest extends AbstractDistributedZkTestCase {
-  private static Logger log = LoggerFactory.getLogger(FullSolrCloudTest.class);
+  static Logger log = LoggerFactory.getLogger(FullSolrCloudTest.class);
   
   @BeforeClass
   public static void beforeFullSolrCloudTest() {
@@ -98,39 +99,58 @@ public class FullSolrCloudTest extends A
   
   protected volatile CloudSolrServer cloudClient;
   
-  protected Map<JettySolrRunner,ZkNodeProps> jettyToInfo = new HashMap<JettySolrRunner,ZkNodeProps>();
-  protected Map<CloudSolrServerClient,ZkNodeProps> clientToInfo = new HashMap<CloudSolrServerClient,ZkNodeProps>();
-  protected Map<String,List<SolrServer>> shardToClient = new HashMap<String,List<SolrServer>>();
+  protected List<CloudJettyRunner> cloudJettys = new ArrayList<CloudJettyRunner>();
   protected Map<String,List<CloudJettyRunner>> shardToJetty = new HashMap<String,List<CloudJettyRunner>>();
   private AtomicInteger jettyIntCntr = new AtomicInteger(0);
   protected ChaosMonkey chaosMonkey;
   protected volatile ZkStateReader zkStateReader;
   
-  private Map<String,SolrServer> shardToLeaderClient = new HashMap<String,SolrServer>();
   protected Map<String,CloudJettyRunner> shardToLeaderJetty = new HashMap<String,CloudJettyRunner>();
   
-  class CloudJettyRunner {
+  static class CloudJettyRunner {
     JettySolrRunner jetty;
     String nodeName;
     String coreNodeName;
     String url;
+    CloudSolrServerClient client;
+    public ZkNodeProps info;
+    @Override
+    public int hashCode() {
+      final int prime = 31;
+      int result = 1;
+      result = prime * result + ((url == null) ? 0 : url.hashCode());
+      return result;
+    }
+    @Override
+    public boolean equals(Object obj) {
+      if (this == obj) return true;
+      if (obj == null) return false;
+      if (getClass() != obj.getClass()) return false;
+      CloudJettyRunner other = (CloudJettyRunner) obj;
+      if (url == null) {
+        if (other.url != null) return false;
+      } else if (!url.equals(other.url)) return false;
+      return true;
+    }
   }
   
   static class CloudSolrServerClient {
-    SolrServer client;
+    SolrServer solrClient;
     String shardName;
+    int port;
+    public ZkNodeProps info;
     
     public CloudSolrServerClient() {}
     
     public CloudSolrServerClient(SolrServer client) {
-      this.client = client;
+      this.solrClient = client;
     }
     
     @Override
     public int hashCode() {
       final int prime = 31;
       int result = 1;
-      result = prime * result + ((client == null) ? 0 : client.hashCode());
+      result = prime * result + ((solrClient == null) ? 0 : solrClient.hashCode());
       return result;
     }
     
@@ -140,9 +160,9 @@ public class FullSolrCloudTest extends A
       if (obj == null) return false;
       if (getClass() != obj.getClass()) return false;
       CloudSolrServerClient other = (CloudSolrServerClient) obj;
-      if (client == null) {
-        if (other.client != null) return false;
-      } else if (!client.equals(other.client)) return false;
+      if (solrClient == null) {
+        if (other.solrClient != null) return false;
+      } else if (!solrClient.equals(other.solrClient)) return false;
       return true;
     }
     
@@ -189,7 +209,7 @@ public class FullSolrCloudTest extends A
       }
       
       chaosMonkey = new ChaosMonkey(zkServer, zkStateReader,
-          DEFAULT_COLLECTION, shardToJetty, shardToClient, shardToLeaderClient,
+          DEFAULT_COLLECTION, shardToJetty,
           shardToLeaderJetty);
     }
     
@@ -335,9 +355,8 @@ public class FullSolrCloudTest extends A
   protected void updateMappingsFromZk(List<JettySolrRunner> jettys,
       List<SolrServer> clients) throws Exception {
     zkStateReader.updateCloudState(true);
-    shardToClient.clear();
+    cloudJettys.clear();
     shardToJetty.clear();
-    jettyToInfo.clear();
     
     CloudState cloudState = zkStateReader.getCloudState();
     Map<String,Slice> slices = cloudState.getSlices(DEFAULT_COLLECTION);
@@ -347,6 +366,7 @@ public class FullSolrCloudTest extends A
           + DEFAULT_COLLECTION + " in " + cloudState.getCollections());
     }
     
+    List<CloudSolrServerClient> theClients = new ArrayList<CloudSolrServerClient>();
     for (SolrServer client : clients) {
       // find info for this client in zk 
       nextClient:
@@ -359,36 +379,23 @@ public class FullSolrCloudTest extends A
           
           if (shard.getKey().contains(":" + port + "_")) {
             CloudSolrServerClient csc = new CloudSolrServerClient();
-            csc.client = client;
+            csc.solrClient = client;
+            csc.port = port;
             csc.shardName = shard.getValue().get(ZkStateReader.NODE_NAME_PROP);
-            boolean isLeader = shard.getValue().containsKey(
-                ZkStateReader.LEADER_PROP);
-            clientToInfo.put(csc, shard.getValue());
-            List<SolrServer> list = shardToClient.get(slice.getKey());
-            if (list == null) {
-              list = new ArrayList<SolrServer>();
-              shardToClient.put(slice.getKey(), list);
-            }
-            list.add(client);
+            csc.info = shard.getValue();
+            
+            theClients .add(csc);
             
-            if (isLeader) {
-              shardToLeaderClient.put(slice.getKey(), client);
-            }
             break nextClient;
           }
         }
       }
     }
-    
-    for (Map.Entry<String,Slice> slice : slices.entrySet()) {
-      // check that things look right
-      assertEquals(slice.getValue().getShards().size(), shardToClient.get(slice.getKey()).size());
-    }
  
     for (JettySolrRunner jetty : jettys) {
       int port = jetty.getLocalPort();
       if (port == -1) {
-        continue; // If we cannot get the port, this jetty is down
+        throw new RuntimeException("Cannot find the port for jetty");
       }
       
       nextJetty:
@@ -396,7 +403,6 @@ public class FullSolrCloudTest extends A
         Map<String,ZkNodeProps> theShards = slice.getValue().getShards();
         for (Map.Entry<String,ZkNodeProps> shard : theShards.entrySet()) {
           if (shard.getKey().contains(":" + port + "_")) {
-            jettyToInfo.put(jetty, shard.getValue());
             List<CloudJettyRunner> list = shardToJetty.get(slice.getKey());
             if (list == null) {
               list = new ArrayList<CloudJettyRunner>();
@@ -406,13 +412,16 @@ public class FullSolrCloudTest extends A
                 ZkStateReader.LEADER_PROP);
             CloudJettyRunner cjr = new CloudJettyRunner();
             cjr.jetty = jetty;
+            cjr.info = shard.getValue();
             cjr.nodeName = shard.getValue().get(ZkStateReader.NODE_NAME_PROP);
             cjr.coreNodeName = shard.getKey();
             cjr.url = shard.getValue().get(ZkStateReader.BASE_URL_PROP) + "/" + shard.getValue().get(ZkStateReader.CORE_NAME_PROP);
+            cjr.client = findClientByPort(port, theClients);
             list.add(cjr);
             if (isLeader) {
               shardToLeaderJetty.put(slice.getKey(), cjr);
             }
+            cloudJettys.add(cjr);
             break nextJetty;
           }
         }
@@ -427,10 +436,19 @@ public class FullSolrCloudTest extends A
       List<CloudJettyRunner> jetties = shardToJetty.get(slice.getKey());
       assertNotNull("Test setup problem: We found no jetties for shard: " + slice.getKey()
           + " just:" + shardToJetty.keySet(), jetties);
-      assertTrue(jetties.size() > 0);
+      assertEquals(slice.getValue().getShards().size(), jetties.size());
     }
   }
   
+  private CloudSolrServerClient findClientByPort(int port, List<CloudSolrServerClient> theClients) {
+    for (CloudSolrServerClient client : theClients) {
+      if (client.port == port) {
+        return client;
+      }
+    }
+    throw new IllegalArgumentException("Client with the give port does not exist:" + port);
+  }
+
   @Override
   protected void setDistributedParams(ModifiableSolrParams params) {
     
@@ -509,11 +527,15 @@ public class FullSolrCloudTest extends A
   
   protected void del(String q) throws Exception {
     controlClient.deleteByQuery(q);
+    cloudClient.deleteByQuery(q);
+
+    /***
     for (SolrServer client : clients) {
       UpdateRequest ureq = new UpdateRequest();
       // ureq.setParam("update.chain", DISTRIB_UPDATE_CHAIN);
       ureq.deleteByQuery(q).process(client);
     }
+     ***/
   }// serial commit...
   
   /*
@@ -647,9 +669,9 @@ public class FullSolrCloudTest extends A
     
     // new server should be part of first shard
     // how many docs are on the new shard?
-    for (SolrServer client : shardToClient.get("shard1")) {
+    for (CloudJettyRunner cjetty : shardToJetty.get("shard1")) {
       if (VERBOSE) System.err.println("total:"
-          + client.query(new SolrQuery("*:*")).getResults().getNumFound());
+          + cjetty.client.solrClient.query(new SolrQuery("*:*")).getResults().getNumFound());
     }
     
     checkShardConsistency("shard1");
@@ -673,24 +695,32 @@ public class FullSolrCloudTest extends A
     
     commit();
     
-    long deadShardCount = shardToClient.get(SHARD2).get(0).query(query).getResults().getNumFound();
-    
+    long deadShardCount = shardToJetty.get(SHARD2).get(0).client.solrClient
+        .query(query).getResults().getNumFound();
+
     query("q", "*:*", "sort", "n_tl1 desc");
     
     // kill a shard
-    JettySolrRunner deadShard = chaosMonkey.stopShard(SHARD2, 0);
+    CloudJettyRunner deadShard = chaosMonkey.stopShard(SHARD2, 0);
     cloudClient.connect();
-    int tries = 0;
-    while (cloudClient.getZkStateReader().getCloudState().liveNodesContain(clientToInfo.get(new CloudSolrServerClient(shardToClient.get(SHARD2).get(0))).get(ZkStateReader.NODE_NAME_PROP))) {
-      if (tries++ == 60) {
-        fail("Shard still reported as live in zk");
-      }
-      Thread.sleep(1000);
+
+    // we are careful to make sure the downed node is no longer in the state,
+    // because on some systems (especially freebsd w/ blackhole enabled), trying
+    // to talk to a downed node causes grief
+    Set<CloudJettyRunner> jetties = new HashSet<CloudJettyRunner>();
+    jetties.addAll(shardToJetty.get(SHARD2));
+    jetties.remove(deadShard);
+    
+    for (CloudJettyRunner cjetty : jetties) {
+      waitToSeeNotLive(((SolrDispatchFilter) cjetty.jetty.getDispatchFilter()
+          .getFilter()).getCores().getZkController().getZkStateReader(),
+          deadShard);
     }
-	
+    waitToSeeNotLive(cloudClient.getZkStateReader(), deadShard);
+
     // ensure shard is dead
     try {
-      index_specific(shardToClient.get(SHARD2).get(0), id, 999, i1, 107, t1,
+      index_specific(deadShard.client.solrClient, id, 999, i1, 107, t1,
           "specific doc!");
       fail("This server should be down and this update should have failed");
     } catch (SolrServerException e) {
@@ -705,21 +735,11 @@ public class FullSolrCloudTest extends A
     // System.out.println("clouddocs:" + cloudClientDocs);
     
     // try to index to a living shard at shard2
-    
-    // we are careful to make sure the downed node is no longer in the state,
-    // because on some systems (especially freebsd w/ blackhole enabled), trying
-    // to talk to a downed node causes grief
-    tries = 0;
-    while (((SolrDispatchFilter) shardToJetty.get(SHARD2).get(1).jetty.getDispatchFilter().getFilter()).getCores().getZkController().getZkStateReader().getCloudState().liveNodesContain(clientToInfo.get(new CloudSolrServerClient(shardToClient.get(SHARD2).get(0))).get(ZkStateReader.NODE_NAME_PROP))) {
-      if (tries++ == 120) {
-        fail("Shard still reported as live in zk");
-      }
-      Thread.sleep(1000);
-    }
+
 	
     long numFound1 = cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound();
     
-    index_specific(shardToClient.get(SHARD2).get(1), id, 1000, i1, 108, t1,
+    index_specific(shardToJetty.get(SHARD2).get(1).client.solrClient, id, 1000, i1, 108, t1,
         "specific doc!");
     
     commit();
@@ -777,21 +797,29 @@ public class FullSolrCloudTest extends A
     // query("q","matchesnothing","fl","*,score", "debugQuery", "true");
     
     // this should trigger a recovery phase on deadShard
-    deadShard.start(true);
+    ChaosMonkey.start(deadShard.jetty);
     
     // make sure we have published we are recovering
     Thread.sleep(1500);
     
     waitForRecoveriesToFinish(false);
     
-    deadShardCount = shardToClient.get(SHARD2).get(0).query(query).getResults().getNumFound();
+    deadShardCount = shardToJetty.get(SHARD2).get(0).client.solrClient
+        .query(query).getResults().getNumFound();
     // if we properly recovered, we should now have the couple missing docs that
     // came in while shard was down
     checkShardConsistency(true, false);
     
     
     // recover over 100 docs so we do more than just peer sync (replicate recovery)
-    deadShard = chaosMonkey.stopShard(SHARD2, 0);
+    chaosMonkey.stopJetty(deadShard);
+    
+    for (CloudJettyRunner cjetty : jetties) {
+      waitToSeeNotLive(((SolrDispatchFilter) cjetty.jetty.getDispatchFilter()
+          .getFilter()).getCores().getZkController().getZkStateReader(),
+          deadShard);
+    }
+    waitToSeeNotLive(cloudClient.getZkStateReader(), deadShard);
     
     for (int i = 0; i < 226; i++) {
       doc = new SolrInputDocument();
@@ -804,7 +832,9 @@ public class FullSolrCloudTest extends A
     }
     commit();
     
-    deadShard.start(true);
+    Thread.sleep(1500);
+    
+    ChaosMonkey.start(deadShard.jetty);
     
     // make sure we have published we are recovering
     Thread.sleep(1500);
@@ -1009,10 +1039,10 @@ public class FullSolrCloudTest extends A
   protected String checkShardConsistency(String shard, boolean verbose)
       throws Exception {
     
-    List<SolrServer> solrClients = shardToClient.get(shard);
-    if (solrClients == null) {
+    List<CloudJettyRunner> solrJetties = shardToJetty.get(shard);
+    if (solrJetties == null) {
       throw new RuntimeException("shard not found:" + shard + " keys:"
-          + shardToClient.keySet());
+          + shardToJetty.keySet());
     }
     long num = -1;
     long lastNum = -1;
@@ -1024,18 +1054,18 @@ public class FullSolrCloudTest extends A
         "The client count does not match up with the shard count for slice:"
             + shard,
         zkStateReader.getCloudState().getSlice(DEFAULT_COLLECTION, shard)
-            .getShards().size(), solrClients.size());
+            .getShards().size(), solrJetties.size());
 
     SolrServer lastClient = null;
-    for (SolrServer client : solrClients) {
-      ZkNodeProps props = clientToInfo.get(new CloudSolrServerClient(client));
+    for (CloudJettyRunner cjetty : solrJetties) {
+      ZkNodeProps props = cjetty.info;
       if (verbose) System.err.println("client" + cnt++);
       if (verbose) System.err.println("PROPS:" + props);
       
       try {
         SolrQuery query = new SolrQuery("*:*");
         query.set("distrib", false);
-        num = client.query(query).getResults().getNumFound();
+        num = cjetty.client.solrClient.query(query).getResults().getNumFound();
       } catch (SolrServerException e) {
         if (verbose) System.err.println("error contacting client: "
             + e.getMessage() + "\n");
@@ -1060,7 +1090,7 @@ public class FullSolrCloudTest extends A
       if (active && live) {
         if (lastNum > -1 && lastNum != num && failMessage == null) {
           failMessage = shard + " is not consistent.  Got " + lastNum + " from " + lastClient + "lastClient"
-              + " and got " + num + " from " + client;
+              + " and got " + num + " from " + cjetty.url;
 
           if (verbose || true) {
             System.err.println("######" + failMessage);
@@ -1071,14 +1101,14 @@ public class FullSolrCloudTest extends A
             query.set("sort","id asc");
 
             SolrDocumentList lst1 = lastClient.query(query).getResults();
-            SolrDocumentList lst2 = client.query(query).getResults();
+            SolrDocumentList lst2 = cjetty.client.solrClient.query(query).getResults();
 
-            showDiff(lst1, lst2, lastClient.toString(), client.toString());
+            showDiff(lst1, lst2, lastClient.toString(), cjetty.client.solrClient.toString());
           }
 
         }
         lastNum = num;
-        lastClient = client;
+        lastClient = cjetty.client.solrClient;
       }
     }
     return failMessage;
@@ -1125,7 +1155,7 @@ public class FullSolrCloudTest extends A
     
     updateMappingsFromZk(jettys, clients);
     
-    Set<String> theShards = shardToClient.keySet();
+    Set<String> theShards = shardToJetty.keySet();
     String failMessage = null;
     for (String shard : theShards) {
       String shardFailMessage = checkShardConsistency(shard, verbose);
@@ -1140,15 +1170,15 @@ public class FullSolrCloudTest extends A
     
     if (checkVsControl) {
       // now check that the right # are on each shard
-      theShards = shardToClient.keySet();
+      theShards = shardToJetty.keySet();
       int cnt = 0;
       for (String s : theShards) {
-        int times = shardToClient.get(s).size();
+        int times = shardToJetty.get(s).size();
         for (int i = 0; i < times; i++) {
           try {
-            SolrServer client = shardToClient.get(s).get(i);
-            ZkNodeProps props = clientToInfo.get(new CloudSolrServerClient(
-                client));
+            CloudJettyRunner cjetty = shardToJetty.get(s).get(i);
+            ZkNodeProps props = cjetty.info;
+            SolrServer client = cjetty.client.solrClient;
             boolean active = props.get(ZkStateReader.STATE_PROP).equals(
                 ZkStateReader.ACTIVE);
             if (active) {
@@ -1180,9 +1210,10 @@ public class FullSolrCloudTest extends A
   }
   
   private SolrServer getClient(String nodeName) {
-    for (CloudSolrServerClient client : clientToInfo.keySet()) {
+    for (CloudJettyRunner cjetty : cloudJettys) {
+      CloudSolrServerClient client = cjetty.client;
       if (client.shardName.equals(nodeName)) {
-        return client.client;
+        return client.solrClient;
       }
     }
     return null;
@@ -1216,12 +1247,13 @@ public class FullSolrCloudTest extends A
           + DEFAULT_COLLECTION + " in " + cloudState.getCollections());
     }
     
-    for (SolrServer client : clients) {
+    for (CloudJettyRunner cjetty : cloudJettys) {
+      CloudSolrServerClient client = cjetty.client;
       for (Map.Entry<String,Slice> slice : slices.entrySet()) {
         Map<String,ZkNodeProps> theShards = slice.getValue().getShards();
         for (Map.Entry<String,ZkNodeProps> shard : theShards.entrySet()) {
           String shardName = new URI(
-              ((HttpSolrServer) client).getBaseURL()).getPort()
+              ((HttpSolrServer) client.solrClient).getBaseURL()).getPort()
               + "_solr_";
           if (verbose && shard.getKey().endsWith(shardName)) {
             System.err.println("shard:" + slice.getKey());
@@ -1231,12 +1263,14 @@ public class FullSolrCloudTest extends A
       }
       
       long count = 0;
-      String currentState = clientToInfo.get(new CloudSolrServerClient(client))
-          .get(ZkStateReader.STATE_PROP);
-      if (currentState != null && currentState.equals(ZkStateReader.ACTIVE)) {
+      String currentState = cjetty.info.get(ZkStateReader.STATE_PROP);
+      if (currentState != null
+          && currentState.equals(ZkStateReader.ACTIVE)
+          && zkStateReader.getCloudState().liveNodesContain(
+              cjetty.info.get(ZkStateReader.NODE_NAME_PROP))) {
         SolrQuery query = new SolrQuery("*:*");
         query.set("distrib", false);
-        count = client.query(query).getResults().getNumFound();
+        count = client.solrClient.query(query).getResults().getNumFound();
       }
       
       if (verbose) System.err.println("client docs:" + count + "\n\n");
@@ -1259,7 +1293,14 @@ public class FullSolrCloudTest extends A
     return rsp;
   }
   
-  class StopableIndexingThread extends Thread {
+  abstract class StopableThread extends Thread {
+    public StopableThread(String name) {
+      super(name);
+    }
+    public abstract void safeStop();
+  }
+  
+  class StopableIndexingThread extends StopableThread {
     private volatile boolean stop = false;
     protected final int startI;
     protected final List<Integer> deletes = new ArrayList<Integer>();
@@ -1333,6 +1374,55 @@ public class FullSolrCloudTest extends A
     
   };
   
+  class StopableSearchThread extends StopableThread {
+    private volatile boolean stop = false;
+    protected final AtomicInteger fails = new AtomicInteger();
+    private String[] QUERIES = new String[] {"to come","their country","aid","co*"};
+    
+    public StopableSearchThread() {
+      super("StopableSearchThread");
+      setDaemon(true);
+    }
+    
+    @Override
+    public void run() {
+      Random random = random();
+      int numSearches = 0;
+      
+      while (true && !stop) {
+        numSearches++;
+        try {
+          //to come to the aid of their country.
+          cloudClient.query(new SolrQuery(QUERIES[random.nextInt(QUERIES.length)]));
+        } catch (Exception e) {
+          System.err.println("QUERY REQUEST FAILED:");
+          e.printStackTrace();
+          if (e instanceof SolrServerException) {
+            System.err.println("ROOT CAUSE:");
+            ((SolrServerException) e).getRootCause().printStackTrace();
+          }
+          fails.incrementAndGet();
+        }
+        try {
+          Thread.sleep(random.nextInt(4000) + 300);
+        } catch (InterruptedException e) {
+          Thread.currentThread().interrupt();
+        }
+      }
+      
+      System.err.println("num searches done:" + numSearches + " with " + fails + " fails");
+    }
+    
+    public void safeStop() {
+      stop = true;
+    }
+    
+    public int getFails() {
+      return fails.get();
+    }
+    
+  };
+  
   protected void waitForThingsToLevelOut(int waitForRecTimeSeconds) throws Exception {
     log.info("Wait for recoveries to finish - wait " + waitForRecTimeSeconds + " for each attempt");
     int cnt = 0;
@@ -1348,7 +1438,7 @@ public class FullSolrCloudTest extends A
       
       updateMappingsFromZk(jettys, clients);
       
-      Set<String> theShards = shardToClient.keySet();
+      Set<String> theShards = shardToJetty.keySet();
       String failMessage = null;
       for (String shard : theShards) {
         failMessage = checkShardConsistency(shard, false);
@@ -1415,4 +1505,16 @@ public class FullSolrCloudTest extends A
       throw new RuntimeException(ex);
     }
   }
+  
+  protected void waitToSeeNotLive(ZkStateReader zkStateReader,
+      CloudJettyRunner cjetty) throws InterruptedException {
+    int tries = 0;
+    while (zkStateReader.getCloudState()
+        .liveNodesContain(cjetty.info.get(ZkStateReader.NODE_NAME_PROP))) {
+      if (tries++ == 120) {
+        fail("Shard still reported as live in zk");
+      }
+      Thread.sleep(1000);
+    }
+  }
 }

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/RecoveryZkTest.java Tue Jul 31 20:58:32 2012
@@ -72,7 +72,7 @@ public class RecoveryZkTest extends Full
     Thread.sleep(atLeast(2000));   
     
     // bring shard replica down
-    JettySolrRunner replica = chaosMonkey.stopShard("shard1", 1);
+    JettySolrRunner replica = chaosMonkey.stopShard("shard1", 1).jetty;
 
     
     // wait a moment - lets allow some docs to be indexed so replication time is non 0
@@ -100,8 +100,8 @@ public class RecoveryZkTest extends Full
     checkShardConsistency("shard1", false); 
     SolrQuery query = new SolrQuery("*:*");
     query.setParam("distrib", "false");
-    long client1Docs = shardToClient.get("shard1").get(0).query(query).getResults().getNumFound();
-    long client2Docs = shardToClient.get("shard1").get(1).query(query).getResults().getNumFound();
+    long client1Docs = shardToJetty.get("shard1").get(0).client.solrClient.query(query).getResults().getNumFound();
+    long client2Docs = shardToJetty.get("shard1").get(1).client.solrClient.query(query).getResults().getNumFound();
     
     assertTrue(client1Docs > 0);
     assertEquals(client1Docs, client2Docs);

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java Tue Jul 31 20:58:32 2012
@@ -19,6 +19,7 @@ package org.apache.solr.cloud;
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -32,6 +33,7 @@ import org.apache.solr.client.solrj.requ
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.params.CollectionParams.CollectionAction;
 import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.servlet.SolrDispatchFilter;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -74,7 +76,7 @@ public class SyncSliceTest extends FullS
   public SyncSliceTest() {
     super();
     sliceCount = 1;
-    shardCount = 3;
+    shardCount = TEST_NIGHTLY ? 7 : 4;
   }
   
   @Override
@@ -86,29 +88,33 @@ public class SyncSliceTest extends FullS
     
     waitForThingsToLevelOut();
 
-    // something wrong with this?
-    //del("*:*");
-    
+    del("*:*");
     List<String> skipServers = new ArrayList<String>();
-    
-    indexDoc(skipServers, id, 0, i1, 50, tlong, 50, t1,
+    int docId = 0;
+    indexDoc(skipServers, id, docId++, i1, 50, tlong, 50, t1,
         "to come to the aid of their country.");
     
-    indexDoc(skipServers, id, 1, i1, 50, tlong, 50, t1,
+    indexDoc(skipServers, id, docId++, i1, 50, tlong, 50, t1,
         "old haven was blue.");
     
     skipServers.add(shardToJetty.get("shard1").get(1).url + "/");
     
-    indexDoc(skipServers, id, 2, i1, 50, tlong, 50, t1,
+    indexDoc(skipServers, id, docId++, i1, 50, tlong, 50, t1,
         "but the song was fancy.");
     
     skipServers.add(shardToJetty.get("shard1").get(2).url + "/");
     
-    indexDoc(skipServers, id, 3, i1, 50, tlong, 50, t1,
+    indexDoc(skipServers, id,docId++, i1, 50, tlong, 50, t1,
         "under the moon and over the lake");
     
     commit();
+    
+    waitForRecoveriesToFinish(false);
 
+    // shard should be inconsistent
+    String shardFailMessage = checkShardConsistency("shard1", true);
+    assertNotNull(shardFailMessage);
+    
     ModifiableSolrParams params = new ModifiableSolrParams();
     params.set("action", CollectionAction.SYNCSHARD.toString());
     params.set("collection", "collection1");
@@ -116,7 +122,8 @@ public class SyncSliceTest extends FullS
     SolrRequest request = new QueryRequest(params);
     request.setPath("/admin/collections");
     
-    String baseUrl = ((HttpSolrServer) shardToClient.get("shard1").get(2)).getBaseURL();
+    String baseUrl = ((HttpSolrServer) shardToJetty.get("shard1").get(2).client.solrClient)
+        .getBaseURL();
     baseUrl = baseUrl.substring(0, baseUrl.length() - "collection1".length());
     
     HttpSolrServer baseServer = new HttpSolrServer(baseUrl);
@@ -129,16 +136,28 @@ public class SyncSliceTest extends FullS
     long cloudClientDocs = cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound();
     assertEquals(4, cloudClientDocs);
     
-    skipServers = new ArrayList<String>();
     
-    skipServers.add(shardToJetty.get("shard1").get(random().nextInt(shardCount)).url + "/");
+    // kill the leader - new leader could have all the docs or be missing one
+    CloudJettyRunner leaderJetty = shardToLeaderJetty.get("shard1");
+    
+    skipServers = getRandomOtherJetty(leaderJetty, null); // but not the leader
     
     // this doc won't be on one node
-    indexDoc(skipServers, id, 4, i1, 50, tlong, 50, t1,
+    indexDoc(skipServers, id, docId++, i1, 50, tlong, 50, t1,
         "to come to the aid of their country.");
     
-    // kill the leader - new leader could have all the docs or be missing one
-    chaosMonkey.killJetty(shardToLeaderJetty.get("shard1").jetty);
+    
+    Set<CloudJettyRunner> jetties = new HashSet<CloudJettyRunner>();
+    jetties.addAll(shardToJetty.get("shard1"));
+    jetties.remove(leaderJetty);
+    assertEquals(shardCount - 1, jetties.size());
+    
+    chaosMonkey.killJetty(leaderJetty);
+
+    // we are careful to make sure the downed node is no longer in the state,
+    // because on some systems (especially freebsd w/ blackhole enabled), trying
+    // to talk to a downed node causes grief
+    waitToSeeDownInCloudState(leaderJetty, jetties);
 
     waitForThingsToLevelOut();
     
@@ -146,6 +165,98 @@ public class SyncSliceTest extends FullS
     
     cloudClientDocs = cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound();
     assertEquals(5, cloudClientDocs);
+    
+    CloudJettyRunner deadJetty = leaderJetty;
+    
+    // let's get the latest leader
+    while (deadJetty == leaderJetty) {
+      updateMappingsFromZk(this.jettys, this.clients);
+      leaderJetty = shardToLeaderJetty.get("shard1");
+    }
+    
+    // bring back dead node
+    ChaosMonkey.start(deadJetty.jetty); // he is not the leader anymore
+    
+    // give a moment to be sure it has started recovering
+    Thread.sleep(2000);
+    
+    waitForThingsToLevelOut();
+    waitForRecoveriesToFinish(false);
+    
+    skipServers = getRandomOtherJetty(leaderJetty, null);
+    skipServers.addAll( getRandomOtherJetty(leaderJetty, null));
+    // skip list should be 
+    
+    //System.out.println("leader:" + leaderJetty.url);
+    //System.out.println("skip list:" + skipServers);
+    
+    // we are skipping  one nodes
+    assertEquals(2, skipServers.size());
+    
+    // more docs than can peer sync
+    for (int i = 0; i < 300; i++) {
+      indexDoc(skipServers, id, docId++, i1, 50, tlong, 50, t1,
+          "to come to the aid of their country.");
+    }
+    
+    commit();
+    
+    waitForRecoveriesToFinish(false);
+    
+    // shard should be inconsistent
+    shardFailMessage = checkShardConsistency("shard1", true);
+    assertNotNull(shardFailMessage);
+    
+    
+    jetties = new HashSet<CloudJettyRunner>();
+    jetties.addAll(shardToJetty.get("shard1"));
+    jetties.remove(leaderJetty);
+    assertEquals(shardCount - 1, jetties.size());
+
+    
+    // kill the current leader
+    chaosMonkey.killJetty(leaderJetty);
+    
+    waitToSeeDownInCloudState(leaderJetty, jetties);
+    
+    Thread.sleep(4000);
+    
+    waitForRecoveriesToFinish(false);
+
+    checkShardConsistency(true, true);
+  }
+
+  private List<String> getRandomJetty() {
+    return getRandomOtherJetty(null, null);
+  }
+  
+  private List<String> getRandomOtherJetty(CloudJettyRunner leader, CloudJettyRunner down) {
+    List<String> skipServers = new ArrayList<String>();
+    List<CloudJettyRunner> candidates = new ArrayList<CloudJettyRunner>();
+    candidates.addAll(shardToJetty.get("shard1"));
+
+    if (leader != null) {
+      candidates.remove(leader);
+    }
+    
+    if (down != null) {
+      candidates.remove(down);
+    }
+    
+    CloudJettyRunner cjetty = candidates.get(random().nextInt(candidates.size()));
+    skipServers.add(cjetty.url + "/");
+    return skipServers;
+  }
+
+  private void waitToSeeDownInCloudState(CloudJettyRunner leaderJetty,
+      Set<CloudJettyRunner> jetties) throws InterruptedException {
+
+    for (CloudJettyRunner cjetty : jetties) {
+      waitToSeeNotLive(((SolrDispatchFilter) cjetty.jetty.getDispatchFilter()
+          .getFilter()).getCores().getZkController().getZkStateReader(),
+          leaderJetty);
+    }
+    waitToSeeNotLive(cloudClient.getZkStateReader(), leaderJetty);
   }
 
   private void waitForThingsToLevelOut() throws Exception {
@@ -158,7 +269,7 @@ public class SyncSliceTest extends FullS
       
       updateMappingsFromZk(jettys, clients);
       
-      Set<String> theShards = shardToClient.keySet();
+      Set<String> theShards = shardToJetty.keySet();
       String failMessage = null;
       for (String shard : theShards) {
         failMessage = checkShardConsistency(shard, false);

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/TestMultiCoreConfBootstrap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/TestMultiCoreConfBootstrap.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/TestMultiCoreConfBootstrap.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/cloud/TestMultiCoreConfBootstrap.java Tue Jul 31 20:58:32 2012
@@ -48,7 +48,8 @@ public class TestMultiCoreConfBootstrap 
   
   @AfterClass
   public static void afterClass() {
-
+    zkServer = null;
+    zkDir = null;
   }
   
   @Override

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/core/ResourceLoaderTest.java Tue Jul 31 20:58:32 2012
@@ -20,8 +20,8 @@ package org.apache.solr.core;
 import junit.framework.Assert;
 
 import org.apache.lucene.util.LuceneTestCase;
-import org.apache.solr.analysis.KeywordTokenizerFactory;
-import org.apache.solr.analysis.NGramFilterFactory;
+import org.apache.lucene.analysis.core.KeywordTokenizerFactory;
+import org.apache.lucene.analysis.ngram.NGramFilterFactory;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.handler.admin.LukeRequestHandler;
 import org.apache.solr.handler.component.FacetComponent;

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Tue Jul 31 20:58:32 2012
@@ -117,6 +117,9 @@ public class TestReplicationHandler exte
     slaveJetty.stop();
     master.tearDown();
     slave.tearDown();
+    masterJetty = slaveJetty = null;
+    master = slave = null;
+    masterClient = slaveClient = null;
   }
 
   private static JettySolrRunner createJetty(SolrInstance instance) throws Exception {

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java Tue Jul 31 20:58:32 2012
@@ -20,16 +20,20 @@ package org.apache.solr.handler.admin;
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.handler.admin.CoreAdminHandler;
+import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.CoreAdminParams;
+import org.apache.solr.common.util.NamedList;
 import org.apache.solr.response.SolrQueryResponse;
+import org.apache.solr.SolrTestCaseJ4;
 
+import java.util.Map;
 import java.io.File;
 import java.io.IOException;
 
 import javax.xml.xpath.XPathExpressionException;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.solr.SolrTestCaseJ4;
+
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.xml.sax.SAXException;
@@ -94,7 +98,49 @@ public class CoreAdminHandlerTest extend
        ,"/solr/cores/core[@name='props']/property[@name='hoss' and @value='man']"
        ,"/solr/cores/core[@name='props']/property[@name='foo' and @value='baz']"
        );
-    
+
+    // attempt to create a bogus core and confirm failure
+    try {
+      resp = new SolrQueryResponse();
+      admin.handleRequestBody
+        (req(CoreAdminParams.ACTION, 
+             CoreAdminParams.CoreAdminAction.CREATE.toString(),
+             CoreAdminParams.NAME, "bogus_dir_core",
+             CoreAdminParams.INSTANCE_DIR, "dir_does_not_exist_127896"),
+         resp);
+      fail("bogus collection created ok");
+    } catch (SolrException e) {
+      // :NOOP:
+      // :TODO: CoreAdminHandler's exception messages are terrible, otherwise we could asert something useful here
+    }
+
+    // check specificly for status of the failed core name
+    resp = new SolrQueryResponse();
+    admin.handleRequestBody
+      (req(CoreAdminParams.ACTION, 
+           CoreAdminParams.CoreAdminAction.STATUS.toString(),
+           CoreAdminParams.CORE, "bogus_dir_core"),
+         resp);
+    Map<String,Exception> failures = 
+      (Map<String,Exception>) resp.getValues().get("initFailures");
+    assertNotNull("core failures is null", failures);
+
+    NamedList<Object> status = 
+      (NamedList<Object>)resp.getValues().get("status");
+    assertNotNull("core status is null", status);
+
+    assertEquals("wrong number of core failures", 1, failures.size());
+    Exception fail = failures.get("bogus_dir_core");
+    assertNotNull("null failure for test core", fail);
+    assertTrue("init failure doesn't mention problem: " + fail.getMessage(),
+               0 < fail.getMessage().indexOf("dir_does_not_exist"));
+
+    assertEquals("bogus_dir_core status isn't empty",
+                 0, ((NamedList)status.get("bogus_dir_core")).size());
+
+               
+    // :TODO: because of SOLR-3665 we can't ask for status from all cores
+
   }
 
   

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/component/DummyCustomParamSpellChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/component/DummyCustomParamSpellChecker.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/component/DummyCustomParamSpellChecker.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/component/DummyCustomParamSpellChecker.java Tue Jul 31 20:58:32 2012
@@ -8,8 +8,10 @@ import org.apache.solr.spelling.Spelling
 import org.apache.solr.spelling.SpellingResult;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.List;
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -40,7 +42,7 @@ public class DummyCustomParamSpellChecke
   }
 
   @Override
-  public void build(SolrCore core, SolrIndexSearcher searcher) {
+  public void build(SolrCore core, SolrIndexSearcher searcher) throws IOException {
 
   }
 
@@ -49,12 +51,20 @@ public class DummyCustomParamSpellChecke
 
     SpellingResult result = new SpellingResult();
     //just spit back out the results
+
+    // sort the keys to make ordering predictable
     Iterator<String> iterator = options.customParams.getParameterNamesIterator();
+    List<String> lst = new ArrayList<String>();
+    while (iterator.hasNext()) {
+      lst.add(iterator.next());
+    }
+    Collections.sort(lst);
+
     int i = 0;
-    while (iterator.hasNext()){
-      String name = iterator.next();
+    for (String name : lst) {
       String value = options.customParams.get(name);
-      result.add(new Token(name, i++, i++),  Collections.singletonList(value));
+      result.add(new Token(name, i, i+1),  Collections.singletonList(value));
+      i += 2;
     }    
     return result;
   }

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java Tue Jul 31 20:58:32 2012
@@ -20,6 +20,7 @@ package org.apache.solr.handler.componen
 import java.io.File;
 import java.util.*;
 
+import org.apache.lucene.util.Constants;
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.params.CommonParams;

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java Tue Jul 31 20:58:32 2012
@@ -2004,4 +2004,61 @@ public class SimpleFacetsTest extends So
             ,"*[count(//lst[@name='facet_fields']/lst/int)=0]"
     );
   }
+
+  /** 
+   * kind of an absurd tests because if there is an inifnite loop, it 
+   * would ver finish -- but at least it ensures that <i>if</i> one of 
+   * these requests return, they return an error 
+   */
+  public void testRangeFacetInfiniteLoopDetection() {
+
+    for (String field : new String[] {"foo_f", "foo_sf", 
+                                      "foo_d", "foo_sd",
+                                      "foo_i", "foo_si"}) {
+      assertQEx("no zero gap error: " + field,
+                req("q", "*:*",
+                    "facet", "true",
+                    "facet.range", field,
+                    "facet.range.start", "23",
+                    "facet.range.gap", "0",
+                    "facet.range.end", "100"),
+                400);
+    }
+    for (String field : new String[] {"foo_pdt", "foo_dt"}) {
+      for (String type : new String[] {"date", "range"}) {
+      assertQEx("no zero gap error for facet." + type + ": " + field,
+                req("q", "*:*",
+                    "facet", "true",
+                    "facet." + type, field,
+                    "facet."+type+".start", "NOW",
+                    "facet."+type+".gap", "+0DAYS",
+                    "facet."+type+".end", "NOW+10DAY"),
+                400);
+      }
+    }
+    
+    for (String field : new String[] {"foo_f", "foo_sf"}) {
+      assertQEx("no float underflow error: " + field,
+                req("q", "*:*",
+                    "facet", "true",
+                    "facet.range", field,
+                    "facet.range.start", "100000000000",
+                    "facet.range.end", "100000086200",
+                    "facet.range.gap", "2160"),
+                400);
+    }
+
+    for (String field : new String[] {"foo_d", "foo_sd"}) {
+      assertQEx("no double underflow error: " + field,
+                req("q", "*:*",
+                    "facet", "true",
+                    "facet.range", field,
+                    "facet.range.start", "9900000000000",
+                    "facet.range.end", "9900000086200",
+                    "facet.range.gap", "0.0003"),
+                400);
+    }
+    
+  }
+
 }

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java Tue Jul 31 20:58:32 2012
@@ -49,6 +49,7 @@ public class BadIndexSchemaTest extends 
 
   public void testSevereErrorsForUnexpectedAnalyzer() throws Exception {
     doTest("bad-schema-nontext-analyzer.xml", "StrField (bad_type)");
+    doTest("bad-schema-analyzer-class-and-nested.xml", "bad_type");
   }
 
   public void testBadExternalFileField() throws Exception {
@@ -61,6 +62,8 @@ public class BadIndexSchemaTest extends 
            "can not be the dest of a copyField");
     doTest("bad-schema-uniquekey-uses-default.xml", 
            "can not be configured with a default value");
+    doTest("bad-schema-uniquekey-multivalued.xml", 
+           "can not be configured to be multivalued");
   }
 
   public void testPerFieldtypeSimButNoSchemaSimFactory() throws Exception {

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/schema/MultiTermTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/schema/MultiTermTest.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/schema/MultiTermTest.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/schema/MultiTermTest.java Tue Jul 31 20:58:32 2012
@@ -18,6 +18,12 @@ package org.apache.solr.schema;
  */
 
 import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.charfilter.MappingCharFilterFactory;
+import org.apache.lucene.analysis.core.KeywordTokenizerFactory;
+import org.apache.lucene.analysis.core.LowerCaseFilterFactory;
+import org.apache.lucene.analysis.core.WhitespaceTokenizerFactory;
+import org.apache.lucene.analysis.miscellaneous.ASCIIFoldingFilterFactory;
+import org.apache.lucene.analysis.miscellaneous.TrimFilterFactory;
 import org.apache.lucene.analysis.util.TokenFilterFactory;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.analysis.*;

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/search/TestRTGBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/search/TestRTGBase.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/search/TestRTGBase.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/search/TestRTGBase.java Tue Jul 31 20:58:32 2012
@@ -134,7 +134,7 @@ public class TestRTGBase extends SolrTes
     if (!termsEnum.seekExact(termBytes, false)) {
       return -1;
     }
-    DocsEnum docs = termsEnum.docs(MultiFields.getLiveDocs(r), null, false);
+    DocsEnum docs = termsEnum.docs(MultiFields.getLiveDocs(r), null, 0);
     int id = docs.nextDoc();
     if (id != DocIdSetIterator.NO_MORE_DOCS) {
       int next = docs.nextDoc();

Modified: lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/search/TestValueSourceCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/search/TestValueSourceCache.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/search/TestValueSourceCache.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/core/src/test/org/apache/solr/search/TestValueSourceCache.java Tue Jul 31 20:58:32 2012
@@ -21,6 +21,7 @@ import org.apache.lucene.queryparser.cla
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.QueryUtils;
 import org.apache.solr.SolrTestCaseJ4;
+import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -34,6 +35,11 @@ public class TestValueSourceCache extend
   }
 
   static QParser _func;
+  
+  @AfterClass
+  public static void afterClass() throws Exception {
+    _func = null;
+  }
 
   Query getQuery(String query) throws ParseException {
     _func.setString(query);

Modified: lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/db/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/db/conf/schema.xml?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/db/conf/schema.xml (original)
+++ lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/db/conf/schema.xml Tue Jul 31 20:58:32 2012
@@ -259,7 +259,7 @@
        best performance.
    -->
 
-   <field name="id" type="string" indexed="true" stored="true" required="true" /> 
+   <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
    <field name="sku" type="textTight" indexed="true" stored="true" omitNorms="true"/>
    <field name="name" type="text" indexed="true" stored="true"/>
    <field name="nameSort" type="string" indexed="true" stored="false"/>

Modified: lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml (original)
+++ lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/rss/conf/rss-data-config.xml Tue Jul 31 20:58:32 2012
@@ -17,7 +17,7 @@
             <field column="description" xpath="/RDF/item/description" />
             <field column="creator" xpath="/RDF/item/creator" />
             <field column="item-subject" xpath="/RDF/item/subject" />
-            <field column="date" xpath="/RDF/item/date" dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss" />
+            <field column="date" xpath="/RDF/item/date" dateTimeFormat="yyyy-MM-dd'T'HH:mm:ss" />
             <field column="slash-department" xpath="/RDF/item/department" />
             <field column="slash-section" xpath="/RDF/item/section" />
             <field column="slash-comments" xpath="/RDF/item/comments" />

Modified: lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/rss/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/rss/conf/schema.xml?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/rss/conf/schema.xml (original)
+++ lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/rss/conf/schema.xml Tue Jul 31 20:58:32 2012
@@ -291,7 +291,7 @@
 	
 	<field name="subject" type="text" indexed="true" stored="true" />
 	<field name="title" type="text" indexed="true" stored="true" />
-	<field name="link" type="string" indexed="true" stored="true" />
+	<field name="link" type="string" indexed="true" stored="true" multiValued="false" />
 	<field name="description" type="html" indexed="true" stored="true" />
 	<field name="creator" type="string" indexed="false" stored="true" />
 	<field name="item-subject" type="string" indexed="true" stored="false" />

Modified: lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/solr/conf/schema.xml?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/solr/conf/schema.xml (original)
+++ lucene/dev/branches/pforcodec_3892/solr/example/example-DIH/solr/solr/conf/schema.xml Tue Jul 31 20:58:32 2012
@@ -259,7 +259,7 @@
        best performance.
    -->
 
-   <field name="id" type="string" indexed="true" stored="true" required="true" /> 
+   <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
    <field name="sku" type="textTight" indexed="true" stored="true" omitNorms="true"/>
    <field name="name" type="text" indexed="true" stored="true"/>
    <field name="nameSort" type="string" indexed="true" stored="false"/>

Modified: lucene/dev/branches/pforcodec_3892/solr/example/solr/collection1/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/example/solr/collection1/conf/schema.xml?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/example/solr/collection1/conf/schema.xml (original)
+++ lucene/dev/branches/pforcodec_3892/solr/example/solr/collection1/conf/schema.xml Tue Jul 31 20:58:32 2012
@@ -91,7 +91,7 @@
       trailing underscores (e.g. _version_) are reserved.
    -->
         
-   <field name="id" type="string" indexed="true" stored="true" required="true" /> 
+   <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
    <field name="sku" type="text_en_splitting_tight" indexed="true" stored="true" omitNorms="true"/>
    <field name="name" type="text_general" indexed="true" stored="true"/>
    <field name="manu" type="text_general" indexed="true" stored="true" omitNorms="true"/>
@@ -137,7 +137,6 @@
 
    <field name="payloads" type="payloads" indexed="true" stored="true"/>
 
-
    <field name="_version_" type="long" indexed="true" stored="true"/>
 
    <!-- Uncommenting the following will create a "timestamp" field using
@@ -607,12 +606,30 @@
       </analyzer>
     </fieldType>
 
-    <fieldType name="text_path" class="solr.TextField" positionIncrementGap="100">
-      <analyzer>
-        <tokenizer class="solr.PathHierarchyTokenizerFactory"/>
+    <!-- 
+      Example of using PathHierarchyTokenizerFactory at index time, so
+      queries for paths match documents at that path, or in descendent paths
+    -->
+    <fieldType name="descendent_path" class="solr.TextField">
+      <analyzer type="index">
+	<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
+      </analyzer>
+      <analyzer type="query">
+	<tokenizer class="solr.KeywordTokenizerFactory" />
+      </analyzer>
+    </fieldType>
+    <!-- 
+      Example of using PathHierarchyTokenizerFactory at query time, so
+      queries for paths match documents at that path, or in ancestor paths
+    -->
+    <fieldType name="ancestor_path" class="solr.TextField">
+      <analyzer type="index">
+	<tokenizer class="solr.KeywordTokenizerFactory" />
+      </analyzer>
+      <analyzer type="query">
+	<tokenizer class="solr.PathHierarchyTokenizerFactory" delimiter="/" />
       </analyzer>
     </fieldType>
-
 
     <!-- since fields of this type are by default not stored or indexed,
          any data added to them will be ignored outright.  --> 
@@ -1041,6 +1058,7 @@
         <filter class="solr.SnowballPorterFilterFactory" language="Turkish"/>
       </analyzer>
     </fieldType>
+
  </types>
   
   <!-- Similarity is the scoring routine for each document vs. a query.

Modified: lucene/dev/branches/pforcodec_3892/solr/example/solr/collection1/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/example/solr/collection1/conf/solrconfig.xml?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/example/solr/collection1/conf/solrconfig.xml (original)
+++ lucene/dev/branches/pforcodec_3892/solr/example/solr/collection1/conf/solrconfig.xml Tue Jul 31 20:58:32 2012
@@ -821,6 +821,8 @@
   <requestHandler name="/get" class="solr.RealTimeGetHandler">
      <lst name="defaults">
        <str name="omitHeader">true</str>
+       <str name="wt">json</str>
+       <str name="indent">true</str>
      </lst>
   </requestHandler>
 
@@ -1609,6 +1611,24 @@
        <processor class="solr.RunUpdateProcessorFactory" />
      </updateRequestProcessorChain>
     -->
+
+  <!-- Script update processor
+
+    This example hooks in an update processor implemented using JavaScript.
+
+    See more about the script update processor at http://wiki.apache.org/solr/ScriptUpdateProcessor
+  -->
+  <!--
+    <updateRequestProcessorChain name="script">
+      <processor class="solr.StatelessScriptUpdateProcessorFactory">
+        <str name="script">update-script.js</str>
+        <lst name="params">
+          <str name="config_param">example config parameter</str>
+        </lst>
+      </processor>
+      <processor class="solr.RunUpdateProcessorFactory" />
+    </updateRequestProcessorChain>
+  -->
  
   <!-- Response Writers
 

Modified: lucene/dev/branches/pforcodec_3892/solr/solrj/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/solrj/build.xml?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/solrj/build.xml (original)
+++ lucene/dev/branches/pforcodec_3892/solr/solrj/build.xml Tue Jul 31 20:58:32 2012
@@ -20,6 +20,9 @@
 
   <property name="ivy.retrieve.pattern" value="${common-solr.dir}/lib/[artifact]-[revision].[ext]"/>
 
+  <!-- we cannot sync because solr/core and solr/solrj share the same lib/... clean this up! -->
+  <property name="ivy.sync" value="false"/>
+
   <import file="../common-build.xml"/>
 
   <!-- Specialized common-solr.test.classpath, to remove the Solr core test output -->

Modified: lucene/dev/branches/pforcodec_3892/solr/test-framework/src/java/org/apache/solr/analysis/StringMockSolrResourceLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/test-framework/src/java/org/apache/solr/analysis/StringMockSolrResourceLoader.java?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/test-framework/src/java/org/apache/solr/analysis/StringMockSolrResourceLoader.java (original)
+++ lucene/dev/branches/pforcodec_3892/solr/test-framework/src/java/org/apache/solr/analysis/StringMockSolrResourceLoader.java Tue Jul 31 20:58:32 2012
@@ -32,11 +32,7 @@ class StringMockSolrResourceLoader imple
     this.text = text;
   }
 
-  public List<String> getLines(String resource) throws IOException {
-    return Arrays.asList(text.split("\n"));
-  }
-
-  public <T> T newInstance(String cname, Class<T> expectedType, String... subpackages) {
+  public <T> T newInstance(String cname, Class<T> expectedType) {
     return null;
   }
 

Modified: lucene/dev/branches/pforcodec_3892/solr/webapp/web/admin.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/webapp/web/admin.html?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/webapp/web/admin.html (original)
+++ lucene/dev/branches/pforcodec_3892/solr/webapp/web/admin.html Tue Jul 31 20:58:32 2012
@@ -63,7 +63,15 @@ limitations under the License.
     </div>
 
     <div id="main" class="clearfix">
-        
+    
+      <div id="init-failures">
+
+          <h2>SolrCore Initialization Failures</h2>
+          <ul></ul>
+          <p>Please check your logs for more information</p>
+                
+      </div>
+
       <div id="content-wrapper">
         <div id="content">
                   

Modified: lucene/dev/branches/pforcodec_3892/solr/webapp/web/css/styles/common.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/webapp/web/css/styles/common.css?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/webapp/web/css/styles/common.css (original)
+++ lucene/dev/branches/pforcodec_3892/solr/webapp/web/css/styles/common.css Tue Jul 31 20:58:32 2012
@@ -284,6 +284,38 @@ ul
   border-color: #66b866;
 }
 
+#init-failures
+{
+  border: 1px solid #f00;
+  display: none;
+  margin-left: 150px;
+  margin-bottom: 20px;
+}
+
+#main.error #init-failures
+{
+  margin-left: 0;
+}
+
+#init-failures h2,
+#init-failures ul,
+#init-failures p
+{
+  padding: 10px;
+}
+
+#init-failures h2
+{
+  background-color: #f00;
+  color: #fff;
+  font-weight: bold;
+}
+
+#init-failures p
+{
+  color: #c0c0c0;
+  padding-top: 0;
+}
 
 #content-wrapper
 {

Modified: lucene/dev/branches/pforcodec_3892/solr/webapp/web/js/scripts/app.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/solr/webapp/web/js/scripts/app.js?rev=1367777&r1=1367776&r2=1367777&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/solr/webapp/web/js/scripts/app.js (original)
+++ lucene/dev/branches/pforcodec_3892/solr/webapp/web/js/scripts/app.js Tue Jul 31 20:58:32 2012
@@ -152,6 +152,24 @@ var solr_admin = function( app_config )
 
   this.timeout = null;
 
+  show_global_error = function( error )
+  {
+    var main = $( '#main' );
+
+    $( 'div[id$="-wrapper"]', main )
+      .remove();
+
+    main
+      .addClass( 'error' )
+      .append( error );
+
+    var pre_tags = $( 'pre', main );
+    if( 0 !== pre_tags.size() )
+    {
+      hljs.highlightBlock( pre_tags.get(0) ); 
+    }
+  };
+
   this.run = function()
   {
     $.ajax
@@ -167,9 +185,11 @@ var solr_admin = function( app_config )
         success : function( response )
         {
           self.cores_data = response.status;
+          var core_count = 0;
 
           for( var core_name in response.status )
           {
+            core_count++;
             var core_path = config.solr_path + '/' + core_name;
             var schema =  response['status'][core_name]['schema'];
             var solrconfig =  response['status'][core_name]['config'];
@@ -211,10 +231,44 @@ var solr_admin = function( app_config )
               .append( core_tpl );
           }
 
+          if( response.initFailures )
+          {
+            var failures = [];
+            for( var core_name in response.initFailures )
+            {
+              failures.push
+              (
+                '<li>' + 
+                  '<strong>' + core_name.esc() + ':</strong>' + "\n" +
+                  response.initFailures[core_name].esc() + "\n" +
+                '</li>'
+              );
+            }
+
+            if( 0 !== failures.length )
+            {
+              var init_failures = $( '#init-failures' );
+
+              init_failures.show();
+              $( 'ul', init_failures ).html( failures.join( "\n" ) );
+            }
+          }
+
+          if( 0 === core_count )
+          {
+            show_global_error
+            (
+              '<div class="message">There are no SolrCores running — for the currenct functionality ' +
+              'we require at least one SolrCore, sorry :)</div>'
+            );
+            return;
+          } // else: we have at least one core....
+
+          var system_url = environment_basepath + '/admin/system?wt=json';
           $.ajax
           (
             {
-              url : environment_basepath + '/admin/system?wt=json',
+              url : system_url,
               dataType : 'json',
               beforeSend : function( arr, form, options )
               {
@@ -280,23 +334,17 @@ var solr_admin = function( app_config )
               },
               error : function()
               {
-                var main = $( '#main' );
-
-                $( 'div[id$="-wrapper"]', main )
-                  .remove();
-
-                main
-                  .addClass( 'error' )
-                  .append
-                  (
-                    '<div class="message">This interface requires that you activate the admin request handlers, add the following configuration to your <code>solrconfig.xml:</code></div>' +
-                    '<div class="code"><pre class="syntax language-xml"><code>' +
-                    '<!-- Admin Handlers - This will register all the standard admin RequestHandlers. -->'.esc() + "\n" +
-                    '<requestHandler name="/admin/" class="solr.admin.AdminHandlers" />'.esc() +
-                    '</code></pre></div>'
-                  );
-
-                hljs.highlightBlock( $( 'pre', main ).get(0) );
+                show_global_error
+                (
+                  '<div class="message"><p>Unable to load environment info from <code>' + system_url.esc() + '</code>.</p>' +
+                  '<p>This interface requires that you activate the admin request handlers in all SolrCores by adding the ' +
+                  'following configuration to your <code>solrconfig.xml</code>:</p></div>' + "\n" +
+
+                  '<div class="code"><pre class="syntax language-xml"><code>' +
+                  '<!-- Admin Handlers - This will register all the standard admin RequestHandlers. -->'.esc() + "\n" +
+                  '<requestHandler name="/admin/" class="solr.admin.AdminHandlers" />'.esc() +
+                  '</code></pre></div>'
+                );
               },
               complete : function()
               {
@@ -317,4 +365,4 @@ var solr_admin = function( app_config )
 
 };
 
-var app = new solr_admin( app_config );
\ No newline at end of file
+var app = new solr_admin( app_config );



Mime
View raw message