should INDEX index_epics_on_lock_version ON epics be in init_structure.sql ?

Summary

In 14.5, db/init_structure.sql contains a reference to INDEX index_epics_on_lock_version ON epics:

CREATE INDEX index_epics_on_lock_version ON epics USING btree (lock_version) WHERE (lock_version IS NULL);

But this seems to be the only reference to it - it's not in db/structure.sql

I think this was a temporary index, added in 12.9, and removed in 13.1 - and it shouldn't have been reintroduced in 14.5. If so, please remove it, and consider what the impact might be.

If this init_structure.sql is used to seed new instances, then we need a migration to remove it from any instances built since 14.5 .. ie a DROP INDEX .. IF EXISTS ..

History:

12.9: db/schema.rb

t.index ["lock_version"], name: "index_epics_on_lock_version", where: "(lock_version IS NULL)"

12.10 - 13.1 inclusive: db/structure.sql

CREATE INDEX index_epics_on_lock_version ON public.epics USING btree (lock_version) WHERE (lock_version IS NULL);

%14.5: db/init_structure.sql

CREATE INDEX index_epics_on_lock_version ON epics USING btree (lock_version) WHERE (lock_version IS NULL);

Steps to reproduce

I searched the git repo history with the following generating: index_epics_on_lock_version-search

j="index_epics_on_lock_version" ; for i in 11.0 11.{1..11} 12.0 12.{1..10} 13.0 13.{1..12} 14.0 14.{1..5} ; do echo -e "\n$i\n" | tee -a ~/${j}-search ; git checkout v${i}.0-ee ;  grep -R $j | tee -a ~/${j}-search ; done

Example Project

n/a

What is the current bug behavior?

As far as I can seem INDEX index_epics_on_lock_version ON epics should not exist past 13.1, and I'm not clear what it'll do in db/init_structure.sql

What is the expected correct behavior?

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by Ben Prescott (ex-GitLab)