You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by GitBox <gi...@apache.org> on 2021/10/04 17:29:40 UTC

[GitHub] [samza] rmatharu commented on a change in pull request #1542: SAMZA-2699: AzureBlob SystemProducer: remove retries when uploading block as azure sdk does internal retries

rmatharu commented on a change in pull request #1542:
URL: https://github.com/apache/samza/pull/1542#discussion_r721571685



##########
File path: samza-azure/src/main/java/org/apache/samza/system/azureblob/avro/AzureBlobOutputStream.java
##########
@@ -322,33 +321,20 @@ private synchronized void uploadBlockAsync() {
       // call async stageblock and add to future
       @Override
       public void run() {
-        int attemptCount = 0;
         byte[] compressedLocalByte = compression.compress(localByte);
         int blockSize = compressedLocalByte.length;
 
-        while (attemptCount < MAX_ATTEMPT) {
-          try {
-            ByteBuffer outputStream = ByteBuffer.wrap(compressedLocalByte, 0, blockSize);
-            metrics.updateCompressByteMetrics(blockSize);
-            LOG.info("{} Upload block start for blob: {} for block size:{}.", blobAsyncClient.getBlobUrl().toString(), blockId, blockSize);
-            metrics.updateAzureUploadMetrics();
-            // StageBlock generates exception on Failure.
-            stageBlock(blockIdEncoded, outputStream, blockSize);
-            break;
-          } catch (InterruptedException e) {
-            String msg = String.format("Upload block for blob: %s failed for blockid: %s due to InterruptedException.",
-                blobAsyncClient.getBlobUrl().toString(), blockId);
-            LOG.error(msg, e);
-            throw new AzureException("InterruptedException encountered during block upload. Will not retry.", e);
-          } catch (Exception e) {
-            attemptCount += 1;
-            String msg = "Upload block for blob: " + blobAsyncClient.getBlobUrl().toString()
-                + " failed for blockid: " + blockId + " due to exception. AttemptCount: " + attemptCount;
-            LOG.error(msg, e);
-            if (attemptCount == MAX_ATTEMPT) {
-              throw new AzureException("Exceeded number of attempts. Max attempts is: " + MAX_ATTEMPT, e);
-            }
-          }
+        try {
+          ByteBuffer outputStream = ByteBuffer.wrap(compressedLocalByte, 0, blockSize);
+          metrics.updateCompressByteMetrics(blockSize);
+          LOG.info("{} Upload block start for blob: {} for block size:{}.", blobAsyncClient.getBlobUrl().toString(), blockId, blockSize);
+          metrics.updateAzureUploadMetrics();

Review comment:
       should metric be updated after upload is complete, i.e.  stageBlock?




-- 
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: commits-unsubscribe@samza.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org