Skip to content

fix: slow indexing of datasets with many external vocabulary terms - #12767

Merged
landreev merged 1 commit into
IQSS:developfrom
akeldamas:12765-index-cvoc-lookup-without-flush
Oct 2, 2026
Merged

landreev merged 1 commit into
IQSS:developfrom
akeldamas:12765-index-cvoc-lookup-without-flush

Conversation

@akeldamas

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Since #12712 the background index job loads its own copy of the dataset. For every external vocabulary term it runs a database query to look up the label. Because the flush mode is AUTO, EclipseLink first checks the whole dataset for changes before each of those queries. With thousands of terms, indexing takes minutes instead of seconds.

The job only reads, so there is nothing to flush. I set the flush mode of its transaction (IndexServiceBean.indexDatasetNow) to COMMIT, which skips those checks. The index time is still written in its own transaction, as before.

Which issue(s) this PR closes:

Special notes for your reviewer:

  • The Solr documents are the same with and without this change, apart from database ids. I compared them for a dataset with 4,312 vocabulary terms, including all the indexed labels.
  • The flush mode only seems to apply this job's own transaction. I see nothing in the indexing code writes something and then reads it back in the same transaction.

Suggestions on how to test this:

Use the files attached to #12765. Set cvocconf.json as :CVocConf, create a dataset from dataset-4000-keywords.json and time how long it takes until it's indexed. On develop that took 168.9 seconds for me, with this change 3.3 seconds (6.12: 1.1 seconds).

The unit tests pass. I added a test to IndexingAfterCommitTest that checks the job sets the flush mode before it loads the dataset.

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?:

No. It fixes a regression that hasn't been released yet. If #12712 ships in 6.12.1, this should ship with it.

Additional documentation:

None.

With flush mode AUTO the index job checked all loaded entities for changes
before each term lookup. The job never changes them, so COMMIT is safe.

Refs: IQSS#12765
@pdurbin pdurbin moved this to Ready for Triage in IQSS Dataverse Project Oct 1, 2026
@pdurbin
pdurbin requested a review from ErykKul October 1, 2026 20:01
@pdurbin

pdurbin commented Oct 1, 2026

Copy link
Copy Markdown
Member

@akeldamas thanks for the pull request! I kicked off a thread in our internal Slack to talk about. I also requested a review from @ErykKul.

@ErykKul ErykKul left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, nice find. Checked that nothing in that transaction writes, so COMMIT mode is safe there.

@github-project-automation github-project-automation Bot moved this from Ready for Triage to Ready for QA ⏩ in IQSS Dataverse Project Oct 1, 2026
@pdurbin

pdurbin commented Oct 2, 2026

Copy link
Copy Markdown
Member

It looks like @ErykKul has cherry-picked c00cfff from this PR by @akeldamas into a new PR Eryk made:

@pdurbin pdurbin added this to the 6.12.1 milestone Oct 2, 2026
@landreev
landreev merged commit 84416f1 into IQSS:develop Oct 2, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done 🧹

Development

Successfully merging this pull request may close these issues.

Extremly slow indexing of datasets with many external vocabulary terms

4 participants