Commit Graph

4120 Commits (d29af2ddc79712547d13d9a11261104efb94b89e)

Author SHA1 Message Date
Sean Chittenden 2ca4cc58ce Move consul.serverConfig out of the consul package
Relocated to its own package, server_manager.  This now greatly simplifies the RPC() call path and appropriately hides the locking behind the package boundary.  More work is needed to be done here
2016-03-23 16:16:22 -07:00
Sean Chittenden 0925b26250 Refactor consul.serverParts into server_details.ServerDetails
This may be short-lived, but it also seems like this is going to lead us down a path where ServerDetails is going to evolve into a more powerful package that will encapsulate more behavior behind a coherent API.
2016-03-23 16:15:47 -07:00
Sean Chittenden 5be956c310 Rename serverConfigMtx to serverConfigLock
Pointed out by: @slackpad
2016-03-23 16:15:47 -07:00
Sean Chittenden b1e392405c Handle the case where there are no healthy servers
Pointed out by: @slackpad
2016-03-23 16:15:47 -07:00
Sean Chittenden d4ca349e21 Refactor out the management of Consul servers
Move the management of c.consulServers (fka c.consuls) into consul/server_manager.go.

This commit brings in a background task that proactively manages the server list and:

*) reshuffles the list
*) manages the timer out of the RPC() path
*) uses atomics to detect a server has failed

This is a WIP, more work in testing needs to be completed.
2016-03-23 16:15:47 -07:00
Sean Chittenden 7b308d8d7e Add a flag to denote that a server is disabled
A server is not normally disabled, but in the event of an RPC error, we want to mark a server as down to allow for fast failover to a different server.  This value must be an int in order to support atomic operations.

Additionally, this is the preliminary work required to bring up a server in a disabled state.  RPC health checks in the future could mark the server as alive, thereby creating an organic "slow start" feature for Consul.
2016-03-23 16:14:59 -07:00
Sean Chittenden 6af781d9d5 Rename `lastServer` to `preferredServer`
Expanding the domain of lastServer beyond RPC() changes the meaning of this variable.  Rename accordingly to match the intent coming in a subsequent commit: a background thread will be in charge of rotating preferredServer.
2016-03-23 16:14:59 -07:00
Sean Chittenden fb0bfcc3cf Introduce GOTEST_FLAGS to conditionally add -v to go test
Trivial change that makes it possible for developers to set an environment variable and change the output of `go test` to be detailed (i.e. `GOTEST_FLAGS=-v`).
2016-03-23 16:14:11 -07:00
Sean Chittenden f6ffbf4e96 Warn if serf events have queued up past 80% of the limit
It is theoretically possible that the number of queued serf events can back up.  If this happens, emit a warning message if there are more than 200 events in queue.

