You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by tf...@apache.org on 2017/05/31 00:56:57 UTC
lucene-solr:master: SOLR-10752: replicationFactor default is 0 if
tlogReplicas > 0 is specified
Repository: lucene-solr
Updated Branches:
refs/heads/master 4608e7d03 -> c824b097b
SOLR-10752: replicationFactor default is 0 if tlogReplicas > 0 is specified
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/c824b097
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c824b097
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c824b097
Branch: refs/heads/master
Commit: c824b097b4f2d2f8d7b9560ee258c3a2515fbcf0
Parents: 4608e7d
Author: Tomas Fernandez Lobbe <tf...@apache.org>
Authored: Tue May 30 17:54:28 2017 -0700
Committer: Tomas Fernandez Lobbe <tf...@apache.org>
Committed: Tue May 30 17:54:28 2017 -0700
----------------------------------------------------------------------
solr/CHANGES.txt | 3 +++
.../apache/solr/cloud/CreateCollectionCmd.java | 4 ++--
.../org/apache/solr/cloud/TestPullReplica.java | 20 +++++++++++++++++---
.../org/apache/solr/cloud/TestTlogReplica.java | 20 +++++++++++++++++---
4 files changed, 39 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c824b097/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 3661037..f57cac5 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -198,6 +198,9 @@ Other Changes
* SOLR-10755: delete/refactor many solrj deprecations (hossman)
+* SOLR-10752: replicationFactor (nrtReplicas) default is 0 if tlogReplicas is specified when creating a collection
+ (Tomás Fernández Löbbe)
+
================== 6.7.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c824b097/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java b/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java
index 3d1a54e..02bb018 100644
--- a/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/CreateCollectionCmd.java
@@ -95,9 +95,9 @@ public class CreateCollectionCmd implements Cmd {
// look at the replication factor and see if it matches reality
// if it does not, find best nodes to create more cores
- int numNrtReplicas = message.getInt(NRT_REPLICAS, message.getInt(REPLICATION_FACTOR, 1));
- int numPullReplicas = message.getInt(PULL_REPLICAS, 0);
int numTlogReplicas = message.getInt(TLOG_REPLICAS, 0);
+ int numNrtReplicas = message.getInt(NRT_REPLICAS, message.getInt(REPLICATION_FACTOR, numTlogReplicas>0?0:1));
+ int numPullReplicas = message.getInt(PULL_REPLICAS, 0);
ShardHandler shardHandler = ocmh.shardHandlerFactory.getShardHandler();
final String async = message.getStr(ASYNC);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c824b097/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
index cb732ff..cb0603d 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java
@@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
@@ -116,9 +117,22 @@ public class TestPullReplica extends SolrCloudTestCase {
@Repeat(iterations=2) // 2 times to make sure cleanup is complete and we can create the same collection
public void testCreateDelete() throws Exception {
try {
- CollectionAdminRequest.createCollection(collectionName, "conf", 2, 1, 0, 3)
- .setMaxShardsPerNode(100)
- .process(cluster.getSolrClient());
+ if (random().nextBoolean()) {
+ CollectionAdminRequest.createCollection(collectionName, "conf", 2, 1, 0, 3)
+ .setMaxShardsPerNode(100)
+ .process(cluster.getSolrClient());
+ } else {
+ // Sometimes don't use SolrJ.
+ String url = String.format(Locale.ROOT, "%s/admin/collections?action=CREATE&name=%s&numShards=%s&pullReplicas=%s&maxShardsPerNode=%s",
+ cluster.getRandomJetty(random()).getBaseUrl(),
+ collectionName,
+ 2, // numShards
+ 3, // pullReplicas
+ 100); // maxShardsPerNode
+ url = url + pickRandom("", "&nrtReplicas=1", "&replicationFactor=1"); // These options should all mean the same
+ HttpGet createCollectionRequest = new HttpGet(url);
+ cluster.getSolrClient().getHttpClient().execute(createCollectionRequest);
+ }
boolean reloaded = false;
while (true) {
DocCollection docCollection = getCollectionState(collectionName);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c824b097/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
index 034a8bf..1c2e7aa 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
@@ -30,6 +30,7 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.client.solrj.SolrClient;
@@ -144,9 +145,22 @@ public class TestTlogReplica extends SolrCloudTestCase {
@Repeat(iterations=2) // 2 times to make sure cleanup is complete and we can create the same collection
public void testCreateDelete() throws Exception {
try {
- CollectionAdminRequest.createCollection(collectionName, "conf", 2, 0, 4, 0)
- .setMaxShardsPerNode(100)
- .process(cluster.getSolrClient());
+ if (random().nextBoolean()) {
+ CollectionAdminRequest.createCollection(collectionName, "conf", 2, 0, 4, 0)
+ .setMaxShardsPerNode(100)
+ .process(cluster.getSolrClient());
+ } else {
+ // Sometimes don't use SolrJ
+ String url = String.format(Locale.ROOT, "%s/admin/collections?action=CREATE&name=%s&numShards=%s&tlogReplicas=%s&maxShardsPerNode=%s",
+ cluster.getRandomJetty(random()).getBaseUrl(),
+ collectionName,
+ 2, // numShards
+ 4, // tlogReplicas
+ 100); // maxShardsPerNode
+ HttpGet createCollectionRequest = new HttpGet(url);
+ cluster.getSolrClient().getHttpClient().execute(createCollectionRequest);
+ }
+
boolean reloaded = false;
while (true) {
DocCollection docCollection = getCollectionState(collectionName);