Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-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 365B5FB08 for ; Sat, 13 Apr 2013 21:41:56 +0000 (UTC) Received: (qmail 61422 invoked by uid 500); 13 Apr 2013 21:41:55 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 61379 invoked by uid 500); 13 Apr 2013 21:41:55 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 61372 invoked by uid 99); 13 Apr 2013 21:41:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Apr 2013 21:41:55 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Apr 2013 21:41:54 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 584B523888CD; Sat, 13 Apr 2013 21:41:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1467706 - in /hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs: FileSystem.java shell/SnapshotCommands.java Date: Sat, 13 Apr 2013 21:41:34 -0000 To: common-commits@hadoop.apache.org From: szetszwo@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130413214134.584B523888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: szetszwo Date: Sat Apr 13 21:41:33 2013 New Revision: 1467706 URL: http://svn.apache.org/r1467706 Log: HDFS-4692. Use timestamp as default snapshot names. Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SnapshotCommands.java Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java?rev=1467706&r1=1467705&r2=1467706&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java Sat Apr 13 21:41:33 2013 @@ -2266,11 +2266,21 @@ public abstract class FileSystem extends } /** + * Create a snapshot with a default name. + * @param path The directory where snapshots will be taken. + * @return the snapshot path. + */ + public final Path createSnapshot(Path path) throws IOException { + return createSnapshot(path, null); + } + + /** * Create a snapshot * @param path The directory where snapshots will be taken. * @param snapshotName The name of the snapshot + * @return the snapshot path. */ - public void createSnapshot(Path path, String snapshotName) + public Path createSnapshot(Path path, String snapshotName) throws IOException { throw new UnsupportedOperationException(getClass().getSimpleName() + " doesn't support createSnapshot"); Modified: hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SnapshotCommands.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SnapshotCommands.java?rev=1467706&r1=1467705&r2=1467706&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SnapshotCommands.java (original) +++ hadoop/common/branches/HDFS-2802/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/SnapshotCommands.java Sat Apr 13 21:41:33 2013 @@ -49,10 +49,10 @@ class SnapshotCommands extends FsCommand */ public static class CreateSnapshot extends FsCommand { public static final String NAME = CREATE_SNAPSHOT; - public static final String USAGE = " "; + public static final String USAGE = " []"; public static final String DESCRIPTION = "Create a snapshot on a directory"; - private String snapshotName; + private String snapshotName = null; @Override protected void processPath(PathData item) throws IOException { @@ -63,12 +63,15 @@ class SnapshotCommands extends FsCommand @Override protected void processOptions(LinkedList args) throws IOException { - if (args.size() != 2) { - throw new IOException("args number not 2:" + args.size()); + if (args.size() == 0) { + throw new IllegalArgumentException(" is missing."); + } + if (args.size() > 2) { + throw new IllegalArgumentException("Too many arguements."); + } + if (args.size() == 2) { + snapshotName = args.removeLast(); } - snapshotName = args.removeLast(); - // TODO: name length check - } @Override @@ -108,8 +111,6 @@ class SnapshotCommands extends FsCommand throw new IOException("args number not 2: " + args.size()); } snapshotName = args.removeLast(); - // TODO: name length check - } @Override @@ -151,8 +152,6 @@ class SnapshotCommands extends FsCommand } newName = args.removeLast(); oldName = args.removeLast(); - - // TODO: new name length check } @Override