mreutegg commented on code in PR #2467:
URL: https://github.com/apache/jackrabbit-oak/pull/2467#discussion_r2293816108


##########
oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/v8/AzureSegmentArchiveWriterV8.java:
##########
@@ -52,11 +55,23 @@ public class AzureSegmentArchiveWriterV8 extends 
AbstractRemoteSegmentArchiveWri
 
     private final BlobRequestOptions writeOptimisedBlobRequestOptions;
 
+    private static final Logger LOG = 
LoggerFactory.getLogger(AzureSegmentArchiveWriterV8.class);
+
     public AzureSegmentArchiveWriterV8(CloudBlobDirectory archiveDirectory, 
IOMonitor ioMonitor, FileStoreMonitor monitor, WriteAccessController 
writeAccessController) {
         super(ioMonitor, monitor);
         this.archiveDirectory = archiveDirectory;
         this.writeAccessController = writeAccessController;
         this.writeOptimisedBlobRequestOptions = 
AzureRequestOptionsV8.optimiseForWriteOperations(archiveDirectory.getServiceClient().getDefaultRequestOptions());
+        this.created = hasBlobs();
+    }
+
+    private boolean hasBlobs() {
+        try {
+            return this.archiveDirectory.listBlobs().iterator().hasNext();
+        } catch (StorageException | URISyntaxException | 
NoSuchElementException e) {
+            LOG.error("Error listing blobs", e);
+            return false;

Review Comment:
   Wouldn't it be better to fail with an exception? Returning `false` in case 
of an exception seems wrong to me when there are actually blobs, but listing 
them failed.



-- 
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