97 Commits

Author SHA1 Message Date
Brian Waldon
9a728a127a dep: bump golang.org/x/net/context
Move from code.google.com/p/go.net/context to
golang.org/x/net/context before bumping to latest.
2014-11-20 10:19:12 -08:00
Yicheng Qin
7d0ffb3f12 raft: not set applied when restored from snapshot
applied is only updated by application level through Advance.
2014-11-14 12:08:39 -08:00
Ben Darnell
32824e053c raft: Only call stableTo when we have ready entries or a snapshot.
The first Ready after RestartNode (with no snapshot) will have no
unstable entries, so we don't have the correct prevLastUnstablei
when Advance is called. This would cause raftLog.unstable to move
backwards and previously-stable entries would be returned to
the application again.

This should have been caught by the "unexpected Ready" portion of
TestNodeRestart, but it went unnoticed because the Node's goroutine
takes some time to read from advancec and prepare the write to read to
readyc. Added a small (1ms) delay to all such tests to ensure that the
goroutine has time to enter its select wait.
2014-11-13 14:57:01 -05:00
Xiang Li
04994048bb Merge pull request #1702 from xiang90/node_config_propose
raft: add a test for proposeConfChange
2014-11-12 21:16:54 -08:00
Jonathan Boulle
eb66d2b0eb Merge pull request #1699 from jonboulle/node_stop
raft: block Stop() on n.done, support idempotency
2014-11-12 16:26:54 -08:00
Xiang Li
2a407dadc0 raft: add a test for proposeConfChange 2014-11-12 16:16:26 -08:00
Jonathan Boulle
2cedf127d4 raft: block Stop() on n.done, support idempotency 2014-11-12 15:54:45 -08:00
Xiang Li
68ab7e69e1 raft: add a test for node proposal 2014-11-12 15:44:24 -08:00
Xiang Li
b271e88c20 Merge pull request #1696 from xiang90/testnodetick
raft: add a test for node.Tick
2014-11-12 14:38:07 -08:00
Xiang Li
45c36a0808 raft: add a test for node.Tick 2014-11-12 11:51:51 -08:00
Xiang Li
fe0325fce7 raft: add comment string for TestNodeStart 2014-11-12 11:40:40 -08:00
Xiang Li
0d7c43d885 *: add a Advance interface to raft.Node
Node set the applied to committed right after it sends out Ready to application. This is not
correct since the application has not actually applied the entries at that point. We add a
Advance interface to Node. Application needs to call Advance to tell raft Node its progress.
Also this change can avoid unnecessary copying when application is still applying entires but
there are more entries to be applied.
2014-11-05 15:04:14 -08:00
Jonathan Boulle
6e6d1897d8 pkg: move everything into subpackages 2014-10-27 09:57:28 -07:00
Xiang Li
a44849deec Merge pull request #1286 from coreos/clusterid
*: generate clusterid
2014-10-20 19:07:03 -07:00
Yicheng Qin
e200d2a8e2 etcdserver/raft: remove msgDenied, removedNodes, shouldStop
The future plan is to do all these in etcdserver level.
2014-10-20 15:13:18 -07:00
Xiang Li
ea6bcacfe4 *: generate clusterid 2014-10-20 15:00:54 -07:00
Jonathan Boulle
7a4d42166b *: add license header to all source files 2014-10-17 15:41:22 -07:00
Yicheng Qin
eb2dd1892f raft: add RemovedNodes to SoftState 2014-10-15 10:53:07 -07:00
Jonathan Boulle
4183b69e12 *: move from third_party to Godep 2014-10-14 00:37:52 -07:00
Xiang Li
d7dfe07e5d Merge pull request #1293 from unihorn/160
raft: protobuf messageType
2014-10-14 09:16:38 +08:00
Yicheng Qin
f693c6ddf2 etcdserver: apply bootstrap conf change 2014-10-13 11:22:23 -07:00
Yicheng Qin
0319b033ea etcdserver/raft: set context for bootstrap addnode entries 2014-10-13 11:22:23 -07:00
Yicheng Qin
32c38820c1 raft: protobuf messageType 2014-10-13 11:13:43 -07:00
Xiang Li
af5b8c6c44 raft: int64 -> uint64 2014-10-09 14:26:43 +08:00
Xiang Li
38af14b0f4 Merge pull request #1260 from coreos/snap_rm
raft: save removed nodes in snapshot
2014-10-09 08:00:33 +08:00
Xiang Li
c67fd14fe8 Merge pull request #1257 from bdarnell/cleanups
Raft: assorted cleanups (golint and go vet)
2014-10-09 05:55:21 +08:00
Ben Darnell
d2e858587f Raft: a few more improvements to test messages. 2014-10-08 15:07:11 -04:00
Xiang Li
7b61565c0a raft: save removed nodes in snapshot 2014-10-08 15:33:55 +08:00
Ben Darnell
36558b1924 Raft: fix printf strings found by go vet. 2014-10-07 18:44:06 -04:00
Xiang Li
d7d6f84f64 raft: rand election timeout 2014-10-07 20:12:49 +08:00
Xiang Li
45e4a8643a raft: add tests for raft.compact 2014-10-07 16:03:11 +08:00
Xiang Li
5587e0d73f raft: compact takes index and nodes parameters
Before this commit, compact always compact log at current appliedindex of raft.
This prevents us from doing non-blocking snapshot since we have to make snapshot
and compact atomically. To prepare for non-blocking snapshot, this commit make
compact supports index and nodes parameters. After completing snapshot, the applier
should call compact with the snapshot index and the nodes at snapshot index to do
a compaction at snapsohot index.
2014-10-07 16:03:11 +08:00
Yicheng Qin
45ebfb4217 raft: refine initial entries logic in StartNode 2014-10-06 16:06:01 -07:00
Yicheng Qin
314d425718 main/raft: write addNode ConfChange entries in log when start raft 2014-10-06 14:33:12 -07:00
Yicheng Qin
e4a6c9651a raft: add removed
The usage of removed:
1. tell removed node about its removal explicitly using msgDenied
2. prevent removed node disrupt cluster progress by launching leader election

