|
@@ -3114,7 +3114,11 @@ public class DFSClient implements FSConstants, java.io.Closeable {
|
|
|
try {
|
|
|
// Pick the "least" datanode as the primary datanode to avoid deadlock.
|
|
|
primaryNode = Collections.min(Arrays.asList(newnodes));
|
|
|
- primary = createClientDatanodeProtocolProxy(primaryNode, conf, block, accessToken, socketTimeout);
|
|
|
+ // Set the timeout to reflect that recovery requires at most two rpcs
|
|
|
+ // to each DN and two rpcs to the NN.
|
|
|
+ int recoveryTimeout = (newnodes.length * 2 + 2) * socketTimeout;
|
|
|
+ primary = createClientDatanodeProtocolProxy(primaryNode, conf, block,
|
|
|
+ accessToken, recoveryTimeout);
|
|
|
newBlock = primary.recoverBlock(block, isAppend, newnodes);
|
|
|
} catch (IOException e) {
|
|
|
LOG.warn("Failed recovery attempt #" + recoveryErrorCount +
|