This is an automated email from the ASF dual-hosted git repository.

tkalkirill pushed a commit to branch ignite-25857
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit 929e9f02b13221e0ecfffea84fdcac7be61473bd
Author: Kirill Tkalenko <tkalkir...@yandex.ru>
AuthorDate: Wed Jul 16 10:00:13 2025 +0300

    IGNITE-25857 wip
---
 .../ignite/internal/raft/storage/impl/RocksDbSharedLogStorage.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/RocksDbSharedLogStorage.java
 
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/RocksDbSharedLogStorage.java
index 0c92e0d6fc5..7ab86b6cc72 100644
--- 
a/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/RocksDbSharedLogStorage.java
+++ 
b/modules/raft/src/main/java/org/apache/ignite/internal/raft/storage/impl/RocksDbSharedLogStorage.java
@@ -518,7 +518,12 @@ public class RocksDbSharedLogStorage implements 
LogStorage, Describer {
 
             lastLogIndex = getLastLogIndex();
 
-            if (lastLogIndex > lastIndexKept) {
+            // If lastLogIndex == 0, it means that most likely after the raft 
snapshot was committed, truncatePrefix was executed, which
+            // deleted all local log entries. And then log entries came from 
the new leader, which led to the need to clean up previous
+            // local log entries that are no longer there.
+            if (lastLogIndex != 0) {
+                assert lastLogIndex >= lastIndexKept : 
String.format("lastLogIndex=%s, lastIndexKept=%s", lastLogIndex, lastIndexKept);
+
                 byte[] beginKey = createKey(lastIndexKept + 1);
                 byte[] endKey = createKey(lastLogIndex + 1);
 

Reply via email to