etcdserver: discard messages if sender reaches max serving

It is the correct thing to do to ensure that the communication is full
of out-of-date messages.

It results in that integration testing is very easy to throw MsgProp away,
and makes client wait until 5 min timeout. Sync interval and heartbeat are
increased to alleviate the traffic.
This commit is contained in:
Yicheng Qin 2014-11-05 10:31:05 -08:00
parent 1e05cd75c7
commit c3b0de943c
2 changed files with 7 additions and 5 deletions

View File

@ -125,9 +125,11 @@ func newSender(u string, cid types.ID, c *http.Client, fs *stats.FollowerStats)
}
func (s *sender) send(data []byte) {
// TODO: we cannot afford the miss of MsgProp, so we wait for some handler
// to take the data
s.q <- data
select {
case s.q <- data:
default:
log.Printf("sender: reach the maximal serving to %s", s.u)
}
}
func (s *sender) stop() {

View File

@ -36,7 +36,7 @@ import (
)
const (
tickDuration = 5 * time.Millisecond
tickDuration = 10 * time.Millisecond
clusterName = "etcd"
)
@ -181,7 +181,7 @@ func (m *member) Launch(t *testing.T) {
t.Fatalf("failed to initialize the etcd server: %v", err)
}
m.s.Ticker = time.Tick(tickDuration)
m.s.SyncTicker = time.Tick(tickDuration)
m.s.SyncTicker = time.Tick(10 * tickDuration)
m.s.Start()
for _, ln := range m.PeerListeners {