{"action":"created","comment":{"url":"https://api.github.com/repos/apache/distributedlog/pulls/comments/145556801","pull_request_review_id":70374611,"id":145556801,"diff_hunk":"@@ -620,4 +631,271 @@ public void processResult(int rc, String path, Object ctx) {\n         }\n         return promise;\n     }\n+\n+    //\n+    // Rename Log\n+    //\n+\n+    @Override\n+    public CompletableFuture<Void> renameLog(URI uri, String oldStreamName, String newStreamName) {\n+        return getLog(\n+            uri,\n+            oldStreamName,\n+            true,\n+            false\n+        ).thenCompose(metadata -> renameLogMetadata(uri, metadata, newStreamName));\n+    }\n+\n+    private CompletableFuture<Void> renameLogMetadata(URI uri,\n+                                                      LogMetadataForWriter oldMetadata,\n+                                                      String newStreamName) {\n+\n+\n+        final LinkedList<Op> createOps = Lists.newLinkedList();\n+        final LinkedList<Op> deleteOps = Lists.newLinkedList();\n+\n+        List<ACL> acls = zooKeeperClient.getDefaultACL();\n+\n+        // get the root path\n+        String oldRootPath = oldMetadata.getLogRootPath();\n+        String newRootPath = LogMetadata.getLogRootPath(\n+            uri, newStreamName, conf.getUnpartitionedStreamName());\n+\n+        // 0. the log path\n+        deleteOps.addFirst(Op.delete(\n+            LogMetadata.getLogStreamPath(uri, oldMetadata.getLogName()), -1));\n+\n+        // 1. the root path\n+        createOps.addLast(Op.create(\n+            newRootPath, EMPTY_BYTES, acls, CreateMode.PERSISTENT));\n+        deleteOps.addFirst(Op.delete(\n+            oldRootPath, -1));\n+\n+        // 2. max id\n+        Versioned<byte[]> maxTxIdData = oldMetadata.getMaxTxIdData();\n+        deleteOldPathAndCreateNewPath(\n+            oldRootPath, MAX_TXID_PATH, maxTxIdData,\n+            newRootPath, DLUtils.serializeTransactionId(0L), acls,\n+            createOps, deleteOps\n+        );\n+\n+        // 3. version\n+        createOps.addLast(Op.create(\n+            newRootPath + VERSION_PATH, intToBytes(LAYOUT_VERSION), acls, CreateMode.PERSISTENT));\n+        deleteOps.addFirst(Op.delete(\n+            oldRootPath + VERSION_PATH, -1));\n+\n+        // 4. lock path (NOTE: if the stream is locked by a writer, then the delete will fail as you can not","path":"distributedlog-core/src/main/java/org/apache/distributedlog/impl/metadata/ZKLogStreamMetadataStore.java","position":160,"original_position":153,"commit_id":"0ebe5977e81ed1b17ea4e98e008855508438587c","original_commit_id":"aca42b82026d9e5f9ee6463aeec29495975af1e1","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":"done","created_at":"2017-10-18T22:09:58Z","updated_at":"2017-10-18T22:09:58Z","html_url":"https://github.com/apache/distributedlog/pull/210#discussion_r145556801","pull_request_url":"https://api.github.com/repos/apache/distributedlog/pulls/210","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/distributedlog/pulls/comments/145556801"},"html":{"href":"https://github.com/apache/distributedlog/pull/210#discussion_r145556801"},"pull_request":{"href":"https://api.github.com/repos/apache/distributedlog/pulls/210"}},"in_reply_to_id":144455505},"pull_request":{"url":"https://api.github.com/repos/apache/distributedlog/pulls/210","id":146326693,"html_url":"https://github.com/apache/distributedlog/pull/210","diff_url":"https://github.com/apache/distributedlog/pull/210.diff","patch_url":"https://github.com/apache/distributedlog/pull/210.patch","issue_url":"https://api.github.com/repos/apache/distributedlog/issues/210","number":210,"state":"open","locked":false,"title":"Issue 209: Support rename log","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":"Descriptions of the changes in this PR:\r\n\r\n- add rename operation in `Namespace`\r\n- add rename operation in `LogStreamMetadataStore`\r\n- implement the rename operation use zookeeper `multi` operation","created_at":"2017-10-12T22:05:31Z","updated_at":"2017-10-18T22:09:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3c4f60365e0e5dd5b221a1f252adaed9668907d1","assignee":null,"assignees":[],"requested_reviewers":[{"login":"mgodave","id":556310,"avatar_url":"https://avatars3.githubusercontent.com/u/556310?v=4","gravatar_id":"","url":"https://api.github.com/users/mgodave","html_url":"https://github.com/mgodave","followers_url":"https://api.github.com/users/mgodave/followers","following_url":"https://api.github.com/users/mgodave/following{/other_user}","gists_url":"https://api.github.com/users/mgodave/gists{/gist_id}","starred_url":"https://api.github.com/users/mgodave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgodave/subscriptions","organizations_url":"https://api.github.com/users/mgodave/orgs","repos_url":"https://api.github.com/users/mgodave/repos","events_url":"https://api.github.com/users/mgodave/events{/privacy}","received_events_url":"https://api.github.com/users/mgodave/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/apache/distributedlog/milestones/2","html_url":"https://github.com/apache/distributedlog/milestone/2","labels_url":"https://api.github.com/repos/apache/distributedlog/milestones/2/labels","id":2749734,"number":2,"title":"0.6.0","description":"Release 0.6.0","creator":{"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},"open_issues":4,"closed_issues":23,"state":"open","created_at":"2017-09-07T06:56:43Z","updated_at":"2017-10-18T20:09:42Z","due_on":"2017-10-15T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/apache/distributedlog/pulls/210/commits","review_comments_url":"https://api.github.com/repos/apache/distributedlog/pulls/210/comments","review_comment_url":"https://api.github.com/repos/apache/distributedlog/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/distributedlog/issues/210/comments","statuses_url":"https://api.github.com/repos/apache/distributedlog/statuses/0ebe5977e81ed1b17ea4e98e008855508438587c","head":{"label":"sijie:4_support_rename_pr","ref":"4_support_rename_pr","sha":"0ebe5977e81ed1b17ea4e98e008855508438587c","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},"repo":{"id":63934065,"name":"distributedlog","full_name":"sijie/distributedlog","owner":{"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},"private":false,"html_url":"https://github.com/sijie/distributedlog","description":"Apache DistributedLog","fork":true,"url":"https://api.github.com/repos/sijie/distributedlog","forks_url":"https://api.github.com/repos/sijie/distributedlog/forks","keys_url":"https://api.github.com/repos/sijie/distributedlog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sijie/distributedlog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sijie/distributedlog/teams","hooks_url":"https://api.github.com/repos/sijie/distributedlog/hooks","issue_events_url":"https://api.github.com/repos/sijie/distributedlog/issues/events{/number}","events_url":"https://api.github.com/repos/sijie/distributedlog/events","assignees_url":"https://api.github.com/repos/sijie/distributedlog/assignees{/user}","branches_url":"https://api.github.com/repos/sijie/distributedlog/branches{/branch}","tags_url":"https://api.github.com/repos/sijie/distributedlog/tags","blobs_url":"https://api.github.com/repos/sijie/distributedlog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sijie/distributedlog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sijie/distributedlog/git/refs{/sha}","trees_url":"https://api.github.com/repos/sijie/distributedlog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sijie/distributedlog/statuses/{sha}","languages_url":"https://api.github.com/repos/sijie/distributedlog/languages","stargazers_url":"https://api.github.com/repos/sijie/distributedlog/stargazers","contributors_url":"https://api.github.com/repos/sijie/distributedlog/contributors","subscribers_url":"https://api.github.com/repos/sijie/distributedlog/subscribers","subscription_url":"https://api.github.com/repos/sijie/distributedlog/subscription","commits_url":"https://api.github.com/repos/sijie/distributedlog/commits{/sha}","git_commits_url":"https://api.github.com/repos/sijie/distributedlog/git/commits{/sha}","comments_url":"https://api.github.com/repos/sijie/distributedlog/comments{/number}","issue_comment_url":"https://api.github.com/repos/sijie/distributedlog/issues/comments{/number}","contents_url":"https://api.github.com/repos/sijie/distributedlog/contents/{+path}","compare_url":"https://api.github.com/repos/sijie/distributedlog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sijie/distributedlog/merges","archive_url":"https://api.github.com/repos/sijie/distributedlog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sijie/distributedlog/downloads","issues_url":"https://api.github.com/repos/sijie/distributedlog/issues{/number}","pulls_url":"https://api.github.com/repos/sijie/distributedlog/pulls{/number}","milestones_url":"https://api.github.com/repos/sijie/distributedlog/milestones{/number}","notifications_url":"https://api.github.com/repos/sijie/distributedlog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sijie/distributedlog/labels{/name}","releases_url":"https://api.github.com/repos/sijie/distributedlog/releases{/id}","deployments_url":"https://api.github.com/repos/sijie/distributedlog/deployments","created_at":"2016-07-22T07:42:13Z","updated_at":"2017-08-16T02:22:46Z","pushed_at":"2017-10-18T22:08:37Z","git_url":"git://github.com/sijie/distributedlog.git","ssh_url":"git@github.com:sijie/distributedlog.git","clone_url":"https://github.com/sijie/distributedlog.git","svn_url":"https://github.com/sijie/distributedlog","homepage":"https://bookkeeper.apache.org/distributedlog","size":9666,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"05d251fe1bbd2facaa0734218c24d6667f455948","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":63931184,"name":"distributedlog","full_name":"apache/distributedlog","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/distributedlog","description":"Apache DistributedLog","fork":false,"url":"https://api.github.com/repos/apache/distributedlog","forks_url":"https://api.github.com/repos/apache/distributedlog/forks","keys_url":"https://api.github.com/repos/apache/distributedlog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/distributedlog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/distributedlog/teams","hooks_url":"https://api.github.com/repos/apache/distributedlog/hooks","issue_events_url":"https://api.github.com/repos/apache/distributedlog/issues/events{/number}","events_url":"https://api.github.com/repos/apache/distributedlog/events","assignees_url":"https://api.github.com/repos/apache/distributedlog/assignees{/user}","branches_url":"https://api.github.com/repos/apache/distributedlog/branches{/branch}","tags_url":"https://api.github.com/repos/apache/distributedlog/tags","blobs_url":"https://api.github.com/repos/apache/distributedlog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/distributedlog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/distributedlog/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/distributedlog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/distributedlog/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/distributedlog/languages","stargazers_url":"https://api.github.com/repos/apache/distributedlog/stargazers","contributors_url":"https://api.github.com/repos/apache/distributedlog/contributors","subscribers_url":"https://api.github.com/repos/apache/distributedlog/subscribers","subscription_url":"https://api.github.com/repos/apache/distributedlog/subscription","commits_url":"https://api.github.com/repos/apache/distributedlog/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/distributedlog/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/distributedlog/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/distributedlog/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/distributedlog/contents/{+path}","compare_url":"https://api.github.com/repos/apache/distributedlog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/distributedlog/merges","archive_url":"https://api.github.com/repos/apache/distributedlog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/distributedlog/downloads","issues_url":"https://api.github.com/repos/apache/distributedlog/issues{/number}","pulls_url":"https://api.github.com/repos/apache/distributedlog/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/distributedlog/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/distributedlog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/distributedlog/labels{/name}","releases_url":"https://api.github.com/repos/apache/distributedlog/releases{/id}","deployments_url":"https://api.github.com/repos/apache/distributedlog/deployments","created_at":"2016-07-22T07:00:06Z","updated_at":"2017-10-02T20:41:35Z","pushed_at":"2017-10-18T22:08:38Z","git_url":"git://github.com/apache/distributedlog.git","ssh_url":"git@github.com:apache/distributedlog.git","clone_url":"https://github.com/apache/distributedlog.git","svn_url":"https://github.com/apache/distributedlog","homepage":"","size":11009,"stargazers_count":84,"watchers_count":84,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":45,"mirror_url":null,"open_issues_count":14,"forks":45,"open_issues":14,"watchers":84,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/distributedlog/pulls/210"},"html":{"href":"https://github.com/apache/distributedlog/pull/210"},"issue":{"href":"https://api.github.com/repos/apache/distributedlog/issues/210"},"comments":{"href":"https://api.github.com/repos/apache/distributedlog/issues/210/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/distributedlog/pulls/210/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/distributedlog/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/distributedlog/pulls/210/commits"},"statuses":{"href":"https://api.github.com/repos/apache/distributedlog/statuses/0ebe5977e81ed1b17ea4e98e008855508438587c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sijie"}}