Skip to content

Add merge_trains_enabled column to project_ci_cd_settings

What does this MR do?

Adds back a merge_trains_enabled column so that "Pipelines for merged results" and "Merge Train" can be enabled separately.

Related: #244831 (closed)

Database Output

Total number of rows to updated 3106(batch size 156) based on:


explain select \* from project\_ci\_cd\_settings where merge\_pipelines\_enabled = true;

Seq Scan on public.project\_ci\_cd\_settings (cost=0.00..515363.49 rows=3106 width=15) (actual time=114.246..4361.749 rows=2430 loops=1)

Query Perf

Migration query perf from database-lab

Add column:


exec ALTER TABLE "project\_ci\_cd\_settings" ADD "merge\_trains\_enabled" boolean DEFAULT FALSE

Session: joe-bu8r2eg350j13v0694sg

The query has been executed. Duration: 27.000 ms (edited) 

explain SELECT COUNT(*) AS count FROM "project_ci_cd_settings" WHERE "project_ci_cd_settings"."merge_pipelines_enabled" = TRUE;
 Aggregate  (cost=515371.26..515371.27 rows=1 width=8) (actual time=9418.322..9418.325 rows=1 loops=1)

   Buffers: shared read=90019 dirtied=6985 written=6888

   I/O Timings: read=4250.375 write=492.321

   ->  Seq Scan on public.project_ci_cd_settings  (cost=0.00..515363.49 rows=3106 width=0) (actual time=155.991..9415.676 rows=2433 loops=1)

         Filter: project_ci_cd_settings.merge_pipelines_enabled

         Rows Removed by Filter: 15817352

         Buffers: shared read=90019 dirtied=6985 written=6888

         I/O Timings: read=4250.375
    Time: 9.418 s
      - planning: 0.082 ms
      - execution: 9.418 s
        - I/O read: 4.250 s
        - I/O write: 492.321 ms

    Shared buffers:
      - hits: 0 from the buffer pool
      - reads: 90019 (~703.30 MiB) from the OS file cache, including disk I/O
      - dirtied: 6985 (~54.60 MiB)
      - writes: 6888 (~53.80 MiB)

Select and update 1 row (3106 will be updated):

explain SELECT "project_ci_cd_settings"."id" FROM "project_ci_cd_settings" WHERE "project_ci_cd_settings"."merge_pipelines_enabled" = TRUE ORDER BY "project_ci_cd_settings"."id" ASC LIMIT 1
Limit  (cost=0.43..142.70 rows=1 width=4) (actual time=36.847..36.849 rows=1 loops=1)
   Buffers: shared hit=3 read=42
   I/O Timings: read=35.751
   ->  Index Scan using project_ci_cd_settings_pkey on public.project_ci_cd_settings  (cost=0.43..441865.60 rows=3106 width=4) (actual time=36.845..36.846 rows=1 loops=1)
         Filter: project_ci_cd_settings.merge_pipelines_enabled
         Rows Removed by Filter: 4134
         Buffers: shared hit=3 read=42
         I/O Timings: read=35.751
Time: 36.996 ms
  - planning: 0.115 ms
  - execution: 36.881 ms
    - I/O read: 35.751 ms
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 3 (~24.00 KiB) from the buffer pool
  - reads: 42 (~336.00 KiB) from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0
explain UPDATE “project_ci_cd_settings” SET “merge_trains_enabled” = TRUE WHERE “project_ci_cd_settings”.“id” >= 4 AND “project_ci_cd_settings”.“id” < 6 AND “project_ci_cd_settings”.“merge_pipelines_enabled” = TRUE
Time: 0.219 ms
  - planning: 0.169 ms
  - execution: 0.050 ms
    - I/O read: 0.000 ms
    - I/O write: 0.000 ms

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
 ModifyTable on public.project_ci_cd_settings  (cost=0.43..4.96 rows=1 width=26) (actual time=0.015..0.016 rows=0 loops=1)
   Buffers: shared hit=4
   ->  Index Scan using project_ci_cd_settings_pkey on public.project_ci_cd_settings  (cost=0.43..4.96 rows=1 width=26) (actual time=0.014..0.014 rows=0 loops=1)
         Index Cond: ((project_ci_cd_settings.id >= 4) AND (project_ci_cd_settings.id < 6))
         Filter: project_ci_cd_settings.merge_pipelines_enabled
         Rows Removed by Filter: 1

Screenshots (strongly suggested)

Screen_Shot_2020-10-23_at_1.22.15_PM

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

Related to #244831 (closed)

Edited by Allison Browne

Merge request reports