Skip to content

Enable opt-in concurrency for tests#4301

Draft
ScottDugas wants to merge 25 commits into
FoundationDB:mainfrom
ScottDugas:test-concurrency-opt-in
Draft

Enable opt-in concurrency for tests#4301
ScottDugas wants to merge 25 commits into
FoundationDB:mainfrom
ScottDugas:test-concurrency-opt-in

Conversation

@ScottDugas

Copy link
Copy Markdown
Collaborator

This updates our configuration so that test classes annotated with @Execution(ExecutionMode.CONCURRENT) will run the tests in parallel, which, right now is 15 classes.
I hope to change the default to run concurrently, but there are a variety of tests failing under that configuration, for a variety of reasons that would need to be addressed.

This updates our configuration so that test classes annotated with
`@Execution(ExecutionMode.CONCURRENT)` will run the tests in
parallel, which, right now is 15 classes.
I hope to change the default to run concurrently, but there are a
variety of tests failing under that configuration, for a variety
of reasons that would need to be addressed.
@ScottDugas ScottDugas added the testing improvement Change that improves our testing label Jun 26, 2026
The actual logs get super intermingled making it impossible to know
what an individual test was doing
It looks like it was getting transaction-too-old.
Basic hypothesis: With concurrent work fdb takes just a little bit
longer, and we can't insert the batches of 100 at the end within 5
seconds, so it gets transaction-too-old. The runAsync retries a few
times, but with the other load it can't succeed. By shrinking the
batch size when it gets a bit higher it succeeds.
Instead of hardcoding the size universally at 100 for batches,
this adds a very, very simplistic work reduction to
TestHelpers.basicInsertBatch. To make this a bit cleaner, it also
encapsulate that method in one that just takes a list of vectors,
which covers all of OperationsTest.
@ScottDugas ScottDugas force-pushed the test-concurrency-opt-in branch from 6503204 to dceae4f Compare June 30, 2026 16:32
This was useful in debugging the failures, and we may want to
revisit something similar in the future, but for now, reduce the
churn in the PR
@ScottDugas ScottDugas force-pushed the test-concurrency-opt-in branch from dceae4f to e3d4977 Compare June 30, 2026 16:34
// When JUnit's parallel execution is enabled, lifecycle methods and the test body can run on
// different worker threads, leaving the test body without a debugger installed. Pin everything in
// this class to a single thread so the thread-local survives between @BeforeEach and @Test.
@Execution(ExecutionMode.SAME_THREAD)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Note: This isn't strictly necessary at this point because we still default to SAME_THREAD. The changes below were necessary, and this future-proofs us for enabling parallelism by default.

I _think_ these ended up being unnecessary.
This reverts commit 9f7fbd1.

It turns out this is necessary, all the OperationsTests (or most)
timed out after 5 minutes, causing the overall build to timeout
after 40. I believe this is because we have a lot of futures, and
if we are doing everything in a thread pool, joining on a future
directly impacts parallelism, so way less work will be done, and
it could potentially run out of threads.
This reverts commit e3d4977.

I'm getting test timeouts, so need more info....
In case this is what is causing the tests to pass....
The tests around Cached read version can get messed up by other tests
running concurrently. I have a fix elsewhere, but want to minimize
the changes in this PR.
This reverts commit eaf53c2.

All the tests timed out... Maybe it's independently flaky...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing improvement Change that improves our testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant