Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YugabyteDB plugin] Use single connection for both schema history table management and applying migrations #53

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

ashetkar
Copy link
Contributor

@ashetkar ashetkar commented Aug 12, 2024

What

  • Fix for GH Issue Flyway migrations with ALTER TABLE ... RENAME COLUMN may fail with YBDB 2.20+ yugabyte/yugabyte-db#23327
    • Currently, the plugin uses a separate connection to manage schema history table and migrations are applied in another thread.
    • This was causing catalog version mismatch issues when one thread altered catalog version while another was querying a pg_catalog.pg_class table inside a transaction.
    • The fix is to use single connection for both schema history table management and applying migrations
  • Also, made the tableEntries map a static variable in YugabyteDBExecutionTemplate
    • This map keeps track of which entries are added to the lock table across different migrations from within the same app. Earlier, being an instance variable it was getting reinitialised for each migration and not serving its purpose.

Testing

Ran modified tests from flyway-tests repository. PR available yugabyte/flyway-tests#3.

@ashetkar
Copy link
Contributor Author

cc @Barry-RG Please take look. Thanks

@ashetkar
Copy link
Contributor Author

Gentle reminder. Thanks!

@piers-williams piers-williams self-requested a review August 30, 2024 09:12
@piers-williams piers-williams merged commit 8c72dc2 into flyway:main Aug 30, 2024
2 checks passed
@ashetkar ashetkar deleted the gh_23327 branch October 25, 2024 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants