svn commit: r1865219 - /jackrabbit/oak/trunk/oak-segment-azure/src/test/java/org/apache/jackrabbit/oak/segment/azure/AzureJournalFileConcurrencyIT.java
Author: adulceanu Date: Thu Aug 15 12:22:01 2019 New Revision: 1865219 URL: http://svn.apache.org/viewvc?rev=1865219=rev Log: OAK-8531 - Reading Azure Journal File while it's modified fails Added test case Added: jackrabbit/oak/trunk/oak-segment-azure/src/test/java/org/apache/jackrabbit/oak/segment/azure/AzureJournalFileConcurrencyIT.java (with props) Added: jackrabbit/oak/trunk/oak-segment-azure/src/test/java/org/apache/jackrabbit/oak/segment/azure/AzureJournalFileConcurrencyIT.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-azure/src/test/java/org/apache/jackrabbit/oak/segment/azure/AzureJournalFileConcurrencyIT.java?rev=1865219=auto == --- jackrabbit/oak/trunk/oak-segment-azure/src/test/java/org/apache/jackrabbit/oak/segment/azure/AzureJournalFileConcurrencyIT.java (added) +++ jackrabbit/oak/trunk/oak-segment-azure/src/test/java/org/apache/jackrabbit/oak/segment/azure/AzureJournalFileConcurrencyIT.java Thu Aug 15 12:22:01 2019 @@ -0,0 +1,139 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.oak.segment.azure; + +import com.microsoft.azure.storage.CloudStorageAccount; +import com.microsoft.azure.storage.StorageException; +import com.microsoft.azure.storage.blob.CloudBlobClient; +import com.microsoft.azure.storage.blob.CloudBlobContainer; + +import org.apache.jackrabbit.oak.segment.spi.persistence.JournalFile; +import org.apache.jackrabbit.oak.segment.spi.persistence.JournalFileReader; +import org.apache.jackrabbit.oak.segment.spi.persistence.JournalFileWriter; +import org.junit.AfterClass; +import org.junit.Assume; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.security.InvalidKeyException; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; + +public class AzureJournalFileConcurrencyIT { +private static final Logger log = LoggerFactory.getLogger(AzureJournalFileConcurrencyIT.class); + +private static CloudBlobContainer container; + +private static int suffix; + +private AzurePersistence persistence; + +@BeforeClass +public static void connectToAzure() throws URISyntaxException, InvalidKeyException, StorageException { +String azureConnectionString = System.getenv("AZURE_CONNECTION"); +Assume.assumeNotNull(azureConnectionString); +CloudBlobClient client = CloudStorageAccount.parse(azureConnectionString).createCloudBlobClient(); +container = client.getContainerReference("oak-test-" + System.currentTimeMillis()); +container.createIfNotExists(); +suffix = 1; +} + +@Before +public void setup() throws StorageException, InvalidKeyException, URISyntaxException, IOException, InterruptedException { +persistence = new AzurePersistence(container.getDirectoryReference("oak-" + (suffix++))); +writeJournalLines(300, 0); +log.info("Finished writing initial content to journal!"); +} + +@AfterClass +public static void cleanupContainer() throws StorageException { +if (container != null) { +container.deleteIfExists(); +} +} + +@Test +public void testConcurrency() throws Exception { +AtomicBoolean stop = new AtomicBoolean(); +AtomicReference exContainer = new AtomicReference<>(); + +Thread producer = new Thread(() -> { +try { +while (!stop.get()) { +writeJournalLines(300, 100); +} +} catch(Exception e) { +exContainer.set(e); +stop.set(true); +} +}); + +Thread consumer = new Thread(() -> { +try { +while (!stop.get()) { +readJournal(); +} +} catch (IOException e) { +exContainer.set(e); +stop.set(true); +} +}); + +
svn commit: r1865218 - /jackrabbit/oak/trunk/oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/ReverseFileReader.java
Author: adulceanu Date: Thu Aug 15 12:21:54 2019 New Revision: 1865218 URL: http://svn.apache.org/viewvc?rev=1865218=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=1865217=1865218=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 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); }
svn commit: r1865263 - in /jackrabbit/oak/branches/1.10: oak-doc-railroad-macro/pom.xml oak-doc/pom.xml
Author: ngupta Date: Fri Aug 16 03:33:15 2019 New Revision: 1865263 URL: http://svn.apache.org/viewvc?rev=1865263=rev Log: Align versions for oak-doc and oak-doc-railroad-macro Modified: jackrabbit/oak/branches/1.10/oak-doc-railroad-macro/pom.xml jackrabbit/oak/branches/1.10/oak-doc/pom.xml Modified: jackrabbit/oak/branches/1.10/oak-doc-railroad-macro/pom.xml URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.10/oak-doc-railroad-macro/pom.xml?rev=1865263=1865262=1865263=diff == --- jackrabbit/oak/branches/1.10/oak-doc-railroad-macro/pom.xml (original) +++ jackrabbit/oak/branches/1.10/oak-doc-railroad-macro/pom.xml Fri Aug 16 03:33:15 2019 @@ -22,7 +22,7 @@ org.apache.jackrabbit oak-parent -1.10.0-SNAPSHOT +1.10.5-SNAPSHOT ../oak-parent/pom.xml Modified: jackrabbit/oak/branches/1.10/oak-doc/pom.xml URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.10/oak-doc/pom.xml?rev=1865263=1865262=1865263=diff == --- jackrabbit/oak/branches/1.10/oak-doc/pom.xml (original) +++ jackrabbit/oak/branches/1.10/oak-doc/pom.xml Fri Aug 16 03:33:15 2019 @@ -23,7 +23,7 @@ org.apache.jackrabbit oak-parent -1.10.0-SNAPSHOT +1.10.5-SNAPSHOT ../oak-parent/pom.xml