{"action":"created","comment":{"url":"https://api.github.com/repos/sysown/proxysql-0.2/pulls/comments/37144760","id":37144760,"diff_hunk":"@@ -348,15 +550,571 @@ int MySQL_Session::handler() {\n \t\t\t\tbreak;\n \t\t\tcase NONE:\n \t\t\tdefault:\n-\t\t\t\tassert(0);\n+\t\t\t\tproxy_error(\"Unexpected packet from client, disconnecting the client\\n\");\n+\t\t\t\treturn -1;\n \t\t\t\tbreak;\n \t\t}\n \t}\n \n \n+#define NEXT_IMMEDIATE(new_st) do { set_status(new_st); goto handler_again; } while (0)\n \n-__get_a_backend:\n+handler_again:\n+\n+\tswitch (status) {\n+\t\tcase FAST_FORWARD:\n+\t\t\tfprintf(stderr,\"FAST_FORWARD\\n\");\n+\t\t\t// FIXME: to implement\n+\t\t\tbreak;\n+\t\tcase CONNECTING_CLIENT:\n+\t\t\t//fprintf(stderr,\"CONNECTING_CLIENT\\n\");\n+\t\t\t// FIXME: to implement\n+\t\t\tbreak;\n+\t\tcase PINGING_SERVER:\n+\t\t\t\n+/*\n+\t\t\tif (mybe->server_myds->revents) {\n+\t\t\t\tMySQL_Data_Stream *myds=mybe->server_myds;\n+\t\t\t\tMySQL_Connection *myconn=myds->myconn;\n+\t\t\t\tmyconn->handler(myds->revents);\n+\t\t\t\tif (myconn->async_state_machine==ASYNC_PING_SUCCESSFUL) {\n+\t\t\t\t\tmyds->DSS=STATE_READY;\n+\t\t\t\t\tmyds->myconn->async_state_machine=ASYNC_IDLE;\n+\t\t\t\t\tif ((myds->myconn->reusable==true) && ((myds->myprot.prot_status & SERVER_STATUS_IN_TRANS)==0)) {\n+\n+\t\t\t\t\t\treturn_MySQL_Connection_To_Poll(myds);\n+\t\t\t\t\t}\n+\t\t\t\t\tstatus=NONE;\n+\t\t\t\t} else {\n+\t\t\t\t\tif (myconn->async_state_machine==ASYNC_PING_FAILED) {\n+\t\t\t\t\t\t// FIXME: treat gracefully\n+\t\t\t\t\t\tassert(0);\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t}\n+*/\n+\t\t\tassert(mybe->server_myds->myconn);\n+\t\t\t{\t\n+\t\t\t\tMySQL_Data_Stream *myds=mybe->server_myds;\n+\t\t\t\tMySQL_Connection *myconn=myds->myconn;\n+\t\t\t\tint rc=myconn->async_ping(myds->revents);\n+//\t\t\t\tif (myds->mypolls==NULL) {\n+//\t\t\t\t\tthread->mypolls.add(POLLIN|POLLOUT, myds->fd, myds, thread->curtime);\n+//\t\t\t\t}\n+\t\t\t\tif (rc==0) {\n+\t\t\t\t\tmyconn->async_state_machine=ASYNC_IDLE;\n+\t\t\t\t\t//if ((myconn->reusable==true) && ((myds->myprot.prot_status & SERVER_STATUS_IN_TRANS)==0)) {\n+\t\t\t\t\tif ((myconn->reusable==true) && myds->myconn->IsActiveTransaction()==false) {\n+\t\t\t\t\t\tmyds->return_MySQL_Connection_To_Pool();\n+\t\t\t\t\t}\n+\t\t\t\t\tdelete mybe->server_myds;\n+\t\t\t\t\tmybe->server_myds=NULL;\n+\t\t\t\t\tset_status(NONE);\n+\t\t\t\t\treturn -1;\n+\t\t\t\t} else {\n+\t\t\t\t\tif (rc==-1) {\n+\t\t\t\t\t\tproxy_error(\"Detected a broken connection during ping\\n\");\n+\t\t\t\t\t\tmyds->destroy_MySQL_Connection_From_Pool();\n+\t\t\t\t\t\tmyds->fd=0;\n+\t\t\t\t\t\tdelete mybe->server_myds;\n+\t\t\t\t\t\tmybe->server_myds=NULL;\n+\t\t\t\t\t\t//thread->mypolls.remove_index_fast(myds->poll_fds_idx);\n+\t\t\t\t\t\treturn -1;\n+\t\t\t\t\t} else {\n+\t\t\t\t\t\t// rc==1 , nothing to do for now\n+// tring to fix bug\n+\t\t\t\t\t\tif (myds->mypolls==NULL) {\n+\t\t\t\t\t\t\tthread->mypolls.add(POLLIN|POLLOUT, myds->fd, myds, thread->curtime);\n+\t\t\t\t\t\t}\n+// tring to fix bug\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t}\n+\t\t\tbreak;\n+\n+\t\tcase PROCESSING_QUERY:\n+\t\t\t//fprintf(stderr,\"PROCESSING_QUERY\\n\");\n+\t\t\tif (pause_until > thread->curtime) {\n+\t\t\t\treturn 0;\n+\t\t\t}\n+\t\t\tif (mysql_thread___connect_timeout_server_max) {\n+\t\t\t\tif (mybe->server_myds->max_connect_time==0)\n+\t\t\t\t\tmybe->server_myds->max_connect_time=thread->curtime+mysql_thread___connect_timeout_server_max*1000;\n+\t\t\t} else {\n+\t\t\t\tmybe->server_myds->max_connect_time=0;\n+\t\t\t}\n+\t\t\tif (\n+\t\t\t\t(mybe->server_myds->myconn && mybe->server_myds->wait_until && thread->curtime >= mybe->server_myds->wait_until)\n+\t\t\t\t// query timed out\n+\t\t\t\t||\n+\t\t\t\t(killed==true) // session was killed by admin\n+\t\t\t) {\n+\t\t\t\tMySQL_Data_Stream *myds=mybe->server_myds;\n+\t\t\t\tif (myds->myconn && myds->myconn->mysql) {\n+\t\t\t\t\tif (myds->killed_at==0) {\n+\t\t\t\t\t\tmyds->wait_until=0;","path":"lib/MySQL_Session.cpp","position":498,"original_position":498,"commit_id":"8d4abf90c015fb1a4d7d95e5287c78976fcc271e","original_commit_id":"8d4abf90c015fb1a4d7d95e5287c78976fcc271e","user":{"login":"renecannao","id":3645227,"avatar_url":"https://avatars.githubusercontent.com/u/3645227?v=3","gravatar_id":"","url":"https://api.github.com/users/renecannao","html_url":"https://github.com/renecannao","followers_url":"https://api.github.com/users/renecannao/followers","following_url":"https://api.github.com/users/renecannao/following{/other_user}","gists_url":"https://api.github.com/users/renecannao/gists{/gist_id}","starred_url":"https://api.github.com/users/renecannao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renecannao/subscriptions","organizations_url":"https://api.github.com/users/renecannao/orgs","repos_url":"https://api.github.com/users/renecannao/repos","events_url":"https://api.github.com/users/renecannao/events{/privacy}","received_events_url":"https://api.github.com/users/renecannao/received_events","type":"User","site_admin":false},"body":"Currect, just create a new thread, fire the command, and die when done","created_at":"2015-08-16T11:08:19Z","updated_at":"2015-08-16T11:08:19Z","html_url":"https://github.com/sysown/proxysql-0.2/pull/317#discussion_r37144760","pull_request_url":"https://api.github.com/repos/sysown/proxysql-0.2/pulls/317","_links":{"self":{"href":"https://api.github.com/repos/sysown/proxysql-0.2/pulls/comments/37144760"},"html":{"href":"https://github.com/sysown/proxysql-0.2/pull/317#discussion_r37144760"},"pull_request":{"href":"https://api.github.com/repos/sysown/proxysql-0.2/pulls/317"}}},"pull_request":{"url":"https://api.github.com/repos/sysown/proxysql-0.2/pulls/317","id":42103731,"html_url":"https://github.com/sysown/proxysql-0.2/pull/317","diff_url":"https://github.com/sysown/proxysql-0.2/pull/317.diff","patch_url":"https://github.com/sysown/proxysql-0.2/pull/317.patch","issue_url":"https://api.github.com/repos/sysown/proxysql-0.2/issues/317","number":317,"state":"closed","locked":false,"title":"Rene's recent changes","user":{"login":"aismail","id":82345,"avatar_url":"https://avatars.githubusercontent.com/u/82345?v=3","gravatar_id":"","url":"https://api.github.com/users/aismail","html_url":"https://github.com/aismail","followers_url":"https://api.github.com/users/aismail/followers","following_url":"https://api.github.com/users/aismail/following{/other_user}","gists_url":"https://api.github.com/users/aismail/gists{/gist_id}","starred_url":"https://api.github.com/users/aismail/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aismail/subscriptions","organizations_url":"https://api.github.com/users/aismail/orgs","repos_url":"https://api.github.com/users/aismail/repos","events_url":"https://api.github.com/users/aismail/events{/privacy}","received_events_url":"https://api.github.com/users/aismail/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-11T08:23:30Z","updated_at":"2015-08-16T11:08:19Z","closed_at":"2015-08-14T14:54:41Z","merged_at":"2015-08-14T14:54:41Z","merge_commit_sha":"c24220f41e2be6fa3744595a9b1fd89965b320fa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sysown/proxysql-0.2/pulls/317/commits","review_comments_url":"https://api.github.com/repos/sysown/proxysql-0.2/pulls/317/comments","review_comment_url":"https://api.github.com/repos/sysown/proxysql-0.2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sysown/proxysql-0.2/issues/317/comments","statuses_url":"https://api.github.com/repos/sysown/proxysql-0.2/statuses/8d4abf90c015fb1a4d7d95e5287c78976fcc271e","head":{"label":"renecannao:master","ref":"master","sha":"8d4abf90c015fb1a4d7d95e5287c78976fcc271e","user":{"login":"renecannao","id":3645227,"avatar_url":"https://avatars.githubusercontent.com/u/3645227?v=3","gravatar_id":"","url":"https://api.github.com/users/renecannao","html_url":"https://github.com/renecannao","followers_url":"https://api.github.com/users/renecannao/followers","following_url":"https://api.github.com/users/renecannao/following{/other_user}","gists_url":"https://api.github.com/users/renecannao/gists{/gist_id}","starred_url":"https://api.github.com/users/renecannao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renecannao/subscriptions","organizations_url":"https://api.github.com/users/renecannao/orgs","repos_url":"https://api.github.com/users/renecannao/repos","events_url":"https://api.github.com/users/renecannao/events{/privacy}","received_events_url":"https://api.github.com/users/renecannao/received_events","type":"User","site_admin":false},"repo":{"id":33404930,"name":"proxysql-0.2","full_name":"renecannao/proxysql-0.2","owner":{"login":"renecannao","id":3645227,"avatar_url":"https://avatars.githubusercontent.com/u/3645227?v=3","gravatar_id":"","url":"https://api.github.com/users/renecannao","html_url":"https://github.com/renecannao","followers_url":"https://api.github.com/users/renecannao/followers","following_url":"https://api.github.com/users/renecannao/following{/other_user}","gists_url":"https://api.github.com/users/renecannao/gists{/gist_id}","starred_url":"https://api.github.com/users/renecannao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renecannao/subscriptions","organizations_url":"https://api.github.com/users/renecannao/orgs","repos_url":"https://api.github.com/users/renecannao/repos","events_url":"https://api.github.com/users/renecannao/events{/privacy}","received_events_url":"https://api.github.com/users/renecannao/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/renecannao/proxysql-0.2","description":"","fork":true,"url":"https://api.github.com/repos/renecannao/proxysql-0.2","forks_url":"https://api.github.com/repos/renecannao/proxysql-0.2/forks","keys_url":"https://api.github.com/repos/renecannao/proxysql-0.2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/renecannao/proxysql-0.2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/renecannao/proxysql-0.2/teams","hooks_url":"https://api.github.com/repos/renecannao/proxysql-0.2/hooks","issue_events_url":"https://api.github.com/repos/renecannao/proxysql-0.2/issues/events{/number}","events_url":"https://api.github.com/repos/renecannao/proxysql-0.2/events","assignees_url":"https://api.github.com/repos/renecannao/proxysql-0.2/assignees{/user}","branches_url":"https://api.github.com/repos/renecannao/proxysql-0.2/branches{/branch}","tags_url":"https://api.github.com/repos/renecannao/proxysql-0.2/tags","blobs_url":"https://api.github.com/repos/renecannao/proxysql-0.2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/renecannao/proxysql-0.2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/renecannao/proxysql-0.2/git/refs{/sha}","trees_url":"https://api.github.com/repos/renecannao/proxysql-0.2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/renecannao/proxysql-0.2/statuses/{sha}","languages_url":"https://api.github.com/repos/renecannao/proxysql-0.2/languages","stargazers_url":"https://api.github.com/repos/renecannao/proxysql-0.2/stargazers","contributors_url":"https://api.github.com/repos/renecannao/proxysql-0.2/contributors","subscribers_url":"https://api.github.com/repos/renecannao/proxysql-0.2/subscribers","subscription_url":"https://api.github.com/repos/renecannao/proxysql-0.2/subscription","commits_url":"https://api.github.com/repos/renecannao/proxysql-0.2/commits{/sha}","git_commits_url":"https://api.github.com/repos/renecannao/proxysql-0.2/git/commits{/sha}","comments_url":"https://api.github.com/repos/renecannao/proxysql-0.2/comments{/number}","issue_comment_url":"https://api.github.com/repos/renecannao/proxysql-0.2/issues/comments{/number}","contents_url":"https://api.github.com/repos/renecannao/proxysql-0.2/contents/{+path}","compare_url":"https://api.github.com/repos/renecannao/proxysql-0.2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/renecannao/proxysql-0.2/merges","archive_url":"https://api.github.com/repos/renecannao/proxysql-0.2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/renecannao/proxysql-0.2/downloads","issues_url":"https://api.github.com/repos/renecannao/proxysql-0.2/issues{/number}","pulls_url":"https://api.github.com/repos/renecannao/proxysql-0.2/pulls{/number}","milestones_url":"https://api.github.com/repos/renecannao/proxysql-0.2/milestones{/number}","notifications_url":"https://api.github.com/repos/renecannao/proxysql-0.2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/renecannao/proxysql-0.2/labels{/name}","releases_url":"https://api.github.com/repos/renecannao/proxysql-0.2/releases{/id}","created_at":"2015-04-04T12:35:55Z","updated_at":"2015-04-29T06:17:44Z","pushed_at":"2015-08-16T08:41:41Z","git_url":"git://github.com/renecannao/proxysql-0.2.git","ssh_url":"git@github.com:renecannao/proxysql-0.2.git","clone_url":"https://github.com/renecannao/proxysql-0.2.git","svn_url":"https://github.com/renecannao/proxysql-0.2","homepage":"","size":12029,"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":"master"}},"base":{"label":"sysown:master","ref":"master","sha":"c72e6d944268dd4fa7bb475af8d33b4dc78db2bc","user":{"login":"sysown","id":10014617,"avatar_url":"https://avatars.githubusercontent.com/u/10014617?v=3","gravatar_id":"","url":"https://api.github.com/users/sysown","html_url":"https://github.com/sysown","followers_url":"https://api.github.com/users/sysown/followers","following_url":"https://api.github.com/users/sysown/following{/other_user}","gists_url":"https://api.github.com/users/sysown/gists{/gist_id}","starred_url":"https://api.github.com/users/sysown/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sysown/subscriptions","organizations_url":"https://api.github.com/users/sysown/orgs","repos_url":"https://api.github.com/users/sysown/repos","events_url":"https://api.github.com/users/sysown/events{/privacy}","received_events_url":"https://api.github.com/users/sysown/received_events","type":"Organization","site_admin":false},"repo":{"id":27358084,"name":"proxysql-0.2","full_name":"sysown/proxysql-0.2","owner":{"login":"sysown","id":10014617,"avatar_url":"https://avatars.githubusercontent.com/u/10014617?v=3","gravatar_id":"","url":"https://api.github.com/users/sysown","html_url":"https://github.com/sysown","followers_url":"https://api.github.com/users/sysown/followers","following_url":"https://api.github.com/users/sysown/following{/other_user}","gists_url":"https://api.github.com/users/sysown/gists{/gist_id}","starred_url":"https://api.github.com/users/sysown/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sysown/subscriptions","organizations_url":"https://api.github.com/users/sysown/orgs","repos_url":"https://api.github.com/users/sysown/repos","events_url":"https://api.github.com/users/sysown/events{/privacy}","received_events_url":"https://api.github.com/users/sysown/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sysown/proxysql-0.2","description":"","fork":false,"url":"https://api.github.com/repos/sysown/proxysql-0.2","forks_url":"https://api.github.com/repos/sysown/proxysql-0.2/forks","keys_url":"https://api.github.com/repos/sysown/proxysql-0.2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sysown/proxysql-0.2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sysown/proxysql-0.2/teams","hooks_url":"https://api.github.com/repos/sysown/proxysql-0.2/hooks","issue_events_url":"https://api.github.com/repos/sysown/proxysql-0.2/issues/events{/number}","events_url":"https://api.github.com/repos/sysown/proxysql-0.2/events","assignees_url":"https://api.github.com/repos/sysown/proxysql-0.2/assignees{/user}","branches_url":"https://api.github.com/repos/sysown/proxysql-0.2/branches{/branch}","tags_url":"https://api.github.com/repos/sysown/proxysql-0.2/tags","blobs_url":"https://api.github.com/repos/sysown/proxysql-0.2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sysown/proxysql-0.2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sysown/proxysql-0.2/git/refs{/sha}","trees_url":"https://api.github.com/repos/sysown/proxysql-0.2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sysown/proxysql-0.2/statuses/{sha}","languages_url":"https://api.github.com/repos/sysown/proxysql-0.2/languages","stargazers_url":"https://api.github.com/repos/sysown/proxysql-0.2/stargazers","contributors_url":"https://api.github.com/repos/sysown/proxysql-0.2/contributors","subscribers_url":"https://api.github.com/repos/sysown/proxysql-0.2/subscribers","subscription_url":"https://api.github.com/repos/sysown/proxysql-0.2/subscription","commits_url":"https://api.github.com/repos/sysown/proxysql-0.2/commits{/sha}","git_commits_url":"https://api.github.com/repos/sysown/proxysql-0.2/git/commits{/sha}","comments_url":"https://api.github.com/repos/sysown/proxysql-0.2/comments{/number}","issue_comment_url":"https://api.github.com/repos/sysown/proxysql-0.2/issues/comments{/number}","contents_url":"https://api.github.com/repos/sysown/proxysql-0.2/contents/{+path}","compare_url":"https://api.github.com/repos/sysown/proxysql-0.2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sysown/proxysql-0.2/merges","archive_url":"https://api.github.com/repos/sysown/proxysql-0.2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sysown/proxysql-0.2/downloads","issues_url":"https://api.github.com/repos/sysown/proxysql-0.2/issues{/number}","pulls_url":"https://api.github.com/repos/sysown/proxysql-0.2/pulls{/number}","milestones_url":"https://api.github.com/repos/sysown/proxysql-0.2/milestones{/number}","notifications_url":"https://api.github.com/repos/sysown/proxysql-0.2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sysown/proxysql-0.2/labels{/name}","releases_url":"https://api.github.com/repos/sysown/proxysql-0.2/releases{/id}","created_at":"2014-12-01T01:58:26Z","updated_at":"2015-07-06T08:59:47Z","pushed_at":"2015-08-15T09:11:20Z","git_url":"git://github.com/sysown/proxysql-0.2.git","ssh_url":"git@github.com:sysown/proxysql-0.2.git","clone_url":"https://github.com/sysown/proxysql-0.2.git","svn_url":"https://github.com/sysown/proxysql-0.2","homepage":"","size":12241,"stargazers_count":3,"watchers_count":3,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":173,"forks":5,"open_issues":173,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sysown/proxysql-0.2/pulls/317"},"html":{"href":"https://github.com/sysown/proxysql-0.2/pull/317"},"issue":{"href":"https://api.github.com/repos/sysown/proxysql-0.2/issues/317"},"comments":{"href":"https://api.github.com/repos/sysown/proxysql-0.2/issues/317/comments"},"review_comments":{"href":"https://api.github.com/repos/sysown/proxysql-0.2/pulls/317/comments"},"review_comment":{"href":"https://api.github.com/repos/sysown/proxysql-0.2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sysown/proxysql-0.2/pulls/317/commits"},"statuses":{"href":"https://api.github.com/repos/sysown/proxysql-0.2/statuses/8d4abf90c015fb1a4d7d95e5287c78976fcc271e"}}}}