Skip to content

Add Packages::Debian::DistributionFinder

What does this MR do?

Add Packages::Debian::DistributionFinder

This is item 2.5.4 of #5835 (comment 414103286).

Database

SQL Queries

The only new scope added for this Finder is .with_codename_or_suite:

https://postgres.ai/console/shared/07c42b92-df80-4a1b-9c9c-71a9703b9914

SELECT "packages_debian_project_distributions".* 
FROM "packages_debian_project_distributions" 
WHERE "packages_debian_project_distributions"."project_id" = 1
AND(
  "packages_debian_project_distributions"."codename" = 'foo' 
  OR 
  "packages_debian_project_distributions"."suite" = 'foo'
);

 Index Scan using uniq_pkgs_debian_project_distributions_project_id_and_suite on public.packages_debian_project_distributions  (cost=0.14..3.17 rows=1 width=368) (actual time=0.035..0.036 rows=0 loops=1)
   Index Cond: (packages_debian_project_distributions.project_id = 1)
   Filter: ((packages_debian_project_distributions.codename = 'foo'::text) OR (packages_debian_project_distributions.suite = 'foo'::text))
   Rows Removed by Filter: 0
   Buffers: shared hit=4

Time: 0.268 ms
  - planning: 0.204 ms
  - execution: 0.064 ms
    - I/O read: N/A
    - I/O write: N/A

Shared buffers:
  - hits: 4 (~32.00 KiB) from the buffer pool
  - reads: 0 from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

The other scopes used by the finder were added in !49405 (merged), the explain plans do not change so these are copied from that MR:

EXPLAIN ANALYZE SELECT "packages_debian_group_distributions".* 
FROM "packages_debian_group_distributions" 
WHERE "packages_debian_group_distributions"."group_id" = 1 
AND "packages_debian_group_distributions"."suite" = 'my-suite';

                                                                                          QUERY PLAN
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
 Index Scan using uniq_pkgs_debian_group_distributions_group_id_and_suite on packages_debian_group_distributions  (cost=0.14..2.16 rows=1 width=368) (actual time=0.039..0.039 rows=0 loops=1)
   Index Cond: ((group_id = 1) AND (suite = 'my-suite'::text))
 Planning Time: 0.106 ms
 Execution Time: 0.062 ms
(4 rows)
EXPLAIN ANALYZE SELECT "packages_debian_group_distributions".* 
FROM "packages_debian_group_distributions" 
WHERE "packages_debian_group_distributions"."group_id" = 1 
AND "packages_debian_group_distributions"."codename" = 'my-codename';

                                                                                          QUERY PLAN
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
 Index Scan using uniq_pkgs_debian_group_distributions_group_id_and_suite on packages_debian_group_distributions  (cost=0.14..2.17 rows=1 width=368) (actual time=0.005..0.005 rows=0 loops=1)
   Index Cond: (group_id = 1)
   Filter: (codename = 'my-codename'::text)
 Planning Time: 0.114 ms
 Execution Time: 0.027 ms
(5 rows)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Mayra Cabrera

Merge request reports