Skip to content

Remove LOCK_VERSION monkeypatch

What does this MR do?

Finally removes the monkeypatch for Rails Optimistic Locking we've been preparing to remove in !18418 (merged) and !25396 (merged)

Database migration

UP
== 20200608195222 SetLockVersionNotNullConstraint: migrating ==================
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE epics\nADD CONSTRAINT check_fcfb4a93ff\nCHECK ( lock_version IS NOT NULL )\nNOT VALID;\n")
   -> 0.0045s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE merge_requests\nADD CONSTRAINT check_970d272570\nCHECK ( lock_version IS NOT NULL )\nNOT VALID;\n")
   -> 0.0005s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE issues\nADD CONSTRAINT check_fba63f706d\nCHECK ( lock_version IS NOT NULL )\nNOT VALID;\n")
   -> 0.0004s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE ci_stages\nADD CONSTRAINT check_81b431e49b\nCHECK ( lock_version IS NOT NULL )\nNOT VALID;\n")
   -> 0.0004s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE ci_builds\nADD CONSTRAINT check_1e2fbd1b39\nCHECK ( lock_version IS NOT NULL )\nNOT VALID;\n")
   -> 0.0004s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE ci_pipelines\nADD CONSTRAINT check_d7e99a025e\nCHECK ( lock_version IS NOT NULL )\nNOT VALID;\n")
   -> 0.0004s
== 20200608195222 SetLockVersionNotNullConstraint: migrated (0.0493s) =========

== 20200608205813 SetLockVersionToNotNull: migrating ==========================
== 20200608205813 SetLockVersionToNotNull: migrated (0.0722s) =================

== 20200608212030 LockVersionCleanupForEpics: migrating =======================
-- execute("ALTER TABLE epics VALIDATE CONSTRAINT check_fcfb4a93ff;")
   -> 0.0005s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:epics, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0056s
-- remove_index(:epics, {:where=>"lock_version IS NULL", :algorithm=>:concurrently, :column=>:lock_version})
   -> 0.0100s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:epics, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_epics_lock_version", :algorithm=>:concurrently})
   -> 0.0049s
-- remove_index(:epics, {:where=>"lock_version IS NULL", :name=>"tmp_index_epics_lock_version", :algorithm=>:concurrently, :column=>:id})
   -> 0.0060s
== 20200608212030 LockVersionCleanupForEpics: migrated (0.0283s) ==============

== 20200608212435 LockVersionCleanupForMergeRequests: migrating ===============
-- execute("ALTER TABLE merge_requests VALIDATE CONSTRAINT check_970d272570;")
   -> 0.0005s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:merge_requests, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0081s
-- remove_index(:merge_requests, {:where=>"lock_version IS NULL", :algorithm=>:concurrently, :column=>:lock_version})
   -> 0.0090s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:merge_requests, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_merge_requests_lock_version", :algorithm=>:concurrently})
   -> 0.0080s
-- remove_index(:merge_requests, {:where=>"lock_version IS NULL", :name=>"tmp_index_merge_requests_lock_version", :algorithm=>:concurrently, :column=>:id})
   -> 0.0082s
== 20200608212435 LockVersionCleanupForMergeRequests: migrated (0.0351s) ======

== 20200608212549 LockVersionCleanupForIssues: migrating ======================
-- execute("ALTER TABLE issues VALIDATE CONSTRAINT check_fba63f706d;")
   -> 0.0007s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:issues, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0074s
-- remove_index(:issues, {:where=>"lock_version IS NULL", :algorithm=>:concurrently, :column=>:lock_version})
   -> 0.0081s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:issues, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_issues_lock_version", :algorithm=>:concurrently})
   -> 0.0066s
-- remove_index(:issues, {:where=>"lock_version IS NULL", :name=>"tmp_index_issues_lock_version", :algorithm=>:concurrently, :column=>:id})
   -> 0.0076s
== 20200608212549 LockVersionCleanupForIssues: migrated (0.0316s) =============

== 20200608212652 LockVersionCleanupForCiStages: migrating ====================
-- execute("ALTER TABLE ci_stages VALIDATE CONSTRAINT check_81b431e49b;")
   -> 0.0004s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:ci_stages, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0023s
-- remove_index(:ci_stages, {:where=>"lock_version IS NULL", :algorithm=>:concurrently, :column=>:lock_version})
   -> 0.0028s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:ci_stages, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_ci_stages_lock_version", :algorithm=>:concurrently})
   -> 0.0020s
-- remove_index(:ci_stages, {:where=>"lock_version IS NULL", :name=>"tmp_index_ci_stages_lock_version", :algorithm=>:concurrently, :column=>:id})
   -> 0.0029s
== 20200608212652 LockVersionCleanupForCiStages: migrated (0.0116s) ===========

== 20200608212807 LockVersionCleanupForCiBuilds: migrating ====================
-- execute("ALTER TABLE ci_builds VALIDATE CONSTRAINT check_1e2fbd1b39;")
   -> 0.0008s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:ci_builds, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0093s
-- remove_index(:ci_builds, {:where=>"lock_version IS NULL", :algorithm=>:concurrently, :column=>:lock_version})
   -> 0.0102s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:ci_builds, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_ci_builds_lock_version", :algorithm=>:concurrently})
   -> 0.0079s
-- remove_index(:ci_builds, {:where=>"lock_version IS NULL", :name=>"tmp_index_ci_builds_lock_version", :algorithm=>:concurrently, :column=>:id})
   -> 0.0080s
