swingbach@gmail.com
1e54117580
raft: add more comments for dueling candidates test case
2016-05-19 13:51:20 +08:00
swingbach@gmail.com
c703ccab63
raft: add more assertions for dueling candidates test case
2016-05-19 13:50:14 +08:00
Xiang Li
910781ef5b
raft: do not panic when removing all the nodes from cluster
2016-05-16 10:04:17 -07:00
Xiang Li
4d2424210f
Merge pull request #5313 from xiang90/fix_raft_abort
...
raft: simplify leadership transfer
2016-05-13 09:26:01 -07:00
Gyu-Ho Lee
fe884f8209
raft: update LICENSE header
2016-05-12 20:49:15 -07:00
Xiang Li
82a6de8b69
raft: simplify leadership transfer
2016-05-10 20:03:42 -07:00
Gyu-Ho Lee
015acabdbb
*: rerun genproto -g
2016-05-02 23:02:31 -07:00
Xiang Li
2fa5b913fe
raft: fix flaky test
...
We recently changed the randomized election timeout from (et, 2*et-1] tp
[et, 2*et-2], where et is user set election timeout.
So 2*et might trigger two elections instead of one. We need to fix the test
code accordingly.
Thanks for Tikv guys for finding this issue. We probably need to randomize
etcd/raft test more.
2016-05-02 21:08:19 -07:00
Anthony Romano
b7ac758969
*: rename storage package to mvcc
2016-04-25 15:25:51 -07:00
Gyu-Ho Lee
4b31acf0e0
*: update generated Proto
2016-04-25 14:08:33 -07:00
Xiang Li
59c5110b73
raft: fix detected race in node.go
2016-04-22 15:45:33 -07:00
Jud White
a9cfbd5414
raft/doc.go: add missing }
2016-04-19 04:21:33 -05:00
Gyu-Ho Lee
7a2ef3eb00
*: regenerate proto buffers
2016-04-13 16:24:07 -07:00
mqliang
1044fbce2c
etcdctlv3: update aunto generated files
2016-04-12 22:48:47 +08:00
Xiang Li
3a695a82a3
Merge pull request #5036 from xiang90/r_t
...
raft: add a test case for Test Slice
2016-04-11 16:02:13 -07:00
Xiang Li
9423125ce1
raft: add a test case for Test Slice
2016-04-11 10:04:03 -07:00
Gyu-Ho Lee
9108af9046
*: clean up from go vet, misspell
2016-04-10 23:16:56 -07:00
Xiang Li
4997ed36b4
Merge pull request #5011 from xiang90/r_c
...
raft: fix issues reported by golint
2016-04-08 11:46:12 -07:00
es-chow
ac059eb8cb
raft: transfer leader feature
2016-04-08 16:56:32 +08:00
Xiang Li
1b41ee9c99
raft: fix issues reported by golint
2016-04-07 22:14:56 -07:00
Anthony Romano
dc17eaace7
*: rename Lease Create to Grant
...
Creating a lease through the client API interface union looked like
"c.Create(...)"-- the method name wasn't very descriptive.
2016-04-07 12:28:14 -07:00
Gyu-Ho Lee
6e6d64fb9b
*: clean up unused vars, functions
...
With help from https://github.com/dominikh/go-unused .
IsNetTimeoutError seems useful, so moved to pkg/netutil.
2016-04-06 21:33:55 -07:00
Tamir Duberstein
68db18667a
raft: correct doc comment
2016-04-06 08:43:42 -04:00
Tamir Duberstein
5250784b09
raft: use rand.Intn instead of rand.Int and mod
...
This provides a better random distribution and is easier to read.
2016-04-06 08:43:42 -04:00
Gyu-Ho Lee
c09f23c46d
*: clean up bool comparison
2016-04-02 18:27:54 -07:00
Xiang Li
5d431b4782
raft: lower split vote rate
2016-04-01 12:11:03 -07:00
Anthony Romano
bd832e5b0a
*: migrate Godeps to vendor/
2016-03-22 17:10:28 -07:00
Xiang Li
f5e60c0e18
raft: add optimization notes
2016-03-17 09:53:50 -07:00
Xiang Li
aa59e7518e
raft: remove unnecessary waitSchedule in test
2016-03-09 09:18:49 -08:00
Peter Bourgon
aedf2c5876
raft: Config: comment wrapping @ 80col
2016-03-01 09:54:58 +01:00
Peter Bourgon
6c1b3a71db
raft: clarify Heartbeat/ElectionTick comments
...
Avoid other, ambiguous interpretations.
2016-03-01 09:52:14 +01:00
Anthony Romano
afa0368dcc
*: fix godoc bugs in interfaces and slice fields
...
detected with goword
2016-02-24 00:45:40 -08:00
Anthony Romano
c5b51946eb
*: exported godoc fixups
2016-02-21 20:36:44 -08:00
Xiang Li
390a4518c0
raft: rework comment for advance interface
2016-02-12 13:43:51 -08:00
Anthony Romano
20461ab11a
*: fix many typos
2016-01-31 21:42:39 -08:00
Gyu-Ho Lee
c827c7432c
raft: fix leaky goroutines in raft test
2016-01-31 12:41:33 -08:00
Gyu-Ho Lee
71c2a9bb3c
*: fix minor typos, comments
2016-01-30 18:15:56 -08:00
Shawn Smith
edd823bba6
raft: fix var name in comment
2016-01-29 16:18:47 +09:00
Xiang Li
37290820de
Merge pull request #4293 from bdarnell/bcast-after-commit
...
raft: Always call bcastAppend after maybeCommit
2016-01-27 09:58:22 -08:00
Sam Rijs
be21d90108
raft/doc: add notice about thread safety of messages
...
Fixes #4285
2016-01-27 20:18:19 +11:00
Xiang Li
6054748181
Merge pull request #4297 from ngaut/ngaut/raft-typo
...
raft: typo
2016-01-26 20:48:53 -08:00
ngaut
751ab40f44
raft: typo
2016-01-27 12:35:14 +08:00
Gyu-Ho Lee
a35d5889f6
*: update gRPC, proto interface
2016-01-26 17:41:39 -08:00
Ben Darnell
0771d713e6
raft: Always call bcastAppend after maybeCommit
2016-01-26 16:55:47 -05:00
Ben Darnell
22925a1d2f
raft: Remove redundant `raft.Commit` field.
...
Keeping this field in sync with `raft.raftLog.committed` was
error-prone, so instead we synthesize the `HardState` on demand.
Fixes #4278 .
2016-01-26 15:18:55 -05:00
Xiang Li
8199147cf8
Merge pull request #4246 from bdarnell/commit-after-remove-node
...
raft: Call maybeCommit after removing a node
2016-01-25 11:47:56 +08:00
Sam Rijs
896719c877
raft: use configured logger in raft/node.go
...
Those three log statements in node.go have not been using the logger that was passed via `raft.Config`, but instead the default raft logger. This changes it to use the proper logger.
2016-01-25 00:15:44 +11:00
Gyu-Ho Lee
53d6aede82
Merge pull request #3889 from gyuho/raft_doc.go_20151118
...
raft: doc, debugging instruction on MessageType
2016-01-22 14:22:49 -08:00
Ben Darnell
46bb2582fe
raft: Call maybeCommit after removing a node.
...
removeNode reduces the required quorum size, so some pending entries may
be able to commit after it is applied.
Discovered in cockroachdb/cockroach#3642
2016-01-20 11:05:48 -04:00
Ben Darnell
c185bdaf95
raft: Improve formatting of DescribeMessage
2016-01-20 11:03:07 -04:00
davygeek
194607812c
raft: follow golint notice to replace +=1 with ++
2016-01-13 09:39:00 +08:00
Xiang Li
eab052d5c4
Merge pull request #4141 from ngaut/ngaut/refactor
...
raft: Rename q() to quorum() which is more readable
2016-01-06 07:32:39 -08:00
siddontang
54a45ba2f5
*: fix typo
2016-01-06 16:17:02 +08:00
ngaut
8ee232d4ec
raft: Rename q() to quorum() which is more readable
2016-01-06 15:23:35 +08:00
ngaut
b38dfda1c9
raft: Tiny refactor
...
Rename i to id since i looks like index which is confusing.
2016-01-04 21:20:54 +08:00
ngaut
acee23112a
raft: typo
2016-01-04 11:51:51 +08:00
Jonathan Boulle
5c65c393a5
raft: small typo fixes in raft package doc
2015-12-23 16:37:06 +01:00
Brandon Philips
c72e4ae112
raft: add raftexample to the docs
...
To help people wanting use this package get started point to the
raftexample package.
2015-12-22 12:04:39 -08:00
Hitoshi Mitake
9b2da76796
raft: remove go vet compliants
2015-12-16 13:29:23 +09:00
Gyu-Ho Lee
8696a1509c
raft/rafttest: fix shadowed variable
2015-12-12 09:38:26 -08:00
Jonathan Boulle
af9f352fe3
raft: update RecentActive name in comments
...
Noticed when retrospectively reviewing #3976 that a couple of places
were missed when the variable was renamed.
2015-12-11 15:06:11 -08:00
Xiang Li
cc6d98bf89
etcdserver: only send snapshot when the member is active
2015-12-10 16:15:26 -08:00
Xiang Li
9df46f9d6f
raft: expose RecentActive in Progress
2015-12-10 12:17:18 -08:00
Bram Gruneir
1901a4c718
raft: Ensure that Progress is not nil when a MsgSnapStatus comes in.
...
This was causing some issues in cockroach cockroachdb/cockroach#2950
2015-12-07 16:01:18 -05:00
Gyu-Ho Lee
d817f885db
raft: doc, debugging instruction on MessageType
...
This adds documentation on MessageType. Having clear explanation about
MessageType helps understand raft logic and debug etcd when there is a
message dropping. This is partially for coreos#3806.
2015-12-03 00:45:11 -08:00
es-chow
5bc56786dc
raft: add RawNode which is a thread-unsafe node without goroutine and remove MultiNode
2015-11-26 17:14:14 +08:00
Xiang Li
a8cc1570d0
raft: support quorum check when raft is leader
...
If quorum check fails, the leader will step down to follower.
2015-11-24 09:36:37 -08:00
Gyu-Ho Lee
81229dbea9
*: add missing package descriptions
...
This adds and updates package descriptions in etcd projects.
And also deletes some duplicate LICENSE statements.
2015-11-17 20:54:10 -08:00
Gyu-Ho Lee
e1c108e604
raft: minor typo in progress.go
...
Fixes a minor typo.
2015-11-17 14:21:35 -08:00
Xiang Li
5d0268aa2e
Merge pull request #3877 from bdarnell/campaign-while-leader
...
raft: no-op instead of panic for Campaigning while leader
2015-11-16 19:59:34 -08:00
Ben Darnell
fbeb58d265
raft: no-op instead of panic for Campaigning while leader
...
We need to be able to force an election (on one node) after creating a
new group (cockroachdb/cockroach#1384 ), but it is difficult to ensure
that our call to Campaign does not race with an election that may be
started by raft itself. A redundant call to Campaign should be a no-op
instead of a panic. (But the panic in becomeCandidate remains, because
we don't want to update the term or change the committed index in this
case)
2015-11-16 21:44:14 -05:00
Yicheng Qin
3a65442d7d
raft: fix print format for term in one log line
...
`term` should be printed in decimal representation instead of
hexadecimal one.
2015-11-15 20:26:16 -08:00
Xiang Li
2990249c1d
Merge pull request #3856 from xiang90/raft_doc_restart
...
raft: add doc to make restart clear
2015-11-11 11:15:49 -08:00
Xiang Li
f7f28b9984
raft: add doc to make restart clear, especially for configuration changed case
2015-11-11 11:11:58 -08:00
Xiang Li
6df52614fc
raft: add more words about raft protocol
2015-11-11 09:20:25 -08:00
Yicheng Qin
0de52414cd
raft: extend wait timeout in TestNodeAdvance
...
This fixes the failure met in semaphore CI.
2015-11-03 16:57:18 -08:00
Yicheng Qin
bf3057e5bd
raft: extend wait timeout in TestMultiNodeAdvance
...
This fixes the failure met in semaphore CI:
```
--- FAIL: TestMultiNodeAdvance-2 (0.01s)
multinode_test.go:458: expect Ready after Advance, but there is
no Ready available
```
2015-10-23 12:08:24 -07:00
Yicheng Qin
01806c3e80
raft: fix malformed example name
...
It is reported by latest govet:
```
gopath/src/github.com/coreos/etcd/raft/example_test.go:26: Example_Node
has malformed example suffix: Node
```
2015-10-20 16:40:01 -07:00
Gyu-Ho Lee
1716d5858f
raft/documentation: clarify progress's subjects.
...
If I understand correctly, `progress` represents the states of follower. For
me, some comments weren't clear because it was missing the subjects of
`progress`. This adds more clarification on who is doing what. Please let me
know if I misunderstood anything. Thanks,
2015-10-15 19:15:08 -07:00
Cong Ding
362df8e470
raft/doc: fix misuse of `for' loop in docs
2015-10-15 11:13:30 -05:00
Cong Ding
f1f92f0fa3
raft/doc: fix typos
2015-10-15 02:17:34 -05:00
Kenji Kaneda
ebd8cb04c1
raft: fix a description of MemoryStorage.Compact
...
The parameter name is compactIndex, not i.
2015-10-06 21:49:33 -07:00
Cong Ding
b2edf1d24a
raft: fix typo in doc
2015-10-01 11:21:23 -05:00
Yicheng Qin
533e728b64
Merge pull request #3609 from yichengq/raft-snapshot
...
raft: kill TODO about behavior when snapshot fails
2015-09-29 19:32:31 -07:00
Yicheng Qin
4c82b481a5
raft: improve behavior when snapshot fails
...
etcd is going to support incremental snapshot, and we design to let it
send at most one snapshot out at first stage. So when one snapshot is in
flight, snapshot request will return error.
When failing to get snapshot when sending MsgSnap, raft prints out
related log and abort sending this message.
2015-09-29 19:15:15 -07:00
Kenji Kaneda
f602767e50
raft: remove an obsolete TODO comment on 4MB maxMsgSize hard coding
...
The TODO comment was added by 7571b2cd
, and it was addressed by d9b5b56c
.
2015-09-28 21:31:12 -07:00
Emil Hessman
b9f22cb69b
raft: fix Node doc typo
2015-09-21 06:13:33 +02:00
Ben Darnell
b7baaa6bc8
raft: Allow per-group nodeIDs in MultiNode.
...
This feature is motivated by
https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/replica_tombstone.md
which requires a change to the way CockroachDB constructs its node IDs.
2015-09-18 15:36:36 -04:00
Jonathan Boulle
7848ac3979
*: add missing license headers
2015-09-15 14:09:01 -07:00
Brandon Philips
68d4ec3e13
raft: improve panic error message
...
Give a human being some insight into how we might have gotten to this
state based on feedback from #3504 .
2015-09-12 12:17:02 -07:00
Dmitry Smirnov
b2f4a5f587
*: fix spelling issues (codespell).
...
Signed-off-by: Dmitry Smirnov <onlyjob@member.fsf.org>
2015-09-11 10:22:29 +10:00
Xiang Li
ef7cf058a2
*: update gogoproto
2015-09-03 15:32:25 -07:00
Tamir Duberstein
45390b9fb8
*: regenerate proto to use local import path
...
Using Go-style import paths in protos is not idiomatic. Normally, this
detail would be internal to etcd, but the path from which gogoproto
is imported affects downstream consumers (e.g. cockroachdb).
In cockroach, we want to avoid including `$GOPATH/src` in our protoc
include path for various reasons. This patch puts etcd on the same
convention, which allows this for cockroach.
More information: https://github.com/cockroachdb/cockroach/pull/2339#discussion_r38663417
This commit also regenerates all the protos, which seem to have
drifted a tiny bit.
2015-09-03 13:38:28 -04:00
Ben Darnell
4f20e01f60
raft: Ignore proposals if not a current member.
...
Fixes another panic in MultiNode.Propose.
2015-08-31 20:31:14 -04:00
Xiang Li
6cbaaa715c
Merge pull request #3396 from bdarnell/multinode-propose-panic
...
raft: Fix a nil-pointer panic in MultiNode.Propose.
2015-08-28 12:34:49 -07:00
Ben Darnell
05924b330a
raft: Fix a nil-pointer panic in MultiNode.Propose.
2015-08-28 11:17:59 +02:00
Yicheng Qin
df83af944b
Merge pull request #3384 from yichengq/fix-shadow
...
test: use go vet shadow feature instead of go-nyet
2015-08-27 14:27:57 -07:00
Yicheng Qin
92cd24d5bd
*: fix govet shadow check failure
2015-08-27 14:15:30 -07:00
Matt Keller
32372e1d70
raft: Fixed a test misassumption
...
network_test.go:56: total = 59.22354ms, want > 50ms
59 is > 50, but the equation added 10 to the right side
2015-08-27 15:15:34 -04:00
Cong Ding
c09b667d57
*: fix go vet reported issues
2015-08-22 12:19:02 -05:00
Xiang Li
6b23a8131f
*: test gofmt with -s and fix reported issues
2015-08-21 18:52:16 -07:00
Xiang Li
50c1db3fbf
raft: downgrade the logging around snapshot to debugf
...
Snapshot related logging is spamming when leader trying to
sync a failed peer.
2015-08-18 15:43:53 -07:00
es-chow
cc362ccdad
raft: set logger to raft so log context such as multinode groupID can be logged
2015-08-12 22:56:00 +08:00
Xiang Li
845c51fedd
*: fix typos vaild->valid
2015-08-07 10:57:11 -07:00
Xiang Li
581ef05bab
*: resolve proto warnings
2015-06-29 18:39:46 -07:00
Xiang Li
13f44e4b79
*: update generated proto code
2015-06-29 16:45:25 -07:00
Xiang Li
e01d53b853
Merge pull request #2979 from xiang90/fix_sendapp
...
raft: fix panic in send app
2015-06-29 10:49:04 -07:00
Xiang Li
b4022899eb
raft: fix panic in send app
...
sendApp accesses the storage several times. Perviously, we
assume that the storage will not be modified during the read
opeartions. The assumption is not true since the storage can
be compacted between the read operations. If a compaction
causes a read entries error, we should not painc. Instead, we
can simply retry the sendApp logic until succeed.
2015-06-15 14:23:33 -07:00
Xiang Li
2f0169c3ab
raft: fix usage section of doc
...
We recently added a config struct to start raft. Update
our doc accordingly.
2015-06-15 10:26:10 -07:00
Yicheng Qin
4e79abcfeb
Merge pull request #2944 from yichengq/fix-2procs
...
pkg/testutil: ForceGosched -> WaitSchedule
2015-06-10 14:44:32 -07:00
Yicheng Qin
018fb8e6d9
pkg/testutil: ForceGosched -> WaitSchedule
...
ForceGosched() performs bad when GOMAXPROCS>1. When GOMAXPROCS=1, it
could promise that other goroutines run long enough
because it always yield the processor to other goroutines. But it cannot
yield processor to goroutine running on other processors. So when
GOMAXPROCS>1, the yield may finish when goroutine on the other
processor just runs for little time.
Here is a test to confirm the case:
```
package main
import (
"fmt"
"runtime"
"testing"
)
func ForceGosched() {
// possibility enough to sched up to 10 go routines.
for i := 0; i < 10000; i++ {
runtime.Gosched()
}
}
var d int
func loop(c chan struct{}) {
for {
select {
case <-c:
for i := 0; i < 1000; i++ {
fmt.Sprintf("come to time %d", i)
}
d++
}
}
}
func TestLoop(t *testing.T) {
c := make(chan struct{}, 1)
go loop(c)
c <- struct{}{}
ForceGosched()
if d != 1 {
t.Fatal("d is not incremented")
}
}
```
`go test -v -race` runs well, but `GOMAXPROCS=2 go test -v -race` fails.
Change the functionality to waiting for schedule to happen.
2015-06-10 14:37:41 -07:00
Xiang Li
1279e495f0
raft: make the repeated log message under bad path debug level
2015-06-05 17:29:24 -07:00
Xiang Li
1561b85bf3
raft: drop the raft prefix in logging
2015-06-02 12:50:42 -07:00
Xiang Li
0ca6be31f8
raft: remove wrong invariant
...
The commit > unstable might not true for follower. The leader only need
to ensure the entry is stored on the majority of nodes to commit an
entry. So the minority of the cluster might receive commit > unstable
append request. This is normal.
2015-05-29 18:48:59 -07:00
Xiang Li
085447ed85
raft: fix raft node start bug
...
raft node should set initial prev hard state to empty.
Or it will not send the first hard coded state to application
until the state changes again.
This commit fixs the issue. It introduce a small overhead, that
the same tate might send to application twice when restarting.
But this is fine.
2015-05-27 13:32:04 -07:00
Xiang Li
0ad6d7e3ba
Merge pull request #2853 from bdarnell/status
...
raft: MultiNode.Status returns nil for non-existent groups.
2015-05-20 13:07:23 -07:00
Ben Darnell
d58fac453d
raft: MultiNode.Status returns nil for non-existent groups.
...
Previously it would panic if the group did not exist.
2015-05-20 15:45:38 -04:00
Ben Darnell
ef721db247
raft: Format node IDs as hex in DescribeMessage.
...
This is how they are printed in all other log messages.
2015-05-20 15:32:56 -04:00
xujun
6b7891c643
raft: fix typo in raftlog
...
fix typo in String() method of raftlog which will misorder
the "committed" and "unstable.offset" output.
2015-04-24 03:28:57 -04:00
Yicheng Qin
89495f9194
Merge pull request #2626 from yichengq/fix-raft-status
...
raft: generate correct json-format status
2015-04-03 13:54:46 -07:00
Yicheng Qin
fa96e64b43
Merge pull request #2624 from yichengq/fix-raft-storage
...
raft: lock storage when compact it
2015-04-03 13:51:06 -07:00
Yicheng Qin
3d32c059dd
raft: generate correct json-format status
...
Current json-format string misses the double quote around status field.
Use %q for better clearance.
2015-04-03 13:49:46 -07:00
Yicheng Qin
d91ea7f199
raft: fix freeTo fails to free
...
If freeTo is called when to is set to the lastest inflight, freeTo
fails to free the slots.
2015-04-03 13:21:26 -07:00
Yicheng Qin
c6de464587
raft: lock storage when compact it
...
etcd now compact raft storage asynchronously, and append entry to raft
storage may happen at the same time. Add the lock to fix the bug that
the entries saved in storage may be organized in a wrong way.
2015-04-03 11:38:01 -07:00
Xiang Li
3f867bc6ed
raft: node bench matches reality
2015-03-28 14:53:42 -07:00
Xiang Li
05e240b892
*: update protobuf
2015-03-25 10:14:35 -07:00
Ben Darnell
c9d507df11
raft: Use raft.Config in MultiNode.
2015-03-24 15:37:13 -04:00
Xiang Li
b3fb052ad4
raft: make peers a prviate field in raft.Config
2015-03-24 11:10:07 -07:00
Xiang Li
abddef0f28
raft: make node configurable
2015-03-23 21:20:49 -07:00
Brandon Philips
057978bbc6
raft: design: fixup markdown
...
Need a space between `1.` for markdown to render as a list.
2015-03-23 14:01:17 -07:00
Xiang Li
d9b5b56c82
raft: make raft configurable
2015-03-23 09:55:19 -07:00
Xiang Li
a552722f03
Merge pull request #2544 from xiang90/raft-inflight
...
raft: add flow control for progress
2015-03-20 20:12:31 -07:00
Xiang Li
4a64373225
raft: add flow control for progress
...
Each progress has a inflighs sliding window. When the progress
is in replicate state, inflights will control the sending speed
of the leader.
The leader can have at most maxInflight number of inflight
messages for each replicate progress. Receving a appResp moves
forward the sliding window. Heartbeat response free one
slot if the window is full.
2015-03-20 20:04:33 -07:00
Xiang Li
09a86cb9b9
Merge pull request #2553 from xiang90/raft-design
...
raft: add progress state machine graph
2015-03-20 19:57:51 -07:00
Xiang Li
86622537a1
raft: add progress state machine graph
2015-03-20 15:28:50 -07:00
Xiang Li
44d9209990
Merge pull request #2548 from xiang90/raft-design
...
raft: add our very first design.md
2015-03-20 09:07:44 -07:00
Yicheng Qin
6e557c58c7
Merge pull request #2532 from yichengq/342
...
raft: print out data and time in log
2015-03-20 08:03:23 -07:00
Xiang Li
59d8089295
raft: add our very first design.md
2015-03-19 21:00:47 -07:00
Xiang Li
2adb58f9de
raft: move progress to progress.go
2015-03-19 10:05:04 -07:00
Xiang Li
7571b2cde2
raft: limit the size of msgApp
...
limit the max size of entries sent per message.
Lower the cost at probing state as we limit the size per message;
lower the penalty when aggressively decrease to a too low next.
2015-03-18 15:59:30 -07:00
Yicheng Qin
0634cf2cfe
raft: print out data and time in log
...
Keep the default log setting consistent with other packages.
2015-03-18 15:49:06 -07:00
Yicheng Qin
7e7bc76038
Merge pull request #2514 from yichengq/340
...
raft: introduce progress states
2015-03-18 09:40:30 -07:00
Yicheng Qin
67194c0b22
raft: introduce progress states
2015-03-18 08:16:32 -07:00
Xiang Li
d17f3a4452
Merge pull request #2519 from bdarnell/multinode-commit
...
raft: Use the correct commit index when advancing in MultiNode.
2015-03-17 10:31:53 -07:00
Ben Darnell
cd1ff78ff3
raft: Elaborate a little more about committed entries in commitReady.
2015-03-17 13:22:36 -04:00
funkygao
0b912c0faf
raft: fix godoc about starting a node
2015-03-17 17:35:18 +08:00
Ben Darnell
271d911c32
raft: Use the correct commit index when advancing in MultiNode.
...
This fixes an issue when restoring from a snapshot and brings
MultiNode closer to Node.
2015-03-16 18:40:51 -04:00
Ben Darnell
5e19adcf70
raft: correctly pass arguments to Logger.Panicf()
2015-03-12 16:15:43 -04:00
Iago López Galeiras
e698192e4a
rafttest: fix build error
...
raftLogger is not exported so we can't access it from here. Go back to
using log.
2015-03-12 11:47:13 +01:00
Xiang Li
39731724ff
Merge pull request #2485 from yichengq/337
...
raft: fall back to bad path when unreachable
2015-03-11 14:16:39 -07:00
Yicheng Qin
be0bf2a2bd
raft: fall back to bad path when unreachable
2015-03-11 13:21:23 -07:00
Xiang Li
c643967a41
raft: reply with the commit index when receives a smaller append message
...
Follower should not reject the append message with a smaller index than its commit
index. Or it will trigger the leader's resending logic, which might have a high cost.
2015-03-10 22:32:36 -07:00
Xiang Li
a2be25cba4
Merge pull request #2460 from xiang90/raft-logger
...
raft: introduce logger interface
2015-03-09 08:00:21 -07:00
Xiang Li
97579e2e1d
raft: introduce logger interface
2015-03-08 21:36:32 -07:00
Xiang Li
7fe608532a
raft: do not reset vote if term is not changed
...
raft MUST keep the voting information for the same term. reset
should not reset vote if term is not changed.
2015-03-07 22:31:20 -08:00
Ben Darnell
725c411346
Add ReportUnreachable and ReportSnapshot to MultiNode.
...
Add ReportSnapshot requirement to doc.go.
2015-03-05 12:39:52 -05:00
Xiang Li
6b9b695167
Merge pull request #2435 from bdarnell/multinode
...
raft: Introduce MultiNode.
2015-03-04 21:27:20 -08:00
Ben Darnell
c824c867ec
raft: more doc updates.
...
Including parallelism of persist and send, cancellation of
ConfChanges, and the risks of two-node clusters.
2015-03-04 15:48:35 -05:00
Ben Darnell
4e74d81bbb
raft: Introduce MultiNode.
...
MultiNode is an alternative to raft.Node that is more efficient
when a node may participate in many consensus groups. It is currently
used in the CockroachDB project; this commit merges the
github.com/cockroachdb/etcd fork back into the mainline.
2015-03-04 15:30:21 -05:00
Ben Darnell
250970cc23
raft: Expand doc.go
...
Includes more details on the required caller behavior and the safety of
membership changes.
Closes #2397
2015-03-04 13:18:02 -05:00
Yicheng Qin
b4b9b9118a
rafthttp: report MsgSnap status
2015-03-02 09:38:11 -08:00
Yicheng Qin
09f181f585
raft: log unreachable remote node
2015-03-01 16:47:49 -08:00
Yicheng Qin
fbd5c81139
raft: remove shadowing of variables from test
2015-02-28 12:09:33 -08:00
Xiang Li
9b4d52ee73
raft: do not resend snapshot if not necessary
...
raft relies on the link layer to report the status of the sent snapshot.
If the snapshot is still sending, the replication to that remote peer will
be paused. If the snapshot finish sending, the replication will begin
optimistically after electionTimeout. If the snapshot fails, raft will
try to resend it.
2015-02-28 11:41:58 -08:00
Xiang Li
2185ac5ac8
raft: cleanup unreachable
2015-02-28 11:35:16 -08:00
Xiang Li
2af33fd494
raft: add reportUnreachable
2015-02-28 10:45:22 -08:00
Xiang Li
cbef6ab152
raft: clean up storage
2015-02-28 10:09:07 -08:00
Xiang Li
5ede18be74
raft: separate compact and createsnap in memory storage
2015-02-28 10:08:30 -08:00
Ben Darnell
b53dc0826e
Only use the EntryFormatter for normal entries.
...
ConfChange entries also have a Data field but the application-supplied
formatter won't know what to do with them.
2015-02-20 13:51:14 -05:00
Barak Michener
92dca0af0f
*: remove shadowing of variables from etcd and add travis test
...
We've been bitten by this enough times that I wrote a tool so that
it never happens again.
2015-02-17 16:31:42 -05:00
Xiang Li
fa66055f66
rafttest: drop isPaused
2015-02-09 18:52:34 -08:00
Xiang Li
085b608de9
rafttest: support node pause
2015-02-09 16:26:43 -08:00
Xiang Li
279b216f9a
raftest: wait for network sending
2015-02-09 15:52:16 -08:00
Xiang Li
65cd0051fe
rafttest: add network delay
2015-02-06 15:01:07 -08:00
Xiang Li
d423946fa4
rafttest: add network drop
2015-02-06 10:50:55 -08:00
Xiang Li
83edf0d862
rafttest: separate network interface and network
2015-02-03 22:50:27 -08:00
Xiang Li
b147a6328d
raftest: add restart and related simple test
2015-02-03 10:08:52 -08:00
Xiang Li
d65af21b73
raft: add raft test suite
2015-02-01 14:53:22 -08:00
Xiang Li
bff2ccaa22
Merge pull request #2170 from xiang90/remove_log
...
raft: remove default verbose logging
2015-01-27 15:58:53 -08:00
Xiang Li
553379e82b
raft: remove default verbose logging
2015-01-27 15:57:44 -08:00
Ben Darnell
33d2400063
raft: Send any waiting appends after receiving MsgAppResp.
...
This addresses a problem that comes up in the cockroach tests,
in which the order of messages may lead to deadlocks (due to
the fact that we don't have regular heartbeat timers in most
of our tests).
2015-01-27 17:43:29 -05:00
Xiang Li
276c9540b4
etcdserver: support raft.status
2015-01-26 16:39:33 -08:00
Jonathan Boulle
f1ed69e883
*: switch to line comments for copyright
...
Build tags are not compatible with block comments.
Also adds copyright header to a few places it was missing.
2015-01-26 09:53:30 -08:00
Ben Darnell
8c3a6508e9
raft: Add applied to the newRaft log message.
2015-01-22 12:04:40 -05:00
Ben Darnell
59214978a2
raft: Add applied index as an argument to newRaft and RestartNode.
2015-01-22 11:38:05 -05:00
Ben Darnell
cd9d5573d4
raft: make EntryFormatter less clever.
2015-01-21 19:27:26 -05:00
Ben Darnell
e73d442e32
raft: Add support for custom formatters in DescribeMessage/DescribeEntry
2015-01-21 14:12:58 -05:00
Xiang Li
003b97a60f
raft: public progress struct in raft
2015-01-20 10:26:22 -08:00
Xiang Li
b34936b097
raft: add progress into status
2015-01-18 15:23:50 -08:00
Xiang Li
0eaaad0e48
raft: add Status interface
...
Status returns the current status of raft state machine.
2015-01-16 14:02:04 -08:00
Ben Darnell
2e1c36cdd9
raft: introduce MsgHeartbeatResp.
...
Now that heartbeats are distinct from MsgApp{,Resp}, the retries
currently performed in stepLeader's MsgAppResp section are only
performed on an actual MsgAppResp (or a new MsgProp). This means
that it may take a long time to recover from a dropped MsgAppResp
in a quiet cluster.
This commit adds a dedicated heartbeat response message. This message
does not convey the follower's current log position because the
MsgHeartbeat does not include the leaders term and index. Upon receipt
of a heartbeat response, the leader may retry the latest MsgApp if it
believes the follower to be behind.
2015-01-14 17:34:10 -05:00
Ben Darnell
9972e62d94
raft: Use <= instead of < for heartbeat ticks.
...
In code outside the raft package, we cannot call raft.bcastHeartbeat
directly. Instead, to control heartbeats we set heartbeatInterval to 1
and call Tick().
2015-01-14 15:27:32 -05:00
Yicheng Qin
7a2fa39e52
Merge pull request #2012 from andybons/master
...
raft: add link to the paper raft_paper_test.go refers to
2015-01-06 00:27:47 -08:00
Xiang Li
2a83e350b1
Merge pull request #1992 from xiang90/rm_leader
...
*: support removing the leader from a 2 members cluster
2015-01-02 14:15:12 -08:00
Xiang Li
35b907ac58
raft: add lastIndex as rejectHint
...
Add the lastindex of the raft log as reject hint, so the leader can
bypass the greater index probing and decrease the next index directly
to last + 1.
2015-01-01 19:04:07 -08:00
Xiang Li
152676f43a
*: support removing the leader from a 2 members cluster
2014-12-29 11:34:33 -08:00
Andrew Bonventre
4463f5c4b3
raft: add link to the paper raft_paper_tests.go refers to
2014-12-29 14:17:48 -05:00
Xiang Li
fc96a9e4a7
raft: remove unnecessary funcs in raft.go
2014-12-25 17:04:33 -08:00
Xiang Li
2dbdf87f86
raft: add doc for storage
2014-12-22 12:33:14 -08:00
Xiang Li
896bac1f76
raft: flush the commit to fix a race in test
2014-12-18 17:10:37 -08:00