You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ad...@apache.org on 2023/04/13 07:16:15 UTC
[jackrabbit-oak] branch issues/OAK-10050 created (now f340bb3ffa)
This is an automated email from the ASF dual-hosted git repository.
adulceanu pushed a change to branch issues/OAK-10050
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
at f340bb3ffa Reusing containers hangs when primary location is not available
This branch includes the following new commits:
new f340bb3ffa Reusing containers hangs when primary location is not available
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[jackrabbit-oak] 01/01: Reusing containers hangs when primary location is not available
Posted by ad...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
adulceanu pushed a commit to branch issues/OAK-10050
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit f340bb3ffa7d401bcc1a327c97859cc209468b51
Author: dulceanu <an...@gmail.com>
AuthorDate: Wed Apr 12 10:28:13 2023 +0200
Reusing containers hangs when primary location is not available
---
.../cloud/azure/blobstorage/AzureBlobStoreBackend.java | 14 +++++++++++---
.../oak/segment/azure/AzureSegmentStoreService.java | 8 +++++---
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/oak-blob-cloud-azure/src/main/java/org/apache/jackrabbit/oak/blob/cloud/azure/blobstorage/AzureBlobStoreBackend.java b/oak-blob-cloud-azure/src/main/java/org/apache/jackrabbit/oak/blob/cloud/azure/blobstorage/AzureBlobStoreBackend.java
index a4e88c3693..021aad0d24 100644
--- a/oak-blob-cloud-azure/src/main/java/org/apache/jackrabbit/oak/blob/cloud/azure/blobstorage/AzureBlobStoreBackend.java
+++ b/oak-blob-cloud-azure/src/main/java/org/apache/jackrabbit/oak/blob/cloud/azure/blobstorage/AzureBlobStoreBackend.java
@@ -135,6 +135,12 @@ public class AzureBlobStoreBackend extends AbstractSharedBackend {
}
protected CloudBlobContainer getAzureContainer() throws DataStoreException {
+ BlobRequestOptions requestOptions = getRequestOptions();
+
+ return Utils.getBlobContainer(connectionString, containerName, requestOptions);
+ }
+
+ private BlobRequestOptions getRequestOptions() {
BlobRequestOptions requestOptions = new BlobRequestOptions();
if (null != retryPolicy) {
requestOptions.setRetryPolicyFactory(retryPolicy);
@@ -146,8 +152,7 @@ public class AzureBlobStoreBackend extends AbstractSharedBackend {
if (enableSecondaryLocation) {
requestOptions.setLocationMode(LocationMode.PRIMARY_THEN_SECONDARY);
}
-
- return Utils.getBlobContainer(connectionString, containerName, requestOptions);
+ return requestOptions;
}
@Override
@@ -202,9 +207,12 @@ public class AzureBlobStoreBackend extends AbstractSharedBackend {
AzureConstants.AZURE_BLOB_ENABLE_SECONDARY_LOCATION_DEFAULT
);
+ LOG.info("Using enableSecondaryLocation={}", enableSecondaryLocation);
+
CloudBlobContainer azureContainer = getAzureContainer();
- if (createBlobContainer && azureContainer.createIfNotExists()) {
+ if (createBlobContainer && !azureContainer.exists(null, getRequestOptions(), null)) {
+ azureContainer.create();
LOG.info("New container created. containerName={}", containerName);
} else {
LOG.info("Reusing existing container. containerName={}", containerName);
diff --git a/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureSegmentStoreService.java b/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureSegmentStoreService.java
index 9f515bda21..d3234c8488 100644
--- a/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureSegmentStoreService.java
+++ b/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureSegmentStoreService.java
@@ -117,7 +117,7 @@ public class AzureSegmentStoreService {
}
@NotNull
- private static AzurePersistence createAzurePersistence(
+ public static AzurePersistence createAzurePersistence(
String connectionString,
Configuration configuration,
boolean createContainer
@@ -128,14 +128,16 @@ public class AzureSegmentStoreService {
CloudBlobClient cloudBlobClient = cloud.createCloudBlobClient();
BlobRequestOptions blobRequestOptions = new BlobRequestOptions();
+ log.info("Using enableSecondaryLocation={}", configuration.enableSecondaryLocation());
+
if (configuration.enableSecondaryLocation()) {
blobRequestOptions.setLocationMode(LocationMode.PRIMARY_THEN_SECONDARY);
}
cloudBlobClient.setDefaultRequestOptions(blobRequestOptions);
CloudBlobContainer container = cloudBlobClient.getContainerReference(configuration.containerName());
- if (createContainer) {
- container.createIfNotExists();
+ if (createContainer && !container.exists(null, blobRequestOptions, null)) {
+ container.create();
}
String path = normalizePath(configuration.rootPath());
return new AzurePersistence(container.getDirectoryReference(path));