Cleanup unused tagging records
What does this MR do and why?
Deletes unused records from the database. These are not used since we moved to labels 7 years ago: d45a6b29
This deletes 53855 issue taggings and 125 merge request taggings.
Migration output
== 20211028100303 TmpIndexForDeleteIssueMergeRequestTaggingsRecords: migrating
-- transaction_open?()
-> 0.0000s
-- index_exists?(:taggings, :id, {:where=>"taggable_type IN ('Issue', 'MergeRequest')", :name=>"tmp_index_taggings_on_id_where_taggable_type_issue_mr", :algorithm=>:concurrently})
-> 0.0043s
-- add_index(:taggings, :id, {:where=>"taggable_type IN ('Issue', 'MergeRequest')", :name=>"tmp_index_taggings_on_id_where_taggable_type_issue_mr", :algorithm=>:concurrently})
-> 0.0101s
== 20211028100303 TmpIndexForDeleteIssueMergeRequestTaggingsRecords: migrated (0.0223s)
== 20211028100843 DeleteIssueMergeRequestTaggingsRecords: migrating ===========
-- transaction_open?()
-> 0.0000s
-- indexes(:taggings)
-> 0.0041s
-- remove_index(:taggings, {:algorithm=>:concurrently, :name=>"tmp_index_taggings_on_id_where_taggable_type_issue_mr"})
-> 0.0043s
== 20211028100843 DeleteIssueMergeRequestTaggingsRecords: migrated (0.0258s) ==
== 20211028100843 DeleteIssueMergeRequestTaggingsRecords: reverting ===========
== 20211028100843 DeleteIssueMergeRequestTaggingsRecords: reverted (0.0000s) ==
== 20211028100303 TmpIndexForDeleteIssueMergeRequestTaggingsRecords: reverting
-- transaction_open?()
-> 0.0000s
-- indexes(:taggings)
-> 0.0034s
-- current_schema()
-> 0.0003s
== 20211028100303 TmpIndexForDeleteIssueMergeRequestTaggingsRecords: reverted (0.0063s)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #335794 (closed)
Merge request reports
Activity
changed milestone to %14.5
assigned to @engwan
removed automation:ml wrong label
removed workflowready for development label
removed [deprecated] Accepting merge requests label
removed devopscreate label
removed missed:14.3 label
removed missed:14.4 label
removed automation:ml label
added devopsplan typefeature + 1 deleted label
added typemaintenance label and removed typefeature label
- A deleted user
added databasereview pending label
2 Warnings New migrations added but db/structure.sql wasn't updated Usually, when adding new migrations, db/structure.sql should be
updated too (unless the migration isn't changing the DB schema
and isn't the most recent one).You've made some app changes, but didn't add any tests.
That's OK as long as you're refactoring existing code,
but please consider adding any of the ~"type::tooling", ~"tooling::pipelines", ~"tooling::workflow", documentation, QA labels.Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer database Terri Chu ( @terrichu
) (UTC-4, 12 hours behind@engwan
)Alper Akgun ( @a_akgun
) (UTC+3, 5 hours behind@engwan
)~migration No reviewer available No maintainer available To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
DangerDatabase migrations
3 Warnings 20211028100303 - TmpIndexForDeleteIssueMergeRequestTaggingsRecords had a query that exceeded
timing guidelines. Run time should not exceed 300000ms, but it was 2274943.04ms. Please consider
possible options to improve the query performance.CREATE INDEX CONCURRENTLY
"tmp_index_taggings_on_id_where_taggable_type_issue_mr" ON "taggings" ("id")
WHERE taggable_type IN ('Issue', 'MergeRequest')
/*application:test,db_config_name:main*/20211028100303 - TmpIndexForDeleteIssueMergeRequestTaggingsRecords took 37.93min. Please add
a comment that mentions Release Managers (@gitlab-org/release/managers
) so they are informed.20211028100303 - TmpIndexForDeleteIssueMergeRequestTaggingsRecords may need a background
migration to comply with timing guidelines. It took 37.93min, but should not exceed 10.0minMigrations included in this change have been executed on gitlab.com data for testing purposes. For details, please see the migration testing pipeline (limited access).
Migration Type Total runtime Result DB size change 20211028100303 - TmpIndexForDeleteIssueMergeRequestTaggingsRecords Post deploy 2276.5 s +1.17 MiB 20211028100843 - DeleteIssueMergeRequestTaggingsRecords Post deploy 38.9 s -1.17 MiB Runtime Histogram for all migrations
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 23 0.1 seconds - 1 second 0 1 second - 5 minutes 0 5 minutes + 1 Migration: 20211028100303 - TmpIndexForDeleteIssueMergeRequestTaggingsRecords- Type: Post deploy
- Duration: 2276.5 s
- Database size change: +1.17 MiB
Query Calls Total Time Max Time Mean Time Rows CREATE INDEX CONCURRENTLY "tmp_index_taggings_on_id_where_taggable_type_issue_mr" ON "taggings" ("id")
WHERE taggable_type IN ('Issue', 'MergeRequest') /*application:test,db_config_name:main*/1 2274943.0 ms 2274943.0 ms 2274943.0 ms 0 SELECT "feature_gates".*
FROM "feature_gates"
WHERE "feature_gates"."feature_key" = $1 /*application:test,db_config_name:main*/1 0.0 ms 0.0 ms 0.0 ms 1 SELECT "postgres_async_indexes".*
FROM "postgres_async_indexes"
WHERE "postgres_async_indexes"."name" = $1
LIMIT $2 /*application:test,db_config_name:main*/1 0.0 ms 0.0 ms 0.0 ms 0 Histogram for TmpIndexForDeleteIssueMergeRequestTaggingsRecords
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 2 0.1 seconds - 1 second 0 1 second - 5 minutes 0 5 minutes + 1 Migration: 20211028100843 - DeleteIssueMergeRequestTaggingsRecords
- Type: Post deploy
- Duration: 38.9 s
- Database size change: -1.17 MiB
Query Calls Total Time Max Time Mean Time Rows DELETE
FROM "taggings"
WHERE "taggings"."id" IN (
SELECT "taggings"."id"
FROM "taggings"
WHERE "taggings"."taggable_type" IN ($1, $2)
LIMIT $3
) /*application:test,db_config_name:main*/19 310.6 ms 26.4 ms 16.3 ms 53980 DROP INDEX CONCURRENTLY "tmp_index_taggings_on_id_where_taggable_type_issue_mr" /*application:test,db_config_name:main*/
1 4.4 ms 4.4 ms 4.4 ms 0 SELECT "postgres_async_indexes".*
FROM "postgres_async_indexes"
WHERE "postgres_async_indexes"."name" = $1
LIMIT $2 /*application:test,db_config_name:main*/1 0.0 ms 0.0 ms 0.0 ms 0 Histogram for DeleteIssueMergeRequestTaggingsRecords
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 21 0.1 seconds - 1 second 0 1 second - 5 minutes 0 5 minutes + 0
Other migrations pending on GitLab.com
Migration Type Total runtime Result DB size change 20211022112202 - AddClusterIdLocationIndexToVulnerabilityOccurrences Post deploy 167.7 s +24.00 KiB Clone Details
Clone ID Clone Created At Clone Data Timestamp Expected Removal Time database-testing-868728
2021-11-01 06:11:27 UTC 2021-11-01 04:01:04 UTC 2021-11-01 18:53:44 +0000 Artifacts
Brought to you by gitlab-org/database-team/gitlab-com-database-testing. Epic
marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed
- A deleted user
added database-testing-automation label
added 243 commits
-
19827eea...409f5667 - 242 commits from branch
master
- 85ef06db - Cleanup unused tagging records
-
19827eea...409f5667 - 242 commits from branch
added 11 commits
-
242b04d7...11da5cd8 - 10 commits from branch
master
- 0320340c - Cleanup unused tagging records
-
242b04d7...11da5cd8 - 10 commits from branch
- Resolved by Steve Abrams
@DylanGriffith can you review please?
requested review from @DylanGriffith
added 180 commits
-
0320340c...eea9ad53 - 178 commits from branch
master
- e25bd779 - Cleanup unused tagging records
- 8b235994 - Delete without temp index
-
0320340c...eea9ad53 - 178 commits from branch
added 17 commits
-
86c9ec5e...c21955b5 - 16 commits from branch
master
- 2cd94915 - Cleanup unused tagging records
-
86c9ec5e...c21955b5 - 16 commits from branch
added databasereviewed label and removed databasereview pending label
requested review from @sabrams
mentioned in issue gitlab-com/www-gitlab-com#11160 (closed)
added databaseapproved label and removed databasereviewed label
@sabrams
, thanks for approving this merge request.This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.
For more info, please refer to the following links:
enabled an automatic merge when the pipeline for 816611ae succeeds
mentioned in commit 01ef8c75
added workflowstaging-canary label
added workflowstaging label and removed workflowstaging-canary label
added workflowcanary label and removed workflowstaging label
added workflowproduction label and removed workflowcanary label
added releasedcandidate label
added releasedpublished label and removed releasedcandidate label
mentioned in merge request kubitus-project/kubitus-installer!388 (merged)