Commit Graph

1030 Commits (061d8e8ead3107a230548a66ec3a24d343e446ad)

Author SHA1 Message Date
Gyuho Lee 63d66b1011 clientv3: configure gRPC message limits in Config
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-20 10:58:01 -08:00
Gyuho Lee b0a7623be8
Merge pull request #9023 from gyuho/keepalive-doc
clientv3: document context to "KeepAlive" API
2017-12-19 11:53:56 -08:00
Gyuho Lee 7cd985bdac clientv3: translate Snapshot API gRPC status error
To be consistent with other APIs.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-19 10:46:19 -08:00
Gyuho Lee e833b7c2d8 clientv3: document context to "Snapshot" API
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-18 17:03:18 -08:00
Gyuho Lee 3e58dd707f clientv3: document lease KeepAlive streaming errors
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-18 10:19:41 -08:00
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
Gyu-Ho Lee 92f5746c54 clientv3/integration: fix license, minor nits in leasing_test.go
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-27 09:23:39 -07:00
Gyu-Ho Lee 090c192517 clientv3: add debugging logs, warnings
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-26 07:16:16 +09:00
Anthony Romano 49e5e78d0f clientv3/integration: test endpoint switches on partitioned member 2017-09-16 13:55:39 -07:00
Anthony Romano efd7800e0f clientv3: try next endpoint point on unavailable error 2017-09-16 13:55:39 -07:00
Anthony Romano e3deb9f482 clientv3: test health balancer gray listing 2017-09-15 14:24:46 -07:00
Anthony Romano 84db8fdaea clientv3: health check balancer 2017-09-15 14:24:46 -07:00
Anthony Romano 6f6279075a Merge pull request #8546 from heyitsanthony/receiver-ci
test: check for inconsistent receiver names
2017-09-12 13:59:52 -07:00
Xiang Li 10b731baa8 Merge pull request #8516 from purpleidea/feat/leaseid-okay
clientv3: Allow naked LeaseID or int64 for LeaseValue Compare's
2017-09-12 09:05:33 -07:00
Anthony Romano 4fa1dd196c *: make receiver names consistent 2017-09-12 03:54:04 -07:00
Gyu-Ho Lee 9553afbb24 Merge pull request #8533 from gyuho/grpc
*: upgrade grpclog to LoggerV2
2017-09-12 03:53:04 -07:00
Gyu-Ho Lee 6f76d52a1a *: deprecate grpc.Code, grpc.ErrorDesc
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-11 09:28:56 -07:00
Gyu-Ho Lee 0b2d8a6c96 *: fix minor typos
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-11 07:33:35 -07:00
Gyu-Ho Lee d6c33367c4 clientv3: upgrade grpclog to LoggerV2
grpclog.Logger has been deprecated.
2017-09-08 15:25:32 -07:00
Gyu-Ho Lee 9a726b424d *: fix leaky context creation with cancel
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-07 13:39:42 -07:00
Gyu-Ho Lee f65aee0759 *: replace 'golang.org/x/net/context' with 'context'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-07 13:39:42 -07:00
James Shubin 252cab0c13 clientv3: Allow naked LeaseID or int64 for LeaseValue Compare's
The logical input to Compare would be a LeaseID (type int64) but the
check panics if we give a LeaseID directly. Allow both so that we don't
unnecessarily annoy and confuse the programmer using the API in the most
logical way.
2017-09-07 13:49:35 -04:00
Anthony Romano 2d0eec0b35 clientv3: goword spelling check 2017-09-06 22:11:33 -07:00
Gyu-Ho Lee 4cbe2e8cae Merge pull request #8505 from gyuho/conn-timeout
clientv3: deprecate grpc.ErrClientConnTimeout errors
2017-09-05 16:50:39 -07:00
James Shubin 550765d037 clientv3: Add LeaseValue helper to Cmp LeaseID values in Txn 2017-09-05 18:51:12 -04:00
Gyu-Ho Lee 15c3c1be28 *: replace 'grpc.ErrClientConnTimeout' with 'context.DeadlineExceeded'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-05 14:10:43 -07:00
Gyu-Ho Lee 312c68a9c6 clientv3: deprecate grpc.ErrClientConnTimeout errors
Replace with context.DeadlineExceeded.
Address https://github.com/coreos/etcd/issues/8504.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-05 14:10:02 -07:00
Gyu-Ho Lee e441c57972 clientv3: fix godoc badge link
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-25 17:44:36 -07:00
Anthony Romano b206afc4a7 concurrency: fix STM example to add to balance
Worked by coincidence; the txn would always retry and there
was a 1/10 chance it would pass by selecting the same to/from keys.
2017-08-22 19:39:22 -07:00
Anthony Romano 1d195521c7 concurrency: retry snapshot serializable stm if writes since first header rev
Was checking the rset key mod rev, which does not work.
2017-08-22 19:39:22 -07:00
Anthony Romano 5c03ade973 leasing: don't acquire lease on ttl'd keys
TTL'd keys may expire on cluster without lease holder's consent.
2017-08-21 12:12:53 -07:00
Anthony Romano cf0a07be52 integration: test leasing client does not acuire lease on TTL'd keys 2017-08-21 12:11:19 -07:00
Anthony Romano 126e91c449 leasing, integration, etcdmain: closer function for leasing kv
Semaphore was seeing goroutine leaks
2017-08-18 14:05:57 -07:00
Gyu-Ho Lee 556c1a1fe0 integration,clientv3/integration: test LeaseLeases API
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-14 14:18:57 -07:00
Gyu-Ho Lee 15ef98a4ee clientv3: implement LeaseLeases API
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-14 14:18:56 -07:00
Anthony Romano cf0eb3b7ce integration: increase timeout for TestLeasingReconnectOwnerRevoke
Adding retry to acquire on failure causes Get to now retry until a
connection can be reestablished to the etcd server, causing the
timeout to trigger and fail the test.
2017-08-07 15:51:27 -07:00
Anthony Romano 61ebb98e55 leasing: retry on errors from acquire txn
Gets should retry on transient failure, but the txn inserts a write, skipping
the retry logic in the client. Instead, check the error if the txn should be
retried.

