Skip to content

Fix indexing race conditions for new dataset versions#12388

Open
vera wants to merge 5 commits into
IQSS:developfrom
vera:fix/12377
Open

Fix indexing race conditions for new dataset versions#12388
vera wants to merge 5 commits into
IQSS:developfrom
vera:fix/12377

Conversation

@vera
Copy link
Copy Markdown
Contributor

@vera vera commented May 8, 2026

What this PR does / why we need it:

This PR fixes a race condition where a new dataset version (draft) could be sent to the indexing service before its database ID (datasetVersionId) was committed (see #12377). The fix ensures a database flush before indexing and adds defensive handling in the search results and indexing logic.

Which issue(s) this PR closes:

Special notes for your reviewer:

The main fix is in CreateDatasetVersionCommand.java where ctxt.em().flush() is called before returning (and thus before onSuccess triggers indexing). Changes in SolrSearchResult.java and IndexServiceBean.java are defensive to prevent 500 errors if the ID is still missing for any reason.

Suggestions on how to test this:

Since this is a race condition, it is hard to reproduce consistently in a standard integration test.

Existing integration & unit tests can be run to ensure nothing was broken in dataset creation and indexing.

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

/

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

Yes, included in doc/release-notes/12377-fix-dataset-version-id-race-condition.md.

Additional documentation:

/

@vera vera changed the title Fix/12377 Fix indexing race conditions for new dataset versions May 8, 2026
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.

Indexing race conditions for new dataset versions

1 participant