zkendall commented on code in PR #2799:
URL: https://github.com/apache/solr/pull/2799#discussion_r1820038021


##########
solr/core/src/test/org/apache/solr/cloud/SplitShardTest.java:
##########
@@ -174,6 +164,50 @@ public void testSplitFuzz() throws Exception {
     assertEquals("wrong range in s1_1", expected1, delta1);
   }
 
+  @Test
+  public void testWithChildDocuments() throws Exception {
+    CloudSolrClient solrClient = cluster.getSolrClient();
+    CollectionAdminRequest.createCollection(COLLECTION_NAME, "conf", 1, 
1).process(solrClient);
+
+    cluster.waitForActiveCollection(COLLECTION_NAME, 1, 1);
+
+    List<SolrInputDocument> inputDocs = new ArrayList<>();
+    for (int idx = 0; idx < 10; ++idx) {
+      SolrInputDocument parent = new SolrInputDocument();
+      parent.addField("id", idx);
+      parent.addField("type_s", "parent");
+
+      // Child has different ID, so could be routed differently if used for 
routing.
+      SolrInputDocument child = new SolrInputDocument();
+      child.addField("id", idx + "_child");
+      child.addField("expected_parent_s", idx);
+
+      parent.addField("myChild", List.of(child));
+
+      inputDocs.add(parent);
+    }
+    solrClient.add(COLLECTION_NAME, inputDocs);
+
+    CollectionAdminRequest.SplitShard splitShard =
+        CollectionAdminRequest.splitShard(COLLECTION_NAME)
+            .setNumSubShards(2)
+            .setShardName("shard1");
+    splitShard.process(solrClient);
+    waitForState("Timed out waiting for shard split", COLLECTION_NAME, 
activeClusterShape(2, 2));

Review Comment:
   > client-side ZkStateReader (from a CloudSolrClient)
   
   derp 🤦 .
   
   Well after that, I was about to surrender, but instead put together one last 
sally :)
   
   Inside the verification step, I added a log statement on the docs shard. 
`log.info("doc shard: "+doc.get("[shard]"));`
   In the first ~3 runs this showed expected data  `shard1_0` etc, but 
eventually I git a run that showed the docs still on the original shard 
(attached pic). Though based on the logs above that, `Update shard state 
shard1_1 to active`, I'm guessing this is more of a visibility issue than a 
shard state issue and aforementioned wait wouldn't have prevented this. What 
could prevent this, a forced commit?
   
   
![image](https://github.com/user-attachments/assets/89b9c275-ba7c-47a5-8975-d35aaa97f972)
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to