It is set when apply node removal, or receive msgDenied.
2014-10-01 14:57:38 -07:00
Xiang Li
45f71af33e pkg: move testutil to pkg 2014-09-25 10:40:40 -07:00
Xiang Li
25c2768b8f raft: node ignores unexpected local messages receiving from network 2014-09-23 13:50:43 -07:00
Yicheng Qin
f2ebd64a1b *: add testutil pkg 2014-09-19 14:32:38 -07:00
Jonathan Boulle
b66a40495d raft: introduce Node interface 2014-09-17 14:18:56 -07:00
Xiang Li
ab61a8aa9a *: init for on disk snap support 2014-09-17 13:56:12 -07:00
Yicheng Qin
de21c39ca5 raft: isStateEqual -> isHardStateEqual, IsEmptyState -> IsEmptyHardState 2014-09-16 13:55:00 -07:00
Yicheng Qin
023dc7cba2 etcdserver: add SYNC request 2014-09-16 13:42:03 -07:00
Yicheng Qin
cc8d8f2102 raft: remove unused raftpb.LastIndex 2014-09-15 14:34:23 -07:00
Yicheng Qin
140fd6d6c4 raft: restart using last written entry also 2014-09-15 09:56:33 -07:00
Yicheng Qin
a9af70c52b raft: write entry 0 into log 2014-09-15 09:55:52 -07:00
Xiang Li
ff7f340bba Merge pull request #1063 from coreos/node_run_test
raft: test node block proposal
2014-09-14 22:46:50 -07:00
Xiang Li
e085cc4e06 Merge pull request #1042 from unihorn/118
raft: set none to be 0
2014-09-14 22:32:37 -07:00
Xiang Li
ccee264b7d raft: move defer after run 2014-09-12 12:28:15 -07:00
Xiang Li
45f56a5377 raft: forceGoSched -> forceGosched 2014-09-12 12:27:18 -07:00
Xiang Li
5c884c7797 raft: better comment and naming 2014-09-12 12:18:30 -07:00