Commit Graph

76 Commits (a9314d6bb76a34ded301fb9672adf0add761b138)

Author SHA1 Message Date
Jason Wilder a9314d6bb7 Move raft index to raft state 2015-07-23 10:21:24 -06:00
Jason Wilder 17a9bb041b Remove raftEnabled func
Not needed since it was just used as a safeguard for seeing if we
are the leader.
2015-07-23 10:21:24 -06:00
Jason Wilder 72e2e1a6f2 Move addPeer to raft state 2015-07-23 10:21:24 -06:00
Jason Wilder 80248f9b53 Remote leaderCh
Not used
2015-07-23 10:21:24 -06:00
Jason Wilder b86fecfd80 Move setPeers to raft state 2015-07-23 10:21:24 -06:00
Jason Wilder 9e4339753f Move leaderCh() to raft state 2015-07-23 10:21:23 -06:00
Jason Wilder 33730da32b Move isLeader to raft state 2015-07-23 10:21:23 -06:00
Jason Wilder fb8a4db74f Move raft closing to localRaft state 2015-07-23 10:21:23 -06:00
Jason Wilder 5ea8342892 Move raft state to separate file
store.go is getting big.
2015-07-23 10:21:23 -06:00
Jason Wilder f3fcfebf83 Make raftState interface private 2015-07-23 10:21:23 -06:00
Jason Wilder a7fa5eb634 Propogate metadata changes from raft nodes to non-raft nodes
Non-raft nodes need to be notifified when the metastore changes. For
example, a database could be dropped on node 1 (non-raft) and node 2
would not know.  Since queries for that database would not be a cache
miss, node 2 would not get updated.

To propogate changes to non-raft nodes, each non-raft node maintains
a blocking connection to a raft node that blocks until a metadata
change occurs.  When the change is triggered, the updated metadata
is returned to the client and the client idempotently updates its local
cache.  It then reconnects and waits for another change.  This is
similar watches in zookeeper or etcd.  Since the blocking request is
always recreated, it also serves as a polling mechanism that will retry
another raft member if the current connection is lost.
2015-07-23 10:21:23 -06:00
Jason Wilder 5486d3e216 Move invalidate to raft state
The behavior is different depending on the state.  Local raft just
waits a second (?) and remote raft fetches the meta data from the leader.
2015-07-23 10:21:23 -06:00
Jason Wilder 43f0407178 Ensure a node can join an existing single node raft cluster 2015-07-23 10:21:23 -06:00
Jason Wilder 9db3a779e9 Assign and store a node ID when joining an existing cluster 2015-07-23 10:21:23 -06:00
Jason Wilder 3f90891b82 Proxy raft and rpc connections to leader transparently
Nodes that are not part of the raft cluster will not reliably know who the
current raft cluster leader is.  To make communication simpler, proxy all
rpc and raft calls to the current raft leader if a non-leader receives one.
2015-07-23 10:21:23 -06:00
Jason Wilder e06f6f421b Add ability to join an existing cluster
This adds some basic ability to join a node to an existing cluster. It
uses a rpc layer to initiate a join request to an existing memeber. The
response indicates whether the joining node should take part in the raft
cluster and who it's peers should be.  If raft should not be started, the
peers are the addresses of the current raft members that it should delegate
consensus operations.

