This commit fixes the broker recovery so that it determines the last index
from the various topic logs instead of persisting the snapshot on every
message that comes in.
* Update the infludb broker to not need a server so that it'll work on non-data node servers
* Update messaging broker to keep track of connect urls for replicas
This commit refactors the raft package to more loosely couple the individual parts. The clock is now broken into
an interface that signals individual actions in the log. The transport has been mocked to allow more control over
the log tests. The handler's log has been mocked to separate its testing from the log itself.
Panic on travis:
=== RUN TestBroker_Join
[raft] 2015/01/30 06:46:16 log open: created at
/tmp/influxdb-messaging-119432971/raft, with ID 0, term 0, last applied
index of 0
[raft] 2015/01/30 06:46:16 log state change: stopped => leader
[raft] 2015/01/30 06:46:16 log initialize: promoted to 'leader' with
cluster ID 3337066551442961397, log ID 1, term 1
[raft] 2015/01/30 06:46:16 log open: created at
/tmp/influxdb-messaging-071763182/raft, with ID 0, term 0, last applied
index of 0
[raft] 2015/01/30 06:46:17 log state change: stopped => follower
[raft] 2015/01/30 06:46:17 log join: entered 'follower' state for
cluster at http://127.0.0.1:33257 with log ID 2
[raft] 2015/01/30 06:46:17 log state change: follower => follower
[raft] 2015/01/30 06:46:17 log state change: follower => stopped
panic: write to: add stream writer: write to: replica unavailable
goroutine 410 [running]:
github.com/influxdb/influxdb/messaging_test.func·003()
/home/travis/gopath/src/github.com/influxdb/influxdb/messaging/broker_test.go:260
+0x140
created by
github.com/influxdb/influxdb/messaging_test.(*Broker).MustReadAll
/home/travis/gopath/src/github.com/influxdb/influxdb/messaging/broker_test.go:262
+0x14e