Tobias Schottdorf
6b0322549f
raft: replace StatusWithoutProgress with BasicStatus
...
Now that a Config is also added to the full status, the old name
did not convey the intention, which was to get a Status without
an associated allocation.
2019-07-18 16:28:37 +02:00
Tobias Schottdorf
7ce934cbec
raft: return active config in Status
...
This is useful for debug purposes, and more so once we support joint
quorums.
2019-07-17 14:29:45 +02:00
Tobias Schottdorf
26a1e60eab
raft: return non-nil Inflights in raft status
...
Recent refactoring to the String() method of `Progress` hit an NPE
because we return nil Inflights as part of the Raft status. Just
fix this at the source and properly populate the Raft status instead
of teaching String() to ignore nil. A real Progress always has a
non-nil Inflights.
2019-07-17 12:53:28 +02:00
Tobias Schottdorf
f9c2d00fb3
raft: extract 'tracker' package
...
Mechanically extract `progressTracker`, `Progress`, and `inflights`
to their own package named `tracker`. Add lots of comments in the
progress, and take the opportunity to rename and clarify various
fields.
2019-06-21 22:15:00 +02:00
Gyuho Lee
34bd797e67
*: revert module import paths
...
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-05-28 15:39:35 -07:00
Tobias Schottdorf
ea82b2b758
raft: move more methods onto the progress tracker
...
Continues what was initiated in the last commit.
2019-05-21 16:02:52 +02:00
Tobias Schottdorf
dbac67e7a8
raft: extract progress tracking into own component
...
The Progress maps contain both the active configuration and information
about the replication status. By pulling it into its own component, this
becomes easier to unit test and also clarifies the code, which will see
changes as etcd-io/etcd#7625 is addressed.
More functionality will move into `prs` in self-contained follow-up commits.
2019-05-21 16:02:52 +02:00
shivaramr
9150bf52d6
go modules: Fix module path version to include version number
2019-04-26 15:29:50 -07:00
Tobias Schottdorf
bd332b318e
raft: add (*RawNode).WithProgress
...
Calls to Status can be frequent and currently incur three heap
allocations, but often the caller has no intention to hold on to the
returned status.
Add StatusWithoutProgress and WithProgress to allow avoiding heap
allocations altogether. StatusWithoutProgress does what's on the
tin and additionally returns a value (instead of a pointer) to
avoid the associated heap allocation. By not returning a Progress
map, it avoids all other allocations that Status incurs.
To still introspect the Progress map, add WithProgress, which
uses a simple visitor pattern.
Add benchmarks to verify that this is indeed allocation free.
```
BenchmarkStatusProgress/members=1/Status-8 5000000 353 ns/op 784 B/op 3 allocs/op
BenchmarkStatusProgress/members=1/Status-example-8 5000000 372 ns/op 784 B/op 3 allocs/op
BenchmarkStatusProgress/members=1/StatusWithoutProgress-8 100000000 17.6 ns/op 0 B/op 0 allocs/op
BenchmarkStatusProgress/members=1/WithProgress-8 30000000 48.6 ns/op 0 B/op 0 allocs/op
BenchmarkStatusProgress/members=1/WithProgress-example-8 30000000 42.9 ns/op 0 B/op 0 allocs/op
BenchmarkStatusProgress/members=3/Status-8 5000000 395 ns/op 784 B/op 3 allocs/op
BenchmarkStatusProgress/members=3/Status-example-8 3000000 449 ns/op 784 B/op 3 allocs/op
BenchmarkStatusProgress/members=3/StatusWithoutProgress-8 100000000 18.7 ns/op 0 B/op 0 allocs/op
BenchmarkStatusProgress/members=3/WithProgress-8 20000000 78.1 ns/op 0 B/op 0 allocs/op
BenchmarkStatusProgress/members=3/WithProgress-example-8 20000000 70.7 ns/op 0 B/op 0 allocs/op
BenchmarkStatusProgress/members=5/Status-8 3000000 470 ns/op 784 B/op 3 allocs/op
BenchmarkStatusProgress/members=5/Status-example-8 3000000 544 ns/op 784 B/op 3 allocs/op
BenchmarkStatusProgress/members=5/StatusWithoutProgress-8 100000000 19.7 ns/op 0 B/op 0 allocs/op
BenchmarkStatusProgress/members=5/WithProgress-8 20000000 105 ns/op 0 B/op 0 allocs/op
BenchmarkStatusProgress/members=5/WithProgress-example-8 20000000 94.0 ns/op 0 B/op 0 allocs/op
BenchmarkStatusProgress/members=100/Status-8 100000 11903 ns/op 22663 B/op 12 allocs/op
BenchmarkStatusProgress/members=100/Status-example-8 100000 13330 ns/op 22669 B/op 12 allocs/op
BenchmarkStatusProgress/members=100/StatusWithoutProgress-8 50000000 20.9 ns/op 0 B/op 0 allocs/op
BenchmarkStatusProgress/members=100/WithProgress-8 1000000 1731 ns/op 0 B/op 0 allocs/op
BenchmarkStatusProgress/members=100/WithProgress-example-8 1000000 1571 ns/op 0 B/op 0 allocs/op
```
2018-12-06 19:02:48 +01:00
Gyuho Lee
bb60f8ab1d
raft: change import paths to "go.etcd.io/etcd"
...
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-28 17:47:52 -07:00
siddontang
c6f2db2e92
raft: support learner
2017-11-11 10:38:21 +08:00
yuleixiao
44a49ff45a
raft: return leaderTransferee at raft status
2017-05-11 12:45:56 +08:00
Gyu-Ho Lee
fe884f8209
raft: update LICENSE header
2016-05-12 20:49:15 -07:00
Anthony Romano
c5b51946eb
*: exported godoc fixups
2016-02-21 20:36:44 -08: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
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
67194c0b22
raft: introduce progress states
2015-03-18 08:16:32 -07:00
Xiang Li
97579e2e1d
raft: introduce logger interface
2015-03-08 21:36:32 -07:00
Xiang Li
2af33fd494
raft: add reportUnreachable
2015-02-28 10:45:22 -08: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
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