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

Remove timeout from MySQL migrations #2974

Merged
merged 1 commit into from
Apr 28, 2022
Merged

Conversation

mgdelacroix
Copy link
Contributor

Summary

This PR reuses the server mechanism to remove the MySQL timeout from the connection string to bypass timeouts when running migrations.

A couple of follow up PRs will come later making the server method public for it to be used in Focalboard instead of duplicating the implementation.

Ticket Link

Fixes #2946

@mgdelacroix mgdelacroix added the 2: Dev Review Requires review by a core committer label Apr 28, 2022
@mgdelacroix mgdelacroix added this to the v0.16 milestone Apr 28, 2022
@mgdelacroix mgdelacroix requested review from jespino and sbishel April 28, 2022 15:45
@mgdelacroix mgdelacroix requested a review from a team as a code owner April 28, 2022 15:45
@mgdelacroix mgdelacroix added the CherryPick/Approved Meant for the quality or patch release tracked in the milestone label Apr 28, 2022
Copy link
Collaborator

@sbishel sbishel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woohoo...Couple questions. This only affects mySQL? Do we need to worry about timeouts on large Postgres DBs? And it make sense, but just want to make sure...only ReadTimeOut is an issue. Thanks Miguel.

@mgdelacroix
Copy link
Contributor Author

mgdelacroix commented Apr 28, 2022

Only ReadTimeouts should be an issue as WriteTimeouts controls the time when the server is writing to the client. In any case, I tested the fix with both timeouts below migration time and it worked fine. As per postgres, I've tested migrations that lasted way more the timeout set in the connection string and it seems to respect morphs timeout, so we're good only making changes to MySQL

@mgdelacroix
Copy link
Contributor Author

@sbishel ^

@mgdelacroix
Copy link
Contributor Author

mgdelacroix commented Apr 28, 2022

After digging a bit deeper, the connect_timeout in Postgres only measures the time until the connection is established, but not the time it takes to run the queries. Postgres has statement_timeout, which I've tested and can break migrations, but it's not set in our default parameters and it's default value is 0, which disables the timeout. Is as well recommended not to be set globally in the official docs, so an admin would need to explicitly add it to the server connection string for it to cause problems.

I'd propose to follow what server is doing and assume statement_timeout is not set, and we can go back to it later if needed.

@sbishel sbishel merged commit c08ce96 into main Apr 28, 2022
@sbishel sbishel deleted the remove-timeout-from-migrations branch April 28, 2022 17:58
@mattermod
Copy link
Contributor

Cherry pick is scheduled.

@mattermod mattermod added CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone and removed CherryPick/Approved Meant for the quality or patch release tracked in the milestone labels Apr 28, 2022
mattermost-build pushed a commit to mattermost-build/focalboard that referenced this pull request Apr 28, 2022
sbishel pushed a commit that referenced this pull request Apr 28, 2022
(cherry picked from commit c08ce96)

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core committer CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Community clone migration failed.
3 participants