Skip to content

LEGLINK-789: Speed up Validation service result persistence - #1822

Merged
johnbritton merged 6 commits into
devfrom
users/jbritton/LEGLINK-789
Aug 13, 2026
Merged

LEGLINK-789: Speed up Validation service result persistence#1822
johnbritton merged 6 commits into
devfrom
users/jbritton/LEGLINK-789

Conversation

@johnbritton

@johnbritton johnbritton commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🛠️ Description of Changes

This PR improves write performance in the result table of the validation database by batching large groups of inserts.

Replaced Result identity generation with a dedicated dbo.result_sequence configured for Hibernate sequence allocation, and added batching settings for insert/update ordering. Included a migration that recreates the result and result_category tables plus sequence so the database matches the new JPA ID strategy.

🧪 Testing Performed

Automated tests to check for regressions.

🧑‍🔬 Unit Testing

  • I have written or updated unit tests to cover my changes
  • Coverage: 0.0%

📓 Documentation Updated

Please update any relevant sections in the project documentation that were impacted by the changes in the PR.

Summary by CodeRabbit

  • Performance Improvements

    • Improved database write performance through optimized batching and ordering of inserts and updates.
    • Increased efficiency when processing large volumes of validation results.
  • Database Updates

    • Added a more scalable result identifier sequence to support higher-volume data processing.
    • Updated result storage structures, relationships, indexes, and uniqueness rules to improve consistency and reliability.

johnbritton and others added 4 commits August 12, 2026 10:29
…ategories/validation-categories-management/validation-categories-management.component.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Replaced Result identity generation with a dedicated dbo.result_sequence configured for Hibernate sequence allocation, and added batching settings for insert/update ordering. Included a migration that recreates the result and result_category tables plus sequence so the database matches the new JPA ID strategy.
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 85122205-34ad-4e37-9a56-03cbfc8fd0c9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The validation module replaces identity-based result IDs with a SQL Server sequence, recreates related database objects, and enables Hibernate JDBC batching with ordered inserts and updates in local and Docker environments.

Changes

Result persistence

Layer / File(s) Summary
Result sequence schema
Java/validation/src/main/resources/database/migrations/V20260812__result_sequence_recreate_table.sql
The migration recreates the result tables, constraints, indexes, join table, and dbo.result_sequence. The sequence uses bigint values and increments by 100.
Result ID mapping
Java/validation/src/main/java/com/lantanagroup/link/validation/entities/Result.java
Result.id uses the result_seq generator backed by dbo.result_sequence with allocation size 100.
Hibernate batching configuration
Java/validation/src/main/resources/application-local.yml, Java/validation/src/main/resources/application-docker.yml
Both environments enable JDBC batching with a batch size of 100 and ordered inserts and updates.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: seanmcilvenna, edward-miller-lcg

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: improving Validation service result persistence performance.
Description check ✅ Passed The description includes all required sections and accurately covers the batching changes, migration, testing status, unit tests, and documentation status.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch users/jbritton/LEGLINK-789

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@Java/validation/src/main/resources/database/migrations/V20260812__result_sequence_recreate_table.sql`:
- Around line 12-20: Replace the destructive drops in migration
V20260812__result_sequence_recreate_table with a temporary-table migration that
recreates the schema, copies existing result_category and result rows plus their
associations, validates the copied data, then swaps the replacement tables into
place. Preserve the clean-database path, and add XUnit coverage for both
populated and empty database branches, including category and issue retrieval
through the validation service.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ec97ba9d-d548-4591-8dcd-a41bd7881ede

📥 Commits

Reviewing files that changed from the base of the PR and between c3ce5ef and 04f8f55.

📒 Files selected for processing (4)
  • Java/validation/src/main/java/com/lantanagroup/link/validation/entities/Result.java
  • Java/validation/src/main/resources/application-docker.yml
  • Java/validation/src/main/resources/application-local.yml
  • Java/validation/src/main/resources/database/migrations/V20260812__result_sequence_recreate_table.sql

Remove the explicit schema = "dbo" from the @SequenceGenerator on Result.id. This allows JPA to use the default schema provided by the persistence setup, improving portability across database vendors and avoiding hard-coded SQL Server schema assumptions.
@johnbritton
johnbritton merged commit b7647b4 into dev Aug 13, 2026
18 checks passed
@johnbritton
johnbritton deleted the users/jbritton/LEGLINK-789 branch August 13, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants