{"action":"opened","number":1116,"pull_request":{"url":"https://api.github.com/repos/MyCATApache/Mycat-Server/pulls/1116","id":85920377,"html_url":"https://github.com/MyCATApache/Mycat-Server/pull/1116","diff_url":"https://github.com/MyCATApache/Mycat-Server/pull/1116.diff","patch_url":"https://github.com/MyCATApache/Mycat-Server/pull/1116.patch","issue_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues/1116","number":1116,"state":"open","locked":false,"title":"添加lock tables功能","user":{"login":"brotherbin","id":14922649,"avatar_url":"https://avatars.githubusercontent.com/u/14922649?v=3","gravatar_id":"","url":"https://api.github.com/users/brotherbin","html_url":"https://github.com/brotherbin","followers_url":"https://api.github.com/users/brotherbin/followers","following_url":"https://api.github.com/users/brotherbin/following{/other_user}","gists_url":"https://api.github.com/users/brotherbin/gists{/gist_id}","starred_url":"https://api.github.com/users/brotherbin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brotherbin/subscriptions","organizations_url":"https://api.github.com/users/brotherbin/orgs","repos_url":"https://api.github.com/users/brotherbin/repos","events_url":"https://api.github.com/users/brotherbin/events{/privacy}","received_events_url":"https://api.github.com/users/brotherbin/received_events","type":"User","site_admin":false},"body":"背景：\r\n 1. Mycat对lock tables语句的处理为随机发送到某一个后端节点，对多节点表不能达到锁表的目的。 2. Mycat将lock tables语句发送到后端某个节点后就释放连接，后续SQL的执行会重新获取连接，在后端不是同一个连接，不能达到锁表目的。  \r\n\r\n修复： \r\n1. 支持lock tables TABLE [READ|WRITE]语句；\r\n 1.1 执行LOCK_SQL时，获取TABLE所在的后端节点连接，执行LOCK_SQL，并将路由结果和后端连接保存至一个lockedMap中; \r\n1.2 前端再发送的其他语句OTHER_SQL，如果路由结果存在于lockedMap中，则从该lockedMap中获取后端连接执行OTHER_SQL，保证锁表过程中后端同一个节点用相同的后端连接; \r\n1.3 前端发送unlock tables时，从lockedMap中获取所有后端连接取执行unlock table命令，再释放lockMap中的连接；  \r\n\r\n2. 事务中执行lock tables时提示错误（屏蔽事务中的lock tables操作）; \r\n\r\n 3. 锁表后且未执行unlock tables之前再次执行lock tables时以及一次锁多个表lock table1 write,table2 read时提示错误（分布式情况下多表锁的处理逻辑较复杂，且使用场景很少）;  \r\n\r\n4. 直接发送unlock tables命令时，直接返回OK，而不去后端执行;  \r\n\r\n新的兼容性问题： \r\n1. 不支持 lock TABLE table1 [read|write]语法(是TABLE，不是TABLES)。MySQL官方提供的锁表语法关键字为lock TABLES, 但实际上MySQL兼容lock TABLES和lock TABLE关键字。而Mycat中DruidParser只支持TABLES关键字，导致Mycat不能像MySQL一样兼容。","created_at":"2016-09-20T06:56:26Z","updated_at":"2016-09-20T06:56:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/pulls/1116/commits","review_comments_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/pulls/1116/comments","review_comment_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues/1116/comments","statuses_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/statuses/172d622c92d4e940389d5416e8ec7ff27ee4c602","head":{"label":"brotherbin:1.6","ref":"1.6","sha":"172d622c92d4e940389d5416e8ec7ff27ee4c602","user":{"login":"brotherbin","id":14922649,"avatar_url":"https://avatars.githubusercontent.com/u/14922649?v=3","gravatar_id":"","url":"https://api.github.com/users/brotherbin","html_url":"https://github.com/brotherbin","followers_url":"https://api.github.com/users/brotherbin/followers","following_url":"https://api.github.com/users/brotherbin/following{/other_user}","gists_url":"https://api.github.com/users/brotherbin/gists{/gist_id}","starred_url":"https://api.github.com/users/brotherbin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brotherbin/subscriptions","organizations_url":"https://api.github.com/users/brotherbin/orgs","repos_url":"https://api.github.com/users/brotherbin/repos","events_url":"https://api.github.com/users/brotherbin/events{/privacy}","received_events_url":"https://api.github.com/users/brotherbin/received_events","type":"User","site_admin":false},"repo":{"id":68581286,"name":"Mycat-Server","full_name":"brotherbin/Mycat-Server","owner":{"login":"brotherbin","id":14922649,"avatar_url":"https://avatars.githubusercontent.com/u/14922649?v=3","gravatar_id":"","url":"https://api.github.com/users/brotherbin","html_url":"https://github.com/brotherbin","followers_url":"https://api.github.com/users/brotherbin/followers","following_url":"https://api.github.com/users/brotherbin/following{/other_user}","gists_url":"https://api.github.com/users/brotherbin/gists{/gist_id}","starred_url":"https://api.github.com/users/brotherbin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brotherbin/subscriptions","organizations_url":"https://api.github.com/users/brotherbin/orgs","repos_url":"https://api.github.com/users/brotherbin/repos","events_url":"https://api.github.com/users/brotherbin/events{/privacy}","received_events_url":"https://api.github.com/users/brotherbin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brotherbin/Mycat-Server","description":null,"fork":true,"url":"https://api.github.com/repos/brotherbin/Mycat-Server","forks_url":"https://api.github.com/repos/brotherbin/Mycat-Server/forks","keys_url":"https://api.github.com/repos/brotherbin/Mycat-Server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brotherbin/Mycat-Server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brotherbin/Mycat-Server/teams","hooks_url":"https://api.github.com/repos/brotherbin/Mycat-Server/hooks","issue_events_url":"https://api.github.com/repos/brotherbin/Mycat-Server/issues/events{/number}","events_url":"https://api.github.com/repos/brotherbin/Mycat-Server/events","assignees_url":"https://api.github.com/repos/brotherbin/Mycat-Server/assignees{/user}","branches_url":"https://api.github.com/repos/brotherbin/Mycat-Server/branches{/branch}","tags_url":"https://api.github.com/repos/brotherbin/Mycat-Server/tags","blobs_url":"https://api.github.com/repos/brotherbin/Mycat-Server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brotherbin/Mycat-Server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brotherbin/Mycat-Server/git/refs{/sha}","trees_url":"https://api.github.com/repos/brotherbin/Mycat-Server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brotherbin/Mycat-Server/statuses/{sha}","languages_url":"https://api.github.com/repos/brotherbin/Mycat-Server/languages","stargazers_url":"https://api.github.com/repos/brotherbin/Mycat-Server/stargazers","contributors_url":"https://api.github.com/repos/brotherbin/Mycat-Server/contributors","subscribers_url":"https://api.github.com/repos/brotherbin/Mycat-Server/subscribers","subscription_url":"https://api.github.com/repos/brotherbin/Mycat-Server/subscription","commits_url":"https://api.github.com/repos/brotherbin/Mycat-Server/commits{/sha}","git_commits_url":"https://api.github.com/repos/brotherbin/Mycat-Server/git/commits{/sha}","comments_url":"https://api.github.com/repos/brotherbin/Mycat-Server/comments{/number}","issue_comment_url":"https://api.github.com/repos/brotherbin/Mycat-Server/issues/comments{/number}","contents_url":"https://api.github.com/repos/brotherbin/Mycat-Server/contents/{+path}","compare_url":"https://api.github.com/repos/brotherbin/Mycat-Server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brotherbin/Mycat-Server/merges","archive_url":"https://api.github.com/repos/brotherbin/Mycat-Server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brotherbin/Mycat-Server/downloads","issues_url":"https://api.github.com/repos/brotherbin/Mycat-Server/issues{/number}","pulls_url":"https://api.github.com/repos/brotherbin/Mycat-Server/pulls{/number}","milestones_url":"https://api.github.com/repos/brotherbin/Mycat-Server/milestones{/number}","notifications_url":"https://api.github.com/repos/brotherbin/Mycat-Server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brotherbin/Mycat-Server/labels{/name}","releases_url":"https://api.github.com/repos/brotherbin/Mycat-Server/releases{/id}","deployments_url":"https://api.github.com/repos/brotherbin/Mycat-Server/deployments","created_at":"2016-09-19T07:41:34Z","updated_at":"2016-09-19T07:41:41Z","pushed_at":"2016-09-20T06:47:55Z","git_url":"git://github.com/brotherbin/Mycat-Server.git","ssh_url":"git@github.com:brotherbin/Mycat-Server.git","clone_url":"https://github.com/brotherbin/Mycat-Server.git","svn_url":"https://github.com/brotherbin/Mycat-Server","homepage":null,"size":6082,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"1.6"}},"base":{"label":"MyCATApache:1.6","ref":"1.6","sha":"3f9be4bf7f802107ef3d82422d8ab9dbc16c896a","user":{"login":"MyCATApache","id":8221116,"avatar_url":"https://avatars.githubusercontent.com/u/8221116?v=3","gravatar_id":"","url":"https://api.github.com/users/MyCATApache","html_url":"https://github.com/MyCATApache","followers_url":"https://api.github.com/users/MyCATApache/followers","following_url":"https://api.github.com/users/MyCATApache/following{/other_user}","gists_url":"https://api.github.com/users/MyCATApache/gists{/gist_id}","starred_url":"https://api.github.com/users/MyCATApache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MyCATApache/subscriptions","organizations_url":"https://api.github.com/users/MyCATApache/orgs","repos_url":"https://api.github.com/users/MyCATApache/repos","events_url":"https://api.github.com/users/MyCATApache/events{/privacy}","received_events_url":"https://api.github.com/users/MyCATApache/received_events","type":"Organization","site_admin":false},"repo":{"id":27519800,"name":"Mycat-Server","full_name":"MyCATApache/Mycat-Server","owner":{"login":"MyCATApache","id":8221116,"avatar_url":"https://avatars.githubusercontent.com/u/8221116?v=3","gravatar_id":"","url":"https://api.github.com/users/MyCATApache","html_url":"https://github.com/MyCATApache","followers_url":"https://api.github.com/users/MyCATApache/followers","following_url":"https://api.github.com/users/MyCATApache/following{/other_user}","gists_url":"https://api.github.com/users/MyCATApache/gists{/gist_id}","starred_url":"https://api.github.com/users/MyCATApache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MyCATApache/subscriptions","organizations_url":"https://api.github.com/users/MyCATApache/orgs","repos_url":"https://api.github.com/users/MyCATApache/repos","events_url":"https://api.github.com/users/MyCATApache/events{/privacy}","received_events_url":"https://api.github.com/users/MyCATApache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MyCATApache/Mycat-Server","description":"","fork":false,"url":"https://api.github.com/repos/MyCATApache/Mycat-Server","forks_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/forks","keys_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/teams","hooks_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/hooks","issue_events_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues/events{/number}","events_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/events","assignees_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/assignees{/user}","branches_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/branches{/branch}","tags_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/tags","blobs_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/git/refs{/sha}","trees_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/statuses/{sha}","languages_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/languages","stargazers_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/stargazers","contributors_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/contributors","subscribers_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/subscribers","subscription_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/subscription","commits_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/commits{/sha}","git_commits_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/git/commits{/sha}","comments_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/comments{/number}","issue_comment_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues/comments{/number}","contents_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/contents/{+path}","compare_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/merges","archive_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/downloads","issues_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues{/number}","pulls_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/pulls{/number}","milestones_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/milestones{/number}","notifications_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/labels{/name}","releases_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/releases{/id}","deployments_url":"https://api.github.com/repos/MyCATApache/Mycat-Server/deployments","created_at":"2014-12-04T02:46:54Z","updated_at":"2016-09-20T06:03:50Z","pushed_at":"2016-09-20T05:42:01Z","git_url":"git://github.com/MyCATApache/Mycat-Server.git","ssh_url":"git@github.com:MyCATApache/Mycat-Server.git","clone_url":"https://github.com/MyCATApache/Mycat-Server.git","svn_url":"https://github.com/MyCATApache/Mycat-Server","homepage":null,"size":13449,"stargazers_count":1536,"watchers_count":1536,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1196,"mirror_url":null,"open_issues_count":66,"forks":1196,"open_issues":66,"watchers":1536,"default_branch":"1.6"}},"_links":{"self":{"href":"https://api.github.com/repos/MyCATApache/Mycat-Server/pulls/1116"},"html":{"href":"https://github.com/MyCATApache/Mycat-Server/pull/1116"},"issue":{"href":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues/1116"},"comments":{"href":"https://api.github.com/repos/MyCATApache/Mycat-Server/issues/1116/comments"},"review_comments":{"href":"https://api.github.com/repos/MyCATApache/Mycat-Server/pulls/1116/comments"},"review_comment":{"href":"https://api.github.com/repos/MyCATApache/Mycat-Server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MyCATApache/Mycat-Server/pulls/1116/commits"},"statuses":{"href":"https://api.github.com/repos/MyCATApache/Mycat-Server/statuses/172d622c92d4e940389d5416e8ec7ff27ee4c602"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":4,"additions":559,"deletions":16,"changed_files":12}}
{"actor":{"display_login":"brotherbin"}}