Skip to content

GraphQL: Use existing RunnerJobsFinder in RunnerJobsResolver

What does this MR do and why?

This MR removes support for the :runner argument in Ci::JobsFinder, and instead leverages the existing Ci::RunnerJobsFinder. The logic shouldn't change.

Part of #438005

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

n/a

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Database query plans

Before

https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/25170/commands/79941

SELECT "p_ci_builds"."status", "p_ci_builds"."finished_at", "p_ci_builds"."created_at", "p_ci_builds"."updated_at",
  "p_ci_builds"."started_at", "p_ci_builds"."runner_id", "p_ci_builds"."coverage", "p_ci_builds"."commit_id",
  "p_ci_builds"."name", "p_ci_builds"."options", "p_ci_builds"."allow_failure", "p_ci_builds"."stage",
  "p_ci_builds"."trigger_request_id", "p_ci_builds"."stage_idx", "p_ci_builds"."tag", "p_ci_builds"."ref",
  "p_ci_builds"."user_id", "p_ci_builds"."type", "p_ci_builds"."target_url", "p_ci_builds"."description",
  "p_ci_builds"."project_id", "p_ci_builds"."erased_by_id", "p_ci_builds"."erased_at", "p_ci_builds"."artifacts_expire_at",
  "p_ci_builds"."environment", "p_ci_builds"."when", "p_ci_builds"."yaml_variables", "p_ci_builds"."queued_at",
  "p_ci_builds"."lock_version", "p_ci_builds"."coverage_regex", "p_ci_builds"."auto_canceled_by_id", "p_ci_builds"."retried",
  "p_ci_builds"."protected", "p_ci_builds"."failure_reason", "p_ci_builds"."scheduled_at", "p_ci_builds"."token_encrypted",
  "p_ci_builds"."upstream_pipeline_id", "p_ci_builds"."resource_group_id", "p_ci_builds"."waiting_for_resource_at",
    "p_ci_builds"."processed",
  "p_ci_builds"."scheduling_type", "p_ci_builds"."id", "p_ci_builds"."stage_id", "p_ci_builds"."partition_id",
  "p_ci_builds"."auto_canceled_by_partition_id"
FROM "p_ci_builds"
WHERE "p_ci_builds"."type" = 'Ci::Build'
  AND "p_ci_builds"."runner_id" = 11574096
  AND ("p_ci_builds"."status" NOT IN ('created'))
  AND ("p_ci_builds"."status" IN ('success'))
ORDER BY "p_ci_builds"."id" DESC
LIMIT 101
 Limit  (cost=1.29..256.55 rows=101 width=1210) (actual time=0.102..594.066 rows=101 loops=1)
   Buffers: shared hit=215 read=416 dirtied=268
   I/O Timings: read=584.755 write=0.000
   ->  Merge Append  (cost=1.29..14050936.86 rows=5559497 width=1210) (actual time=0.100..593.983 rows=101 loops=1)
         Sort Key: p_ci_builds.id DESC
         Buffers: shared hit=215 read=416 dirtied=268
         I/O Timings: read=584.755 write=0.000
         ->  Index Scan using index_ci_builds_on_runner_id_and_id_desc on public.ci_builds p_ci_builds_1  (cost=0.71..13231093.72 rows=5259045 width=1250) (actual time=0.052..0.052 rows=1 loops=1)
               Index Cond: (p_ci_builds_1.runner_id = 11574096)
               Filter: (((p_ci_builds_1.status)::text <> 'created'::text) AND ((p_ci_builds_1.type)::text = 'Ci::Build'::text) AND ((p_ci_builds_1.status)::text = 'success'::text))
               Rows Removed by Filter: 0
               Buffers: shared hit=6
               I/O Timings: read=0.000 write=0.000
         ->  Index Scan using ci_builds_101_runner_id_id_convert_to_bigint_idx on gitlab_partitions_dynamic.ci_builds_101 p_ci_builds_2  (cost=0.57..764248.16 rows=300452 width=540) (actual time=0.046..593.792 rows=101 loops=1)
               Index Cond: (p_ci_builds_2.runner_id = 11574096)
               Filter: (((p_ci_builds_2.status)::text <> 'created'::text) AND ((p_ci_builds_2.type)::text = 'Ci::Build'::text) AND ((p_ci_builds_2.status)::text = 'success'::text))
               Rows Removed by Filter: 290
               Buffers: shared hit=209 read=416 dirtied=268
               I/O Timings: read=584.755 write=0.000
