You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix JPA event publication delete batching to bind each batch #1701
JpaEventPublicationRepository.deletePublications(List<UUID>) splits identifiers using DELETE_BATCH_SIZE = 100, but the delete query currently binds the original full identifier list for every batch iteration.
That means the code creates batches, but the actual JPQL IN parameter does not respect the batch size.
For example, with 250 identifiers:
Expected behavior:
1st delete binds 100 identifiers
2nd delete binds 100 identifiers
3rd delete binds 50 identifiers
Current behavior:
1st delete binds all 250 identifiers
2nd delete binds all 250 identifiers again
3rd delete binds all 250 identifiers again
The final deleted rows are usually the same, because the first query may delete all matching rows. However, the batching contract is not actually honored.
Impact
This is not a data correctness bug for normal cases where all requested identifiers should be deleted.
The risk appears when the method receives more than DELETE_BATCH_SIZE identifiers:
oversized IN parameters are sent to the database
the same large delete statement is repeated for every computed batch
database parameter limits can still be hit despite the batching code
query parsing/binding work grows unnecessarily for large delete requests
So the issue is best classified as a performance and operational stability fix.
Proposed Fix
Bind the current batch instead of the original identifier list:
Test Coverage
Add a focused unit test for JpaEventPublicationRepository that verifies 101 identifiers are split into two delete executions with batch sizes 100 and 1.
Keep this as a unit test rather than adding mock-based verification to the existing integration test class, so it matches the repository's current test conventions.
Activity
GH-1701 - Fix JPA event publication delete batching.
GH-1701 - Polishing.
odrotbohm commentedon Jun 10, 2026
That's applied, thanks!