{"action":"created","comment":{"url":"https://api.github.com/repos/zalando/patroni/pulls/comments/79166127","id":79166127,"diff_hunk":"@@ -398,6 +398,7 @@ def get_postgresql_status(self, retry=False):\n                     'received_location': row[3],\n                     'replayed_location': row[4],\n                     'replayed_timestamp': row[5],\n+                    'is_lagging': self.server.patroni.ha.is_lagging(xlog=row[3]),","path":"patroni/api.py","position":26,"original_position":4,"commit_id":"cd9617e3852192d089f1a8724e38932cd992b90f","original_commit_id":"cd9617e3852192d089f1a8724e38932cd992b90f","user":{"login":"CyberDem0n","id":3407345,"avatar_url":"https://avatars.githubusercontent.com/u/3407345?v=3","gravatar_id":"","url":"https://api.github.com/users/CyberDem0n","html_url":"https://github.com/CyberDem0n","followers_url":"https://api.github.com/users/CyberDem0n/followers","following_url":"https://api.github.com/users/CyberDem0n/following{/other_user}","gists_url":"https://api.github.com/users/CyberDem0n/gists{/gist_id}","starred_url":"https://api.github.com/users/CyberDem0n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CyberDem0n/subscriptions","organizations_url":"https://api.github.com/users/CyberDem0n/orgs","repos_url":"https://api.github.com/users/CyberDem0n/repos","events_url":"https://api.github.com/users/CyberDem0n/events{/privacy}","received_events_url":"https://api.github.com/users/CyberDem0n/received_events","type":"User","site_admin":false},"body":"Acceptance tests are failing on this line:\r\n```python\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python3.5/socketserver.py\", line 625, in process_request_thread                                                        \r\n    self.finish_request(request, client_address)                                                                                        \r\n  File \"/usr/lib/python3.5/socketserver.py\", line 354, in finish_request\r\n    self.RequestHandlerClass(request, client_address, self)                                                                             \r\n  File \"/usr/lib/python3.5/socketserver.py\", line 681, in __init__                                                                      \r\n    self.handle()\r\n  File \"/usr/lib/python3.5/http/server.py\", line 422, in handle                                                                         \r\n    self.handle_one_request()\r\n  File \"/usr/lib/python3.5/http/server.py\", line 410, in handle_one_request                                                             \r\n    method()\r\n  File \"/home/akukushkin/git/ants/patroni/patroni/api.py\", line 109, in do_GET_patroni\r\n    response = self.get_postgresql_status(True)                                                                                         \r\n  File \"/home/akukushkin/git/ants/patroni/patroni/api.py\", line 402, in get_postgresql_status                                           \r\n    'paused': row[6]} if row[1] else {\r\nTypeError: is_lagging() got an unexpected keyword argument 'xlog' \r\n```\r\n\r\nI think 'is_lagging' should not be exposed via API on the first place, because:\r\n 1. It could be calculated on any node from `replayed_location`\r\n 2. It is using \"cached\" version of the cluster view in order to calculate this boolean value, what can give a wrong result, because at this moment master can already write some other value into `optime/leader`. The result will be `False`, what is wrong...","created_at":"2016-09-16T13:13:58Z","updated_at":"2016-09-16T13:18:07Z","html_url":"https://github.com/zalando/patroni/pull/295#discussion_r79166127","pull_request_url":"https://api.github.com/repos/zalando/patroni/pulls/295","_links":{"self":{"href":"https://api.github.com/repos/zalando/patroni/pulls/comments/79166127"},"html":{"href":"https://github.com/zalando/patroni/pull/295#discussion_r79166127"},"pull_request":{"href":"https://api.github.com/repos/zalando/patroni/pulls/295"}}},"pull_request":{"url":"https://api.github.com/repos/zalando/patroni/pulls/295","id":84437281,"html_url":"https://github.com/zalando/patroni/pull/295","diff_url":"https://github.com/zalando/patroni/pull/295.diff","patch_url":"https://github.com/zalando/patroni/pull/295.patch","issue_url":"https://api.github.com/repos/zalando/patroni/issues/295","number":295,"state":"open","locked":false,"title":"Introduce starting state and master start timeout.","user":{"login":"ants","id":64938,"avatar_url":"https://avatars.githubusercontent.com/u/64938?v=3","gravatar_id":"","url":"https://api.github.com/users/ants","html_url":"https://github.com/ants","followers_url":"https://api.github.com/users/ants/followers","following_url":"https://api.github.com/users/ants/following{/other_user}","gists_url":"https://api.github.com/users/ants/gists{/gist_id}","starred_url":"https://api.github.com/users/ants/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ants/subscriptions","organizations_url":"https://api.github.com/users/ants/orgs","repos_url":"https://api.github.com/users/ants/repos","events_url":"https://api.github.com/users/ants/events{/privacy}","received_events_url":"https://api.github.com/users/ants/received_events","type":"User","site_admin":false},"body":"This is WIP/RFC patch that would fix #283 . I haven't actually tested it outside running the test suite and there a couple of changes yet to be made, but some preliminary feedback on the approach taken would be nice.\r\n\r\nPreviously pg_ctl waited for a timeout and then happily trodded on considering PostgreSQL to be running. This caused PostgreSQL to show up in listings as running when it was actually not and caused a race condition that resulted in either a failover or a crash recovery or a crash recovery interrupted by failover and a missed rewind.\r\n\r\nThis change adds a master_start_timeout parameter and introduces a new state for the main run_cycle loop: starting. When master_start_timeout is zero we will fail over as soon as there is a failover candidate. Otherwise PostgreSQL will be started, but once master_start_timeout expires we will stop and release leader lock if failover is possible. Once failover succeeds or fails (no leader and no one to take the role) we continue with normal processing. While we are waiting for the master timeout we handle manual failover requests.","created_at":"2016-09-08T08:48:09Z","updated_at":"2016-09-16T13:18:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"528ed14423227da6cd2f000cc03d899bef52ebd6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zalando/patroni/pulls/295/commits","review_comments_url":"https://api.github.com/repos/zalando/patroni/pulls/295/comments","review_comment_url":"https://api.github.com/repos/zalando/patroni/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zalando/patroni/issues/295/comments","statuses_url":"https://api.github.com/repos/zalando/patroni/statuses/cd9617e3852192d089f1a8724e38932cd992b90f","head":{"label":"ants:feature/master_start_timeout","ref":"feature/master_start_timeout","sha":"cd9617e3852192d089f1a8724e38932cd992b90f","user":{"login":"ants","id":64938,"avatar_url":"https://avatars.githubusercontent.com/u/64938?v=3","gravatar_id":"","url":"https://api.github.com/users/ants","html_url":"https://github.com/ants","followers_url":"https://api.github.com/users/ants/followers","following_url":"https://api.github.com/users/ants/following{/other_user}","gists_url":"https://api.github.com/users/ants/gists{/gist_id}","starred_url":"https://api.github.com/users/ants/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ants/subscriptions","organizations_url":"https://api.github.com/users/ants/orgs","repos_url":"https://api.github.com/users/ants/repos","events_url":"https://api.github.com/users/ants/events{/privacy}","received_events_url":"https://api.github.com/users/ants/received_events","type":"User","site_admin":false},"repo":{"id":65907385,"name":"patroni","full_name":"ants/patroni","owner":{"login":"ants","id":64938,"avatar_url":"https://avatars.githubusercontent.com/u/64938?v=3","gravatar_id":"","url":"https://api.github.com/users/ants","html_url":"https://github.com/ants","followers_url":"https://api.github.com/users/ants/followers","following_url":"https://api.github.com/users/ants/following{/other_user}","gists_url":"https://api.github.com/users/ants/gists{/gist_id}","starred_url":"https://api.github.com/users/ants/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ants/subscriptions","organizations_url":"https://api.github.com/users/ants/orgs","repos_url":"https://api.github.com/users/ants/repos","events_url":"https://api.github.com/users/ants/events{/privacy}","received_events_url":"https://api.github.com/users/ants/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ants/patroni","description":"A template for PostgreSQL High Availability with ZooKeeper, etcd or Consul","fork":true,"url":"https://api.github.com/repos/ants/patroni","forks_url":"https://api.github.com/repos/ants/patroni/forks","keys_url":"https://api.github.com/repos/ants/patroni/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ants/patroni/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ants/patroni/teams","hooks_url":"https://api.github.com/repos/ants/patroni/hooks","issue_events_url":"https://api.github.com/repos/ants/patroni/issues/events{/number}","events_url":"https://api.github.com/repos/ants/patroni/events","assignees_url":"https://api.github.com/repos/ants/patroni/assignees{/user}","branches_url":"https://api.github.com/repos/ants/patroni/branches{/branch}","tags_url":"https://api.github.com/repos/ants/patroni/tags","blobs_url":"https://api.github.com/repos/ants/patroni/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ants/patroni/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ants/patroni/git/refs{/sha}","trees_url":"https://api.github.com/repos/ants/patroni/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ants/patroni/statuses/{sha}","languages_url":"https://api.github.com/repos/ants/patroni/languages","stargazers_url":"https://api.github.com/repos/ants/patroni/stargazers","contributors_url":"https://api.github.com/repos/ants/patroni/contributors","subscribers_url":"https://api.github.com/repos/ants/patroni/subscribers","subscription_url":"https://api.github.com/repos/ants/patroni/subscription","commits_url":"https://api.github.com/repos/ants/patroni/commits{/sha}","git_commits_url":"https://api.github.com/repos/ants/patroni/git/commits{/sha}","comments_url":"https://api.github.com/repos/ants/patroni/comments{/number}","issue_comment_url":"https://api.github.com/repos/ants/patroni/issues/comments{/number}","contents_url":"https://api.github.com/repos/ants/patroni/contents/{+path}","compare_url":"https://api.github.com/repos/ants/patroni/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ants/patroni/merges","archive_url":"https://api.github.com/repos/ants/patroni/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ants/patroni/downloads","issues_url":"https://api.github.com/repos/ants/patroni/issues{/number}","pulls_url":"https://api.github.com/repos/ants/patroni/pulls{/number}","milestones_url":"https://api.github.com/repos/ants/patroni/milestones{/number}","notifications_url":"https://api.github.com/repos/ants/patroni/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ants/patroni/labels{/name}","releases_url":"https://api.github.com/repos/ants/patroni/releases{/id}","deployments_url":"https://api.github.com/repos/ants/patroni/deployments","created_at":"2016-08-17T12:53:28Z","updated_at":"2016-08-17T12:53:29Z","pushed_at":"2016-09-16T12:06:23Z","git_url":"git://github.com/ants/patroni.git","ssh_url":"git@github.com:ants/patroni.git","clone_url":"https://github.com/ants/patroni.git","svn_url":"https://github.com/ants/patroni","homepage":"","size":1723,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"zalando:master","ref":"master","sha":"540ee2b3c778c88d747994ebc99edd80592fc6bf","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":38744670,"name":"patroni","full_name":"zalando/patroni","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/patroni","description":"A template for PostgreSQL High Availability with ZooKeeper, etcd or Consul","fork":false,"url":"https://api.github.com/repos/zalando/patroni","forks_url":"https://api.github.com/repos/zalando/patroni/forks","keys_url":"https://api.github.com/repos/zalando/patroni/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/patroni/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/patroni/teams","hooks_url":"https://api.github.com/repos/zalando/patroni/hooks","issue_events_url":"https://api.github.com/repos/zalando/patroni/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/patroni/events","assignees_url":"https://api.github.com/repos/zalando/patroni/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/patroni/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/patroni/tags","blobs_url":"https://api.github.com/repos/zalando/patroni/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/patroni/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/patroni/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/patroni/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/patroni/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/patroni/languages","stargazers_url":"https://api.github.com/repos/zalando/patroni/stargazers","contributors_url":"https://api.github.com/repos/zalando/patroni/contributors","subscribers_url":"https://api.github.com/repos/zalando/patroni/subscribers","subscription_url":"https://api.github.com/repos/zalando/patroni/subscription","commits_url":"https://api.github.com/repos/zalando/patroni/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/patroni/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/patroni/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/patroni/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/patroni/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/patroni/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/patroni/merges","archive_url":"https://api.github.com/repos/zalando/patroni/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/patroni/downloads","issues_url":"https://api.github.com/repos/zalando/patroni/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/patroni/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/patroni/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/patroni/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/patroni/labels{/name}","releases_url":"https://api.github.com/repos/zalando/patroni/releases{/id}","deployments_url":"https://api.github.com/repos/zalando/patroni/deployments","created_at":"2015-07-08T09:27:19Z","updated_at":"2016-09-15T22:52:19Z","pushed_at":"2016-09-16T12:06:24Z","git_url":"git://github.com/zalando/patroni.git","ssh_url":"git@github.com:zalando/patroni.git","clone_url":"https://github.com/zalando/patroni.git","svn_url":"https://github.com/zalando/patroni","homepage":"","size":1936,"stargazers_count":304,"watchers_count":304,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":34,"forks":34,"open_issues":34,"watchers":304,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zalando/patroni/pulls/295"},"html":{"href":"https://github.com/zalando/patroni/pull/295"},"issue":{"href":"https://api.github.com/repos/zalando/patroni/issues/295"},"comments":{"href":"https://api.github.com/repos/zalando/patroni/issues/295/comments"},"review_comments":{"href":"https://api.github.com/repos/zalando/patroni/pulls/295/comments"},"review_comment":{"href":"https://api.github.com/repos/zalando/patroni/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zalando/patroni/pulls/295/commits"},"statuses":{"href":"https://api.github.com/repos/zalando/patroni/statuses/cd9617e3852192d089f1a8724e38932cd992b90f"}}}}
{"actor":{"display_login":"CyberDem0n"}}