HBASE-5964. HFileSystem: "No FileSystem for scheme: hdfs"
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1336343 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
31e2b2dee5
commit
2c89cef21a
|
@ -30,6 +30,7 @@ import org.apache.hadoop.fs.FSDataInputStream;
|
||||||
import org.apache.hadoop.fs.FSDataOutputStream;
|
import org.apache.hadoop.fs.FSDataOutputStream;
|
||||||
import org.apache.hadoop.fs.LocalFileSystem;
|
import org.apache.hadoop.fs.LocalFileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
|
import org.apache.hadoop.hbase.util.Methods;
|
||||||
import org.apache.hadoop.util.ReflectionUtils;
|
import org.apache.hadoop.util.ReflectionUtils;
|
||||||
import org.apache.hadoop.util.Progressable;
|
import org.apache.hadoop.util.Progressable;
|
||||||
|
|
||||||
|
@ -141,12 +142,23 @@ public class HFileSystem extends FilterFileSystem {
|
||||||
private static FileSystem newInstanceFileSystem(Configuration conf)
|
private static FileSystem newInstanceFileSystem(Configuration conf)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
URI uri = FileSystem.getDefaultUri(conf);
|
URI uri = FileSystem.getDefaultUri(conf);
|
||||||
|
FileSystem fs = null;
|
||||||
Class<?> clazz = conf.getClass("fs." + uri.getScheme() + ".impl", null);
|
Class<?> clazz = conf.getClass("fs." + uri.getScheme() + ".impl", null);
|
||||||
if (clazz == null) {
|
if (clazz != null) {
|
||||||
|
// This will be true for Hadoop 1.0, or 0.20.
|
||||||
|
fs = (FileSystem)ReflectionUtils.newInstance(clazz, conf);
|
||||||
|
fs.initialize(uri, conf);
|
||||||
|
} else {
|
||||||
|
// For Hadoop 2.0, we have to go through FileSystem for the filesystem
|
||||||
|
// implementation to be loaded by the service loader in case it has not
|
||||||
|
// been loaded yet.
|
||||||
|
Configuration clone = new Configuration(conf);
|
||||||
|
clone.setBoolean("fs." + uri.getScheme() + ".impl.disable.cache", true);
|
||||||
|
fs = FileSystem.get(uri, clone);
|
||||||
|
}
|
||||||
|
if (fs == null) {
|
||||||
throw new IOException("No FileSystem for scheme: " + uri.getScheme());
|
throw new IOException("No FileSystem for scheme: " + uri.getScheme());
|
||||||
}
|
}
|
||||||
FileSystem fs = (FileSystem)ReflectionUtils.newInstance(clazz, conf);
|
|
||||||
fs.initialize(uri, conf);
|
|
||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue