databendlabs / openraft

rust raft with improvements
Apache License 2.0
1.41k stars 158 forks source link

Feature: `Raft::trigger()::allow_next_revert()` allow to reset replication for next detected follower log revert #1259

Closed drmingdrmer closed 1 month ago

drmingdrmer commented 1 month ago

Changelog

Feature: Raft::trigger()::allow_next_revert() allow to reset replication for next detected follower log revert

This method requests the RaftCore to allow to reset replication for a specific node when log revert is detected.

This method returns Fatal error if failed to send the request to RaftCore, e.g. when RaftCore is shut down. Otherwise, it returns a Ok(Result<_,_>), the inner result is:

Behavior

Automatic Replication Reset

When the loosen-follower-log-revert feature flag is enabled, the Leader automatically reset replication if it detects that the target node's log has reverted. This feature is primarily useful in testing environments.

Production Considerations

In production environments, state reversion is a critical issue that should not be automatically handled. However, there may be scenarios where a Follower's data is intentionally removed and needs to rejoin the cluster(without membership changes). In such cases, the Leader should reinitialize replication for that node with the following steps:


This change is Reviewable