{"action":"created","comment":{"url":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls/comments/85645329","pull_request_review_id":6339025,"id":85645329,"diff_hunk":"@@ -64,44 +73,44 @@ public SequencerServer(ServerContext serverContext) {\n         Map<String, Object> opts = serverContext.getServerConfig();\n         lastIssuedMap = new ConcurrentHashMap<>();\n         globalIndex = new AtomicLong();\n+        this.opts = opts;\n \n         try {\n             if (!(Boolean) opts.get(\"--memory\")) {\n-                fc = FileChannel.open(FileSystems.getDefault().getPath(opts.get(\"--log-path\")\n-                                + File.separator + \"sequencer_checkpoint\"),\n-                        EnumSet.of(StandardOpenOption.READ, StandardOpenOption.WRITE,\n-                                StandardOpenOption.CREATE, StandardOpenOption.SPARSE));\n+                synchronized (fcLock) {\n+                    open_fc();\n+                }\n                 // schedule checkpointing.\n                 scheduler.scheduleAtFixedRate(this::checkpointState,\n                         Utils.parseLong(opts.get(\"--checkpoint\")),\n                         Utils.parseLong(opts.get(\"--checkpoint\")),\n                         TimeUnit.SECONDS);\n             }\n+            reboot();\n \n-            long newIndex = Utils.parseLong(opts.get(\"--initial-token\"));\n-            if (newIndex == -1) {\n-                if (!(Boolean) opts.get(\"--memory\")) {\n-                    ByteBuffer b = ByteBuffer.allocate((int) fc.size());\n-                    fc.read(b);\n-                    if (fc.size() >= 8) {\n-                        globalIndex.set(b.getLong(0));\n-                    } else {\n-                        log.warn(\"Sequencer recovery requested but checkpoint not set, defaulting to 0\");\n-                        globalIndex.set(0);\n-                    }\n-                } else {\n-                    log.warn(\"Sequencer recovery requested but has no meaning for a in-memory server, defaulting to 0\");\n-                    globalIndex.set(0);\n-                }\n-            } else {\n-                globalIndex.set(newIndex);\n-            }\n             log.info(\"Sequencer initial token set to {}\", globalIndex.get());\n         } catch (Exception ex) {\n             log.warn(\"Exception parsing initial token, default to 0.\", ex);\n+            ex.printStackTrace();\n         }\n     }\n \n+    private void open_fc() {\n+        try {\n+            fc = FileChannel.open(make_checkpoint_path(),\n+                    EnumSet.of(StandardOpenOption.READ, StandardOpenOption.WRITE,\n+                            StandardOpenOption.CREATE, StandardOpenOption.SPARSE));\n+        } catch (IOException e) {\n+            log.warn(\"Error opening \" + make_checkpoint_path() + \": \" + e);\n+            fc = null;\n+        }\n+    }\n+\n+    private java.nio.file.Path make_checkpoint_path() {","path":"src/main/java/org/corfudb/infrastructure/SequencerServer.java","position":87,"original_position":87,"commit_id":"4e5f4447cc9362ef39ffc67534379c9be71de46e","original_commit_id":"4e5f4447cc9362ef39ffc67534379c9be71de46e","user":{"login":"dahliamalkhi","id":5497591,"avatar_url":"https://avatars.githubusercontent.com/u/5497591?v=3","gravatar_id":"","url":"https://api.github.com/users/dahliamalkhi","html_url":"https://github.com/dahliamalkhi","followers_url":"https://api.github.com/users/dahliamalkhi/followers","following_url":"https://api.github.com/users/dahliamalkhi/following{/other_user}","gists_url":"https://api.github.com/users/dahliamalkhi/gists{/gist_id}","starred_url":"https://api.github.com/users/dahliamalkhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dahliamalkhi/subscriptions","organizations_url":"https://api.github.com/users/dahliamalkhi/orgs","repos_url":"https://api.github.com/users/dahliamalkhi/repos","events_url":"https://api.github.com/users/dahliamalkhi/events{/privacy}","received_events_url":"https://api.github.com/users/dahliamalkhi/received_events","type":"User","site_admin":false},"body":"name..","created_at":"2016-10-29T18:12:22Z","updated_at":"2016-10-29T18:41:49Z","html_url":"https://github.com/CorfuDB/CorfuDB/pull/214#discussion_r85645329","pull_request_url":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls/214","_links":{"self":{"href":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls/comments/85645329"},"html":{"href":"https://github.com/CorfuDB/CorfuDB/pull/214#discussion_r85645329"},"pull_request":{"href":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls/214"}}},"pull_request":{"url":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls/214","id":83372185,"html_url":"https://github.com/CorfuDB/CorfuDB/pull/214","diff_url":"https://github.com/CorfuDB/CorfuDB/pull/214.diff","patch_url":"https://github.com/CorfuDB/CorfuDB/pull/214.patch","issue_url":"https://api.github.com/repos/CorfuDB/CorfuDB/issues/214","number":214,"state":"closed","locked":false,"title":"Support for QuickCheck testing of layout & SMRMap/FGMap objects","user":{"login":"slfritchie","id":75320,"avatar_url":"https://avatars.githubusercontent.com/u/75320?v=3","gravatar_id":"","url":"https://api.github.com/users/slfritchie","html_url":"https://github.com/slfritchie","followers_url":"https://api.github.com/users/slfritchie/followers","following_url":"https://api.github.com/users/slfritchie/following{/other_user}","gists_url":"https://api.github.com/users/slfritchie/gists{/gist_id}","starred_url":"https://api.github.com/users/slfritchie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slfritchie/subscriptions","organizations_url":"https://api.github.com/users/slfritchie/orgs","repos_url":"https://api.github.com/users/slfritchie/repos","events_url":"https://api.github.com/users/slfritchie/events{/privacy}","received_events_url":"https://api.github.com/users/slfritchie/received_events","type":"User","site_admin":false},"body":"Introduce QuickCheck, via overhaul of the cmdlet API for test interface\r\n\r\nThis branch changes the cmdlet API substantially to allow \"quick\r\nand easy\" access to Corfu's main Java APIs from a non-Java language\r\n(in this case, Erlang).  The goal is to allow QuickCheck (either\r\nthe commercial version EQC or the open source version PropEr) to\r\ntest Java APIs.\r\n\r\nEach cmdlet must have a `public String[] main2(String[] args)`.\r\nThe `args` list is the cmdlet's command line arguments, or it's an\r\narray of strings as received from the QuickCheck interface.\r\nThe return String[] array at index 0 must be either \"OK\" or \"ERROR\".\r\nSubsequent indexes, if they exist, contain enough information to be\r\nparseable by QuickCheck and also by humans (if using the original\r\ncmdlet interface).\r\n\r\nThe helper functions `cmdlet.ok()` and `cmdlet.error()` make it easy\r\nto create well-formed return values.\r\n\r\nThe `corfu_layout` and `corfu_smrobject` cmdlets have two new\r\narguments/command-thingies that they support: `reboot` and `reset`\r\n\r\n* reboot: perform a soft reboot, emulating the object's behavior if it\r\n  were being started by the JVM for the first time.  (This is much\r\n  quicker than actually stopping & restarting the JVM.)  Any state on\r\n  disk is consulted in the usual manner.\r\n\r\n* reset: all state on disk is deleted, then the `reboot` method is\r\n  called.  This is necessary for QuickCheck testing to force the\r\n  sequencer, log unit, and layout servers to start from a known\r\n  state prior to a QuickCheck test doing whatever random stuff it\r\n  wants to do.\r\n\r\nThe `reboot` and `reset` commands performed by `corfu_layout` will\r\naffect only the LayoutServer.\r\n\r\nThe `reboot` and `reset` commands performed by `corfu_smrobject` will\r\naffect both the log unit and sequencer servers.\r\n\r\nThe `reboot` implementation should be examined very carefully by my\r\nfellow code reviewers: this reboot stuff is tricksy.  According to\r\nthe QuickCheck models that I've created so far, they seem to work\r\ncorrectly, and they don't appear to be leaking too many resources\r\n(e.g. file descriptors, threads, memory, mmap()'ed VM regions,\r\netc.) ... but I wouldn't bet the farm (yet) that I've refactored\r\nthe reboot() code 100% correctly.\r\n\r\n# Running QuickCheck tests (with EQC or PropEr)\r\n\r\nSee the new file src/test/erlang/README.md for a tutorial.\r\nThis doc also includes an overview of how the Java<->Erlang\r\ncommunication is implemented.\r\n\r\n# Mitigation for bugs 211 and 212\r\n\r\nMy laptop can hit the conditions for bugs 211 and/or 212 fairly\r\nfrequently, when using the prop_parallel() test evaluation: usually\r\nat least once per minute.\r\n\r\nTo allow QuickCheck testing to continue despite these bugs, I've\r\nadded a temp hack to the test evaluation that checks if one of the\r\nlimited number of 211/212 exceptions has happend.  If yes, then the\r\nfailing test is discarded, and the framework continues with the\r\nnext test case.\r\n\r\n# Partial code cruft that's included in this PR\r\n\r\nI was working on the prototype/first draft of the Configuration Manager \r\nwhen I took the long side-track to work on QuickCheck testability.\r\nThe incomplete prototoype is sitting in the LayoutServer object.\r\nI'm leaving this ConfigManager code in place for now; either I or\r\nZeeshan will resume work on it shortly.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/corfudb/corfudb/214)\n<!-- Reviewable:end -->\n","created_at":"2016-08-31T00:53:16Z","updated_at":"2016-10-29T18:41:49Z","closed_at":"2016-09-15T21:02:44Z","merged_at":"2016-09-15T21:02:44Z","merge_commit_sha":"f1cd5d96c186fca299286a63240fd6ae3c5a2c5e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls/214/commits","review_comments_url":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls/214/comments","review_comment_url":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CorfuDB/CorfuDB/issues/214/comments","statuses_url":"https://api.github.com/repos/CorfuDB/CorfuDB/statuses/4e5f4447cc9362ef39ffc67534379c9be71de46e","head":{"label":"slfritchie:slf/quickcheck-testing1","ref":"slf/quickcheck-testing1","sha":"4e5f4447cc9362ef39ffc67534379c9be71de46e","user":{"login":"slfritchie","id":75320,"avatar_url":"https://avatars.githubusercontent.com/u/75320?v=3","gravatar_id":"","url":"https://api.github.com/users/slfritchie","html_url":"https://github.com/slfritchie","followers_url":"https://api.github.com/users/slfritchie/followers","following_url":"https://api.github.com/users/slfritchie/following{/other_user}","gists_url":"https://api.github.com/users/slfritchie/gists{/gist_id}","starred_url":"https://api.github.com/users/slfritchie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slfritchie/subscriptions","organizations_url":"https://api.github.com/users/slfritchie/orgs","repos_url":"https://api.github.com/users/slfritchie/repos","events_url":"https://api.github.com/users/slfritchie/events{/privacy}","received_events_url":"https://api.github.com/users/slfritchie/received_events","type":"User","site_admin":false},"repo":{"id":60572322,"name":"CorfuDB","full_name":"slfritchie/CorfuDB","owner":{"login":"slfritchie","id":75320,"avatar_url":"https://avatars.githubusercontent.com/u/75320?v=3","gravatar_id":"","url":"https://api.github.com/users/slfritchie","html_url":"https://github.com/slfritchie","followers_url":"https://api.github.com/users/slfritchie/followers","following_url":"https://api.github.com/users/slfritchie/following{/other_user}","gists_url":"https://api.github.com/users/slfritchie/gists{/gist_id}","starred_url":"https://api.github.com/users/slfritchie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slfritchie/subscriptions","organizations_url":"https://api.github.com/users/slfritchie/orgs","repos_url":"https://api.github.com/users/slfritchie/repos","events_url":"https://api.github.com/users/slfritchie/events{/privacy}","received_events_url":"https://api.github.com/users/slfritchie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/slfritchie/CorfuDB","description":"A cluster consistency platform","fork":true,"url":"https://api.github.com/repos/slfritchie/CorfuDB","forks_url":"https://api.github.com/repos/slfritchie/CorfuDB/forks","keys_url":"https://api.github.com/repos/slfritchie/CorfuDB/keys{/key_id}","collaborators_url":"https://api.github.com/repos/slfritchie/CorfuDB/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/slfritchie/CorfuDB/teams","hooks_url":"https://api.github.com/repos/slfritchie/CorfuDB/hooks","issue_events_url":"https://api.github.com/repos/slfritchie/CorfuDB/issues/events{/number}","events_url":"https://api.github.com/repos/slfritchie/CorfuDB/events","assignees_url":"https://api.github.com/repos/slfritchie/CorfuDB/assignees{/user}","branches_url":"https://api.github.com/repos/slfritchie/CorfuDB/branches{/branch}","tags_url":"https://api.github.com/repos/slfritchie/CorfuDB/tags","blobs_url":"https://api.github.com/repos/slfritchie/CorfuDB/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/slfritchie/CorfuDB/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/slfritchie/CorfuDB/git/refs{/sha}","trees_url":"https://api.github.com/repos/slfritchie/CorfuDB/git/trees{/sha}","statuses_url":"https://api.github.com/repos/slfritchie/CorfuDB/statuses/{sha}","languages_url":"https://api.github.com/repos/slfritchie/CorfuDB/languages","stargazers_url":"https://api.github.com/repos/slfritchie/CorfuDB/stargazers","contributors_url":"https://api.github.com/repos/slfritchie/CorfuDB/contributors","subscribers_url":"https://api.github.com/repos/slfritchie/CorfuDB/subscribers","subscription_url":"https://api.github.com/repos/slfritchie/CorfuDB/subscription","commits_url":"https://api.github.com/repos/slfritchie/CorfuDB/commits{/sha}","git_commits_url":"https://api.github.com/repos/slfritchie/CorfuDB/git/commits{/sha}","comments_url":"https://api.github.com/repos/slfritchie/CorfuDB/comments{/number}","issue_comment_url":"https://api.github.com/repos/slfritchie/CorfuDB/issues/comments{/number}","contents_url":"https://api.github.com/repos/slfritchie/CorfuDB/contents/{+path}","compare_url":"https://api.github.com/repos/slfritchie/CorfuDB/compare/{base}...{head}","merges_url":"https://api.github.com/repos/slfritchie/CorfuDB/merges","archive_url":"https://api.github.com/repos/slfritchie/CorfuDB/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/slfritchie/CorfuDB/downloads","issues_url":"https://api.github.com/repos/slfritchie/CorfuDB/issues{/number}","pulls_url":"https://api.github.com/repos/slfritchie/CorfuDB/pulls{/number}","milestones_url":"https://api.github.com/repos/slfritchie/CorfuDB/milestones{/number}","notifications_url":"https://api.github.com/repos/slfritchie/CorfuDB/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/slfritchie/CorfuDB/labels{/name}","releases_url":"https://api.github.com/repos/slfritchie/CorfuDB/releases{/id}","deployments_url":"https://api.github.com/repos/slfritchie/CorfuDB/deployments","created_at":"2016-06-07T01:27:06Z","updated_at":"2016-06-08T20:31:37Z","pushed_at":"2016-10-29T02:02:41Z","git_url":"git://github.com/slfritchie/CorfuDB.git","ssh_url":"git@github.com:slfritchie/CorfuDB.git","clone_url":"https://github.com/slfritchie/CorfuDB.git","svn_url":"https://github.com/slfritchie/CorfuDB","homepage":"","size":932482,"stargazers_count":1,"watchers_count":1,"language":"Java","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":1,"default_branch":"master"}},"base":{"label":"CorfuDB:master","ref":"master","sha":"19488a3160871b864ac4281e19afd8f3443367db","user":{"login":"CorfuDB","id":10199273,"avatar_url":"https://avatars.githubusercontent.com/u/10199273?v=3","gravatar_id":"","url":"https://api.github.com/users/CorfuDB","html_url":"https://github.com/CorfuDB","followers_url":"https://api.github.com/users/CorfuDB/followers","following_url":"https://api.github.com/users/CorfuDB/following{/other_user}","gists_url":"https://api.github.com/users/CorfuDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CorfuDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CorfuDB/subscriptions","organizations_url":"https://api.github.com/users/CorfuDB/orgs","repos_url":"https://api.github.com/users/CorfuDB/repos","events_url":"https://api.github.com/users/CorfuDB/events{/privacy}","received_events_url":"https://api.github.com/users/CorfuDB/received_events","type":"Organization","site_admin":false},"repo":{"id":12960439,"name":"CorfuDB","full_name":"CorfuDB/CorfuDB","owner":{"login":"CorfuDB","id":10199273,"avatar_url":"https://avatars.githubusercontent.com/u/10199273?v=3","gravatar_id":"","url":"https://api.github.com/users/CorfuDB","html_url":"https://github.com/CorfuDB","followers_url":"https://api.github.com/users/CorfuDB/followers","following_url":"https://api.github.com/users/CorfuDB/following{/other_user}","gists_url":"https://api.github.com/users/CorfuDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CorfuDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CorfuDB/subscriptions","organizations_url":"https://api.github.com/users/CorfuDB/orgs","repos_url":"https://api.github.com/users/CorfuDB/repos","events_url":"https://api.github.com/users/CorfuDB/events{/privacy}","received_events_url":"https://api.github.com/users/CorfuDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CorfuDB/CorfuDB","description":"A cluster consistency platform","fork":false,"url":"https://api.github.com/repos/CorfuDB/CorfuDB","forks_url":"https://api.github.com/repos/CorfuDB/CorfuDB/forks","keys_url":"https://api.github.com/repos/CorfuDB/CorfuDB/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CorfuDB/CorfuDB/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CorfuDB/CorfuDB/teams","hooks_url":"https://api.github.com/repos/CorfuDB/CorfuDB/hooks","issue_events_url":"https://api.github.com/repos/CorfuDB/CorfuDB/issues/events{/number}","events_url":"https://api.github.com/repos/CorfuDB/CorfuDB/events","assignees_url":"https://api.github.com/repos/CorfuDB/CorfuDB/assignees{/user}","branches_url":"https://api.github.com/repos/CorfuDB/CorfuDB/branches{/branch}","tags_url":"https://api.github.com/repos/CorfuDB/CorfuDB/tags","blobs_url":"https://api.github.com/repos/CorfuDB/CorfuDB/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CorfuDB/CorfuDB/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CorfuDB/CorfuDB/git/refs{/sha}","trees_url":"https://api.github.com/repos/CorfuDB/CorfuDB/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CorfuDB/CorfuDB/statuses/{sha}","languages_url":"https://api.github.com/repos/CorfuDB/CorfuDB/languages","stargazers_url":"https://api.github.com/repos/CorfuDB/CorfuDB/stargazers","contributors_url":"https://api.github.com/repos/CorfuDB/CorfuDB/contributors","subscribers_url":"https://api.github.com/repos/CorfuDB/CorfuDB/subscribers","subscription_url":"https://api.github.com/repos/CorfuDB/CorfuDB/subscription","commits_url":"https://api.github.com/repos/CorfuDB/CorfuDB/commits{/sha}","git_commits_url":"https://api.github.com/repos/CorfuDB/CorfuDB/git/commits{/sha}","comments_url":"https://api.github.com/repos/CorfuDB/CorfuDB/comments{/number}","issue_comment_url":"https://api.github.com/repos/CorfuDB/CorfuDB/issues/comments{/number}","contents_url":"https://api.github.com/repos/CorfuDB/CorfuDB/contents/{+path}","compare_url":"https://api.github.com/repos/CorfuDB/CorfuDB/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CorfuDB/CorfuDB/merges","archive_url":"https://api.github.com/repos/CorfuDB/CorfuDB/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CorfuDB/CorfuDB/downloads","issues_url":"https://api.github.com/repos/CorfuDB/CorfuDB/issues{/number}","pulls_url":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls{/number}","milestones_url":"https://api.github.com/repos/CorfuDB/CorfuDB/milestones{/number}","notifications_url":"https://api.github.com/repos/CorfuDB/CorfuDB/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CorfuDB/CorfuDB/labels{/name}","releases_url":"https://api.github.com/repos/CorfuDB/CorfuDB/releases{/id}","deployments_url":"https://api.github.com/repos/CorfuDB/CorfuDB/deployments","created_at":"2013-09-19T22:02:36Z","updated_at":"2016-10-25T16:33:06Z","pushed_at":"2016-10-29T09:02:34Z","git_url":"git://github.com/CorfuDB/CorfuDB.git","ssh_url":"git@github.com:CorfuDB/CorfuDB.git","clone_url":"https://github.com/CorfuDB/CorfuDB.git","svn_url":"https://github.com/CorfuDB/CorfuDB","homepage":"","size":1961161,"stargazers_count":95,"watchers_count":95,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":24,"mirror_url":null,"open_issues_count":53,"forks":24,"open_issues":53,"watchers":95,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls/214"},"html":{"href":"https://github.com/CorfuDB/CorfuDB/pull/214"},"issue":{"href":"https://api.github.com/repos/CorfuDB/CorfuDB/issues/214"},"comments":{"href":"https://api.github.com/repos/CorfuDB/CorfuDB/issues/214/comments"},"review_comments":{"href":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls/214/comments"},"review_comment":{"href":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CorfuDB/CorfuDB/pulls/214/commits"},"statuses":{"href":"https://api.github.com/repos/CorfuDB/CorfuDB/statuses/4e5f4447cc9362ef39ffc67534379c9be71de46e"}}}}
{"actor":{"display_login":"dahliamalkhi"}}