{"action":"created","issue":{"url":"https://api.github.com/repos/pingcap/tidb/issues/8745","repository_url":"https://api.github.com/repos/pingcap/tidb","labels_url":"https://api.github.com/repos/pingcap/tidb/issues/8745/labels{/name}","comments_url":"https://api.github.com/repos/pingcap/tidb/issues/8745/comments","events_url":"https://api.github.com/repos/pingcap/tidb/issues/8745/events","html_url":"https://github.com/pingcap/tidb/pull/8745","id":392472174,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM5NzM1ODc4","number":8745,"title":"gc_worker: Remove timezone name from the times that are saved in mysql.tidb","user":{"login":"MyonKeminta","id":9948422,"node_id":"MDQ6VXNlcjk5NDg0MjI=","avatar_url":"https://avatars1.githubusercontent.com/u/9948422?v=4","gravatar_id":"","url":"https://api.github.com/users/MyonKeminta","html_url":"https://github.com/MyonKeminta","followers_url":"https://api.github.com/users/MyonKeminta/followers","following_url":"https://api.github.com/users/MyonKeminta/following{/other_user}","gists_url":"https://api.github.com/users/MyonKeminta/gists{/gist_id}","starred_url":"https://api.github.com/users/MyonKeminta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MyonKeminta/subscriptions","organizations_url":"https://api.github.com/users/MyonKeminta/orgs","repos_url":"https://api.github.com/users/MyonKeminta/repos","events_url":"https://api.github.com/users/MyonKeminta/events{/privacy}","received_events_url":"https://api.github.com/users/MyonKeminta/received_events","type":"User","site_admin":false},"labels":[{"id":1153365387,"node_id":"MDU6TGFiZWwxMTUzMzY1Mzg3","url":"https://api.github.com/repos/pingcap/tidb/labels/component/transaction-need-LGT3","name":"component/transaction-need-LGT3","color":"83e2d1","default":false},{"id":630229257,"node_id":"MDU6TGFiZWw2MzAyMjkyNTc=","url":"https://api.github.com/repos/pingcap/tidb/labels/type/bug-fix","name":"type/bug-fix","color":"fc2929","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-19T07:26:12Z","updated_at":"2018-12-20T08:04:47Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/pingcap/tidb/pulls/8745","html_url":"https://github.com/pingcap/tidb/pull/8745","diff_url":"https://github.com/pingcap/tidb/pull/8745.diff","patch_url":"https://github.com/pingcap/tidb/pull/8745.patch"},"body":"<!--\r\nThank you for contributing to TiDB! Please read TiDB's [CONTRIBUTING](https://github.com/pingcap/tidb/blob/master/CONTRIBUTING.md) document **BEFORE** filing this PR.\r\n-->\r\n\r\n### What problem does this PR solve? <!--add issue link with summary if exists-->\r\n\r\ngc_worker saves some times in mysql.tidb. These times are: `tikv_gc_safe_point`, `tikv_gc_last_run_time`, `tikv_gc_leader_lease`.\r\n\r\nNow our format is `20060102-15:04:05 -0700 MST`. The time zone is specified twice by `\"-0700\"` and `\"MST\"`. This seems to be ok, but unfortunately it caused a problem: in some environments, it can't get a timezone name properly, only to produce something like `\"20181218-19:53:37 +0800 +08\"`. Then if we try to load it from the table, we will get an error when parsing the string, which says `cannot parse \"+08\" as \"MST\"`.\r\n\r\nThis PR tries to solve this problem by deprecating the last field `\"MST\"`, but still be able to load the time with the old format.\r\n\r\n### What is changed and how it works?\r\n\r\nA function named `ParseTimeFromPrefix` was added. It tries to parse a time with specified format from a prefix of a given string, and the string should contain a space that separate the prefix and the rest of the string. So when we use this function to parse the string `\"20181218-19:53:37 +0800 +08\"` or `\"20181218-19:53:37 +0800 CST\"` with the format `\"20060102-15:04:05 -0700\"`, we actually ignored the last `\"+08\"` or `\"CST\"`. So it's compatible with old format.\r\n\r\n### Check List <!--REMOVE the items that are not applicable-->\r\n\r\nTests <!-- At least one of them must be included. -->\r\n\r\n - Unit test\r\n\r\nCode changes\r\n\r\n - Has exported function/method change\r\n   - util/misc.go: added function `ParseTimeFromPrefix`\r\n - Has persistent data change\r\n   - The format of times in mysql.tidb is changed from `20060102-15:04:05 -0700 MST` to `20060102-15:04:05 -0700`\r\n\r\nSide effects\r\n\r\n- No\r\n\r\nRelated changes\r\n\r\n - Need to cherry-pick to the release branch\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/pingcap/tidb/8745)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/pingcap/tidb/issues/comments/448908436","html_url":"https://github.com/pingcap/tidb/pull/8745#issuecomment-448908436","issue_url":"https://api.github.com/repos/pingcap/tidb/issues/8745","id":448908436,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODkwODQzNg==","user":{"login":"zhexuany","id":13320708,"node_id":"MDQ6VXNlcjEzMzIwNzA4","avatar_url":"https://avatars0.githubusercontent.com/u/13320708?v=4","gravatar_id":"","url":"https://api.github.com/users/zhexuany","html_url":"https://github.com/zhexuany","followers_url":"https://api.github.com/users/zhexuany/followers","following_url":"https://api.github.com/users/zhexuany/following{/other_user}","gists_url":"https://api.github.com/users/zhexuany/gists{/gist_id}","starred_url":"https://api.github.com/users/zhexuany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhexuany/subscriptions","organizations_url":"https://api.github.com/users/zhexuany/orgs","repos_url":"https://api.github.com/users/zhexuany/repos","events_url":"https://api.github.com/users/zhexuany/events{/privacy}","received_events_url":"https://api.github.com/users/zhexuany/received_events","type":"User","site_admin":false},"created_at":"2018-12-20T08:04:47Z","updated_at":"2018-12-20T08:04:47Z","author_association":"MEMBER","body":"@MyonKeminta Please fix ci"}}
{"actor":{"display_login":"zhexuany"}}