{"action":"created","comment":{"url":"https://api.github.com/repos/pingcap/tidb/pulls/comments/217298313","pull_request_review_id":154963996,"id":217298313,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNzI5ODMxMw==","diff_hunk":"@@ -0,0 +1,160 @@\n+// Copyright 2017 PingCAP, Inc.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package timeutil\n+\n+import (\n+\t\"errors\"\n+\t\"fmt\"\n+\t\"os\"\n+\t\"path/filepath\"\n+\t\"strings\"\n+\t\"sync\"\n+\t\"syscall\"\n+\t\"time\"\n+\n+\tlog \"github.com/sirupsen/logrus\"\n+)\n+\n+// init initializes `locCache`.\n+func init() {\n+\t// We need set LocalStr when it is in testing process.\n+\tif LocalStr == \"\" {\n+\t\tLocalStr = \"System\"\n+\t}\n+\tLocCache = &locCache{}\n+\tLocCache.locMap = make(map[string]*time.Location)\n+}\n+\n+// LocCache is a simple cache policy to improve the performance of 'time.LoadLocation'.\n+var LocCache *locCache","path":"util/timeutil/time.go","position":40,"original_position":40,"commit_id":"49454d55fbfebe59895f7cd14f18abe6143ce49d","original_commit_id":"49454d55fbfebe59895f7cd14f18abe6143ce49d","user":{"login":"tiancaiamao","id":1420062,"node_id":"MDQ6VXNlcjE0MjAwNjI=","avatar_url":"https://avatars2.githubusercontent.com/u/1420062?v=4","gravatar_id":"","url":"https://api.github.com/users/tiancaiamao","html_url":"https://github.com/tiancaiamao","followers_url":"https://api.github.com/users/tiancaiamao/followers","following_url":"https://api.github.com/users/tiancaiamao/following{/other_user}","gists_url":"https://api.github.com/users/tiancaiamao/gists{/gist_id}","starred_url":"https://api.github.com/users/tiancaiamao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiancaiamao/subscriptions","organizations_url":"https://api.github.com/users/tiancaiamao/orgs","repos_url":"https://api.github.com/users/tiancaiamao/repos","events_url":"https://api.github.com/users/tiancaiamao/events{/privacy}","received_events_url":"https://api.github.com/users/tiancaiamao/received_events","type":"User","site_admin":false},"body":"Is it necessary to expose this variable ?","created_at":"2018-09-13T08:21:10Z","updated_at":"2018-09-13T08:49:51Z","html_url":"https://github.com/pingcap/tidb/pull/7638#discussion_r217298313","pull_request_url":"https://api.github.com/repos/pingcap/tidb/pulls/7638","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/comments/217298313"},"html":{"href":"https://github.com/pingcap/tidb/pull/7638#discussion_r217298313"},"pull_request":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/7638"}}},"pull_request":{"url":"https://api.github.com/repos/pingcap/tidb/pulls/7638","id":213815437,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzODE1NDM3","html_url":"https://github.com/pingcap/tidb/pull/7638","diff_url":"https://github.com/pingcap/tidb/pull/7638.diff","patch_url":"https://github.com/pingcap/tidb/pull/7638.patch","issue_url":"https://api.github.com/repos/pingcap/tidb/issues/7638","number":7638,"state":"open","locked":false,"title":"store/mocktikv: get tz name from zoneinfo","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},"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\nIt retrieves real IANA timezone name when the location is local. This can avoid the performance delegation on TiKV side. \r\n### What is changed and how it works?\r\nWe need first get the soft link from `/etc/localtime`. And then check whether the soft link path contains `share/zoneinfo` or not. If yes, we get the real IANA timezone name from this path.\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\nSide effects\r\n\r\nRelated changes\r\n - Need to be included in the release note\r\n","created_at":"2018-09-07T04:47:08Z","updated_at":"2018-09-13T08:49:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c09c3bd81c09ea18623678205d5cc4c6859c1f28","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":578476531,"node_id":"MDU6TGFiZWw1Nzg0NzY1MzE=","url":"https://api.github.com/repos/pingcap/tidb/labels/component/coprocessor","name":"component/coprocessor","color":"bfd4f2","default":false},{"id":660753991,"node_id":"MDU6TGFiZWw2NjA3NTM5OTE=","url":"https://api.github.com/repos/pingcap/tidb/labels/priority/release-blocker","name":"priority/release-blocker","color":"b60205","default":false},{"id":770872605,"node_id":"MDU6TGFiZWw3NzA4NzI2MDU=","url":"https://api.github.com/repos/pingcap/tidb/labels/status/all%20tests%20passed","name":"status/all tests passed","color":"2cbe4e","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/pingcap/tidb/pulls/7638/commits","review_comments_url":"https://api.github.com/repos/pingcap/tidb/pulls/7638/comments","review_comment_url":"https://api.github.com/repos/pingcap/tidb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pingcap/tidb/issues/7638/comments","statuses_url":"https://api.github.com/repos/pingcap/tidb/statuses/49454d55fbfebe59895f7cd14f18abe6143ce49d","head":{"label":"zhexuany:get_tz_name_from_zoneinfo","ref":"get_tz_name_from_zoneinfo","sha":"49454d55fbfebe59895f7cd14f18abe6143ce49d","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},"repo":{"id":79155321,"node_id":"MDEwOlJlcG9zaXRvcnk3OTE1NTMyMQ==","name":"tidb","full_name":"zhexuany/tidb","owner":{"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},"private":false,"html_url":"https://github.com/zhexuany/tidb","description":"TiDB is a distributed NewSQL database compatible with MySQL protocol ","fork":true,"url":"https://api.github.com/repos/zhexuany/tidb","forks_url":"https://api.github.com/repos/zhexuany/tidb/forks","keys_url":"https://api.github.com/repos/zhexuany/tidb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zhexuany/tidb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zhexuany/tidb/teams","hooks_url":"https://api.github.com/repos/zhexuany/tidb/hooks","issue_events_url":"https://api.github.com/repos/zhexuany/tidb/issues/events{/number}","events_url":"https://api.github.com/repos/zhexuany/tidb/events","assignees_url":"https://api.github.com/repos/zhexuany/tidb/assignees{/user}","branches_url":"https://api.github.com/repos/zhexuany/tidb/branches{/branch}","tags_url":"https://api.github.com/repos/zhexuany/tidb/tags","blobs_url":"https://api.github.com/repos/zhexuany/tidb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zhexuany/tidb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zhexuany/tidb/git/refs{/sha}","trees_url":"https://api.github.com/repos/zhexuany/tidb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zhexuany/tidb/statuses/{sha}","languages_url":"https://api.github.com/repos/zhexuany/tidb/languages","stargazers_url":"https://api.github.com/repos/zhexuany/tidb/stargazers","contributors_url":"https://api.github.com/repos/zhexuany/tidb/contributors","subscribers_url":"https://api.github.com/repos/zhexuany/tidb/subscribers","subscription_url":"https://api.github.com/repos/zhexuany/tidb/subscription","commits_url":"https://api.github.com/repos/zhexuany/tidb/commits{/sha}","git_commits_url":"https://api.github.com/repos/zhexuany/tidb/git/commits{/sha}","comments_url":"https://api.github.com/repos/zhexuany/tidb/comments{/number}","issue_comment_url":"https://api.github.com/repos/zhexuany/tidb/issues/comments{/number}","contents_url":"https://api.github.com/repos/zhexuany/tidb/contents/{+path}","compare_url":"https://api.github.com/repos/zhexuany/tidb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zhexuany/tidb/merges","archive_url":"https://api.github.com/repos/zhexuany/tidb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zhexuany/tidb/downloads","issues_url":"https://api.github.com/repos/zhexuany/tidb/issues{/number}","pulls_url":"https://api.github.com/repos/zhexuany/tidb/pulls{/number}","milestones_url":"https://api.github.com/repos/zhexuany/tidb/milestones{/number}","notifications_url":"https://api.github.com/repos/zhexuany/tidb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zhexuany/tidb/labels{/name}","releases_url":"https://api.github.com/repos/zhexuany/tidb/releases{/id}","deployments_url":"https://api.github.com/repos/zhexuany/tidb/deployments","created_at":"2017-01-16T20:11:14Z","updated_at":"2017-01-16T20:11:19Z","pushed_at":"2018-09-13T06:03:25Z","git_url":"git://github.com/zhexuany/tidb.git","ssh_url":"git@github.com:zhexuany/tidb.git","clone_url":"https://github.com/zhexuany/tidb.git","svn_url":"https://github.com/zhexuany/tidb","homepage":"","size":55539,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pingcap:master","ref":"master","sha":"cb03f2bec151033a38dfd17715a42cf3728b0541","user":{"login":"pingcap","id":11855343,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExODU1MzQz","avatar_url":"https://avatars3.githubusercontent.com/u/11855343?v=4","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":41986369,"node_id":"MDEwOlJlcG9zaXRvcnk0MTk4NjM2OQ==","name":"tidb","full_name":"pingcap/tidb","owner":{"login":"pingcap","id":11855343,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExODU1MzQz","avatar_url":"https://avatars3.githubusercontent.com/u/11855343?v=4","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/tidb","description":"TiDB is a distributed HTAP database compatible with the MySQL protocol ","fork":false,"url":"https://api.github.com/repos/pingcap/tidb","forks_url":"https://api.github.com/repos/pingcap/tidb/forks","keys_url":"https://api.github.com/repos/pingcap/tidb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/tidb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/tidb/teams","hooks_url":"https://api.github.com/repos/pingcap/tidb/hooks","issue_events_url":"https://api.github.com/repos/pingcap/tidb/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/tidb/events","assignees_url":"https://api.github.com/repos/pingcap/tidb/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/tidb/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/tidb/tags","blobs_url":"https://api.github.com/repos/pingcap/tidb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/tidb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/tidb/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/tidb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/tidb/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/tidb/languages","stargazers_url":"https://api.github.com/repos/pingcap/tidb/stargazers","contributors_url":"https://api.github.com/repos/pingcap/tidb/contributors","subscribers_url":"https://api.github.com/repos/pingcap/tidb/subscribers","subscription_url":"https://api.github.com/repos/pingcap/tidb/subscription","commits_url":"https://api.github.com/repos/pingcap/tidb/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/tidb/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/tidb/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/tidb/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/tidb/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/tidb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/tidb/merges","archive_url":"https://api.github.com/repos/pingcap/tidb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/tidb/downloads","issues_url":"https://api.github.com/repos/pingcap/tidb/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/tidb/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/tidb/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/tidb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/tidb/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/tidb/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/tidb/deployments","created_at":"2015-09-06T04:01:52Z","updated_at":"2018-09-13T08:47:49Z","pushed_at":"2018-09-13T08:32:54Z","git_url":"git://github.com/pingcap/tidb.git","ssh_url":"git@github.com:pingcap/tidb.git","clone_url":"https://github.com/pingcap/tidb.git","svn_url":"https://github.com/pingcap/tidb","homepage":"https://pingcap.com","size":82102,"stargazers_count":14895,"watchers_count":14895,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2092,"mirror_url":null,"archived":false,"open_issues_count":541,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2092,"open_issues":541,"watchers":14895,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/7638"},"html":{"href":"https://github.com/pingcap/tidb/pull/7638"},"issue":{"href":"https://api.github.com/repos/pingcap/tidb/issues/7638"},"comments":{"href":"https://api.github.com/repos/pingcap/tidb/issues/7638/comments"},"review_comments":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/7638/comments"},"review_comment":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pingcap/tidb/pulls/7638/commits"},"statuses":{"href":"https://api.github.com/repos/pingcap/tidb/statuses/49454d55fbfebe59895f7cd14f18abe6143ce49d"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"tiancaiamao"}}