Skip to content

Resolve "Migrate lfs_object_registry to use Geo::ReplicableRegistry"

What does this MR do?

Adds migrations to the gitlab-geo database to make the lfs_object_registry table compatible with Geo::ReplicableRegistry

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Database

#up

== 20210120225014 MigrateLfsObjectRegistry: migrating =========================
-- change_column_default(:lfs_object_registry, :retry_count, {:from=>nil, :to=>0})
   -> 0.0048s
-- add_column(:lfs_object_registry, :state, :integer, {:null=>false, :limit=>2, :default=>0})
   -> 0.0024s
-- add_column(:lfs_object_registry, :last_synced_at, :datetime_with_timezone)
   -> 0.0010s
-- add_column(:lfs_object_registry, :last_sync_failure, :text)
   -> 0.0007s
== 20210120225014 MigrateLfsObjectRegistry: migrated (0.0090s) ================

== 20210125222907 AddLfsObjectStateIndex: migrating ===========================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:lfs_object_registry, :state, {:name=>"index_state_in_lfs_objects", :algorithm=>:concurrently})
   -> 0.0031s
-- add_index(:lfs_object_registry, :state, {:name=>"index_state_in_lfs_objects", :algorithm=>:concurrently})
   -> 0.0052s
== 20210125222907 AddLfsObjectStateIndex: migrated (0.0091s) ==================

== 20210225200858 AddTextLimitToLfsObjectRegistryLastSyncFailure: migrating ===
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE lfs_object_registry\nADD CONSTRAINT check_c41d57c1dc\nCHECK ( char_length(last_sync_failure) <= 255 )\nNOT VALID;\n")
   -> 0.0010s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE lfs_object_registry VALIDATE CONSTRAINT check_c41d57c1dc;")
   -> 0.0008s
== 20210225200858 AddTextLimitToLfsObjectRegistryLastSyncFailure: migrated (0.0112s)

#down

== 20210225200858 AddTextLimitToLfsObjectRegistryLastSyncFailure: reverting ===
-- execute("ALTER TABLE lfs_object_registry\nDROP CONSTRAINT IF EXISTS check_c41d57c1dc\n")
   -> 0.0013s
== 20210225200858 AddTextLimitToLfsObjectRegistryLastSyncFailure: reverted (0.0073s)

== 20210125222907 AddLfsObjectStateIndex: reverting ===========================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:lfs_object_registry, :state, {:name=>"index_state_in_lfs_objects", :algorithm=>:concurrently})
   -> 0.0044s
-- remove_index(:lfs_object_registry, {:name=>"index_state_in_lfs_objects", :algorithm=>:concurrently, :column=>:state})
   -> 0.0051s
== 20210125222907 AddLfsObjectStateIndex: reverted (0.0103s) ==================
== 20210120225014 MigrateLfsObjectRegistry: reverting =========================
-- change_column_default(:lfs_object_registry, :retry_count, {:from=>0, :to=>nil})
   -> 0.0054s
-- remove_column(:lfs_object_registry, :state)
   -> 0.0008s
-- remove_column(:lfs_object_registry, :last_synced_at)
   -> 0.0006s
-- remove_column(:lfs_object_registry, :last_sync_failure)
   -> 0.0007s
== 20210120225014 MigrateLfsObjectRegistry: reverted (0.0076s) ================

Related to #276694 (closed)

Follow up for adding not null constraints: #322892

Edited by Michael Kozono

Merge request reports