Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8578D175F1 for ; Mon, 26 Jan 2015 19:34:57 +0000 (UTC) Received: (qmail 42969 invoked by uid 500); 26 Jan 2015 19:34:57 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 42925 invoked by uid 500); 26 Jan 2015 19:34:57 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 42916 invoked by uid 99); 26 Jan 2015 19:34:57 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jan 2015 19:34:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A880CE03F2; Mon, 26 Jan 2015 19:34:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: apurtell@apache.org To: commits@hbase.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: Revert "HBASE-12892 Add a class to allow taking a snapshot from the command line" Date: Mon, 26 Jan 2015 19:34:57 +0000 (UTC) Repository: hbase Updated Branches: refs/heads/0.98 547b78095 -> de01f6f4d Revert "HBASE-12892 Add a class to allow taking a snapshot from the command line" This reverts commit 547b7809535d6deb63beca8ea5f2102f08b73ca6. Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/de01f6f4 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/de01f6f4 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/de01f6f4 Branch: refs/heads/0.98 Commit: de01f6f4d58d3647496fcedbe8b51d8fe3534e27 Parents: 547b780 Author: Andrew Purtell Authored: Mon Jan 26 11:34:39 2015 -0800 Committer: Andrew Purtell Committed: Mon Jan 26 11:34:39 2015 -0800 ---------------------------------------------------------------------- bin/hbase | 3 - .../hadoop/hbase/snapshot/CreateSnapshot.java | 86 -------------------- 2 files changed, 89 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/de01f6f4/bin/hbase ---------------------------------------------------------------------- diff --git a/bin/hbase b/bin/hbase index 3d87c0f..41620f0 100755 --- a/bin/hbase +++ b/bin/hbase @@ -84,7 +84,6 @@ if [ $# = 0 ]; then echo " shell Run the HBase shell" echo " hbck Run the hbase 'fsck' tool" echo " hlog Write-ahead-log analyzer" - echo " snapshot Create a new snapshot of a table" echo " hfile Store file analyzer" echo " zkcli Run the ZooKeeper shell" echo " upgrade Upgrade hbase" @@ -298,8 +297,6 @@ elif [ "$COMMAND" = "zkcli" ] ; then CLASS="org.apache.hadoop.hbase.zookeeper.ZooKeeperMainServer" elif [ "$COMMAND" = "upgrade" ] ; then CLASS="org.apache.hadoop.hbase.migration.UpgradeTo96" -elif [ "$COMMAND" = "snapshot" ] ; then - CLASS="org.apache.hadoop.hbase.snapshot.CreateSnapshot" elif [ "$COMMAND" = "master" ] ; then CLASS='org.apache.hadoop.hbase.master.HMaster' if [ "$1" != "stop" ] && [ "$1" != "clear" ] ; then http://git-wip-us.apache.org/repos/asf/hbase/blob/de01f6f4/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/CreateSnapshot.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/CreateSnapshot.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/CreateSnapshot.java deleted file mode 100644 index 06b6017..0000000 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/CreateSnapshot.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * 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. - */ -package org.apache.hadoop.hbase.snapshot; - -import org.apache.commons.cli.CommandLine; -import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.Admin; -import org.apache.hadoop.hbase.client.Connection; -import org.apache.hadoop.hbase.client.ConnectionFactory; -import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; -import org.apache.hadoop.hbase.util.AbstractHBaseTool; -import java.util.Arrays; - - -/** - * This is a command line class that will snapshot a given table. - */ -public class CreateSnapshot extends AbstractHBaseTool { - private String tableName = null; - private String snapshotName = null; - private String snapshotType = null; - - public static void main(String[] args) { - new CreateSnapshot().doStaticMain(args); - } - - @Override - protected void addOptions() { - this.addRequiredOptWithArg("t", "table", "The name of the table"); - this.addRequiredOptWithArg("n", "name", "The name of the created snapshot"); - this.addOptWithArg("s", "snapshot_type", - "Snapshot Type. FLUSH is default. Posible values are " - + Arrays.toString(HBaseProtos.SnapshotDescription.Type.values())); - } - - @Override - protected void processOptions(CommandLine cmd) { - this.tableName = cmd.getOptionValue('t'); - this.snapshotName = cmd.getOptionValue('n'); - this.snapshotType = cmd.getOptionValue('s'); - - } - - @Override - protected int doWork() throws Exception { - Connection connection = null; - Admin admin = null; - try { - connection = ConnectionFactory.createConnection(getConf()); - admin = connection.getAdmin(); - HBaseProtos.SnapshotDescription.Type type = HBaseProtos.SnapshotDescription.Type.FLUSH; - if (snapshotType != null) { - type = HBaseProtos.SnapshotDescription.Type.valueOf(snapshotName.toUpperCase()); - } - - admin.snapshot(snapshotName, TableName.valueOf(tableName), type); - } catch (Exception e) { - return -1; - } finally { - if (admin != null) { - admin.close(); - } - if (connection != null) { - connection.close(); - } - } - return 0; - } - -}