talent-plan/tinykv

TestConfig doesn't include "peers" section

oocococo opened this issue · 0 comments

In raftstore/peer.go, NewPeer function will create raft peer using

raftCfg := &raft.Config{
		ID:            meta.GetId(),
		ElectionTick:  cfg.RaftElectionTimeoutTicks,
		HeartbeatTick: cfg.RaftHeartbeatTicks,
		Applied:       appliedIndex,
		Storage:       ps,
	}

Although you've made it clear that
For simplicity, there would be only one Peer on a Store and one Region in a cluster for project2.

But a config w/o peers section go against the define of peers IDs of all nodes **(including self)**

// peers contains the IDs of all nodes (including self) in the raft cluster. It
	// should only be set when starting a new raft cluster. Restarting raft from
	// previous configuration will panic if peers is set. peer is private and only
	// used for testing right now.
	peers []uint64

Although it's only for test, but doesn't it make the config not valid?