After

https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/25184/commands/80011

SELECT "p_ci_builds"."status", "p_ci_builds"."finished_at", "p_ci_builds"."created_at", "p_ci_builds"."updated_at",
  "p_ci_builds"."started_at", "p_ci_builds"."runner_id", "p_ci_builds"."coverage", "p_ci_builds"."commit_id",
  "p_ci_builds"."name", "p_ci_builds"."options", "p_ci_builds"."allow_failure", "p_ci_builds"."stage",
  "p_ci_builds"."trigger_request_id", "p_ci_builds"."stage_idx", "p_ci_builds"."tag", "p_ci_builds"."ref",
  "p_ci_builds"."user_id", "p_ci_builds"."type", "p_ci_builds"."target_url", "p_ci_builds"."description",
  "p_ci_builds"."project_id", "p_ci_builds"."erased_by_id", "p_ci_builds"."erased_at", "p_ci_builds"."artifacts_expire_at",
  "p_ci_builds"."environment", "p_ci_builds"."when", "p_ci_builds"."yaml_variables", "p_ci_builds"."queued_at",
  "p_ci_builds"."lock_version", "p_ci_builds"."coverage_regex", "p_ci_builds"."auto_canceled_by_id", "p_ci_builds"."retried",
  "p_ci_builds"."protected", "p_ci_builds"."failure_reason", "p_ci_builds"."scheduled_at", "p_ci_builds"."token_encrypted",
  "p_ci_builds"."upstream_pipeline_id", "p_ci_builds"."resource_group_id", "p_ci_builds"."waiting_for_resource_at",
    "p_ci_builds"."processed",
  "p_ci_builds"."scheduling_type", "p_ci_builds"."id", "p_ci_builds"."stage_id", "p_ci_builds"."partition_id",
  "p_ci_builds"."auto_canceled_by_partition_id"
FROM "p_ci_builds"
WHERE "p_ci_builds"."type" = 'Ci::Build'
  AND "p_ci_builds"."runner_id" = 11574096
ORDER BY "p_ci_builds"."id" DESC
LIMIT 101
 Limit  (cost=1.29..157.76 rows=101 width=1209) (actual time=126.647..1268.870 rows=101 loops=1)
   Buffers: shared hit=7 read=286 dirtied=217
   I/O Timings: read=1228.366 write=0.000
   ->  Merge Append  (cost=1.29..12734872.39 rows=8220201 width=1209) (actual time=126.644..1268.706 rows=101 loops=1)
         Sort Key: p_ci_builds.id DESC
         Buffers: shared hit=7 read=286 dirtied=217
         I/O Timings: read=1228.366 write=0.000
         ->  Index Scan using index_ci_builds_on_runner_id_and_id_desc on public.ci_builds p_ci_builds_1  (cost=0.71..11891615.18 rows=7744166 width=1250) (actual time=43.406..43.407 rows=1 loops=1)
               Index Cond: (p_ci_builds_1.runner_id = 11574096)
               Filter: ((p_ci_builds_1.type)::text = 'Ci::Build'::text)
               Rows Removed by Filter: 0
               Buffers: shared hit=2 read=4
               I/O Timings: read=43.283 write=0.000
         ->  Index Scan using ci_builds_101_runner_id_id_convert_to_bigint_idx on gitlab_partitions_dynamic.ci_builds_101 p_ci_builds_2  (cost=0.57..761055.19 rows=476035 width=540) (actual time=83.232..1225.073 rows=101 loops=1)
               Index Cond: (p_ci_builds_2.runner_id = 11574096)
               Filter: ((p_ci_builds_2.type)::text = 'Ci::Build'::text)
               Rows Removed by Filter: 0
               Buffers: shared hit=5 read=282 dirtied=217
               I/O Timings: read=1185.083 write=0.000
Edited by Pedro Pombeiro

Merge request reports

Loading