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 |
|