Skip to content

Unified tz solution - #269

Merged
shlomi-noach merged 34 commits into
masterfrom
unified-tz-solution
Oct 17, 2016
Merged

shlomi-noach merged 34 commits into
masterfrom
unified-tz-solution

Conversation

@shlomi-noach

Copy link
Copy Markdown
Contributor

Storyline: #247

This PR identifies and solves the very special case where a DATETIME columns is converted to TIMESTAMP. Turns out it is a different case from any other DATETIME/TIMESTAMP related conversion.

The PR fixes handling of this migration cross different timezones; it will behave correctly even as master, replica and app are all on different time zones.

This PR adds a lot of time-related tests.

Shlomi Noach added 25 commits September 28, 2016 09:44
--time-zone overrides both of them, if given
…lar the conversion from DATETIME to TIMESTAMP
also refactored some functions
Comment thread go/sql/builder.go
for _, column := range columns.Columns() {
var setToken string
if column.timezoneConversion != nil {
setToken = fmt.Sprintf("%s=convert_tz(?, '%s', '%s')", EscapeName(column.Name), column.timezoneConversion.ToTimezone, "+00:00")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice, glad this works 👍

@shlomi-noach

shlomi-noach commented Oct 14, 2016 •

Copy link
Copy Markdown
Contributor Author

Added a (enforced, tested) limitation that a column converting from DATETIME to TIMESTAMP cannot be part of the shared unique key gh-ost iterates on.
This limitation can be lifted in the future given more development.

@shlomi-noach

Copy link
Copy Markdown
Contributor Author

Sent to production testing

@shlomi-noach

Copy link
Copy Markdown
Contributor Author

Tests are good. Merging.

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.

3 participants