Fixes #8372
2017-08-07 11:39:12 -07:00
Gyu-Ho Lee 9982cd0528 clientv3/integration: add 'TestMaintenanceHashKV'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-05 18:17:06 -07:00
Gyu-Ho Lee 8c32cd96fb clientv3: add 'HashKV' to 'Maintenance' interface
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-05 18:17:06 -07:00
Anthony Romano d3716b86ae clientv3: s/ToOpResponse/OpResponse
Closer to idiomatic go.
2017-08-04 11:35:36 -07:00
visheshnp 8fe94356f4 clientv3: more Op accessors 2017-08-04 11:35:36 -07:00
Anthony Romano 468078ffcd integration: leasing tests 2017-08-04 11:35:36 -07:00
visheshnp a425e98a7e leasing: KV leasing 2017-08-04 11:35:36 -07:00
Anthony Romano b7b31e5770 concurrency: add examples 2017-08-02 21:09:05 -07:00
Anthony Romano d543870966 Merge pull request #8347 from heyitsanthony/use-from-grpc-md
clientv3: use FromOutgoingContext to bucket watches
2017-08-01 17:05:56 -07:00
Gyu-Ho Lee 45e6b658dd Merge pull request #8349 from gyuho/fix-lease-test
clientv3/integration: match context canceled on client close
2017-08-01 14:53:31 -07:00
Gyu-Ho Lee b89ef7e295 clientv3/integration: match context canceled on client close
Fix https://github.com/coreos/etcd/issues/8329.

Different behavior from https://github.com/grpc/grpc-go/pull/1369,
in grpc-go transportMonitor.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-01 13:25:13 -07:00
Anthony Romano 7de417d745 clientv3/integration: use grpc metadata to create unique watch ctxs 2017-08-01 13:14:31 -07:00
Anthony Romano fdba9e5fb1 clientv3/integration: test Put succeeds following SetEndpoint
Still gets transport closing errors, but no unavailable endpoint errors.
2017-08-01 12:59:37 -07:00
Anthony Romano 10db0319d1 ordering: use default clients to populate etcd data
Switching endpoints on the same client was triggering balancer
reconnect errors that should be tested in clientv3/integration.
2017-08-01 12:56:04 -07:00
Anthony Romano 4669aaa9a2 clientv3: only retry mutable KV RPCs if no endpoints found
Was retrying when it shouldn't, causing multiple puts
2017-08-01 12:55:51 -07:00
Anthony Romano 8385c6682a clientv3/integration: test client puts at most once on bad connection 2017-08-01 10:31:13 -07:00
Anthony Romano 1c75c383a1 clientv3: use FromOutgoingContext to bucket watches
Watches were bucketed on string(ctx) for historical reasons;
metadata.FromOutgoingContext should be enough to key watches now.

