Skip to content

Disallow subtransactions in with_lock_retries migration helper

Andreas Brandl requested to merge ab/with-lock-retries-subtrans into master

What does this MR do?

This is step 2 from #339115 (comment 668767523).

The intent here is to disallow using with_lock_retries in a context where we already have an open transaction going (in order to disallow subtransactions).

  1. Retain behavior for existing migrations or change existing migrations when possible
  2. Change V2 helper to raise if used within open transaction (so the breaking change is only in effect for newly added migrations inheriting from Gitlab::Database::Migration[1.0]).

Follow-up:

  1. Fix other migration helpers using with_lock_retries inside open transaction - those will raise an error when used with V2 helpers and Gitlab::Database::Migration[1.0], example: create_table_with_constraints (fix in !69304 (merged))

Does this MR meet the acceptance criteria?

Conformity

Edited by Andreas Brandl

Merge request reports