Commit Graph

86 Commits (7ace10f7e6a4b362502eabc3588ece157f00d770)

Author SHA1 Message Date
Jason Wilder a682188c81 Re-add raft/messaging
Deleting them broke the build.
2015-05-18 12:48:10 -06:00
Ben Johnson 00ce4a504e Wait for quorum write before returning from Log.Apply().
This commit ensures a commit is written to a quorum before returning
from Log.Apply().
2015-05-13 16:05:26 -06:00
Ben Johnson 16c8449ca1 Add additional logging for RequestVote. 2015-05-11 15:41:05 -06:00
Philip O'Toole b8b396807e Set leader ID on log open if only 1 node
Without this change a restart of a single-node cluster would result in
no Raft leader.
2015-05-11 11:23:43 -07:00
Cory LaNou 3205d8e182 removing unused code 2015-05-04 09:53:03 -06:00
Philip O'Toole c539072519 Return whether a snap should occur as bool
This avoids a race condition when accessing snapshotIndex.
2015-04-30 15:14:25 -07:00
Ben Johnson 80a6f2eccd Do not require snapshot on Log.WriteEntriesTo().
This commit fixes a bug where snapshots were always sent when connecting
to the leader -- even when not required.
2015-04-29 14:41:11 -06:00
Philip O'Toole 5894f6580c Merge pull request #2415 from xiaost/fix-leaderid-error
raft: fix leaderID error when state changed
2015-04-24 15:50:33 -07:00
Jason Wilder da5935e885 Fix node getting stuck in candidate state
During an election, a node can sometimes get stuck in candidate state
causing it to never read from the new leader.  This would prevent
it from incrementing it's index and staying consisistent w/ the
leader.
2015-04-24 16:00:54 -06:00
Jason Wilder a9bdfb3b86 Log node state and id in raft traces
When running multiple nodes locally w/ raft tracing, it's very difficult
to determine which node is logging.  This adds the nodes state(leader,follower,candiate) and
id to all the log messages so we can tarce the nodes states more easily.
2015-04-24 13:25:27 -06:00
Jason Wilder a4017fa4fd Replace heartbeat log threshold time w/ constant 2015-04-24 10:33:34 -06:00
Jason Wilder 49b80a6d19 Track and log the number of times a heartbeat has failed 2015-04-24 09:44:44 -06:00
Jason Wilder 2e47a8de11 Log when heartbeat succeeds again 2015-04-24 09:32:15 -06:00
Jason Wilder 174afb5eb9 Log heartbeat error once every 15s
Prevents logs from getting flooded with a message every second when
a broker node is down.

Fixes #1896
2015-04-24 08:43:42 -06:00
xiaost e521ac9b73 raft: fix leaderID error when state changed 2015-04-24 22:23:45 +08:00
Ben Johnson b54f81fcac Fix stream writer flushing to be thread safe.
This change fixes the raft streams so that Flush() is not called
asynchronously while the snapshot is being written.
2015-04-15 12:07:03 -06:00
Ben Johnson 6e124f3ab6 Start cluster before broker.
This commit fixes an issue where the second node joins but the first node
cannot commit because it doesn't have the HTTP endpoint running yet. This
is a side effect of streaming raft since we don't synchronize the quorum
set with the heartbeats. We should cache the config per term in the future.
2015-04-15 11:18:44 -06:00
Ben Johnson 4c4c03852c Merge branch 'master' of https://github.com/influxdb/influxdb into raft 2015-04-13 13:54:06 -06:00
Ben Johnson df605fce74 Add log entry cache to raft log. 2015-04-12 16:34:37 -06:00
Ben Johnson 44b4992b75 Add handling for snapshotting pseudo-state. 2015-04-12 14:24:30 -06:00
Ben Johnson 908fe7db4a Wrap raft.Log mutex. 2015-04-12 12:57:34 -06:00
Ben Johnson eaf4bfca0a Fix term signal.
This commit changes raft so that term changes are made immediately and
term change signals are made afterward. Previously, election timeouts
were invalidated by incoming term changes which caused an election loop.

