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

*: fix wrong timezone when env TZ is not set #512

Merged
merged 5 commits into from
Apr 28, 2020

Conversation

zier-one
Copy link
Contributor

@zier-one zier-one commented Apr 28, 2020

What problem does this PR solve?

If the environment TZ is not set , the value of time.Local.String() is Local,
when we try to connect to mysql using Local timezone, we will get an error: Error 1298: Unknown or incorrect time zone: 'Local'

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test

Release note

  • Fix using incorrect timezone when env TZ is not set

@zier-one zier-one changed the title *: fix wrong timezone when TZ env is not set *: fix wrong timezone when env TZ is not set Apr 28, 2020
@amyangfei
Copy link
Contributor

I found in some environment without TZ env, using timezone="Local" can be success, sounds strange.

[2020/04/28 16:22:00.429 +08:00] [INFO] [mysql.go:341] ["Start mysql sink"] [dsn="root@tcp(127.0.0.1:3306)/?interpolateParams=true&loc=Local&multiStatements=true&time_zone=%22Local%22"]

@amyangfei
Copy link
Contributor

BTW, is the loc variable needed in DSN, as we don't provide parseTime=true

@zier-one
Copy link
Contributor Author

zier-one commented Apr 28, 2020

I found in some environment without TZ env, using timezone="Local" can be success, sounds strange.

[2020/04/28 16:22:00.429 +08:00] [INFO] [mysql.go:341] ["Start mysql sink"] [dsn="root@tcp(127.0.0.1:3306)/?interpolateParams=true&loc=Local&multiStatements=true&time_zone=%22Local%22"]

Is the downstream TiDB?

Error 1298: Unknown or incorrect time zone: 'Local' this error is reported by MySQL57

@amyangfei
Copy link
Contributor

I found in some environment without TZ env, using timezone="Local" can be success, sounds strange.

[2020/04/28 16:22:00.429 +08:00] [INFO] [mysql.go:341] ["Start mysql sink"] [dsn="root@tcp(127.0.0.1:3306)/?interpolateParams=true&loc=Local&multiStatements=true&time_zone=%22Local%22"]

Is the downstream TiDB?

Error 1298: Unknown or incorrect time zone: 'Local' this error is reported by MySQL57

Yes, TiDB works well and MySQL raises the error.

Copy link
Contributor

@amyangfei amyangfei left a comment

Choose a reason for hiding this comment

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

LGTM

@amyangfei
Copy link
Contributor

/run-all-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/sink Sink component. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants