You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-commits@hadoop.apache.org by dh...@apache.org on 2010/02/14 10:08:39 UTC
svn commit: r909993 - in /hadoop/mapreduce/trunk: CHANGES.txt
src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java
src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java
Author: dhruba
Date: Sun Feb 14 09:08:38 2010
New Revision: 909993
URL: http://svn.apache.org/viewvc?rev=909993&view=rev
Log:
MAPREDUCE-1490. Fix a NPE that could occur during instantiation and
initialization of the DistributedRaidFileSystem.
(Rodrigo Schmidt via dhruba)
Modified:
hadoop/mapreduce/trunk/CHANGES.txt
hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java
hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java
Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=909993&r1=909992&r2=909993&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Sun Feb 14 09:08:38 2010
@@ -341,6 +341,12 @@
MAPREDUCE-1358. Avoid false positives in OutputLogFilter. (Todd Lipcon via
cdouglas)
+ MAPREDUCE-1490. Fix a NullPointerException that could occur during
+ instantiation and initialization of the DistributedRaidFileSystem.
+ (Rodrigo Schmidt via dhruba)
+
+ cdouglas)
+
Release 0.21.0 - Unreleased
INCOMPATIBLE CHANGES
Modified: hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java?rev=909993&r1=909992&r2=909993&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java (original)
+++ hadoop/mapreduce/trunk/src/contrib/raid/src/java/org/apache/hadoop/hdfs/DistributedRaidFileSystem.java Sun Feb 14 09:08:38 2010
@@ -65,9 +65,17 @@
/* Initialize a Raid FileSystem
*/
public void initialize(URI name, Configuration conf) throws IOException {
- super.initialize(name, conf);
this.conf = conf;
+ Class<?> clazz = conf.getClass("fs.raid.underlyingfs.impl",
+ DistributedFileSystem.class);
+ if (clazz == null) {
+ throw new IOException("No FileSystem for fs.raid.underlyingfs.impl.");
+ }
+
+ this.fs = (FileSystem)ReflectionUtils.newInstance(clazz, null);
+ super.initialize(name, conf);
+
String alt = conf.get("hdfs.raid.locations");
// If no alternates are specified, then behave absolutely same as
Modified: hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java?rev=909993&r1=909992&r2=909993&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java (original)
+++ hadoop/mapreduce/trunk/src/contrib/raid/src/test/org/apache/hadoop/hdfs/TestRaidDfs.java Sun Feb 14 09:08:38 2010
@@ -22,6 +22,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.GregorianCalendar;
@@ -177,10 +178,14 @@
// filter all filesystem calls from client
Configuration clientConf = new Configuration(conf);
- clientConf.set("fs.hdfs.impl", "org.apache.hadoop.dfs.DistributedRaidFileSystem");
- DistributedRaidFileSystem raidfs = new DistributedRaidFileSystem(dfs);
- raidfs.initialize(dfs.getUri(), clientConf);
-
+ clientConf.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedRaidFileSystem");
+ clientConf.set("fs.raid.underlyingfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem");
+ URI dfsUri = dfs.getUri();
+ FileSystem.closeAll();
+ FileSystem raidfs = FileSystem.get(dfsUri, clientConf);
+
+ assertTrue("raidfs not an instance of DistributedRaidFileSystem",raidfs instanceof DistributedRaidFileSystem);
+
// corrupt first block of file
LOG.info("Corrupt first block of file");
corruptBlock(file1, locations.get(0).getBlock());