This is an automated email from the ASF dual-hosted git repository.
tkalkirill pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 8a182458a20 IGNITE-25857 Improved implementation of
RocksDbSharedLogStorage#truncateSuffix after clearing all log entries due to
snapshot (#6255)
8a182458a20 is described below
commit 8a182458a2006626a1c637213bf5fb0fb37b947e
Author: Kirill Tkalenko <[email protected]>
AuthorDate: Wed Jul 16 10:39:44 2025 +0300
IGNITE-25857 Improved implementation of
RocksDbSharedLogStorage#truncateSuffix after clearing all log entries due to
snapshot (#6255)
---
.../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);