Commit Graph

163 Commits (bddabe564ae5dc8ef65a15ee9083325dbf74bd9c)

Author SHA1 Message Date
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
Ben Johnson 2cf93fd102 Clear reference to LogEntry.result after return. 2013-06-25 14:22:23 -06:00
Ben Johnson e526ed3441 Convert LogEntry.result to interface type. 2013-06-25 14:20:53 -06:00
Ben Johnson b80b7c5a62 Add debug mode. 2013-06-25 14:11:48 -06:00
Ben Johnson dbcb144af6 Merge branch 'master' of https://github.com/xiangli-cmu/go-raft into xiangli-master
Conflicts:
	server.go
2013-06-25 13:17:00 -06:00
Xiang Li 00fb080e7c add comments and gofmt 2013-06-24 09:52:51 -07:00
Xiang Li 2bc38456cb fix issues, further cleaning is needed 2013-06-23 20:41:43 -07:00
Xiang Li d8884cbbea change the do struct and add commit center 2013-06-23 11:42:31 -07:00
Sergey Shepelev 494bf7e0fa server.MemberCount: synchronize access to .peers map with mutex 2013-06-22 19:38:48 +04:00
Sergey Shepelev 19ad97520b server.MemberCount: count peers with len() is cheaper than loop 2013-06-22 19:35:30 +04:00
Xiang Li 5bef65699c when the leader fails in during the collecting response phase, let it step down 2013-06-13 11:03:32 -07:00
Xiang Li f294f3cb9d fix snapshot 2013-06-12 09:47:48 -07:00
Xiang Li 3b73c41286 election new leader and rejoin works 2013-06-11 15:30:13 -07:00
Xiang Li 531e12146a add timer.fire function, which can fire at the timer channel 2013-06-09 21:47:59 -07:00
Xiang Li 094e77f624 use heartbeat to flush the new command in do() function and keep the response result in the log entry 2013-06-08 22:39:50 -07:00
Ben Johnson f9ec2ed5eb Minor cleanup. 2013-06-07 22:41:36 -04:00
Ben Johnson 847bf85fc4 Clean up TestTakeAndSendSnapshot test. 2013-06-07 22:37:10 -04:00
Ben Johnson 769a5ed6a1 go fmt 2013-06-07 22:19:18 -04:00
Ben Johnson 3bcf91a39f Merge branch 'master' of https://github.com/xiangli-cmu/go-raft into xiangli-cmu-master
Conflicts:
	log.go
2013-06-07 17:53:27 -04:00
Ben Johnson bb7caaf889 Add RemovePeer(). 2013-06-07 01:58:41 -04:00
Xiang Li 86bff03c08 add unit test for statemachine 2013-06-06 13:54:27 -07:00
Xiang Li 4fc43b68d6 add statemachine interface 2013-06-05 21:14:07 -07:00
Xiang Li 349a1abacc solve conflicts 2013-06-05 20:32:52 -07:00
Xiang Li f15cadeffd add snapshot unit test 2013-06-05 20:25:17 -07:00
Ben Johnson 77c63cc1f1 Add error lookup for committed log entries. 2013-06-05 13:57:31 -04:00
Xiang Li 842aa1a0ad fix issues (https://github.com/benbjohnson/go-raft/pull/19) 2013-06-05 10:38:49 -07:00
Xiang Li c0e1613eaa clean the codes 2013-06-04 22:56:59 -07:00
Xiang Li 32729ef871 solve conflicts 2013-06-04 17:22:09 -07:00
Xiang Li 4b06328eb0 Merge branch 'master' of https://github.com/xiangli-cmu/go-raft
Conflicts:
	server.go
2013-06-04 17:11:02 -07:00
Xiang Li 3a6fc7bee4 add log-compaction 2013-06-04 17:02:45 -07:00
Ben Johnson 4ca46e7714 Serialize election timeout goroutine. 2013-06-04 09:38:02 -04:00
Ben Johnson 8efbb1535e Fix peer timer race condition. 2013-06-04 09:35:43 -04:00
Ben Johnson c544519c7c Fix timer race condition. 2013-06-03 19:16:50 -04:00
Xiang Li d0dfd4a428 scratch log-compaction 2013-06-03 14:58:12 -07:00
Ben Johnson ba9b7739e4 Add Server.LastCommandName(). 2013-06-03 15:13:38 -04:00
Ben Johnson 1bd88d5e26 Track current leader. 2013-06-03 09:51:52 -04:00
Ben Johnson 20301ed8fd Merge branch 'master' of https://github.com/benbjohnson/go-raft 2013-06-02 22:43:44 -04:00
Ben Johnson 0d9f1f01ed Clean up API. 2013-06-02 22:43:40 -04:00
Xiang Li e1d7a7a8b3 delete the redundant codes when using setCurrTerm 2013-06-02 18:25:02 -07:00
Xiang Li f8973a52a8 fix leader field of Server 2013-06-02 18:18:25 -07:00
Ben Johnson 147d3c5dd8 Switch to use Transporter interface. 2013-05-28 15:57:38 -04:00
Ben Johnson 9e8834448a Remove join command. Fix race condition. 2013-05-28 14:46:27 -04:00
Ben Johnson 97fbdde521 Interface clean up. 2013-05-26 20:17:20 -06:00
Ben Johnson 34008d93eb gofmt 2013-05-26 20:06:08 -06:00
Ben Johnson 345a74b63d Deny command execution for non-leaders. 2013-05-26 20:04:41 -06:00
Ben Johnson 7503eee58b Fix timer cleanup. 2013-05-26 18:02:31 -06:00
Ben Johnson 1337175e63 Merge branch 'master' of https://github.com/benbjohnson/go-raft 2013-05-26 15:51:15 -06:00
Ben Johnson c80f42a2c3 Add random timeouts. 2013-05-26 15:51:01 -06:00
Jesse McNelis c74317513c properly defer unlock calls 2013-05-25 15:37:56 +10:00
Ben Johnson 9cc40929ea Remove ApplyFunc. 2013-05-10 22:15:00 -06:00
Ben Johnson 2efa6b4107 Fix command serialization issues. 2013-05-10 08:47:24 -06:00
Ben Johnson f5761513bc Add log entry marshaling. 2013-05-09 21:50:57 -06:00
Ben Johnson ea99db0386 Fix log entry serialization. 2013-05-08 14:22:08 -06:00
Ben Johnson 7521258d0c Fixed minor bugs. 2013-05-07 21:56:32 -06:00
Ben Johnson f3441b8bfb Add multi-node failure with re-election test. 2013-05-05 15:41:55 -06:00
Ben Johnson 9de292c636 Add heartbeat timer. 2013-05-05 14:26:04 -06:00
Ben Johnson d00057d4cb Refactor timer. 2013-05-05 14:01:06 -06:00
Ben Johnson 776a2ccff9 Fix race conditions. 2013-05-05 13:48:15 -06:00
Ben Johnson ef423e8ad5 Add multi-node join. 2013-05-05 13:36:23 -06:00
Ben Johnson b6e9a8c07b Fix race condition in election timer. 2013-05-05 11:14:27 -06:00
Ben Johnson 0d2cb8affa Fix race conditions. 2013-05-02 22:16:39 -06:00