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 0CF6F9B36 for ; Thu, 8 Dec 2011 20:20:42 +0000 (UTC) Received: (qmail 65663 invoked by uid 500); 8 Dec 2011 20:20:41 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 65625 invoked by uid 500); 8 Dec 2011 20:20:41 -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 65618 invoked by uid 99); 8 Dec 2011 20:20:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Dec 2011 20:20:41 +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; Thu, 08 Dec 2011 20:20:39 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0C5B62388A39; Thu, 8 Dec 2011 20:20:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1212084 - in /hadoop/common/trunk/hadoop-common-project/hadoop-common: CHANGES.txt src/test/java/org/apache/hadoop/io/TestSequenceFile.java Date: Thu, 08 Dec 2011 20:20:16 -0000 To: common-commits@hadoop.apache.org From: eli@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111208202017.0C5B62388A39@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: eli Date: Thu Dec 8 20:20:16 2011 New Revision: 1212084 URL: http://svn.apache.org/viewvc?rev=1212084&view=rev Log: HADOOP-7870. fix SequenceFile#createWriter with boolean createParent arg to respect createParent. Contributed by Jon Hsieh Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1212084&r1=1212083&r2=1212084&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt (original) +++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Thu Dec 8 20:20:16 2011 @@ -187,6 +187,9 @@ Release 0.23.1 - Unreleased HADOOP-7854. UGI getCurrentUser is not synchronized. (Daryn Sharp via jitendra) + HADOOP-7870. fix SequenceFile#createWriter with boolean + createParent arg to respect createParent. (Jon Hsieh via eli) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java?rev=1212084&r1=1212083&r2=1212084&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java (original) +++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java Thu Dec 8 20:20:16 2011 @@ -26,6 +26,7 @@ import org.apache.commons.logging.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.io.SequenceFile.CompressionType; +import org.apache.hadoop.io.SequenceFile.Metadata; import org.apache.hadoop.io.compress.CompressionCodec; import org.apache.hadoop.io.compress.DefaultCodec; import org.apache.hadoop.util.ReflectionUtils; @@ -516,6 +517,29 @@ public class TestSequenceFile extends Te assertTrue("InputStream for " + path + " should have been closed.", openedFile[0].isClosed()); } + public void testRecursiveSeqFileCreate() throws IOException { + Configuration conf = new Configuration(); + FileSystem fs = FileSystem.getLocal(conf); + Path name = new Path(new Path(System.getProperty("test.build.data","."), + "recursiveCreateDir") , "file"); + boolean createParent = false; + + try { + SequenceFile.createWriter(fs, conf, name, RandomDatum.class, + RandomDatum.class, 512, (short) 1, 4096, createParent, + CompressionType.NONE, null, new Metadata()); + fail("Expected an IOException due to missing parent"); + } catch (IOException ioe) { + // Expected + } + + createParent = true; + SequenceFile.createWriter(fs, conf, name, RandomDatum.class, + RandomDatum.class, 512, (short) 1, 4096, createParent, + CompressionType.NONE, null, new Metadata()); + // should succeed, fails if exception thrown + } + /** For debugging and testing. */ public static void main(String[] args) throws Exception { int count = 1024 * 1024;