Stale term was also fixed and http/pprof was added too.
2015-04-10 13:52:20 -06:00
Ben Johnson c757039f70 Update term change immediately, only send signal. 2015-04-09 17:07:12 -06:00
Ben Johnson 3f0adcf105 Always notify term change on RequestVote.
Previously there was a bug that ignored new terms from incoming vote
requests when the sender's log was out of date.
2015-04-09 13:33:04 -06:00
Philip O'Toole 566f6558b4 Persist term to disk when it changes 2015-04-09 11:12:09 -07:00
Ben Johnson 7815d47bc3 Merge pull request #2217 from influxdb/cluster-fix
Cluster fix
2015-04-09 11:52:52 -06:00
Ben Johnson 37829ea4c3 Only update term if higher in candidate loop.
This fixes a bug where votes were overwritten because terms were
being reset by incoming terms that were the same.
2015-04-09 10:55:39 -06:00
Ben Johnson bcfc259fe8 Wait for first applied index on Log.Join().
Previously the join method returned immediately after connecting.
Now the join method will wait until the snapshot and/or log entry
is replicated as well before returning.
2015-04-08 13:34:21 -06:00
Ben Johnson 3d71d45cf6 Return term from vote, add term logging. 2015-04-04 10:59:50 -06:00
Ben Johnson bc444821b9 Add raft term logging. 2015-04-01 15:42:16 -06:00
Ben Johnson 947c776dc8 Fix comments. 2015-03-30 08:13:13 -06:00
Ben Johnson 189aaa0d82 Remove debug statements. 2015-03-29 15:36:55 -06:00
Ben Johnson 27f4a3efec Fix raft transition and reader edge cases. 2015-03-29 15:04:11 -06:00
Ben Johnson 3d03602fa7 Raft documentation, read from index fix. 2015-03-29 09:08:44 -06:00
Ben Johnson 057309fc8e Simplify raft snapshotting, entry apply. 2015-03-26 20:32:39 -06:00
Philip O'Toole c461c7e7b4 Remove logging to specific file 2015-03-25 17:41:39 -07:00
Ben Johnson 11c808f55f Add restore and bootstrap.
This commit adds the "influxd restore" command to the CLI. This allows
a snapshot that has been produced by "influxd backup" to be restored
to a config location and the broker and raft directories will be
bootstrapped based on the state of the snapshot.
2015-03-22 15:31:49 -06:00
Ben Johnson 75450466a6 Fix leader id initialization. 2015-03-16 11:27:57 -06:00
Ben Johnson 96748cb217 Update file permissions. 2015-03-14 13:49:25 -06:00
Ben Johnson 53dbec8232 Add config notifications and increased test coverage. 2015-03-14 13:36:06 -06:00
Ben Johnson 5f6bcf523f Fix broker integration bugs. 2015-03-11 12:00:45 -06:00
Ben Johnson 66115f95ca Merge branch 'master' of https://github.com/influxdb/influxdb into stateless-broker
Conflicts:
	cmd/influxd/run.go
	messaging/broker.go
	messaging/client.go
	messaging/client_test.go
	messaging/intg_test.go
	server.go
	tx_test.go
2015-03-10 16:27:37 -06:00
Ben Johnson 27e9132796 Integrate stateless broker into remaining packages. 2015-03-10 14:53:45 -06:00
Joseph Rothrock 9b63eed767 Merge branch 'master' of github.com:influxdb/influxdb into 1753
Conflicts:
	CHANGELOG.md
2015-03-06 12:37:15 -08:00
Joseph Rothrock 771ef1cec3 Don't Panic on Missing Dirs
Issue: 1753
Figure out what's missing, create it, and keep going.
2015-03-06 12:11:02 -08:00
dgnorton 3454523bae Merge pull request #1864 from influxdb/fix-1180
fix #1180: race in startStateLoop
2015-03-06 13:21:05 -05:00
Ben Johnson cae0e85ed7 Update higher term on leader during stream request.
This commit adds a check for newer terms in the streaming endpoint.
2015-03-06 11:12:54 -07:00
David Norton cb780d82d5 fix #1180: race in startStateLoop 2015-03-06 13:09:46 -05:00
Todd Persen 11fce7cb33 Seed the random Int63 generator. 2015-02-23 23:19:56 -08:00
Ben Johnson 9dd299fe80 Add small delay for single node heartbeat.
This commit adds a small 10ms delay to the heartbeat when there is only
one node in the cluster. This code needs a larger fix to avoid heartbeats
with a single node cluster but this should work well in the short term.
2015-02-23 16:18:19 -07:00