Enable access to the secondary Azure blobstore service endpoint in Oak blobstore
@@ -55,6 +55,7 @@ import com.google.common.collect.AbstractIterator;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.microsoft.azure.storage.AccessCondition;
+import com.microsoft.azure.storage.LocationMode;
import com.microsoft.azure.storage.ResultContinuation;
import com.microsoft.azure.storage.ResultSegment;
import com.microsoft.azure.storage.RetryPolicy;
@@ -100,6 +101,7 @@ public class AzureBlobStoreBackend extends AbstractSharedBackend {
private static final String REF_KEY = "reference.key";
private static final String LAST_MODIFIED_KEY = "lastModified";
+ private static final String SECONDARY_STORAGE_ACCOUNT_REDUNDANCY_NAME = "oak.blobstore.enable.secondary.storage.location";
private static final long BUFFERED_STREAM_THRESHHOLD = 1024 * 1024;
static final long MIN_MULTIPART_UPLOAD_PART_SIZE = 1024 * 1024 * 10; // 10MB
@@ -123,6 +125,7 @@ public class AzureBlobStoreBackend extends AbstractSharedBackend {
private String downloadDomainOverride = null;
private boolean createBlobContainer = true;
private boolean presignedDownloadURIVerifyExists = true;
+ private String secondaryRedundancy = null;
private Cache<String, URI> httpDownloadURICache;
@@ -141,6 +144,9 @@ public class AzureBlobStoreBackend extends AbstractSharedBackend {
requestOptions.setTimeoutIntervalInMs(requestTimeout);
}
requestOptions.setConcurrentRequestCount(concurrentRequestCount);
+ if (null != secondaryRedundancy) {
+ requestOptions.setLocationMode(LocationMode.PRIMARY_THEN_SECONDARY);
+ }
return Utils.getBlobContainer(connectionString, containerName, requestOptions);
}
@@ -228,6 +234,8 @@ public class AzureBlobStoreBackend extends AbstractSharedBackend {
if (createRefSecretOnInit) {
getOrCreateReferenceKey();
}
+
+ secondaryRedundancy = properties.getProperty(SECONDARY_STORAGE_ACCOUNT_REDUNDANCY_NAME, null);
}
catch (StorageException e) {
throw new DataStoreException(e);
