Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
/ NuGet.Jobs Public archive

[Revalidation] Skip packages with many versions #610

Merged
merged 3 commits into from
Nov 2, 2018

Conversation

loic-sharma
Copy link
Contributor

@loic-sharma loic-sharma commented Nov 1, 2018

This change allows the revalidation job to skip packages with many versions. This generates the following query:

SELECT TOP (1) [t0].[Key], [t0].[PackageId], [t0].[PackageNormalizedVersion], [t0].[Enqueued], [t0].[ValidationTrackingId], [t0].[Completed], [t0].[RowVersion]
FROM [PackageRevalidations] AS [t0]
WHERE (NOT ([t0].[Completed] = 1)) AND ([t0].[Enqueued] IS NULL) AND (NOT (EXISTS(
    SELECT NULL AS [EMPTY]
    FROM (
        SELECT COUNT(*) AS [value], [t1].[PackageId]
        FROM [PackageRevalidations] AS [t1]
        GROUP BY [t1].[PackageId]
        ) AS [t2]
    WHERE ([t2].[PackageId] = [t0].[PackageId]) AND ([t2].[value] > @p0)
    )))
ORDER BY [t0].[Key]

!_validationContext.PackageRevalidations.GroupBy(r2 => r2.PackageId)
.Where(g => g.Count() > _config.MaximumPackageVersions)
.Any(g => g.Key == r.PackageId));
}
Copy link
Contributor Author

@loic-sharma loic-sharma Nov 2, 2018

Choose a reason for hiding this comment

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

This query builds a list of packages that have too many versions, and filters out PackageRevalidations that are on that list.

An alternative query would be: find all packages with less versions than MaximumPackageVersions, and use that to find the next revalidation. Such a query is much more expensive as the list of packages with less versions than MaximumPackageVersions is huge.

@loic-sharma loic-sharma merged commit d0e0f42 into dev Nov 2, 2018
@loic-sharma loic-sharma deleted the loshar-skip-baddies branch November 2, 2018 19:41
joelverhagen pushed a commit that referenced this pull request Oct 26, 2020
This change allows the revalidation job to skip packages with many versions.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants