Detecting duplicate btree indexes
What does this MR do and why?
Detect duplicate indexes.
Related Issue: #385701 (closed)
Based on the discussion on the related issue:
- We will create issues for each team that is owning a table so that they remove the duplicate indexes.
- Once this MR is merged, any duplicate index will fail the tests, so that it requires teams to remove the old index in the same MR.
Steps to validate locally
- Create a duplicate index on
abuse_report_events
, in the TEST environment:
gdk psql -d "gitlabhq_test" -c "CREATE INDEX index_abuse_report_events_on_user_id_and_abuse_report_id ON abuse_report_events(user_id, abuse_report_id);"
- Run this test, which should fail by complaining about a duplicate index
./bin/rspec spec/db/schema_spec.rb --example 'for table abuse_report_events btree indexes does not have any duplicated indexes'
The expected error:
Duplicate index: index_abuse_report_events_on_user_id_and_abuse_report_id with ["index_abuse_report_events_on_user_id"]
index_abuse_report_events_on_user_id_and_abuse_report_id : [{:name=>"user_id", :order=>:asc}, {:name=>"abuse_report_id", :order=>:asc}]
index_abuse_report_events_on_user_id : [{:name=>"user_id", :order=>:asc}].
Consider dropping the indexes index_abuse_report_events_on_user_id
- Clean up. Drop the index and run the test again (step 2). It should succeed
gdk psql -d "gitlabhq_test" -c "DROP INDEX index_abuse_report_events_on_user_id_and_abuse_report_id;"
Potential Indexes Storage Savings
- On Main around 51 GBs. here (internal thanos link)
- On CI around 189 GBs. here (internal thanos link)
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.
Merge request reports
Activity
changed milestone to %15.8
assigned to @OmarQunsulGitlab
- A deleted user
added backend label
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 backend Josianne Hyson ( @jhyson
) (UTC+13, 12 hours ahead of@OmarQunsulGitlab
)Sean Arnold ( @seanarnold
) (UTC+13, 12 hours ahead of@OmarQunsulGitlab
)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
Danger added typemaintenance label
added maintenancetest-gap label
added grouptenant scale label
added 367 commits
-
3a266269...137f333f - 366 commits from branch
master
- 7e666e21 - Detecting duplicate btree indexes
-
3a266269...137f333f - 366 commits from branch
added devopsdata stores sectioncore platform labels
added Category:Cell label
added 144 commits
-
7e666e21...7b42930e - 143 commits from branch
master
- 4275cde1 - Detecting duplicate btree indexes
-
7e666e21...7b42930e - 143 commits from branch
mentioned in issue #385701 (closed)
changed milestone to %15.9
added missed:15.8 label
changed milestone to %15.10
added missed:15.9 label
changed milestone to %15.11