Skip to content

Update config_version & force_full_reconciliation for stale workspaces

Vishal Tak requested to merge vtak/workspace_version_migration into master

What does this MR do and why?

Issue: Rails: Migrate workspaces with config_version=2... (#434494 - closed)

  • Workspace config_version 3 migration
  • We expect zero migration on gitlab.com and a handful for self-managed.

Migration output

$ bin/rails db:migrate:up:main VERSION=20240104085448  RAILS_ENV=development
main: == [advisory_lock_connection] object_id: 183380, pg_backend_pid: 24766
main: == 20240104085448 QueueUpdateWorkspacesConfigVersion3: migrating ==============
main: == 20240104085448 QueueUpdateWorkspacesConfigVersion3: migrated (0.0669s) =====

main: == [advisory_lock_connection] object_id: 183380, pg_backend_pid: 24766
$ bin/rails db:migrate:down:main VERSION=20240104085448  RAILS_ENV=development
main: == [advisory_lock_connection] object_id: 182480, pg_backend_pid: 27656
main: == 20240104085448 QueueUpdateWorkspacesConfigVersion3: reverting ==============
main: == 20240104085448 QueueUpdateWorkspacesConfigVersion3: reverted (0.0285s) =====

main: == [advisory_lock_connection] object_id: 182480, pg_backend_pid: 27656

Query plans

The update query for the full data on gitlabdotcom. We expect no data to process.

explain UPDATE "workspaces" SET "config_version" = 3, "force_include_all_resources" = true WHERE "workspaces"."id" BETWEEN 1 AND 240 AND "workspaces"."config_version" = 2 AND "workspaces"."actual_state" != 'Terminating' AND "workspaces"."id" >= 2

Query plan: https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/25068/commands/79607

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.

How to set up and validate locally

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

  1. Running the specs would give an idea how workspace rows are migrated.
Edited by Vishal Tak

Merge request reports