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 2020/05/15 04:47:46 UTC

[lucene-solr] branch branch_8x updated (218cdac -> abaf16e)

This is an automated email from the ASF dual-hosted git repository.

tflobbe pushed a change to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


    from 218cdac  RefGuide typo
     new 43631e1  SOLR-14471: Fix last-place replica after shards.preference rules  (#1507)
     new abaf16e  SOLR-14471: Add CHANGES entry

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 solr/CHANGES.txt                                        |  3 +++
 .../routing/RequestReplicaListTransformerGenerator.java |  3 ++-
 .../RequestReplicaListTransformerGeneratorTest.java     | 17 ++++++++++++++++-
 3 files changed, 21 insertions(+), 2 deletions(-)


[lucene-solr] 01/02: SOLR-14471: Fix last-place replica after shards.preference rules (#1507)

Posted by tf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tflobbe pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 43631e126e93308d034a2babd51765230f96f5e3
Author: Michael Gibney <mi...@michaelgibney.net>
AuthorDate: Fri May 15 00:31:35 2020 -0400

    SOLR-14471: Fix last-place replica after shards.preference rules  (#1507)
    
    Properly apply base replica ordering to last-place shards.preference matches
---
 .../routing/RequestReplicaListTransformerGenerator.java |  3 ++-
 .../RequestReplicaListTransformerGeneratorTest.java     | 17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/RequestReplicaListTransformerGenerator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/RequestReplicaListTransformerGenerator.java
index 2f41768..4853787 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/RequestReplicaListTransformerGenerator.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/RequestReplicaListTransformerGenerator.java
@@ -158,7 +158,7 @@ public class RequestReplicaListTransformerGenerator {
         Object current;
         int idx = 1;
         int boundaryCount = 0;
-        int[] boundaries = new int[choices.size() - 1];
+        int[] boundaries = new int[choices.size()];
         do {
           current = iter.next();
           if (replicaComp.compare(prev, current) != 0) {
@@ -167,6 +167,7 @@ public class RequestReplicaListTransformerGenerator {
           prev = current;
           idx++;
         } while (iter.hasNext());
+        boundaries[boundaryCount++] = idx;
 
         // Finally inspect boundaries to apply base transformation, where necessary (separate phase to avoid ConcurrentModificationException)
         int startIdx = 0;
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/routing/RequestReplicaListTransformerGeneratorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/routing/RequestReplicaListTransformerGeneratorTest.java
index 5b64fde..c0ebad3 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/routing/RequestReplicaListTransformerGeneratorTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/routing/RequestReplicaListTransformerGeneratorTest.java
@@ -88,6 +88,19 @@ public class RequestReplicaListTransformerGeneratorTest extends SolrTestCaseJ4 {
         )
     );
 
+    // Add a PULL replica so that there's a tie for "last place"
+    replicas.add(
+        new Replica(
+            "node5",
+            map(
+                ZkStateReader.BASE_URL_PROP, "http://host2_2:8983/solr",
+                ZkStateReader.NODE_NAME_PROP, "node5",
+                ZkStateReader.CORE_NAME_PROP, "collection1",
+                ZkStateReader.REPLICA_TYPE, "PULL"
+            ), "c1","s1"
+        )
+    );
+
     // replicaType and replicaBase combined rule param
     String rulesParam = ShardParams.SHARDS_PREFERENCE_REPLICA_TYPE + ":NRT," +
         ShardParams.SHARDS_PREFERENCE_REPLICA_TYPE + ":TLOG," +
@@ -101,6 +114,7 @@ public class RequestReplicaListTransformerGeneratorTest extends SolrTestCaseJ4 {
     assertEquals("node2", replicas.get(1).getNodeName());
     assertEquals("node4", replicas.get(2).getNodeName());
     assertEquals("node3", replicas.get(3).getNodeName());
+    assertEquals("node5", replicas.get(4).getNodeName());
 
     params.set("routingPreference", "1");
     rlt = generator.getReplicaListTransformer(params);
@@ -108,7 +122,8 @@ public class RequestReplicaListTransformerGeneratorTest extends SolrTestCaseJ4 {
     assertEquals("node1", replicas.get(0).getNodeName());
     assertEquals("node4", replicas.get(1).getNodeName());
     assertEquals("node2", replicas.get(2).getNodeName());
-    assertEquals("node3", replicas.get(3).getNodeName());
+    assertEquals("node5", replicas.get(3).getNodeName());
+    assertEquals("node3", replicas.get(4).getNodeName());
   }
 
   @SuppressWarnings("unchecked")


[lucene-solr] 02/02: SOLR-14471: Add CHANGES entry

Posted by tf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tflobbe pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit abaf16ea1bb2301e5b555f0bf1ea9d3bd7012761
Author: Tomas Fernandez Lobbe <tf...@apache.org>
AuthorDate: Thu May 14 21:35:21 2020 -0700

    SOLR-14471: Add CHANGES entry
---
 solr/CHANGES.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 100d4e2..66608ce 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -102,6 +102,9 @@ Bug Fixes
 * SOLR-14456: Fix Content-Type header usage when a request is forwarded from Solr node to Solr
   node with compression enabled (samuelgmartinez via Houston Putman)
 
+* SOLR-14471: Fix bug in shards.preference behavior, base replica selection strategy not applied to the last group of
+  equivalent replicas. (Michael Gibney via Tomás Fernández Löbbe)
+
 Other Changes
 ---------------------
 * SOLR-14197: SolrResourceLoader: marked many methods as deprecated, and in some cases rerouted exiting logic to avoid