Add default value to workspace.desired_config_generator_version
Issue: Drop the desired_config_generator_version colum... (#538166 - closed)
What does this MR do and why?
Add default value to workspace.desired_config_generator_version
This change is required because workspace.desired_config_generator_version does not have any default value on database level. This made Mark desired_config_generator_version ignore fo... (!205613 - merged) backwards incompatible.
Read the incident report for more details— gitlab-com/gl-infra/production#20594 (comment 2770476832)
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
For DB reviewers
Query
UPDATE "workspaces" SET "desired_config_generator_version" = 3 WHERE "workspaces"."desired_config_generator_version" IS NULL AND "workspaces"."id" >= 1 AND "workspaces"."id" < 50
Explain output
ModifyTable on public.workspaces (cost=0.29..3.30 rows=0 width=0) (actual time=0.022..0.023 rows=0 loops=1)
Buffers: shared hit=5
I/O Timings: read=0.000 write=0.000
-> Index Scan using workspaces_pkey on public.workspaces (cost=0.29..3.30 rows=1 width=10) (actual time=0.021..0.021 rows=0 loops=1)
Index Cond: ((workspaces.id >= 1) AND (workspaces.id < 50))
Filter: (workspaces.desired_config_generator_version IS NULL)
Rows Removed by Filter: 0
Buffers: shared hit=5
I/O Timings: read=0.000 write=0.000
Settings: jit = 'off', random_page_cost = '1.5', seq_page_cost = '4', work_mem = '100MB', effective_cache_size = '472585MB'
Statistics:
Time: 1.020 ms
- planning: 0.915 ms
- execution: 0.105 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 5 (~40.00 KiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
Query locks:
# | RELKIND | RELNAMESPACE | RELNAME | BELONGS TO RELATION | LOCKTYPE | MODE | GRANTED | FASTPATH
----+---------+--------------+----------------------------------------------+---------------------+----------+------------------+---------+-----------
7 | r | public | workspaces | workspaces | relation | RowExclusiveLock | true | true
2 | i | public | index_workspaces_on_project_id | workspaces | relation | RowExclusiveLock | true | true
3 | i | public | index_workspaces_on_cluster_agent_id | workspaces | relation | RowExclusiveLock | true | true
1 | i | public | index_workspaces_on_user_id | workspaces | relation | RowExclusiveLock | true | true
5 | i | public | index_workspaces_on_personal_access_token_id | workspaces | relation | RowExclusiveLock | true | true
6 | i | public | workspaces_pkey | workspaces | relation | RowExclusiveLock | true | true
4 | i | public | index_workspaces_on_name | workspaces | relation | RowExclusiveLock | true | true
Edited by Ashvin Sharma