shahrs87 commented on code in PR #6513:
URL: https://github.com/apache/hadoop/pull/6513#discussion_r1479057807
##########
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DataStreamer.java:
##########
@@ -1618,24 +1621,33 @@ private void setupPipelineForAppendOrRecovery() throws
IOException {
LOG.warn(msg);
lastException.set(new IOException(msg));
streamerClosed = true;
- return;
+ return false;
}
- setupPipelineInternal(nodes, storageTypes, storageIDs);
+ return setupPipelineInternal(nodes, storageTypes, storageIDs);
}
- protected void setupPipelineInternal(DatanodeInfo[] datanodes,
+ protected boolean setupPipelineInternal(DatanodeInfo[] datanodes,
StorageType[] nodeStorageTypes, String[] nodeStorageIDs)
throws IOException {
boolean success = false;
long newGS = 0L;
+ boolean isCreateStage = BlockConstructionStage.PIPELINE_SETUP_CREATE ==
stage;
while (!success && !streamerClosed && dfsClient.clientRunning) {
if (!handleRestartingDatanode()) {
- return;
+ return false;
+ }
+
+ final boolean isRecovery = errorState.hasInternalError() &&
!isCreateStage;
+
+ // During create stage, if we remove a node (nodes.length - 1)
+ // min replication should still be satisfied.
+ if (isCreateStage && !(dfsClient.dtpReplaceDatanodeOnFailureReplication
> 0 &&
Review Comment:
Reason behind adding this check here:
We are already doing this check in catch block of
`addDatanode2ExistingPipeline` method
[here](https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DataStreamer.java#L1528-L1539).
But when `isAppend` flag is set to `false` and we are in
`PIPELINE_SETUP_CREATE` phase, we exit early from
`addDatanode2ExistingPipeline` method
[here](https://github.com/apache/hadoop/blob/trunk/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DataStreamer.java#L1489-L1492)
Irrespective of ReplaceDatanodeOnFailure policy, we will NEVER add a new
datanode to the pipeline during PIPELINE_SETUP_CREATE stage and if removing one
bad datanode is going to violate
`dfs.client.block.write.replace-datanode-on-failure.min-replication` property
then we should exit early.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]