This is an automated email from the ASF dual-hosted git repository. daim pushed a commit to branch DetailedGC/OAK-10199 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 236fffa8f147155e491cf5b6508e75d6c7591970 Author: Miroslav Smiljanic <[email protected]> AuthorDate: Mon Jan 22 11:04:05 2024 +0100 OAK-10594 disable Azure writing for all StorageException (#1260) * OAK-10594 disable Azure writing for all StorageException * OAK-10594 add more error codes for retry * OAK-10594 remove imports * OAK-10594 remove * import --------- Co-authored-by: Miroslav Smiljanic <[email protected]> --- .../oak/segment/azure/AzureRepositoryLock.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureRepositoryLock.java b/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureRepositoryLock.java index 046fa2643d..6371f4988e 100644 --- a/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureRepositoryLock.java +++ b/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureRepositoryLock.java @@ -17,7 +17,9 @@ package org.apache.jackrabbit.oak.segment.azure; import com.microsoft.azure.storage.AccessCondition; +import com.microsoft.azure.storage.Constants; import com.microsoft.azure.storage.RetryNoRetry; +import com.microsoft.azure.storage.StorageErrorCode; import com.microsoft.azure.storage.StorageErrorCodeStrings; import com.microsoft.azure.storage.StorageException; import com.microsoft.azure.storage.blob.BlobRequestOptions; @@ -28,6 +30,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; +import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -137,11 +140,14 @@ public class AzureRepositoryLock implements RepositoryLock { } catch (StorageException e) { timeSinceLastUpdate = (System.currentTimeMillis() - lastUpdate) / 1000; - if (e.getErrorCode().equals(StorageErrorCodeStrings.OPERATION_TIMED_OUT)) { - if (timeSinceLastUpdate > timeToWaitBeforeWriteBlock) { - writeAccessController.disableWriting(); - } - log.warn("Could not renew the lease due to the operation timeout. Retry in progress ...", e); + if (timeSinceLastUpdate > timeToWaitBeforeWriteBlock) { + writeAccessController.disableWriting(); + } + + if (Set.of(StorageErrorCodeStrings.OPERATION_TIMED_OUT, StorageErrorCode.SERVICE_INTERNAL_ERROR, StorageErrorCodeStrings.SERVER_BUSY, StorageErrorCodeStrings.INTERNAL_ERROR).contains(e.getErrorCode())) { + log.warn("Could not renew the lease due to the operation timeout or service unavailability. Retry in progress ...", e); + } else if (e.getHttpStatusCode() == Constants.HeaderConstants.HTTP_UNUSED_306) { + log.warn("Client side error. Retry in progress ...", e); } else { log.error("Can't renew the lease", e); shutdownHook.run();
