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

Update VPP and software install status summaries and filters for unified queue #25569

Merged

Conversation

gillespi314
Copy link
Contributor

For #23921

@gillespi314 gillespi314 marked this pull request as ready for review January 20, 2025 17:06
@gillespi314 gillespi314 requested a review from a team as a code owner January 20, 2025 17:06
Copy link
Member

@mna mna left a comment

Choose a reason for hiding this comment

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

Some build issues in the test, but otherwise LGTM.

server/datastore/mysql/software_installers_test.go Outdated Show resolved Hide resolved
server/datastore/mysql/software_installers.go Outdated Show resolved Hide resolved
case fleet.SoftwareInstallPending:
filter += " AND ua.activity_type = 'vpp_app_install'"
case fleet.SoftwareUninstallPending:
// VPP does not have uninstaller yet so to preserve existing behavior of VPP filters we map uninstall to install
Copy link
Member

Choose a reason for hiding this comment

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

It seems the old behaviour had SoftwarePending mapped to SoftwareInstallPending, doesn't look like it supported uninstall?

@@ -1212,7 +1285,8 @@ WHERE
max(id) -- ensure we use only the most recent install attempt for each host
FROM host_software_installs
WHERE
software_title_id = :title_id
host_id = hsi.host_id
Copy link
Member

Choose a reason for hiding this comment

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

That was missing, was that a bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it may have been just potential inefficiency in the prior subquery rather than a bug since the subquery is still grouping by hsi.host_id and being then joined on hosts.id. This change seemed to improve the EXPLAIN when I was testing locally.

@@ -67,35 +67,85 @@ func (ds *Datastore) GetSummaryHostVPPAppInstalls(ctx context.Context, teamID *u
) {
var dest fleet.VPPAppStatusSummary

// TODO(mna): must consider upcoming queue for pending
stmt := fmt.Sprintf(`
// TODO(uniq): do we need to handle host_deleted_at and removed similar to GetSummaryHostSoftwareInstalls?
Copy link
Member

Choose a reason for hiding this comment

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

I don't think so, see other comment above.

AND host_id NOT IN(SELECT host_id FROM upcoming) -- antijoin to exclude hosts with upcoming activities
GROUP BY
host_id
)
Copy link
Member

Choose a reason for hiding this comment

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

Really like those CTE approaches, makes it readable/maintainable.

@gillespi314 gillespi314 merged commit 029841c into feat-upcoming-activites-queue Jan 22, 2025
9 of 23 checks passed
@gillespi314 gillespi314 deleted the sg-sw-vpp-filters-and-summaries branch January 22, 2025 16:18
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