zhang-xiaoda / nju-dissys-2017 Goto Github PK
View Code? Open in Web Editor NEWDistributed System, Fall 2017, CS@NJU
Distributed System, Fall 2017, CS@NJU
我研究了一下TestFailNoAgree这个测试用例,似乎存在缺陷。
主要是这几行:
cfg.one(10, servers)
// 3 of 5 followers disconnect
leader := cfg.checkOneLeader()
cfg.disconnect((leader + 1) % servers)
cfg.disconnect((leader + 2) % servers)
cfg.disconnect((leader + 3) % servers)
cfg.one 首先多次调用Start,直到某一个node认为自己是leader,并返回possible index;
然后, 使用cfg.checkOneLeader()来检查是否真正选举出唯一leader;
问题在于, cfg.checkOneLeader()会首先sleep 500ms,确认election success后disconnect 3/5 的node。
需要注意的是cfg.one中最后一个request被接受了,并且此时已经正在被replicate,paper推荐的election timeout大概在100ms级别,heartbeat timeout时间更短,这就造成了disconnect之前log已经commit了。
而测试用例的assert是没有任何一个commit成功
以下是运行日志,供参考
/usr/local/go/bin/go test -v raft -run ^TestFailNoAgree$
0 says: hello world!
1 says: hello world!
2 says: hello world!
3 says: hello world!
4 says: hello world!
Test: no agreement if too many followers fail ...
1 says: oh, we have a guest named 10
2 says: oh, we have a guest named 10
3 says: oh, we have a guest named 10
4 says: oh, we have a guest named 10
0 says: oh, we have a guest named 10
2 : tick
0 : tick
1 : tick
4 : tick
1 says: oh, we have a guest named 10
2 says: oh, we have a guest named 10
3 says: oh, we have a guest named 10
4 says: oh, we have a guest named 10
0 says: oh, we have a guest named 10
3 : tick
2 : tick
0 : tick
1 : tick
1 says: oh, we have a guest named 10
2 says: oh, we have a guest named 10
3 says: oh, we have a guest named 10
4 says: oh, we have a guest named 10
0 says: oh, we have a guest named 10
3 : tick
4 : tick
3 tells 4 : vote me, {1 3 0 0}
3 tells 2 : vote me, {1 3 0 0}
3 tells 1 : vote me, {1 3 0 0}
3 tells 0 : vote me, {1 3 0 0}
2 says: higher term detected, term= 1
2 tells 3 : vote granted
0 says: higher term detected, term= 1
0 tells 3 : vote granted
1 says: higher term detected, term= 1
1 tells 3 : vote granted
4 says: higher term detected, term= 1
4 tells 3 : vote granted
3 says: I am the leader in term 1
map[]
3 told 1 : ping, {1 3 0 0 [] 0}
map[]
3 told 2 : ping, {1 3 0 0 [] 0}
3 told 0 : ping, {1 3 0 0 [] 0}
3 told 4 : ping, {1 3 0 0 [] 0}
1 tells 3 : pong, &{1 true}
4 tells 3 : pong, &{1 true}
0 tells 3 : pong, &{1 true}
2 tells 3 : pong, &{1 true}
0 : tick
1 : tick
2 : tick
4 : tick
3 : tick
1 says: oh, we have a guest named 10
2 says: oh, we have a guest named 10
3 says: oh, we have a guest named 10
map[]
2 : tick
1 : tick
0 : tick
4 : tick
3 : tick
3 told 4 : ping, {1 3 0 0 [map[command:10 term:1]] 0}
3 told 2 : ping, {1 3 0 0 [map[command:10 term:1]] 0}
3 told 0 : ping, {1 3 0 0 [map[command:10 term:1]] 0}
3 told 1 : ping, {1 3 0 0 [map[command:10 term:1]] 0}
2 tells 3 : roger that [map[command:10 term:1]]
2 tells 3 : pong, &{1 true}
4 tells 3 : roger that [map[command:10 term:1]]
4 tells 3 : pong, &{1 true}
1 tells 3 : roger that [map[term:1 command:10]]
1 tells 3 : pong, &{1 true}
0 tells 3 : roger that [map[command:10 term:1]]
0 tells 3 : pong, &{1 true}
3 says: 1 is commited
0 : tick
4 : tick
2 : tick
1 : tick
3 : tick
2 : tick
0 : tick
1 : tick
4 : tick
3 : tick
3 told 4 : ping, {1 3 1 1 [] 1}
3 told 1 : ping, {1 3 1 1 [] 1}
3 told 2 : ping, {1 3 1 1 [] 1}
3 told 0 : ping, {1 3 1 1 [] 1}
2 tells 3 : pong, &{1 true}
1 tells 3 : pong, &{1 true}
4 tells 3 : pong, &{1 true}
0 tells 3 : pong, &{1 true}
0 : tick
2 : tick
1 : tick
4 : tick
3 : tick
3 told 0 : ping, {1 3 1 1 [] 1}
3 told 1 : ping, {1 3 1 1 [] 1}
3 told 2 : ping, {1 3 1 1 [] 1}
3 told 4 : ping, {1 3 1 1 [] 1}
2 tells 3 : pong, &{1 true}
4 tells 3 : pong, &{1 true}
1 tells 3 : pong, &{1 true}
0 tells 3 : pong, &{1 true}
2 : tick
0 : tick
1 : tick
4 : tick
3 : tick
0 : tick
1 : tick
2 : tick
4 : tick
3 : tick
3 told 0 : ping, {1 3 1 1 [] 1}
3 told 4 : ping, {1 3 1 1 [] 1}
3 told 1 : ping, {1 3 1 1 [] 1}
3 told 2 : ping, {1 3 1 1 [] 1}
0 tells 3 : pong, &{1 true}
4 tells 3 : pong, &{1 true}
2 tells 3 : pong, &{1 true}
1 tells 3 : pong, &{1 true}
2 : tick
0 : tick
1 : tick
4 : tick
3 : tick
2 : tick
0 : tick
1 : tick
4 : tick
3 : tick
3 told 4 : ping, {1 3 1 1 [] 1}
3 told 1 : ping, {1 3 1 1 [] 1}
3 told 2 : ping, {1 3 1 1 [] 1}
3 told 0 : ping, {1 3 1 1 [] 1}
4 tells 3 : pong, &{1 true}
1 tells 3 : pong, &{1 true}
0 tells 3 : pong, &{1 true}
2 tells 3 : pong, &{1 true}
0 : tick
2 : tick
1 : tick
4 : tick
3 : tick
0 : tick
1 : tick
2 : tick
4 : tick
3 : tick
3 told 4 : ping, {1 3 1 1 [] 1}
3 told 1 : ping, {1 3 1 1 [] 1}
3 told 0 : ping, {1 3 1 1 [] 1}
3 told 2 : ping, {1 3 1 1 [] 1}
1 tells 3 : pong, &{1 true}
4 tells 3 : pong, &{1 true}
0 tells 3 : pong, &{1 true}
2 tells 3 : pong, &{1 true}
4 : tick
0 : tick
2 : tick
1 : tick
3 : tick
0 says: current state, { 1 , 3 , [map[command:10 term:1]] }
1 says: current state, { 1 , 3 , [map[term:1 command:10]] }
2 says: current state, { 1 , 3 , [map[term:1 command:10]] }
3 says: current state, { 1 , 3 , [map[command:10 term:1]] }
4 says: current state, { 1 , 3 , [map[command:10 term:1]] }
3 says: oh, we have a guest named 20
map[]
4 : tick
1 : tick
2 : tick
3 : tick
0 : tick
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : roger that [map[command:20 term:1]]
2 tells 3 : pong, &{1 true}
0 : tick
2 : tick
1 : tick
3 : tick
4 : tick
1 tells 4 : vote me, {2 1 1 1}
1 tells 2 : vote me, {2 1 1 1}
1 tells 3 : vote me, {2 1 1 1}
1 tells 0 : vote me, {2 1 1 1}
4 tells 3 : vote me, {2 4 1 1}
4 tells 1 : vote me, {2 4 1 1}
4 tells 2 : vote me, {2 4 1 1}
4 tells 0 : vote me, {2 4 1 1}
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
0 tells 4 : vote me, {2 0 1 1}
0 tells 2 : vote me, {2 0 1 1}
0 tells 3 : vote me, {2 0 1 1}
0 tells 1 : vote me, {2 0 1 1}
2 : tick
1 : tick
0 : tick
4 : tick
3 : tick
3 : tick
4 : tick
1 : tick
2 : tick
0 : tick
3 told 4 : ping, {1 3 1 1 [map[term:1 command:20]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 2 1 [] 1}
2 tells 3 : pong, &{1 true}
0 : tick
2 : tick
1 : tick
3 : tick
4 : tick
1 tells 4 : vote me, {3 1 1 1}
1 tells 3 : vote me, {3 1 1 1}
1 tells 0 : vote me, {3 1 1 1}
1 tells 2 : vote me, {3 1 1 1}
4 tells 0 : vote me, {3 4 1 1}
4 tells 1 : vote me, {3 4 1 1}
4 tells 3 : vote me, {3 4 1 1}
4 tells 2 : vote me, {3 4 1 1}
0 : tick
2 : tick
1 : tick
4 : tick
3 : tick
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
0 tells 4 : vote me, {3 0 1 1}
0 tells 2 : vote me, {3 0 1 1}
0 tells 3 : vote me, {3 0 1 1}
0 tells 1 : vote me, {3 0 1 1}
1 : tick
0 : tick
2 : tick
3 : tick
4 : tick
4 tells 3 : vote me, {4 4 1 1}
4 tells 1 : vote me, {4 4 1 1}
4 tells 2 : vote me, {4 4 1 1}
4 tells 0 : vote me, {4 4 1 1}
1 tells 4 : vote me, {4 1 1 1}
1 tells 2 : vote me, {4 1 1 1}
1 tells 3 : vote me, {4 1 1 1}
1 tells 0 : vote me, {4 1 1 1}
2 : tick
1 : tick
3 : tick
4 : tick
0 : tick
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
1 : tick
0 : tick
2 : tick
3 : tick
4 : tick
4 tells 3 : vote me, {5 4 1 1}
4 tells 1 : vote me, {5 4 1 1}
4 tells 2 : vote me, {5 4 1 1}
4 tells 0 : vote me, {5 4 1 1}
0 : tick
1 : tick
2 : tick
4 : tick
3 : tick
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
0 tells 4 : vote me, {4 0 1 1}
0 tells 2 : vote me, {4 0 1 1}
0 tells 1 : vote me, {4 0 1 1}
0 tells 3 : vote me, {4 0 1 1}
1 tells 4 : vote me, {5 1 1 1}
1 tells 2 : vote me, {5 1 1 1}
1 tells 3 : vote me, {5 1 1 1}
1 tells 0 : vote me, {5 1 1 1}
1 : tick
0 : tick
4 : tick
2 : tick
3 : tick
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
0 : tick
2 : tick
1 : tick
4 : tick
3 : tick
1 tells 4 : vote me, {6 1 1 1}
1 tells 2 : vote me, {6 1 1 1}
1 tells 3 : vote me, {6 1 1 1}
1 tells 0 : vote me, {6 1 1 1}
1 : tick
2 : tick
0 : tick
3 : tick
4 : tick
0 tells 4 : vote me, {5 0 1 1}
0 tells 2 : vote me, {5 0 1 1}
0 tells 3 : vote me, {5 0 1 1}
0 tells 1 : vote me, {5 0 1 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 2 1 [] 1}
2 tells 3 : pong, &{1 true}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
4 tells 3 : vote me, {6 4 1 1}
4 tells 1 : vote me, {6 4 1 1}
4 tells 2 : vote me, {6 4 1 1}
4 tells 0 : vote me, {6 4 1 1}
0 : tick
1 : tick
2 : tick
4 : tick
3 : tick
4 : tick
0 : tick
3 : tick
1 : tick
2 : tick
1 tells 4 : vote me, {7 1 1 1}
1 tells 2 : vote me, {7 1 1 1}
1 tells 0 : vote me, {7 1 1 1}
1 tells 3 : vote me, {7 1 1 1}
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
0 : tick
1 : tick
2 : tick
4 : tick
3 : tick
0 tells 4 : vote me, {6 0 1 1}
0 tells 2 : vote me, {6 0 1 1}
0 tells 3 : vote me, {6 0 1 1}
0 tells 1 : vote me, {6 0 1 1}
4 : tick
2 : tick
3 : tick
0 : tick
1 : tick
4 tells 3 : vote me, {7 4 1 1}
4 tells 1 : vote me, {7 4 1 1}
4 tells 0 : vote me, {7 4 1 1}
4 tells 2 : vote me, {7 4 1 1}
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[term:1 command:20]] 1}
2 tells 3 : pong, &{1 true}
2 : tick
0 : tick
1 : tick
3 : tick
4 : tick
1 tells 2 : vote me, {8 1 1 1}
1 tells 3 : vote me, {8 1 1 1}
1 tells 0 : vote me, {8 1 1 1}
1 tells 4 : vote me, {8 1 1 1}
0 : tick
2 : tick
3 : tick
1 : tick
4 : tick
3 told 4 : ping, {1 3 1 1 [map[term:1 command:20]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
0 tells 4 : vote me, {7 0 1 1}
0 tells 2 : vote me, {7 0 1 1}
0 tells 3 : vote me, {7 0 1 1}
0 tells 1 : vote me, {7 0 1 1}
4 tells 3 : vote me, {8 4 1 1}
4 tells 1 : vote me, {8 4 1 1}
4 tells 2 : vote me, {8 4 1 1}
4 tells 0 : vote me, {8 4 1 1}
0 : tick
1 : tick
2 : tick
4 : tick
3 : tick
1 tells 4 : vote me, {9 1 1 1}
1 tells 2 : vote me, {9 1 1 1}
1 tells 0 : vote me, {9 1 1 1}
1 tells 3 : vote me, {9 1 1 1}
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
0 : tick
1 : tick
2 : tick
2 tells 3 : pong, &{1 true}
3 : tick
4 : tick
2 : tick
0 : tick
1 : tick
3 : tick
4 : tick
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[term:1 command:20]] 1}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
0 : tick
2 : tick
1 : tick
4 : tick
3 : tick
0 tells 4 : vote me, {8 0 1 1}
0 tells 2 : vote me, {8 0 1 1}
0 tells 3 : vote me, {8 0 1 1}
0 tells 1 : vote me, {8 0 1 1}
4 tells 3 : vote me, {9 4 1 1}
4 tells 1 : vote me, {9 4 1 1}
4 tells 0 : vote me, {9 4 1 1}
4 tells 2 : vote me, {9 4 1 1}
0 : tick
1 : tick
2 : tick
3 : tick
4 : tick
1 tells 4 : vote me, {10 1 1 1}
1 tells 2 : vote me, {10 1 1 1}
1 tells 3 : vote me, {10 1 1 1}
1 tells 0 : vote me, {10 1 1 1}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 2 1 [] 1}
2 tells 3 : pong, &{1 true}
0 : tick
1 : tick
3 : tick
4 : tick
2 : tick
4 tells 3 : vote me, {10 4 1 1}
4 tells 1 : vote me, {10 4 1 1}
4 tells 2 : vote me, {10 4 1 1}
4 tells 0 : vote me, {10 4 1 1}
0 : tick
2 : tick
1 : tick
3 : tick
4 : tick
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 2 1 [] 1}
2 tells 3 : pong, &{1 true}
1 tells 2 : vote me, {11 1 1 1}
1 tells 3 : vote me, {11 1 1 1}
1 tells 0 : vote me, {11 1 1 1}
1 tells 4 : vote me, {11 1 1 1}
0 tells 4 : vote me, {9 0 1 1}
0 tells 1 : vote me, {9 0 1 1}
0 tells 2 : vote me, {9 0 1 1}
0 tells 3 : vote me, {9 0 1 1}
0 : tick
2 : tick
1 : tick
3 : tick
4 : tick
1 : tick
0 : tick
4 : tick
3 : tick
2 : tick
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[term:1 command:20]] 1}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
4 tells 3 : vote me, {11 4 1 1}
4 tells 1 : vote me, {11 4 1 1}
4 tells 2 : vote me, {11 4 1 1}
4 tells 0 : vote me, {11 4 1 1}
1 : tick
3 : tick
2 : tick
0 : tick
4 : tick
1 tells 4 : vote me, {12 1 1 1}
1 tells 3 : vote me, {12 1 1 1}
1 tells 2 : vote me, {12 1 1 1}
1 tells 0 : vote me, {12 1 1 1}
2 : tick
1 : tick
3 : tick
0 : tick
4 : tick
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 4 : ping, {1 3 1 1 [map[term:1 command:20]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
0 tells 4 : vote me, {10 0 1 1}
0 tells 2 : vote me, {10 0 1 1}
0 tells 3 : vote me, {10 0 1 1}
0 tells 1 : vote me, {10 0 1 1}
2 : tick
3 : tick
1 : tick
4 : tick
0 : tick
4 tells 3 : vote me, {12 4 1 1}
4 tells 1 : vote me, {12 4 1 1}
4 tells 2 : vote me, {12 4 1 1}
4 tells 0 : vote me, {12 4 1 1}
1 tells 2 : vote me, {13 1 1 1}
1 tells 4 : vote me, {13 1 1 1}
1 tells 0 : vote me, {13 1 1 1}
1 tells 3 : vote me, {13 1 1 1}
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
1 : tick
2 : tick
3 : tick
0 : tick
4 : tick
0 : tick
1 : tick
2 : tick
4 : tick
3 : tick
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
0 tells 4 : vote me, {11 0 1 1}
0 tells 2 : vote me, {11 0 1 1}
0 tells 1 : vote me, {11 0 1 1}
0 tells 3 : vote me, {11 0 1 1}
1 : tick
0 : tick
4 : tick
2 : tick
3 : tick
4 tells 3 : vote me, {13 4 1 1}
4 tells 1 : vote me, {13 4 1 1}
4 tells 2 : vote me, {13 4 1 1}
4 tells 0 : vote me, {13 4 1 1}
1 tells 0 : vote me, {14 1 1 1}
1 tells 3 : vote me, {14 1 1 1}
1 tells 2 : vote me, {14 1 1 1}
1 tells 4 : vote me, {14 1 1 1}
2 : tick
1 : tick
0 : tick
3 : tick
4 : tick
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 2 1 [] 1}
2 tells 3 : pong, &{1 true}
3 told 4 : ping, {1 3 1 1 [map[term:1 command:20]] 1}
4 : tick
0 : tick
1 : tick
2 : tick
3 : tick
4 tells 3 : vote me, {14 4 1 1}
4 tells 1 : vote me, {14 4 1 1}
4 tells 2 : vote me, {14 4 1 1}
4 tells 0 : vote me, {14 4 1 1}
1 tells 4 : vote me, {15 1 1 1}
1 tells 2 : vote me, {15 1 1 1}
1 tells 0 : vote me, {15 1 1 1}
1 tells 3 : vote me, {15 1 1 1}
3 : tick
2 : tick
0 : tick
1 : tick
4 : tick
0 tells 4 : vote me, {12 0 1 1}
0 tells 2 : vote me, {12 0 1 1}
0 tells 1 : vote me, {12 0 1 1}
0 tells 3 : vote me, {12 0 1 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
2 : tick
0 : tick
3 : tick
1 : tick
4 : tick
4 tells 3 : vote me, {15 4 1 1}
4 tells 2 : vote me, {15 4 1 1}
4 tells 0 : vote me, {15 4 1 1}
4 tells 1 : vote me, {15 4 1 1}
0 : tick
1 : tick
2 : tick
4 : tick
3 : tick
3 told 4 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 1 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
3 told 2 : ping, {1 3 2 1 [] 1}
3 told 0 : ping, {1 3 1 1 [map[command:20 term:1]] 1}
2 tells 3 : pong, &{1 true}
1 tells 4 : vote me, {16 1 1 1}
1 tells 2 : vote me, {16 1 1 1}
1 tells 0 : vote me, {16 1 1 1}
1 tells 3 : vote me, {16 1 1 1}
2 : tick
1 : tick
4 : tick
0 : tick
3 : tick
0 says: bye~
1 says: bye~
2 says: bye~
3 says: bye~
4 says: bye~
test_test.go:160: 1 committed but no majority
exit status 1
FAIL raft 2.734s
所有的测试是否能够连续执行。即输入“go test”,运行全部测试。
实验要求中,是"go test -run XXX"的单元测试,最终是否也是只进行单元测试。
在执行rf.peers[sever].Call(xx,xx)后系统返回了一个错误说
2021/11/23 19:00:21 ClientEnd.Call(): decode reply: EOF
查了很久也不明白是为什么
代码中没有设置AppendEntries RPC函数,是需要我们自己补充么?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.