Transactional locks hanging for non-transactional migrations

See original GitHub issue
Which version and edition of Flyway are you using?
  • org.flywaydb:flyway-core:9.1.2
If this is not the latest version, can you reproduce the issue with the latest one as well? (Many bugs are fixed in newer releases and upgrading will often resolve the issue)
  • It is the latest version
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
  • Java API
Which database are you using? (Type & version)
  • Postgres 12.4
Which operating system are you using?
  • Docker container with Linux running on macOS
What did you do? (Please include the content causing the issue, any relevant configuration settings, the SQL statement(s) that failed (if any), and the command you ran)
  • Upgrading to flyway 9.1.2 caused existing migrations to hang indefinitely
  • We have non-transactional migrations (e.g. CREATE INDEX CONCURRENTLY index_name ON table_name(column_name) that no longer work because the default behavior of flyway with postgres is to use a transactional lock starting flyway 9.1.2 (see https://github.com/flyway/flyway/commit/022a646b7959aa7a9a11760d8e93e5e238fbd6ec)
  • Disabling the transactional log (flyway.postgresql.transactional.lock=false) works fine, but is such breaking behavior expected from a patch release?
  • Does this interaction between non-transactional migrations and transactional locks make sense?
What did you expect to see?
  • Existing migrations to keep working after upgrading to 9.12
What did you see instead?
  • Existing (non-transactional) migrations hang indefinitely

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DoodleBobBuffPantscommented, Aug 24, 2022

@LukasVyhlidka

It’s documented on this page

Multiple connections are required for scenarios where there is SQL that cannot be executed in a transaction - we still need a transaction in order to take a transactional lock, so we do it on a connection that updates the history table

0reactions
LukasVyhlidkacommented, Aug 24, 2022

Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transactional locks hanging for non-transactional migrations
Disabling the transactional log ( flyway.postgresql.transactional.lock=false ) works fine, but is such breaking behavior expected from a patch ...
Read more >
Flyway >=9.1.2 hanging forever on concurrent index creation
Disable the transactional lock in Flyway that breaks all non-transactional migrations since v9.1.2 of the plugin See ...
Read more >
How do I create indexes concurrently with flyway in postgres?
The first hurdle is detecting when a migration needs to be run outside of a transaction. Two paths forward are evident. The first...
Read more >
Lock retries in database migrations without subtransactions
The "lock-retries" methodology works like so: Open (sub-)transaction; Set a lock_timeout to a low value (e.g. 100ms); Try the migration; If we ...
Read more >
Transaction locking and row versioning guide - SQL Server
In this article. Transaction basics; Locking and row versioning basics; Locking in the Database Engine; Lock granularity and hierarchies; Lock ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found