zkendall commented on code in PR #2799:
URL: https://github.com/apache/solr/pull/2799#discussion_r1818183662
##########
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:
Doesn't look like it does in this case. `class SplitShard extends
AsyncCollectionAdminRequest`, and the logs show the wait having to try multiple
times before predicate is satisfied
```
4141 INFO
(TEST-SplitShardTest.testWithChildDocuments-seed#[8A3CDF8B33E81E8F]) [n: c: s:
r: x: t:] o.a.s.c.SolrCloudTestCase waitForState (splitshardtest-collection):
Waiting for 2 active shards after split
4141 INFO
(TEST-SplitShardTest.testWithChildDocuments-seed#[8A3CDF8B33E81E8F]) [n: c: s:
r: x: t:] o.a.s.c.SolrCloudTestCase active slice count: 1 expected: 2
4142 INFO (watches-39-thread-1) [n: c: s: r: x: t:]
o.a.s.c.SolrCloudTestCase active slice count: 1 expected: 2
4143 INFO
(TEST-SplitShardTest.testWithChildDocuments-seed#[8A3CDF8B33E81E8F]) [n: c: s:
r: x: t:] o.a.s.c.SolrCloudTestCase active slice count: 1 expected: 2
4143 INFO (watches-39-thread-1) [n: c: s: r: x: t:]
o.a.s.c.SolrCloudTestCase active slice count: 1 expected: 2
4143 INFO
(TEST-SplitShardTest.testWithChildDocuments-seed#[8A3CDF8B33E81E8F]) [n: c: s:
r: x: t:] o.a.s.c.SolrCloudTestCase active slice count: 1 expected: 2
4143 INFO
(TEST-SplitShardTest.testWithChildDocuments-seed#[8A3CDF8B33E81E8F]) [n: c: s:
r: x: t:] o.a.s.c.SolrCloudTestCase active slice count: 1 expected: 2
4242 INFO (zkCallback-40-thread-1) [n: c: s: r: x: t:]
o.a.s.c.c.ZkStateReader A cluster state change: [WatchedEvent
state:SyncConnected type:NodeDataChanged
path:/collections/splitshardtest-collection/state.json zxid: 227] for
collection [splitshardtest-collection] has occurred - updating... (live nodes
size: [1])
4242 INFO (zkCallback-24-thread-2) [n: c: s: r: x: t:]
o.a.s.c.c.ZkStateReader A cluster state change: [WatchedEvent
state:SyncConnected type:NodeDataChanged
path:/collections/splitshardtest-collection/state.json zxid: 227] for
collection [splitshardtest-collection] has occurred - updating... (live nodes
size: [1])
4243 INFO (watches-39-thread-1) [n: c: s: r: x: t:]
o.a.s.c.SolrCloudTestCase active slice count: 2 expected: 2
4243 INFO (watches-39-thread-1) [n: c: s: r: x: t:]
o.a.s.c.SolrCloudTestCase active replica count: 2 expected replica count: 2
```
I can set `splitShard.setWaitForFinalState(true);`, but I think I still like
having this verification step here since I've seen too many tests in my life
have false positives due to faulty premises, this helps future proof it.
--
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]