Resolve GraphQL type mismatch in Cleanup policy type
What does this MR do and why?
Update GraphQL int type for last_run_deleted_size. The last_run_deleted_size is the cache size in bytes that has been deleted.
The type in the db is bigint, which allows for the below values
Range: -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
The GraphQL int type allows for:
Range: -2,147,483,648 to +2,147,483,647
This MR updates the types to a bigint.
Once this is merged, a backport for 18.7 will be created.
References
Screenshots or screen recordings
See validation steps
How to set up and validate locally
- On master branch.
- In the rails console, enable these feature flags
Feature.enable(:virtual_registry_cleanup_policies)
Feature.enable(:ui_for_virtual_registry_cleanup_policy)
Feature.enable(:maven_virtual_registry)
- Get a top level group, create a cleanup policy, We will add the max value for a bigint
group = Group.find_by(path: 'twitter')
VirtualRegistries::Cleanup::Policy.create!(
group: group,
keep_n_days_after_download: 30,
cadence: 7,
enabled: true,
notify_on_success: true,
notify_on_failure: true,
status: :scheduled,
last_run_deleted_entries_count: 250,
last_run_deleted_size: 9223372036854775807,
last_run_detailed_metrics: {
'maven' => {
'deleted_entries_count' => 150,
'deleted_size' => 9223372036854775807
},
'container' => {
'deleted_entries_count' => 100,
'deleted_size' => 9223372036854775807
}
}
)
- In GraphQL explorer, run this query.
query {
group(fullPath: "twitter") {
virtualRegistriesCleanupPolicy {
lastRunAt
lastRunDeletedSize
lastRunDetailedMetrics {
maven {
deletedSize
deletedEntriesCount
}
container {
deletedSize
deletedEntriesCount
}
}
lastRunDeletedEntriesCount
}
}
}
This will return an error:
"Internal server error: Integer out of bounds: 9223372036854775807 @ group.virtualRegistriesCleanupPolicy.lastRunDeletedSize (VirtualRegistryCleanupPolicy.lastRunDeletedSize). Consider using ID or GraphQL::Types::BigInt instead."
- Switch to this branch, and run the query again. And it should return success with the value.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #584220 (closed)
Edited by Fiona McCawley

