timoninmaxim commented on code in PR #10292:
URL: https://github.com/apache/ignite/pull/10292#discussion_r1005660290


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java:
##########
@@ -2443,6 +2505,8 @@ private void checkIncrementalCanBeCreated(
     ) throws IgniteCheckedException, IOException {
         File snpDir = snapshotLocalDir(name, snpPath);
 
+        ensureHardLinkAvailable(cctx.wal().archiveDir().toPath(), 
snpDir.toPath());

Review Comment:
   Return of `archiveDir`is marked with `@Nullable`, also this thread doesn't 
check WAL for existence prior this line. So let's also add checks in this 
method: for WAL is available, and for archive dir isn't null.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java:
##########
@@ -2475,12 +2469,45 @@ private void deleteObsoleteRawSegments() {
                 if (segmentReservedOrLocked(desc.idx))
                     return;
 
-                if (desc.idx < lastCheckpointPtr.index() && 
duplicateIndices.contains(desc.idx))
-                    segmentAware.addSize(desc.idx, 
-deleteArchiveFiles(desc.file));
+                if (desc.idx < lastCheckpointPtr.index() && 
duplicateIndices.contains(desc.idx)) {
+                    long sz = deleteArchiveFiles(desc.file);
+
+                    segmentAware.addSize(desc.idx, -sz);
+                }
             }
         }
     }
 
+    /** {@inheritDoc} */
+    @Override public File compressedSegment(long idx) {
+        return archiveSegment(idx, ZIP_SUFFIX);

Review Comment:
   Should return `null` if compression is disabled. Currently it creates a 
`File` object by path, that never exists.



##########
modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java:
##########
@@ -231,4 +233,25 @@ public WALIterator replay(
      * Start automatically releasing segments when reaching {@link 
DataStorageConfiguration#getMaxWalArchiveSize()}.
      */
     void startAutoReleaseSegments();
+
+    /**
+     * Archive directory if any.
+     *
+     * @return Archive directory.
+     */
+    @Nullable File archiveDir();
+
+    /**
+     * @param idx Segment index.
+     * @return Compressed archive segment.
+     */
+    @Nullable File compressedSegment(long idx);
+
+    /**
+     * Blocks current thread while segment with the {@code index} not 
compressed.

Review Comment:
   s/index/idx/



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to