Most notably, this can happen if `c.consulServerLock` is held for an "extended period of time".  The probability of anyone ever seeing this log message is hopefully low to nonexistent, but if it happens, the warning message indicating a large number of serf events fired while a lock was held is likely to be helpful (vs serf mysteriously blocking when attempting to add an event to a channel).
2016-03-23 16:14:11 -07:00
Sean Chittenden 54016f5276 Commit miss re: consuls variable rename 2016-03-23 16:13:49 -07:00
Sean Chittenden f9aa968bf4 Remove lastRPCTime
This mechanism isn't going to provide much value in the future.  Preemptively reduce the complexity of future work.
2016-03-23 16:13:49 -07:00
Sean Chittenden cc86eb0a1a Rename c.consuls to c.consulServers
Prep for breaking out maintenance of consuls into a new goroutine.
2016-03-23 16:10:27 -07:00
Sean Chittenden a92cda7bcd Fix whitespace alignment in a comment 2016-03-23 16:00:39 -07:00
Sean Chittenden 146c5b0a59 Use `rand.Int31n()` to get power of two optimization
In cases where i+1 is a power of two, skip one modulo operation.
2016-03-23 16:00:39 -07:00
James Phillips 77ad084229 Fixes JSON in wildcard query example. 2016-03-23 14:33:20 -07:00
James Phillips d3da5efdb2 Merge pull request #1865 from hashicorp/f-upgrade-boltdb
Updates BoltDB to v1.2.0 release.
2016-03-22 08:53:04 -07:00
James Phillips 351778eabb Updates BoltDB to v1.2.0 release. 2016-03-22 08:36:46 -07:00
Miquel Sabaté Solà b2e8ec97b8 contrib: added bash completion
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
2016-03-22 12:46:27 +01:00
James Phillips 77eb95ddd8 Merge pull request #1861 from hashicorp/b-flaky-test
Widens coordinate update sleeps in unit tests.
2016-03-21 18:24:05 -07:00
James Phillips cd7b3d4b49 Widens coordinate update sleeps in unit tests. 2016-03-21 18:23:11 -07:00
James Phillips 520d3eb375 Merge pull request #1854 from talonx/master
Added help text for -dev option #1804
2016-03-21 18:03:34 -07:00
James Phillips 90df1182ec Merge pull request #1860 from hashicorp/b-flaky-sort
Gets rid of flaky sort check.
2016-03-21 17:31:17 -07:00
James Phillips 8a9ad3811b Gets rid of flaky sort check.
If we get a coordinate then this test will fail, so we only check the
first item in the list, which is deterministic.
2016-03-21 17:30:05 -07:00
James Phillips 8211c34924 Merge pull request #1859 from hashicorp/b-flaky-coord-tests
Increases timeouts for coordinate tests.
2016-03-21 17:10:01 -07:00
James Phillips fffa8d5061 Increases timeouts for coordinate tests.
We take the interval and add the random stagger to it, so 2X is cutting it
too close and the unit tests are often flaky.
2016-03-21 16:44:35 -07:00
James Phillips e60a095207 Merge pull request #1839 from foxel/patch-1
Clarification for advertise_addrs.rpc
2016-03-21 16:14:17 -07:00
Sean Chittenden f33b2722d8 Update the docs slightly re: only_passing
Signed-off by: @slackpad
2016-03-21 16:07:56 -07:00
Hrishikesh Barua 9f9aa5084b Added help text for -dev option #1804 2016-03-21 17:27:57 +05:30
James Phillips ea62d29756 Merge pull request #1852 from Sayalic0/patch-1
add inline code segment to enableTagOverride
2016-03-19 23:16:43 -07:00
Sayalic bb9ddee4a0 add inline code segment to enableTagOverride 2016-03-20 11:09:12 +08:00
James Phillips b6cd4318d6 Merge pull request #1851 from hashicorp/f-ipv6-bind
Allow [::] as a bind address (binds to first public IPv6 address)
2016-03-19 16:16:19 -07:00
James Phillips 99eb629c8f Adds more specific checks for ipv6 addresses. 2016-03-19 16:14:45 -07:00
James Phillips 7510f00100 Merge pull request #1846 from TeaBough/master
Define a TestingT interface in server.go
2016-03-19 08:56:46 -07:00
James Phillips 043c031ad1 Merge pull request #1702 from far-blue/ui-configurable-api-url
Configurable consul host address
2016-03-18 21:05:00 -07:00
James Phillips f2740b447d Merge pull request #1848 from mssola/unconvert
Used 'unconvert' to remove unneeded conversions
2016-03-18 17:24:36 -07:00
James Phillips 4a35b71289 Merge pull request #1849 from hashicorp/f-leader-stats
Add leader address to consul stats
2016-03-18 17:22:30 -07:00
James Phillips 3c883951d7 Removes leader from members and changes name since it's an address. 2016-03-18 17:07:11 -07:00
Sergey Romanov 93c8b496e5 #735 add information about leader to consul members 2016-03-18 17:05:40 -07:00
Wim b5d45322b4 Allow [::] as a bind address (binds to first public IPv6 address) 2016-03-18 23:59:44 +01:00
Miquel Sabaté Solà 615c93a77d Used 'unconvert' to remove unneeded conversions
I've removed unneeded conversions by performing the following commands:

    $ go get -u github.com/mdempsky/unconvert
    $ go list ./... | grep -v vendor | xargs unconvert -apply

Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
2016-03-18 16:12:56 +01:00
Miquel Sabaté Solà 4567963d8e command: deprecated the -dc flag in the agent CLI
The `-dc` flag from the agent CLI command has been deprecated in favor of
`-datacenter`. This is done this way because:

- Other CLI commands used `-datacenter`. See: event, exec and watch.
- The agent configuration file uses `datacenter`.

Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
2016-03-18 15:44:35 +01:00
Thibault Vigouroux 44bce6797f Define a TestingT interface in server.go 2016-03-18 12:27:59 +01:00
James Phillips 6b2ace6f6b Fixes a few bugs in the prepared query doc. 2016-03-17 23:42:27 -07:00
James Phillips 0e41fa5340 Merge pull request #1844 from hashicorp/b-go-linker-flag
Go's -X linker flag now requires only one argument
2016-03-17 11:06:27 -07:00
Sean Chittenden 96c6b4f331 Go's -X linker flag now requires only one argument 2016-03-17 10:51:50 -07:00
James Phillips 6711662676 Adds a note about template query ACLs. 2016-03-17 08:21:58 -07:00
James Phillips 69d3f0b28f Puts tree into ready state for 0.7.0 work (again). 2016-03-16 10:50:49 -07:00
James Phillips 580cfc3831 Updates website to version 0.6.4. 2016-03-16 10:36:57 -07:00
James Phillips 26a0ef8c41
Release v0.6.4 2016-03-16 09:42:48 -07:00
James Phillips 1be3554ab9 Preps for 0.6.4 release. 2016-03-16 09:42:07 -07:00