databendlabs / openraft

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

Fix: Prevent panic when calling `Raft::change_membership()` on uninitialized node #1243

Closed drmingdrmer closed 2 months ago

drmingdrmer commented 2 months ago

Previously, change_membership() assumed the current membership config was always non-empty and used the last config entry. However, uninitialized nodes lack a membership config, leading to panics.

This commit adds checks to prevent change_membership() from panicking


This change is Reviewable