Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure index is up to date when querying #5081

Merged
merged 1 commit into from
Jun 8, 2024

Conversation

rnewson
Copy link
Member

@rnewson rnewson commented Jun 6, 2024

Ensure index is up to date when querying

the IndexHealthCheckTest exposed a sequence of events that lead to
test failure, but also point to an undesirable state during production.

Namely;

  1. an index is opened
  2. an index is updated
  3. the IndexManager closes the index due to LRU pressure, and rolls back
    the changes in step 2
  4. an index is queried, which returns results that don't reflect the
    changes made in step 2.

This change modifies the SearchRequest so that the caller can ensure
the index is at least up to a certain sequence.

Some attributes are added to IndexManager member variables to clarify
their valid ranges.

add --rerun to the test goal so we can run the tests again even if
the code under test has not changed.

@rnewson rnewson force-pushed the nouveau-healthcheck-test-failure-fix branch from f0b4989 to 89a5769 Compare June 6, 2024 21:42
@nickva
Copy link
Contributor

nickva commented Jun 6, 2024

It did show one failure:

024-06-06T22:09:44.508Z] Caching disabled for task ':test' because:

[2024-06-06T22:09:44.508Z]   Build cache is disabled

[2024-06-06T22:09:44.508Z] Task ':test' is not up-to-date because:

[2024-06-06T22:09:44.508Z]   Task.upToDateWhen is false.

[2024-06-06T22:09:44.508Z] Starting process 'Gradle Test Executor 1'. Working directory: /home/jenkins/workspace/jenkins-cm1_PullRequests_PR-5081/25.3.2.12/build/apache-couchdb-3.3.3-89a5769/nouveau Command: /opt/java/openjdk/bin/java -Dorg.gradle.internal.worker.tmpdir=/home/jenkins/workspace/jenkins-cm1_PullRequests_PR-5081/25.3.2.12/build/apache-couchdb-3.3.3-89a5769/nouveau/build/tmp/test/work -Dorg.gradle.native=false -javaagent:/home/jenkins/workspace/jenkins-cm1_PullRequests_PR-5081/25.3.2.12/build/apache-couchdb-3.3.3-89a5769/nouveau/build/tmp/.cache/expanded/zip_cde35f471dab581134460fc9a50e2c59/jacocoagent.jar=destfile=build/jacoco/test.exec,append=true,inclnolocationclasses=false,dumponexit=true,output=file,jmx=false @/home/jenkins/.gradle/.tmp/gradle-worker-classpath17310477907838578221txt -Xmx512m -Dfile.encoding=US-ASCII -Duser.country=US -Duser.language=en -Duser.variant -ea worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 1'

[2024-06-06T22:09:44.508Z] Successfully started process 'Gradle Test Executor 1'
[2024-06-06T22:09:45.706Z] 
[2024-06-06T22:09:45.706Z] IndexHealthCheckTest > testIndexHealthCheck(Path) STANDARD_OUT
[2024-06-06T22:09:45.706Z]     22:09:45.555 [Test worker] INFO org.apache.couchdb.nouveau.core.IndexManager -- deleting indexes below ___test9 (excluding nothing)
[2024-06-06T22:09:45.706Z]     22:09:45.586 [ForkJoinPool.commonPool-worker-3] INFO org.apache.couchdb.nouveau.core.IndexManager -- opening ___test9
[2024-06-06T22:09:46.052Z]     22:09:45.985 [Test worker] INFO org.apache.couchdb.nouveau.core.IndexManager -- closing ___test9 for cause EXPIRED
[2024-06-06T22:09:46.398Z]     22:09:46.167 [Test worker] DEBUG org.apache.couchdb.nouveau.core.IndexManager -- committed ___test9 before close
[2024-06-06T22:09:46.398Z]     22:09:46.173 [ForkJoinPool.commonPool-worker-3] INFO org.apache.couchdb.nouveau.core.IndexManager -- opening ___test9
[2024-06-06T22:09:46.743Z]     22:09:46.366 [Test worker] INFO org.apache.couchdb.nouveau.core.IndexManager -- deleting indexes below ___test9 (excluding nothing)
[2024-06-06T22:09:47.940Z] 
[2024-06-06T22:09:47.940Z] Gradle Test Executor 1 finished executing tests.
[2024-06-06T22:09:47.940Z] 
[2024-06-06T22:09:47.940Z] > Task :test

@nickva
Copy link
Contributor

nickva commented Jun 6, 2024

