Commit Graph

123 Commits (d0da319e26c6d8c15438f82ba73b1f9dd5508084)

Author SHA1 Message Date
Xiang Li d0da319e26 Merge https://github.com/benbjohnson/go-raft 2013-07-10 16:35:00 -07:00
Xiang Li 75e0a229e9 commit a NOP after the server becomes leader. Commit ohter commands, after the majority of the peers synced by the NOP command 2013-07-10 16:07:14 -07:00
Ben Johnson 2ee061c60f Fix state check in candidate inner loop. 2013-07-10 11:46:11 -06:00
Xiang Li 62ddd377a0 add encoding speed test and gofmt 2013-07-10 10:31:56 -07:00
Ben Johnson 5e713120bf HTTP Transporter fixes. 2013-07-08 21:00:14 -06:00
Ben Johnson 4ee205422c Merge branch 'master' of https://github.com/benbjohnson/go-raft into http-transporter
Conflicts:
	peer.go
	server.go
2013-07-08 20:56:15 -06:00
Ben Johnson 5aa494ddf9 Add HTTPTransporter. 2013-07-08 20:55:00 -06:00
Xiang Li 3392f8192f Remove the lock in init(). Since addPeer func() require that lock. When do log replay in the init(), there will be deadlock 2013-07-08 16:42:33 -07:00
Xiang Li b3e7f49a33 do not send commit signal if it came from old leader 2013-07-08 10:35:26 -07:00
Xiang Li 7178b21d27 create new channel before start heartbeat to avoid recv stop signal from old heartbeat func 2013-07-07 22:26:36 -07:00
Xiang Li 53d43dee4f fix election timeout problem 2013-07-07 21:31:58 -07:00
Xiang Li 46dd6bbd81 when change the state to leader, we should also update the s.leader to its own name 2013-07-07 17:01:55 -07:00
Xiang Li fa3ec69b6b fix break in select 2013-07-07 16:52:18 -07:00
Xiang Li d3787f60c1 when candidate stepdown it should break the loop; gofmt 2013-07-07 16:37:11 -07:00
Xiang Li 6c6c76bbd9 [Fix #52] Detect new leader with same term as candidate in processAppendEntriesRequest 2013-07-07 16:26:18 -07:00
Ben Johnson 00d109823e Retrieve peer index and term before verifying server state in heartbeat. 2013-07-07 16:19:03 -06:00
Ben Johnson 107888aaff Pass race detector. 2013-07-07 16:12:24 -06:00
Ben Johnson 743b684370 gofmt 2013-07-07 14:55:55 -06:00
Ben Johnson 08e2d519ae Refactor server event loop. 2013-07-07 14:21:04 -06:00
Ben Johnson ce3dbb5dfb Server clean up. 2013-07-06 13:41:42 -06:00
Ben Johnson 44f3ef6701 [Fix #47] Clean up external interface. 2013-07-05 22:49:47 -06:00
Xiang Li cbceb05801 add server state mutex to avoid state race condition 2013-07-05 10:44:03 -07:00
Xiang Li fe55d87640 server should not be blocking will holding the lock 2013-07-03 10:10:43 -07:00
Xiang Li 5c5b489331 rafactor server.go 2013-07-03 09:53:46 -07:00
Xiang Li 11de59fa06 after stepdown candidate should return from collectvote and restart election timeout 2013-07-02 20:51:19 -07:00
Xiang Li c87fa96a14 make stepdown blocking 2013-07-02 18:22:37 -07:00
Xiang Li 7a19090e5d change log ouput format to Lmicroseconds 2013-07-02 11:42:14 -07:00
Xiang Li c9ce5b4217 when promoted, election timeout should be stopped 2013-07-01 22:51:17 -07:00
Xiang Li dac781172e non-blocking sending votes 2013-07-01 08:50:31 -07:00
Xiang Li a6a3f76ea1 clean up promote 2013-07-01 08:46:53 -07:00
Xiang Li a3e02e81ae snapshot checksum in hex 2013-06-30 19:50:48 -07:00
Xiang Li a48505bd95 clean up 2013-06-30 19:20:23 -07:00
Xiang Li 3c15b12198 clean up println 2013-06-30 19:14:02 -07:00
Xiang Li 4f24fb775f check checksum before load snapshot 2013-06-30 17:55:54 -07:00
Xiang Li b0eaf972e6 we have pass the server pointer to the command, dont need to return index 2013-06-29 12:47:18 -07:00
Xiang Li 5c6766e13e return the index of the commited command to the application via do() and add Index func to get the current committed index of the server 2013-06-28 16:14:41 -07:00
Xiang Li 52f97d0c3a change init count val to 1 in func commitCenter() 2013-06-27 14:48:13 -07:00
Xiang Li 941720fe07 gofmt 2013-06-27 13:10:52 -07:00
Xiang Li 1272a1cd30 add commit about fire at peer when leader has new commit index 2013-06-27 13:06:09 -07:00
Xiang Li 7a58a3efd0 candidate should also start election timeout when stepdown; At least one entry from the leader's current term must also be stored on 2013-06-27 13:03:22 -07:00
Ben Johnson 938b649b08 Minor Timer refactor. 2013-06-26 20:35:32 -06:00
Xiang Li 430b2eb661 clean up codes 2013-06-26 18:34:43 -07:00
Xiang Li 8bc79aa999 gofmt 2013-06-26 17:12:44 -07:00
Xiang Li 0fab22808e clean up timer and change heartbeat and election to the new timer 2013-06-26 16:48:47 -07:00
Ben Johnson b9e1bdc86d Remove commitNotify(). 2013-06-26 12:57:31 -06:00
Ben Johnson e09c874f00 Clean up commitCenter(). 2013-06-26 12:57:16 -06:00
Ben Johnson 0bd3c9b1cd Remove unnecessary server locks. 2013-06-26 12:38:39 -06:00
Ben Johnson 46fb02f191 Add s.Peers() and peer cloning. 2013-06-26 12:25:22 -06:00
Ben Johnson ff349bbe40 Remove s.Peers(). 2013-06-26 12:11:43 -06:00
Ben Johnson faeaa88410 Clean up Peer.flush(). 2013-06-25 15:41:42 -06:00