diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-16 13:42:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-16 13:42:19 +0300 |
commit | 84d1bd786125c1c14a3ba5f63e38a4cc736a9027 (patch) | |
tree | f550fa965f507077e20dbb6d61a8269a99ef7107 /db/post_migrate/20240105120320_disable_fastupdate_on_issue_search_data.rb | |
parent | 3a105e36e689f7b75482236712f1a47fd5a76814 (diff) |
Add latest changes from gitlab-org/gitlab@16-8-stable-eev16.8.0-rc42
Diffstat (limited to 'db/post_migrate/20240105120320_disable_fastupdate_on_issue_search_data.rb')
-rw-r--r-- | db/post_migrate/20240105120320_disable_fastupdate_on_issue_search_data.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/db/post_migrate/20240105120320_disable_fastupdate_on_issue_search_data.rb b/db/post_migrate/20240105120320_disable_fastupdate_on_issue_search_data.rb new file mode 100644 index 00000000000..b7271fa5f51 --- /dev/null +++ b/db/post_migrate/20240105120320_disable_fastupdate_on_issue_search_data.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +class DisableFastupdateOnIssueSearchData < Gitlab::Database::Migration[2.2] + milestone '16.8' + + disable_ddl_transaction! + + NUM_PARTITIONS = 64 + + def up + each_index_name do |index_name| + with_lock_retries do + execute <<~SQL + ALTER INDEX #{index_name} SET ( fastupdate = false ) ; + SQL + end + end + end + + def down + each_index_name do |index_name| + with_lock_retries do + execute <<~SQL + ALTER INDEX #{index_name} RESET ( fastupdate ) ; + SQL + end + end + end + + private + + def each_index_name + NUM_PARTITIONS.times do |partition| + yield "gitlab_partitions_static.issue_search_data_#{format('%02d', partition)}_search_vector_idx" + end + end +end |