You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mh...@apache.org on 2023/06/23 15:48:44 UTC
[asterixdb] branch master updated: [ASTERIXDB-3196][*DB] Skip logs REDO on cloud deployments
This is an automated email from the ASF dual-hosted git repository.
mhubail pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new af14efc2de [ASTERIXDB-3196][*DB] Skip logs REDO on cloud deployments
af14efc2de is described below
commit af14efc2dedf2cfd386ab88de0ef9c35d3e1308c
Author: Murtadha Hubail <mh...@apache.org>
AuthorDate: Thu Jun 22 20:36:17 2023 -0700
[ASTERIXDB-3196][*DB] Skip logs REDO on cloud deployments
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Since no updates logs are generated on cloud deployments,
we should skip logs REDO during partition promotion.
- Ensure cloud prefixes do not start with file separator.
Change-Id: If05ba888ea8327508d4cde00380a88d1f3494780
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17613
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Ali Alsuliman <al...@gmail.com>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
---
.../src/main/java/org/apache/asterix/app/nc/ReplicaManager.java | 6 ++++--
.../src/main/java/org/apache/asterix/cloud/CloudIOManager.java | 4 ++--
.../main/java/org/apache/asterix/cloud/clients/aws/s3/S3Utils.java | 7 ++++++-
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java
index 1372016d09..0684442bee 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/ReplicaManager.java
@@ -131,8 +131,10 @@ public class ReplicaManager implements IReplicaManager {
(PersistentLocalResourceRepository) appCtx.getLocalResourceRepository();
localResourceRepository.cleanup(partition);
localResourceRepository.clearResourcesCache();
- final IRecoveryManager recoveryManager = appCtx.getTransactionSubsystem().getRecoveryManager();
- recoveryManager.replayReplicaPartitionLogs(Stream.of(partition).collect(Collectors.toSet()), true);
+ if (!appCtx.isCloudDeployment()) {
+ final IRecoveryManager recoveryManager = appCtx.getTransactionSubsystem().getRecoveryManager();
+ recoveryManager.replayReplicaPartitionLogs(Stream.of(partition).collect(Collectors.toSet()), true);
+ }
partitions.put(partition, new Object());
}
diff --git a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/CloudIOManager.java b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/CloudIOManager.java
index b508b6c930..4939ab53fd 100644
--- a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/CloudIOManager.java
+++ b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/CloudIOManager.java
@@ -37,6 +37,7 @@ import java.util.Set;
import org.apache.asterix.cloud.clients.CloudClientProvider;
import org.apache.asterix.cloud.clients.ICloudClient;
+import org.apache.asterix.cloud.clients.aws.s3.S3Utils;
import org.apache.asterix.common.config.CloudProperties;
import org.apache.commons.io.FileUtils;
import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -165,8 +166,7 @@ public class CloudIOManager extends IOManager {
if (file.getFile().isDirectory()) {
continue;
}
-
- String path = file.getRelativePath();
+ String path = S3Utils.toCloudPrefix(file.getRelativePath());
if (!cloudFiles.contains(path)) {
// Delete local files that do not exist in cloud storage (the ground truth for valid files)
localFilesIter.remove();
diff --git a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/aws/s3/S3Utils.java b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/aws/s3/S3Utils.java
index e3e9e98eb2..4ea11b2ec2 100644
--- a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/aws/s3/S3Utils.java
+++ b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/aws/s3/S3Utils.java
@@ -18,6 +18,7 @@
*/
package org.apache.asterix.cloud.clients.aws.s3;
+import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
@@ -39,7 +40,7 @@ public class S3Utils {
String newMarker = null;
ListObjectsV2Response listObjectsResponse;
ListObjectsV2Request.Builder listObjectsBuilder = ListObjectsV2Request.builder().bucket(bucket);
- listObjectsBuilder.prefix(encodeURI(path));
+ listObjectsBuilder.prefix(encodeURI(toCloudPrefix(path)));
while (true) {
// List the objects from the start, or from the last marker in case of truncated result
if (newMarker == null) {
@@ -72,4 +73,8 @@ public class S3Utils {
public static String decodeURI(String path) {
return URLDecoder.decode(path, Charset.defaultCharset());
}
+
+ public static String toCloudPrefix(String path) {
+ return path.startsWith(File.separator) ? path.substring(1) : path;
+ }
}