sergey-chugunov-1985 commented on a change in pull request #9001:
URL: https://github.com/apache/ignite/pull/9001#discussion_r613166735



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
##########
@@ -1325,6 +1325,14 @@ private FileWriteHandle rollOver(FileWriteHandle cur, 
@Nullable WALRecord rec) t
     private FileWriteHandle restoreWriteHandle(@Nullable WALPointer 
lastReadPtr) throws StorageException {
         long absIdx = lastReadPtr == null ? 0 : lastReadPtr.index();
 
+        FileDescriptor[] walArchiveFiles = walArchiveFiles();
+
+        if (archiver != null &&
+            !F.isEmpty(walArchiveFiles) &&
+            absIdx <= walArchiveFiles[walArchiveFiles.length - 1].idx) {
+            absIdx = walArchiveFiles[walArchiveFiles.length - 1].idx + 1;

Review comment:
       @tkalkirill, from user perspective this change seems working as it fixes 
wrong behavior. But from code perspective I agree with you: we add some logic 
that increments `absIdx` based on checks that seems absolutely random. Adding a 
marker record with proper documentation would make this code much more readable 
and easy to understand.




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

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


Reply via email to