From 60e2f3dd3c3db5295bfdd7715f8b6ba402776449 Mon Sep 17 00:00:00 2001 From: Nick Dimiduk Date: Fri, 1 Mar 2013 10:46:01 -0800 Subject: [PATCH] HBASE-4285 cleanup ImportTsv partitions file litter ImportTsv leaves a 'partitions_blah' file sitting in the user home directory after it completes. This will affect any job that makes use of HFileOutputFormat#configureIncrementalLoad. This patch asks the filesystem to clean up the file after it's through. --- .../hadoop/hbase/mapreduce/HFileOutputFormat.java | 1 + .../hadoop/hbase/mapreduce/TestImportTsv.java | 65 ++++++++++++++++------ 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat.java index 0eb2005..0ffeeb7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat.java @@ -297,6 +297,7 @@ public class HFileOutputFormat extends FileOutputFormat 0); + assertTrue("too many partition files found.", files.length < 2); + } + + // run job job.waitForCompletion(false); assertTrue(job.isSuccessful()); - + + if (verifyPartitions) { + // verify partitions file is deleted + FileStatus[] files = fs.globStatus(new Path(job.getWorkingDirectory(), "partitions_*")); + assertEquals("Failed to clean up partitions file.", 0, files.length); + } + HTable table = new HTable(new Configuration(conf), TAB); boolean verified = false; long pause = conf.getLong("hbase.client.pause", 5 * 1000); -- 1.8.1