alievmirza commented on code in PR #7694:
URL: https://github.com/apache/ignite-3/pull/7694#discussion_r2993634650
##########
modules/raft-api/src/main/java/org/apache/ignite/internal/raft/service/RaftGroupListener.java:
##########
@@ -96,4 +96,14 @@ default void onConfigurationCommitted(
* Invoked once after a raft node has been shut down.
*/
void onShutdown();
+
+ /**
+ * Returns the last applied index persisted by the state machine.
+ * Called during {@code NodeImpl.init()} to prevent truncation of
already-applied log entries.
+ *
+ * @return persisted applied index, or 0 if unknown.
+ */
+ default long getPersistedAppliedIndex() {
+ return 0;
Review Comment:
Shouldn't we implement it for all listeners, especially for MS/CMG?
##########
modules/raft/src/test/java/org/apache/ignite/raft/jraft/storage/impl/LogManagerTest.java:
##########
@@ -476,4 +482,46 @@ public void testLastLogIndexWhenShutdown() throws
Exception {
Exception e = assertThrows(IllegalStateException.class, () ->
this.logManager.getLastLogIndex(true));
assertEquals("Node is shutting down", e.getMessage());
}
+
+ /** Suffix truncation below appliedId must report error and abort the
append (IGNITE-25502). */
Review Comment:
why do we need link to a ticket here? wouldn't some TC check fail after we
merge this ticket?
##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java:
##########
@@ -1066,6 +1066,19 @@ public boolean init(final NodeOptions opts) {
return false;
}
+ // Restore appliedId so that unsafeTruncateSuffix() can reject
truncation of applied entries.
Review Comment:
why do we need this entire block of code? please explain
--
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]