Refactor push rules v2
What does this MR do?
As we want to introduce group push rules and not introduce any technical debt and duplication, according to discussion here: !26990 (comment 309629687) here I did following changes:
- added
push_rule_id
to project_settings - added
push_rule_id
to application_settings - added saving proper attributes when push rule is created.
Screenshots
current SQL query in background migration:
UPDATE project_settings ps1
SET push_rule_id = pr.id
FROM project_settings ps2
INNER JOIN push_rules pr
ON ps2.project_id = pr.project_id
WHERE pr.is_sample = false
AND pr.id BETWEEN 0 AND 1000
AND ps1.project_id = ps2.project_id
Current plan:
Buffers: shared hit=9404 read=320 dirtied=290
I/O Timings: read=239.823
-> Nested Loop (cost=1.30..3295.18 rows=624 width=42) (actual time=1.943..235.098 rows=642 loops=1)
Buffers: shared hit=4880 read=294 dirtied=6
I/O Timings: read=222.743
-> Nested Loop (cost=0.87..2992.13 rows=624 width=24) (actual time=1.935..231.932 rows=642 loops=1)
Buffers: shared hit=2306 read=294 dirtied=6
I/O Timings: read=222.743
-> Index Scan using push_rules_pkey on public.push_rules pr (cost=0.43..215.53 rows=624 width=14) (actual time=0.022..16.934 rows=642 loops=1)
Index Cond: ((pr.id >= 0) AND (pr.id <= 1000))
Filter: (NOT pr.is_sample)
Rows Removed by Filter: 0
Buffers: shared hit=9 read=17
I/O Timings: read=16.233
-> Index Scan using project_settings_pkey on public.project_settings ps2 (cost=0.43..4.44 rows=1 width=10) (actual time=0.334..0.334 rows=1 loops=642)
Index Cond: (ps2.project_id = pr.project_id)
Buffers: shared hit=2297 read=277 dirtied=6
I/O Timings: read=206.510
-> Index Scan using project_settings_pkey on public.project_settings ps1 (cost=0.43..0.48 rows=1 width=26) (actual time=0.004..0.004 rows=1 loops=642)
Index Cond: (ps1.project_id = ps2.project_id)
Buffers: shared hit=2574
Current time for one batch:
Time: 261.521 ms
- planning: 0.766 ms
- execution: 260.755 ms
- I/O read: 239.823 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 9404 (~73.50 MiB) from the buffer pool
- reads: 320 (~2.50 MiB) from the OS file cache, including disk I/O
- dirtied: 290 (~2.30 MiB)
- writes: 0
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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 Gosia Ksionek