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 js...@apache.org on 2025/12/17 10:49:25 UTC

(jackrabbit-oak) branch jsedding/OAK-12040-reduce-http-requests-for-writes created (now 3a0191c527)

This is an automated email from the ASF dual-hosted git repository.

jsedding pushed a change to branch jsedding/OAK-12040-reduce-http-requests-for-writes
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


      at 3a0191c527 OAK-12040 - segment-azure: reduce HTTP requests for writes

This branch includes the following new commits:

     new 3a0191c527 OAK-12040 - segment-azure: reduce HTTP requests for writes

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: OAK-12040 - segment-azure: reduce HTTP requests for writes

Posted by js...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jsedding pushed a commit to branch jsedding/OAK-12040-reduce-http-requests-for-writes
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit 3a0191c527fca4add77eab058b393325a997a796
Author: Julian Sedding <js...@apache.org>
AuthorDate: Wed Dec 17 11:49:09 2025 +0100

    OAK-12040 - segment-azure: reduce HTTP requests for writes
---
 .../oak/segment/azure/AzureSegmentArchiveWriter.java          | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureSegmentArchiveWriter.java b/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureSegmentArchiveWriter.java
index d96dce3171..a5baefb407 100644
--- a/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureSegmentArchiveWriter.java
+++ b/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureSegmentArchiveWriter.java
@@ -17,9 +17,13 @@
 package org.apache.jackrabbit.oak.segment.azure;
 
 import com.azure.core.util.BinaryData;
+import com.azure.core.util.Context;
 import com.azure.storage.blob.BlobContainerClient;
+import com.azure.storage.blob.models.BlobRequestConditions;
 import com.azure.storage.blob.models.BlobStorageException;
+import com.azure.storage.blob.options.BlockBlobSimpleUploadOptions;
 import com.azure.storage.blob.specialized.BlockBlobClient;
+import com.azure.storage.common.implementation.Constants;
 import org.apache.jackrabbit.oak.commons.Buffer;
 import org.apache.jackrabbit.oak.commons.time.Stopwatch;
 import org.apache.jackrabbit.oak.segment.azure.util.Retrier;
@@ -77,8 +81,11 @@ public class AzureSegmentArchiveWriter extends AbstractRemoteSegmentArchiveWrite
         ioMonitor.beforeSegmentWrite(new File(blob.getBlobName()), msb, lsb, size);
         Stopwatch stopwatch = Stopwatch.createStarted();
         try {
-            blob.upload(BinaryData.fromBytes(Arrays.copyOfRange(data, offset, offset + size)), true);
-            blob.setMetadata(AzureBlobMetadata.toSegmentMetadata(indexEntry));
+            BlockBlobSimpleUploadOptions options = new BlockBlobSimpleUploadOptions(BinaryData.fromBytes(Arrays.copyOfRange(data, offset, offset + size)))
+                    .setMetadata(AzureBlobMetadata.toSegmentMetadata(indexEntry))
+                    // override existing blob if present
+                    .setRequestConditions(new BlobRequestConditions().setIfNoneMatch(Constants.HeaderConstants.ETAG_WILDCARD));
+            blob.uploadWithResponse(options, null, Context.NONE);
         } catch (BlobStorageException e) {
             throw new IOException(e);
         }