HADOOP-13831. Correct check for error code to detect Azure Storage Throttling and provide retries. Contributed by Gaurav Kanade
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/f92913c3 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/f92913c3 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/f92913c3 Branch: refs/heads/YARN-5085 Commit: f92913c35bfda0d565606f9fb9a301ddd4105fd8 Parents: 70ca1f1 Author: Mingliang Liu <[email protected]> Authored: Thu Dec 15 12:35:08 2016 -0800 Committer: Mingliang Liu <[email protected]> Committed: Thu Dec 15 12:35:08 2016 -0800 ---------------------------------------------------------------------- .../apache/hadoop/fs/azure/AzureNativeFileSystemStore.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/f92913c3/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java ---------------------------------------------------------------------- diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java index ac6c514..d232a2d 100644 --- a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java +++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/AzureNativeFileSystemStore.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; import java.net.URI; import java.net.URISyntaxException; import java.net.URLDecoder; @@ -2511,8 +2512,7 @@ public class AzureNativeFileSystemStore implements NativeFileSystemStore { try { dstBlob.startCopyFromBlob(srcBlob, null, getInstrumentedContext()); } catch (StorageException se) { - if (se.getErrorCode().equals( - StorageErrorCode.SERVER_BUSY.toString())) { + if (se.getHttpStatusCode() == HttpURLConnection.HTTP_UNAVAILABLE) { int copyBlobMinBackoff = sessionConfiguration.getInt( KEY_COPYBLOB_MIN_BACKOFF_INTERVAL, DEFAULT_COPYBLOB_MIN_BACKOFF_INTERVAL); @@ -2541,8 +2541,7 @@ public class AzureNativeFileSystemStore implements NativeFileSystemStore { waitForCopyToComplete(dstBlob, getInstrumentedContext()); safeDelete(srcBlob, lease); } catch (StorageException e) { - if (e.getErrorCode().equals( - StorageErrorCode.SERVER_BUSY.toString())) { + if (e.getHttpStatusCode() == HttpURLConnection.HTTP_UNAVAILABLE) { LOG.warn("Rename: CopyBlob: StorageException: ServerBusy: Retry complete, will attempt client side copy for page blob"); InputStream ipStream = null; OutputStream opStream = null; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
