Skip to content

Commit 9f38f8d

Browse files
committed
[ASTERIXDB-3196][CONF] Add cloud properties
- user model changes: yes - storage format changes: no - interface changes: yes Details: - Add the following cloud properties to allow configuring cloud storage which can be used for compute-storage separation: -- cloud.storage.scheme -- cloud.storage.bucket -- cloud.storage.region -- cloud.storage.prefix -- cloud.storage.endpoint -- cloud.storage.anonymous.auth Change-Id: I1184818476c9b35bb521dc959033eeedd2a836c1 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17594 Reviewed-by: Murtadha Al Hubail <[email protected]> Reviewed-by: Ali Alsuliman <[email protected]> Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]>
1 parent 02ff31b commit 9f38f8d

File tree

29 files changed

+280
-560
lines changed

29 files changed

+280
-560
lines changed

asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/CcApplicationContext.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.apache.asterix.common.cluster.IGlobalRecoveryManager;
3838
import org.apache.asterix.common.config.ActiveProperties;
3939
import org.apache.asterix.common.config.BuildProperties;
40+
import org.apache.asterix.common.config.CloudProperties;
4041
import org.apache.asterix.common.config.CompilerProperties;
4142
import org.apache.asterix.common.config.ExtensionProperties;
4243
import org.apache.asterix.common.config.ExternalProperties;
@@ -99,6 +100,7 @@ public class CcApplicationContext implements ICcApplicationContext {
99100
private ExtensionProperties extensionProperties;
100101
private MessagingProperties messagingProperties;
101102
private NodeProperties nodeProperties;
103+
private final CloudProperties cloudProperties;
102104
private Supplier<IMetadataBootstrap> metadataBootstrapSupplier;
103105
private volatile HyracksConnection hcc;
104106
private volatile ResultSet resultSet;
@@ -140,6 +142,7 @@ public CcApplicationContext(ICCServiceContext ccServiceCtx, HyracksConnection hc
140142
activeProperties = new ActiveProperties(propertiesAccessor);
141143
extensionProperties = new ExtensionProperties(propertiesAccessor);
142144
replicationProperties = new ReplicationProperties(propertiesAccessor);
145+
cloudProperties = new CloudProperties(propertiesAccessor);
143146
this.ftStrategy = ftStrategy;
144147
this.buildProperties = new BuildProperties(propertiesAccessor);
145148
this.messagingProperties = new MessagingProperties(propertiesAccessor);
@@ -373,4 +376,9 @@ public IDataPartitioningProvider getDataPartitioningProvider() {
373376
public boolean isCloudDeployment() {
374377
return ccServiceCtx.getAppConfig().getBoolean(CLOUD_DEPLOYMENT);
375378
}
379+
380+
@Override
381+
public CloudProperties getCloudProperties() {
382+
return cloudProperties;
383+
}
376384
}

asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.apache.asterix.common.api.IReceptionistFactory;
4343
import org.apache.asterix.common.config.ActiveProperties;
4444
import org.apache.asterix.common.config.BuildProperties;
45+
import org.apache.asterix.common.config.CloudProperties;
4546
import org.apache.asterix.common.config.CompilerProperties;
4647
import org.apache.asterix.common.config.ExternalProperties;
4748
import org.apache.asterix.common.config.MessagingProperties;
@@ -164,6 +165,7 @@ public class NCAppRuntimeContext implements INcApplicationContext {
164165
private final ICacheManager cacheManager;
165166
private IConfigValidator configValidator;
166167
private IDiskWriteRateLimiterProvider diskWriteRateLimiterProvider;
168+
private final CloudProperties cloudProperties;
167169

168170
public NCAppRuntimeContext(INCServiceContext ncServiceContext, NCExtensionManager extensionManager,
169171
IPropertiesFactory propertiesFactory) {
@@ -178,6 +180,7 @@ public NCAppRuntimeContext(INCServiceContext ncServiceContext, NCExtensionManage
178180
replicationProperties = propertiesFactory.newReplicationProperties();
179181
messagingProperties = propertiesFactory.newMessagingProperties();
180182
nodeProperties = propertiesFactory.newNodeProperties();
183+
cloudProperties = propertiesFactory.newCloudProperties();
181184
ncExtensionManager = extensionManager;
182185
componentProvider = new StorageComponentProvider();
183186
resourceIdFactory = new GlobalResourceIdFactoryProvider(ncServiceContext).createResourceIdFactory();
@@ -191,7 +194,7 @@ public void initialize(IRecoveryManagerFactory recoveryManagerFactory, IReceptio
191194
boolean initialRun) throws IOException {
192195
ioManager = getServiceContext().getIoManager();
193196
if (isCloudDeployment()) {
194-
persistenceIOManager = new CloudIOManager((IOManager) ioManager);
197+
persistenceIOManager = new CloudIOManager((IOManager) ioManager, cloudProperties);
195198
} else {
196199
persistenceIOManager = ioManager;
197200
}
@@ -661,4 +664,9 @@ public IDiskWriteRateLimiterProvider getDiskWriteRateLimiterProvider() {
661664
public boolean isCloudDeployment() {
662665
return ncServiceContext.getAppConfig().getBoolean(CLOUD_DEPLOYMENT);
663666
}
667+
668+
@Override
669+
public CloudProperties getCloudProperties() {
670+
return cloudProperties;
671+
}
664672
}

asterixdb/asterix-app/src/main/resources/cc-cloud-storage.conf

Lines changed: 0 additions & 68 deletions
This file was deleted.

asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/CloudUtils.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import java.net.URI;
2222

23-
import org.apache.asterix.cloud.storage.MockCloudStorageConfiguration;
2423
import org.apache.logging.log4j.LogManager;
2524
import org.apache.logging.log4j.Logger;
2625

@@ -36,15 +35,19 @@ public class CloudUtils {
3635
private static final Logger LOGGER = LogManager.getLogger();
3736

3837
private static final int MOCK_SERVER_PORT = 8001;
39-
private static final String MOCK_SERVER_HOSTNAME = "http://127.0.0.1:" + MOCK_SERVER_PORT;
40-
private static final String CLOUD_STORAGE_BUCKET = MockCloudStorageConfiguration.INSTANCE.getContainer();
41-
private static final String MOCK_SERVER_REGION = "us-west-2";
38+
public static final String MOCK_SERVER_HOSTNAME = "http://127.0.0.1:" + MOCK_SERVER_PORT;
39+
public static final String CLOUD_STORAGE_BUCKET = "cloud-storage-container";
40+
public static final String MOCK_SERVER_REGION = "us-west-2";
4241
private static S3Mock s3MockServer;
4342

4443
private CloudUtils() {
4544
throw new AssertionError("Do not instantiate");
4645
}
4746

47+
public static void main(String[] args) {
48+
startS3CloudEnvironment();
49+
}
50+
4851
public static void startS3CloudEnvironment() {
4952
// Starting S3 mock server to be used instead of real S3 server
5053
LOGGER.info("Starting S3 mock server");

asterixdb/asterix-app/src/test/java/org/apache/asterix/test/cloud_storage/CloudStorageTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class CloudStorageTest {
4545
private static final TestExecutor testExecutor = new TestExecutor();
4646
private static final String SUITE_TESTS = "testsuite_cloud_storage.xml";
4747
private static final String ONLY_TESTS = "testsuite_cloud_storage_only.xml";
48-
private static final String CONFIG_FILE_NAME = "src/main/resources/cc-cloud-storage.conf";
48+
private static final String CONFIG_FILE_NAME = "src/test/resources/cc-cloud-storage.conf";
4949

5050
public CloudStorageTest(TestCaseContext tcCtx) {
5151
this.tcCtx = tcCtx;

asterixdb/asterix-app/src/test/resources/cc-cloud-storage.conf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,9 @@ compiler.windowmemory=192KB
6161
messaging.frame.size=4096
6262
messaging.frame.count=512
6363
cloud.deployment=true
64-
storage.buffercache.pagesize=32KB
64+
storage.buffercache.pagesize=32KB
65+
cloud.storage.scheme=s3
66+
cloud.storage.bucket=cloud-storage-container
67+
cloud.storage.region=us-west-2
68+
cloud.storage.endpoint=http://127.0.0.1:8001
69+
cloud.storage.anonymous.auth=true

asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
"active\.suspend\.timeout" : 3600,
1111
"azure.request.timeout" : 120,
1212
"cloud.deployment" : false,
13+
"cloud.storage.anonymous.auth" : false,
14+
"cloud.storage.bucket" : "",
15+
"cloud.storage.endpoint" : "",
16+
"cloud.storage.prefix" : "",
17+
"cloud.storage.region" : "",
18+
"cloud.storage.scheme" : "",
1319
"compiler\.arrayindex" : true,
1420
"compiler.batch.lookup" : true,
1521
"compiler.cbo" : true,

asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
"active\.suspend\.timeout" : 3600,
1111
"azure.request.timeout" : 120,
1212
"cloud.deployment" : false,
13+
"cloud.storage.anonymous.auth" : false,
14+
"cloud.storage.bucket" : "",
15+
"cloud.storage.endpoint" : "",
16+
"cloud.storage.prefix" : "",
17+
"cloud.storage.region" : "",
18+
"cloud.storage.scheme" : "",
1319
"compiler\.arrayindex" : true,
1420
"compiler.batch.lookup" : true,
1521
"compiler.cbo" : true,

asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
"active\.suspend\.timeout" : 3600,
1111
"azure.request.timeout" : 120,
1212
"cloud.deployment" : false,
13+
"cloud.storage.anonymous.auth" : false,
14+
"cloud.storage.bucket" : "",
15+
"cloud.storage.endpoint" : "",
16+
"cloud.storage.prefix" : "",
17+
"cloud.storage.region" : "",
18+
"cloud.storage.scheme" : "",
1319
"compiler\.arrayindex" : true,
1420
"compiler.batch.lookup" : true,
1521
"compiler.cbo" : true,

asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/CloudIOManager.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,8 @@
3636
import java.util.Set;
3737

3838
import org.apache.asterix.cloud.clients.CloudClientProvider;
39-
import org.apache.asterix.cloud.clients.CloudClientProvider.ClientType;
4039
import org.apache.asterix.cloud.clients.ICloudClient;
41-
import org.apache.asterix.cloud.clients.ICloudClientCredentialsProvider.CredentialsType;
42-
import org.apache.asterix.cloud.storage.CloudStorageConfigurationProvider;
43-
import org.apache.asterix.cloud.storage.ICloudStorageConfiguration;
44-
import org.apache.asterix.cloud.storage.ICloudStorageConfiguration.ConfigurationType;
40+
import org.apache.asterix.common.config.CloudProperties;
4541
import org.apache.commons.io.FileUtils;
4642
import org.apache.hyracks.api.exceptions.HyracksDataException;
4743
import org.apache.hyracks.api.io.FileReference;
@@ -62,19 +58,17 @@ public class CloudIOManager extends IOManager {
6258
private IOManager localIoManager;
6359

6460
private CloudIOManager(List<IODeviceHandle> devices, IFileDeviceResolver deviceComputer, int ioParallelism,
65-
int queueSize) throws HyracksDataException {
61+
int queueSize, CloudProperties cloudProperties) throws HyracksDataException {
6662
super(devices, deviceComputer, ioParallelism, queueSize);
67-
ICloudStorageConfiguration cloudStorageConfiguration =
68-
CloudStorageConfigurationProvider.INSTANCE.getConfiguration(ConfigurationType.FILE);
69-
this.bucket = cloudStorageConfiguration.getContainer();
70-
cloudClient = CloudClientProvider.getClient(ClientType.S3, CredentialsType.FILE);
63+
this.bucket = cloudProperties.getStorageBucket();
64+
cloudClient = CloudClientProvider.getClient(cloudProperties);
7165
int numOfThreads = getIODevices().size() * getIoParallelism();
7266
writeBufferProvider = new WriteBufferProvider(numOfThreads);
7367
}
7468

75-
public CloudIOManager(IOManager ioManager) throws HyracksDataException {
69+
public CloudIOManager(IOManager ioManager, CloudProperties cloudProperties) throws HyracksDataException {
7670
this(ioManager.getIoDevices(), ioManager.getDeviceComputer(), ioManager.getIoParallelism(),
77-
ioManager.getQueueSize());
71+
ioManager.getQueueSize(), cloudProperties);
7872
this.localIoManager = ioManager;
7973
}
8074

0 commit comments

Comments
 (0)