Conversation
- Prevent UpdateDatasetVersionCommand from modifying modificationTime on all existing files in the dataset. - Only initialize timestamps on newly created files (createDate == null) or when single-file variable metadata (fmVarMet) is explicitly updated. - Resolves quadratic O(N^2) cumulative UPDATE DVOBJECT queries causing upload times to degrade from 1s to 30s+ on datasets with 10k+ files. - Adds comprehensive JUnit 5 acceptance tests asserting existing files are not dirtied. Reference: https://groups.google.com/g/dataverse-community/c/pzSjF1YPaJw/m/bQWX3W_kBwAJ
…pload bottleneck - Configured 2 CPU, 8GB RAM environment with Postgres query logging. - Includes investigate.py benchmark tool measuring per-file latency and SQL UPDATE count. - Includes technical report and replication guide. Reference: https://groups.google.com/g/dataverse-community/c/pzSjF1YPaJw/m/bQWX3W_kBwAJ
…ion environment - Renamed release note to doc/release-notes/12728-perf-large-upload.md matching IQSS#12728 - Moved Docker reproduction benchmark environment to dedicated repository: https://github.com/tuannx/dataverse-large-upload-repro
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:$O(N)$ database write bottleneck in
Fixes an
UpdateDatasetVersionCommand.javawhere adding a file or updating a dataset version unconditionally touchedmodificationTimeon all existing files in the dataset.In datasets with thousands of files (e.g. 14,000+ files), mutating every file's modification timestamp on each upload caused JPA dirty checking to execute an$\frac{N(N+1)}{2}$ cumulative updates). This caused per-file upload latency to degrade from 1s to over 30s.
UPDATE DVOBJECT SET MODIFICATIONTIME = ...statement for each existing file on every flush (The fix ensures
UpdateDatasetVersionCommandonly initializes timestamps on newly created files (dataFile.getCreateDate() == null), safely handles null timestamps on legacy files, or updates the target file when single-file variable metadata (fmVarMet) is explicitly passed.Which issue(s) this PR closes:
Special notes for your reviewer:
Includes:
src/main/java/edu/harvard/iq/dataverse/engine/command/impl/UpdateDatasetVersionCommand.java: Targeted fix to avoid dirtying existing files in JPA.src/test/java/edu/harvard/iq/dataverse/engine/command/impl/UpdateDatasetVersionCommandTest.java: Acceptance tests asserting that:modificationTime(reproduces and fails on unpatched code, passes with fix).doc/release-notes/12728-perf-large-upload.md: Release notes following issue naming convention.A standalone Docker reproduction benchmark environment and Python benchmark tool are provided in the companion repo:
Suggestions on how to test this:
Run the JUnit 5 acceptance test:
mvn test -Dtest=UpdateDatasetVersionCommandTestOr run the full command regression suite:
mvn test -Dtest=UpdateDatasetVersionCommandTest,CreateDatasetVersionCommandTest,AbstractDatasetCommandTest,UpdateDatasetLicenseCommandTest,UpdateDatasetFieldsCommandTestDoes 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, added
doc/release-notes/12728-perf-large-upload.md.Additional documentation: