You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/06/04 21:24:08 UTC

svn commit: r1683615 [10/12] - in /lucene/dev/branches/LUCENE-6481: ./ dev-tools/ dev-tools/idea/.idea/ dev-tools/maven/solr/core/src/test/ dev-tools/scripts/ lucene/ lucene/codecs/ lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/ lucene/cor...

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/java/org/apache/solr/update/PeerSync.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/java/org/apache/solr/update/PeerSync.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/java/org/apache/solr/update/PeerSync.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/java/org/apache/solr/update/PeerSync.java Thu Jun  4 19:24:05 2015
@@ -46,6 +46,7 @@ import org.apache.solr.handler.component
 import org.apache.solr.handler.component.ShardHandlerFactory;
 import org.apache.solr.handler.component.ShardRequest;
 import org.apache.solr.handler.component.ShardResponse;
+import org.apache.solr.logging.MDCLoggingContext;
 import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.response.SolrQueryResponse;
@@ -80,6 +81,7 @@ public class PeerSync  {
   private final boolean getNoVersionsIsSuccess;
   private final HttpClient client;
   private final boolean onlyIfActive;
+  private SolrCore core;
 
   // comparator that sorts by absolute value, putting highest first
   private static Comparator<Long> absComparator = new Comparator<Long>() {
@@ -128,6 +130,7 @@ public class PeerSync  {
   }
   
   public PeerSync(SolrCore core, List<String> replicas, int nUpdates, boolean cantReachIsSuccess, boolean getNoVersionsIsSuccess, boolean onlyIfActive) {
+    this.core = core;
     this.replicas = replicas;
     this.nUpdates = nUpdates;
     this.maxUpdates = nUpdates;
@@ -175,95 +178,102 @@ public class PeerSync  {
     if (ulog == null) {
       return false;
     }
-
-    log.info(msg() + "START replicas=" + replicas + " nUpdates=" + nUpdates);
-
-    // TODO: does it ever make sense to allow sync when buffering or applying buffered?  Someone might request that we do it...
-    if (!(ulog.getState() == UpdateLog.State.ACTIVE || ulog.getState()==UpdateLog.State.REPLAYING)) {
-      log.error(msg() + "ERROR, update log not in ACTIVE or REPLAY state. " + ulog);
-      // return false;
-    }
-    
-    if (debug) {
-      if (startingVersions != null) {
-        log.debug(msg() + "startingVersions=" + startingVersions.size() + " " + startingVersions);
-      }
-    }
-
-    // Fire off the requests before getting our own recent updates (for better concurrency)
-    // This also allows us to avoid getting updates we don't need... if we got our updates and then got their updates, they would
-    // have newer stuff that we also had (assuming updates are going on and are being forwarded).
-    for (String replica : replicas) {
-      requestVersions(replica);
-    }
-
-    recentUpdates = ulog.getRecentUpdates();
+    MDCLoggingContext.setCore(core);
     try {
-      ourUpdates = recentUpdates.getVersions(nUpdates);
-    } finally {
-      recentUpdates.close();
-    }
-
-    Collections.sort(ourUpdates, absComparator);
-
-    if (startingVersions != null) {
-      if (startingVersions.size() == 0) {
-        log.warn("no frame of reference to tell if we've missed updates");
-        return false;
-      }
-      Collections.sort(startingVersions, absComparator);
-
-      ourLowThreshold = percentile(startingVersions, 0.8f);
-      ourHighThreshold = percentile(startingVersions, 0.2f);
-
-      // now make sure that the starting updates overlap our updates
-      // there shouldn't be reorders, so any overlap will do.
-
-      long smallestNewUpdate = Math.abs(ourUpdates.get(ourUpdates.size()-1));
-
-      if (Math.abs(startingVersions.get(0)) < smallestNewUpdate) {
-        log.warn(msg() + "too many updates received since start - startingUpdates no longer overlaps with our currentUpdates");
-        return false;
-      }
-
-      // let's merge the lists
-      List<Long> newList = new ArrayList<>(ourUpdates);
-      for (Long ver : startingVersions) {
-        if (Math.abs(ver) < smallestNewUpdate) {
-          newList.add(ver);
+      log.info(msg() + "START replicas=" + replicas + " nUpdates=" + nUpdates);
+      
+      // TODO: does it ever make sense to allow sync when buffering or applying buffered? Someone might request that we
+      // do it...
+      if (!(ulog.getState() == UpdateLog.State.ACTIVE || ulog.getState() == UpdateLog.State.REPLAYING)) {
+        log.error(msg() + "ERROR, update log not in ACTIVE or REPLAY state. " + ulog);
+        // return false;
+      }
+      
+      if (debug) {
+        if (startingVersions != null) {
+          log.debug(msg() + "startingVersions=" + startingVersions.size() + " " + startingVersions);
         }
       }
-
-      ourUpdates = newList;
-    }  else {
-
-      if (ourUpdates.size() > 0) {
-        ourLowThreshold = percentile(ourUpdates, 0.8f);
-        ourHighThreshold = percentile(ourUpdates, 0.2f);
-      }  else {
-        // we have no versions and hence no frame of reference to tell if we can use a peers
-        // updates to bring us into sync
-        log.info(msg() + "DONE.  We have no versions.  sync failed.");
-        return false;
+      
+      // Fire off the requests before getting our own recent updates (for better concurrency)
+      // This also allows us to avoid getting updates we don't need... if we got our updates and then got their updates,
+      // they would
+      // have newer stuff that we also had (assuming updates are going on and are being forwarded).
+      for (String replica : replicas) {
+        requestVersions(replica);
+      }
+      
+      recentUpdates = ulog.getRecentUpdates();
+      try {
+        ourUpdates = recentUpdates.getVersions(nUpdates);
+      } finally {
+        recentUpdates.close();
+      }
+      
+      Collections.sort(ourUpdates, absComparator);
+      
+      if (startingVersions != null) {
+        if (startingVersions.size() == 0) {
+          log.warn("no frame of reference to tell if we've missed updates");
+          return false;
+        }
+        Collections.sort(startingVersions, absComparator);
+        
+        ourLowThreshold = percentile(startingVersions, 0.8f);
+        ourHighThreshold = percentile(startingVersions, 0.2f);
+        
+        // now make sure that the starting updates overlap our updates
+        // there shouldn't be reorders, so any overlap will do.
+        
+        long smallestNewUpdate = Math.abs(ourUpdates.get(ourUpdates.size() - 1));
+        
+        if (Math.abs(startingVersions.get(0)) < smallestNewUpdate) {
+          log.warn(msg()
+              + "too many updates received since start - startingUpdates no longer overlaps with our currentUpdates");
+          return false;
+        }
+        
+        // let's merge the lists
+        List<Long> newList = new ArrayList<>(ourUpdates);
+        for (Long ver : startingVersions) {
+          if (Math.abs(ver) < smallestNewUpdate) {
+            newList.add(ver);
+          }
+        }
+        
+        ourUpdates = newList;
+      } else {
+        
+        if (ourUpdates.size() > 0) {
+          ourLowThreshold = percentile(ourUpdates, 0.8f);
+          ourHighThreshold = percentile(ourUpdates, 0.2f);
+        } else {
+          // we have no versions and hence no frame of reference to tell if we can use a peers
+          // updates to bring us into sync
+          log.info(msg() + "DONE.  We have no versions.  sync failed.");
+          return false;
+        }
       }
-    }
-
-    ourUpdateSet = new HashSet<>(ourUpdates);
-    requestedUpdateSet = new HashSet<>(ourUpdates);
-
-    for(;;) {
-      ShardResponse srsp = shardHandler.takeCompletedOrError();
-      if (srsp == null) break;
-      boolean success = handleResponse(srsp);
-      if (!success) {
-        log.info(msg() +  "DONE. sync failed");
-        shardHandler.cancelAll();
-        return false;
+      
+      ourUpdateSet = new HashSet<>(ourUpdates);
+      requestedUpdateSet = new HashSet<>(ourUpdates);
+      
+      for (;;) {
+        ShardResponse srsp = shardHandler.takeCompletedOrError();
+        if (srsp == null) break;
+        boolean success = handleResponse(srsp);
+        if (!success) {
+          log.info(msg() + "DONE. sync failed");
+          shardHandler.cancelAll();
+          return false;
+        }
       }
+      
+      log.info(msg() + "DONE. sync succeeded");
+      return true;
+    } finally {
+      MDCLoggingContext.clear();
     }
-
-    log.info(msg() +  "DONE. sync succeeded");
-    return true;
   }
   
   private void requestVersions(String replica) {

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/java/org/apache/solr/update/UpdateLog.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/java/org/apache/solr/update/UpdateLog.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/java/org/apache/solr/update/UpdateLog.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/java/org/apache/solr/update/UpdateLog.java Thu Jun  4 19:24:05 2015
@@ -1545,6 +1545,10 @@ public class UpdateLog implements Plugin
     }
   }
 
+  public Long getCurrentMaxVersion() {
+    return maxVersionFromIndex;
+  }
+
   // this method is primarily used for unit testing and is not part of the public API for this class
   Long getMaxVersionFromIndex() {
     if (maxVersionFromIndex == null && versionInfo != null) {
@@ -1599,8 +1603,8 @@ public class UpdateLog implements Plugin
     return highestVersion;
   }
 
-  public void onFirstSearcher(SolrIndexSearcher newSearcher) {
-    log.info("On first searcher opened, looking up max value of version field");
+  public void seedBucketsWithHighestVersion(SolrIndexSearcher newSearcher) {
+    log.info("Looking up max value of version field to seed version buckets");
     versionInfo.blockUpdates();
     try {
       maxVersionFromIndex = seedBucketsWithHighestVersion(newSearcher, versionInfo);

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test-files/log4j.properties
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test-files/log4j.properties?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test-files/log4j.properties (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test-files/log4j.properties Thu Jun  4 19:24:05 2015
@@ -3,9 +3,8 @@ log4j.rootLogger=INFO, CONSOLE
 
 log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
 log4j.appender.CONSOLE.Target=System.err
-log4j.appender.CONSOLE.layout=org.apache.solr.util.SolrLogLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%-5p - %d{yyyy-MM-dd HH:mm:ss.SSS}; %C; %m\n
-
+log4j.appender.CONSOLE.layout=org.apache.log4j.EnhancedPatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%-4r %-5p (%t) [%X{node_name} %X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
 log4j.logger.org.apache.zookeeper=WARN
 log4j.logger.org.apache.hadoop=WARN
 log4j.logger.org.apache.directory=WARN

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test-files/solr/collection1/conf/bad-solrconfig-multiple-indexconfigs.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test-files/solr/collection1/conf/bad-solrconfig-multiple-indexconfigs.xml?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test-files/solr/collection1/conf/bad-solrconfig-multiple-indexconfigs.xml (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test-files/solr/collection1/conf/bad-solrconfig-multiple-indexconfigs.xml Thu Jun  4 19:24:05 2015
@@ -23,12 +23,10 @@
 
   <indexConfig>
     <useCompoundFile>true</useCompoundFile>
-    <unlockOnStartup>false</unlockOnStartup>
   </indexConfig>
   <!-- BEGIN BAD: multiple indexConfig sections -->
   <indexConfig>
     <useCompoundFile>${useCompoundFile:false}</useCompoundFile>
-    <unlockOnStartup>true</unlockOnStartup>
   </indexConfig>
   <!-- END BAD -->
 

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test-files/solr/collection1/conf/solrconfig-schemaless.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test-files/solr/collection1/conf/solrconfig-schemaless.xml?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test-files/solr/collection1/conf/solrconfig-schemaless.xml (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test-files/solr/collection1/conf/solrconfig-schemaless.xml Thu Jun  4 19:24:05 2015
@@ -30,7 +30,7 @@
   <codecFactory class="solr.SchemaCodecFactory"/>
 
   <updateHandler>
-    <updateLog enable="${enable.update.log}">
+    <updateLog enable="true">
       <str name="dir">${solr.ulog.dir:}</str>
     </updateLog> 
   </updateHandler>

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/TestJoin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/TestJoin.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/TestJoin.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/TestJoin.java Thu Jun  4 19:24:05 2015
@@ -17,6 +17,7 @@
 
 package org.apache.solr;
 
+import org.apache.solr.common.params.ModifiableSolrParams;
 import org.noggit.JSONUtil;
 import org.noggit.ObjectBuilder;
 import org.apache.solr.request.SolrQueryRequest;
@@ -56,41 +57,43 @@ public class TestJoin extends SolrTestCa
 
     assertU(commit());
 
+    ModifiableSolrParams p = params("sort","id asc");
+
     // test debugging
-    assertJQ(req("q","{!join from=dept_s to=dept_id_s}title:MTS", "fl","id", "debugQuery","true")
+    assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s}title:MTS", "fl","id", "debugQuery","true")
         ,"/debug/join/{!join from=dept_s to=dept_id_s}title:MTS=={'_MATCH_':'fromSetSize,toSetSize', 'fromSetSize':2, 'toSetSize':3}"
     );
 
-    assertJQ(req("q","{!join from=dept_s to=dept_id_s}title:MTS", "fl","id")
+    assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s}title:MTS", "fl","id")
         ,"/response=={'numFound':3,'start':0,'docs':[{'id':'10'},{'id':'12'},{'id':'13'}]}"
     );
 
     // empty from
-    assertJQ(req("q","{!join from=noexist_s to=dept_id_s}*:*", "fl","id")
+    assertJQ(req(p, "q","{!join from=noexist_s to=dept_id_s}*:*", "fl","id")
         ,"/response=={'numFound':0,'start':0,'docs':[]}"
     );
 
     // empty to
-    assertJQ(req("q","{!join from=dept_s to=noexist_s}*:*", "fl","id")
+    assertJQ(req(p, "q","{!join from=dept_s to=noexist_s}*:*", "fl","id")
         ,"/response=={'numFound':0,'start':0,'docs':[]}"
     );
 
     // self join... return everyone with she same title as Dave
-    assertJQ(req("q","{!join from=title to=title}name:dave", "fl","id")
+    assertJQ(req(p, "q","{!join from=title to=title}name:dave", "fl","id")
         ,"/response=={'numFound':2,'start':0,'docs':[{'id':'3'},{'id':'4'}]}"
     );
 
     // find people that develop stuff
-    assertJQ(req("q","{!join from=dept_id_s to=dept_s}text:develop", "fl","id")
+    assertJQ(req(p, "q","{!join from=dept_id_s to=dept_s}text:develop", "fl","id")
         ,"/response=={'numFound':3,'start':0,'docs':[{'id':'1'},{'id':'4'},{'id':'5'}]}"
     );
 
     // self join on multivalued text field
-    assertJQ(req("q","{!join from=title to=title}name:dave", "fl","id")
+    assertJQ(req(p, "q","{!join from=title to=title}name:dave", "fl","id")
         ,"/response=={'numFound':2,'start':0,'docs':[{'id':'3'},{'id':'4'}]}"
     );
 
-    assertJQ(req("q","{!join from=dept_s to=dept_id_s}title:MTS", "fl","id", "debugQuery","true")
+    assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s}title:MTS", "fl","id", "debugQuery","true")
         ,"/response=={'numFound':3,'start':0,'docs':[{'id':'10'},{'id':'12'},{'id':'13'}]}"
     );
     
@@ -99,12 +102,12 @@ public class TestJoin extends SolrTestCa
       "/response=={'numFound':2,'start':0,'docs':[{'id':'10'},{'id':'13'}]}";
 
     // straight forward query
-    assertJQ(req("q","{!join from=dept_s to=dept_id_s}name:dave", 
+    assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s}name:dave",
                  "fl","id"),
              davesDepartments);
 
     // variable deref for sub-query parsing
-    assertJQ(req("q","{!join from=dept_s to=dept_id_s v=$qq}", 
+    assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s v=$qq}",
                  "qq","{!dismax}dave",
                  "qf","name",
                  "fl","id", 
@@ -112,14 +115,14 @@ public class TestJoin extends SolrTestCa
              davesDepartments);
 
     // variable deref for sub-query parsing w/localparams
-    assertJQ(req("q","{!join from=dept_s to=dept_id_s v=$qq}", 
+    assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s v=$qq}",
                  "qq","{!dismax qf=name}dave",
                  "fl","id", 
                  "debugQuery","true"),
              davesDepartments);
 
     // defType local param to control sub-query parsing
-    assertJQ(req("q","{!join from=dept_s to=dept_id_s defType=dismax}dave", 
+    assertJQ(req(p, "q","{!join from=dept_s to=dept_id_s defType=dismax}dave",
                  "qf","name",
                  "fl","id", 
                  "debugQuery","true"),
@@ -127,7 +130,7 @@ public class TestJoin extends SolrTestCa
 
     // find people that develop stuff - but limit via filter query to a name of "john"
     // this tests filters being pushed down to queries (SOLR-3062)
-    assertJQ(req("q","{!join from=dept_id_s to=dept_s}text:develop", "fl","id", "fq", "name:john")
+    assertJQ(req(p, "q","{!join from=dept_id_s to=dept_s}text:develop", "fl","id", "fq", "name:john")
              ,"/response=={'numFound':1,'start':0,'docs':[{'id':'1'}]}"
             );
 

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java Thu Jun  4 19:24:05 2015
@@ -52,21 +52,6 @@ public class AliasIntegrationTest extend
 
   private static final Logger logger = LoggerFactory.getLogger(AliasIntegrationTest.class);
   
-  @BeforeClass
-  public static void beforeSuperClass() throws Exception {
-  }
-  
-  @AfterClass
-  public static void afterSuperClass() {
-    
-  }
-  
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-  }
-
   public AliasIntegrationTest() {
     super();
     sliceCount = 1;

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java Thu Jun  4 19:24:05 2015
@@ -104,18 +104,6 @@ public class BasicDistributedZkTest exte
   CompletionService<Object> completionService;
   Set<Future<Object>> pending;
   
-  @BeforeClass
-  public static void beforeThisClass2() throws Exception {
-  }
-  
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-    System.setProperty("solr.xml.persist", "true");
-  }
-
-  
   public BasicDistributedZkTest() {
     sliceCount = 2;
     completionService = new ExecutorCompletionService<>(executor);
@@ -519,7 +507,7 @@ public class BasicDistributedZkTest exte
         createCores(httpSolrClient, executor, "multiunload2", 1, cnt);
       } finally {
         if (executor != null) {
-          ExecutorUtil.shutdownAndAwaitTermination(executor, 120, TimeUnit.SECONDS);
+          ExecutorUtil.shutdownAndAwaitTermination(executor);
         }
       }
     }
@@ -1116,21 +1104,6 @@ public class BasicDistributedZkTest exte
     }
   }
 
-  volatile CloudSolrClient commondCloudSolrClient;
-  protected CloudSolrClient getCommonCloudSolrClient() {
-    if (commondCloudSolrClient == null) {
-      synchronized(this) {
-        commondCloudSolrClient = new CloudSolrClient(zkServer.getZkAddress(), random().nextBoolean());
-        commondCloudSolrClient.setParallelUpdates(random().nextBoolean());
-        commondCloudSolrClient.setDefaultCollection(DEFAULT_COLLECTION);
-        commondCloudSolrClient.getLbClient().setConnectionTimeout(15000);
-        commondCloudSolrClient.getLbClient().setSoTimeout(30000);
-        commondCloudSolrClient.connect();
-      }
-    }
-    return commondCloudSolrClient;
-  }
-
   @Override
   protected QueryResponse queryServer(ModifiableSolrParams params) throws SolrServerException, IOException {
 
@@ -1147,9 +1120,6 @@ public class BasicDistributedZkTest exte
   @Override
   public void distribTearDown() throws Exception {
     super.distribTearDown();
-    if (commondCloudSolrClient != null) {
-      commondCloudSolrClient.close();
-    }
     if (otherCollectionClients != null) {
       for (List<SolrClient> clientList : otherCollectionClients.values()) {
         IOUtils.close(clientList);
@@ -1158,11 +1128,5 @@ public class BasicDistributedZkTest exte
     otherCollectionClients = null;
     List<Runnable> tasks = executor.shutdownNow();
     assertTrue(tasks.isEmpty());
-
-    System.clearProperty("numShards");
-    System.clearProperty("solr.xml.persist");
-    
-    // insurance
-    DirectUpdateHandler2.commitOnClose = true;
   }
 }

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java Thu Jun  4 19:24:05 2015
@@ -49,7 +49,7 @@ import java.util.concurrent.atomic.Atomi
 @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776")
 @ThreadLeakLingering(linger = 60000)
 public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase {
-  private static final int FAIL_TOLERANCE = 40;
+  private static final int FAIL_TOLERANCE = 60;
 
   public static Logger log = LoggerFactory.getLogger(ChaosMonkeyNothingIsSafeTest.class);
   
@@ -91,16 +91,9 @@ public class ChaosMonkeyNothingIsSafeTes
     super.distribSetUp();
     // can help to hide this when testing and looking at logs
     //ignoreException("shard update error");
-    System.setProperty("numShards", Integer.toString(sliceCount));
     useFactory("solr.StandardDirectoryFactory");
   }
   
-  @Override
-  public void distribTearDown() throws Exception {
-    System.clearProperty("numShards");
-    super.distribTearDown();
-  }
-  
   public ChaosMonkeyNothingIsSafeTest() {
     super();
     sliceCount = Integer.parseInt(System.getProperty("solr.tests.cloud.cm.slicecount", "-1"));

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java Thu Jun  4 19:24:05 2015
@@ -71,16 +71,7 @@ public class ChaosMonkeySafeLeaderTest e
   @Override
   public void distribSetUp() throws Exception {
     useFactory("solr.StandardDirectoryFactory");
-
     super.distribSetUp();
-    
-    System.setProperty("numShards", Integer.toString(sliceCount));
-  }
-  
-  @Override
-  public void distribTearDown() throws Exception {
-    System.clearProperty("numShards");
-    super.distribTearDown();
   }
   
   public ChaosMonkeySafeLeaderTest() {

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CollectionReloadTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CollectionReloadTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CollectionReloadTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CollectionReloadTest.java Thu Jun  4 19:24:05 2015
@@ -54,12 +54,6 @@ public class CollectionReloadTest extend
     sliceCount = 1;
   }
   
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-  }
-
   @Test
   public void testReloadedLeaderStateAfterZkSessionLoss() throws Exception {
     waitForThingsToLevelOut(30000);

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIAsyncDistributedZkTest.java Thu Jun  4 19:24:05 2015
@@ -38,17 +38,6 @@ import org.junit.Test;
 @Slow
 public class CollectionsAPIAsyncDistributedZkTest extends AbstractFullDistribZkTestBase {
   private static final int MAX_TIMEOUT_SECONDS = 60;
-  private static final boolean DEBUG = false;
-
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-
-    useJettyDataDir = false;
-
-    System.setProperty("numShards", Integer.toString(sliceCount));
-    System.setProperty("solr.xml.persist", "true");
-  }
 
   public CollectionsAPIAsyncDistributedZkTest() {
     sliceCount = 1;
@@ -100,10 +89,6 @@ public class CollectionsAPIAsyncDistribu
   
       assertEquals("Shard split did not complete. Last recorded state: " + state, "completed", state);
     }
-
-    if (DEBUG) {
-      printLayout();
-    }
   }
 
   private String getRequestStateAfterCompletion(String requestId, int waitForSeconds, SolrClient client)
@@ -128,15 +113,4 @@ public class CollectionsAPIAsyncDistribu
     NamedList innerResponse = (NamedList) response.getResponse().get("status");
     return (String) innerResponse.get("state");
   }
-
-  @Override
-  public void distribTearDown() throws Exception {
-    super.distribTearDown();
-    System.clearProperty("numShards");
-    System.clearProperty("solr.xml.persist");
-    
-    // insurance
-    DirectUpdateHandler2.commitOnClose = true;
-  }
-
 }

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java Thu Jun  4 19:24:05 2015
@@ -103,22 +103,14 @@ import static org.apache.solr.common.clo
 public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBase {
 
   private static final String DEFAULT_COLLECTION = "collection1";
-  private static final boolean DEBUG = false;
 
   // we randomly use a second config set rather than just one
   private boolean secondConfigSet = random().nextBoolean();
   
-  @BeforeClass
-  public static void beforeThisClass2() throws Exception {
-
-  }
-  
   @Override
   public void distribSetUp() throws Exception {
     super.distribSetUp();
     
-    useJettyDataDir = false;
-
     if (secondConfigSet ) {
       String zkHost = zkServer.getZkHost();
       String zkAddress = zkServer.getZkAddress();
@@ -146,9 +138,6 @@ public class CollectionsAPIDistributedZk
       AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "elevate.xml");
       zkClient.close();
     }
-    
-    System.setProperty("numShards", Integer.toString(sliceCount));
-
   }
   
   protected String getSolrXml() {
@@ -158,8 +147,6 @@ public class CollectionsAPIDistributedZk
   
   public CollectionsAPIDistributedZkTest() {
     sliceCount = 2;
-    checkCreatedVsState = false;
-    
   }
   
   @Override
@@ -183,6 +170,7 @@ public class CollectionsAPIDistributedZk
   @ShardsFixed(num = 4)
   public void test() throws Exception {
     testNodesUsedByCreate();
+    testNoConfigSetExist();
     testCollectionsAPI();
     testCollectionsAPIAddRemoveStress();
     testErrorHandling();
@@ -193,10 +181,6 @@ public class CollectionsAPIDistributedZk
     // last
     deleteCollectionWithDownNodes();
     addReplicaTest();
-
-    if (DEBUG) {
-      super.printLayout();
-    }
   }
 
   private void deleteCollectionRemovesStaleZkCollectionsNode() throws Exception {
@@ -225,7 +209,7 @@ public class CollectionsAPIDistributedZk
       
     }
     
-    checkForMissingCollection(collectionName);
+    assertCollectionNotExists(collectionName, 45);
     
     assertFalse(cloudClient.getZkStateReader().getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collectionName, true));
 
@@ -253,8 +237,8 @@ public class CollectionsAPIDistributedZk
     request.setPath("/admin/collections");
 
     makeRequest(baseUrl, request);
-    
-    checkForMissingCollection(collectionName);
+
+    assertCollectionNotExists(collectionName, 45);
     
     // now creating that collection should work
     params = new ModifiableSolrParams();
@@ -514,6 +498,40 @@ public class CollectionsAPIDistributedZk
     assertTrue(cloudClient.getZkStateReader().getClusterState().hasCollection("corewithnocollection2"));
   }
 
+  private void testNoConfigSetExist() throws Exception {
+    cloudClient.getZkStateReader().updateClusterState(true);
+    assertFalse(cloudClient.getZkStateReader().getClusterState().hasCollection("corewithnocollection3"));
+
+    // try and create a SolrCore with no collection name
+    Create createCmd = new Create();
+    createCmd.setCoreName("corewithnocollection3");
+    createCmd.setCollection("");
+    String dataDir = createTempDir().toFile().getAbsolutePath();
+    createCmd.setDataDir(dataDir);
+    createCmd.setNumShards(1);
+    createCmd.setCollectionConfigName("conf123");
+    boolean gotExp = false;
+    try {
+      makeRequest(getBaseUrl((HttpSolrClient) clients.get(1)), createCmd);
+    } catch (SolrException e) {
+      gotExp = true;
+    }
+
+    assertTrue(gotExp);
+    TimeUnit.MILLISECONDS.sleep(200);
+    // in both cases, the collection should have default to the core name
+    cloudClient.getZkStateReader().updateClusterState(true);
+
+    Collection<Slice> slices = cloudClient.getZkStateReader().getClusterState().getActiveSlices("corewithnocollection3");
+    assertNull(slices);
+
+    CollectionAdminRequest.List list = new CollectionAdminRequest.List();
+    CollectionAdminResponse res = new CollectionAdminResponse();
+        res.setResponse(makeRequest(getBaseUrl((HttpSolrClient) clients.get(1)), list));
+    List<String> collections = (List<String>) res.getResponse().get("collections");
+    assertFalse(collections.contains("corewithnocollection3"));
+  }
+
   private void testNodesUsedByCreate() throws Exception {
     // we can use this client because we just want base url
     final String baseUrl = getBaseUrl((HttpSolrClient) clients.get(0));
@@ -751,7 +769,7 @@ public class CollectionsAPIDistributedZk
     makeRequest(baseUrl, request);
     
     // ensure its out of the state
-    checkForMissingCollection(collectionName);
+    assertCollectionNotExists(collectionName, 45);
     
     //collectionNameList.remove(collectionName);
 
@@ -1164,16 +1182,6 @@ public class CollectionsAPIDistributedZk
     waitForRecoveriesToFinish(COLL_NAME, false);
   }
   
-  @Override
-  public void distribTearDown() throws Exception {
-    super.distribTearDown();
-    System.clearProperty("numShards");
-    System.clearProperty("solr.xml.persist");
-
-    // insurance
-    DirectUpdateHandler2.commitOnClose = true;
-  }
-
   private void clusterPropTest() throws Exception {
     try (CloudSolrClient client = createCloudClient(null)) {
       assertTrue("cluster property not set", setClusterProp(client, ZkStateReader.LEGACY_CLOUD, "false"));

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ConcurrentDeleteAndCreateCollectionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ConcurrentDeleteAndCreateCollectionTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ConcurrentDeleteAndCreateCollectionTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ConcurrentDeleteAndCreateCollectionTest.java Thu Jun  4 19:24:05 2015
@@ -75,29 +75,37 @@ public class ConcurrentDeleteAndCreateCo
   }
   
   public void testConcurrentCreateAndDeleteOverTheSameConfig() {
-    Logger.getLogger("org.apache.solr").setLevel(Level.WARN);
-    final String configName = "testconfig";
-    final File configDir = getFile("solr").toPath().resolve("configsets/configset-2/conf").toFile();
-    uploadConfig(configDir, configName); // upload config once, to be used by all collections
-    final SolrClient solrClient = new HttpSolrClient(solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString());
-    final AtomicReference<Exception> failure = new AtomicReference<>();
-    final int timeToRunSec = 30;
-    final Thread[] threads = new Thread[2];
-    for (int i = 0; i < threads.length; i++) {
-      final String collectionName = "collection" + i;
-      threads[i] = new CreateDeleteCollectionThread("create-delete-" + i, collectionName, configName, 
-          timeToRunSec, solrClient, failure);
-    }
-    
-    startAll(threads);
-    joinAll(threads);
+    // TODO: no idea what this test needs to override the level, but regardless of reason it should
+    // reset when it's done.
+    final Logger logger = Logger.getLogger("org.apache.solr");
+    final Level SAVED_LEVEL = logger.getLevel();
+    try {
+      logger.setLevel(Level.WARN);
+      final String configName = "testconfig";
+      final File configDir = getFile("solr").toPath().resolve("configsets/configset-2/conf").toFile();
+      uploadConfig(configDir, configName); // upload config once, to be used by all collections
+      final SolrClient solrClient = new HttpSolrClient(solrCluster.getJettySolrRunners().get(0).getBaseUrl().toString());
+      final AtomicReference<Exception> failure = new AtomicReference<>();
+      final int timeToRunSec = 30;
+      final Thread[] threads = new Thread[2];
+      for (int i = 0; i < threads.length; i++) {
+        final String collectionName = "collection" + i;
+        threads[i] = new CreateDeleteCollectionThread("create-delete-" + i, collectionName, configName, 
+                                                      timeToRunSec, solrClient, failure);
+      }
     
-    assertNull("concurrent create and delete collection failed: " + failure.get(), failure.get());
+      startAll(threads);
+      joinAll(threads);
     
-    try {
-      solrClient.close();
-    } catch (IOException e) {
-      throw new RuntimeException(e);
+      assertNull("concurrent create and delete collection failed: " + failure.get(), failure.get());
+      
+      try {
+        solrClient.close();
+      } catch (IOException e) {
+        throw new RuntimeException(e);
+      }
+    } finally {
+      logger.setLevel(SAVED_LEVEL);
     }
   }
   
@@ -222,4 +230,4 @@ public class ConcurrentDeleteAndCreateCo
     
   }
   
-}
\ No newline at end of file
+}

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java Thu Jun  4 19:24:05 2015
@@ -72,20 +72,8 @@ import static org.apache.solr.common.par
 @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776")
 public class CustomCollectionTest extends AbstractFullDistribZkTestBase {
 
-  private static final String DEFAULT_COLLECTION = "collection1";
   private static final boolean DEBUG = false;
 
-  @BeforeClass
-  public static void beforeThisClass2() throws Exception {
-  }
-
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-    System.setProperty("solr.xml.persist", "true");
-  }
-
   protected String getSolrXml() {
     return "solr-no-core.xml";
   }
@@ -93,8 +81,6 @@ public class CustomCollectionTest extend
 
   public CustomCollectionTest() {
     sliceCount = 2;
-    checkCreatedVsState = false;
-
   }
 
   @Override
@@ -453,14 +439,4 @@ public class CustomCollectionTest extend
     QueryResponse rsp = getCommonCloudSolrClient().query(params);
     return rsp;
   }
-
-  @Override
-  public void distribTearDown() throws Exception {
-    super.distribTearDown();
-    System.clearProperty("numShards");
-    System.clearProperty("solr.xml.persist");
-
-    // insurance
-    DirectUpdateHandler2.commitOnClose = true;
-  }
 }

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DeleteLastCustomShardedReplicaTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DeleteLastCustomShardedReplicaTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DeleteLastCustomShardedReplicaTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DeleteLastCustomShardedReplicaTest.java Thu Jun  4 19:24:05 2015
@@ -42,28 +42,7 @@ import static org.apache.solr.cloud.Over
 import static org.apache.solr.common.cloud.ZkNodeProps.makeMap;
 import static org.apache.solr.common.params.CollectionParams.CollectionAction.DELETEREPLICA;
 
-@Ignore("SOLR-6347")
 public class DeleteLastCustomShardedReplicaTest extends AbstractFullDistribZkTestBase {
-  private CloudSolrClient client;
-
-  @BeforeClass
-  public static void beforeThisClass2() throws Exception {
-
-  }
-
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-    System.setProperty("solr.xml.persist", "true");
-    client = createCloudClient(null);
-  }
-
-  @Override
-  public void distribTearDown() throws Exception {
-    super.distribTearDown();
-    client.close();
-  }
 
   protected String getSolrXml() {
     return "solr-no-core.xml";
@@ -71,45 +50,46 @@ public class DeleteLastCustomShardedRepl
 
   public DeleteLastCustomShardedReplicaTest() {
     sliceCount = 2;
-    checkCreatedVsState = false;
   }
 
   @Test
   @ShardsFixed(num = 2)
   public void test() throws Exception {
-    int replicationFactor = 1;
-    int maxShardsPerNode = 5;
+    try (CloudSolrClient client = createCloudClient(null))  {
+      int replicationFactor = 1;
+      int maxShardsPerNode = 5;
 
-    Map<String, Object> props = ZkNodeProps.makeMap(
-        "router.name", ImplicitDocRouter.NAME,
-        ZkStateReader.REPLICATION_FACTOR, replicationFactor,
-        ZkStateReader.MAX_SHARDS_PER_NODE, maxShardsPerNode,
-        NUM_SLICES, 1,
-        SHARDS_PROP,"a,b");
+      Map<String, Object> props = ZkNodeProps.makeMap(
+              "router.name", ImplicitDocRouter.NAME,
+              ZkStateReader.REPLICATION_FACTOR, replicationFactor,
+              ZkStateReader.MAX_SHARDS_PER_NODE, maxShardsPerNode,
+              NUM_SLICES, 1,
+              SHARDS_PROP,"a,b");
 
-    Map<String,List<Integer>> collectionInfos = new HashMap<>();
+      Map<String,List<Integer>> collectionInfos = new HashMap<>();
 
-    String collectionName = "customcollreplicadeletion";
+      String collectionName = "customcollreplicadeletion";
 
-    createCollection(collectionInfos, collectionName, props, client);
+      createCollection(collectionInfos, collectionName, props, client);
 
-    waitForRecoveriesToFinish(collectionName, false);
+      waitForRecoveriesToFinish(collectionName, false);
 
-    DocCollection testcoll = getCommonCloudSolrClient().getZkStateReader()
-        .getClusterState().getCollection(collectionName);
-    Replica replica = testcoll.getSlice("a").getReplicas().iterator().next();
+      DocCollection testcoll = getCommonCloudSolrClient().getZkStateReader()
+              .getClusterState().getCollection(collectionName);
+      Replica replica = testcoll.getSlice("a").getReplicas().iterator().next();
 
-    removeAndWaitForLastReplicaGone(collectionName, replica, "a");
+      removeAndWaitForLastReplicaGone(client, collectionName, replica, "a");
+    }
   }
 
-  protected void removeAndWaitForLastReplicaGone(String COLL_NAME, Replica replica, String shard)
+  protected void removeAndWaitForLastReplicaGone(CloudSolrClient client, String COLL_NAME, Replica replica, String shard)
       throws SolrServerException, IOException, InterruptedException {
     Map m = makeMap("collection", COLL_NAME, "action", DELETEREPLICA.toLower(), "shard",
         shard, "replica", replica.getName());
     SolrParams params = new MapSolrParams(m);
     SolrRequest request = new QueryRequest(params);
     request.setPath("/admin/collections");
-    this.client.request(request);
+    client.request(request);
     long endAt = System.currentTimeMillis() + 3000;
     boolean success = false;
     DocCollection testcoll = null;

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java Thu Jun  4 19:24:05 2015
@@ -48,21 +48,6 @@ import static org.apache.solr.common.clo
 import static org.apache.solr.common.params.CollectionParams.CollectionAction.DELETEREPLICA;
 
 public class DeleteReplicaTest extends AbstractFullDistribZkTestBase {
-  private CloudSolrClient client;
-  
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-    System.setProperty("solr.xml.persist", "true");
-    client = createCloudClient(null);
-  }
-
-  @Override
-  public void distribTearDown() throws Exception {
-    super.distribTearDown();
-    client.close();
-  }
 
   protected String getSolrXml() {
     return "solr-no-core.xml";
@@ -70,7 +55,6 @@ public class DeleteReplicaTest extends A
 
   public DeleteReplicaTest() {
     sliceCount = 2;
-    checkCreatedVsState = false;
   }
 
   @Test
@@ -79,15 +63,15 @@ public class DeleteReplicaTest extends A
     String collectionName = "delLiveColl";
     try (CloudSolrClient client = createCloudClient(null)) {
       createCollection(collectionName, client);
-      
+
       waitForRecoveriesToFinish(collectionName, false);
-      
+
       DocCollection testcoll = getCommonCloudSolrClient().getZkStateReader()
           .getClusterState().getCollection(collectionName);
-      
+
       Slice shard1 = null;
       Replica replica1 = null;
-      
+
       // Get an active replica
       for (Slice slice : testcoll.getSlices()) {
         if(replica1 != null)

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DeleteShardTest.java Thu Jun  4 19:24:05 2015
@@ -44,20 +44,6 @@ public class DeleteShardTest extends Abs
     sliceCount = 2;
   }
 
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", "2");
-    System.setProperty("solr.xml.persist", "true");
-  }
-
-  @Override
-  public void distribTearDown() throws Exception {
-    super.distribTearDown();
-    System.clearProperty("numShards");
-    System.clearProperty("solr.xml.persist");
-  }
-
   // TODO: Custom hash slice deletion test
 
   @Test

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/DistributedVersionInfoTest.java Thu Jun  4 19:24:05 2015
@@ -234,7 +234,7 @@ public class DistributedVersionInfoTest
 
     cloudClient.commit();
 
-    log.info("\n\n\n Total of "+deletedDocs.size()+" docs deleted \n\n\n");
+    log.info("Total of "+deletedDocs.size()+" docs deleted");
 
     maxOnLeader = getMaxVersionFromIndex(leader);
     maxOnReplica = getMaxVersionFromIndex(replica);

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java Thu Jun  4 19:24:05 2015
@@ -36,7 +36,10 @@ import org.apache.solr.common.cloud.ZkCo
 import org.apache.solr.common.cloud.ZkStateReader;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.CoreContainer;
+import org.apache.solr.core.SolrCore;
 import org.apache.solr.servlet.SolrDispatchFilter;
+import org.apache.solr.update.UpdateHandler;
+import org.apache.solr.update.UpdateLog;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -78,12 +81,6 @@ public class HttpPartitionTest extends A
     fixShardCount(3);
   }
   
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-  }
-  
   /**
    * Overrides the parent implementation to install a SocketProxy in-front of the Jetty server.
    */
@@ -207,7 +204,22 @@ public class HttpPartitionTest extends A
     
     // sent 3 docs in so far, verify they are on the leader and replica
     assertDocsExistInAllReplicas(notLeaders, testCollectionName, 1, 3);
-        
+
+    // Get the max version from the replica core to make sure it gets updated after recovery (see SOLR-7625)
+    JettySolrRunner replicaJetty = getJettyOnPort(getReplicaPort(notLeader));
+    SolrDispatchFilter filter = (SolrDispatchFilter)replicaJetty.getDispatchFilter().getFilter();
+    CoreContainer coreContainer = filter.getCores();
+    ZkCoreNodeProps replicaCoreNodeProps = new ZkCoreNodeProps(notLeader);
+    String coreName = replicaCoreNodeProps.getCoreName();
+    Long maxVersionBefore = null;
+    try (SolrCore core = coreContainer.getCore(coreName)) {
+      assertNotNull("Core '"+coreName+"' not found for replica: "+notLeader.getName(), core);
+      UpdateLog ulog = core.getUpdateHandler().getUpdateLog();
+      maxVersionBefore = ulog.getCurrentMaxVersion();
+    }
+    assertNotNull("max version bucket seed not set for core " + coreName, maxVersionBefore);
+    log.info("Looked up max version bucket seed "+maxVersionBefore+" for core "+coreName);
+
     // now up the stakes and do more docs
     int numDocs = 1000;
     boolean hasPartition = false;
@@ -234,7 +246,15 @@ public class HttpPartitionTest extends A
     }
     
     notLeaders = ensureAllReplicasAreActive(testCollectionName, "shard1", 1, 2, maxWaitSecsToSeeAllActive);
-    
+
+    try (SolrCore core = coreContainer.getCore(coreName)) {
+      assertNotNull("Core '" + coreName + "' not found for replica: " + notLeader.getName(), core);
+      Long currentMaxVersion = core.getUpdateHandler().getUpdateLog().getCurrentMaxVersion();
+      log.info("After recovery, looked up NEW max version bucket seed " + currentMaxVersion +
+          " for core " + coreName + ", was: " + maxVersionBefore);
+      assertTrue("max version bucket seed not updated after recovery!", currentMaxVersion > maxVersionBefore);
+    }
+
     // verify all docs received
     assertDocsExistInAllReplicas(notLeaders, testCollectionName, 1, numDocs + 3);
 

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/KerberosTestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/KerberosTestUtil.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/KerberosTestUtil.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/KerberosTestUtil.java Thu Jun  4 19:24:05 2015
@@ -1,7 +1,10 @@
 package org.apache.solr.cloud;
 
 import java.io.File;
+import java.util.Arrays;
 import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 
@@ -119,4 +122,27 @@ public class KerberosTestUtil {
       return krb5LoginModuleName;
     }
   }
+
+  /**
+   *  These Locales don't generate dates that are compatibile with Hadoop MiniKdc.
+   */
+  private final static List<String> brokenLanguagesWithMiniKdc =
+      Arrays.asList(
+          new Locale("th").getLanguage(), 
+          new Locale("ja").getLanguage(), 
+          new Locale("hi").getLanguage()
+          );
+  /** 
+   *returns the currently set locale, and overrides it with {@link Locale#US} if it's 
+   * currently something MiniKdc can not handle
+   *
+   * @see Locale#setDefault
+   */
+  public static final Locale overrideLocaleIfNotSpportedByMiniKdc() {
+    Locale old = Locale.getDefault();
+    if (brokenLanguagesWithMiniKdc.contains(Locale.getDefault().getLanguage())) {
+      Locale.setDefault(Locale.US);
+    }
+    return old;
+  }
 }

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/LeaderInitiatedRecoveryOnCommitTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/LeaderInitiatedRecoveryOnCommitTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/LeaderInitiatedRecoveryOnCommitTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/LeaderInitiatedRecoveryOnCommitTest.java Thu Jun  4 19:24:05 2015
@@ -39,26 +39,6 @@ public class LeaderInitiatedRecoveryOnCo
   }
 
   @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-  }
-
-  @Override
-  public void distribTearDown() throws Exception {
-    System.clearProperty("numShards");
-
-    super.distribTearDown();
-
-    // close socket proxies after super.distribTearDown
-    if (!proxies.isEmpty()) {
-      for (SocketProxy proxy : proxies.values()) {
-        proxy.close();
-      }
-    }
-  }
-
-  @Override
   @Test
   public void test() throws Exception {
     oneShardTest();

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/MigrateRouteKeyTest.java Thu Jun  4 19:24:05 2015
@@ -153,7 +153,7 @@ public class MigrateRouteKeyTest extends
     Indexer indexer = new Indexer(cloudClient, splitKey, 1, 30);
     indexer.start();
 
-    String url = CustomCollectionTest.getUrlFromZk(getCommonCloudSolrClient().getZkStateReader().getClusterState(), targetCollection);
+    String url = getUrlFromZk(getCommonCloudSolrClient().getZkStateReader().getClusterState(), targetCollection);
 
     try (HttpSolrClient collectionClient = new HttpSolrClient(url)) {
 

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java Thu Jun  4 19:24:05 2015
@@ -49,16 +49,6 @@ public class MultiThreadedOCPTest extend
 
   private static final int NUM_COLLECTIONS = 4;
 
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-
-    useJettyDataDir = false;
-
-    System.setProperty("numShards", Integer.toString(sliceCount));
-    System.setProperty("solr.xml.persist", "true");
-  }
-
   public MultiThreadedOCPTest() {
     sliceCount = 2;
   }
@@ -296,16 +286,6 @@ public class MultiThreadedOCPTest extend
     return (String) innerResponse.get("state");
   }
 
-  @Override
-  public void distribTearDown() throws Exception {
-    super.distribTearDown();
-    System.clearProperty("numShards");
-    System.clearProperty("solr.xml.persist");
-    
-    // insurance
-    DirectUpdateHandler2.commitOnClose = true;
-  }
-
 }
 
 

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java Thu Jun  4 19:24:05 2015
@@ -50,28 +50,8 @@ import static org.apache.solr.common.clo
 import static org.apache.solr.common.cloud.ZkStateReader.REPLICATION_FACTOR;
 
 @LuceneTestCase.Slow
-@SuppressSSL     // See SOLR-5776
+@SuppressSSL(bugUrl = "SOLR-5776")
 public class OverseerRolesTest  extends AbstractFullDistribZkTestBase{
-  private CloudSolrClient client;
-
-  @BeforeClass
-  public static void beforeThisClass2() throws Exception {
-
-  }
-
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-    System.setProperty("solr.xml.persist", "true");
-    client = createCloudClient(null);
-  }
-
-  @Override
-  public void distribTearDown() throws Exception {
-    super.distribTearDown();
-    client.close();
-  }
 
   protected String getSolrXml() {
     return "solr-no-core.xml";
@@ -80,17 +60,17 @@ public class OverseerRolesTest  extends
   public OverseerRolesTest() {
     sliceCount = 2;
     fixShardCount(TEST_NIGHTLY ? 6 : 2);
-
-    checkCreatedVsState = false;
   }
 
   @Test
   public void test() throws Exception {
-    testQuitCommand();
-    testOverseerRole();
+    try (CloudSolrClient client = createCloudClient(null))  {
+      testQuitCommand(client);
+      testOverseerRole(client);
+    }
   }
 
-  private void testQuitCommand() throws Exception{
+  private void testQuitCommand(CloudSolrClient client) throws Exception{
     String collectionName = "testOverseerQuit";
 
     createCollection(collectionName, client);
@@ -121,7 +101,7 @@ public class OverseerRolesTest  extends
 
 
 
-  private void testOverseerRole() throws Exception {
+  private void testOverseerRole(CloudSolrClient client) throws Exception {
     String collectionName = "testOverseerCol";
 
     createCollection(collectionName, client);
@@ -137,7 +117,7 @@ public class OverseerRolesTest  extends
     Collections.shuffle(l, random());
     String overseerDesignate = l.get(0);
     log.info("overseerDesignate {}",overseerDesignate);
-    setOverseerRole(CollectionAction.ADDROLE,overseerDesignate);
+    setOverseerRole(client, CollectionAction.ADDROLE,overseerDesignate);
 
     long timeout = System.currentTimeMillis()+15000;
 
@@ -166,7 +146,7 @@ public class OverseerRolesTest  extends
 
     String anotherOverseer = l.get(0);
     log.info("Adding another overseer designate {}", anotherOverseer);
-    setOverseerRole(CollectionAction.ADDROLE, anotherOverseer);
+    setOverseerRole(client, CollectionAction.ADDROLE, anotherOverseer);
 
     String currentOverseer = getLeaderNode(client.getZkStateReader().getZkClient());
 
@@ -211,7 +191,7 @@ public class OverseerRolesTest  extends
     assertTrue("New overseer designate has not become the overseer, expected : " + anotherOverseer + "actual : " + getLeaderNode(client.getZkStateReader().getZkClient()), leaderchanged);
   }
 
-  private void setOverseerRole(CollectionAction action, String overseerDesignate) throws Exception, IOException {
+  private void setOverseerRole(CloudSolrClient client, CollectionAction action, String overseerDesignate) throws Exception, IOException {
     log.info("Adding overseer designate {} ", overseerDesignate);
     Map m = makeMap(
         "action", action.toString().toLowerCase(Locale.ROOT),

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/OverseerStatusTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/OverseerStatusTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/OverseerStatusTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/OverseerStatusTest.java Thu Jun  4 19:24:05 2015
@@ -17,6 +17,7 @@ package org.apache.solr.cloud;
  * limitations under the License.
  */
 
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.response.CollectionAdminResponse;
 import org.apache.solr.common.params.CollectionParams;
 import org.apache.solr.common.util.NamedList;
@@ -27,24 +28,18 @@ public class OverseerStatusTest extends
 
   public OverseerStatusTest() {
     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");
+    sliceCount = 1;
   }
 
   @Test
+  @ShardsFixed(num = 1)
   public void test() throws Exception {
 
     waitForThingsToLevelOut(15);
 
     // find existing command counts because collection may be created by base test class too
     int numCollectionCreates = 0, numOverseerCreates = 0;
-    NamedList<Object> resp = invokeCollectionApi("action",
-        CollectionParams.CollectionAction.OVERSEERSTATUS.toLower());
+    NamedList<Object> resp = new CollectionAdminRequest.OverseerStatus().process(cloudClient).getResponse();
     if (resp != null) {
       NamedList<Object> collection_operations = (NamedList<Object>) resp.get("collection_operations");
       if (collection_operations != null)  {
@@ -64,8 +59,7 @@ public class OverseerStatusTest extends
 
     String collectionName = "overseer_status_test";
     CollectionAdminResponse response = createCollection(collectionName, 1, 1, 1);
-    resp = invokeCollectionApi("action",
-        CollectionParams.CollectionAction.OVERSEERSTATUS.toLower());
+    resp = new CollectionAdminRequest.OverseerStatus().process(cloudClient).getResponse();
     NamedList<Object> collection_operations = (NamedList<Object>) resp.get("collection_operations");
     NamedList<Object> overseer_operations = (NamedList<Object>) resp.get("overseer_operations");
     SimpleOrderedMap<Object> createcollection = (SimpleOrderedMap<Object>) collection_operations.get(CollectionParams.CollectionAction.CREATE.toLower());
@@ -73,22 +67,25 @@ public class OverseerStatusTest extends
     createcollection = (SimpleOrderedMap<Object>) overseer_operations.get(CollectionParams.CollectionAction.CREATE.toLower());
     assertEquals("No stats for create in Overseer", numOverseerCreates + 1, createcollection.get("requests"));
 
-    invokeCollectionApi("action", CollectionParams.CollectionAction.RELOAD.toLower(), "name", collectionName);
-    resp = invokeCollectionApi("action",
-        CollectionParams.CollectionAction.OVERSEERSTATUS.toLower());
+    // Reload the collection
+    new CollectionAdminRequest.Reload().setCollectionName(collectionName).process(cloudClient);
+
+
+    resp = new CollectionAdminRequest.OverseerStatus().process(cloudClient).getResponse();
     collection_operations = (NamedList<Object>) resp.get("collection_operations");
     SimpleOrderedMap<Object> reload = (SimpleOrderedMap<Object>) collection_operations.get(CollectionParams.CollectionAction.RELOAD.toLower());
     assertEquals("No stats for reload in OverseerCollectionProcessor", 1, reload.get("requests"));
 
     try {
-      invokeCollectionApi("action", CollectionParams.CollectionAction.SPLITSHARD.toLower(),
-          "collection", "non_existent_collection",
-          "shard", "non_existent_shard");
+      new CollectionAdminRequest.SplitShard()
+              .setCollectionName("non_existent_collection")
+              .setShardName("non_existent_shard")
+              .process(cloudClient);
+      fail("Split shard for non existent collection should have failed");
     } catch (Exception e) {
       // expected because we did not correctly specify required params for split
     }
-    resp = invokeCollectionApi("action",
-        CollectionParams.CollectionAction.OVERSEERSTATUS.toLower());
+    resp = new CollectionAdminRequest.OverseerStatus().process(cloudClient).getResponse();
     collection_operations = (NamedList<Object>) resp.get("collection_operations");
     SimpleOrderedMap<Object> split = (SimpleOrderedMap<Object>) collection_operations.get(CollectionParams.CollectionAction.SPLITSHARD.toLower());
     assertEquals("No stats for split in OverseerCollectionProcessor", 1, split.get("errors"));

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java Thu Jun  4 19:24:05 2015
@@ -59,29 +59,6 @@ public class ReplicationFactorTest exten
     fixShardCount(3);
   }
   
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-  }
-  
-  @Override
-  public void distribTearDown() throws Exception {
-    
-    log.info("tearing down replicationFactorTest!");
-    
-    System.clearProperty("numShards");
-    
-    super.distribTearDown();
-
-    log.info("super.distribTearDown complete, closing all socket proxies");
-    if (!proxies.isEmpty()) {
-      for (SocketProxy proxy : proxies.values()) {
-        proxy.close();
-      }
-    }    
-  }
-  
   /**
    * Overrides the parent implementation so that we can configure a socket proxy
    * to sit infront of each Jetty server, which gives us the ability to simulate

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/RollingRestartTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/RollingRestartTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/RollingRestartTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/RollingRestartTest.java Thu Jun  4 19:24:05 2015
@@ -18,6 +18,7 @@ package org.apache.solr.cloud;
  */
 
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.common.cloud.SolrZkClient;
 import org.apache.solr.common.params.CollectionParams;
 import org.apache.zookeeper.KeeperException;
@@ -42,16 +43,9 @@ public class RollingRestartTest extends
   @Override
   public void distribSetUp() throws Exception {
     super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
     useFactory("solr.StandardDirectoryFactory");
   }
 
-  @Override
-  public void distribTearDown() throws Exception {
-    System.clearProperty("numShards");
-    super.distribTearDown();
-  }
-
   @Test
   public void test() throws Exception {
     waitForRecoveriesToFinish(false);
@@ -77,7 +71,7 @@ public class RollingRestartTest extends
       int n = random().nextInt(getShardCount());
       String nodeName = cloudJettys.get(n).nodeName;
       log.info("Chose {} as overseer designate", nodeName);
-      invokeCollectionApi(CollectionParams.ACTION, CollectionParams.CollectionAction.ADDROLE.toLower(), "role", "overseer", "node", nodeName);
+      new CollectionAdminRequest.AddRole().setRole("overseer").setNode(nodeName).process(cloudClient);
       designates.add(nodeName);
       designateJettys.add(cloudJettys.get(n));
     }

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SaslZkACLProviderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SaslZkACLProviderTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SaslZkACLProviderTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SaslZkACLProviderTest.java Thu Jun  4 19:24:05 2015
@@ -3,8 +3,6 @@ package org.apache.solr.cloud;
 import java.io.File;
 import java.io.IOException;
 import java.nio.charset.Charset;
-import java.util.Arrays;
-import java.util.List;
 import java.util.Locale;
 
 import javax.security.auth.login.Configuration;
@@ -52,12 +50,7 @@ public class SaslZkACLProviderTest exten
       .getLogger(SaslZkACLProviderTest.class);
 
   private static final Charset DATA_ENCODING = Charset.forName("UTF-8");
-  // These Locales don't generate dates that are compatibile with Hadoop MiniKdc.
-  protected final static List<String> brokenLocales =
-    Arrays.asList(
-      "th_TH_TH_#u-nu-thai",
-      "ja_JP_JP_#u-ca-japanese",
-      "hi_IN");
+
   protected Locale savedLocale = null;
 
   protected ZkTestServer zkServer;
@@ -77,10 +70,7 @@ public class SaslZkACLProviderTest exten
   @Override
   public void setUp() throws Exception {
     super.setUp();
-    if (brokenLocales.contains(Locale.getDefault().toString())) {
-      savedLocale = Locale.getDefault();
-      Locale.setDefault(Locale.US);
-    }
+    savedLocale = KerberosTestUtil.overrideLocaleIfNotSpportedByMiniKdc();
     log.info("####SETUP_START " + getTestName());
     createTempDir();
 
@@ -124,10 +114,7 @@ public class SaslZkACLProviderTest exten
   @Override
   public void tearDown() throws Exception {
     zkServer.shutdown();
-
-    if (savedLocale != null) {
-      Locale.setDefault(savedLocale);
-    }
+    Locale.setDefault(savedLocale);
     super.tearDown();
   }
 

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ShardRoutingCustomTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ShardRoutingCustomTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ShardRoutingCustomTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ShardRoutingCustomTest.java Thu Jun  4 19:24:05 2015
@@ -17,6 +17,10 @@ package org.apache.solr.cloud;
  * limitations under the License.
  */
 
+import java.io.File;
+
+import org.apache.solr.client.solrj.SolrClient;
+import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -51,7 +55,31 @@ public class ShardRoutingCustomTest exte
   private void doCustomSharding() throws Exception {
     printLayout();
 
-    startCloudJetty(collection, "shardA");
+    int totalReplicas = getTotalReplicas(collection);
+
+    File jettyDir = createTempDir("jetty").toFile();
+    jettyDir.mkdirs();
+    setupJettySolrHome(jettyDir);
+    JettySolrRunner j = createJetty(jettyDir, createTempDir().toFile().getAbsolutePath(), "shardA", "solrconfig.xml", null);
+    jettys.add(j);
+    SolrClient client = createNewSolrClient(j.getLocalPort());
+    clients.add(client);
+
+    int retries = 60;
+    while (--retries >= 0) {
+      // total replicas changed.. assume it was us
+      if (getTotalReplicas(collection) != totalReplicas) {
+       break;
+      }
+      Thread.sleep(500);
+    }
+
+    if (retries <= 0) {
+      fail("Timeout waiting for " + j + " to appear in clusterstate");
+      printLayout();
+    }
+
+    updateMappingsFromZk(this.jettys, this.clients);
 
     printLayout();
   }

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/ShardSplitTest.java Thu Jun  4 19:24:05 2015
@@ -64,13 +64,6 @@ public class ShardSplitTest extends Basi
     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");
-  }
-
   @Test
   public void test() throws Exception {
 
@@ -248,7 +241,7 @@ public class ShardSplitTest extends Basi
 
     waitForRecoveriesToFinish(false);
 
-    String url = CustomCollectionTest.getUrlFromZk(getCommonCloudSolrClient().getZkStateReader().getClusterState(), collectionName);
+    String url = getUrlFromZk(getCommonCloudSolrClient().getZkStateReader().getClusterState(), collectionName);
 
     try (HttpSolrClient collectionClient = new HttpSolrClient(url)) {
 
@@ -322,7 +315,7 @@ public class ShardSplitTest extends Basi
 
     waitForRecoveriesToFinish(false);
 
-    String url = CustomCollectionTest.getUrlFromZk(getCommonCloudSolrClient().getZkStateReader().getClusterState(), collectionName);
+    String url = getUrlFromZk(getCommonCloudSolrClient().getZkStateReader().getClusterState(), collectionName);
 
     try (HttpSolrClient collectionClient = new HttpSolrClient(url)) {
 

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SharedFSAutoReplicaFailoverTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SharedFSAutoReplicaFailoverTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SharedFSAutoReplicaFailoverTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SharedFSAutoReplicaFailoverTest.java Thu Jun  4 19:24:05 2015
@@ -88,7 +88,6 @@ public class SharedFSAutoReplicaFailover
   public void distribSetUp() throws Exception {
     super.distribSetUp();
     useJettyDataDir = false;
-    System.setProperty("solr.xml.persist", "true");
   }
   
   protected String getSolrXml() {
@@ -100,8 +99,6 @@ public class SharedFSAutoReplicaFailover
     sliceCount = 2;
     completionService = new ExecutorCompletionService<>(executor);
     pending = new HashSet<>();
-    checkCreatedVsState = false;
-    
   }
 
   @Test
@@ -263,6 +260,5 @@ public class SharedFSAutoReplicaFailover
   @Override
   public void distribTearDown() throws Exception {
     super.distribTearDown();
-    System.clearProperty("solr.xml.persist");
   }
 }

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java Thu Jun  4 19:24:05 2015
@@ -51,12 +51,6 @@ public class SolrCloudExampleTest extend
     sliceCount = 2;
   }
 
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-  }
-
   @Test
   public void testLoadDocsIntoGettingStartedCollection() throws Exception {
     waitForThingsToLevelOut(30000);

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java Thu Jun  4 19:24:05 2015
@@ -50,24 +50,7 @@ import java.util.Set;
 @Slow
 public class SyncSliceTest extends AbstractFullDistribZkTestBase {
   private boolean success = false;
-  
-  @BeforeClass
-  public static void beforeSuperClass() throws Exception {
-  }
-  
-  @AfterClass
-  public static void afterSuperClass() {
-    
-  }
-  
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    // we expect this time of exception as shards go up and down...
-    //ignoreException(".*");
-    System.setProperty("numShards", Integer.toString(sliceCount));
-  }
-  
+
   @Override
   public void distribTearDown() throws Exception {
     if (!success) {
@@ -75,7 +58,7 @@ public class SyncSliceTest extends Abstr
     }
     super.distribTearDown();
   }
-  
+
   public SyncSliceTest() {
     super();
     sliceCount = 1;

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestAuthenticationFramework.java Thu Jun  4 19:24:05 2015
@@ -23,9 +23,6 @@ import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
 import org.apache.http.HttpException;
@@ -63,12 +60,6 @@ public class TestAuthenticationFramework
   static String requestUsername = MockAuthenticationPlugin.expectedUsername;
   static String requestPassword = MockAuthenticationPlugin.expectedPassword;
   
-  protected final static List<String> brokenLocales =
-      Arrays.asList(
-        "th_TH_TH_#u-nu-thai",
-        "ja_JP_JP_#u-ca-japanese",
-        "hi_IN");
-
   @Rule
   public TestRule solrTestRules = RuleChain
       .outerRule(new SystemPropertiesRestoreRule());
@@ -80,9 +71,6 @@ public class TestAuthenticationFramework
 
   @Override
   public void setUp() throws Exception {
-    if (brokenLocales.contains(Locale.getDefault().toString())) {
-      Locale.setDefault(Locale.US);
-    }
     setupAuthenticationPlugin();
     super.setUp();
   }

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java Thu Jun  4 19:24:05 2015
@@ -52,12 +52,7 @@ public class TestCollectionAPI extends R
 
   public TestCollectionAPI() {
     schemaString = "schema15.xml";      // we need a string id
-  }
-
-  @Override
-  public void distribSetUp() throws Exception {
     sliceCount = 2;
-    super.distribSetUp();
   }
 
   @Test

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestCryptoKeys.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestCryptoKeys.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestCryptoKeys.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestCryptoKeys.java Thu Jun  4 19:24:05 2015
@@ -71,12 +71,6 @@ public class TestCryptoKeys extends Abst
   }
 
 
-  @Override
-  public void distribSetUp() throws Exception {
-    super.distribSetUp();
-    System.setProperty("numShards", Integer.toString(sliceCount));
-  }
-
   public TestCryptoKeys() {
     super();
     sliceCount = 1;

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudCluster.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudCluster.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudCluster.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudCluster.java Thu Jun  4 19:24:05 2015
@@ -22,10 +22,13 @@ import org.apache.lucene.util.LuceneTest
 import org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettyConfig;
+import org.apache.solr.client.solrj.embedded.JettyConfig.Builder;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.cloud.ClusterState;
 import org.apache.solr.common.cloud.Replica;
@@ -88,7 +91,9 @@ public class TestMiniSolrCloudCluster ex
   protected void testCollectionCreateSearchDelete() throws Exception {
 
     File solrXml = new File(SolrTestCaseJ4.TEST_HOME(), "solr-no-core.xml");
-    MiniSolrCloudCluster miniCluster = new MiniSolrCloudCluster(NUM_SERVERS, null, createTempDir().toFile(), solrXml, null, null);
+    Builder jettyConfig = JettyConfig.builder();
+    jettyConfig.waitForLoadingCoresToFinish(null);
+    MiniSolrCloudCluster miniCluster = new MiniSolrCloudCluster(NUM_SERVERS, createTempDir().toFile(), solrXml, jettyConfig.build());
 
     try {
       assertNotNull(miniCluster.getZkServer());
@@ -174,6 +179,16 @@ public class TestMiniSolrCloudCluster ex
         startedServer = miniCluster.startJettySolrRunner(null, null, null);
         assertTrue(startedServer.isRunning());
         assertEquals(NUM_SERVERS, miniCluster.getJettySolrRunners().size());
+        Thread.sleep(15000);
+        try {
+          cloudSolrClient.query(query);
+          fail("Expected exception on query because collection should not be ready - we have turned on async core loading");
+        } catch (SolrServerException e) {
+          SolrException rc = (SolrException) e.getRootCause();
+          assertTrue(rc.code() >= 500 && rc.code() < 600);
+        } catch (SolrException e) {
+          assertTrue(e.code() >= 500 && e.code() < 600);
+        }
 
         // delete the collection we created earlier
         miniCluster.deleteCollection(collectionName);

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterKerberos.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterKerberos.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterKerberos.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterKerberos.java Thu Jun  4 19:24:05 2015
@@ -19,8 +19,6 @@ package org.apache.solr.cloud;
 
 import javax.security.auth.login.Configuration;
 import java.io.File;
-import java.util.Arrays;
-import java.util.List;
 import java.util.Locale;
 
 import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
@@ -62,14 +60,9 @@ public class TestMiniSolrCloudClusterKer
     REPLICATION_FACTOR = 2;
   }
   
-  protected final static List<String> brokenLocales =
-      Arrays.asList(
-        "th_TH_TH_#u-nu-thai",
-        "ja_JP_JP_#u-ca-japanese",
-        "hi_IN");
-
   private MiniKdc kdc;
 
+  private Locale savedLocale; // in case locale is broken and we need to fill in a working locale
   @Rule
   public TestRule solrTestRules = RuleChain
       .outerRule(new SystemPropertiesRestoreRule());
@@ -81,9 +74,7 @@ public class TestMiniSolrCloudClusterKer
 
   @Override
   public void setUp() throws Exception {
-    if (brokenLocales.contains(Locale.getDefault().toString())) {
-      Locale.setDefault(Locale.US);
-    }
+    savedLocale = KerberosTestUtil.overrideLocaleIfNotSpportedByMiniKdc();
     super.setUp();
     setupMiniKdc();
   }
@@ -171,6 +162,7 @@ public class TestMiniSolrCloudClusterKer
     if (kdc != null) {
       kdc.stop();
     }
+    Locale.setDefault(savedLocale);
     super.tearDown();
   }
 }

Modified: lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberos.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberos.java?rev=1683615&r1=1683614&r2=1683615&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberos.java (original)
+++ lucene/dev/branches/LUCENE-6481/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberos.java Thu Jun  4 19:24:05 2015
@@ -18,10 +18,9 @@ package org.apache.solr.cloud;
  */
 
 import javax.security.auth.login.Configuration;
+
 import java.io.File;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
 import java.util.Locale;
 
 import org.apache.commons.io.Charsets;
@@ -49,20 +48,14 @@ public class TestSolrCloudWithKerberos e
   static final int TIMEOUT = 10000;
   private MiniKdc kdc;
 
-  protected final static List<String> brokenLocales =
-      Arrays.asList(
-          "th_TH_TH_#u-nu-thai",
-          "ja_JP_JP_#u-ca-japanese",
-          "hi_IN");
+  private Locale savedLocale; // in case locale is broken and we need to fill in a working locale
 
   Configuration originalConfig = Configuration.getConfiguration();
   
   @Override
   public void distribSetUp() throws Exception {
     //SSLTestConfig.setSSLSystemProperties();
-    if (brokenLocales.contains(Locale.getDefault().toString())) {
-      Locale.setDefault(Locale.US);
-    }
+    savedLocale = KerberosTestUtil.overrideLocaleIfNotSpportedByMiniKdc();
     // Use just one jetty
     this.sliceCount = 0;
     this.fixShardCount(1);
@@ -198,6 +191,7 @@ public class TestSolrCloudWithKerberos e
       kdc.stop();
     }
     //SSLTestConfig.clearSSLSystemProperties();
+    Locale.setDefault(savedLocale);
     super.distribTearDown();
   }
 }