GitHub PullRequestReviewCommentEvent at 2014-11-26 21:19:18
Repository: voltdb
Actor: nshi
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments/20964635","id":20964635,"diff_hunk":"@@ -0,0 +1,888 @@\n+package org.voltcore.zk;\n+\n+import java.nio.ByteBuffer;\n+import java.util.Collections;\n+import java.util.HashSet;\n+import java.util.List;\n+import java.util.ListIterator;\n+import java.util.Set;\n+import java.util.concurrent.RejectedExecutionException;\n+import java.util.concurrent.ScheduledThreadPoolExecutor;\n+import java.util.concurrent.atomic.AtomicBoolean;\n+import java.util.concurrent.locks.Lock;\n+import java.util.concurrent.locks.ReentrantLock;\n+\n+import org.apache.zookeeper_voltpatches.CreateMode;\n+import org.apache.zookeeper_voltpatches.KeeperException;\n+import org.apache.zookeeper_voltpatches.WatchedEvent;\n+import org.apache.zookeeper_voltpatches.Watcher;\n+import org.apache.zookeeper_voltpatches.Watcher.Event.KeeperState;\n+import org.apache.zookeeper_voltpatches.ZooDefs.Ids;\n+import org.apache.zookeeper_voltpatches.ZooKeeper;\n+import org.apache.zookeeper_voltpatches.data.Stat;\n+import org.voltcore.logging.VoltLogger;\n+import org.voltcore.utils.CoreUtils;\n+import org.voltcore.utils.Pair;\n+import org.voltdb.VoltDB;\n+import org.voltdb.VoltZK;\n+\n+import com.google_voltpatches.common.collect.ImmutableSet;\n+import com.google_voltpatches.common.collect.Sets;\n+import com.google_voltpatches.common.util.concurrent.ListeningScheduledExecutorService;\n+import com.google_voltpatches.common.util.concurrent.MoreExecutors;\n+\n+/*\n+ * This state machine coexists with other state machines under a single system node used to track\n+ * the participant count. When the\n+ */\n+public class SynchronizedStatesManager {\n+    private final AtomicBoolean m_done = new AtomicBoolean(false);\n+    private Set<String> m_members = new HashSet<String>();\n+    private final StateMachineInstance m_registeredStateMachines [];\n+    private int m_registeredStateMachineInstances = 0;\n+    private static final ScheduledThreadPoolExecutor m_esBase =\n+            new ScheduledThreadPoolExecutor(1,\n+                    CoreUtils.getThreadFactory(null, \"SMI Daemon\", CoreUtils.SMALL_STACK_SIZE, false, null),\n+                                            new java.util.concurrent.ThreadPoolExecutor.DiscardPolicy());\n+    private static final ListeningScheduledExecutorService m_shared_es = MoreExecutors.listeningDecorator(m_esBase);\n+    // We assume that we are far enough along that the HostMessenger is up and running. Otherwise add to constructor.\n+    private final ZooKeeper m_zk;\n+    private final String m_stateMachineRoot;\n+    private final String m_stateMachineMemberPath;\n+    private final String m_memberId;\n+\n+    protected static boolean addIfMissing(ZooKeeper zk, String absolutePath, CreateMode createMode, byte[] data) {\n+        try {\n+            Stat s = zk.exists(absolutePath, false);","path":"src/frontend/org/voltcore/zk/SynchronizedStatesManager.java","position":56,"original_position":56,"commit_id":"29944f0abc06c90973894d2a888cca9c5e459ad4","original_commit_id":"29944f0abc06c90973894d2a888cca9c5e459ad4","user":{"login":"nshi","id":10992,"avatar_url":"https://avatars.githubusercontent.com/u/10992?v=3","gravatar_id":"","url":"https://api.github.com/users/nshi","html_url":"https://github.com/nshi","followers_url":"https://api.github.com/users/nshi/followers","following_url":"https://api.github.com/users/nshi/following{/other_user}","gists_url":"https://api.github.com/users/nshi/gists{/gist_id}","starred_url":"https://api.github.com/users/nshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nshi/subscriptions","organizations_url":"https://api.github.com/users/nshi/orgs","repos_url":"https://api.github.com/users/nshi/repos","events_url":"https://api.github.com/users/nshi/events{/privacy}","received_events_url":"https://api.github.com/users/nshi/received_events","type":"User","site_admin":false},"body":"Since you are already catching `KeeperException.NodeExistsException`, you don't need to check if it exists.","created_at":"2014-11-26T21:19:18Z","updated_at":"2014-11-26T21:19:18Z","html_url":"https://github.com/VoltDB/voltdb/pull/1842#discussion_r20964635","pull_request_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/1842","_links":{"self":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments/20964635"},"html":{"href":"https://github.com/VoltDB/voltdb/pull/1842#discussion_r20964635"},"pull_request":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/1842"}}},"pull_request":{"url":"https://api.github.com/repos/VoltDB/voltdb/pulls/1842","id":25111720,"html_url":"https://github.com/VoltDB/voltdb/pull/1842","diff_url":"https://github.com/VoltDB/voltdb/pull/1842.diff","patch_url":"https://github.com/VoltDB/voltdb/pull/1842.patch","issue_url":"https://api.github.com/repos/VoltDB/voltdb/issues/1842","number":1842,"state":"open","locked":false,"title":"Add Zookeeper-based state machine to coordinate DR functionality on the ...","user":{"login":"wweiss-voltdb","id":6462615,"avatar_url":"https://avatars.githubusercontent.com/u/6462615?v=3","gravatar_id":"","url":"https://api.github.com/users/wweiss-voltdb","html_url":"https://github.com/wweiss-voltdb","followers_url":"https://api.github.com/users/wweiss-voltdb/followers","following_url":"https://api.github.com/users/wweiss-voltdb/following{/other_user}","gists_url":"https://api.github.com/users/wweiss-voltdb/gists{/gist_id}","starred_url":"https://api.github.com/users/wweiss-voltdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wweiss-voltdb/subscriptions","organizations_url":"https://api.github.com/users/wweiss-voltdb/orgs","repos_url":"https://api.github.com/users/wweiss-voltdb/repos","events_url":"https://api.github.com/users/wweiss-voltdb/events{/privacy}","received_events_url":"https://api.github.com/users/wweiss-voltdb/received_events","type":"User","site_admin":false},"body":"...Producer cluster.","created_at":"2014-11-26T20:26:48Z","updated_at":"2014-11-26T21:19:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a4e7015302b65290b793bf748aee149a97bce7a8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/1842/commits","review_comments_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/1842/comments","review_comment_url":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments/{number}","comments_url":"https://api.github.com/repos/VoltDB/voltdb/issues/1842/comments","statuses_url":"https://api.github.com/repos/VoltDB/voltdb/statuses/29944f0abc06c90973894d2a888cca9c5e459ad4","head":{"label":"VoltDB:ENG-7099-DisableDrOnPrimary","ref":"ENG-7099-DisableDrOnPrimary","sha":"29944f0abc06c90973894d2a888cca9c5e459ad4","user":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"repo":{"id":2445970,"name":"voltdb","full_name":"VoltDB/voltdb","owner":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VoltDB/voltdb","description":"VoltDB","fork":false,"url":"https://api.github.com/repos/VoltDB/voltdb","forks_url":"https://api.github.com/repos/VoltDB/voltdb/forks","keys_url":"https://api.github.com/repos/VoltDB/voltdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VoltDB/voltdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VoltDB/voltdb/teams","hooks_url":"https://api.github.com/repos/VoltDB/voltdb/hooks","issue_events_url":"https://api.github.com/repos/VoltDB/voltdb/issues/events{/number}","events_url":"https://api.github.com/repos/VoltDB/voltdb/events","assignees_url":"https://api.github.com/repos/VoltDB/voltdb/assignees{/user}","branches_url":"https://api.github.com/repos/VoltDB/voltdb/branches{/branch}","tags_url":"https://api.github.com/repos/VoltDB/voltdb/tags","blobs_url":"https://api.github.com/repos/VoltDB/voltdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VoltDB/voltdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VoltDB/voltdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/VoltDB/voltdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VoltDB/voltdb/statuses/{sha}","languages_url":"https://api.github.com/repos/VoltDB/voltdb/languages","stargazers_url":"https://api.github.com/repos/VoltDB/voltdb/stargazers","contributors_url":"https://api.github.com/repos/VoltDB/voltdb/contributors","subscribers_url":"https://api.github.com/repos/VoltDB/voltdb/subscribers","subscription_url":"https://api.github.com/repos/VoltDB/voltdb/subscription","commits_url":"https://api.github.com/repos/VoltDB/voltdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/VoltDB/voltdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/VoltDB/voltdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/VoltDB/voltdb/issues/comments/{number}","contents_url":"https://api.github.com/repos/VoltDB/voltdb/contents/{+path}","compare_url":"https://api.github.com/repos/VoltDB/voltdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VoltDB/voltdb/merges","archive_url":"https://api.github.com/repos/VoltDB/voltdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VoltDB/voltdb/downloads","issues_url":"https://api.github.com/repos/VoltDB/voltdb/issues{/number}","pulls_url":"https://api.github.com/repos/VoltDB/voltdb/pulls{/number}","milestones_url":"https://api.github.com/repos/VoltDB/voltdb/milestones{/number}","notifications_url":"https://api.github.com/repos/VoltDB/voltdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VoltDB/voltdb/labels{/name}","releases_url":"https://api.github.com/repos/VoltDB/voltdb/releases{/id}","created_at":"2011-09-23T18:46:12Z","updated_at":"2014-11-26T16:19:43Z","pushed_at":"2014-11-26T20:21:05Z","git_url":"git://github.com/VoltDB/voltdb.git","ssh_url":"git@github.com:VoltDB/voltdb.git","clone_url":"https://github.com/VoltDB/voltdb.git","svn_url":"https://github.com/VoltDB/voltdb","homepage":"http://community.voltdb.com/","size":578633,"stargazers_count":399,"watchers_count":399,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":116,"mirror_url":null,"open_issues_count":22,"forks":116,"open_issues":22,"watchers":399,"default_branch":"master"}},"base":{"label":"VoltDB:dr-integration-prime","ref":"dr-integration-prime","sha":"78a9f1a500a58d78b603e5e26cfb434f657ec880","user":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"repo":{"id":2445970,"name":"voltdb","full_name":"VoltDB/voltdb","owner":{"login":"VoltDB","id":703910,"avatar_url":"https://avatars.githubusercontent.com/u/703910?v=3","gravatar_id":"","url":"https://api.github.com/users/VoltDB","html_url":"https://github.com/VoltDB","followers_url":"https://api.github.com/users/VoltDB/followers","following_url":"https://api.github.com/users/VoltDB/following{/other_user}","gists_url":"https://api.github.com/users/VoltDB/gists{/gist_id}","starred_url":"https://api.github.com/users/VoltDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VoltDB/subscriptions","organizations_url":"https://api.github.com/users/VoltDB/orgs","repos_url":"https://api.github.com/users/VoltDB/repos","events_url":"https://api.github.com/users/VoltDB/events{/privacy}","received_events_url":"https://api.github.com/users/VoltDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VoltDB/voltdb","description":"VoltDB","fork":false,"url":"https://api.github.com/repos/VoltDB/voltdb","forks_url":"https://api.github.com/repos/VoltDB/voltdb/forks","keys_url":"https://api.github.com/repos/VoltDB/voltdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VoltDB/voltdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VoltDB/voltdb/teams","hooks_url":"https://api.github.com/repos/VoltDB/voltdb/hooks","issue_events_url":"https://api.github.com/repos/VoltDB/voltdb/issues/events{/number}","events_url":"https://api.github.com/repos/VoltDB/voltdb/events","assignees_url":"https://api.github.com/repos/VoltDB/voltdb/assignees{/user}","branches_url":"https://api.github.com/repos/VoltDB/voltdb/branches{/branch}","tags_url":"https://api.github.com/repos/VoltDB/voltdb/tags","blobs_url":"https://api.github.com/repos/VoltDB/voltdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VoltDB/voltdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VoltDB/voltdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/VoltDB/voltdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VoltDB/voltdb/statuses/{sha}","languages_url":"https://api.github.com/repos/VoltDB/voltdb/languages","stargazers_url":"https://api.github.com/repos/VoltDB/voltdb/stargazers","contributors_url":"https://api.github.com/repos/VoltDB/voltdb/contributors","subscribers_url":"https://api.github.com/repos/VoltDB/voltdb/subscribers","subscription_url":"https://api.github.com/repos/VoltDB/voltdb/subscription","commits_url":"https://api.github.com/repos/VoltDB/voltdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/VoltDB/voltdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/VoltDB/voltdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/VoltDB/voltdb/issues/comments/{number}","contents_url":"https://api.github.com/repos/VoltDB/voltdb/contents/{+path}","compare_url":"https://api.github.com/repos/VoltDB/voltdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VoltDB/voltdb/merges","archive_url":"https://api.github.com/repos/VoltDB/voltdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VoltDB/voltdb/downloads","issues_url":"https://api.github.com/repos/VoltDB/voltdb/issues{/number}","pulls_url":"https://api.github.com/repos/VoltDB/voltdb/pulls{/number}","milestones_url":"https://api.github.com/repos/VoltDB/voltdb/milestones{/number}","notifications_url":"https://api.github.com/repos/VoltDB/voltdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VoltDB/voltdb/labels{/name}","releases_url":"https://api.github.com/repos/VoltDB/voltdb/releases{/id}","created_at":"2011-09-23T18:46:12Z","updated_at":"2014-11-26T16:19:43Z","pushed_at":"2014-11-26T20:21:05Z","git_url":"git://github.com/VoltDB/voltdb.git","ssh_url":"git@github.com:VoltDB/voltdb.git","clone_url":"https://github.com/VoltDB/voltdb.git","svn_url":"https://github.com/VoltDB/voltdb","homepage":"http://community.voltdb.com/","size":578633,"stargazers_count":399,"watchers_count":399,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":116,"mirror_url":null,"open_issues_count":22,"forks":116,"open_issues":22,"watchers":399,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/1842"},"html":{"href":"https://github.com/VoltDB/voltdb/pull/1842"},"issue":{"href":"https://api.github.com/repos/VoltDB/voltdb/issues/1842"},"comments":{"href":"https://api.github.com/repos/VoltDB/voltdb/issues/1842/comments"},"review_comments":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/1842/comments"},"review_comment":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/VoltDB/voltdb/pulls/1842/commits"},"statuses":{"href":"https://api.github.com/repos/VoltDB/voltdb/statuses/29944f0abc06c90973894d2a888cca9c5e459ad4"}}}}