mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: return active config in Status
This is useful for debug purposes, and more so once we support joint quorums.
This commit is contained in:
parent
26a1e60eab
commit
7ce934cbec
@ -21,6 +21,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"go.etcd.io/etcd/raft/quorum"
|
||||
"go.etcd.io/etcd/raft/raftpb"
|
||||
"go.etcd.io/etcd/raft/tracker"
|
||||
)
|
||||
@ -460,6 +461,13 @@ func TestRawNodeStatus(t *testing.T) {
|
||||
if exp, act := *rn.raft.prs.Progress[1], status.Progress[1]; !reflect.DeepEqual(exp, act) {
|
||||
t.Fatalf("want: %+v\ngot: %+v", exp, act)
|
||||
}
|
||||
expCfg := tracker.Config{Voters: quorum.JointConfig{
|
||||
quorum.MajorityConfig{1: {}},
|
||||
nil,
|
||||
}}
|
||||
if !reflect.DeepEqual(expCfg, status.Config) {
|
||||
t.Fatalf("want: %+v\ngot: %+v", expCfg, status.Config)
|
||||
}
|
||||
}
|
||||
|
||||
// TestRawNodeCommitPaginationAfterRestart is the RawNode version of
|
||||
|
@ -28,6 +28,7 @@ type Status struct {
|
||||
SoftState
|
||||
|
||||
Applied uint64
|
||||
Config tracker.Config
|
||||
Progress map[uint64]tracker.Progress
|
||||
|
||||
LeadTransferee uint64
|
||||
@ -54,6 +55,7 @@ func getStatusWithoutProgress(r *raft) Status {
|
||||
s.HardState = r.hardState()
|
||||
s.SoftState = *r.softState()
|
||||
s.Applied = r.raftLog.applied
|
||||
s.Config = r.prs.Config.Clone()
|
||||
return s
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user