Interestingly, the failure is not always the same. In a previous run on main the reason for closure was SIZE while in the case above it's EXPIRED


[2024-06-06T20:54:41.651Z] IndexHealthCheckTest > testIndexHealthCheck(Path) STANDARD_OUT
[2024-06-06T20:54:41.651Z]     20:54:41.136 [Test worker] INFO org.apache.couchdb.nouveau.core.IndexManager -- deleting indexes below ___test9 (excluding nothing)
[2024-06-06T20:54:41.651Z]     20:54:41.168 [ForkJoinPool.commonPool-worker-3] INFO org.apache.couchdb.nouveau.core.IndexManager -- opening ___test9
[2024-06-06T20:54:41.996Z]     20:54:41.554 [ForkJoinPool.commonPool-worker-5] INFO org.apache.couchdb.nouveau.core.IndexManager -- closing ___test9 for cause SIZE
[2024-06-06T20:54:41.996Z]     20:54:41.596 [ForkJoinPool.commonPool-worker-5] DEBUG org.apache.couchdb.nouveau.core.IndexManager -- committed ___test9 before close
[2024-06-06T20:54:41.996Z]     20:54:41.706 [ForkJoinPool.commonPool-worker-3] INFO org.apache.couchdb.nouveau.core.IndexManager -- opening ___test9
[2024-06-06T20:54:41.996Z]     20:54:41.723 [ForkJoinPool.commonPool-worker-7] INFO org.apache.couchdb.nouveau.core.IndexManager -- closing ___test9 for cause SIZE
[2024-06-06T20:54:41.996Z]     20:54:41.890 [Test worker] INFO org.apache.couchdb.nouveau.core.IndexManager -- deleting indexes below ___test9 (excluding nothing)
[2024-06-06T20:54:42.464Z] 
[2024-06-06T20:54:42.464Z] IndexHealthCheckTest > testIndexHealthCheck(Path) FAILED
[2024-06-06T20:54:42.464Z]     org.opentest4j.AssertionFailedError: Result{isHealthy=false, message=Wrong number of search results, expected 1, got 0, duration=0, timestamp=2024-06-06T20:54:41.890Z} ==> expected: <true> but was: <false>
[2024-06-06T20:54:42.464Z]         at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
[2024-06-06T20:54:42.464Z]         at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
[2024-06-06T20:54:42.464Z]         at app//org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
[2024-06-06T20:54:42.464Z]         at app//org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
[2024-06-06T20:54:42.464Z]         at app//org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:214)
[2024-06-06T20:54:42.464Z]         at app//org.apache.couchdb.nouveau.health.IndexHealthCheckTest.testIndexHealthCheck(IndexHealthCheckTest.java:45)

@rnewson rnewson force-pushed the nouveau-healthcheck-test-failure-fix branch from 89a5769 to 06c3da5 Compare June 7, 2024 07:14
@rnewson
Copy link
Member Author

rnewson commented Jun 7, 2024

@nickva good catch, that was also because idleseconds defaults to zero.

@rnewson rnewson force-pushed the nouveau-healthcheck-test-failure-fix branch from 06c3da5 to 63b7b79 Compare June 7, 2024 14:42
@rnewson rnewson changed the title IndexManager keep at least one index open Ensure index is up to date when querying Jun 7, 2024
@rnewson rnewson force-pushed the nouveau-healthcheck-test-failure-fix branch 2 times, most recently from 2602aa7 to 1ba13da Compare June 7, 2024 20:00
Copy link
Contributor

@big-r81 big-r81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

the IndexHealthCheckTest exposed a sequence of events that lead to
test failure, but also point to an undesirable state during production.

Namely;

1) an index is opened
2) an index is updated
3) the IndexManager closes the index due to LRU pressure, and rolls back
the changes in step 2
4) an index is queried, which returns results that don't reflect the
changes made in step 2.

This change modifies the SearchRequest so that the caller can ensure
the index is at least up to a certain sequence.

Some attributes are added to IndexManager member variables to clarify
their valid ranges.

add --rerun to the test goal so we can run the tests again even if
the code under test has not changed.
@rnewson rnewson force-pushed the nouveau-healthcheck-test-failure-fix branch from 1ba13da to de63bfe Compare June 8, 2024 20:32
@rnewson rnewson merged commit dbf8d02 into main Jun 8, 2024
17 checks passed
@rnewson rnewson deleted the nouveau-healthcheck-test-failure-fix branch June 8, 2024 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants