You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by ha...@apache.org on 2010/11/15 19:58:14 UTC
svn commit: r1035410 - in /hadoop/hdfs/trunk: CHANGES.txt
src/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java
src/test/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java
Author: hairong
Date: Mon Nov 15 18:58:14 2010
New Revision: 1035410
URL: http://svn.apache.org/viewvc?rev=1035410&view=rev
Log:
HDFS-1500. TestOfflineImageViewer failing on trunk. Contributed by Hairong Kuang.
Modified:
hadoop/hdfs/trunk/CHANGES.txt
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java
hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java
Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=1035410&r1=1035409&r2=1035410&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Mon Nov 15 18:58:14 2010
@@ -50,6 +50,9 @@ Trunk (unreleased changes)
HDFS-895. Allow hflush/sync to occur in parallel with new writes
to the file. (Todd Lipcon via hairong)
+ HDFS-1500. TestOfflineImageViewer failing on trunk. (Todd Lipcon
+ via hairong)
+
IMPROVEMENTS
HDFS-1304. Add a new unit test for HftpFileSystem.open(..). (szetszwo)
Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java?rev=1035410&r1=1035409&r2=1035410&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/ImageLoaderCurrent.java Mon Nov 15 18:58:14 2010
@@ -120,7 +120,7 @@ class ImageLoaderCurrent implements Imag
protected final DateFormat dateFormat =
new SimpleDateFormat("yyyy-MM-dd HH:mm");
private static int [] versions =
- {-16, -17, -18, -19, -20, -21, -22, -23, -24, -25};
+ {-16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26};
private int imageVersion = 0;
/* (non-Javadoc)
Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java?rev=1035410&r1=1035409&r2=1035410&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java (original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/tools/offlineImageViewer/TestOfflineImageViewer.java Mon Nov 15 18:58:14 2010
@@ -76,7 +76,7 @@ public class TestOfflineImageViewer exte
// Main entry point into testing. Necessary since we only want to generate
// the fsimage file once and use it for multiple tests.
- public void testOIV() {
+ public void testOIV() throws Exception {
File originalFsimage = null;
try {
originalFsimage = initFsimage();
@@ -98,7 +98,7 @@ public class TestOfflineImageViewer exte
// Create a populated namespace for later testing. Save its contents to a
// data structure and store its fsimage location.
- private File initFsimage() {
+ private File initFsimage() throws IOException {
MiniDFSCluster cluster = null;
File orig = null;
try {
@@ -131,11 +131,9 @@ public class TestOfflineImageViewer exte
URI [] files = cluster.getNameDirs().toArray(new URI[0]);
orig = new File(files[0].getPath(), "current/fsimage");
- if(!orig.exists())
+ if (!orig.exists()) {
fail("Didn't generate or can't find fsimage.");
-
- } catch (IOException e) {
- fail("Failed trying to generate fsimage file: " + e.getMessage());
+ }
} finally {
if(cluster != null)
cluster.shutdown();
@@ -152,7 +150,7 @@ public class TestOfflineImageViewer exte
// Verify that we can correctly generate an ls-style output for a valid
// fsimage
- private void outputOfLSVisitor(File originalFsimage) {
+ private void outputOfLSVisitor(File originalFsimage) throws IOException {
File testFile = new File(ROOT, "/basicCheck");
File outputFile = new File(ROOT, "/basicCheckOutput");
@@ -167,8 +165,6 @@ public class TestOfflineImageViewer exte
HashMap<String, LsElements> fileOutput = readLsfile(outputFile);
compareNamespaces(writtenFiles, fileOutput);
- } catch (IOException e) {
- fail("Failed reading valid file: " + e.getMessage());
} finally {
if(testFile.exists()) testFile.delete();
if(outputFile.exists()) outputFile.delete();
@@ -178,7 +174,7 @@ public class TestOfflineImageViewer exte
// Confirm that attempting to read an fsimage file with an unsupported
// layout results in an error
- public void unsupportedFSLayoutVersion(File originalFsimage) {
+ public void unsupportedFSLayoutVersion(File originalFsimage) throws IOException {
File testFile = new File(ROOT, "/invalidLayoutVersion");
File outputFile = new File(ROOT, "invalidLayoutVersionOutput");
@@ -196,8 +192,6 @@ public class TestOfflineImageViewer exte
throw e; // wasn't error we were expecting
System.out.println("Correctly failed at reading bad image version.");
}
- } catch (IOException e) {
- fail("Problem testing unsupported layout version: " + e.getMessage());
} finally {
if(testFile.exists()) testFile.delete();
if(outputFile.exists()) outputFile.delete();
@@ -205,7 +199,7 @@ public class TestOfflineImageViewer exte
}
// Verify that image viewer will bail on a file that ends unexpectedly
- private void truncatedFSImage(File originalFsimage) {
+ private void truncatedFSImage(File originalFsimage) throws IOException {
File testFile = new File(ROOT, "/truncatedFSImage");
File outputFile = new File(ROOT, "/trucnatedFSImageOutput");
try {
@@ -221,9 +215,7 @@ public class TestOfflineImageViewer exte
} catch (EOFException e) {
System.out.println("Correctly handled EOF");
}
-
- } catch (IOException e) {
- fail("Failed testing truncatedFSImage: " + e.getMessage());
+
} finally {
if(testFile.exists()) testFile.delete();
if(outputFile.exists()) outputFile.delete();
@@ -373,7 +365,7 @@ public class TestOfflineImageViewer exte
}
}
- private void outputOfFileDistributionVisitor(File originalFsimage) {
+ private void outputOfFileDistributionVisitor(File originalFsimage) throws IOException {
File testFile = new File(ROOT, "/basicCheck");
File outputFile = new File(ROOT, "/fileDistributionCheckOutput");
@@ -394,8 +386,6 @@ public class TestOfflineImageViewer exte
assertEquals(row.length, 2);
totalFiles += Integer.parseInt(row[1]);
}
- } catch (IOException e) {
- fail("Failed reading valid file: " + e.getMessage());
} finally {
if(testFile.exists()) testFile.delete();
if(outputFile.exists()) outputFile.delete();