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 to...@apache.org on 2018/04/19 10:58:32 UTC
svn commit: r1829525 -
/jackrabbit/oak/trunk/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/SegmentTarFixture.java
Author: tomekr
Date: Thu Apr 19 10:58:32 2018
New Revision: 1829525
URL: http://svn.apache.org/viewvc?rev=1829525&view=rev
Log:
OAK-7297: New fixture for the Azure Segment Store
- delete the Azure container once the benchmark is done
Modified:
jackrabbit/oak/trunk/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/SegmentTarFixture.java
Modified: jackrabbit/oak/trunk/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/SegmentTarFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/SegmentTarFixture.java?rev=1829525&r1=1829524&r2=1829525&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/SegmentTarFixture.java (original)
+++ jackrabbit/oak/trunk/oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/SegmentTarFixture.java Thu Apr 19 10:58:32 2018
@@ -31,6 +31,7 @@ import javax.annotation.Nonnull;
import com.google.common.base.StandardSystemProperty;
import com.microsoft.azure.storage.CloudStorageAccount;
+import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.blob.CloudBlobContainer;
import com.microsoft.azure.storage.blob.CloudBlobDirectory;
import org.apache.commons.io.FileUtils;
@@ -50,8 +51,13 @@ import org.apache.jackrabbit.oak.segment
import org.apache.jackrabbit.oak.segment.standby.server.StandbyServerSync;
import org.apache.jackrabbit.oak.spi.blob.BlobStore;
import org.apache.jackrabbit.oak.stats.StatisticsProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class SegmentTarFixture extends OakFixture {
+
+ private static final Logger log = LoggerFactory.getLogger(SegmentTarFixture.class);
+
/**
* Listener instance doing nothing on a {@code SegmentNotFoundException}
*/
@@ -147,6 +153,8 @@ public class SegmentTarFixture extends O
private StandbyServerSync[] serverSyncs;
private StandbyClientSync[] clientSyncs;
private ScheduledExecutorService[] executors;
+
+ private CloudBlobContainer[] containers;
public SegmentTarFixture(SegmentTarFixtureBuilder builder) {
this(builder, false, -1);
@@ -225,6 +233,7 @@ public class SegmentTarFixture extends O
CloudStorageAccount cloud = CloudStorageAccount.parse(azureConnectionString);
CloudBlobContainer container = cloud.createCloudBlobClient().getContainerReference(azureContainerName);
container.createIfNotExists();
+ containers[i] = container;
CloudBlobDirectory directory = container.getDirectoryReference(azureRootPath + "/primary-" + i);
builder.withCustomPersistence(new AzurePersistence(directory));
}
@@ -346,6 +355,10 @@ public class SegmentTarFixture extends O
stores = new FileStore[fileStoresLength];
blobStoreFixtures = new BlobStoreFixture[blobStoresLength];
+
+ if (azureConnectionString != null) {
+ containers = new CloudBlobContainer[n];
+ }
}
@Override
@@ -375,6 +388,18 @@ public class SegmentTarFixture extends O
bsf.tearDown();
}
}
+
+ if (containers != null) {
+ for (CloudBlobContainer container : containers) {
+ if (container != null) {
+ try {
+ container.deleteIfExists();
+ } catch (StorageException e) {
+ log.error("Can't remove container", e);
+ }
+ }
+ }
+ }
FileUtils.deleteQuietly(parentPath);
}