Commit dd19ceb0 authored by Krasimir Angelov's avatar Krasimir Angelov

Merge branch 'remove-partition-pruning-feature-flags' into 'master'

Remove partition_pruning and drop_detached_partitions feature flags

See merge request gitlab-org/gitlab!74739
parents 60903c44 988a96c7
---
name: drop_detached_partitions
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67056
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/337155
milestone: '14.2'
type: development
group: group::database
default_enabled: false
---
name: partition_pruning
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67056
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/337153
milestone: '14.2'
type: development
group: group::database
default_enabled: false
...@@ -4,8 +4,6 @@ module Gitlab ...@@ -4,8 +4,6 @@ module Gitlab
module Partitioning module Partitioning
class DetachedPartitionDropper class DetachedPartitionDropper
def perform def perform
return unless Feature.enabled?(:drop_detached_partitions, default_enabled: :yaml)
Gitlab::AppLogger.info(message: "Checking for previously detached partitions to drop") Gitlab::AppLogger.info(message: "Checking for previously detached partitions to drop")
Postgresql::DetachedPartition.ready_to_drop.find_each do |detached_partition| Postgresql::DetachedPartition.ready_to_drop.find_each do |detached_partition|
......
...@@ -25,11 +25,9 @@ module Gitlab ...@@ -25,11 +25,9 @@ module Gitlab
partitions_to_create = missing_partitions partitions_to_create = missing_partitions
create(partitions_to_create) unless partitions_to_create.empty? create(partitions_to_create) unless partitions_to_create.empty?
if Feature.enabled?(:partition_pruning, default_enabled: :yaml)
partitions_to_detach = extra_partitions partitions_to_detach = extra_partitions
detach(partitions_to_detach) unless partitions_to_detach.empty? detach(partitions_to_detach) unless partitions_to_detach.empty?
end end
end
rescue StandardError => e rescue StandardError => e
Gitlab::AppLogger.error(message: "Failed to create / detach partition(s)", Gitlab::AppLogger.error(message: "Failed to create / detach partition(s)",
table_name: model.table_name, table_name: model.table_name,
......
...@@ -90,18 +90,6 @@ RSpec.describe Gitlab::Database::Partitioning::DetachedPartitionDropper do ...@@ -90,18 +90,6 @@ RSpec.describe Gitlab::Database::Partitioning::DetachedPartitionDropper do
expect(table_oid('test_partition')).to be_nil expect(table_oid('test_partition')).to be_nil
end end
context 'when the drop_detached_partitions feature flag is disabled' do
before do
stub_feature_flags(drop_detached_partitions: false)
end
it 'does not drop the partition' do
dropper.perform
expect(table_oid('test_partition')).not_to be_nil
end
end
context 'removing foreign keys' do context 'removing foreign keys' do
it 'removes foreign keys from the table before dropping it' do it 'removes foreign keys from the table before dropping it' do
expect(dropper).to receive(:drop_detached_partition).and_wrap_original do |drop_method, partition_name| expect(dropper).to receive(:drop_detached_partition).and_wrap_original do |drop_method, partition_name|
......
...@@ -101,11 +101,6 @@ RSpec.describe Gitlab::Database::Partitioning::PartitionManager do ...@@ -101,11 +101,6 @@ RSpec.describe Gitlab::Database::Partitioning::PartitionManager do
] ]
end end
context 'with the partition_pruning feature flag enabled' do
before do
stub_feature_flags(partition_pruning: true)
end
it 'detaches each extra partition' do it 'detaches each extra partition' do
extra_partitions.each { |p| expect(manager).to receive(:detach_one_partition).with(p) } extra_partitions.each { |p| expect(manager).to receive(:detach_one_partition).with(p) }
...@@ -113,19 +108,6 @@ RSpec.describe Gitlab::Database::Partitioning::PartitionManager do ...@@ -113,19 +108,6 @@ RSpec.describe Gitlab::Database::Partitioning::PartitionManager do
end end
end end
context 'with the partition_pruning feature flag disabled' do
before do
stub_feature_flags(partition_pruning: false)
end
it 'returns immediately' do
expect(manager).not_to receive(:detach)
sync_partitions
end
end
end
describe '#detach_partitions' do describe '#detach_partitions' do
around do |ex| around do |ex|
travel_to(Date.parse('2021-06-23')) do travel_to(Date.parse('2021-06-23')) do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment