Commit Graph

775 Commits (c8d08a8898591d0ee0a316ee9514dd5b8cbfc0b8)

Author SHA1 Message Date
Anthony Romano da3e3b7240 clientv3: document from "don't halt lease client if there is a lease error"
From https://github.com/coreos/etcd/pull/7866.
2017-12-18 09:55:00 -08:00
Sam Batschelet a5d9bff24c clientv3/lease.go: TTL, document expired Lease. 2017-12-18 08:34:19 -05:00
Manjunath A Kumatagi 18746c65da Clientv3: Fix govet error for gotip 2017-12-15 14:31:27 +05:30
Gyu-Ho Lee 805bcc828c clientv3: simplify V(4) logger with Lvl(4)
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-12-05 18:48:36 -08:00
Gyu-Ho Lee 5d2461e139 clientv3: add Lvl method to logger
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-12-05 18:48:36 -08:00
Gyuho Lee 3a941c9455 clientv3/config.go: remove extra whitespace character
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-05 14:51:36 -08:00
Gyuho Lee 6458e22708 clientv3: fix indentation in doc.go
Looks off in https://godoc.org/github.com/coreos/etcd/clientv3.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-04 17:05:31 -08:00
Gyu-Ho Lee 6b6013fad5 clientv3/doc: update dial-timeout error handling with new gRPC
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-12-04 13:45:42 -08:00
Rene Zbinden e18afc462b clientv3: Fix comment for DialKeepAliveTime and DialKeepAliveTimeout 2017-12-04 14:22:34 +01:00
Gyuho Lee 56a012f2ab
Merge pull request #8841 from gyuho/test-test
clientv3/integration: add more tests on balancer switch, inflight range
2017-11-30 09:38:53 -08:00
Gyu-Ho Lee 92167e8773 clientv3: update error handling godoc
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-29 10:53:54 -08:00
Gyu-Ho Lee a7cb307a18 clientv3/integration: add more tests on balancer switch, inflight range
Test all possible cases of server shutdown with inflight range requests.
Removed redundant tests in kv_test.go.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-27 15:05:12 -08:00
Gyu-Ho Lee bd76ac85db clientv3/integration: move isServerCtxTimeout to server_shutdown_test.go
Tests with cluster_proxy tags were failing, since isServerCtxTimeout
was defined with "+build !cluster_proxy".

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-27 15:02:48 -08:00
Gyu-Ho Lee a9105b5a8d clientv3: document context timeout error with server-side clock skew
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-27 14:06:42 -08:00
Gyu-Ho Lee 0d0e8e78f7 clientv3/integration: handle server-side context timeouts from clock-drift
Due to clock drifts in server-side, client context times out
first in server-side, while original client-side context is
not timed out yet.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-27 14:02:09 -08:00
Gyu-Ho Lee 5a154e8e2b *: disable gRPC client logs in tests
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-11 20:56:00 -08:00
Gyu-Ho Lee 977f33a5a6 clientv3: grpclog.SetLoggerV2 on clientv3.SetLogger
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-11 20:51:45 -08:00
Gyu-Ho Lee 75110dd839 *: fix naked returns
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-10 18:46:15 -08:00
Gyu-Ho Lee c669ff9765 clientv3: retry mutable ops on "no connection available"
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-10 15:40:06 -08:00
Gyu-Ho Lee 123b869a0f clientv3/integration: match grpc.ErrClientConnClosing in TestKVNewAfterClose
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-10 15:39:35 -08:00
Gyu-Ho Lee 103efd922b clientv3/balancer: only notify healthy addresses
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-10 15:39:25 -08:00
Gyu-Ho Lee 012b013538 clientv3: combine "healthBalancer" and "simpleBalancer"
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-10 15:38:05 -08:00
Gyu-Ho Lee 52f4bc9061 clientv3/integration: remove TestKVGetOneEndpointDown
Already tested in other server shutdown tests.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-10 14:46:40 -08:00
Gyu-Ho Lee dfe0f8c2bc
Merge pull request #8839 from gyuho/test-balancer
clientv3/integration: test linearizable get with leader election, network partition
2017-11-10 13:55:11 -08:00
Gyu-Ho Lee 00b15e38df words: whitelist prometheus
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-10 10:08:48 -08:00
tylerauerbeck 973857107e clientv3: update metrics to use promhttp
Update clientv3/example_metrics_test.go and clientv3/integration/metrics_test.go to use promhttp.Handler() instead of prometheus.Handler()

fixes #8729
2017-11-10 09:47:49 -08:00
Gyu-Ho Lee 706cf20339 clientv3/integration: test linearizable get with leader election, network partition
Test case that failed my balancer refactor https://github.com/coreos/etcd/pull/8834.
Current, kv network partition tests do not specifically test
isolated leader case.

This PR moves TestKVSwitchUnavailable to network_partition_test.go
and make it always isolate leader.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-07 19:51:24 -08:00
Gyu-Ho Lee f49f5c9094 *: disable grpc client log in tests by default
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-07 15:05:13 -08:00
Gyu-Ho Lee 5d98710b2e api/v3rpc: deprecate grpc.Errorf
It's been deprecated as of grpc/grpc-go v1.6.x.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-04 22:08:17 -07:00
Gyu-Ho Lee 0ca8f420d4 clientv3/integration: match more errors in put retries
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-31 13:31:38 -07:00
Gyu-Ho Lee 2c13231e7b clientv3/integration: increase balancer switch timeout for TestKVGetResetLoneEndpoint
Since 3-second is the minimum time to keep an endpoint in unhealthy,
it is possible that endpoint switch happens right after context timeout.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-31 10:48:15 -07:00
Gyu-Ho Lee 8d23e1c870 clientv3/integration: add blackhole tests for range RPCs
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-30 19:18:53 -07:00
Gyu-Ho Lee a37dd0055f clientv3/integration: move to TestBalancerUnderBlackholeKeepAliveWatch
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-30 17:19:48 -07:00
Gyu-Ho Lee 8d5c284b6c clientv3/integration: add blackhole tests on mutable operations
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-30 13:32:59 -07:00
Gyu-Ho Lee bea930f44d clientv3/integration: finish isolated node test cases
1. one with retry
2. one without retry (range request with longer timeouts)

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-30 11:17:43 -07:00
Gyu-Ho Lee ca1e6a74e0
Merge pull request #8782 from gyuho/rename
clientv3/integration: rename to 'mustWaitPinReady'
2017-10-27 15:07:31 -07:00
Gyu-Ho Lee 5d169b866f clientv3/integration: rename to 'mustWaitPinReady'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-27 15:00:31 -07:00
Gyu-Ho Lee 03ce2fa037 clientv3/integration: remove client keepalive in network partition tests
Those tests are about balancer endpoint switch, not about keepalive pings.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-27 14:47:37 -07:00
Xiang Li 2cea13ba68
Merge pull request #8779 from gyuho/shutdown-test
clientv3/integration: add TestBalancerUnderServerShutdownImmutable
2017-10-27 12:23:22 -07:00
Gyu-Ho Lee 732c40531b
Merge pull request #8762 from gyuho/partition-test
clientv3/integration: add TestBalancerUnderNetworkPartitionWatch
2017-10-27 12:22:32 -07:00
Gyu-Ho Lee 62821158aa
Merge pull request #8767 from xiang90/f
clientv3/integration: fix a todo in testNetworkPartitionBalancer
2017-10-27 11:26:40 -07:00
Gyu-Ho Lee 9d95cfb105 clientv3/integration: add TestBalancerUnderServerShutdownImmutable
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-27 10:55:12 -07:00
Gyu-Ho Lee e980bde82d clientv3/integration: add TestBalancerUnderNetworkPartitionWatch
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-26 18:17:00 -07:00
Gyu-Ho Lee 0bfc6a0d92 clientv3/integration: add TestBalancerUnderServerShutdownMutable*
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-26 16:42:33 -07:00
Gyu-Ho Lee 6a8d6b6ad9 clientv3/integration: use waitPinReady in blackhole test
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-26 15:12:27 -07:00
Gyu-Ho Lee af53f54042 clientv3/integration: add waitPinReady
RPC should be sent to trigger 'readyWait' on new pin address.
Otherwise, endpoints other than ep[0] may be pinned.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-26 15:11:10 -07:00
Xiang 10c971db70 clientv3/integration: add put blackhole test 2017-10-26 14:09:51 -07:00
Xiang 7d7e9b6e43 clientv3/integration: fix a todo in testNetworkPartitionBalancer 2017-10-25 22:54:44 -07:00
Gyu-Ho Lee 8fa35216b0 clientv3/integration: Get with context timeout
Address https://github.com/coreos/etcd/pull/8762#discussion_r147019068.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-25 17:43:29 -07:00
Xiang Li 995d79a0fc Merge pull request #8758 from gyuho/failure-test
clientv3/integration: add TestBalancerUnderServerShutdownWatch
2017-10-25 17:03:33 -07:00
Gyu-Ho Lee cea7387b73 clientv3/integration: add TestBalancerUnderServerShutdownWatch
Current Watch integration tests haven't covered the balancer
switch behavior under server failures.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-25 16:13:46 -07:00
Gyu-Ho Lee c50cfbeaf6 Merge pull request #8759 from gyuho/mmm
integration: use variadic parameters for *Partition
2017-10-25 15:31:33 -07:00
Gyu-Ho Lee 6f8c476599 clientv3/integration: rename partition tests
To be consistent with TestBalancerUnderShutdown*

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-25 14:57:16 -07:00
Gyu-Ho Lee b6f770fc24 integration: use variadic parameters for *Partition
'member' type is not exported.
In network partition tests, we want do

