You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by zh...@apache.org on 2017/08/22 13:02:43 UTC

[bookkeeper] branch master updated: ISSUE #254: Remove BookKeeperTools

This is an automated email from the ASF dual-hosted git repository.

zhaijia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new b15e167  ISSUE #254: Remove BookKeeperTools
b15e167 is described below

commit b15e167f49d968d0e990a0eb467ca1f186bdc0a7
Author: Arvin <ar...@gmail.com>
AuthorDate: Tue Aug 22 21:02:31 2017 +0800

    ISSUE #254: Remove BookKeeperTools
    
    Descriptions of the changes in this PR:
    remove the BookKeeperTools,
    update the latest admin docs and BookieRecoveryTest's annotation.
    
    Author: Arvin <ar...@gmail.com>
    
    Reviewers: Jia Zhai <None>, Enrico Olivelli <eo...@gmail.com>
    
    This closes #452 from ArvinDevel/master, closes #254
---
 .../apache/bookkeeper/tools/BookKeeperTools.java   | 88 ----------------------
 .../bookkeeper/client/BookieRecoveryTest.java      |  2 +-
 site/docs/latest/admin/autorecovery.md             |  6 +-
 site/docs/latest/admin/bookies.md                  |  4 +-
 4 files changed, 6 insertions(+), 94 deletions(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/BookKeeperTools.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/BookKeeperTools.java
deleted file mode 100644
index 41a9c00..0000000
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/tools/BookKeeperTools.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.apache.bookkeeper.tools;
-
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-import org.apache.bookkeeper.client.BKException;
-import org.apache.bookkeeper.client.BookKeeperAdmin;
-import org.apache.bookkeeper.net.BookieSocketAddress;
-import org.apache.zookeeper.KeeperException;
-
-import java.io.IOException;
-
-/**
- * Provides Admin Tools to manage the BookKeeper cluster.
- *
- */
-public class BookKeeperTools {
-
-    /**
-     * Main method so we can invoke the bookie recovery via command line.
-     *
-     * @param args
-     *            Arguments to BookKeeperTools. 2 are required and the third is
-     *            optional. The first is a comma separated list of ZK server
-     *            host:port pairs. The second is the host:port socket address
-     *            for the bookie we are trying to recover. The third is the
-     *            host:port socket address of the optional destination bookie
-     *            server we want to replicate the data over to.
-     * @throws InterruptedException
-     * @throws IOException
-     * @throws KeeperException
-     * @throws BKException
-     */
-    public static void main(String[] args)
-            throws InterruptedException, IOException, KeeperException, BKException {
-        // Validate the inputs
-        if (args.length < 2) {
-            System.err.println("USAGE: BookKeeperTools zkServers bookieSrc [bookieDest]");
-            return;
-        }
-        // Parse out the input arguments
-        String zkServers = args[0];
-        String bookieSrcString[] = args[1].split(":");
-        if (bookieSrcString.length < 2) {
-            System.err.println("BookieSrc inputted has invalid name format (host:port expected): " + args[1]);
-            return;
-        }
-        final BookieSocketAddress bookieSrc = new BookieSocketAddress(bookieSrcString[0], Integer
-                .parseInt(bookieSrcString[1]));
-        BookieSocketAddress bookieDest = null;
-        if (args.length > 2) {
-            String bookieDestString[] = args[2].split(":");
-            if (bookieDestString.length < 2) {
-                System.err.println("BookieDest inputted has invalid name format (host:port expected): "
-                                   + args[2]);
-                return;
-            }
-            bookieDest = new BookieSocketAddress(bookieDestString[0], Integer.parseInt(bookieDestString[1]));
-        }
-
-        // Create the BookKeeperTools instance and perform the bookie recovery
-        // synchronously.
-        BookKeeperAdmin bkTools = new BookKeeperAdmin(zkServers);
-        bkTools.recoverBookieData(bookieSrc, bookieDest);
-
-        // Shutdown the resources used in the BookKeeperTools instance.
-        bkTools.close();
-    }
-
-}
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieRecoveryTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieRecoveryTest.java
index b33cbfd..c707c46 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieRecoveryTest.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieRecoveryTest.java
@@ -124,7 +124,7 @@ public class BookieRecoveryTest extends BookKeeperClusterTestCase {
     @After
     @Override
     public void tearDown() throws Exception {
-        // Release any resources used by the BookKeeperTools instance.
+        // Release any resources used by the BookieRecoveryTest instance.
         if(bkAdmin != null){
             bkAdmin.close();
         }
diff --git a/site/docs/latest/admin/autorecovery.md b/site/docs/latest/admin/autorecovery.md
index 64c6beb..d572346 100644
--- a/site/docs/latest/admin/autorecovery.md
+++ b/site/docs/latest/admin/autorecovery.md
@@ -11,14 +11,14 @@ When a {% pop bookie %} crashes, all {% pop ledgers %} on that bookie become und
 
 You can manually recover failed bookies using the [`bookkeeper`](../../reference/cli) command-line tool. You need to specify:
 
-* that the `org.apache.bookkeeper.tools.BookKeeperTools` class needs to be run
+* the `shell recover` option 
 * an IP and port for your BookKeeper cluster's ZooKeeper ensemble
 * the IP and port for the failed bookie
 
 Here's an example:
 
 ```bash
-$ bookkeeper-server/bin/bookkeeper org.apache.bookkeeper.tools.BookKeeperTools \
+$ bookkeeper-server/bin/bookkeeper shell recover \
   zk1.example.com:2181 \ # IP and port for ZooKeeper
   192.168.1.10:3181      # IP and port for the failed bookie
 ```
@@ -26,7 +26,7 @@ $ bookkeeper-server/bin/bookkeeper org.apache.bookkeeper.tools.BookKeeperTools \
 If you wish, you can also specify which bookie you'd like to rereplicate to. Here's an example:
 
 ```bash
-$ bookkeeper-server/bin/bookkeeper org.apache.bookkeeper.tools.BookKeeperTools \
+$ bookkeeper-server/bin/bookkeeper shell recover \
   zk1.example.com:2181 \ # IP and port for ZooKeeper
   192.168.1.10:3181 \    # IP and port for the failed bookie
   192.168.1.11:3181      # IP and port for the bookie to rereplicate to
diff --git a/site/docs/latest/admin/bookies.md b/site/docs/latest/admin/bookies.md
index f9b1dcf..1b0427d 100644
--- a/site/docs/latest/admin/bookies.md
+++ b/site/docs/latest/admin/bookies.md
@@ -162,7 +162,7 @@ If the change was the result of an accidental configuration change, the change c
 1. Run the following command to re-replicate the data:
 
    ```bash
-   $ bin/bookkeeper org.apache.bookkeeper.tools.BookKeeperTools \
+   $ bookkeeper-server/bin/bookkeeper shell recover \
      <zkserver> \
      <oldbookie> \
      <newbookie>
@@ -171,7 +171,7 @@ If the change was the result of an accidental configuration change, the change c
    The ZooKeeper server, old bookie, and new bookie, are all identified by their external IP and `bookiePort` (3181 by default). Here's an example:
 
    ```bash
-   $ bin/bookkeeper org.apache.bookkeeper.tools.BookKeeperTools \
+   $ bookkeeper-server/bin/bookkeeper shell recover \
      zk1.example.com \
      192.168.1.10:3181 \
      192.168.1.10:3181

-- 
To stop receiving notification emails like this one, please contact
['"commits@bookkeeper.apache.org" <co...@bookkeeper.apache.org>'].