{"action":"created","issue":{"url":"https://api.github.com/repos/pingcap/tidb/issues/6548","repository_url":"https://api.github.com/repos/pingcap/tidb","labels_url":"https://api.github.com/repos/pingcap/tidb/issues/6548/labels{/name}","comments_url":"https://api.github.com/repos/pingcap/tidb/issues/6548/comments","events_url":"https://api.github.com/repos/pingcap/tidb/issues/6548/events","html_url":"https://github.com/pingcap/tidb/pull/6548","id":322697545,"number":6548,"title":"binloginfo: fix a data race on global.Config() in the unit test","user":{"login":"tiancaiamao","id":1420062,"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},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-14T07:15:09Z","updated_at":"2018-05-14T07:42:56Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/pingcap/tidb/pulls/6548","html_url":"https://github.com/pingcap/tidb/pull/6548","diff_url":"https://github.com/pingcap/tidb/pull/6548.diff","patch_url":"https://github.com/pingcap/tidb/pull/6548.patch"},"body":"```\r\nWARNING: DATA RACE\r\nRead at 0x000002591538 by goroutine 20:\r\n  github.com/pingcap/tidb/sessionctx/binloginfo.(*BinlogInfo).WriteBinlog()\r\n      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/sessionctx/binloginfo/binloginfo.go:118 +0x667\r\n  github.com/pingcap/tidb/store/tikv.(*twoPhaseCommitter).writeFinishBinlog.func1()\r\n      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/store/tikv/2pc.go:683 +0x6b\r\n\r\nPrevious write at 0x000002591538 by goroutine 53:\r\n  github.com/pingcap/tidb/sessionctx/binloginfo_test.(*testBinlogSuite).TestIgnoreError()\r\n      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/sessionctx/binloginfo/binloginfo_test.go:395 +0x499\r\n  github.com/pingcap/tidb/util/testkit.(*TestKit).Exec()\r\n      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:130 +0x133\r\n  github.com/pingcap/tidb/util/testkit.(*TestKit).MustExec()\r\n      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:159 +0x91\r\n  github.com/pingcap/tidb/sessionctx/binloginfo_test.(*testBinlogSuite).TestIgnoreError()\r\n      /home/jenkins/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/sessionctx/binloginfo/binloginfo_test.go:378 +0x275\r\n  github.com/pingcap/tidb/sessionctx/binloginfo_test.(*testBinlogSuite).TestIgnoreError()\r\n```\r\n\r\nI should make a atomic variable, rather than operate on config.Binlog directly.\r\n\r\n```\r\ngoroutine1:\r\n       \tcfg := config.GetGlobalConfig()\r\n\tif cfg.Binlog.IgnoreError {\r\n\r\ngoroutine2 (in test code):\r\n\r\n\tcfg := config.GetGlobalConfig()\r\n\tcfg.Binlog.IgnoreError = true\r\n```\r\n\r\nI'll update https://github.com/pingcap/tidb/pull/6546 when this is merged.\r\n\r\n@coocood @shenli "},"comment":{"url":"https://api.github.com/repos/pingcap/tidb/issues/comments/388725730","html_url":"https://github.com/pingcap/tidb/pull/6548#issuecomment-388725730","issue_url":"https://api.github.com/repos/pingcap/tidb/issues/6548","id":388725730,"user":{"login":"coocood","id":891222,"avatar_url":"https://avatars0.githubusercontent.com/u/891222?v=4","gravatar_id":"","url":"https://api.github.com/users/coocood","html_url":"https://github.com/coocood","followers_url":"https://api.github.com/users/coocood/followers","following_url":"https://api.github.com/users/coocood/following{/other_user}","gists_url":"https://api.github.com/users/coocood/gists{/gist_id}","starred_url":"https://api.github.com/users/coocood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coocood/subscriptions","organizations_url":"https://api.github.com/users/coocood/orgs","repos_url":"https://api.github.com/users/coocood/repos","events_url":"https://api.github.com/users/coocood/events{/privacy}","received_events_url":"https://api.github.com/users/coocood/received_events","type":"User","site_admin":false},"created_at":"2018-05-14T07:42:56Z","updated_at":"2018-05-14T07:42:56Z","author_association":"MEMBER","body":"ignoreError is a config, erroStopped is a state, why should they share the same flag?"}}
{"actor":{"display_login":"coocood"}}