tkalkirill commented on a change in pull request #9001:
URL: https://github.com/apache/ignite/pull/9001#discussion_r613816957



##########
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:
       @nizhikov 
   We define a segment into which we will continue to write based on the last 
read WAL record. In the normal case, everything works well because after 
rollover, we write a record to a new segment, see 
**FileWriteAheadLogManager#log**.
   
   In the root cause of the current ticket, we do not write any WAL record to 
the new segment, and at the same time archive the previous segment, so after 
restarting the node, we will try to read the WAL records in a new segment, but 
they are not there, so we will ignore it, so we continue to write to the 
previous segment. If we had written a record to the auto-rolloved segment, then 
there would be no problem since we would have read this WAL record in a new 
segment and continued writing to a new segment.




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