{"action":"created","comment":{"url":"https://api.github.com/repos/apache/bookkeeper/pulls/comments/157031861","pull_request_review_id":83602554,"id":157031861,"diff_hunk":"@@ -0,0 +1,76 @@\n+/*\n+ *\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a copy of the License at\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ *\n+ */\n+package org.apache.bookkeeper.client;\n+\n+import java.util.ArrayList;\n+import java.util.Comparator;\n+import java.util.HashMap;\n+import java.util.List;\n+import java.util.Map;\n+\n+/**\n+ * Handles LastAddSynced on the client side.\n+ */\n+class LastAddSyncedManager {\n+\n+    private final Map<Integer, Long> lastAddSyncedMap = new HashMap<>();","path":"bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LastAddSyncedManager.java","position":34,"original_position":34,"commit_id":"f5871d319ad0b86c23029dce57c2c2d3cf0e43e5","original_commit_id":"f5871d319ad0b86c23029dce57c2c2d3cf0e43e5","user":{"login":"sijie","id":1217863,"avatar_url":"https://avatars2.githubusercontent.com/u/1217863?v=4","gravatar_id":"","url":"https://api.github.com/users/sijie","html_url":"https://github.com/sijie","followers_url":"https://api.github.com/users/sijie/followers","following_url":"https://api.github.com/users/sijie/following{/other_user}","gists_url":"https://api.github.com/users/sijie/gists{/gist_id}","starred_url":"https://api.github.com/users/sijie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sijie/subscriptions","organizations_url":"https://api.github.com/users/sijie/orgs","repos_url":"https://api.github.com/users/sijie/repos","events_url":"https://api.github.com/users/sijie/events{/privacy}","received_events_url":"https://api.github.com/users/sijie/received_events","type":"User","site_admin":false},"body":"I think using `Map<Integer, Long>` here is not efficient. \r\n\r\n- it has a lot of allocations, boxing and unboxing.\r\n- it can be simplified with `long[]`\r\n- most of the ensembles are pretty small (e.g. 3 or 5) ","created_at":"2017-12-14T18:58:29Z","updated_at":"2017-12-14T18:59:04Z","html_url":"https://github.com/apache/bookkeeper/pull/853#discussion_r157031861","pull_request_url":"https://api.github.com/repos/apache/bookkeeper/pulls/853","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/bookkeeper/pulls/comments/157031861"},"html":{"href":"https://github.com/apache/bookkeeper/pull/853#discussion_r157031861"},"pull_request":{"href":"https://api.github.com/repos/apache/bookkeeper/pulls/853"}}},"pull_request":{"url":"https://api.github.com/repos/apache/bookkeeper/pulls/853","id":158380772,"html_url":"https://github.com/apache/bookkeeper/pull/853","diff_url":"https://github.com/apache/bookkeeper/pull/853.diff","patch_url":"https://github.com/apache/bookkeeper/pull/853.patch","issue_url":"https://api.github.com/repos/apache/bookkeeper/issues/853","number":853,"state":"open","locked":false,"title":"BP-14 WriteFlag DEFERRED_SYNC Client Side Implementation","user":{"login":"eolivelli","id":9469110,"avatar_url":"https://avatars0.githubusercontent.com/u/9469110?v=4","gravatar_id":"","url":"https://api.github.com/users/eolivelli","html_url":"https://github.com/eolivelli","followers_url":"https://api.github.com/users/eolivelli/followers","following_url":"https://api.github.com/users/eolivelli/following{/other_user}","gists_url":"https://api.github.com/users/eolivelli/gists{/gist_id}","starred_url":"https://api.github.com/users/eolivelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eolivelli/subscriptions","organizations_url":"https://api.github.com/users/eolivelli/orgs","repos_url":"https://api.github.com/users/eolivelli/repos","events_url":"https://api.github.com/users/eolivelli/events{/privacy}","received_events_url":"https://api.github.com/users/eolivelli/received_events","type":"User","site_admin":false},"body":"Introduce implementation of WriteFlag#DEFERRED_SYNC on LedgerHandle (purely client-side).\r\n\r\nTests are only on the client-side (with Mockito), there is no implementation on the bookie side. Most significant tests will come with the force() API, at this point we can only test that we have not broken the LAC advance mechanism.\r\n\r\nThere is a new class LastAddSyncedManager which will be really used on the next patch, when we will introduce the force() API and the Bookie will be able to return to the client the id of the last entry really sync'd to the journal.\r\n","created_at":"2017-12-14T15:07:10Z","updated_at":"2017-12-14T18:59:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"929c187cb6a4a73d44278c0e62fa8cd9e0c819b5","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/bookkeeper/pulls/853/commits","review_comments_url":"https://api.github.com/repos/apache/bookkeeper/pulls/853/comments","review_comment_url":"https://api.github.com/repos/apache/bookkeeper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/bookkeeper/issues/853/comments","statuses_url":"https://api.github.com/repos/apache/bookkeeper/statuses/f5871d319ad0b86c23029dce57c2c2d3cf0e43e5","head":{"label":"eolivelli:bp14-deferred-force-write-client-side","ref":"bp14-deferred-force-write-client-side","sha":"f5871d319ad0b86c23029dce57c2c2d3cf0e43e5","user":{"login":"eolivelli","id":9469110,"avatar_url":"https://avatars0.githubusercontent.com/u/9469110?v=4","gravatar_id":"","url":"https://api.github.com/users/eolivelli","html_url":"https://github.com/eolivelli","followers_url":"https://api.github.com/users/eolivelli/followers","following_url":"https://api.github.com/users/eolivelli/following{/other_user}","gists_url":"https://api.github.com/users/eolivelli/gists{/gist_id}","starred_url":"https://api.github.com/users/eolivelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eolivelli/subscriptions","organizations_url":"https://api.github.com/users/eolivelli/orgs","repos_url":"https://api.github.com/users/eolivelli/repos","events_url":"https://api.github.com/users/eolivelli/events{/privacy}","received_events_url":"https://api.github.com/users/eolivelli/received_events","type":"User","site_admin":false},"repo":{"id":61374519,"name":"bookkeeper","full_name":"eolivelli/bookkeeper","owner":{"login":"eolivelli","id":9469110,"avatar_url":"https://avatars0.githubusercontent.com/u/9469110?v=4","gravatar_id":"","url":"https://api.github.com/users/eolivelli","html_url":"https://github.com/eolivelli","followers_url":"https://api.github.com/users/eolivelli/followers","following_url":"https://api.github.com/users/eolivelli/following{/other_user}","gists_url":"https://api.github.com/users/eolivelli/gists{/gist_id}","starred_url":"https://api.github.com/users/eolivelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eolivelli/subscriptions","organizations_url":"https://api.github.com/users/eolivelli/orgs","repos_url":"https://api.github.com/users/eolivelli/repos","events_url":"https://api.github.com/users/eolivelli/events{/privacy}","received_events_url":"https://api.github.com/users/eolivelli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eolivelli/bookkeeper","description":"Mirror of Apache Bookkeeper","fork":true,"url":"https://api.github.com/repos/eolivelli/bookkeeper","forks_url":"https://api.github.com/repos/eolivelli/bookkeeper/forks","keys_url":"https://api.github.com/repos/eolivelli/bookkeeper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eolivelli/bookkeeper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eolivelli/bookkeeper/teams","hooks_url":"https://api.github.com/repos/eolivelli/bookkeeper/hooks","issue_events_url":"https://api.github.com/repos/eolivelli/bookkeeper/issues/events{/number}","events_url":"https://api.github.com/repos/eolivelli/bookkeeper/events","assignees_url":"https://api.github.com/repos/eolivelli/bookkeeper/assignees{/user}","branches_url":"https://api.github.com/repos/eolivelli/bookkeeper/branches{/branch}","tags_url":"https://api.github.com/repos/eolivelli/bookkeeper/tags","blobs_url":"https://api.github.com/repos/eolivelli/bookkeeper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eolivelli/bookkeeper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eolivelli/bookkeeper/git/refs{/sha}","trees_url":"https://api.github.com/repos/eolivelli/bookkeeper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eolivelli/bookkeeper/statuses/{sha}","languages_url":"https://api.github.com/repos/eolivelli/bookkeeper/languages","stargazers_url":"https://api.github.com/repos/eolivelli/bookkeeper/stargazers","contributors_url":"https://api.github.com/repos/eolivelli/bookkeeper/contributors","subscribers_url":"https://api.github.com/repos/eolivelli/bookkeeper/subscribers","subscription_url":"https://api.github.com/repos/eolivelli/bookkeeper/subscription","commits_url":"https://api.github.com/repos/eolivelli/bookkeeper/commits{/sha}","git_commits_url":"https://api.github.com/repos/eolivelli/bookkeeper/git/commits{/sha}","comments_url":"https://api.github.com/repos/eolivelli/bookkeeper/comments{/number}","issue_comment_url":"https://api.github.com/repos/eolivelli/bookkeeper/issues/comments{/number}","contents_url":"https://api.github.com/repos/eolivelli/bookkeeper/contents/{+path}","compare_url":"https://api.github.com/repos/eolivelli/bookkeeper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eolivelli/bookkeeper/merges","archive_url":"https://api.github.com/repos/eolivelli/bookkeeper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eolivelli/bookkeeper/downloads","issues_url":"https://api.github.com/repos/eolivelli/bookkeeper/issues{/number}","pulls_url":"https://api.github.com/repos/eolivelli/bookkeeper/pulls{/number}","milestones_url":"https://api.github.com/repos/eolivelli/bookkeeper/milestones{/number}","notifications_url":"https://api.github.com/repos/eolivelli/bookkeeper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eolivelli/bookkeeper/labels{/name}","releases_url":"https://api.github.com/repos/eolivelli/bookkeeper/releases{/id}","deployments_url":"https://api.github.com/repos/eolivelli/bookkeeper/deployments","created_at":"2016-06-17T13:11:53Z","updated_at":"2016-06-17T13:11:55Z","pushed_at":"2017-12-14T15:02:53Z","git_url":"git://github.com/eolivelli/bookkeeper.git","ssh_url":"git@github.com:eolivelli/bookkeeper.git","clone_url":"https://github.com/eolivelli/bookkeeper.git","svn_url":"https://github.com/eolivelli/bookkeeper","homepage":null,"size":14191,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"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":"apache:master","ref":"master","sha":"9d59e6f8066669f2f0a07d7a026d9d7dcdaa2e47","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":1575956,"name":"bookkeeper","full_name":"apache/bookkeeper","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/bookkeeper","description":"Apache Bookkeeper","fork":false,"url":"https://api.github.com/repos/apache/bookkeeper","forks_url":"https://api.github.com/repos/apache/bookkeeper/forks","keys_url":"https://api.github.com/repos/apache/bookkeeper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/bookkeeper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/bookkeeper/teams","hooks_url":"https://api.github.com/repos/apache/bookkeeper/hooks","issue_events_url":"https://api.github.com/repos/apache/bookkeeper/issues/events{/number}","events_url":"https://api.github.com/repos/apache/bookkeeper/events","assignees_url":"https://api.github.com/repos/apache/bookkeeper/assignees{/user}","branches_url":"https://api.github.com/repos/apache/bookkeeper/branches{/branch}","tags_url":"https://api.github.com/repos/apache/bookkeeper/tags","blobs_url":"https://api.github.com/repos/apache/bookkeeper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/bookkeeper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/bookkeeper/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/bookkeeper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/bookkeeper/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/bookkeeper/languages","stargazers_url":"https://api.github.com/repos/apache/bookkeeper/stargazers","contributors_url":"https://api.github.com/repos/apache/bookkeeper/contributors","subscribers_url":"https://api.github.com/repos/apache/bookkeeper/subscribers","subscription_url":"https://api.github.com/repos/apache/bookkeeper/subscription","commits_url":"https://api.github.com/repos/apache/bookkeeper/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/bookkeeper/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/bookkeeper/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/bookkeeper/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/bookkeeper/contents/{+path}","compare_url":"https://api.github.com/repos/apache/bookkeeper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/bookkeeper/merges","archive_url":"https://api.github.com/repos/apache/bookkeeper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/bookkeeper/downloads","issues_url":"https://api.github.com/repos/apache/bookkeeper/issues{/number}","pulls_url":"https://api.github.com/repos/apache/bookkeeper/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/bookkeeper/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/bookkeeper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/bookkeeper/labels{/name}","releases_url":"https://api.github.com/repos/apache/bookkeeper/releases{/id}","deployments_url":"https://api.github.com/repos/apache/bookkeeper/deployments","created_at":"2011-04-06T07:00:07Z","updated_at":"2017-12-13T12:01:37Z","pushed_at":"2017-12-14T15:28:25Z","git_url":"git://github.com/apache/bookkeeper.git","ssh_url":"git@github.com:apache/bookkeeper.git","clone_url":"https://github.com/apache/bookkeeper.git","svn_url":"https://github.com/apache/bookkeeper","homepage":"https://bookkeeper.apache.org","size":19751,"stargazers_count":238,"watchers_count":238,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":146,"mirror_url":null,"archived":false,"open_issues_count":148,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":146,"open_issues":148,"watchers":238,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/bookkeeper/pulls/853"},"html":{"href":"https://github.com/apache/bookkeeper/pull/853"},"issue":{"href":"https://api.github.com/repos/apache/bookkeeper/issues/853"},"comments":{"href":"https://api.github.com/repos/apache/bookkeeper/issues/853/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/bookkeeper/pulls/853/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/bookkeeper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/bookkeeper/pulls/853/commits"},"statuses":{"href":"https://api.github.com/repos/apache/bookkeeper/statuses/f5871d319ad0b86c23029dce57c2c2d3cf0e43e5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sijie"}}