cita-cloud / consensus_raft

The raft consensus component for CITA Cloud.
Apache License 2.0
3 stars 0 forks source link

更新共识节点列表导致不出块 #48

Closed rink1969 closed 1 year ago

rink1969 commented 1 year ago

先创建两个节点的链 然后把其中一个节点从共识列表中删除,并停掉节点 接着再增加一个节点,把它加入共识节点列表。

新增节点可以正常同步到最新高度。 然后链就停止出块。

将两个节点都重启之后恢复正常。 从重启之后的日志看,重启之前两个节点都没有正确处理配置变更,所以双方的投票都被对方拒绝,导致无法达成共识。

重启之后正确处理了配置变更,才恢复正常。

│ Jul 26 10:19:21.277 INFO controller grpc addr: http://127.0.0.1:50004, tag: controller, module: consensus::client:45                                                                               │
│ Jul 26 10:19:21.277 INFO network grpc addr: http://127.0.0.1:50000, tag: network, module: consensus::client:167                                                                                    │
│ Jul 26 10:19:21.277 INFO registering network msg handler..., tag: network, module: consensus::client:191                                                                                           │
│ Jul 26 10:19:21.283 INFO network msg handler registered., tag: network, module: consensus::client:206                                                                                              │
│ Jul 26 10:19:21.284 INFO recover from active_path., tag: storage, module: consensus::storage:238                                                                                                   │
│ Jul 26 10:19:21.285 INFO Restore snapshot, tag: storage, module: consensus::storage:571                                                                                                            │
│ Jul 26 10:19:21.285 INFO Restore snapshot, tag: storage, module: consensus::storage:571                                                                                                            │
│ Jul 26 10:19:21.285 INFO waiting for `reconfigure` from controller.., module: consensus::peer:168                                                                                                  │
│ Jul 26 10:19:28.245 INFO reconfigure ack, module: consensus::peer:220                                                                                                                              │
│ Jul 26 10:19:28.245 INFO switched to configuration, config: Configuration { voters: Configuration { incoming: Configuration { voters: {14154913469146201472, 14514993580083775267} }, outgoing: Co │
│ Jul 26 10:19:28.245 INFO became follower at term 260, term: 260, raft_id: 10304773338545719770, module: raft::raft:1088                                                                            │
│ Jul 26 10:19:28.245 INFO newRaft, peers: Configuration { incoming: Configuration { voters: {14154913469146201472, 14514993580083775267} }, outgoing: Configuration { voters: {} } }, last term: 5, │
│ Jul 26 10:19:28.246 INFO RawNode created with id 10304773338545719770., id: 10304773338545719770, raft_id: 10304773338545719770, module: raft::raw_node:315                                        │
│ Jul 26 10:19:28.246 INFO new pending conf change: `ConfChangeV2 { transition: Auto, changes: [ConfChangeSingle { change_type: AddNode, node_id: 10304773338545719770 }, ConfChangeSingle { change_ │
│ Jul 26 10:20:01.126 INFO received a message with higher term from 14514993580083775267, msg type: MsgRequestVote, message_term: 263, term: 260, from: 14514993580083775267, raft_id: 1030477333854 │
│ Jul 26 10:20:01.126 INFO became follower at term 263, term: 263, raft_id: 10304773338545719770, module: raft::raft:1088                                                                            │
│ Jul 26 10:20:01.126 INFO [logterm: 5, index: 5, vote: 0] cast vote for 14514993580083775267 [logterm: 7, index: 224] at term 263, msg type: MsgRequestVote, term: 263, msg_index: 224, msg_term: 7 │
│ Jul 26 10:20:01.207 INFO proposal height lower than current block height, don't check proposal, current_height: 215, proposal_height: 1, module: consensus::peer:531