瀏覽代碼

rafthttp: add "RaftDropHeartbeat" failpoint

To simulate network partition locally.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 年之前
父節點
當前提交
8990126c17
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      etcdserver/api/rafthttp/stream.go

+ 3 - 0
etcdserver/api/rafthttp/stream.go

@@ -510,6 +510,7 @@ func (cr *streamReader) decodeLoop(rc io.ReadCloser, t streamType) error {
 	}
 	cr.mu.Unlock()
 
+	// gofail: labelRaftDropHeartbeat:
 	for {
 		m, err := dec.decode()
 		if err != nil {
@@ -519,6 +520,8 @@ func (cr *streamReader) decodeLoop(rc io.ReadCloser, t streamType) error {
 			return err
 		}
 
+		// gofail-go: var raftDropHeartbeat struct{}
+		// continue labelRaftDropHeartbeat
 		receivedBytes.WithLabelValues(types.ID(m.From).String()).Add(float64(m.Size()))
 
 		cr.mu.Lock()