InjectPartition(t, clus.Members[lead], clus.Members[lead+1])

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-25 14:55:03 -07:00
Gyu-Ho Lee ff2ed93b5c clientv3/integration: do not create v3 clients when not used
Add 'SkipCreatingClients' field to skip creating clients if not used.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-24 16:59:41 -07:00
Xiang 8d1f9c654a clientv3/integration: fix keepalive by waiting for unhealthy 2017-10-24 00:56:09 -07:00
Xiang 109f52e3d6 clientv3: fix balancer unresponsiveness
When no address is pined, and balancer ignores the addr Up due to
its current unhealthy state, balancer will be unresponsive forever.

This PR fixes it by doing a full reset when there is no pined addr,
thus re-trigger the Up call.
2017-10-23 21:19:21 -07:00
Gyu-Ho Lee 2a49b04f09 clientv3/integration: fix typos
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-23 20:13:53 -07:00
Xiang Li b699c7cff7 Merge pull request #8737 from xiang90/fix_TestWatchKeepAlive
clientv3/integration: shorten keepalive timeout
2017-10-22 21:21:22 -07:00
Xiang Li 97f0b28bdb Merge pull request #8738 from gyuho/ccc
clientv3: fix balancer notify, stale endpoint handling, retry
2017-10-22 21:20:44 -07:00
Xiang f65575073a clientv3/integration: match ErrTimeout in testNetworkPartitionBalancer
For put, etcd can return timeout errors from network partitions.
2017-10-22 18:44:35 -07:00
Xiang 5943229921 clientv3: wait for current pin endpoint down on notify 2017-10-22 18:02:58 -07:00
Xiang 3899f9e3c5 clientv3/integration: shorten keepalive timeout 2017-10-22 18:02:15 -07:00
Xiang 59af91fc69 clientv3: use hostPortError in down function
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-22 18:01:31 -07:00
Xiang 63ab5addfa clientv3: do not mark stale endpoints as unhealthy 2017-10-22 17:59:26 -07:00
Gyu-Ho Lee 725df70664 clientv3: only stop if EtcdError code is not Unavailable, retry with more error codes
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-22 17:54:14 -07:00
Xiang Li 5eef654c3c Merge pull request #8734 from xiang90/testing_log
clientv3: disable server logging for client testing
2017-10-22 16:50:21 -07:00
Xiang 6f0771d2f6 clientv3: disable server logging for client testing 2017-10-22 16:32:42 -07:00
Xiang 06e591d526 clientv3/integration: skip retry test on txn read 2017-10-22 16:14:39 -07:00
Gyu-Ho Lee 439c97d465 clientv3: remove balancer interface
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-20 16:31:02 -07:00
Gyu-Ho Lee 54ef60d033 clientv3: remove redundant retries in Auth, set FailFast=true
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 16:03:12 -07:00
Gyu-Ho Lee 1fa60c9882 clientv3: add TODO for watch retry
Later we can do:

