{"action":"created","comment":{"url":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls/comments/51427849","id":51427849,"diff_hunk":"@@ -918,7 +918,18 @@ func scrapeGlobalVariables(db *sql.DB, ch chan<- prometheus.Metric) error {\n }\n \n func scrapeSlaveStatus(db *sql.DB, ch chan<- prometheus.Metric) error {\n-\tslaveStatusRows, err := db.Query(slaveStatusQuery)\n+\tvar (\n+\t\tslaveStatusRows *sql.Rows\n+\t\terr error\n+\t)\n+\t// Leverage lock-free SHOW SLAVE STATUS by guessing the right suffix\n+\tquerySuffixes := []string{\" NONBLOCKING\", \" NOLOCK\", \" \"}","path":"mysqld_exporter.go","position":10,"original_position":10,"commit_id":"4c6a85bc6c5a71073dc28d82b12aa101ee47b71b","original_commit_id":"4c6a85bc6c5a71073dc28d82b12aa101ee47b71b","user":{"login":"SuperQ","id":1320667,"avatar_url":"https://avatars.githubusercontent.com/u/1320667?v=3","gravatar_id":"","url":"https://api.github.com/users/SuperQ","html_url":"https://github.com/SuperQ","followers_url":"https://api.github.com/users/SuperQ/followers","following_url":"https://api.github.com/users/SuperQ/following{/other_user}","gists_url":"https://api.github.com/users/SuperQ/gists{/gist_id}","starred_url":"https://api.github.com/users/SuperQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SuperQ/subscriptions","organizations_url":"https://api.github.com/users/SuperQ/orgs","repos_url":"https://api.github.com/users/SuperQ/repos","events_url":"https://api.github.com/users/SuperQ/events{/privacy}","received_events_url":"https://api.github.com/users/SuperQ/received_events","type":"User","site_admin":false},"body":"Actually, this querySuffixes can be moved to a global const.  Maybe `slaveStatusQuerySuffixes`","created_at":"2016-02-01T15:03:04Z","updated_at":"2016-02-01T15:03:04Z","html_url":"https://github.com/prometheus/mysqld_exporter/pull/61#discussion_r51427849","pull_request_url":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls/61","_links":{"self":{"href":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls/comments/51427849"},"html":{"href":"https://github.com/prometheus/mysqld_exporter/pull/61#discussion_r51427849"},"pull_request":{"href":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls/61"}}},"pull_request":{"url":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls/61","id":56164571,"html_url":"https://github.com/prometheus/mysqld_exporter/pull/61","diff_url":"https://github.com/prometheus/mysqld_exporter/pull/61.diff","patch_url":"https://github.com/prometheus/mysqld_exporter/pull/61.patch","issue_url":"https://api.github.com/repos/prometheus/mysqld_exporter/issues/61","number":61,"state":"open","locked":false,"title":"Leverage lock-free SHOW SLAVE STATUS","user":{"login":"roman-vynar","id":2220941,"avatar_url":"https://avatars.githubusercontent.com/u/2220941?v=3","gravatar_id":"","url":"https://api.github.com/users/roman-vynar","html_url":"https://github.com/roman-vynar","followers_url":"https://api.github.com/users/roman-vynar/followers","following_url":"https://api.github.com/users/roman-vynar/following{/other_user}","gists_url":"https://api.github.com/users/roman-vynar/gists{/gist_id}","starred_url":"https://api.github.com/users/roman-vynar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roman-vynar/subscriptions","organizations_url":"https://api.github.com/users/roman-vynar/orgs","repos_url":"https://api.github.com/users/roman-vynar/repos","events_url":"https://api.github.com/users/roman-vynar/events{/privacy}","received_events_url":"https://api.github.com/users/roman-vynar/received_events","type":"User","site_admin":false},"body":"Leverage lock-free `SHOW SLAVE STATUS` by choosing the right suffix on the first run and than using it on the next queries.\r\n\r\n[Percona Server 5.5] (https://www.percona.com/doc/percona-server/5.5/reliability/show_slave_status_nolock.html) supports non-blocking `SHOW SLAVE STATUS NOLOCK`.\r\n[Percona Server 5.6] (https://www.percona.com/doc/percona-server/5.6/reliability/show_slave_status_nolock.html) supports non-blocking `SHOW SLAVE STATUS NOLOCK` as well as `SHOW SLAVE STATUS NONBLOCKING` to match initial MySQL 5.7.\r\n[Oracle MySQL 5.7] (http://dev.mysql.com/doc/refman/5.7/en/show-slave-status.html) initially supported `SHOW SLAVE STATUS NONBLOCKING`. As of 5.7.6 they removed the suffix due to locking changes and it became unnecessary.","created_at":"2016-01-15T12:40:04Z","updated_at":"2016-02-01T15:03:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"880450447573b71f976039c2f2137f0edd2d10e2","assignee":{"login":"SuperQ","id":1320667,"avatar_url":"https://avatars.githubusercontent.com/u/1320667?v=3","gravatar_id":"","url":"https://api.github.com/users/SuperQ","html_url":"https://github.com/SuperQ","followers_url":"https://api.github.com/users/SuperQ/followers","following_url":"https://api.github.com/users/SuperQ/following{/other_user}","gists_url":"https://api.github.com/users/SuperQ/gists{/gist_id}","starred_url":"https://api.github.com/users/SuperQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SuperQ/subscriptions","organizations_url":"https://api.github.com/users/SuperQ/orgs","repos_url":"https://api.github.com/users/SuperQ/repos","events_url":"https://api.github.com/users/SuperQ/events{/privacy}","received_events_url":"https://api.github.com/users/SuperQ/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls/61/commits","review_comments_url":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls/61/comments","review_comment_url":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prometheus/mysqld_exporter/issues/61/comments","statuses_url":"https://api.github.com/repos/prometheus/mysqld_exporter/statuses/4c6a85bc6c5a71073dc28d82b12aa101ee47b71b","head":{"label":"roman-vynar:master","ref":"master","sha":"4c6a85bc6c5a71073dc28d82b12aa101ee47b71b","user":{"login":"roman-vynar","id":2220941,"avatar_url":"https://avatars.githubusercontent.com/u/2220941?v=3","gravatar_id":"","url":"https://api.github.com/users/roman-vynar","html_url":"https://github.com/roman-vynar","followers_url":"https://api.github.com/users/roman-vynar/followers","following_url":"https://api.github.com/users/roman-vynar/following{/other_user}","gists_url":"https://api.github.com/users/roman-vynar/gists{/gist_id}","starred_url":"https://api.github.com/users/roman-vynar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roman-vynar/subscriptions","organizations_url":"https://api.github.com/users/roman-vynar/orgs","repos_url":"https://api.github.com/users/roman-vynar/repos","events_url":"https://api.github.com/users/roman-vynar/events{/privacy}","received_events_url":"https://api.github.com/users/roman-vynar/received_events","type":"User","site_admin":false},"repo":{"id":40642220,"name":"mysqld_exporter","full_name":"roman-vynar/mysqld_exporter","owner":{"login":"roman-vynar","id":2220941,"avatar_url":"https://avatars.githubusercontent.com/u/2220941?v=3","gravatar_id":"","url":"https://api.github.com/users/roman-vynar","html_url":"https://github.com/roman-vynar","followers_url":"https://api.github.com/users/roman-vynar/followers","following_url":"https://api.github.com/users/roman-vynar/following{/other_user}","gists_url":"https://api.github.com/users/roman-vynar/gists{/gist_id}","starred_url":"https://api.github.com/users/roman-vynar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roman-vynar/subscriptions","organizations_url":"https://api.github.com/users/roman-vynar/orgs","repos_url":"https://api.github.com/users/roman-vynar/repos","events_url":"https://api.github.com/users/roman-vynar/events{/privacy}","received_events_url":"https://api.github.com/users/roman-vynar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/roman-vynar/mysqld_exporter","description":"Exporter for MySQL server metrics","fork":true,"url":"https://api.github.com/repos/roman-vynar/mysqld_exporter","forks_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/forks","keys_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/teams","hooks_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/hooks","issue_events_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/issues/events{/number}","events_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/events","assignees_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/assignees{/user}","branches_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/branches{/branch}","tags_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/tags","blobs_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/git/refs{/sha}","trees_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/statuses/{sha}","languages_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/languages","stargazers_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/stargazers","contributors_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/contributors","subscribers_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/subscribers","subscription_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/subscription","commits_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/commits{/sha}","git_commits_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/git/commits{/sha}","comments_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/comments{/number}","issue_comment_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/issues/comments{/number}","contents_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/contents/{+path}","compare_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/merges","archive_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/downloads","issues_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/issues{/number}","pulls_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/pulls{/number}","milestones_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/milestones{/number}","notifications_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/labels{/name}","releases_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/releases{/id}","deployments_url":"https://api.github.com/repos/roman-vynar/mysqld_exporter/deployments","created_at":"2015-08-13T06:19:28Z","updated_at":"2016-02-01T14:54:22Z","pushed_at":"2016-02-01T14:55:00Z","git_url":"git://github.com/roman-vynar/mysqld_exporter.git","ssh_url":"git@github.com:roman-vynar/mysqld_exporter.git","clone_url":"https://github.com/roman-vynar/mysqld_exporter.git","svn_url":"https://github.com/roman-vynar/mysqld_exporter","homepage":"http://prometheus.io/","size":110,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"prometheus:master","ref":"master","sha":"637415b90cfdf6a0c159d5dd42e0727502f2cd50","user":{"login":"prometheus","id":3380462,"avatar_url":"https://avatars.githubusercontent.com/u/3380462?v=3","gravatar_id":"","url":"https://api.github.com/users/prometheus","html_url":"https://github.com/prometheus","followers_url":"https://api.github.com/users/prometheus/followers","following_url":"https://api.github.com/users/prometheus/following{/other_user}","gists_url":"https://api.github.com/users/prometheus/gists{/gist_id}","starred_url":"https://api.github.com/users/prometheus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prometheus/subscriptions","organizations_url":"https://api.github.com/users/prometheus/orgs","repos_url":"https://api.github.com/users/prometheus/repos","events_url":"https://api.github.com/users/prometheus/events{/privacy}","received_events_url":"https://api.github.com/users/prometheus/received_events","type":"Organization","site_admin":false},"repo":{"id":32075541,"name":"mysqld_exporter","full_name":"prometheus/mysqld_exporter","owner":{"login":"prometheus","id":3380462,"avatar_url":"https://avatars.githubusercontent.com/u/3380462?v=3","gravatar_id":"","url":"https://api.github.com/users/prometheus","html_url":"https://github.com/prometheus","followers_url":"https://api.github.com/users/prometheus/followers","following_url":"https://api.github.com/users/prometheus/following{/other_user}","gists_url":"https://api.github.com/users/prometheus/gists{/gist_id}","starred_url":"https://api.github.com/users/prometheus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prometheus/subscriptions","organizations_url":"https://api.github.com/users/prometheus/orgs","repos_url":"https://api.github.com/users/prometheus/repos","events_url":"https://api.github.com/users/prometheus/events{/privacy}","received_events_url":"https://api.github.com/users/prometheus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prometheus/mysqld_exporter","description":"Exporter for MySQL server metrics","fork":false,"url":"https://api.github.com/repos/prometheus/mysqld_exporter","forks_url":"https://api.github.com/repos/prometheus/mysqld_exporter/forks","keys_url":"https://api.github.com/repos/prometheus/mysqld_exporter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prometheus/mysqld_exporter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prometheus/mysqld_exporter/teams","hooks_url":"https://api.github.com/repos/prometheus/mysqld_exporter/hooks","issue_events_url":"https://api.github.com/repos/prometheus/mysqld_exporter/issues/events{/number}","events_url":"https://api.github.com/repos/prometheus/mysqld_exporter/events","assignees_url":"https://api.github.com/repos/prometheus/mysqld_exporter/assignees{/user}","branches_url":"https://api.github.com/repos/prometheus/mysqld_exporter/branches{/branch}","tags_url":"https://api.github.com/repos/prometheus/mysqld_exporter/tags","blobs_url":"https://api.github.com/repos/prometheus/mysqld_exporter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prometheus/mysqld_exporter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prometheus/mysqld_exporter/git/refs{/sha}","trees_url":"https://api.github.com/repos/prometheus/mysqld_exporter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prometheus/mysqld_exporter/statuses/{sha}","languages_url":"https://api.github.com/repos/prometheus/mysqld_exporter/languages","stargazers_url":"https://api.github.com/repos/prometheus/mysqld_exporter/stargazers","contributors_url":"https://api.github.com/repos/prometheus/mysqld_exporter/contributors","subscribers_url":"https://api.github.com/repos/prometheus/mysqld_exporter/subscribers","subscription_url":"https://api.github.com/repos/prometheus/mysqld_exporter/subscription","commits_url":"https://api.github.com/repos/prometheus/mysqld_exporter/commits{/sha}","git_commits_url":"https://api.github.com/repos/prometheus/mysqld_exporter/git/commits{/sha}","comments_url":"https://api.github.com/repos/prometheus/mysqld_exporter/comments{/number}","issue_comment_url":"https://api.github.com/repos/prometheus/mysqld_exporter/issues/comments{/number}","contents_url":"https://api.github.com/repos/prometheus/mysqld_exporter/contents/{+path}","compare_url":"https://api.github.com/repos/prometheus/mysqld_exporter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prometheus/mysqld_exporter/merges","archive_url":"https://api.github.com/repos/prometheus/mysqld_exporter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prometheus/mysqld_exporter/downloads","issues_url":"https://api.github.com/repos/prometheus/mysqld_exporter/issues{/number}","pulls_url":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls{/number}","milestones_url":"https://api.github.com/repos/prometheus/mysqld_exporter/milestones{/number}","notifications_url":"https://api.github.com/repos/prometheus/mysqld_exporter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prometheus/mysqld_exporter/labels{/name}","releases_url":"https://api.github.com/repos/prometheus/mysqld_exporter/releases{/id}","deployments_url":"https://api.github.com/repos/prometheus/mysqld_exporter/deployments","created_at":"2015-03-12T12:23:48Z","updated_at":"2016-01-31T11:56:20Z","pushed_at":"2016-02-01T13:57:43Z","git_url":"git://github.com/prometheus/mysqld_exporter.git","ssh_url":"git@github.com:prometheus/mysqld_exporter.git","clone_url":"https://github.com/prometheus/mysqld_exporter.git","svn_url":"https://github.com/prometheus/mysqld_exporter","homepage":"http://prometheus.io/","size":174,"stargazers_count":22,"watchers_count":22,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":13,"forks":14,"open_issues":13,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls/61"},"html":{"href":"https://github.com/prometheus/mysqld_exporter/pull/61"},"issue":{"href":"https://api.github.com/repos/prometheus/mysqld_exporter/issues/61"},"comments":{"href":"https://api.github.com/repos/prometheus/mysqld_exporter/issues/61/comments"},"review_comments":{"href":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls/61/comments"},"review_comment":{"href":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prometheus/mysqld_exporter/pulls/61/commits"},"statuses":{"href":"https://api.github.com/repos/prometheus/mysqld_exporter/statuses/4c6a85bc6c5a71073dc28d82b12aa101ee47b71b"}}}}