To keep the meta store implementation agnostic of whether it's running
a local raft or not, a consensusStrategy type was also added.
2015-07-23 10:21:22 -06:00
Jason Wilder abfd438a11 Implement remote meta data fetch
This adds some basic plumbing to make remote procedure calls to other cluster
members.  This first implementation allows a node to contact the raft leader
and fetch a copy of the meta data. This will be used by non-raft members to
pull down the latest metadata.
2015-07-23 10:21:22 -06:00
Philip O'Toole 641b38f394 Merge pull request #3256 from cannium/remove-unnecessary-timeout
Remove unnecessary timeout in WaitForLeader()
2015-07-19 12:01:22 -07:00
Philip O'Toole f549910a18 Merge pull request #3279 from LK4D4/fix_style_else
Fix style issues with else
2015-07-17 11:53:42 -07:00
gunnaraasen 9ba37325f6 Fixes authorization.
Adds GRANT and REVOKE statements for admin privilege. Adds authorization to the query endpoint.
2015-07-17 11:33:06 -07:00
Alexander Morozov 675eacbf2c Fix style issues with else
In go it's better to just continue flow without "else", if it is return in
"if" statement.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-07-17 11:10:23 -07:00
Philip O'Toole 74cb96646c Refactor query engine for distributed query support
With this change, the query engine code gathers information about
shards and tagsets by working with individual shards, collating the
information, and returning that to the client. It does not assume that any
particular shard is local, and accesses all shards through abstracted
Mappers, of which there are two types -- a Mapper type for Raw queries
and a second type for Aggregate queries. There are corresponding
Executors for each type of Mapper, but both types of Executors share the
same interface.
2015-07-15 12:54:55 -07:00
Can ZHANG c41ef86c3c Remove unnecessary timeout in WaitForLeader()
If the timer expires and a leader is still not selected, the local data node will never be created.
2015-07-09 15:00:24 +08:00
Philip O'Toole bc15a6ea27 Set log prefix for Metastore
Log messages from this package do not look the same as all other log
messages.
2015-07-06 12:24:00 -04:00
Jason Wilder 30b15d3c55 Use salted hashes for in memory password cache 2015-06-30 16:55:30 -06:00
Jason Wilder 153d18f38c Add synchronization around authcache accesses 2015-06-30 18:29:36 -04:00
David Norton ba6bddc5f8 fix #3102: fix race in test 2015-06-30 18:29:36 -04:00
David Norton 3463d906e9 fix #3102: add unit test for authentication 2015-06-30 18:29:36 -04:00
David Norton debc3cc11c fix #3102: add authentication cache 2015-06-30 18:29:11 -04:00
Philip O'Toole 64ace983e8 Support return of shard groups for timerange 2015-06-26 17:28:52 -04:00
David Norton 4c194f2c8d fix #3014: make code review changes 2015-06-25 22:26:53 -04:00
David Norton 3c7a82d91c fix #3014: implement snapshots 2015-06-25 19:54:00 -04:00
Vladimir Lopes 02b8c6fbf1 Don't use deleted shard groups on pre-creation
The way it was, shard groups that were deleted by retention policy
enforcement were being recreated again, just to be deleted in the
next enforcement run. This change will help keep raft log free from
this unnecessary creation and deletion.
2015-06-18 15:20:23 -03:00
Philip O'Toole 01720aa246 Fix excessive shard group creation logging
Fixes issue #3029.
2015-06-17 14:45:47 -07:00
Philip O'Toole 4b332b7348 Enforce minimum retention duration of 1 hour
Fixes issue #2991.
2015-06-17 11:02:07 -07:00
Dejan Golja f133ceb350 Added support for SHOW GRANTS FOR USER syntax 2015-06-17 01:00:26 +10:00
Ben Johnson a966482a8e Ensure default retention policies are fully replicated
This commit sets the replication factor to the number of nodes
currently in the cluster.
2015-06-11 14:43:44 -06:00
Philip O'Toole eaae2a1afb Don't bother polling if leader already exists 2015-06-11 11:34:52 -07:00
Philip O'Toole 4dff5f48aa Export WaitForLeader on MetaStore
This exported function can then be used by Services and
server-reporting, so those components don't make progress until the
cluster is ready.
2015-06-11 11:10:07 -07:00
Philip O'Toole 431034c8f4 Wait for Raft leader even when cluster exists 2015-06-11 01:23:30 -07:00
Philip O'Toole b15a0df6d4 Wait for leader before reporting 2015-06-11 00:21:15 -07:00
Ben Johnson 405ec78f42 Limit cluster to 3 nodes
This commit restricts the maximum number of nodes in a cluster to 3.

Fixes #2750
2015-06-11 00:11:47 -06:00
Ben Johnson 586da7f558 Generate cluster id on first node
This commit sets a cluster ID when the first node is initialized.
The ID is generated on every CreateNodeCommand so that it can be
applied consistently in the state machine of every server.
2015-06-10 22:33:58 -06:00
Ben Johnson bc31783a00 Refactor backup and restore
This commit updates the snapshot code as well as the "backup" and
"restore" command to work with the new architecture.
2015-06-10 22:07:01 -06:00
Philip O'Toole 5798d99692 Move shard precreation logic to meta/store 2015-06-10 15:37:00 -07:00
Philip O'Toole 21343e4e0f Don't panic when altering retention policy
Fixes issue #2846
2015-06-09 11:39:09 -07:00
Philip O'Toole 4b94a00644 Set auto-created retetion period to infinity
Fix issue #2817
2015-06-08 19:47:37 -07:00
Philip O'Toole cc03030b5e Add missing call to WaitGroup.Done()
Fix issue #2806
2015-06-08 11:10:02 -07:00
Philip O'Toole 38f38a5bd4 Improve AutoCreate camelcase 2015-06-06 17:03:52 -07:00
Philip O'Toole 5fcae1eb04 Improve Go style of retention auto-create 2015-06-06 17:02:32 -07:00