VSB-TUO/Health report license summary#1135
Merged
milanmajchrak merged 3 commits intocustomer/vsb-tuofrom Nov 3, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes the LicenseCheck health check by implementing batch database queries instead of individual N+1 queries, reducing the number of database calls from one per item to a single batch query. This significantly improves performance for large repositories.
Key changes:
- Added batch query method
findByBitstreamUUIDs()to fetch all license mappings in a single database call - Refactored LicenseCheck to collect bitstream UUIDs first, then batch fetch all mappings, then process results in memory
- Removed unused AWS SDK dependency (
com.amazonaws.util.CollectionUtils)
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| LicenseCheck.java | Refactored to use batch queries and process results in memory; removed AWS dependency |
| ClarinLicenseResourceMappingService.java | Added batch query method signature |
| ClarinLicenseResourceMappingServiceImpl.java | Implemented batch query service method with duplicate import |
| ClarinLicenseResourceMappingDAO.java | Added batch query DAO interface method |
| ClarinLicenseResourceMappingDAOImpl.java | Implemented batch query with IN clause for multiple UUIDs |
Comments suppressed due to low confidence (1)
dspace-api/src/main/java/org/dspace/health/LicenseCheck.java:46
- The contents of this container are never accessed.
Map<UUID, Item> bitstreamToItem = new HashMap<>();
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dspace-api/src/main/java/org/dspace/content/clarin/ClarinLicenseResourceMappingServiceImpl.java
Outdated
Show resolved
Hide resolved
...api/src/main/java/org/dspace/content/service/clarin/ClarinLicenseResourceMappingService.java
Outdated
Show resolved
Hide resolved
dspace-api/src/main/java/org/dspace/content/clarin/ClarinLicenseResourceMappingServiceImpl.java
Show resolved
Hide resolved
...pi/src/main/java/org/dspace/content/dao/impl/clarin/ClarinLicenseResourceMappingDAOImpl.java
Show resolved
Hide resolved
milanmajchrak
requested changes
Oct 30, 2025
vidiecan
approved these changes
Nov 3, 2025
Paurikova2
added a commit
that referenced
this pull request
Nov 5, 2025
* added select get bitstreams based on uuids, improved speed of run * incorrect indentation, removed unused map, checkstyle * removed continue
milanmajchrak
pushed a commit
that referenced
this pull request
Nov 12, 2025
* VSB-TUO/Health report license summary (#1135) * added select get bitstreams based on uuids, improved speed of run * incorrect indentation, removed unused map, checkstyle * VSB-TUO/Fix bitstreamuuid query (#1140) * revent PostgreSQL parameter limit error by batching bitstream UUID queries in findByBitstreamUUIDs * BATCH_SIZE as configurable constant
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.
Problem description
Since the database had too much data, it made too many calls and got stuck in a never-ending loop.