Class: Gitlab::Database::Partitioning::DetachedPartitionDropper

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/database/partitioning/detached_partition_dropper.rb

Instance Method Summary collapse

Instance Method Details

#performObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gitlab/database/partitioning/detached_partition_dropper.rb', line 6

def perform
  Gitlab::AppLogger.info(message: "Checking for previously detached partitions to drop")

  Postgresql::DetachedPartition.ready_to_drop.find_each do |detached_partition|
    if partition_attached?(detached_partition.fully_qualified_table_name)
      unmark_partition(detached_partition)
    else
      drop_partition(detached_partition)
    end
  rescue StandardError => e
    Gitlab::AppLogger.error(message: "Failed to drop previously detached partition",
                            partition_name: detached_partition.table_name,
                            exception_class: e.class,
                            exception_message: e.message)
  end
end