diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java index 95787a1b01..7df54c1dd8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java @@ -870,7 +870,7 @@ public boolean isFileClosed(String src) throws IOException { RemoteMethod method = new RemoteMethod("isFileClosed", new Class[] {String.class}, new RemoteParam()); return rpcClient.invokeSequential(locations, method, Boolean.class, - Boolean.TRUE); + null); } @Override diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcMultiDestination.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcMultiDestination.java index 62e90770eb..20548d51c9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcMultiDestination.java +++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcMultiDestination.java @@ -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 public void testGetContentSummaryEc() throws Exception { DistributedFileSystem routerDFS =