Start index jobs after the transaction commits, shorten index waits in ITs #12712

Open
ErykKul opened 9:49am on September 16, 2026 wants to merge 385 Ξ” into iqss/dataverse develop from
flaky-tests-fix
ErykKul authored
of work during September 16
Diff Delta:
385
About 45 Diff Delta/hour
Classified as:  General

ErykKul's Description of Work

What this PR does / why we need it:

Fixes the flaky search tests (SearchIT, DataRetrieverApiIT, see #12710 and #12658) and shortens the index waits in the ITs.

Commands call asyncIndexDataset from inside their transaction, and the background job can run before that transaction commits. When it does, the permission doc misses the creator and the index time is never written (the dvObjectToModify is null errors in the server log), so the dataset stays invisible and the tests wait for nothing. This has been possible since indexing on create became async in #9558; the container based CI is fast enough to hit it.

Index jobs, the index time update and role reindexing now fire a CDI event that runs after the transaction has committed (IndexingRequest, IndexingRequestObserver). No callers change, and the 1 s sleep in IndexAsync goes away.

On the test side sleepForReindex polls every 100 ms instead of sleeping a fixed 1.5 s, the dev/CI Solr soft commits every 100 ms, and sleepForDatasetIndex fails on timeout instead of warning.

Which issue(s) this PR closes:


  • Closes #

Special notes for your reviewer:

Verified against the Docker dev stack: both classes pass, 0 index-time errors in the server log (CI runs had 25 to 80), SearchIT in 137 s instead of 409 s.

Suggestions on how to test this:

Run SearchIT and DataRetrieverApiIT against the dev stack with -Ddataverse.test.solr.softcommit.millis=100, then check that docker logs dev_dataverse 2>&1 | grep -c 'dvObjectToModify" is null' prints 0.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

No.

Is there a release notes update needed for this change?:

Yes: indexing now starts only after the transaction that changed a dataset or its permissions has committed, so a new dataset no longer risks being missing from search for its creator until the next reindex.

Additional documentation:

The testing guide documents -Ddataverse.test.solr.softcommit.millis.

Building updated commit group diff...
9 total changed files
(1 file ignored)
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...