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


##########
oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureSegmentArchiveWriter.java:
##########
@@ -57,6 +57,7 @@ public AzureSegmentArchiveWriter(BlobContainerClient 
blobContainerClient, String
         this.archiveName = AzureUtilities.ensureNoTrailingSlash(archiveName);
         this.archivePathPrefix = AzureUtilities.asAzurePrefix(rootPrefix, 
archiveName);
         this.writeAccessController = writeAccessController;
+        this.created = AzureUtilities.archiveExists(blobContainerClient, 
archivePathPrefix);

Review Comment:
   Without that, the "empty" archive (no segments inside, only metadata) is not 
closed properly during recovery - the "closed" marker is not uploaded.
   
https://github.com/apache/jackrabbit-oak/blob/19f29c6e4e3001c2d7237c184588d5513f7b80e4/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarWriter.java#L212-L212
   
   You can see that in the test 
   
org.apache.jackrabbit.oak.segment.azure.AzureArchiveManagerTest#testUncleanStopWithEmptyArchive
   
   ```java
   java.io.IOException: Failed to open recovered tar file data00001a.tar
        at 
org.apache.jackrabbit.oak.segment.file.tar.TarReader.open(TarReader.java:113)
        at 
org.apache.jackrabbit.oak.segment.file.tar.TarFiles.lambda$init$0(TarFiles.java:425)
        at 
java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at 
java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
        at 
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at 
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at 
java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:952)
        at 
java.base/java.util.stream.ReduceOps$ReduceTask.doLeaf(ReduceOps.java:926)
        at 
java.base/java.util.stream.AbstractTask.compute(AbstractTask.java:327)
        at 
java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
        at 
java.base/java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:290)
   
   ```
   
   
   



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