Commit Graph

102 Commits (519a30a463f2b1feb0080a19dd680fdc976cb97a)

Author SHA1 Message Date
Philip O'Toole db120f4c0e Log database and retention policy creation 2015-09-08 11:24:59 -07:00
Jason Wilder 380d82b078 Fix race in local node creation
It was possible for the metastore Open call to return before it actually
created it's local node.
2015-09-05 09:07:37 -06:00
Jason Wilder 3404fe3872 Wait for meta-store to find the leader before returning
The meta-store would open but may not have finished loading the raft log. If write
requests came in, they could fail or be dropped because of missing shard group
info.  This change makes the meta store only return after it has found the leader
and is really ready.

This change also fixed a race in the ClusterRestart test that may be causing it
to fail sporadically.

Fixes #3677 #3960
2015-09-04 14:51:57 -06:00
Philip O'Toole cf5a655249 Don't precreate shard groups entirely in past
Fixes issue #3722
2015-09-04 08:31:50 -07:00
Jason Wilder 3d203885f0 Remove extraneous join error logging 2015-08-13 16:58:25 -06:00
Jason Wilder 22550dce54 Fix starting a cluster with self in the join urls
If you started a 3 node cluster and passed the same join URLs to
all three nodes, the first node started would not bootstrap correctly.
2015-08-13 16:20:34 -06:00
Jason Wilder 668181d275 Make log statements more consistent
* Capitalize first letter of message
* Log all services staring consistently
* Remove some extraneous log statements in meta.Store
* Log data dirs for meta, data and hinted handoff
2015-08-13 10:01:42 -06:00
Jason Wilder ffcca1ceff Cap auto-created retention policy replica count at 3
Defaulting to the number of nodes in the cluster is doesn't make
sense with larger clusters. (e.g. 10 nodes = RF 10)
2015-08-12 14:18:02 -06:00
Jason Wilder e0b25c723d Code review fixes 2015-08-05 14:48:30 -06:00
Jason Wilder b5b8754904 Fix comments and whitespace issues 2015-08-05 14:17:26 -06:00
Jason Wilder 13052e60f2 Sync hostname to metastore after startup
If the -hostname flag is passed, the node will startup and be accessible from
remote nodes using the specified hostname.  At startup, we attempt to update
the hostname if it's different.  For data-only nodes, this is pretty straight-forward.
For nodes part of the raft cluster, it is much more complicated as the the cluster
must be up and stable (with a leader) for a the update to take place.  The main
complication in this case is that the node starting up will have a different
hostname and will fail to take part of the raft cluster because each other node
does not have this new name in the it's raft peers list.  Since this is very problematic
and very easy to break a cluster, this PR just aborts startup and alerts the operator that
some manual actions must be taken to update the raft peer on all raft members before
the hostname can be fully updated.

Fixes #3421
2015-08-05 14:17:26 -06:00
Jason Wilder 2b76dac479 Don't resolve hostname when creating node
Hostnames were always being resolved to an IP address and the IP
address was used as the host address and raft peer address.  There
was no way to use an actual hostname instead of an IP address.
2015-08-05 14:17:26 -06:00
Jason Wilder ce26a3097a Add UpdateNode raft command 2015-08-05 14:17:26 -06:00
Jason Wilder 95c98d1ab7 Fix data race in WaitForDataChanged 2015-07-28 09:40:25 -06:00
Jason Wilder 06d8ff7c13 Use config.Peers when passing -join flag
Removes the two separate variables in the meta.Config.  -join will
now override the Peers var.
2015-07-28 09:40:25 -06:00
Jason Wilder c93e46d569 Support add new raft nodes
This change adds the first 3 nodes to the cluster as raft peers. Other
nodes are data-only.
2015-07-28 09:40:25 -06:00
Jason Wilder f5705aebe1 Rename raftState.openRaft to open 2015-07-28 09:40:25 -06:00
Jason Wilder 9dd66fa4ad Make meta RPC private 2015-07-23 10:21:25 -06:00
Jason Wilder 47b8de7ce8 Hide Meta.Join from config command using toml skip annotation 2015-07-23 10:21:25 -06:00
Jason Wilder 29011c5cf2 Code review fixes 2015-07-23 10:21:25 -06:00
Jason Wilder 84a8d7d24b Add cluster-tracing option to meta config
Useful for troubleshooting but too verbose for regular use.
2015-07-23 10:21:24 -06:00
Jason Wilder c1fc83e3d5 Make join private so it does not show up in config command 2015-07-23 10:21:24 -06:00
Jason Wilder 29b11a20a2 Support multiple comma-separated join addresses
Will try each once until one succeeds
2015-07-23 10:21:24 -06:00
Jason Wilder 85db9c46e8 Move remaining raft impl details to local raft state 2015-07-23 10:21:24 -06:00
Jason Wilder 790733daad Move snapshot to raft state 2015-07-23 10:21:24 -06:00
Jason Wilder 54e116507f Move apply to raft state 2015-07-23 10:21:24 -06:00
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