```diff
+// RetryWatchClient implements a WatchClient.
+func RetryWatchClient(c *Client) pb.WatchClient {
+	readRetry := c.newRetryWrapper(isReadStopError)
+	wc := pb.NewWatchClient(c.conn)
+	return &retryWatchClient{wc, readRetry}
+}
+
+type retryWatchClient struct {
+	pb.WatchClient
+	readRetry retryRPCFunc
+}
+
+func (rwc *retryWatchClient) Watch(ctx context.Context, opts ...grpc.CallOption) (stream pb.Watch_WatchClient, err error) {
+	err = rwc.readRetry(ctx, func(rctx context.Context) error {
+		stream, err = rwc.WatchClient.Watch(rctx, opts...)
+		return err
+	})
+	return stream, err
+}

-	return NewWatchFromWatchClient(pb.NewWatchClient(c.conn))
+	return NewWatchFromWatchClient(RetryWatchClient(c))
```

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 16:02:01 -07:00
Gyu-Ho Lee 141170c1d4 clientv3: remove redundant retries in Maintenance, set FailFast=true
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 16:01:50 -07:00
Gyu-Ho Lee c09a89d834 clientv3: remove redundant retries in Cluster, set FailFast=true
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 16:00:45 -07:00
Gyu-Ho Lee fecd26f141 clientv3: rename to isRepeatableStopError, isNonRepeatableStopError
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 15:58:12 -07:00
Gyu-Ho Lee b46ab2c36e clientv3: remove redundant retries in KV, set FailFast=true
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 15:57:10 -07:00
Gyu-Ho Lee f95f865060 clientv3: unexport pb.LeaseClient in lease client
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 15:02:19 -07:00
Gyu-Ho Lee 87fe8c12ae clientv3: rename to repeatableRetry in lease client
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 14:58:54 -07:00
Gyu-Ho Lee 29aa4ce2a1 clientv3: remove redundant retries in Lease, set FailFast=true
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 14:53:01 -07:00
Gyu-Ho Lee 2540859ee7 clientv3: separate readyWait for ConnectNotify
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 13:07:22 -07:00
Gyu-Ho Lee 1549403dd2 clientv3: clean up logging, clarify var/field names
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 12:33:25 -07:00
Gyu-Ho Lee ad24700252 clientv3: handle stale endpoint in health balancer
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-19 12:02:31 -07:00
Gyu-Ho Lee 7f2b6a19d6 clientv3: fix typo in 'testNetworkPartitionBalancer'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-10 16:07:03 -07:00
Gyu-Ho Lee 500c2499f4 clientv3: reset unhealthy on updateAddrs
Otherwise, 'mayPin' incorrectly decides if an address
should be pinned or not.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-10 12:28:57 -07:00
Gyu-Ho Lee e9e17e3fe5 clientv3: pin any endpoint when all unhealthy
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-09 16:02:18 -07:00
Gyu-Ho Lee 8224c748c9 clientv3/integration: add balancer network partition tests
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-09 14:54:47 -07:00
Gyu-Ho Lee fbed568b6a clientv3/balancer: mark partitioned member as unhealthy
Previous behavior is when server returns errors, retry
wrapper does not do anything, while passively expecting
balancer to gray-list the isolated endpoint. This is
problematic when multiple endpoints are passed, and
network partition happens.

This patch adds 'endpointError' method to 'balancer' interface
to actively(possibly even before health-check API gets called)
handle RPC errors and gray-list endpoints for the time being,
thus speeding up the endpoint switch.

This is safe in a single-endpoint case, because balancer will
retry no matter what in such case.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-09 13:40:03 -07:00
Gyu-Ho Lee 1704443c6d clientv3: only health-check when timeout elapses since last failure
Otherwise network-partitioned member with active health-check
server would not be gray-listed, making health-balancer stuck
with isolated endpoint.

Also clarifies some log messages.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-09 13:40:03 -07:00
lorneli 5096b4ed5d clientv3/ordering: compare and update prevRev atomically
Several goroutines may call setPrevRev concurrently with different
revisions, all higher than prevRev. Previously all of these goroutines
could set prevRev, so prevRev may be replaced by older one.

If response's revision equals to prevRev, there's no need to call
setPrevRev.
2017-10-09 20:06:19 +08:00
Gyu-Ho Lee bed5f388a8 clientv3: add pinned() method to 'balancer'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-06 15:28:21 -07:00
Gyu-Ho Lee 1c6fbcd3d0 clientv3: add debugging lines to 'retry' paths
Helpful for debugging client balancer.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-06 10:13:25 -07:00
Gyu-Ho Lee 05f96e8770 clientv3/yaml: add 'TrustedCAfile' field to replace 'CAfile'
To be consistent with etcdmain.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-04 14:00:54 -07:00
Gyu-Ho Lee b2f5393b64 clientv3/ordering: add missing 'errOrderViolation' error check
Fix https://github.com/coreos/etcd/issues/8641.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-03 18:04:36 -07:00
Gyu-Ho Lee 69031e3a6d clientv3/ordering: acquire setPrevRev mutex only when needed
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-03 15:06:37 -07:00
Gyu-Ho Lee 0199bdc266 *: fix 'ineffassign' issues
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-03 10:14:33 -07:00
Gyu-Ho Lee 3f596db104 clientv3: add more health balancer debugging logs
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-02 15:38:36 -07:00
lorneli aac652009d clientv3/integration: test leasing txn invalidates deleted cache
Test cache invalidating in txnLeasing.commitToCache function.
2017-09-30 13:04:06 +08:00
Gyu-Ho Lee 65ffb52e5f clientv3/integration: add TestWatchKeepAlive
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-28 15:35:29 -07:00
Gyu-Ho Lee 636815909d clientv3/integration: match context errors to stopped server
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-27 13:12:08 -07:00
Gyu-Ho Lee a439095697 clientv3: wait for ConnectNotify before sending RPCs
With slow CPU, gRPC can lag behind with RPCs being sent before
calling 'Up', returning 'no address available' on the first try.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-27 13:12:08 -07:00