Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Thanks for fixing this! Two comments:
|
|
On your first point: good hint, but for a different reason. EclipseLink loads lazy relations of detached entities without trouble, so that part is fine. The real problem is that the request thread and the background indexer share the same entity objects, and EclipseLink's unit of work is not thread-safe. That race just failed a CI run on #12740 (an NPE inside EclipseLink) and it shows up in a develop run from 15 September too. Passing ids and loading in the background thread fixes it. One catch: for a revoked role the assignment is already deleted, so the event has to carry the id of the collection or dataset it was on. I'm working on that now, and I'll also make the test waits more careful. A commit is coming. On your second point: agreed, and I checked where it bites.
I'd keep this PR to indexing and open an issue for 6.13: run the whole |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I am investigating the failed tests. |
This comment has been minimized.
This comment has been minimized.
|
|
📦 Pushed preview images as 🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |


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
asyncIndexDatasetfrom 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 (thedvObjectToModify is nullerrors 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 inIndexAsyncgoes away.The requests carry ids, not entities. The background job loads the dataset itself, in a transaction of its own, and the permission reindexing loads the definition points by id (for a revoked role the assignment is already gone, so its definition point id is passed on). Sharing the entity with the request thread was a race: both threads read it at the same time, and EclipseLink's unit of work is not thread-safe. That race produced an NPE inside EclipseLink in a CI run of #12740 (
AbstractSession.executeDeferredEvents) and in a develop run of 15 September.On the test side
sleepForReindexpolls every 100 ms instead of sleeping a fixed 1.5 s, the dev/CI Solr soft commits every 100 ms, andsleepForDatasetIndexfails on timeout instead of warning. When a search cannot be tied to a dataset (a query for*or a text), the fixed 1.5 s wait stays, and the searches inSearchITthat relied on it now wait on their dataset id first.Which issue(s) this PR 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),
SearchITin 137 s instead of 409 s.Suggestions on how to test this:
Run
SearchITandDataRetrieverApiITagainst the dev stack with-Ddataverse.test.solr.softcommit.millis=100, then check thatdocker 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.