|
@@ -65,6 +65,7 @@ import org.apache.hadoop.fs.InvalidPathException;
|
|
import org.apache.hadoop.fs.ParentNotDirectoryException;
|
|
import org.apache.hadoop.fs.ParentNotDirectoryException;
|
|
import org.apache.hadoop.fs.Path;
|
|
import org.apache.hadoop.fs.Path;
|
|
import org.apache.hadoop.fs.permission.FsPermission;
|
|
import org.apache.hadoop.fs.permission.FsPermission;
|
|
|
|
+import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys;
|
|
import org.apache.hadoop.hdfs.client.HdfsDataOutputStream;
|
|
import org.apache.hadoop.hdfs.client.HdfsDataOutputStream;
|
|
import org.apache.hadoop.hdfs.protocol.Block;
|
|
import org.apache.hadoop.hdfs.protocol.Block;
|
|
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
|
|
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
|
|
@@ -73,6 +74,7 @@ import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
|
|
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
|
|
import org.apache.hadoop.hdfs.server.blockmanagement.BlockManager;
|
|
|
|
+import org.apache.hadoop.hdfs.server.common.HdfsServerConstants;
|
|
import org.apache.hadoop.hdfs.server.datanode.DataNode;
|
|
import org.apache.hadoop.hdfs.server.datanode.DataNode;
|
|
import org.apache.hadoop.hdfs.server.datanode.DataNodeTestUtils;
|
|
import org.apache.hadoop.hdfs.server.datanode.DataNodeTestUtils;
|
|
import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
|
|
import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
|
|
@@ -377,6 +379,11 @@ public class TestFileCreation {
|
|
Configuration conf = new HdfsConfiguration();
|
|
Configuration conf = new HdfsConfiguration();
|
|
SimulatedFSDataset.setFactory(conf);
|
|
SimulatedFSDataset.setFactory(conf);
|
|
conf.setBoolean(DFSConfigKeys.DFS_PERMISSIONS_ENABLED_KEY, false);
|
|
conf.setBoolean(DFSConfigKeys.DFS_PERMISSIONS_ENABLED_KEY, false);
|
|
|
|
+
|
|
|
|
+ // Force NameNodeProxies' createNNProxyWithClientProtocol to give
|
|
|
|
+ // up file creation after one failure.
|
|
|
|
+ conf.setBoolean(DFSConfigKeys.DFS_CLIENT_TEST_NO_PROXY_RETRIES, true);
|
|
|
|
+
|
|
final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build();
|
|
final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build();
|
|
FileSystem fs = cluster.getFileSystem();
|
|
FileSystem fs = cluster.getFileSystem();
|
|
|
|
|
|
@@ -405,9 +412,8 @@ public class TestFileCreation {
|
|
} catch (IOException abce) {
|
|
} catch (IOException abce) {
|
|
GenericTestUtils.assertExceptionContains("Failed to CREATE_FILE", abce);
|
|
GenericTestUtils.assertExceptionContains("Failed to CREATE_FILE", abce);
|
|
}
|
|
}
|
|
- // NameNodeProxies' createNNProxyWithClientProtocol has 5 retries.
|
|
|
|
assertCounter("AlreadyBeingCreatedExceptionNumOps",
|
|
assertCounter("AlreadyBeingCreatedExceptionNumOps",
|
|
- 6L, getMetrics(metricsName));
|
|
|
|
|
|
+ 1L, getMetrics(metricsName));
|
|
FSDataOutputStream stm2 = fs2.create(p, true);
|
|
FSDataOutputStream stm2 = fs2.create(p, true);
|
|
stm2.write(2);
|
|
stm2.write(2);
|
|
stm2.close();
|
|
stm2.close();
|