Maven virtual registry: adjust cached response queries and scopes
🔥 Problem
In Maven Virtual Registry: Cleanup background job ... (#479957 - closed), we introduced different statuses for cached responses: default
, processing
and error
.
Thus, the definition of available cache response needs to be updated: cache response in the default
status.
Moreover, we have a unique index on [upstream_id
, relative_path
]. This needs to be updated to take the status
into account.
Pulling from virtual registries can be a highly concurrent situations: several processes pulling the same file while some cleanup is going on. Thus, there are good chances that we have a file in the processing
state (being destroyed) and a different process that will not see the file (because it's using the default
status) will try to create a new record. The upstream_id
and relative_path
will be the same = the unique index will
🚒 Solution
- Update all read queries to use the
default
scope. - Update the indexes to take the status into account.
This will implement the preliminary work for Maven virtual registry: use LFK update_column_to (#486492 - closed).