{"action":"created","issue":{"url":"https://api.github.com/repos/pingcap/tidb/issues/8332","repository_url":"https://api.github.com/repos/pingcap/tidb","labels_url":"https://api.github.com/repos/pingcap/tidb/issues/8332/labels{/name}","comments_url":"https://api.github.com/repos/pingcap/tidb/issues/8332/comments","events_url":"https://api.github.com/repos/pingcap/tidb/issues/8332/events","html_url":"https://github.com/pingcap/tidb/pull/8332","id":381112887,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxMTU1OTc2","number":8332,"title":" planner: cleanup prepare cache when client send deallocate","user":{"login":"lysu","id":528332,"node_id":"MDQ6VXNlcjUyODMzMg==","avatar_url":"https://avatars3.githubusercontent.com/u/528332?v=4","gravatar_id":"","url":"https://api.github.com/users/lysu","html_url":"https://github.com/lysu","followers_url":"https://api.github.com/users/lysu/followers","following_url":"https://api.github.com/users/lysu/following{/other_user}","gists_url":"https://api.github.com/users/lysu/gists{/gist_id}","starred_url":"https://api.github.com/users/lysu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lysu/subscriptions","organizations_url":"https://api.github.com/users/lysu/orgs","repos_url":"https://api.github.com/users/lysu/repos","events_url":"https://api.github.com/users/lysu/events{/privacy}","received_events_url":"https://api.github.com/users/lysu/received_events","type":"User","site_admin":false},"labels":[{"id":667671533,"node_id":"MDU6TGFiZWw2Njc2NzE1MzM=","url":"https://api.github.com/repos/pingcap/tidb/labels/component/planner","name":"component/planner","color":"1d76db","default":false},{"id":630229257,"node_id":"MDU6TGFiZWw2MzAyMjkyNTc=","url":"https://api.github.com/repos/pingcap/tidb/labels/type/bug-fix","name":"type/bug-fix","color":"fc2929","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-11-15T11:12:26Z","updated_at":"2018-11-15T12:02:55Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/pingcap/tidb/pulls/8332","html_url":"https://github.com/pingcap/tidb/pull/8332","diff_url":"https://github.com/pingcap/tidb/pull/8332.diff","patch_url":"https://github.com/pingcap/tidb/pull/8332.patch"},"body":"### What problem does this PR solve? <!--add issue link with summary if exists-->\r\n\r\nref #8330, current tidb's ps deallocate handler doesn't release plan-cache memory, this PR fix it.\r\n\r\n### What is changed and how it works?\r\n\r\ndelete plan cache when client deallocate a prepared stmt.\r\n\r\n- in handleStmt for binary protocol\r\n- in deallocExec for text protocol \"deallocate prepare stmtX\"\r\n- add some test case\r\n\r\n### Check List <!--REMOVE the items that are not applicable-->\r\n\r\nTests <!-- At least one of them must be included. -->\r\n\r\n - Unit test\r\n - Integration test\r\n - Manual test (add detailed scripts or steps below)\r\n\r\nuse code in issue doesn't saw OOM any more\r\n\r\nCode changes\r\n\r\n - Has exported function/method change\r\n - Has interface methods change\r\n\r\nSide effects\r\n\r\n - Increased code complexity\r\n\r\nRelated changes\r\n\r\n - Need to cherry-pick to the release branch\r\n\r\n### Remain Question\r\n\r\ncurrent impl simple use current sessionVars, if `sql_mode` or `schema_version` are changed before deallocate, then we can not free previous item.\r\n\r\n<!-- Reviewable:start -->\r\n---\r\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/pingcap/tidb/8332)\r\n<!-- Reviewable:end -->\r\n"},"comment":{"url":"https://api.github.com/repos/pingcap/tidb/issues/comments/439017405","html_url":"https://github.com/pingcap/tidb/pull/8332#issuecomment-439017405","issue_url":"https://api.github.com/repos/pingcap/tidb/issues/8332","id":439017405,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTAxNzQwNQ==","user":{"login":"eurekaka","id":6261973,"node_id":"MDQ6VXNlcjYyNjE5NzM=","avatar_url":"https://avatars2.githubusercontent.com/u/6261973?v=4","gravatar_id":"","url":"https://api.github.com/users/eurekaka","html_url":"https://github.com/eurekaka","followers_url":"https://api.github.com/users/eurekaka/followers","following_url":"https://api.github.com/users/eurekaka/following{/other_user}","gists_url":"https://api.github.com/users/eurekaka/gists{/gist_id}","starred_url":"https://api.github.com/users/eurekaka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eurekaka/subscriptions","organizations_url":"https://api.github.com/users/eurekaka/orgs","repos_url":"https://api.github.com/users/eurekaka/repos","events_url":"https://api.github.com/users/eurekaka/events{/privacy}","received_events_url":"https://api.github.com/users/eurekaka/received_events","type":"User","site_admin":false},"created_at":"2018-11-15T12:02:55Z","updated_at":"2018-11-15T12:02:55Z","author_association":"CONTRIBUTOR","body":"> LRU capacity should be a protection mechanism that protect max memory usage instead of free memory\r\n\r\n+1\r\nIf we want to limit the memory of `kvcache`, we have to do bookkeeping for memory usage of cached plan? seems it is not an easy job."}}
{"actor":{"display_login":"eurekaka"}}