2022-09-19: Failing migrations on gstg
Incident Roles
The DRI for this incident is the incident issue assignee, see roles and responsibilities.
Roles when the incident was declared:
- Incident Manager (IMOC): @samdbeckham,
@mksionek (Shadow)
- Engineer on-call (EOC): @ahmadsherif
Current Status
More information will be added as we investigate the issue. For customers believed to be affected by this incident, please subscribe to this issue or monitor our status page for further updates.
Summary for CMOC notice / Exec summary:
- Customer Impact: None
- Service Impact: ServiceDeploy-Node
- Impact Duration: 2022-09-19 11:15 UTC - 2022-09-19 19:18 UTC - (483min)
- Root cause: gitlab-org/gitlab!91074 (merged)
Timeline
Recent Events (available internally only):
- Deployments
- Feature Flag Changes
- Infrastructure Configurations
- GCP Events (e.g. host failure)
- Gitlab.com Latest Updates
All times UTC.
2022-09-19
-
11:15
- Problem started https://ops.gitlab.net/gitlab-com/gl-infra/deployer/-/jobs/8030173 -
11:59
- @mbursi declares incident in Slack. -
12:01
- @mbursi asks for help in #database slack channel -
12:02
- @ahegyi joins the bridge call -
13:10
- @ahegyi finds a possible solution and waits for plan team review - MR -
13:35
- @acroitor joins the bridge call -
13:36
- @cmaxim joins the bridge call -
13:46
- the fix is approved by @acroitor and waiting for approval from a Database maintainer. -
14:10
- @alexives joins the call -
14:21
- a solution is agreed on with the approval of Database -
15:48
- gitlab-org/gitlab!98337 (merged) is merged -
15:49
- An auto-deploy package starts to build https://ops.gitlab.net/gitlab-org/release/tools/-/pipelines/1427396 -
17:16
- gstg-cny deployment starts https://ops.gitlab.net/gitlab-com/gl-infra/deployer/-/pipelines/1427530 -
18:49
- gstg-cny deployment finishes -
18:50
- gprd-cny deployment starts https://ops.gitlab.net/gitlab-com/gl-infra/deployer/-/pipelines/1427671 -
19:58
- Deployment to gprd-cny finished.
Create related issues
Use the following links to create related issues to this incident if additional work needs to be completed after it is resolved:
Takeaways
- ...
Corrective Actions
When we rename columns, we create a new column and duplicate all the indexes defined for the old column. Unfortunately, there is a special index definition (with SQL expressions as columns) within the iterations_cadences
table which is not parseable by Rails and the migration fails here: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/database/migration_helpers.rb#L1012
The index definition (notice the columns
part):
pp ActiveRecord::Base.connection.indexes("iterations_cadences")
[#<ActiveRecord::ConnectionAdapters::IndexDefinition:0x00007fb2e03c95e8
@columns=
"automatic, duration_in_weeks, date((COALESCE(last_run_date, '1970-01-01'::date) + ((duration_in_weeks)::double precision * 'P7D'::interval)))",
@comment=nil,
@lengths={},
@name="cadence_create_iterations_automation",
@opclasses={},
@orders={},
@table="iterations_cadences",
@type=nil,
@unique=false,
@using=:btree,
@where="(duration_in_weeks IS NOT NULL)">,
]
Fix
Option 1:
Only copy indexes which have their column list successfully parsed (add type check).
Option 2:
If the columns
variable is a String
, try to parse out the columns and decide if the column is part of the index definition
Why we didn't catch it?
Assumption: locally, we didn't run the migrations and post-migrations separately. According to the timestamps, on the local dev environment, the index is removed first after the rename_column_concurrently
method is called.
Order on local dev environment:
db/post_migrate/20220913082728_drop_index_cadence_create_iterations_automation.rb
db/migrate/20220913082930_rename_iterations_cadences_last_run_date_to_next_run_date.rb
Order on staging:
db/migrate/20220913082930_rename_iterations_cadences_last_run_date_to_next_run_date.rb
- Deploy new version of the app.
db/post_migrate/20220913082728_drop_index_cadence_create_iterations_automation.rb
Note: In some cases we need to redact information from public view. We only do this in a limited number of documented cases. This might include the summary, timeline or any other bits of information, laid out in out handbook page. Any of this confidential data will be in a linked issue, only visible internally. By default, all information we can share, will be public, in accordance to our transparency value.
Click to expand or collapse the Incident Review section.
Incident Review
- Ensure that the exec summary is completed at the top of the incident issue, the timeline is updated and relevant graphs are included in the summary
- If there are any corrective action items mentioned in the notes on the incident, ensure they are listed in the "Corrective Action" section
- Fill out relevant sections below or link to the meeting review notes that cover these topics
Customer Impact
-
Who was impacted by this incident? (i.e. external customers, internal customers)
- ...
-
What was the customer experience during the incident? (i.e. preventing them from doing X, incorrect display of Y, ...)
- ...
-
How many customers were affected?
- ...
-
If a precise customer impact number is unknown, what is the estimated impact (number and ratio of failed requests, amount of traffic drop, ...)?
- ...
What were the root causes?
- ...
Incident Response Analysis
-
How was the incident detected?
- ...
-
How could detection time be improved?
- ...
-
How was the root cause diagnosed?
- ...
-
How could time to diagnosis be improved?
- ...
-
How did we reach the point where we knew how to mitigate the impact?
- ...
-
How could time to mitigation be improved?
- ...
-
What went well?
- ...
Post Incident Analysis
-
Did we have other events in the past with the same root cause?
- ...
-
Do we have existing backlog items that would've prevented or greatly reduced the impact of this incident?
- ...
-
Was this incident triggered by a change (deployment of code or change to infrastructure)? If yes, link the issue.
- ...
What went well?
- ...
Guidelines
Resources
- If the Situation Zoom room was utilised, recording will be automatically uploaded to Incident room Google Drive folder (private)