{"action":"created","comment":{"url":"https://api.github.com/repos/couchbaselabs/pydcp/pulls/comments/205817139","pull_request_review_id":141166625,"id":205817139,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTgxNzEzOQ==","diff_hunk":"@@ -201,11 +203,15 @@ def initiate_connection(args):\n         print \"Forcing compression on connection\"\n \n     if args.failover_logging:\n-        if not dcp_log_data.internal and args.log_preset:\n+        if dcp_log_data.external and args.log_preset:\n             reset_list = []\n+            preset_list = []\n             for vb in args.vbuckets:\n-                if not os.path.exists(dcp_log_data.get_path(vb)):\n+                if os.path.exists(dcp_log_data.get_path(vb)):\n+                    preset_list.append(vb)\n+                else:\n                     reset_list.append(vb)\n+            dcp_log_data.setup_log_preset(preset_list)","path":"simple_dcp_client.py","position":43,"original_position":43,"commit_id":"ffc435cdd429619ec9da44dca613efed45afe014","original_commit_id":"ffc435cdd429619ec9da44dca613efed45afe014","user":{"login":"jameseh96","id":6432465,"node_id":"MDQ6VXNlcjY0MzI0NjU=","avatar_url":"https://avatars0.githubusercontent.com/u/6432465?v=4","gravatar_id":"","url":"https://api.github.com/users/jameseh96","html_url":"https://github.com/jameseh96","followers_url":"https://api.github.com/users/jameseh96/followers","following_url":"https://api.github.com/users/jameseh96/following{/other_user}","gists_url":"https://api.github.com/users/jameseh96/gists{/gist_id}","starred_url":"https://api.github.com/users/jameseh96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jameseh96/subscriptions","organizations_url":"https://api.github.com/users/jameseh96/orgs","repos_url":"https://api.github.com/users/jameseh96/repos","events_url":"https://api.github.com/users/jameseh96/events{/privacy}","received_events_url":"https://api.github.com/users/jameseh96/received_events","type":"User","site_admin":false},"body":"It feels like this behaviour could be encapsulated rather than relying on the caller sorting this out - something like ( sticking to the `setup_log_preset` structure)\r\n\r\n```\r\ndcp_log_data = LogData(args.log_path)\r\nif dcp_log_data.external and args.log_preset:\r\n    dcp_log_data.setup_log_preset(args.vbuckets)\r\n```\r\nand (as far as I can tell from looking) all that would need would be for setup_log_preset to handle the file not existing - previously the code relied on the files existing and having valid json in multiple places, (hence resetting non-existent things) but that isn't really the case anymore.\r\n\r\nHypothetically, this could even be reduced to\r\n\r\n```\r\n\r\n class LogData(object):\r\n     def __init__(self, dirpath, vbuckets, retain_existing_logs=True):\r\n        if retain_existing_logs:\r\n            self.setup_log_preset(vbuckets)\r\n        else:\r\n            self.reset(vbuckets)\r\n        ....\r\n....\r\n\r\n\r\ndcp_log_data = LogData(args.log_path, args.vbuckets, args.log_preset)\r\n\r\n```\r\n\r\nBut as always, just a suggestion, it's at your discretion as to whether it is worth it :)","created_at":"2018-07-27T15:44:00Z","updated_at":"2018-07-27T15:44:01Z","html_url":"https://github.com/couchbaselabs/pydcp/pull/37#discussion_r205817139","pull_request_url":"https://api.github.com/repos/couchbaselabs/pydcp/pulls/37","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/couchbaselabs/pydcp/pulls/comments/205817139"},"html":{"href":"https://github.com/couchbaselabs/pydcp/pull/37#discussion_r205817139"},"pull_request":{"href":"https://api.github.com/repos/couchbaselabs/pydcp/pulls/37"}}},"pull_request":{"url":"https://api.github.com/repos/couchbaselabs/pydcp/pulls/37","id":204139195,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0MTM5MTk1","html_url":"https://github.com/couchbaselabs/pydcp/pull/37","diff_url":"https://github.com/couchbaselabs/pydcp/pull/37.diff","patch_url":"https://github.com/couchbaselabs/pydcp/pull/37.patch","issue_url":"https://api.github.com/repos/couchbaselabs/pydcp/issues/37","number":37,"state":"open","locked":false,"title":"Reduction of file accesses for logging","user":{"login":"CSubmerged","id":32954345,"node_id":"MDQ6VXNlcjMyOTU0MzQ1","avatar_url":"https://avatars1.githubusercontent.com/u/32954345?v=4","gravatar_id":"","url":"https://api.github.com/users/CSubmerged","html_url":"https://github.com/CSubmerged","followers_url":"https://api.github.com/users/CSubmerged/followers","following_url":"https://api.github.com/users/CSubmerged/following{/other_user}","gists_url":"https://api.github.com/users/CSubmerged/gists{/gist_id}","starred_url":"https://api.github.com/users/CSubmerged/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CSubmerged/subscriptions","organizations_url":"https://api.github.com/users/CSubmerged/orgs","repos_url":"https://api.github.com/users/CSubmerged/repos","events_url":"https://api.github.com/users/CSubmerged/events{/privacy}","received_events_url":"https://api.github.com/users/CSubmerged/received_events","type":"User","site_admin":false},"body":"Converted the majority of dcp_data_persist to always record to an\r\ninternal dictionary, and only write to the external JSON files\r\nwhen required, improving file access efficiency.","created_at":"2018-07-26T13:17:54Z","updated_at":"2018-07-27T15:44:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cfe90f51f64c846299e6059973aa8f796292c67e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"dhaikney","id":5340416,"node_id":"MDQ6VXNlcjUzNDA0MTY=","avatar_url":"https://avatars0.githubusercontent.com/u/5340416?v=4","gravatar_id":"","url":"https://api.github.com/users/dhaikney","html_url":"https://github.com/dhaikney","followers_url":"https://api.github.com/users/dhaikney/followers","following_url":"https://api.github.com/users/dhaikney/following{/other_user}","gists_url":"https://api.github.com/users/dhaikney/gists{/gist_id}","starred_url":"https://api.github.com/users/dhaikney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhaikney/subscriptions","organizations_url":"https://api.github.com/users/dhaikney/orgs","repos_url":"https://api.github.com/users/dhaikney/repos","events_url":"https://api.github.com/users/dhaikney/events{/privacy}","received_events_url":"https://api.github.com/users/dhaikney/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/couchbaselabs/pydcp/pulls/37/commits","review_comments_url":"https://api.github.com/repos/couchbaselabs/pydcp/pulls/37/comments","review_comment_url":"https://api.github.com/repos/couchbaselabs/pydcp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/couchbaselabs/pydcp/issues/37/comments","statuses_url":"https://api.github.com/repos/couchbaselabs/pydcp/statuses/ffc435cdd429619ec9da44dca613efed45afe014","head":{"label":"CSubmerged:master","ref":"master","sha":"ffc435cdd429619ec9da44dca613efed45afe014","user":{"login":"CSubmerged","id":32954345,"node_id":"MDQ6VXNlcjMyOTU0MzQ1","avatar_url":"https://avatars1.githubusercontent.com/u/32954345?v=4","gravatar_id":"","url":"https://api.github.com/users/CSubmerged","html_url":"https://github.com/CSubmerged","followers_url":"https://api.github.com/users/CSubmerged/followers","following_url":"https://api.github.com/users/CSubmerged/following{/other_user}","gists_url":"https://api.github.com/users/CSubmerged/gists{/gist_id}","starred_url":"https://api.github.com/users/CSubmerged/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CSubmerged/subscriptions","organizations_url":"https://api.github.com/users/CSubmerged/orgs","repos_url":"https://api.github.com/users/CSubmerged/repos","events_url":"https://api.github.com/users/CSubmerged/events{/privacy}","received_events_url":"https://api.github.com/users/CSubmerged/received_events","type":"User","site_admin":false},"repo":{"id":142435924,"node_id":"MDEwOlJlcG9zaXRvcnkxNDI0MzU5MjQ=","name":"pydcp-1","full_name":"CSubmerged/pydcp-1","owner":{"login":"CSubmerged","id":32954345,"node_id":"MDQ6VXNlcjMyOTU0MzQ1","avatar_url":"https://avatars1.githubusercontent.com/u/32954345?v=4","gravatar_id":"","url":"https://api.github.com/users/CSubmerged","html_url":"https://github.com/CSubmerged","followers_url":"https://api.github.com/users/CSubmerged/followers","following_url":"https://api.github.com/users/CSubmerged/following{/other_user}","gists_url":"https://api.github.com/users/CSubmerged/gists{/gist_id}","starred_url":"https://api.github.com/users/CSubmerged/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CSubmerged/subscriptions","organizations_url":"https://api.github.com/users/CSubmerged/orgs","repos_url":"https://api.github.com/users/CSubmerged/repos","events_url":"https://api.github.com/users/CSubmerged/events{/privacy}","received_events_url":"https://api.github.com/users/CSubmerged/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CSubmerged/pydcp-1","description":"A testsuite for the Couchbase DCP protocol","fork":true,"url":"https://api.github.com/repos/CSubmerged/pydcp-1","forks_url":"https://api.github.com/repos/CSubmerged/pydcp-1/forks","keys_url":"https://api.github.com/repos/CSubmerged/pydcp-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CSubmerged/pydcp-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CSubmerged/pydcp-1/teams","hooks_url":"https://api.github.com/repos/CSubmerged/pydcp-1/hooks","issue_events_url":"https://api.github.com/repos/CSubmerged/pydcp-1/issues/events{/number}","events_url":"https://api.github.com/repos/CSubmerged/pydcp-1/events","assignees_url":"https://api.github.com/repos/CSubmerged/pydcp-1/assignees{/user}","branches_url":"https://api.github.com/repos/CSubmerged/pydcp-1/branches{/branch}","tags_url":"https://api.github.com/repos/CSubmerged/pydcp-1/tags","blobs_url":"https://api.github.com/repos/CSubmerged/pydcp-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CSubmerged/pydcp-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CSubmerged/pydcp-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/CSubmerged/pydcp-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CSubmerged/pydcp-1/statuses/{sha}","languages_url":"https://api.github.com/repos/CSubmerged/pydcp-1/languages","stargazers_url":"https://api.github.com/repos/CSubmerged/pydcp-1/stargazers","contributors_url":"https://api.github.com/repos/CSubmerged/pydcp-1/contributors","subscribers_url":"https://api.github.com/repos/CSubmerged/pydcp-1/subscribers","subscription_url":"https://api.github.com/repos/CSubmerged/pydcp-1/subscription","commits_url":"https://api.github.com/repos/CSubmerged/pydcp-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/CSubmerged/pydcp-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/CSubmerged/pydcp-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/CSubmerged/pydcp-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/CSubmerged/pydcp-1/contents/{+path}","compare_url":"https://api.github.com/repos/CSubmerged/pydcp-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CSubmerged/pydcp-1/merges","archive_url":"https://api.github.com/repos/CSubmerged/pydcp-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CSubmerged/pydcp-1/downloads","issues_url":"https://api.github.com/repos/CSubmerged/pydcp-1/issues{/number}","pulls_url":"https://api.github.com/repos/CSubmerged/pydcp-1/pulls{/number}","milestones_url":"https://api.github.com/repos/CSubmerged/pydcp-1/milestones{/number}","notifications_url":"https://api.github.com/repos/CSubmerged/pydcp-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CSubmerged/pydcp-1/labels{/name}","releases_url":"https://api.github.com/repos/CSubmerged/pydcp-1/releases{/id}","deployments_url":"https://api.github.com/repos/CSubmerged/pydcp-1/deployments","created_at":"2018-07-26T12:09:23Z","updated_at":"2018-07-27T10:03:56Z","pushed_at":"2018-07-27T10:03:54Z","git_url":"git://github.com/CSubmerged/pydcp-1.git","ssh_url":"git@github.com:CSubmerged/pydcp-1.git","clone_url":"https://github.com/CSubmerged/pydcp-1.git","svn_url":"https://github.com/CSubmerged/pydcp-1","homepage":"","size":778,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"couchbaselabs:master","ref":"master","sha":"40d6878bced332cb66106a680bf22a0817343fbe","user":{"login":"couchbaselabs","id":636956,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYzNjk1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/636956?v=4","gravatar_id":"","url":"https://api.github.com/users/couchbaselabs","html_url":"https://github.com/couchbaselabs","followers_url":"https://api.github.com/users/couchbaselabs/followers","following_url":"https://api.github.com/users/couchbaselabs/following{/other_user}","gists_url":"https://api.github.com/users/couchbaselabs/gists{/gist_id}","starred_url":"https://api.github.com/users/couchbaselabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/couchbaselabs/subscriptions","organizations_url":"https://api.github.com/users/couchbaselabs/orgs","repos_url":"https://api.github.com/users/couchbaselabs/repos","events_url":"https://api.github.com/users/couchbaselabs/events{/privacy}","received_events_url":"https://api.github.com/users/couchbaselabs/received_events","type":"Organization","site_admin":false},"repo":{"id":13848402,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg0ODQwMg==","name":"pydcp","full_name":"couchbaselabs/pydcp","owner":{"login":"couchbaselabs","id":636956,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYzNjk1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/636956?v=4","gravatar_id":"","url":"https://api.github.com/users/couchbaselabs","html_url":"https://github.com/couchbaselabs","followers_url":"https://api.github.com/users/couchbaselabs/followers","following_url":"https://api.github.com/users/couchbaselabs/following{/other_user}","gists_url":"https://api.github.com/users/couchbaselabs/gists{/gist_id}","starred_url":"https://api.github.com/users/couchbaselabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/couchbaselabs/subscriptions","organizations_url":"https://api.github.com/users/couchbaselabs/orgs","repos_url":"https://api.github.com/users/couchbaselabs/repos","events_url":"https://api.github.com/users/couchbaselabs/events{/privacy}","received_events_url":"https://api.github.com/users/couchbaselabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/couchbaselabs/pydcp","description":"A testsuite for the Couchbase DCP protocol","fork":false,"url":"https://api.github.com/repos/couchbaselabs/pydcp","forks_url":"https://api.github.com/repos/couchbaselabs/pydcp/forks","keys_url":"https://api.github.com/repos/couchbaselabs/pydcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/couchbaselabs/pydcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/couchbaselabs/pydcp/teams","hooks_url":"https://api.github.com/repos/couchbaselabs/pydcp/hooks","issue_events_url":"https://api.github.com/repos/couchbaselabs/pydcp/issues/events{/number}","events_url":"https://api.github.com/repos/couchbaselabs/pydcp/events","assignees_url":"https://api.github.com/repos/couchbaselabs/pydcp/assignees{/user}","branches_url":"https://api.github.com/repos/couchbaselabs/pydcp/branches{/branch}","tags_url":"https://api.github.com/repos/couchbaselabs/pydcp/tags","blobs_url":"https://api.github.com/repos/couchbaselabs/pydcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/couchbaselabs/pydcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/couchbaselabs/pydcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/couchbaselabs/pydcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/couchbaselabs/pydcp/statuses/{sha}","languages_url":"https://api.github.com/repos/couchbaselabs/pydcp/languages","stargazers_url":"https://api.github.com/repos/couchbaselabs/pydcp/stargazers","contributors_url":"https://api.github.com/repos/couchbaselabs/pydcp/contributors","subscribers_url":"https://api.github.com/repos/couchbaselabs/pydcp/subscribers","subscription_url":"https://api.github.com/repos/couchbaselabs/pydcp/subscription","commits_url":"https://api.github.com/repos/couchbaselabs/pydcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/couchbaselabs/pydcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/couchbaselabs/pydcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/couchbaselabs/pydcp/issues/comments{/number}","contents_url":"https://api.github.com/repos/couchbaselabs/pydcp/contents/{+path}","compare_url":"https://api.github.com/repos/couchbaselabs/pydcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/couchbaselabs/pydcp/merges","archive_url":"https://api.github.com/repos/couchbaselabs/pydcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/couchbaselabs/pydcp/downloads","issues_url":"https://api.github.com/repos/couchbaselabs/pydcp/issues{/number}","pulls_url":"https://api.github.com/repos/couchbaselabs/pydcp/pulls{/number}","milestones_url":"https://api.github.com/repos/couchbaselabs/pydcp/milestones{/number}","notifications_url":"https://api.github.com/repos/couchbaselabs/pydcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/couchbaselabs/pydcp/labels{/name}","releases_url":"https://api.github.com/repos/couchbaselabs/pydcp/releases{/id}","deployments_url":"https://api.github.com/repos/couchbaselabs/pydcp/deployments","created_at":"2013-10-25T01:05:55Z","updated_at":"2018-07-26T10:07:07Z","pushed_at":"2018-07-27T10:03:55Z","git_url":"git://github.com/couchbaselabs/pydcp.git","ssh_url":"git@github.com:couchbaselabs/pydcp.git","clone_url":"https://github.com/couchbaselabs/pydcp.git","svn_url":"https://github.com/couchbaselabs/pydcp","homepage":"","size":776,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":9,"open_issues":5,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/couchbaselabs/pydcp/pulls/37"},"html":{"href":"https://github.com/couchbaselabs/pydcp/pull/37"},"issue":{"href":"https://api.github.com/repos/couchbaselabs/pydcp/issues/37"},"comments":{"href":"https://api.github.com/repos/couchbaselabs/pydcp/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/couchbaselabs/pydcp/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/couchbaselabs/pydcp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/couchbaselabs/pydcp/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/couchbaselabs/pydcp/statuses/ffc435cdd429619ec9da44dca613efed45afe014"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jameseh96"}}