smiroslav commented on code in PR #2480:
URL: https://github.com/apache/jackrabbit-oak/pull/2480#discussion_r2307210652


##########
oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureArchiveManager.java:
##########
@@ -138,22 +143,44 @@ public SegmentArchiveWriter create(String archiveName) 
throws IOException {
     @Override
     public boolean delete(String archiveName) {
         try {
+            uploadDeletedMarker(archiveName);
             getBlobs(archiveName)
                     .forEach(blobItem -> {
                         try {
-                            writeAccessController.checkWritingAllowed();
-                            
writeBlobContainerClient.getBlobClient(blobItem.getName()).delete();
+                            String blobName = getName(blobItem);
+                            if (!blobName.equals(DELETED_ARCHIVE_MARKER) && 
!blobName.equals(CLOSED_ARCHIVE_MARKER)) {
+                                writeAccessController.checkWritingAllowed();
+                                
writeBlobContainerClient.getBlobClient(blobItem.getName()).delete();
+                            }
                         } catch (BlobStorageException e) {
                             log.error("Can't delete segment {}", 
blobItem.getName(), e);
                         }
                     });
+            deleteClosedMarker(archiveName);
+            deleteDeletedMarker(archiveName);
             return true;
-        } catch (IOException e) {
+        } catch (IOException | BlobStorageException e) {
             log.error("Can't delete archive {}", archiveName, e);
             return false;
         }
     }
 
+    private void deleteDeletedMarker(String archiveName) throws 
BlobStorageException {
+        writeAccessController.checkWritingAllowed();
+        writeBlobContainerClient.getBlobClient(getDirectory(archiveName) + 
DELETED_ARCHIVE_MARKER).deleteIfExists();
+    }
+
+    private void deleteClosedMarker(String archiveName) throws 
BlobStorageException {
+        writeAccessController.checkWritingAllowed();
+        writeBlobContainerClient.getBlobClient(getDirectory(archiveName) + 
CLOSED_ARCHIVE_MARKER).deleteIfExists();
+    }

Review Comment:
   Here, as well, my preference is to be more explicit. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to