|
@@ -37,14 +37,12 @@ public class DistributedFileSystem extends FileSystem {
|
|
private Path workingDir =
|
|
private Path workingDir =
|
|
new Path("/user", System.getProperty("user.name"));
|
|
new Path("/user", System.getProperty("user.name"));
|
|
private URI uri;
|
|
private URI uri;
|
|
- private FileSystem localFs;
|
|
|
|
|
|
|
|
DFSClient dfs;
|
|
DFSClient dfs;
|
|
|
|
|
|
public DistributedFileSystem() {
|
|
public DistributedFileSystem() {
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/** @deprecated */
|
|
/** @deprecated */
|
|
public DistributedFileSystem(InetSocketAddress namenode,
|
|
public DistributedFileSystem(InetSocketAddress namenode,
|
|
Configuration conf) throws IOException {
|
|
Configuration conf) throws IOException {
|
|
@@ -65,7 +63,6 @@ public class DistributedFileSystem extends FileSystem {
|
|
int port = uri.getPort();
|
|
int port = uri.getPort();
|
|
this.dfs = new DFSClient(new InetSocketAddress(host, port), conf);
|
|
this.dfs = new DFSClient(new InetSocketAddress(host, port), conf);
|
|
this.uri = URI.create("hdfs://"+host+":"+port);
|
|
this.uri = URI.create("hdfs://"+host+":"+port);
|
|
- this.localFs = getLocal(conf);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public Path getWorkingDirectory() {
|
|
public Path getWorkingDirectory() {
|
|
@@ -114,7 +111,8 @@ public class DistributedFileSystem extends FileSystem {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- public String[][] getFileCacheHints(Path f, long start, long len) throws IOException {
|
|
|
|
|
|
+ public String[][] getFileCacheHints(Path f, long start, long len)
|
|
|
|
+ throws IOException {
|
|
return dfs.getHints(getPathName(f), start, len);
|
|
return dfs.getHints(getPathName(f), start, len);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -133,7 +131,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
throw new IOException("Mkdirs failed to create " + parent);
|
|
throw new IOException("Mkdirs failed to create " + parent);
|
|
}
|
|
}
|
|
|
|
|
|
- return new FSDataOutputStream( dfs.create(getPath(f), overwrite,
|
|
|
|
|
|
+ return new FSDataOutputStream( dfs.create(getPathName(f), overwrite,
|
|
replication, blockSize,
|
|
replication, blockSize,
|
|
progress, bufferSize) );
|
|
progress, bufferSize) );
|
|
}
|
|
}
|
|
@@ -141,7 +139,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
public boolean setReplication(Path src,
|
|
public boolean setReplication(Path src,
|
|
short replication
|
|
short replication
|
|
) throws IOException {
|
|
) throws IOException {
|
|
- return dfs.setReplication(getPath(src), replication);
|
|
|
|
|
|
+ return dfs.setReplication(getPathName(src), replication);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -167,16 +165,16 @@ public class DistributedFileSystem extends FileSystem {
|
|
return ((DfsPath)f).getContentsLength();
|
|
return ((DfsPath)f).getContentsLength();
|
|
}
|
|
}
|
|
|
|
|
|
- DFSFileInfo info[] = dfs.listPaths(getPath(f));
|
|
|
|
|
|
+ DFSFileInfo info[] = dfs.listPaths(getPathName(f));
|
|
return (info == null) ? 0 : info[0].getLen();
|
|
return (info == null) ? 0 : info[0].getLen();
|
|
}
|
|
}
|
|
|
|
|
|
public FileStatus[] listStatus(Path f) throws IOException {
|
|
public FileStatus[] listStatus(Path f) throws IOException {
|
|
- return dfs.listPaths(getPath(f));
|
|
|
|
|
|
+ return dfs.listPaths(getPathName(f));
|
|
}
|
|
}
|
|
|
|
|
|
public Path[] listPaths(Path f) throws IOException {
|
|
public Path[] listPaths(Path f) throws IOException {
|
|
- DFSFileInfo info[] = dfs.listPaths(getPath(f));
|
|
|
|
|
|
+ DFSFileInfo info[] = dfs.listPaths(getPathName(f));
|
|
if (info == null) {
|
|
if (info == null) {
|
|
return new Path[0];
|
|
return new Path[0];
|
|
} else {
|
|
} else {
|
|
@@ -253,7 +251,8 @@ public class DistributedFileSystem extends FileSystem {
|
|
/**
|
|
/**
|
|
* Enter, leave or get safe mode.
|
|
* Enter, leave or get safe mode.
|
|
*
|
|
*
|
|
- * @see org.apache.hadoop.dfs.ClientProtocol#setSafeMode(FSConstants.SafeModeAction)
|
|
|
|
|
|
+ * @see org.apache.hadoop.dfs.ClientProtocol#setSafeMode(
|
|
|
|
+ * FSConstants.SafeModeAction)
|
|
*/
|
|
*/
|
|
public boolean setSafeMode(FSConstants.SafeModeAction action)
|
|
public boolean setSafeMode(FSConstants.SafeModeAction action)
|
|
throws IOException {
|
|
throws IOException {
|
|
@@ -309,8 +308,9 @@ public class DistributedFileSystem extends FileSystem {
|
|
}
|
|
}
|
|
DatanodeInfo[] dataNode = {dfsIn.getCurrentDatanode()};
|
|
DatanodeInfo[] dataNode = {dfsIn.getCurrentDatanode()};
|
|
lblocks[0] = new LocatedBlock(dataBlock, dataNode);
|
|
lblocks[0] = new LocatedBlock(dataBlock, dataNode);
|
|
- LOG.info("Found checksum error in data stream at block=" + dataBlock.getBlockName() +
|
|
|
|
- " on datanode=" + dataNode[0].getName());
|
|
|
|
|
|
+ LOG.info("Found checksum error in data stream at block="
|
|
|
|
+ + dataBlock.getBlockName() + " on datanode="
|
|
|
|
+ + dataNode[0].getName());
|
|
|
|
|
|
// Find block in checksum stream
|
|
// Find block in checksum stream
|
|
DFSClient.DFSDataInputStream dfsSums = (DFSClient.DFSDataInputStream) sums;
|
|
DFSClient.DFSDataInputStream dfsSums = (DFSClient.DFSDataInputStream) sums;
|
|
@@ -321,8 +321,9 @@ public class DistributedFileSystem extends FileSystem {
|
|
}
|
|
}
|
|
DatanodeInfo[] sumsNode = {dfsSums.getCurrentDatanode()};
|
|
DatanodeInfo[] sumsNode = {dfsSums.getCurrentDatanode()};
|
|
lblocks[1] = new LocatedBlock(sumsBlock, sumsNode);
|
|
lblocks[1] = new LocatedBlock(sumsBlock, sumsNode);
|
|
- LOG.info("Found checksum error in checksum stream at block=" + sumsBlock.getBlockName() +
|
|
|
|
- " on datanode=" + sumsNode[0].getName());
|
|
|
|
|
|
+ LOG.info("Found checksum error in checksum stream at block="
|
|
|
|
+ + sumsBlock.getBlockName() + " on datanode="
|
|
|
|
+ + sumsNode[0].getName());
|
|
|
|
|
|
// Ask client to delete blocks.
|
|
// Ask client to delete blocks.
|
|
dfs.reportChecksumFailure(f.toString(), lblocks);
|
|
dfs.reportChecksumFailure(f.toString(), lblocks);
|
|
@@ -339,7 +340,7 @@ public class DistributedFileSystem extends FileSystem {
|
|
return p.info;
|
|
return p.info;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- DFSFileInfo p = dfs.getFileInfo(getPath(f));
|
|
|
|
|
|
+ DFSFileInfo p = dfs.getFileInfo(getPathName(f));
|
|
return p;
|
|
return p;
|
|
}
|
|
}
|
|
}
|
|
}
|