Skip to content

MID-11043 Fix 10k limit in certification queries using iterative search for native repo#614

Open
kay1313 wants to merge 1 commit into
masterfrom
fix/MID-11043
Open

MID-11043 Fix 10k limit in certification queries using iterative search for native repo#614
kay1313 wants to merge 1 commit into
masterfrom
fix/MID-11043

Conversation

@kay1313
Copy link
Copy Markdown
Contributor

@kay1313 kay1313 commented Apr 17, 2026

Description

This PR fixes an issue with certification queries on native repository where large campaigns could be silently truncated (e.g. at ~10,000 containers).

The problem was caused by using non-iterative repositoryService.searchContainers(...) in certification helpers, which may return only a limited result set for large queries on native repository. As a result, operations like stage closing or work item processing could affect only a subset of cases/work items, leaving the rest unprocessed.


Changes

Introduced a shared native-aware helper in AccCertQueryHelper:

  • uses searchContainersIterative(...) for native repository
  • falls back to searchContainers(...) for non-native repository

Updated certification queries to use the helper:

  • searchCases(...)
  • getAllCurrentIterationCases(...)
  • searchOpenWorkItems(...)

This ensures full result sets are processed for large campaigns while preserving existing behavior for non-native backends.


Notes

  • The difference between native and non-native repository behavior was introduced in MID-10225.
  • This change preserves the intended behavior introduced there; it only fixes truncation of large result sets and does not alter the original logic.

Testing

Added regression test covering large campaign (>10k cases)
Verifies:

  • full case retrieval via helper methods
  • correct processing of all work items during stage closing

@1azyman 1azyman self-requested a review April 29, 2026 20:27
Copy link
Copy Markdown
Member

@1azyman 1azyman left a comment

Choose a reason for hiding this comment

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

Generic repository was removed in 4.10 (via #10866). Just minor changes to remove dead code.


private <T extends Containerable> void searchContainers(
Class<T> type, ObjectQuery query, ObjectHandler<T> handler, OperationResult result) throws SchemaException {
if (repositoryService.isNative()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

AFAIK this is always true for midpoint 4.11 and 4.10 (generic, non-native repository module was removed in 4.10 - repo-sql-impl).

return cases;
}

/**
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

10k limit in javadoc not correct, native repo supports iterative search, generic repo removed in >=4.10

@kay1313
Copy link
Copy Markdown
Contributor Author

kay1313 commented Apr 30, 2026

Removed the obsolete non-native repository fallback and the outdated Javadoc note about the 10k limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants