Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
import org.apache.hadoop.hdfs.protocolPB.PBHelperClient;
import org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier;
import org.apache.hadoop.hdfs.security.token.block.InvalidBlockTokenException;
import org.apache.hadoop.hdfs.server.namenode.LeaseExpiredException;
import org.apache.hadoop.io.EnumSetWritable;
import org.apache.hadoop.ipc.RemoteException;
import org.apache.hadoop.net.NetUtils;
Expand Down Expand Up @@ -640,8 +639,9 @@ public static boolean shouldRetryCreate(RemoteException e) {

static void completeFile(FanOutOneBlockAsyncDFSOutput output, DFSClient client,
ClientProtocol namenode, String src, String clientName, ExtendedBlock block,
HdfsFileStatus stat) {
for (int retry = 0;; retry++) {
HdfsFileStatus stat) throws IOException {
int maxRetries = client.getConf().getNumBlockWriteLocateFollowingRetry();
for (int retry = 0; retry < maxRetries; retry++) {
try {
if (namenode.complete(src, clientName, block, stat.getFileId())) {
endFileLease(output);
Expand All @@ -650,18 +650,11 @@ static void completeFile(FanOutOneBlockAsyncDFSOutput output, DFSClient client,
LOG.warn("complete file " + src + " not finished, retry = " + retry);
}
} catch (RemoteException e) {
IOException ioe = e.unwrapRemoteException();
if (ioe instanceof LeaseExpiredException) {
LOG.warn("lease for file " + src + " is expired, give up", e);
return;
} else {
LOG.warn("complete file " + src + " failed, retry = " + retry, e);
}
} catch (Exception e) {
LOG.warn("complete file " + src + " failed, retry = " + retry, e);
throw e.unwrapRemoteException();
}
sleepIgnoreInterrupt(retry);
}
throw new IOException("can not complete file after retrying " + maxRetries + " times");
}

static void sleepIgnoreInterrupt(int retry) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
(in particular, if you are doing it for the first time), instead do
'mvn package'. If you are interested in the full story, see
https://issues.apache.org/jira/browse/HBASE-6795.

for trigger test
-->
<modelVersion>4.0.0</modelVersion>
<parent>
Expand Down