HDFS-14747. RBF: IsFileClosed should be return false when the file is open in multiple destination. Contributed by xuzq.
This commit is contained in:
parent
75bf090990
commit
c92de8209d
@ -870,7 +870,7 @@ public boolean isFileClosed(String src) throws IOException {
|
|||||||
RemoteMethod method = new RemoteMethod("isFileClosed",
|
RemoteMethod method = new RemoteMethod("isFileClosed",
|
||||||
new Class<?>[] {String.class}, new RemoteParam());
|
new Class<?>[] {String.class}, new RemoteParam());
|
||||||
return rpcClient.invokeSequential(locations, method, Boolean.class,
|
return rpcClient.invokeSequential(locations, method, Boolean.class,
|
||||||
Boolean.TRUE);
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -255,6 +255,28 @@ public void testRecoverLease() throws Exception {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test isFileClosed when the result is false.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testIsFileClosed() throws Exception {
|
||||||
|
Path testPath = new Path("/is_file_closed.txt");
|
||||||
|
DistributedFileSystem routerFs =
|
||||||
|
(DistributedFileSystem) getRouterFileSystem();
|
||||||
|
FSDataOutputStream fsDataOutputStream = null;
|
||||||
|
try {
|
||||||
|
fsDataOutputStream = routerFs.create(testPath);
|
||||||
|
fsDataOutputStream.write("hello world".getBytes());
|
||||||
|
fsDataOutputStream.hflush();
|
||||||
|
|
||||||
|
boolean result = routerFs.isFileClosed(testPath);
|
||||||
|
assertFalse(result);
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeStream(fsDataOutputStream);
|
||||||
|
routerFs.delete(testPath, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetContentSummaryEc() throws Exception {
|
public void testGetContentSummaryEc() throws Exception {
|
||||||
DistributedFileSystem routerDFS =
|
DistributedFileSystem routerDFS =
|
||||||
|
Loading…
Reference in New Issue
Block a user