Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DGS-11414: add pagination for get all subjects #3455

Open
wants to merge 3 commits into
base: 7.7.x
Choose a base branch
from

Conversation

djibodu
Copy link
Contributor

@djibodu djibodu commented Dec 6, 2024

What

Adding pagination for getAllSubjects. Default and max limit both set to 20,000

Checklist

  • Contains customer facing changes? Including API/behavior changes
  • Is this change gated behind feature flag(s)?
    • List the LD flags needed to be set to enable this change
  • Did you add sufficient unit test and/or integration test coverage for this PR?
    • If not, please explain why it is not required
  • Does this change require modifying existing system tests or adding new system tests?
    • If so, include tracking information for the system test changes

References

JIRA:

Test & Review

Open questions / Follow-ups

@djibodu djibodu marked this pull request as ready for review December 6, 2024 18:50
@djibodu djibodu requested a review from a team as a code owner December 6, 2024 18:50
@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

1 similar comment
@sonarqube-confluent
Copy link

Failed

  • 0.00% Coverage on New Code (is less than 80.00%)

Analysis Details

0 Issues

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 0 Code Smells

Coverage and Duplications

  • Coverage 0.00% Coverage (0.00% Estimated after merge)
  • Duplications No duplication information (6.70% Estimated after merge)

Project ID: schema-registry

View in SonarQube

@djibodu djibodu changed the title add pagination for get all subjects DGS-11414: add pagination for get all subjects Dec 10, 2024
Copy link
Member

@rayokota rayokota left a comment

Choose a reason for hiding this comment

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

Thanks @djibodu , left some comments

Comment on lines 608 to 618
public int normalizeSchemaLimit(int suppliedLimit) {
int limit = schemaSearchDefaultLimit;
if (suppliedLimit > 0 && suppliedLimit <= schemaSearchMaxLimit) {
limit = suppliedLimit;
}
return limit;
}

public int normalizeSubjectLimit(int suppliedLimit) {
int limit = subjectSearchDefaultLimit;
if (suppliedLimit > 0 && suppliedLimit <= subjectSearchMaxLimit) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's combine these into one method that takes a default

public int normalizeLimit(int suppliedLimit, int defaultLimit)

limit = schemaRegistry.normalizeSubjectLimit(limit);

stream = stream.skip(offset).limit(limit);
return stream.collect(Collectors.toCollection(LinkedHashSet::new)); // preserve order
Copy link
Member

Choose a reason for hiding this comment

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

nit: can be

return subjects.stream() // add newline
    .skip(offset)
    .limit(offset)
    .collect(...);

Copy link
Member

Choose a reason for hiding this comment

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

Also, let's change the schemas pagination to use the same logic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants