Raft Node Voting Status Control for Log Consistency
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In distributed systems using the Raft algorithm, the loss of the latest log can occur when a node without the latest log is elected as a leader after a node with the latest log restarts due to a fault, compromising system security.
Innovation Solution
A fault rectification method is implemented in a distributed RAFT cluster system where nodes maintain status variables such as currentTerm, votedFor, lastLogIndex, and lastLogTerm, and set a voting status to 'Voting Not Allowed' for restarted nodes until they receive a replicated-log-entry message from a leader node, ensuring that only nodes with the latest log can be elected as leaders and preventing log loss.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If nodes maintain the ability to vote in leader election after restart, then system availability is improved, but log consistency is compromised as nodes without latest log may be elected as leaders
Solution Approach 1:
The patent applies preliminary action by requiring restarted nodes to receive replicated log entries from the leader node before being permitted to vote in leader elections. This pre-condition ensures that nodes have the latest log information before participating in elections, preventing log loss while maintaining system availability. The voting status is changed from 'Voting Not Allowed' to 'Voting Allowed' only after the node has synchronized with the leader's log.
2Loss of information
If voting status is restricted for restarted nodes, then log consistency is improved, but system availability deteriorates due to delayed leader election
Solution Approach 1:
The patent implements dynamics by making the voting status of restarted nodes dynamic rather than static. Nodes transition from 'Voting Not Allowed' to 'Voting Allowed' status automatically upon receiving replicated log entries from the leader. This dynamic adjustment balances log consistency requirements with timely leader election, as nodes can quickly regain voting rights once synchronized without manual intervention or prolonged restrictions.
3Loss of information
If nodes synchronize log entries from leader before voting, then log consistency is ensured, but communication overhead increases
Solution Approach 1:
The patent applies universality by utilizing the existing replicated log entry mechanism already present in the Raft consensus protocol for dual purposes: both for maintaining log consistency and for determining voting eligibility. The same communication channel used for log replication also serves to notify restarted nodes when they can resume voting. This multi-functional use of the replication mechanism avoids establishing separate communication overhead for voting status management.
Data Source
Figure 1
Figure 2a
Figure 2b
AI summary
This application provides a fault rectification method, applied to a distributed cluster system, where a quantity of nodes that have a latest log and that are included in the distributed cluster system possibly causes a problem that a node that does not have the latest log is elected as a leader after one of the nodes that have the latest log restarts due to a fault, the distributed cluster system includes at least a first node, a second node, and a third node, the first node and the second node have the latest log before the fault occurs, the third node does not have the latest log before the fault occurs, and the method includes: setting, by the first node after the first node restarts due to the fault, a voting status of the first node to Voting Not Allowed, where the voting status is used to indicate whether the first node can vote in a process in which the distributed cluster system elects a leader; and receiving, by the first node, a replicated-log-entry message from the second node, and setting the voting status of the first node to Voting Allowed, where the second node is a leader. The method helps improve security of the distributed cluster system.