Fixes #8338
2017-08-01 09:26:07 -07:00
Anthony Romano 52b031cfa2 clientv3: accept Compare_LEASE in Compare() 2017-07-31 13:00:04 -07:00
Anthony Romano fca56f132a ordering: use x/net/context and add doc.go
Compilation troubles when using the "context" package.
2017-07-26 20:58:41 -07:00
Anthony Romano 318caeee7e clientv3: return CompactRevision wresp when set with Canceled 2017-07-25 12:36:01 -07:00
Anthony Romano ebcfdd1a3d integration: check Canceled is true in compacted watch response 2017-07-25 12:36:01 -07:00
mangoslicer 887df72d13 clientv3/ordering: kv order caching 2017-07-19 21:40:50 -04:00
Anthony Romano 755270fa6a integration: sync lapi server after puts in TestLeaseTimeToLive
Linearized read to ensure the keys have committed.
2017-07-13 14:55:43 -07:00
Xiang Li acfde8aba0 Merge pull request #8199 from sakshamsharma/clientv3-keep-alive
clientv3: add keep-alive to connection
2017-07-08 16:32:35 -07:00
Gyu-Ho Lee a57405a958 Merge pull request #8153 from gyuho/leadership-transfer
*: expose Leadership Transfer API to clients
2017-07-06 13:00:08 -07:00
Saksham Sharma 2a30a754e9 clientv3: add keep-alive to connection
this makes the grpc client connection use a keep-alive.
2017-07-06 12:55:52 -07:00
Anthony Romano d48e59e389 Merge pull request #8201 from arthurkiller/master
concurrency: fix typo in Serializable godoc
2017-07-06 11:03:55 -07:00
lza@arthur 4df1970188 concurrency: fix typo in Serializable godoc 2017-07-06 12:57:55 +08:00
Gyu-Ho Lee 581a83dfd9 clientv3/*: add 'MoveLeader' method to 'Maintenance'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-23 13:07:17 -07:00
Hui Kang 7fffd8b827 concurrency: comment the default stm isolation level is serializable snapshot
Default stm isolation level is serializable snapshot isolation, which
is different than snapshot isolation (SI)

Signed-off-by: Hui Kang <kangh@us.ibm.com>
2017-06-22 22:24:17 -04:00
Anthony Romano 9e574afb84 clientv3/integration: wait for leader before trying to count watches
Fixes #8044
2017-06-22 15:02:41 -07:00
Anthony Romano b10ea20113 namespace: support nested txns 2017-06-21 14:33:16 -07:00
Anthony Romano f400010028 clientv3/integration: test clientv3 nested txns 2017-06-21 14:33:15 -07:00
Anthony Romano f8dbcd86ec clientv3: support nested Txns with OpTxn 2017-06-21 14:33:15 -07:00
Anthony Romano 8f34d0c8b6 clientv3/integration: test compare on range 2017-06-16 12:13:27 -07:00
Anthony Romano 7ff6e62c56 namespace: prefix comparison range_end 2017-06-16 12:13:27 -07:00
Anthony Romano fcf1abd23b clientv3: compare helper functions to set range/prefix 2017-06-16 12:13:27 -07:00
Gyu-Ho Lee 5e059fd8dc *: use metadata Incoming/OutgoingContext
Fix https://github.com/coreos/etcd/issues/7888.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-15 16:41:23 -07:00
Anthony Romano f5b96991a1 concurrency: fetch current lock holder when creating waitlist key
The uncontended path for a mutex would fetch the minimum
revision key on the prefix after creating its entry in
the wait list. This fetch can be rolled into the txn for
creating the wait key, eliminating a round-trip for immediately
acquiring the lock.
2017-06-15 11:29:34 -07:00
Anthony Romano 13d9438cf9 clientv3: clarify Watch close conditions
The "too slow" comment is rather vague. If the server closes
the watch for being too slow (it doesn't seem to any more), the
watch client should gracefully resume instead of forcing the
user to handle it.

Also removed the 'opts' comment since it wasn't being maintained.
2017-06-15 09:34:00 -07:00
fanmin shi 762b2c625c clientv3: change watchGrpcStream Close() to close()
private struct shouldn't have public method.
2017-06-08 12:11:06 -07:00
fanmin shi 4dff7aaa2a clientv3: change keepAlive Close() to close()
keepAlive is a private struct that belongs to clientv3 pkg and shouldn't expose a public Close() method.
2017-06-08 11:53:59 -07:00
Anthony Romano 887db5a3db *: fix go tool vet -all -shadow errors 2017-06-03 21:32:36 -07:00
Anthony Romano ea8561c35c clientv3: support unixs:// scheme
For using TLS without giving a TLSConfig to the client.
2017-05-31 15:51:48 -07:00
Anthony Romano 1b48d6e5df clientv3/integration: test dialing to TLS without a TLS config times out
etcdctl was getting ctx errors from timing out trying to issue RPCs to
a TLS endpoint but without using TLS for transmission. Client should
immediately bail out with a time out error.
2017-05-31 15:51:03 -07:00
Anthony Romano 8effbda3a7 clientv3: use Endpoints[0] to initialize grpc creds
Dialing out without specifying TLS creds but giving https uses some
default behavior that depends on passing an endpoint with https to
Dial(), so it's not enough to completely rely on the balancer to supply
endpoints.

Fixes #8008

Also ctx-izes grpc.Dial
2017-05-31 15:01:11 -07:00
Anthony Romano c250e7be9e clientv3: do not launch cluster on go test without explicit -run
There's a workaround by running -run=Test but this periodically
comes up as an issue, so have `go test` only run Test* to stem
the complaints.

Fixes #8000
2017-05-30 12:23:12 -07:00
fanmin shi e9f464debc integration: creation of cluster now takes maxTxnOps 2017-05-24 14:48:44 -07:00
fanmin shi ae7ddfb483 etcdserver: add --max-txn-ops flag
--max-txn-ops allows users to define the maximum transaction operations
for each txn request. it defaults at 128.

Fixes #7826
2017-05-24 10:32:32 -07:00
Hitoshi Mitake 4cd5e7ebb2 Merge pull request #7809 from mitake/auth-watch
protect watch with auth
2017-05-20 13:23:30 +09:00
Hitoshi Mitake 939912c425 clientv3, etcdserver: support auth in Watch() 2017-05-20 11:34:45 +09:00
Anthony Romano 33c375dc44 *: fill out blank package godocs
Mostly one-liner short descriptions, but also includes some typo fixes
and some examples.
2017-05-18 09:41:13 -07:00
Anthony Romano 63c7e9f840 clientv3: remove duplicate documentation for Do() 2017-05-11 13:25:26 -07:00
Xiang Li b8875515a4 Merge pull request #7890 from yudai/keep_ka_loop_running
clientv3: Do no stop keep alive loop by server side errors
2017-05-09 11:00:21 -07:00
Iwasaki Yudai aa85b0cea7 clientv3: Do no stop keep alive loop by server side errors 2017-05-08 15:47:34 -07:00
Luediger Reinhard 8b081ce9b3 clientv3: check IsModify
Fix watch_test.go TestEvent

Prior to This fix the isModify case of the table driven test was never checked.
2017-05-05 19:39:59 +02:00
Anthony Romano 2e32d2142d Merge pull request #7869 from heyitsanthony/fix-lease-require-leader-test
clientv3/integration: drain keepalives before waiting for leader loss
2017-05-04 08:29:16 -07:00
Anthony Romano 9fee35b02d Merge pull request #7842 from heyitsanthony/fix-switch-race
clientv3: don't race on upc/downc/switch endpoints in balancer
2017-05-03 13:48:00 -07:00
Anthony Romano f6d0dda187 clientv3/integration: drain keepalives before waiting for leader loss
500ms keepalive delay on proxy side causes client to sometimes send
a second keepalive since it waits more than 500ms for the first response.

Fixes #7658
2017-05-03 13:22:45 -07:00
Anthony Romano 24e85b2454 Merge pull request #7852 from heyitsanthony/revert-lease-err-ka
Revert "Merge pull request #7732 from heyitsanthony/lease-err-ka"
2017-05-03 11:03:17 -07:00
Anthony Romano 31d5d610fc concurrency: provide old STM functions as deprecated
semver
2017-05-03 02:07:01 -07:00
Anthony Romano 43e5f892f6 clientv3: don't race on upc/downc/switch endpoints in balancer
If the balancer update notification loop starts with a downed
connection and endpoints are switched while the old connection is up,
the balancer can potentially wait forever for an up connection without
refreshing the connections to reflect the current endpoints.

Instead, fetch upc/downc together, only caring about a single transition
either from down->up or up->down for each iteration

Simple way to reproduce failures: add time.Sleep(time.Second) to the
beginning of the update notification loop.
2017-05-02 16:43:24 -07:00
Anthony Romano 6dd8fb6f24 Revert "Merge pull request #7732 from heyitsanthony/lease-err-ka"
This reverts commit fbbc4a4979, reversing
changes made to f254e38385.

Fixes #7851
2017-05-02 09:36:16 -07:00
Anthony Romano c309d745a6 Merge pull request #7819 from heyitsanthony/fix-elect-compact
concurrency: use current revisions for election
2017-04-27 11:01:44 -07:00
Gyu-Ho Lee f674a1b583 clientv3/integration: test client dial with expired certs
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-26 12:32:46 -07:00
Anthony Romano 50f29bd661 concurrency: use current revisions for election
Watching from the leader's ModRevision could cause live-locking on
observe retry loops when the ModRevision is less than the compacted
revision. Instead, start watching the leader from at least the store
revision of the linearized read used to detect the current leader.

Fixes #7815
2017-04-25 20:15:50 -07:00
Anthony Romano f3053265ae clientv3/integration: use new interfaces in lease tests 2017-04-24 23:49:44 -07:00
Anthony Romano f224d74ed7 concurrency: use new lease interface in session 2017-04-24 23:49:44 -07:00
Anthony Romano d5f414f69b clientv3: don't halt lease client if there is a lease error
Fixes #7488
2017-04-24 23:49:44 -07:00
Anthony Romano ca4acceb1e clientv3: set current revision to create rev regardless of CreateNotify
Turns out the optimization to ignore setting the init rev for
current revision watches breaks some ordering assumptions. Since
Watch only returns a channel once it gets a response, it should
bind the revision at the time of the first create response.

Was causing TestWatchReconnInit to fail.
2017-04-22 13:04:38 -07:00
Anthony Romano c1300c81b3 concurrency: clarify Observe semantics; only fetches subsequence 2017-04-22 11:26:11 -07:00
Anthony Romano 4ab818a856 clientv3: only update initReq.rev == 0 with creation watch revision
Always updating the initReq.rev on watch create will resume from the wrong
revision if initReq is ever nonzero.
2017-04-21 20:22:51 -07:00
Anthony Romano ec470944f8 clientv3/integration: test watch resume with disconnect before first event 2017-04-21 20:22:51 -07:00
Anthony Romano 35dff4cbc3 Merge pull request #7769 from heyitsanthony/more-time-lease-test
clientv3/integration: sleep less in TestLeaseRenewLostQuorum
2017-04-19 00:57:49 -07:00
Hitoshi Mitake d3456b5ecd Merge pull request #7759 from mitake/fix-7724
*: simply ignore ErrAuthNotEnabled in clientv3 if auth is not enabled
2017-04-19 16:07:18 +09:00
Anthony Romano c654370d6d clientv3/integration: sleep less in TestLeaseRenewLostQuorum
Server Stop+Restart sometimes takes more than 500ms, so with a
one second window the lease client may not get a chance to issue
a keepalive and get a lease extension before the lease client
timer elapses. Instead, sleep for a shorter period of time (while
still guaranteeing a keepalive resend during quorum loss) and
skip the test if server restart takes longer than the lease TTL.

Fixes #7346
2017-04-18 19:35:20 -07:00
Hitoshi Mitake e1306bff8f *: simply ignore ErrAuthNotEnabled in clientv3 if auth is not enabled
Fix https://github.com/coreos/etcd/issues/7724
2017-04-19 11:27:14 +09:00
Anthony Romano 8fdf8f752b Merge pull request #7752 from heyitsanthony/clientv3-fetch-keyspace-pfx
clientv3: translate WithPrefix() into WithFromKey() for empty key
2017-04-18 09:24:53 -07:00
Gyu-Ho Lee 81291b23b1 clientv3/integration: add 'TestUserErrorAuth'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-17 17:11:37 -07:00
Anthony Romano f92c11e1f2 clientv3: translate WithPrefix() into WithFromKey() for empty key 2017-04-16 20:47:18 -07:00
Anthony Romano f0143916de clientv3/integration: test fetching entire keyspace 2017-04-16 20:47:18 -07:00
darasion 0e7fd4a37c clientv3/namespace: fix incorrect watching prefix-end
using "abc" will watch the wrong range when WithPrefix() specified.
2017-04-15 22:31:50 +08:00
Anthony Romano 2951e7f6e4 Merge pull request #7733 from heyitsanthony/fix-client-foreign-dial
clientv3: let client dial endpoints not in the balancer
2017-04-14 10:45:17 -07:00
Gyu-Ho Lee 6c2fb5105d clientv3/integration: use 'transport.IsClosedConnError'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-13 11:55:23 -07:00
Anthony Romano 46971fa1db integration: test client can dial endpoints not in balancer 2017-04-12 20:07:04 -07:00
Anthony Romano 9b8e39e7ca clientv3: let client.Dial() dial endpoints not in the balancer 2017-04-12 20:07:03 -07:00
Anthony Romano 4f9aa276bd *: rename Snapshot STM isolation to SerializableSnapshot
Pure Snapshot isolation would permit read conflicts. Change the name
from Snapshot to SerializableSnapshot to reflect that it will also
reject read conflicts.
2017-04-11 17:17:50 -07:00
Anthony Romano 4b4f5be74a concurrency: don't skip leader updates in Observe()
The Get for the leader key will fetch based on the latest revision
instead of the deletion revision, missing leader updates between
the delete and the Get.

Although it's usually safe to skip these updates since they're
stale, it makes testing more difficult and in some cases the
full leader update history is desirable.
2017-04-07 16:36:38 -07:00
Anthony Romano 80c1b9c13a concurrency: support resuming elections if leadership already held
If a client already knows it holds leadership, let it create an
election object with its leadership information.
2017-04-07 16:36:38 -07:00
Anthony Romano d1ae4cd5bd concurrency: only delete on election resignation if create revision matches
Addresses a case where two clients share the same lease. A client resigns but
disconnects / crashes and doesn't realize it. Another client reuses the
lease and gets leadership with a new key. The old client comes back and
tries to resign again, revoking the new leadership of the new client.
2017-04-07 16:36:37 -07:00
Anthony Romano 4b5bb7f212 concurrency: return v3.GetResponse for Election.Leader()
The full information about the leader's key is necessary to
safely use elections with transactions. Instead of returning
only the value on Leader(), return the entire GetResposne.
2017-04-07 16:36:37 -07:00
Anthony Romano a6cab69c88 concurrency: expose leader revision and proclaim headers for election 2017-04-07 16:36:37 -07:00
Gyu-Ho Lee 369d561350 clientv3/integration: fix minor typo in Fatalf
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-06 18:26:42 -07:00
Anthony Romano bea4c62965 Merge pull request #7677 from heyitsanthony/fix-waitsubstream
clientv3: register waitCancelSubstreams closingc goroutine with waitgroup
2017-04-06 11:10:06 -07:00
Anthony Romano aab2eda7df clientv3: register waitCancelSubstreams closingc goroutine with waitgroup
Fixes #7598
2017-04-05 16:06:53 -07:00
Gyu-Ho Lee dee467dc24 clientv3/yaml: use TLS 1.2 in min version
To be consistent with 'pkg/transport'

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-05 11:50:35 -07:00
Anthony Romano d42c1f5131 Merge pull request #7646 from andelf/fix-unix-socket-url
*: fix a bug in handling unix socket urls
2017-04-05 09:24:38 -07:00
andelf 4f27981c46 *: fix a bug in handling unix socket urls
Now use url.Host + url.Path as unix socket path

Fixes #7644
2017-04-05 14:33:13 +08:00
Gyu-Ho Lee d51d381eca Merge pull request #7656 from gyuho/more-adapter
*: add cluster API adapter
2017-04-04 20:10:24 -07:00
Gyu-Ho Lee 9bc3c0bd05 clientv3: remove unused fields from 'auth'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-04 08:17:36 -07:00
Gyu-Ho Lee 7f2d6b3ef6 clientv3,v3client: add cluster embedded client
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-04-04 08:14:18 -07:00
Anthony Romano a0149106b8 clientv3: fix go1.8 go fmt warning in test 2017-04-03 14:00:06 -07:00
Anthony Romano f13bea0bb0 Merge pull request #7639 from heyitsanthony/fix-userflag-timeout
clientv3: respect dial timeout in auth
2017-04-03 09:30:48 -07:00
Anthony Romano 5aebe1a52d clientv3: test dial timeout is respected when using auth 2017-03-31 15:14:46 -07:00
Anthony Romano 62d7bae496 clientv3: respect dial timeout when authenticating
Fixes #7627
2017-03-31 15:14:46 -07:00
Anthony Romano 8024a0d15f clientv3: support WithRequireLeader in lease client
Unconditionally opens a WithRequireLeader stream in the lease client. Any
keep alive channels opened using WithRequireLeader will be closed when
the leader is lost.

Fixes #7275
2017-03-30 21:39:36 -07:00
Anthony Romano 7db7744737 clientv3/integration: test lease WithRequireLeader 2017-03-30 20:18:33 -07:00
Gyu-Ho Lee 0bf110e27f clientv3,v3client: maintenance to embedded client
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-03-28 14:12:43 -07:00
Anthony Romano 36ece32a61 Merge pull request #7582 from heyitsanthony/fix-watch-stream-leak
clientv3: use waitgroup to wait for substream goroutine teardown
2017-03-23 12:24:06 -07:00
Anthony Romano 23719f99c6 Merge pull request #7563 from heyitsanthony/fix-testdialcancel-leak
clientv3: wait for Get goroutine in TestDialCancel
2017-03-23 10:07:23 -07:00
Anthony Romano a39107a3b8 clientv3: use waitgroup to wait for substream goroutine teardown
When a grpc watch stream is torn down, it will join on its logical substream
goroutines by waiting for each to close a channel. This doesn't guarantee
the substream is fully exited, though, but only about to exit and can be
waiting to resume even after Watch.Close finishes. Instead, use a
waitgroup.Done at the very end of the substream defer.

Fixes #7573
2017-03-22 23:27:26 -07:00
Anthony Romano 85f989ab3d Documentation, op-guide, clientv3: add documentation for namespacing 2017-03-22 16:45:38 -07:00
Anthony Romano 66d147766f clientv3/integration: simple namespace wrapper tests 2017-03-22 16:45:38 -07:00
Anthony Romano 1f8c7b33e7 namespace: a wrapper for clientv3 to namespace requests 2017-03-22 14:09:09 -07:00
Anthony Romano f9b6066dd6 clientv3: make ops and compares non-opaque and mutable
Fixes #7250
2017-03-22 14:08:59 -07:00
Anthony Romano dd465d0e40 clientv3: remove redundant error handling code 2017-03-22 01:08:23 -07:00
Anthony Romano d1a9ccb2b9 clientv3: wait for Get goroutine in TestDialCancel 2017-03-21 16:43:39 -07:00
fanmin shi 902c676cdb Merge pull request #7397 from fanminshi/fix_SetEndpoints
clientv3/balancer: update eps if pinAddr is not included in updateAddrs
2017-03-15 12:16:15 -07:00
fanmin shi a23609efe6 clientv3: update eps if pinAddr is not included in updateAddrs
FIXES #7392
2017-03-15 11:03:25 -07:00
Anthony Romano 27960911af Merge pull request #7500 from heyitsanthony/fix-balancer-test-leak
clientv3: synchronize on goroutines in TestBalancerDoNotBlockOnClose
2017-03-15 08:58:03 -07:00
Anthony Romano b36734f1d3 clientv3: synchronize on goroutines in TestBalancerDoNotBlockOnClose
Was leaking dialers.
2017-03-14 19:53:33 -07:00
Anthony Romano a087325452 clientv3: close open watch channel if substream is closing on reconnect
If substream is closing but outc is still open while reconnecting, then outc
would only be closed once the watch client would connect or once the watch
client is closed. This was leading to deadlocks in the proxy tests. Instead,
close immediately if the context is canceled.

Fixes #7503
2017-03-14 17:25:18 -07:00
Anthony Romano 1a6be700d8 Merge pull request #7444 from heyitsanthony/lock-service
grpc lock service
2017-03-14 00:01:34 -07:00
fanmin shi 3a61fe596b Merge pull request #7423 from purpleidea/feat/clientv3util-examples
clientv3util: Add KeyExists and KeyMissing examples
2017-03-13 17:26:57 -07:00
fanmin shi 94d5936180 Update example_key_test.go 2017-03-13 16:54:26 -07:00
Anthony Romano d51c8bb640 concurrency: support returning response header for mutex 2017-03-13 15:23:26 -07:00
Anthony Romano a2cdd908dc clientv3: permit creating client without grpc connection
For creating client from etcdserver.
2017-03-13 15:23:26 -07:00
Anthony Romano 593489d454 clientv3: use CheckAfterTest after terminating cluster
AfterTest() has a delay that waits for runtime goroutines to exit;
CheckLeakedGoroutine does not. Since the test runner manages the
test cluster for examples, there is no delay between terminating
the cluster and checking for leaked goroutines. Instead, apply
Aftertest checking before running CheckLeakedGoroutine to let runtime
http goroutines finish.
2017-03-10 12:23:46 -08:00
Xiang Li 0a692b0524 Merge pull request #7443 from fanminshi/fix_balancer_deadlock
clientv3: serialize updating notifych in balancer
2017-03-10 07:48:47 -08:00
fanmin shi 310641630e clientv3: send frst down() func after recieving first notified addr
This ensures the ordering of down and up calls.
2017-03-09 12:20:36 -08:00
fanmin shi 8baaa06cce clientv3: serialize updating notifych in balancer
FIXES #7283
2017-03-09 12:20:28 -08:00
Gyu-Ho Lee 5f4412996d clientv3: define error type for closed watcher 2017-03-09 02:29:54 -08:00
James Shubin 889dd1b22f clientv3util: Add KeyExists and KeyMissing examples 2017-03-09 02:34:30 -05:00
fanmin shi 7a25257fb2 clientv3: close balancer to avoid goroutine leak in balancer_test.go 2017-03-08 13:37:18 -08:00
Anthony Romano 270dc9427b clientv3: pass back dial error on dial timeout
Fixes #7419
2017-03-06 09:33:10 -08:00
James Shubin 71937151d0 clientv3: Add KeyExists and KeyNotExists Cmp helpers
This is quite useful for transactions.
2017-03-03 18:45:10 -05:00
Anthony Romano cf547aa403 clientv3: bump example requestTimeout for slow CI
Fixes #7398
2017-03-01 14:37:40 -08:00
Anthony Romano c231950cdb clientv3: use any port for metrics example
Was getting bind conflicts causing failures on semaphore.
2017-02-24 14:33:08 -08:00
Anthony Romano c3a678be75 integration: permit background watch streams in TestWatchCancelOnServer
Fixes #7272
2017-02-22 09:54:08 -08:00
Anthony Romano 12d3e4e473 integration: test keepalives for short TTLs 2017-02-21 13:15:45 -08:00
Anthony Romano 3c306cdb3e clientv3: do not set next keepalive time <= now+TTL 2017-02-21 13:15:45 -08:00
Anthony Romano 0c0fbbd7c5 Merge pull request #7342 from heyitsanthony/client-version
clientv3: version checking
2017-02-21 11:46:48 -08:00
yiyiyaya 56b4e6b71f clientv3: fix typo in README
Fix https://github.com/coreos/etcd/issues/7337
2017-02-21 10:33:17 -08:00
Anthony Romano 51435df179 integration: test RejectOldCluster 2017-02-16 21:33:14 -08:00
Anthony Romano 4d2aa80ecf clientv3: add cluster version checking 2017-02-16 18:14:14 -08:00
Anthony Romano c9452c6ad4 clientv3: let user provide a client context through Config 2017-02-16 18:14:14 -08:00
fanmin shi a5cf7fdc87 Merge pull request #7221 from fanminshi/grpcproxy_support_lease_coalescing
grpcproxy: support lease coalescing
2017-02-16 13:42:49 -08:00
Xiang 4fb8d30f0a clientv3: fix lease keepalive duration 2017-02-16 12:04:07 -08:00
Xiang Li 5d3597a5f2 Merge pull request #7338 from xiang90/fix_l
clientv3: fix lease keepalive duration
2017-02-16 11:58:10 -08:00
fanmin shi 65b59f4423 grpcproxy: incorporate lease proxy into existing proxy framework 2017-02-16 11:50:59 -08:00
Xiang 4274db46f2 clientv3: fix lease keepalive duration 2017-02-16 11:25:26 -08:00
Anthony Romano 2f8b9ce9aa Merge pull request #7314 from heyitsanthony/fix-leadership
grpcproxy: split out / tighten up leadership detection
2017-02-15 07:01:38 -08:00
Anthony Romano a4a8393cb7 integration: wait five elections before creating watch for require leader test
Otherwise new watch will race with the leader watcher receiving the loss event.
2017-02-15 00:16:25 -08:00
fanmin shi 8cb5e05fc9 clientv3: KeepAliveOnce returns ErrLeaseNotFound if TTL <= 0 2017-02-14 15:19:29 -08:00
Anthony Romano 43740a8d3c Merge pull request #7318 from heyitsanthony/limit-doc
etcdserverpb, clientv3: clarify WithLimit documentation
2017-02-13 15:35:37 -08:00
Anthony Romano fb7dd0f688 etcdserverpb, clientv3: clarify WithLimit documentation
Fixes #7316
2017-02-13 12:37:44 -08:00
fanmin shi bcfbb096e2 clientv3/integration: test lease not found on TimeToLive() 2017-02-10 16:41:47 -08:00
fanmin shi 366e689eae clientv3: uses direct client calls in integration tests
clientv3 integration test was using clientv3.NewKV, clientv3.NewWatcher, etc to create specific client.
replace those with direct client calls so that the direct calls can also test grpc proxy.
2017-02-07 11:09:19 -08:00
fanmin shi c182428e52 clientv3/integration: stop member before keepalive in TestLeaseKeepAliveInitTimeout 2017-02-07 10:07:03 -08:00
Anthony Romano cf5cc18f02 Merge pull request #7286 from heyitsanthony/lease-snip-cancel-stop
clientv3: remove cancelWhenStop from lease implementation
2017-02-07 09:12:34 -08:00
Anthony Romano a213b3abf5 clientv3: remove cancelWhenStop from lease implementation
Only have Close() cancel out outstanding goroutines. Canceling out
single-shot RPCs will mask connection close on client.Close().
2017-02-06 17:21:46 -08:00
Anthony Romano a9f10bdeee clientv3: only start lease stream after first keepalive call
Fixes #7274
2017-02-06 11:52:57 -08:00
Xiang Li 6fb99a8585 Merge pull request #7276 from fanminshi/fix_lease_keep_alive_loop
clientv3: sends keepalive reqs immediately after lease keep alive stream reset
2017-02-04 21:28:56 -08:00
fanmin shi 720234d32b clientv3: sends keepalive reqs immediately after lease keep alive stream reset
when lease client reset lease keep alive stream, sendKeepAliveLoop() should send out keep alive reqs immediately instead of waiting for 500ms.
2017-02-03 16:36:24 -08:00
Anthony Romano 8c43bd06a0 clientv3: add DialOptions to config
Removes strict prometheus dependency.

Fixes #7058
2017-02-03 12:00:20 -08:00
Anthony Romano b465b48476 clientv3: remove strict yaml dependency
Moved to clientv3/yaml
2017-02-01 21:02:45 -08:00
Ravi Gadde c586218ec6 clientv3: start a session with existing lease
This change is needed to handle process restarts with elections. When the
leader process is restarted, it should be able to hang on to the leadership
by using the existing lease.

Fixes #7166
2017-01-30 18:07:22 -08:00
fanmin shi 18af48a9dc integration: add test case in dial_test to ensure balancer.updateAddrs works properly 2017-01-26 14:21:29 -08:00
fanmin shi 0c4e67c1f4 clientv3: fix balancer update address bug 2017-01-26 13:33:10 -08:00
Anthony Romano 56286ccd29 clientv3: use DialContext
Fixes #7216
2017-01-25 09:49:41 -08:00
Anthony Romano a2c44a8b65 clientv3: test closing client cancels blocking dials 2017-01-25 09:49:41 -08:00
sharat d3191d1afb clientv3: add WithIgnoreLease option 2017-01-25 03:09:30 +05:30
Anthony Romano 8695511153 concurrency: STM snapshot isolation level 2017-01-20 16:22:43 -08:00
Anthony Romano 8604d1863b concurrency: STM WithPrefetch option
Fixes #6923
2017-01-20 16:22:42 -08:00
Anthony Romano a81234a25b concurrency: extend STM interface to Get from any of a list of keys
Now possible to fetch multiple keys in a single txn.
2017-01-20 16:22:42 -08:00
Anthony Romano 59880a0ab8 concurrency: variadic stm options
Makes txn isolation and the context variadic options.
2017-01-20 16:22:42 -08:00
Derek Chiang acec15ebc6 clientv3/concurrency: fix rev comparison on concurrent key deletion 2017-01-19 20:51:31 -08:00
Xiang Li 5cf0d6678b Merge pull request #7174 from vimalk78/support-v3-txn-without-condition
clientv3/txn.go : removed the TODO: add a Do for shortcut the txn without any condition
2017-01-19 08:45:34 -08:00
Vimal Kumar fcaa509e4c clientv3/txn.go : removed the TODO: add a Do for shortcut the txn without any condition 2017-01-18 11:37:29 +05:30
fanmin shi 3a40421aa5 Merge pull request #7157 from fanminshi/clientv3_balancer_uses_one_connection
clientv3: balancer uses one connection at a time
2017-01-17 12:12:35 -08:00
fanmin shi df55438a60 clientv3: balancer uses one connection at a time
FIX #7080
2017-01-17 10:09:41 -08:00
Steve Phillips eb7a804ca8 kv.go: Fixed []byte to string conversion syntax in comment 2017-01-15 05:57:16 -08:00
Gyu-Ho Lee d94d22122b clientv3: add 'WithIgnoreValue' option 2017-01-13 15:13:18 -08:00
Anthony Romano 7dfe503f1c Merge pull request #7148 from heyitsanthony/fix-lease-overlap
clientv3: don't reset stream on keepaliveonce or revoke failure
2017-01-13 10:05:02 -08:00
Anthony Romano 5e3b20e70c clientv3: don't reset stream on keepaliveonce or revoke failure
Would cause the keepalive loop to cancel out.

Fixes #7082
2017-01-13 09:05:23 -08:00
Hitoshi Mitake c89eae790d Merge pull request #7110 from mitake/reauth
etcdserver, clientv3: handle a case of expired auth token
2017-01-13 11:57:25 +09:00
fanmin shi 6d443ba3f9 clienv3: fix balancer test logic 2017-01-12 13:07:44 -08:00
Hitoshi Mitake d431b64d97 etcdserver, clientv3: handle a case of expired auth token
This commit adds a mechanism of handling a case of expired auth token
to clientv3. If a server returns an error code
grpc.codes.Unauthenticated, newRetryWrapper() tries to get a new token
and use it as an option of PerRPCCredential.

Fixes https://github.com/coreos/etcd/issues/7012
2017-01-12 11:49:02 +09:00
Anthony Romano a375e91c66 clientv3: don't reset keepalive stream on grant failure
Was triggering cancelation errors on outstanding KeepAlives if Grant
had to retry.
2016-12-16 10:36:51 -08:00
Anthony Romano 46bd842db9 clientv3/integration: test lease grant/keepalive with/without failures 2016-12-16 10:36:51 -08:00
Xiang Li 86a43849fb Merge pull request #7010 from dennwc/keepalive-exit-err
clientv3: ensure KeepAlive channel is closed or error is returned
2016-12-15 08:06:36 -08:00
Denys Smirnov b126e31132 clientv3: better error message for keep alive loop halt 2016-12-15 16:06:27 +02:00
Denys Smirnov 5183ce0118 clientv3: add test for keep alive loop exit case 2016-12-15 03:02:44 +02:00
Denys Smirnov e0bcd4d516 clientv3: return error from KeepAlive if corresponding loop exits
after recvKeepAliveLoop exits client might call KeepAlive adding request channel that will not be closed
this fix makes sure that recvKeepAliveLoop is running before adding request to lessor's list and returns error otherwise

Fixes #6922
2016-12-15 03:02:35 +02:00
Anthony Romano 246fb29d8a clientv3: close Lease on client Close
Fixes #6987
2016-12-14 12:11:17 -08:00
Anthony Romano fdd89df1eb clientv3/integration: test lease keepalive works following quorum loss 2016-12-06 14:09:57 -08:00
Gyu-Ho Lee a08103c088 clientv3: return copy of endpoints, not pointer
Fix https://github.com/coreos/etcd/issues/6892.
2016-11-23 11:33:54 -08:00
fanmin shi ab6b175a2a Merge pull request #6828 from fanminshi/add_not_equal_to_compare
etcdserver, clientv3: add "!=" to txn
2016-11-09 15:27:08 -08:00
fanmin shi c2fd42b556 etcdserver, clientv3: add "!=" to txn
adding != to compare is a requested functionality from a etcd user

FIX #6719
2016-11-09 14:28:36 -08:00
Kelvin Liang c20d31adc5 clientv3/naming: support OpOption when adding an endpoint
if we want to add an endpoint with lease, we need this option.
for example:

    resp, err := cli.Grant(context.TODO(), 5)
    if err != nil {
        log.Fatal(err)
    }

    err = r.Update(context.TODO(), serviceName, naming.Update{Op:naming.Add, Addr: exposedAddr}, clientv3.WithLease(resp.ID))
    if err != nil {
        log.Fatalf(err)
    }
2016-11-09 15:30:17 -04:00
Gyu-Ho Lee dbb692e50f Merge pull request #6820 from gyuho/watcher
mvcc: return -1 for wrong watcher range key >= end
2016-11-08 17:36:19 -08:00
Gyu-Ho Lee 9dd75a946f clientv3, ctlv3: document range end requirement 2016-11-08 17:02:32 -08:00
Gyu-Ho Lee a93d8dfe62 Merge pull request #6821 from gyuho/manual
*: fix minor typos, styles
2016-11-08 15:39:26 -08:00
Gyu-Ho Lee 2955d58776
clientv3/integration: fix minor typos, consistent formatting 2016-11-08 12:37:33 -08:00
Anthony Romano 1aeeb38459 clientv3: let watchers cancel when reconnecting 2016-11-08 12:02:17 -08:00
Anthony Romano 7b5e5eadb1 integration: test canceling a watcher on disconnected stream 2016-11-08 12:02:17 -08:00
Anthony Romano fe755b6250 Merge pull request #6748 from sinsharat/client_metric_add_tests
clientv3: added test for client metrics
2016-11-02 15:00:08 -07:00
sharat 195570b621 clientv3: updated doc for metric support 2016-11-03 03:22:59 +05:30
sinsharat 13acad85b3 clientv3: added test for client metrics 2016-11-03 00:38:29 +05:30
Gyu-Ho Lee 0684d8c4c6 clientv3/integration: close active connection to get ErrClientConnClosing
because clientv3.Close won't trigger it any more

clientv3.Close just closes watch client
instead of closing grpc connection
2016-11-01 11:13:33 -07:00
Gyu-Ho Lee 5bd00ab1f6 *: fix minor typos 2016-10-31 09:47:15 -07:00
Anthony Romano 0345226759 Merge pull request #6751 from heyitsanthony/fix-require-leader-test
integration: put key on watch target member for TestWatchWithRequireLeader
2016-10-28 23:24:00 -04:00
Anthony Romano d8ea9d22b6 integration: put key on watch target member for TestWatchWithRequireLeader
It's possible the put will not propagate to all members before removing quorum,
causing watches on the key to wait forever.

Fixes #6386
2016-10-28 13:12:26 -04:00
sharat a1bfb31219 clientv3: added example for client metrics 2016-10-28 04:30:17 +05:30
Xiang Li 89107a49fa Merge pull request #6741 from sinsharat/clientv3_add_client_side_metrics
clientv3: added client side metrics support
2016-10-27 13:22:10 -07:00