java-client-api
java-client-api copied to clipboard
QueryBatcherTest fails due to server side forest assignment policy changes.
Version of MarkLogic Java Client API
develop
Version of MarkLogic Server
10.0-2 and nightly 10.0 releases after 10.0-2 releases.
Java version
9.0.4
OS and version
Happens on both Windows and Linux versions.
Input: Some code to illustrate the problem, preferably in a state that can be independently reproduced on our end
QueryBatcherTest.java in test folder. Assignment policy for database java-unittest
from MarkLogic Server release 10.0-2 onward is 'segment'.
Above test was written when policy was bucket
. Either the tests (8 test methods needs to be changed) have to be changed or the setup for this test needs to be changed so that database assignment policy is bucket.
Actual output: What did you observe? What errors did you see? Can you attach the logs? (Java logs, MarkLogic logs)
java.lang.AssertionError: Missing uri=[/QueryBatcherTest/content_1.json] from forest=[java-unittest-1]
at org.junit.Assert.fail(Assert.java:88)
at com.marklogic.client.test.datamovement.QueryBatcherTest.runQueryBatcher(QueryBatcherTest.java:394)
at com.marklogic.client.test.datamovement.QueryBatcherTest.runQueryBatcher(QueryBatcherTest.java:404)
at com.marklogic.client.test.datamovement.QueryBatcherTest.testRawCtsQuery(QueryBatcherTest.java:199)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Expected output: What specifically did you expect to happen?
All tests run successfully.
Alternatives: What else have you tried, actual/expected?
Using the Admin GUI changed the assignment policy to bucket. Tests ran fine.
We decided in the morning standup (09/30/2019 's) that Java Client API should cater to needs of DHF and that project has elected to use segment as the forest assignment policy. Hence changing the test setup to use previous assignment policy, i.e. bucket, needs to be reworked.
Tests should be run using segment policy (which is the default policy as of 5.0.1 Java Client API release and ML Server 10.0-2 release).
A couple of notes. First, the following tests are affected:
testRawCtsQuery testRawValueQuery testRawCombinedQuery testDirectoryQuery testCollectionQuery testStructuredQuery testStringQuery
Second, if develop-143 proves beneficial and thus is merged, this bug will be easy to fix because the setup can determine which uri is in which forest and thus set up the expectations correctly regardless of assignment policy.
A fallback if develop-143 isn't merged would be to revise the unit tests to take the same approach as in the unit test for #1196, which verifies the total count and that the set of documents in each forest is disjunct.
The develop-143 branch doesn't seem likely to be merged.
The default policy is still segment.
When time permits, the best known resolution will be to take the same approach as 1196.
Just ran the test on a database with "bucket" and then changed it to "segment" - all tests passed. Note that a new database defaults to "bucket", which is the case for the java-unittest database.