This is an automated email from the ASF dual-hosted git repository.
miroslav pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/trunk by this push:
new 5cfb02ba07 OAK-11069 - Include RuntimeExceptions so we get logs for
all of these. (#1675)
5cfb02ba07 is described below
commit 5cfb02ba07e623058595c2df0d2dfa4c94d500d9
Author: Axel Hanikel <[email protected]>
AuthorDate: Tue Sep 3 10:37:04 2024 +0200
OAK-11069 - Include RuntimeExceptions so we get logs for all of these.
(#1675)
* OAK-11069 - Include RuntimeExceptions so we get logs for all of these.
* Improve readability, keep retrying on all StorageExceptions
---------
Co-authored-by: Axel Hanikel <[email protected]>
---
.../oak/segment/azure/AzureRepositoryLock.java | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 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 6371f4988e..01a24511f7 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
@@ -96,7 +96,7 @@ public class AzureRepositoryLock implements RepositoryLock {
leaseId = blob.acquireLease(leaseDuration, null);
writeAccessController.enableWriting();
log.info("Acquired lease {}", leaseId);
- } catch (StorageException | IOException e) {
+ } catch (Exception e) {
if (ex == null) {
log.info("Can't acquire the lease. Retrying every 1s.
Timeout is set to {}s.", timeoutSec);
}
@@ -137,17 +137,25 @@ public class AzureRepositoryLock implements
RepositoryLock {
writeAccessController.enableWriting();
lastUpdate = System.currentTimeMillis();
}
- } catch (StorageException e) {
+ } catch (Exception e) {
timeSinceLastUpdate = (System.currentTimeMillis() -
lastUpdate) / 1000;
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);
+ if (e instanceof StorageException) {
+ StorageException storageException = (StorageException) e;
+ if (Set.of(StorageErrorCodeStrings.OPERATION_TIMED_OUT
+ , StorageErrorCode.SERVICE_INTERNAL_ERROR
+ , StorageErrorCodeStrings.SERVER_BUSY
+ ,
StorageErrorCodeStrings.INTERNAL_ERROR).contains(storageException.getErrorCode()))
{
+ log.warn("Could not renew the lease due to the
operation timeout or service unavailability. Retry in progress ...", e);
+ } else if (storageException.getHttpStatusCode() ==
Constants.HeaderConstants.HTTP_UNUSED_306) {
+ log.warn("Client side error. Retry in progress ...",
e);
+ } else {
+ log.warn("Could not renew lease due to storage
exception. Retry in progress ... ", e);
+ }
} else {
log.error("Can't renew the lease", e);
shutdownHook.run();