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

Send advisory lock requests to the master #198

Merged
merged 1 commit into from
Mar 1, 2018
Merged

Send advisory lock requests to the master #198

merged 1 commit into from
Mar 1, 2018

Conversation

georgeclaghorn
Copy link
Contributor

Fixes running migrations in Rails 5.2, which takes an advisory lock on a replica connection and attempts to release it on the primary connection:

[replica] (0.1ms)  SELECT GET_LOCK('5059312551837065865', 0)
[replica] (0.4ms)  SELECT `schema_migrations`.`version` FROM `schema_migrations` ORDER BY `schema_migrations`.`version` ASC
Migrating to IndexRemindersOnDeliveredAndRemindAt (20180301142256)
[primary] (29.2ms)  CREATE  INDEX `index_reminders_on_delivered_and_remind_at`  ON `reminders` (`delivered`, `remind_at`) 
[primary] (0.3ms)  BEGIN
[primary] ActiveRecord::SchemaMigration Create (0.6ms)  INSERT INTO `schema_migrations` (`version`) VALUES ('20180301142256')
[primary] (0.5ms)  COMMIT
[primary] ActiveRecord::InternalMetadata Load (0.3ms)  SELECT  `ar_internal_metadata`.* FROM `ar_internal_metadata` WHERE `ar_internal_metadata`.`key` = 'environment' LIMIT 1
[primary] (0.2ms)  BEGIN
[primary] (0.2ms)  COMMIT
[primary] (0.3ms)  SELECT RELEASE_LOCK('5059312551837065865')

Failed to release advisory lock

@bleonard
Copy link
Contributor

bleonard commented Mar 1, 2018

Thanks @georgeclaghorn !

@bleonard bleonard merged commit 20b1461 into instacart:master Mar 1, 2018
@georgeclaghorn georgeclaghorn deleted the advisory-locks-fix branch March 1, 2018 18:18
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