>From Ritik Raj <[email protected]>:

Ritik Raj has uploaded this change for review. ( 
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
---
M 
asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/google/gcs/GCSCloudClient.java
M 
asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/azure/blobstorage/AzBlobStorageCloudClient.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
4 files changed, 30 insertions(+), 4 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/53/19353/1

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..75f9f51 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,6 +221,10 @@
             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);
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: 1
Gerrit-Owner: Ritik Raj <[email protected]>
Gerrit-MessageType: newchange

Reply via email to