SOLR-6988 Make stateformat=2 as default

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1653867 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2015-01-22 14:12:52 +00:00
parent 02dfdd3202
commit ec01b5aeb5
3 changed files with 12 additions and 13 deletions

View File

@ -853,6 +853,9 @@ public class CollectionsHandler extends RequestHandlerBase {
DocCollection.STATE_FORMAT, DocCollection.STATE_FORMAT,
AUTO_ADD_REPLICAS, AUTO_ADD_REPLICAS,
"router."); "router.");
if(props.get(DocCollection.STATE_FORMAT) == null){
props.put(DocCollection.STATE_FORMAT,"2");
}
if(SYSTEM_COLL.equals(name)){ if(SYSTEM_COLL.equals(name)){
//We must always create asystem collection with only a single shard //We must always create asystem collection with only a single shard

View File

@ -77,8 +77,8 @@ public class ExternalCollectionsTest extends AbstractFullDistribZkTestBase {
@Override @Override
protected int getStateFormat() { protected String getStateFormat() {
return 2; return "2";
} }
private void testConfNameAndCollectionNameSame() throws Exception{ private void testConfNameAndCollectionNameSame() throws Exception{

View File

@ -353,16 +353,12 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
return createJettys(numJettys, false); return createJettys(numJettys, false);
} }
protected int defaultStateFormat = 1 + random().nextInt(2); protected String defaultStateFormat = String.valueOf( 1 + random().nextInt(2));
protected int getStateFormat() { protected String getStateFormat() {
String stateFormat = System.getProperty("tests.solr.stateFormat", null); String stateFormat = System.getProperty("tests.solr.stateFormat", null);
if (stateFormat != null) { if (stateFormat != null) {
if ("2".equals(stateFormat)) { defaultStateFormat = stateFormat;
return defaultStateFormat = 2;
} else if ("1".equals(stateFormat)) {
return defaultStateFormat = 1;
}
} }
return defaultStateFormat; // random return defaultStateFormat; // random
} }
@ -378,7 +374,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
List<SolrClient> clients = new ArrayList<>(); List<SolrClient> clients = new ArrayList<>();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (getStateFormat() == 2) { if ("2".equals(getStateFormat())) {
log.info("Creating collection1 with stateFormat=2"); log.info("Creating collection1 with stateFormat=2");
SolrZkClient zkClient = new SolrZkClient(zkServer.getZkAddress(), SolrZkClient zkClient = new SolrZkClient(zkServer.getZkAddress(),
AbstractZkTestCase.TIMEOUT, AbstractZkTestCase.TIMEOUT); AbstractZkTestCase.TIMEOUT, AbstractZkTestCase.TIMEOUT);
@ -1623,9 +1619,9 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
collectionInfos.put(collectionName, list); collectionInfos.put(collectionName, list);
} }
params.set("name", collectionName); params.set("name", collectionName);
if (getStateFormat() == 2) { if ("1".equals(getStateFormat()) ) {
log.info("Creating collection with stateFormat=2: " + collectionName); log.info("Creating collection with stateFormat=1: " + collectionName);
params.set(DocCollection.STATE_FORMAT, "2"); params.set(DocCollection.STATE_FORMAT, "1");
} }
SolrRequest request = new QueryRequest(params); SolrRequest request = new QueryRequest(params);
request.setPath("/admin/collections"); request.setPath("/admin/collections");