{"action":"created","issue":{"url":"https://api.github.com/repos/neo4j/neo4j/issues/6287","repository_url":"https://api.github.com/repos/neo4j/neo4j","labels_url":"https://api.github.com/repos/neo4j/neo4j/issues/6287/labels{/name}","comments_url":"https://api.github.com/repos/neo4j/neo4j/issues/6287/comments","events_url":"https://api.github.com/repos/neo4j/neo4j/issues/6287/events","html_url":"https://github.com/neo4j/neo4j/pull/6287","id":128343917,"number":6287,"title":"Improved deadlock resolution strategy for enterprise lock manager.","user":{"login":"jakewins","id":182752,"avatar_url":"https://avatars.githubusercontent.com/u/182752?v=3","gravatar_id":"","url":"https://api.github.com/users/jakewins","html_url":"https://github.com/jakewins","followers_url":"https://api.github.com/users/jakewins/followers","following_url":"https://api.github.com/users/jakewins/following{/other_user}","gists_url":"https://api.github.com/users/jakewins/gists{/gist_id}","starred_url":"https://api.github.com/users/jakewins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakewins/subscriptions","organizations_url":"https://api.github.com/users/jakewins/orgs","repos_url":"https://api.github.com/users/jakewins/repos","events_url":"https://api.github.com/users/jakewins/events{/privacy}","received_events_url":"https://api.github.com/users/jakewins/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/neo4j/neo4j/labels/3.0","name":"3.0","color":"006b75"},{"url":"https://api.github.com/repos/neo4j/neo4j/labels/kernel","name":"kernel","color":"0052cc"}],"state":"open","locked":false,"assignee":{"login":"chrisvest","id":7993,"avatar_url":"https://avatars.githubusercontent.com/u/7993?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisvest","html_url":"https://github.com/chrisvest","followers_url":"https://api.github.com/users/chrisvest/followers","following_url":"https://api.github.com/users/chrisvest/following{/other_user}","gists_url":"https://api.github.com/users/chrisvest/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisvest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisvest/subscriptions","organizations_url":"https://api.github.com/users/chrisvest/orgs","repos_url":"https://api.github.com/users/chrisvest/repos","events_url":"https://api.github.com/users/chrisvest/events{/privacy}","received_events_url":"https://api.github.com/users/chrisvest/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2016-01-23T18:14:39Z","updated_at":"2016-02-11T09:50:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/6287","html_url":"https://github.com/neo4j/neo4j/pull/6287","diff_url":"https://github.com/neo4j/neo4j/pull/6287.diff","patch_url":"https://github.com/neo4j/neo4j/pull/6287.patch"},"body":"When a deadlock is detected, it's rather likely that multiple participants\r\nin the deadlock realize at the same time that they are deadlocking. Because\r\nwe want to minimize aborts, we have code that chooses which of the\r\ndeadlocking parties should bail out.\r\n\r\nThis code is very sensitive, because if there is ever a code path where both\r\nparties think the other will abort, we would end up in a real deadlock,\r\nrather than averting it.\r\n\r\nCurrently, the strategy has been to look at wait lists - the client with the\r\nhighest number of waiting clients is allowed to continue, while the other\r\nclient aborts. However, this strategy is sub-optimal, partially because\r\nthe data we have on number of waiting clients is unreliable, but mainly\r\nbecause there was no good tie breaker if both clients have same-sized wait\r\nlists - if both clients have the same number of clients waiting for them,\r\nboth will abort.\r\n\r\nThis modifies this, while hopefully making the code a bit clearer:\r\n\r\n - There is now a tie breaker, if both clients are on the same \"level\"\r\n   we abort based on client id, ensuring only one client aborts.\r\n - There is now four strategies, chosen with a feature toggle, to allow\r\n   real-world trialing of the two prominent deadlock resolution strategies.\r\n\r\n   - ABORT_YOUNG, assumes that higher throughput can be achieved by letting\r\n                  transactions with more locks held (presumed older) finish.\r\n                  Young transactions with fewer locks abort.\r\n   - ABORT_OLD, assumes old monolithic transactions are \"holding up the\r\n                line\", and that higher throughput can be achieved by\r\n                aborting transactions with more locks.\r\n   - ABORT_LONG_WAIT_LIST, the old strategy - but with the tie breaker added in\r\n   - ABORT_SHORT_WAIT_LIST, the inverse of the old strategy\r\n\r\nThis sets a nice precedent for introducing transaction priorities, where we\r\ncould choose to abort transactions with lower priorities. Something to\r\nconsider for future improvements."},"comment":{"url":"https://api.github.com/repos/neo4j/neo4j/issues/comments/182786084","html_url":"https://github.com/neo4j/neo4j/pull/6287#issuecomment-182786084","issue_url":"https://api.github.com/repos/neo4j/neo4j/issues/6287","id":182786084,"user":{"login":"chrisvest","id":7993,"avatar_url":"https://avatars.githubusercontent.com/u/7993?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisvest","html_url":"https://github.com/chrisvest","followers_url":"https://api.github.com/users/chrisvest/followers","following_url":"https://api.github.com/users/chrisvest/following{/other_user}","gists_url":"https://api.github.com/users/chrisvest/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisvest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisvest/subscriptions","organizations_url":"https://api.github.com/users/chrisvest/orgs","repos_url":"https://api.github.com/users/chrisvest/repos","events_url":"https://api.github.com/users/chrisvest/events{/privacy}","received_events_url":"https://api.github.com/users/chrisvest/received_events","type":"User","site_admin":false},"created_at":"2016-02-11T09:50:26Z","updated_at":"2016-02-11T09:50:26Z","body":"@jakewins Sorry this took so long. Nice javadocs! I've identified two more issues, and it needs a rebase. Otherwise it looks good."}}