Commit Graph

33 Commits

Author SHA1 Message Date
Sean Chittenden
a8b53b05b4 Prefer %+q over %q in log messages. 2016-06-11 18:17:20 -04:00
Sean Chittenden
5331ea7bc6 goling(1) compliance pass (e.g. Rpc* -> RPC) 2016-06-10 23:38:28 -04:00
Sean Chittenden
5ffd9707b0 Expose rpcproxy's ServerEndpoint() constructor, newServer() as NewServerEndpoint() 2016-06-10 22:14:03 -04:00
Sean Chittenden
4e543b6d43 Restore old behavior and have AddPrimaryServer() return a pointer to the existing server (vs nil when the server already exists). 2016-06-10 16:46:49 -04:00
Sean Chittenden
a0902c3f45 Prevent duplicate servers being added in AddPrimaryServer.
This logic was already present elsewhere and was missed in this one
place.
2016-06-10 15:55:27 -04:00
Sean Chittenden
83e3df0b6a Rename listLock to activatedListLock 2016-06-10 15:54:39 -04:00
Sean Chittenden
ecd84f4be7 Nomad does not use Serf at the client level. Use a hard lock. 2016-06-10 15:54:39 -04:00
Sean Chittenden
dbdebcad80 golint(1) police 2016-06-10 15:54:39 -04:00
Sean Chittenden
f07c910131 Formatting nit: remove brackets 2016-06-10 15:54:39 -04:00
Sean Chittenden
a7047bb28f Prefix all log entries in client/rpcproxy with client.rpcproxy 2016-06-10 15:54:39 -04:00
Sean Chittenden
b57f7c97c2 Style nit: remove var block 2016-06-10 15:54:39 -04:00
Sean Chittenden
8f83c2e825 Move RPCProxy.New() adjacent to its struct definition 2016-06-10 15:54:39 -04:00
Sean Chittenden
d2dcf27b35 Populate the RPC Proxy's server list if heartbeat did not include a leader.
It's possible that a Nomad Client is heartbeating with a Nomad server that
has become issolated from the quorum of Nomad Servers.  When 3x the
heartbeatTTL has been exceeded, append the Consul server list to the primary
primary server list.  When the next RPCProxy rebalance occurs, there is a
chance one of the servers discovered from Consul will be in the majority.
When client reattaches to a Nomad Server in the majority, it will include
a heartbeat and will reset the TTLs *AND* will clear the primary server list
to include only values from the heartbeat.
2016-06-10 15:54:39 -04:00
Sean Chittenden
4e03dc5fbc Remove named return parameters 2016-06-10 15:50:11 -04:00
Sean Chittenden
68f7afcd23 Collapse server_endpoint_internal_test.go into server_endpoint_test.go
Requested by: @dadgar
2016-06-10 15:50:11 -04:00
Sean Chittenden
273e8cf3c9 Collapse rpcproxy_internal_test.go into rpcproxy_test.go
Requested by: @dadgar
2016-06-10 15:50:11 -04:00
Sean Chittenden
1ec537450e Rename rpcproxy.UpdateFromNodeUpdateResponse to RefreshServerLists
While breaking the API within this PR, break out the individual
arguments to RefreshServerLists.  The servers parameter is reusing
`structs.NodeServerInfo` for the time being, but this can be revisited
if the needs of the strucutre diverge in the future.
2016-06-10 15:50:11 -04:00
Sean Chittenden
9de963497b Clean up various comments 2016-06-10 15:50:11 -04:00
Sean Chittenden
f9862d4043 Update godoc for newServer to reflect DNS and IP-based inputs
Requested by: alex
2016-06-10 15:50:11 -04:00
Sean Chittenden
6908846086 Add a quick set of client/rpcproxy.ServerEndpoint equality tests 2016-06-10 15:50:11 -04:00
Sean Chittenden
5b0a969a36 Fix the client/rpcproxy unit tests. 2016-06-10 15:50:11 -04:00
Sean Chittenden
ed30876186 Change the endpoint for /v1/agent/servers and fix tests.
When an agent is running a server, the list of servers includes the
Raft peers.  When the agent is running a client (which is always the
case?), include a list of the servers found in the Client's RpcProxy.
Dedupe and provide a unique list back to the caller.
2016-06-10 15:50:11 -04:00
Sean Chittenden
c8bf53b0a8 Fix a comment to be more correct 2016-06-10 15:50:11 -04:00
Sean Chittenden
ab99e89bd9 Reconcile, clean up, and centralize API version numbers (major and minor).
Reduce future confusion by introducing a minor version that is gossiped out
via the `mvn` Serf tag (Minor Version Number, `vsn` is already being used for
to communicate `Major Version Number`).

Background: hashicorp/consul/issues/1346#issuecomment-151663152
2016-06-10 15:50:11 -04:00
Sean Chittenden
6b8a9b435c Update the nomad_server_service default from nomad-server to just nomad. 2016-06-10 15:50:11 -04:00
Sean Chittenden
6cdc0556de Change the constants used to match the struct definitions 2016-06-10 15:50:11 -04:00
Sean Chittenden
90f7eb42fb When clearing the backup servers, set the length to zero. 2016-06-10 15:50:11 -04:00
Sean Chittenden
9998573298 Clear the backup server list when a Nomad heartbeat arives with servers
If Nomad is heartbeating during a transition from using backup servers
to Nomad servers, make Nomad the canonical source of servers and flush
the list of servers populated from Consul.
2016-06-10 15:50:11 -04:00
Sean Chittenden
7034c50d2f Pass the datacenter name in the heartbeat
Servers that are part of a different datacenter are added as backup
servers instead of primary servers.
2016-06-10 15:50:11 -04:00
Sean Chittenden
916d93c9ab Bump the cluster test minimums to 10min.
These ranges aren't too useful with the default 600s rebalance, but
will be useful if that default ever changes in the future.
2016-06-10 15:50:11 -04:00
Sean Chittenden
1e3feae8f9 Bump shuffle interval per suggestion from Alex 2016-06-10 15:50:11 -04:00
Sean Chittenden
0a5fa55e8f Fix package name in comments 2016-06-10 15:50:11 -04:00
Sean Chittenden
7cdf0edcfe Rename the package from client/rpc_proxy to client/rpcproxy
Also rename `NewRpcProxy()` to just `New()` to avoid package stutter.
2016-06-10 15:50:11 -04:00