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


##########
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:
   >  if you choose to supply an async ID (you didn't)
   
   Good point, but it's evidently still not fully processing as the above logs 
show. And I just tried a more explicit test as follows, which  fails as per 
screenshot.
   
   ```java
       splitShard.process(solrClient);
       ZkStateReader zkStateReader = cluster.getZkStateReader();
       Collection<Slice> activeSlices = 
zkStateReader.getClusterState().getCollection(COLLECTION_NAME).getActiveSlices();
       assertEquals("Expected shard slices", activeSlices.size(), 2);
       ```
   
      
   
![image](https://github.com/user-attachments/assets/94e91218-0bf9-4d70-a6d0-bf456ef7b6c1)
   
   
   ~Do you know how `WAIT_FOR_FINAL_STATE` is used? I see that in the 
ShardSplitter it doesn't appear to be used directly, just passed on to it's own 
calls. So far I haven't followed those to learn more.~
   EDIT: Actually upon multiple runs, it can still fail this assertion with  
`setWaitForFinalState(true)`.



##########
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:
   >  if you choose to supply an async ID (you didn't)
   
   Good point, but it's evidently still not fully processing as the above logs 
show. And I just tried a more explicit test as follows, which  fails as per 
screenshot.
   
   ```java
       splitShard.process(solrClient);
       ZkStateReader zkStateReader = cluster.getZkStateReader();
       Collection<Slice> activeSlices = 
zkStateReader.getClusterState().getCollection(COLLECTION_NAME).getActiveSlices();
       assertEquals("Expected shard slices", activeSlices.size(), 2);
   ```
   
      
   
![image](https://github.com/user-attachments/assets/94e91218-0bf9-4d70-a6d0-bf456ef7b6c1)
   
   
   ~Do you know how `WAIT_FOR_FINAL_STATE` is used? I see that in the 
ShardSplitter it doesn't appear to be used directly, just passed on to it's own 
calls. So far I haven't followed those to learn more.~
   EDIT: Actually upon multiple runs, it can still fail this assertion with  
`setWaitForFinalState(true)`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to