>From Ritik Raj <[email protected]>: Ritik Raj has submitted this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19353 )
Change subject: [ASTERIXDB-3552][STO]: Adding more logs for delete operation ...................................................................... [ASTERIXDB-3552][STO]: Adding more logs for delete operation - user model changes: no - storage format changes: no - interface changes: no Ext-ref: MB-64791 Change-Id: Ica98523fccd84548773dfdbe099fc362909f9767 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19353 Integration-Tests: Jenkins <[email protected]> Reviewed-by: Ritik Raj <[email protected]> Reviewed-by: Murtadha Hubail <[email protected]> Tested-by: Jenkins <[email protected]> --- M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/cloud_storage/CloudStorageUnstableTest.java M asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/google/gcs/GCSCloudClient.java M asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/CloudStorageIntegrationUtil.java M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/cloud_storage/CloudPythonTest.java M asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/azure/blobstorage/AzBlobStorageCloudClient.java M asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtil.java M asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java M asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/aws/s3/S3CloudClient.java M asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties 9 files changed, 52 insertions(+), 14 deletions(-) Approvals: Murtadha Hubail: Looks good to me, approved Ritik Raj: Looks good to me, but someone else must approve Jenkins: Verified; Verified diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/CloudStorageIntegrationUtil.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/CloudStorageIntegrationUtil.java index 6ee625f..d49fe26 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/CloudStorageIntegrationUtil.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/CloudStorageIntegrationUtil.java @@ -28,7 +28,7 @@ public static void main(String[] args) throws Exception { boolean cleanStart = Boolean.getBoolean("cleanup.start"); - LocalCloudUtil.startS3CloudEnvironment(cleanStart); + LocalCloudUtilAdobeMock.startS3CloudEnvironment(cleanStart); final AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil(); try { integrationUtil.run(cleanStart, Boolean.getBoolean("cleanup.shutdown"), diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtil.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtil.java index 95fdafc..9e67c92 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtil.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtil.java @@ -72,7 +72,7 @@ LOGGER.info("Starting S3 mock server"); // Use file backend for debugging/inspection s3MockServer = new S3Mock.Builder().withPort(MOCK_SERVER_PORT).withFileBackend(MOCK_FILE_BACKEND).build(); - shutdownSilently(); + stopS3MockServer(); try { s3MockServer.start(); } catch (Exception ex) { @@ -105,6 +105,12 @@ return s3MockServer; } + public static void stopS3MockServer() { + shutdownSilently(); + // since they are running on same port, we need to shut down other mock server as well + LocalCloudUtilAdobeMock.shutdownSilently(); + } + private static void shutdownSilently() { if (s3MockServer != null) { try { diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java index 5f6b492..30d4c3c 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/api/common/LocalCloudUtilAdobeMock.java @@ -43,6 +43,7 @@ private static final int MOCK_SERVER_PORT = 8001; private static final int MOCK_SERVER_PORT_HTTPS = 8002; public static final String CLOUD_STORAGE_BUCKET = "cloud-storage-container"; + public static final String PLAYGROUND_BUCKET = "playground"; private static S3MockApplication s3Mock; private LocalCloudUtilAdobeMock() { @@ -68,7 +69,7 @@ properties.put(S3MockApplication.PROP_HTTP_PORT, MOCK_SERVER_PORT); properties.put(S3MockApplication.PROP_HTTPS_PORT, MOCK_SERVER_PORT_HTTPS); properties.put(S3MockApplication.PROP_SILENT, false); - shutdownSilently(); + LocalCloudUtil.stopS3MockServer(); s3Mock = S3MockApplication.start(properties); LOGGER.info("S3 mock server started successfully"); @@ -82,8 +83,8 @@ LOGGER.info("Created bucket {} for cloud storage", CLOUD_STORAGE_BUCKET); if (createPlaygroundContainer) { - client.createBucket(CreateBucketRequest.builder().bucket("playground").build()); - LOGGER.info("Created bucket {}", "playground"); + client.createBucket(CreateBucketRequest.builder().bucket(PLAYGROUND_BUCKET).build()); + LOGGER.info("Created bucket {}", PLAYGROUND_BUCKET); } client.close(); return s3Mock; diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/cloud_storage/CloudPythonTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/cloud_storage/CloudPythonTest.java index 643ed80..e969519 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/cloud_storage/CloudPythonTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/cloud_storage/CloudPythonTest.java @@ -23,7 +23,7 @@ import java.util.Collection; import java.util.List; -import org.apache.asterix.api.common.LocalCloudUtil; +import org.apache.asterix.api.common.LocalCloudUtilAdobeMock; import org.apache.asterix.common.config.GlobalConfig; import org.apache.asterix.test.common.TestExecutor; import org.apache.asterix.test.runtime.LangExecutionUtil; @@ -64,7 +64,7 @@ @BeforeClass public static void setUp() throws Exception { - LocalCloudUtil.startS3CloudEnvironment(true); + LocalCloudUtilAdobeMock.startS3CloudEnvironment(true); TestExecutor testExecutor = new TestExecutor(DELTA_RESULT_PATH); testExecutor.executorId = "cloud"; testExecutor.stripSubstring = "//DB:"; diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/cloud_storage/CloudStorageUnstableTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/cloud_storage/CloudStorageUnstableTest.java index 82a264a..29087f3 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/cloud_storage/CloudStorageUnstableTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/cloud_storage/CloudStorageUnstableTest.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.Random; -import org.apache.asterix.api.common.LocalCloudUtil; +import org.apache.asterix.api.common.LocalCloudUtilAdobeMock; import org.apache.asterix.common.config.GlobalConfig; import org.apache.asterix.test.common.TestExecutor; import org.apache.asterix.test.runtime.LangExecutionUtil; @@ -66,7 +66,7 @@ @BeforeClass public static void setUp() throws Exception { System.setProperty(CloudRetryableRequestUtil.CLOUD_UNSTABLE_MODE, "true"); - LocalCloudUtil.startS3CloudEnvironment(true, true); + LocalCloudUtilAdobeMock.startS3CloudEnvironment(true, true); TestExecutor testExecutor = new TestExecutor(DELTA_RESULT_PATH); testExecutor.executorId = "cloud"; testExecutor.stripSubstring = "//DB:"; diff --git a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/aws/s3/S3CloudClient.java b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/aws/s3/S3CloudClient.java index d279643..224ede4 100644 --- a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/aws/s3/S3CloudClient.java +++ b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/aws/s3/S3CloudClient.java @@ -248,8 +248,8 @@ LOGGER.warn("Failed to delete object: {}, code: {}, message: {}", s3Error.key(), s3Error.code(), s3Error.message()); } - throw new RuntimeDataException(ErrorCode.CLOUD_IO_FAILURE, "DELETE", deleteErrors.get(0).key(), - paths.toString()); + throw new RuntimeDataException(ErrorCode.CLOUD_IO_FAILURE, "DELETE", + !deleteErrors.isEmpty() ? deleteErrors.get(0).key() : "", paths.toString()); } profiler.objectDelete(); } diff --git a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/azure/blobstorage/AzBlobStorageCloudClient.java b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/azure/blobstorage/AzBlobStorageCloudClient.java index 02da6ae..84d68e3 100644 --- a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/azure/blobstorage/AzBlobStorageCloudClient.java +++ b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/azure/blobstorage/AzBlobStorageCloudClient.java @@ -82,6 +82,7 @@ private static final String AZURITE_ACCOUNT_NAME = "devstoreaccount1"; private static final String AZURITE_ACCOUNT_KEY = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="; + private static final int SUCCESS_RESPONSE_CODE = 202; private final ICloudGuardian guardian; private BlobContainerClient blobContainerClient; private AzBlobStorageClientConfig config; @@ -264,7 +265,14 @@ try { for (Response<Void> response : responses) { deletedPath = deletePathIter.next(); - response.getStatusCode(); + // The response.getStatusCode() method returns: + // - 202 (Accepted) if the delete operation is successful + // - exception if the delete operation fails + int statusCode = response.getStatusCode(); + if (statusCode != SUCCESS_RESPONSE_CODE) { + LOGGER.warn("Failed to delete blob: {} with status code: {} while deleting {}", deletedPath, + statusCode, paths.toString()); + } } } catch (BlobStorageException e) { throw new RuntimeDataException(ErrorCode.CLOUD_IO_FAILURE, e, "DELETE", deletedPath, paths.toString()); diff --git a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/google/gcs/GCSCloudClient.java b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/google/gcs/GCSCloudClient.java index 2ef34b0..cb246ff 100644 --- a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/google/gcs/GCSCloudClient.java +++ b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/google/gcs/GCSCloudClient.java @@ -221,9 +221,13 @@ for (StorageBatchResult<Boolean> deleteResponse : deleteResponses) { String deletedPath = deletePathIter.next(); try { + // The deleteResponse.get() method returns: + // - true if the file was successfully deleted, + // - false if the file could not be deleted, + // - and throws an exception if an error occurred during the delete operation. boolean deleted = deleteResponse.get(); if (!deleted) { - LOGGER.warn("File {} already deleted while deleting {}", deletedPath, paths); + LOGGER.warn("Failed to delete object {} while deleting {}", deletedPath, paths); } } catch (BaseServiceException e) { LOGGER.warn("Failed to delete object {} while deleting {}", deletedPath, paths, e); diff --git a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties index 4a1629d..6900de3 100644 --- a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties +++ b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties @@ -105,7 +105,7 @@ 68 = Invalid key type. Expected '%1$s', found '%2$s'. 69 = Failed to read key. Reason: %1$s. 70 = Avro type '%1$s' is not supported by default. To enable type conversion, recreate the external dataset with the option '%2$s' enabled -71 = Cloud I/O operation '%1$s' failed during deletion of file '%2$s' in context of files '%3$s' +71 = Cloud I/O '%1$s' operation failed for file '%2$s' while operating on files '%3$s'. 100 = Unsupported JRE: %1$s -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19353 To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Change-Id: Ica98523fccd84548773dfdbe099fc362909f9767 Gerrit-Change-Number: 19353 Gerrit-PatchSet: 6 Gerrit-Owner: Ritik Raj <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Ritik Raj <[email protected]> Gerrit-MessageType: merged
