{"action":"created","comment":{"url":"https://api.github.com/repos/percona/percona-server/pulls/comments/92578056","pull_request_review_id":13095078,"id":92578056,"diff_hunk":"@@ -2082,6 +2082,18 @@ bool MYSQL_QUERY_LOG::write(THD *thd, ulonglong current_utime,\n #if defined(ENABLED_PROFILING)\n     thd->profiling.print_current(&log_file);\n #endif\n+    if ((thd->variables.log_slow_verbosity & (1ULL << SLOG_V_MICROTIME))\n+        && thd->trx_start_utime)\n+    {\n+        char buf[30];\n+        snprintf(buf, 30, \"%lX%llX\", thd->thread_id, thd->trx_start_utime);\n+        if (!(thd->server_status & SERVER_STATUS_IN_TRANS))\n+            thd->trx_start_utime= 0;\n+        if (my_b_printf(&log_file,\n+                    \"# Trx_id: %s\\n\", buf) == (uint) -1)","path":"sql/log.cc","position":12,"original_position":12,"commit_id":"d51c97aa921d4be2dc2d2f503dfe9c889163993b","original_commit_id":"d51c97aa921d4be2dc2d2f503dfe9c889163993b","user":{"login":"laurynas-biveinis","id":58894,"avatar_url":"https://avatars.githubusercontent.com/u/58894?v=3","gravatar_id":"","url":"https://api.github.com/users/laurynas-biveinis","html_url":"https://github.com/laurynas-biveinis","followers_url":"https://api.github.com/users/laurynas-biveinis/followers","following_url":"https://api.github.com/users/laurynas-biveinis/following{/other_user}","gists_url":"https://api.github.com/users/laurynas-biveinis/gists{/gist_id}","starred_url":"https://api.github.com/users/laurynas-biveinis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laurynas-biveinis/subscriptions","organizations_url":"https://api.github.com/users/laurynas-biveinis/orgs","repos_url":"https://api.github.com/users/laurynas-biveinis/repos","events_url":"https://api.github.com/users/laurynas-biveinis/events{/privacy}","received_events_url":"https://api.github.com/users/laurynas-biveinis/received_events","type":"User","site_admin":false},"body":"We end up with two trx ids, innodb one, and thread id. Probably it's better to implement the InnoDB trx id for \"COMMIT\", and nothing for \"BEGIN\" (maybe in some cases BEGIN gets InnoDB trx id - what about \"WITH CONSISTENT SNAPSHOT\"?)","created_at":"2016-12-15T10:05:26Z","updated_at":"2016-12-15T10:05:42Z","html_url":"https://github.com/percona/percona-server/pull/1243#discussion_r92578056","pull_request_url":"https://api.github.com/repos/percona/percona-server/pulls/1243","_links":{"self":{"href":"https://api.github.com/repos/percona/percona-server/pulls/comments/92578056"},"html":{"href":"https://github.com/percona/percona-server/pull/1243#discussion_r92578056"},"pull_request":{"href":"https://api.github.com/repos/percona/percona-server/pulls/1243"}}},"pull_request":{"url":"https://api.github.com/repos/percona/percona-server/pulls/1243","id":98088430,"html_url":"https://github.com/percona/percona-server/pull/1243","diff_url":"https://github.com/percona/percona-server/pull/1243.diff","patch_url":"https://github.com/percona/percona-server/pull/1243.patch","issue_url":"https://api.github.com/repos/percona/percona-server/issues/1243","number":1243,"state":"open","locked":false,"title":"Log all statements in transaction with same id, lp:897715","user":{"login":"ihanick","id":207383,"avatar_url":"https://avatars.githubusercontent.com/u/207383?v=3","gravatar_id":"","url":"https://api.github.com/users/ihanick","html_url":"https://github.com/ihanick","followers_url":"https://api.github.com/users/ihanick/followers","following_url":"https://api.github.com/users/ihanick/following{/other_user}","gists_url":"https://api.github.com/users/ihanick/gists{/gist_id}","starred_url":"https://api.github.com/users/ihanick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ihanick/subscriptions","organizations_url":"https://api.github.com/users/ihanick/orgs","repos_url":"https://api.github.com/users/ihanick/repos","events_url":"https://api.github.com/users/ihanick/events{/privacy}","received_events_url":"https://api.github.com/users/ihanick/received_events","type":"User","site_admin":false},"body":"https://bugs.launchpad.net/percona-server/+bug/897715\r\nhttp://jenkins.percona.com/job/percona-server-5.6-param/\r\n\r\nI have considered to use thread_id + statement start time as a uniq identifier.\r\nOnly explicit transactions are tracked.\r\nI'm not sure if additional flag is required for log_slow_verbosity or existing one (e.g. microtime) could be used.\r\nIt could be also implemented for 5.5 in the same way.\r\n\r\nThis kind of functionality will be useful with:\r\n- find a transactions caused  metadata lock\r\n- find whole transaction (including non-innodb statements at transaction start) by thread id (from processlist) or innodb transaction id (from innodb status).\r\n- find incorrect transactions usage (set auto_commit = 0, connection pool on application side, some application threads using transactions and some expecting auto_commit=1).\r\n\r\nMysql 5.7 has thd->get_transaction()->sequence_number but it always empty.\r\n","created_at":"2016-12-15T05:15:28Z","updated_at":"2016-12-15T10:05:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"476fb502e50f27f83ce8a59d7042abb570c39dc6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/percona/percona-server/pulls/1243/commits","review_comments_url":"https://api.github.com/repos/percona/percona-server/pulls/1243/comments","review_comment_url":"https://api.github.com/repos/percona/percona-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/percona/percona-server/issues/1243/comments","statuses_url":"https://api.github.com/repos/percona/percona-server/statuses/d51c97aa921d4be2dc2d2f503dfe9c889163993b","head":{"label":"ihanick:5.6-ps-bug897715","ref":"5.6-ps-bug897715","sha":"d51c97aa921d4be2dc2d2f503dfe9c889163993b","user":{"login":"ihanick","id":207383,"avatar_url":"https://avatars.githubusercontent.com/u/207383?v=3","gravatar_id":"","url":"https://api.github.com/users/ihanick","html_url":"https://github.com/ihanick","followers_url":"https://api.github.com/users/ihanick/followers","following_url":"https://api.github.com/users/ihanick/following{/other_user}","gists_url":"https://api.github.com/users/ihanick/gists{/gist_id}","starred_url":"https://api.github.com/users/ihanick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ihanick/subscriptions","organizations_url":"https://api.github.com/users/ihanick/orgs","repos_url":"https://api.github.com/users/ihanick/repos","events_url":"https://api.github.com/users/ihanick/events{/privacy}","received_events_url":"https://api.github.com/users/ihanick/received_events","type":"User","site_admin":false},"repo":{"id":42033848,"name":"percona-server","full_name":"ihanick/percona-server","owner":{"login":"ihanick","id":207383,"avatar_url":"https://avatars.githubusercontent.com/u/207383?v=3","gravatar_id":"","url":"https://api.github.com/users/ihanick","html_url":"https://github.com/ihanick","followers_url":"https://api.github.com/users/ihanick/followers","following_url":"https://api.github.com/users/ihanick/following{/other_user}","gists_url":"https://api.github.com/users/ihanick/gists{/gist_id}","starred_url":"https://api.github.com/users/ihanick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ihanick/subscriptions","organizations_url":"https://api.github.com/users/ihanick/orgs","repos_url":"https://api.github.com/users/ihanick/repos","events_url":"https://api.github.com/users/ihanick/events{/privacy}","received_events_url":"https://api.github.com/users/ihanick/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ihanick/percona-server","description":null,"fork":true,"url":"https://api.github.com/repos/ihanick/percona-server","forks_url":"https://api.github.com/repos/ihanick/percona-server/forks","keys_url":"https://api.github.com/repos/ihanick/percona-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ihanick/percona-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ihanick/percona-server/teams","hooks_url":"https://api.github.com/repos/ihanick/percona-server/hooks","issue_events_url":"https://api.github.com/repos/ihanick/percona-server/issues/events{/number}","events_url":"https://api.github.com/repos/ihanick/percona-server/events","assignees_url":"https://api.github.com/repos/ihanick/percona-server/assignees{/user}","branches_url":"https://api.github.com/repos/ihanick/percona-server/branches{/branch}","tags_url":"https://api.github.com/repos/ihanick/percona-server/tags","blobs_url":"https://api.github.com/repos/ihanick/percona-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ihanick/percona-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ihanick/percona-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/ihanick/percona-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ihanick/percona-server/statuses/{sha}","languages_url":"https://api.github.com/repos/ihanick/percona-server/languages","stargazers_url":"https://api.github.com/repos/ihanick/percona-server/stargazers","contributors_url":"https://api.github.com/repos/ihanick/percona-server/contributors","subscribers_url":"https://api.github.com/repos/ihanick/percona-server/subscribers","subscription_url":"https://api.github.com/repos/ihanick/percona-server/subscription","commits_url":"https://api.github.com/repos/ihanick/percona-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/ihanick/percona-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/ihanick/percona-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/ihanick/percona-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/ihanick/percona-server/contents/{+path}","compare_url":"https://api.github.com/repos/ihanick/percona-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ihanick/percona-server/merges","archive_url":"https://api.github.com/repos/ihanick/percona-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ihanick/percona-server/downloads","issues_url":"https://api.github.com/repos/ihanick/percona-server/issues{/number}","pulls_url":"https://api.github.com/repos/ihanick/percona-server/pulls{/number}","milestones_url":"https://api.github.com/repos/ihanick/percona-server/milestones{/number}","notifications_url":"https://api.github.com/repos/ihanick/percona-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ihanick/percona-server/labels{/name}","releases_url":"https://api.github.com/repos/ihanick/percona-server/releases{/id}","deployments_url":"https://api.github.com/repos/ihanick/percona-server/deployments","created_at":"2015-09-07T05:52:25Z","updated_at":"2016-11-26T02:58:56Z","pushed_at":"2016-12-15T04:00:43Z","git_url":"git://github.com/ihanick/percona-server.git","ssh_url":"git@github.com:ihanick/percona-server.git","clone_url":"https://github.com/ihanick/percona-server.git","svn_url":"https://github.com/ihanick/percona-server","homepage":null,"size":522276,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"5.6"}},"base":{"label":"percona:5.6","ref":"5.6","sha":"bb4e710d933b3e13251afa87152e91454079ea1b","user":{"login":"percona","id":1683025,"avatar_url":"https://avatars.githubusercontent.com/u/1683025?v=3","gravatar_id":"","url":"https://api.github.com/users/percona","html_url":"https://github.com/percona","followers_url":"https://api.github.com/users/percona/followers","following_url":"https://api.github.com/users/percona/following{/other_user}","gists_url":"https://api.github.com/users/percona/gists{/gist_id}","starred_url":"https://api.github.com/users/percona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/percona/subscriptions","organizations_url":"https://api.github.com/users/percona/orgs","repos_url":"https://api.github.com/users/percona/repos","events_url":"https://api.github.com/users/percona/events{/privacy}","received_events_url":"https://api.github.com/users/percona/received_events","type":"Organization","site_admin":false},"repo":{"id":30753733,"name":"percona-server","full_name":"percona/percona-server","owner":{"login":"percona","id":1683025,"avatar_url":"https://avatars.githubusercontent.com/u/1683025?v=3","gravatar_id":"","url":"https://api.github.com/users/percona","html_url":"https://github.com/percona","followers_url":"https://api.github.com/users/percona/followers","following_url":"https://api.github.com/users/percona/following{/other_user}","gists_url":"https://api.github.com/users/percona/gists{/gist_id}","starred_url":"https://api.github.com/users/percona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/percona/subscriptions","organizations_url":"https://api.github.com/users/percona/orgs","repos_url":"https://api.github.com/users/percona/repos","events_url":"https://api.github.com/users/percona/events{/privacy}","received_events_url":"https://api.github.com/users/percona/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/percona/percona-server","description":"Percona Server","fork":false,"url":"https://api.github.com/repos/percona/percona-server","forks_url":"https://api.github.com/repos/percona/percona-server/forks","keys_url":"https://api.github.com/repos/percona/percona-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/percona/percona-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/percona/percona-server/teams","hooks_url":"https://api.github.com/repos/percona/percona-server/hooks","issue_events_url":"https://api.github.com/repos/percona/percona-server/issues/events{/number}","events_url":"https://api.github.com/repos/percona/percona-server/events","assignees_url":"https://api.github.com/repos/percona/percona-server/assignees{/user}","branches_url":"https://api.github.com/repos/percona/percona-server/branches{/branch}","tags_url":"https://api.github.com/repos/percona/percona-server/tags","blobs_url":"https://api.github.com/repos/percona/percona-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/percona/percona-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/percona/percona-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/percona/percona-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/percona/percona-server/statuses/{sha}","languages_url":"https://api.github.com/repos/percona/percona-server/languages","stargazers_url":"https://api.github.com/repos/percona/percona-server/stargazers","contributors_url":"https://api.github.com/repos/percona/percona-server/contributors","subscribers_url":"https://api.github.com/repos/percona/percona-server/subscribers","subscription_url":"https://api.github.com/repos/percona/percona-server/subscription","commits_url":"https://api.github.com/repos/percona/percona-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/percona/percona-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/percona/percona-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/percona/percona-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/percona/percona-server/contents/{+path}","compare_url":"https://api.github.com/repos/percona/percona-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/percona/percona-server/merges","archive_url":"https://api.github.com/repos/percona/percona-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/percona/percona-server/downloads","issues_url":"https://api.github.com/repos/percona/percona-server/issues{/number}","pulls_url":"https://api.github.com/repos/percona/percona-server/pulls{/number}","milestones_url":"https://api.github.com/repos/percona/percona-server/milestones{/number}","notifications_url":"https://api.github.com/repos/percona/percona-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/percona/percona-server/labels{/name}","releases_url":"https://api.github.com/repos/percona/percona-server/releases{/id}","deployments_url":"https://api.github.com/repos/percona/percona-server/deployments","created_at":"2015-02-13T11:32:01Z","updated_at":"2016-12-15T05:54:06Z","pushed_at":"2016-12-15T05:15:28Z","git_url":"git://github.com/percona/percona-server.git","ssh_url":"git@github.com:percona/percona-server.git","clone_url":"https://github.com/percona/percona-server.git","svn_url":"https://github.com/percona/percona-server","homepage":"https://www.percona.com/software/mysql-database/percona-server","size":522313,"stargazers_count":246,"watchers_count":246,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":88,"mirror_url":null,"open_issues_count":20,"forks":88,"open_issues":20,"watchers":246,"default_branch":"5.7"}},"_links":{"self":{"href":"https://api.github.com/repos/percona/percona-server/pulls/1243"},"html":{"href":"https://github.com/percona/percona-server/pull/1243"},"issue":{"href":"https://api.github.com/repos/percona/percona-server/issues/1243"},"comments":{"href":"https://api.github.com/repos/percona/percona-server/issues/1243/comments"},"review_comments":{"href":"https://api.github.com/repos/percona/percona-server/pulls/1243/comments"},"review_comment":{"href":"https://api.github.com/repos/percona/percona-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/percona/percona-server/pulls/1243/commits"},"statuses":{"href":"https://api.github.com/repos/percona/percona-server/statuses/d51c97aa921d4be2dc2d2f503dfe9c889163993b"}}}}
{"actor":{"display_login":"laurynas-biveinis"}}