== 20200608212807 LockVersionCleanupForCiBuilds: migrated (0.0374s) ===========

== 20200608212824 LockVersionCleanupForCiPipelines: migrating =================
-- execute("ALTER TABLE ci_pipelines VALIDATE CONSTRAINT check_d7e99a025e;")
   -> 0.0003s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:ci_pipelines, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0079s
-- remove_index(:ci_pipelines, {:where=>"lock_version IS NULL", :algorithm=>:concurrently, :column=>:lock_version})
   -> 0.0088s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:ci_pipelines, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_ci_pipelines_lock_version", :algorithm=>:concurrently})
   -> 0.0068s
-- remove_index(:ci_pipelines, {:where=>"lock_version IS NULL", :name=>"tmp_index_ci_pipelines_lock_version", :algorithm=>:concurrently, :column=>:id})
   -> 0.0067s
== 20200608212824 LockVersionCleanupForCiPipelines: migrated (0.0320s) ========
DOWN
== 20200608212824 LockVersionCleanupForCiPipelines: reverting =================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:ci_pipelines, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0067s
-- add_index(:ci_pipelines, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0041s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:ci_pipelines, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_ci_pipelines_lock_version", :algorithm=>:concurrently})
   -> 0.0050s
-- add_index(:ci_pipelines, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_ci_pipelines_lock_version", :algorithm=>:concurrently})
   -> 0.0021s
== 20200608212824 LockVersionCleanupForCiPipelines: reverted (0.0185s) ========

== 20200608212807 LockVersionCleanupForCiBuilds: reverting ====================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:ci_builds, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0087s
-- add_index(:ci_builds, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0023s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:ci_builds, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_ci_builds_lock_version", :algorithm=>:concurrently})
   -> 0.0079s
-- add_index(:ci_builds, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_ci_builds_lock_version", :algorithm=>:concurrently})
   -> 0.0023s
== 20200608212807 LockVersionCleanupForCiBuilds: reverted (0.0216s) ===========

== 20200608212652 LockVersionCleanupForCiStages: reverting ====================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:ci_stages, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0016s
-- add_index(:ci_stages, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0020s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:ci_stages, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_ci_stages_lock_version", :algorithm=>:concurrently})
   -> 0.0021s
-- add_index(:ci_stages, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_ci_stages_lock_version", :algorithm=>:concurrently})
   -> 0.0019s
== 20200608212652 LockVersionCleanupForCiStages: reverted (0.0080s) ===========

== 20200608212549 LockVersionCleanupForIssues: reverting ======================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:issues, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0066s
-- add_index(:issues, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0027s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:issues, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_issues_lock_version", :algorithm=>:concurrently})
   -> 0.0065s
-- add_index(:issues, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_issues_lock_version", :algorithm=>:concurrently})
   -> 0.0042s
== 20200608212549 LockVersionCleanupForIssues: reverted (0.0208s) =============

== 20200608212435 LockVersionCleanupForMergeRequests: reverting ===============
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:merge_requests, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0091s
-- add_index(:merge_requests, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0020s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:merge_requests, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_merge_requests_lock_version", :algorithm=>:concurrently})
   -> 0.0065s
-- add_index(:merge_requests, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_merge_requests_lock_version", :algorithm=>:concurrently})
   -> 0.0028s
== 20200608212435 LockVersionCleanupForMergeRequests: reverted (0.0214s) ======

== 20200608212030 LockVersionCleanupForEpics: reverting =======================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:epics, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0056s
-- add_index(:epics, :lock_version, {:where=>"lock_version IS NULL", :algorithm=>:concurrently})
   -> 0.0026s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:epics, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_epics_lock_version", :algorithm=>:concurrently})
   -> 0.0042s
-- add_index(:epics, :id, {:where=>"lock_version IS NULL", :name=>"tmp_index_epics_lock_version", :algorithm=>:concurrently})
   -> 0.0018s
== 20200608212030 LockVersionCleanupForEpics: reverted (0.0148s) ==============

== 20200608205813 SetLockVersionToNotNull: reverting ==========================
== 20200608205813 SetLockVersionToNotNull: reverted (0.0000s) =================

== 20200608195222 SetLockVersionNotNullConstraint: reverting ==================
-- execute("ALTER TABLE epics\nDROP CONSTRAINT IF EXISTS check_fcfb4a93ff\n")
   -> 0.0013s
-- execute("ALTER TABLE merge_requests\nDROP CONSTRAINT IF EXISTS check_970d272570\n")
   -> 0.0003s
-- execute("ALTER TABLE issues\nDROP CONSTRAINT IF EXISTS check_fba63f706d\n")
   -> 0.0003s
-- execute("ALTER TABLE ci_stages\nDROP CONSTRAINT IF EXISTS check_81b431e49b\n")
   -> 0.0002s
-- execute("ALTER TABLE ci_builds\nDROP CONSTRAINT IF EXISTS check_1e2fbd1b39\n")
   -> 0.0003s
-- execute("ALTER TABLE ci_pipelines\nDROP CONSTRAINT IF EXISTS check_d7e99a025e\n")
   -> 0.0002s
== 20200608195222 SetLockVersionNotNullConstraint: reverted (0.0146s) =========

Screenshots

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

Refs #207312 (closed)

Edited by Coung Ngo

Merge request reports