-
Notifications
You must be signed in to change notification settings - Fork 45
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
Silence strong migration warning #1037
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e275055
Increase lock timeout limit to silence stong migration warnings
ngetahun c91b7df
Merge branch 'master' into silence_strong_migration_warning
ngetahun 8c3b9fe
Merge branch 'master' into silence_strong_migration_warning
felixsch 3340b52
Merge branch 'master' into silence_strong_migration_warning
felixsch c15cb41
Disable strong_migration lock timeout limit checks
ngetahun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# rubocop:disable Style/NumericLiterals | ||
unless Rails.env.production? | ||
StrongMigrations.start_after = 20200205123840 | ||
StrongMigrations.lock_timeout_limit = 86400.seconds | ||
StrongMigrations.lock_timeout_limit = 0 | ||
end | ||
# rubocop:enable Style/NumericLiterals |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a timeout of 24h, do we expect a migration to take longer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with this check is, that it not actually checks how long a transaction takes but rather what
mariadb
is configured to (aka when to cancel a transaction).See: https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_lock_wait_timeout which is fetched by the check here: https://github.com/ankane/strong_migrations/blob/master/lib/strong_migrations/adapters/mysql_adapter.rb#L35
To make this sane, we would need to ship our own mariadb configuration since the default is
31536000
and us setting86400
will trigger this check and fail always with default configuration.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I see. Why not remove that line entirely then instead of setting to 0?
In glue we're setting timeouts for migrations, which I guess was the goal here too when we added that line:
Would it make sense to set some limits for RMT too, so that a migration cannot block the db endlessly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we should set the
lock_timeout
andstatement_timeout
, then also thelock_timeout_limit
works. But without you will run into: https://github.com/ankane/strong_migrations/blob/master/lib/strong_migrations/checker.rb#L162 which then is setting by default: https://github.com/ankane/strong_migrations/blob/master/lib/strong_migrations.rb#L59I'm not sure if setting a
statement_timeout
is really wanted, since a migration can take a long time which is completely fine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok that's unexpected that strong migrations sets it's own default and fails then. Maybe a comment explaining this would help.
Regarding the
statement_timeout
, it's possible to change it to a higher value for specific migrations that are known to take long.Anyway, strong_migrations isn't used in production anyway it seems in RMT.