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

Fix search by tag count queries for commands, clusters and applications #1162

Merged
merged 1 commit into from
Mar 25, 2022

Conversation

tgianos
Copy link
Contributor

@tgianos tgianos commented Mar 25, 2022

Searching by tags for these entites results in a query using group by and having. This was working fine for the actual
content queries but the count queries were getting messed up because it couldn't count the result properly as it was just
and array of 1's being return (counting the group size and all were one). It was actually the length of the result set we'd
have wanted for the total count. This wouldn't work though for the ones were tags weren't involved because that query doesn't
have a group by and a having.

This change modifies the count queries to instead of trying to count directly with the same where predicate it actually
counts the results of the real query as a subquery (all on database side so it doesn't return all the data). This way it
doesn't matter if there's a group by or not. Now the total results returned via the API in the Page object are correct and
pagination can continue properly.

Searching by tags for these entites results in a query using `group by` and `having`. This was working fine for the actual
content queries but the count queries were getting messed up because it couldn't count the result properly as it was just
and array of 1's being return (counting the group size and all were one). It was actually the length of the result set we'd
have wanted for the total count. This wouldn't work though for the ones were tags weren't involved because that query doesn't
have a group by and a having.

This change modifies the count queries to instead of trying to count directly with the same where predicate it actually
counts the results of the real query as a subquery (all on database side so it doesn't return all the data). This way it
doesn't matter if there's a `group by` or not. Now the total results returned via the API in the `Page` object are correct and
pagination can continue properly.
@tgianos tgianos added the bug label Mar 25, 2022
@tgianos tgianos added this to the 4.3.0 milestone Mar 25, 2022
@tgianos tgianos requested a review from nvhoang March 25, 2022 21:04
@tgianos tgianos self-assigned this Mar 25, 2022
@tgianos tgianos merged commit 807686c into Netflix:master Mar 25, 2022
@tgianos tgianos deleted the entitySearchByTags branch March 25, 2022 21:45
@coveralls
Copy link

Coverage Status

Coverage increased (+0.07%) to 93.876% when pulling bdb6a3a on tgianos:entitySearchByTags into 51b81ed on Netflix:master.

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

Successfully merging this pull request may close these issues.

None yet

3 participants