smiroslav commented on code in PR #2480: URL: https://github.com/apache/jackrabbit-oak/pull/2480#discussion_r2307191749
########## oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/v8/AzureArchiveManagerV8.java: ########## @@ -131,22 +137,43 @@ public SegmentArchiveWriter create(String archiveName) throws IOException { @Override public boolean delete(String archiveName) { try { + uploadDeletedMarker(archiveName); getBlobs(archiveName) .forEach(cloudBlob -> { try { - writeAccessController.checkWritingAllowed(); - cloudBlob.delete(); + String blobName = getName(cloudBlob); + if (!blobName.equals(DELETED_ARCHIVE_MARKER) && !blobName.equals(CLOSED_ARCHIVE_MARKER)) { + writeAccessController.checkWritingAllowed(); + cloudBlob.delete(); + } } catch (StorageException e) { log.error("Can't delete segment {}", cloudBlob.getUri().getPath(), e); } }); + deleteClosedMarker(archiveName); + deleteDeletedMarker(archiveName); return true; - } catch (IOException e) { + } catch (IOException | URISyntaxException | StorageException e) { log.error("Can't delete archive {}", archiveName, e); return false; } } + private void deleteDeletedMarker(String archiveName) throws IOException, URISyntaxException, StorageException { + writeAccessController.checkWritingAllowed(); + getDirectory(archiveName).getBlockBlobReference(DELETED_ARCHIVE_MARKER).deleteIfExists(); + } + + private void deleteClosedMarker(String archiveName) throws IOException, URISyntaxException, StorageException { + writeAccessController.checkWritingAllowed(); + getDirectory(archiveName).getBlockBlobReference(CLOSED_ARCHIVE_MARKER).deleteIfExists(); + } + + private void uploadDeletedMarker(String archiveName) throws IOException, URISyntaxException, StorageException { + writeAccessController.checkWritingAllowed(); + getDirectory(archiveName).getBlockBlobReference(DELETED_ARCHIVE_MARKER).openOutputStream().close(); + } Review Comment: I prefer being explicit here. If we had more special blobs, then maybe I would consider having a general method that accepts blob name as the second argument as a better option. -- 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