Author: adulceanu
Date: Thu Aug 15 12:21:54 2019
New Revision: 1865218

URL: http://svn.apache.org/viewvc?rev=1865218&view=rev
Log:
OAK-8531 - Reading Azure Journal File while it's modified fails

Modified:
    
jackrabbit/oak/trunk/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/ReverseFileReader.java

Modified: 
jackrabbit/oak/trunk/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/ReverseFileReader.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/ReverseFileReader.java?rev=1865218&r1=1865217&r2=1865218&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/ReverseFileReader.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/ReverseFileReader.java
 Thu Aug 15 12:21:54 2019
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.oak.segment.azure;
 
+import com.microsoft.azure.storage.OperationContext;
 import com.microsoft.azure.storage.StorageException;
 import com.microsoft.azure.storage.blob.CloudBlob;
 
@@ -23,6 +24,7 @@ import java.io.IOException;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 
 import static java.lang.Math.min;
@@ -65,7 +67,11 @@ public class ReverseFileReader {
         if (buffer.length > 0) {
             fileOffset -= buffer.length;
             try {
-                blob.downloadRangeToByteArray(fileOffset, 
Long.valueOf(buffer.length), buffer, 0);
+                OperationContext opContext = new OperationContext();
+                HashMap<String, String> userHeaders = new HashMap<>();
+                userHeaders.put("If-Match", "*");
+                opContext.setUserHeaders(userHeaders);
+                blob.downloadRangeToByteArray(fileOffset, 
Long.valueOf(buffer.length), buffer, 0, null, null, opContext);
             } catch (StorageException e) {
                 throw new IOException(e);
             }


Reply via email to