Chris Ayoub
36a76e8531
clientv3: filter learners members during autosync
...
This change is to ensure that all members returned during the client's
AutoSync are started and are not learners, which are not valid
etcd members to make requests to.
Signed-off-by: Chris Ayoub <cayoub@hubspot.com>
2022-07-20 00:04:03 -04:00
Gyuho Lee
1471e12108
clientv3: embed api version in metadata
...
ref.
https://github.com/etcd-io/etcd/pull/11687
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
clientv3: fix racy writes to context key
=== RUN TestWatchOverlapContextCancel
==================
WARNING: DATA RACE
Write at 0x00c42110dd40 by goroutine 99:
runtime.mapassign()
/usr/local/go/src/runtime/hashmap.go:485 +0x0
github.com/coreos/etcd/clientv3.metadataSet()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/ctx.go:61 +0x8c
github.com/coreos/etcd/clientv3.withVersion()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/ctx.go:47 +0x137
github.com/coreos/etcd/clientv3.newStreamClientInterceptor.func1()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/client.go:309 +0x81
google.golang.org/grpc.NewClientStream()
/go/src/github.com/coreos/etcd/gopath/src/google.golang.org/grpc/stream.go:101 +0x10e
github.com/coreos/etcd/etcdserver/etcdserverpb.(*watchClient).Watch()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.pb.go:3193 +0xe9
github.com/coreos/etcd/clientv3.(*watchGrpcStream).openWatchClient()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:788 +0x143
github.com/coreos/etcd/clientv3.(*watchGrpcStream).newWatchClient()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:700 +0x5c3
github.com/coreos/etcd/clientv3.(*watchGrpcStream).run()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:431 +0x12b
Previous read at 0x00c42110dd40 by goroutine 130:
reflect.maplen()
/usr/local/go/src/runtime/hashmap.go:1165 +0x0
reflect.Value.MapKeys()
/usr/local/go/src/reflect/value.go:1090 +0x43b
fmt.(*pp).printValue()
/usr/local/go/src/fmt/print.go:741 +0x1885
fmt.(*pp).printArg()
/usr/local/go/src/fmt/print.go:682 +0x1b1
fmt.(*pp).doPrintf()
/usr/local/go/src/fmt/print.go:998 +0x1cad
fmt.Sprintf()
/usr/local/go/src/fmt/print.go:196 +0x77
github.com/coreos/etcd/clientv3.streamKeyFromCtx()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:825 +0xc8
github.com/coreos/etcd/clientv3.(*watcher).Watch()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:265 +0x426
github.com/coreos/etcd/clientv3/integration.testWatchOverlapContextCancel.func1()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/integration/watch_test.go:959 +0x23e
Goroutine 99 (running) created at:
github.com/coreos/etcd/clientv3.(*watcher).newWatcherGrpcStream()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:236 +0x59d
github.com/coreos/etcd/clientv3.(*watcher).Watch()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:278 +0xbb6
github.com/coreos/etcd/clientv3/integration.testWatchOverlapContextCancel.func1()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/integration/watch_test.go:959 +0x23e
Goroutine 130 (running) created at:
github.com/coreos/etcd/clientv3/integration.testWatchOverlapContextCancel()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/integration/watch_test.go:979 +0x76d
github.com/coreos/etcd/clientv3/integration.TestWatchOverlapContextCancel()
/go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/integration/watch_test.go:922 +0x44
testing.tRunner()
/usr/local/go/src/testing/testing.go:657 +0x107
==================
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2020-03-18 17:17:00 -07:00
Joe Betz
0781c0327d
clientv3: Replace endpoint.ParseHostPort with net.SplitHostPort to fix IPv6 client endpoints
2019-10-08 18:27:03 -07:00
Joe Betz
c454344f14
clientv3: Set authority used in cert checks to host of endpoint
2019-10-08 15:35:27 -07:00
vimalk78
83bf125d93
clientv3: add nil checks in Close()
...
Added nil checks in Close() for Watcher and Lease fields
Added test case
2019-08-25 23:40:05 -07:00
Gyuho Lee
2a8d09b83b
clientv3: use Endpoints(), fix context creation
...
If overwritten, the previous context should be canceled first.
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-13 12:43:49 -07:00
Gyuho Lee
ab1db0dfd8
clientv3: deprecate "grpc.ErrClientConnClosing"
...
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-05 14:38:27 -07:00
Gyuho Lee
8c7c6ec0c1
clientv3/balancer: refactor
...
refactor + remove unused
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-26 09:19:19 -07:00
Gyuho Lee
3dc00ab615
clientv3: move auth token credential to "credentials" package
...
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-26 09:17:44 -07:00
Gyuho Lee
db7231accc
clientv3: use new "credentials" package
...
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-26 08:56:33 -07:00
Gyuho Lee
12ab2ee3c4
clientv3: do not use pointer to TransportCredentials interface
...
Interface in Go is already reference
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-26 08:52:31 -07:00
Gyuho Lee
1caaa9ed4a
test: test update for Go 1.12.5 and related changes
...
Update to Go 1.12.5 testing. Remove deprecated unused and gosimple
pacakges, and mask staticcheck 1006. Also, fix unconvert errors related
to unnecessary type conversions and following staticcheck errors:
- remove redundant return statements
- use for range instead of for select
- use time.Since instead of time.Now().Sub
- omit comparison to bool constant
- replace T.Fatal and T.Fatalf in tests with T.Error and T.Fatalf respectively because the goroutine calls T.Fatal must be called in the same goroutine as the test
- fix error strings that should not be capitalized
- use sort.Strings(...) instead of sort.Sort(sort.StringSlice(...))
- use he status code of Canceled instead of grpc.ErrClientConnClosing which is deprecated
- use use status.Errorf instead of grpc.Errorf which is deprecated
Related #10528 #10438
2019-06-05 17:02:05 -04:00
Gyuho Lee
34bd797e67
*: revert module import paths
...
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-05-28 15:39:35 -07:00
Gyuho Lee
e899023f3f
Merge pull request #10640 from shrajfr12/gomodulecompat
...
Fix module path to have the major version to comply with go modules specification.
2019-05-01 22:46:03 -07:00
shivaramr
9150bf52d6
go modules: Fix module path version to include version number
2019-04-26 15:29:50 -07:00
johncming
9b5c468dc6
clientv3: modify lock type.
2019-03-29 21:02:13 +08:00
johncming
662fd55084
clientv3: clean up unused code.
2019-03-18 10:34:41 +08:00
Gyuho Lee
4f46b65748
clientv3: use default info level log configuration
...
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-02-21 10:57:38 -08:00
cfc4n
a033686acf
clientv3/integration: return err if err == rpctypes.ErrAuthNotEnable
2019-02-02 14:06:54 +08:00
Gyuho Lee
61218004c0
clientv3: remove "JitterUp" imports
...
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-01-03 11:00:45 -08:00
Philipp Gillé
0cfc01b873
clientv3: Fix spelling in comment
2018-11-12 22:33:48 +01:00
Joe Betz
6a43db1eff
clientv3: Fix concurrent clientv3 client creation in 3.4 by using proper UUIDs
2018-10-22 14:08:58 -07:00
Sahdev P. Zala
f6f375109e
clientv3: let etcd client use all available keepalive ClientParams
...
We should allow etcd client use all of the available keepalive
client parameters as documented in this link,
https://godoc.org/google.golang.org/grpc/keepalive#ClientParameters
Currently in the etcd, by default PermitWithoutStream is set to
false, and user has no way to override it.
On the server side, we explicitely setting EnforcementPolicy
PermitWithoutStream to false and don't provide option to override it
to user but on the client side we should allow this option as
provided by the grpc.
2018-10-02 15:51:27 -04:00
Gyuho Lee
0ef9ef3c74
*: rerun "gofmt"
...
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-28 18:25:39 -07:00
Gyuho Lee
2ac04381a2
clientv3: update Go import paths to "go.etcd.io"
...
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-28 17:47:55 -07:00
Joe Betz
67bcf28c4e
clientv3: Use passthrough resolver for direct endpoint dialing
2018-07-27 10:15:02 -07:00
Joe Betz
b3b06a862a
clientv3: Fix maintenance APIs to directly dial grpc endpoints correctly.
2018-07-23 11:20:15 -07:00
Joe Betz
8451a1715f
clientv3: Enable balancer logging if ETCD_CLIENT_DEBUG environment variable is set
2018-06-15 16:28:36 -07:00
Gyuho Lee
6e521d2f3f
clientv3: add "IsConnCanceled", deprecate "grpc.ErrClientConnClosing"
...
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-06-15 14:47:08 -07:00
Gyuho Lee
a76681073d
clientv3: add "zap.Config" to replace global logger
...
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-06-15 13:41:28 -07:00
Gyuho Lee
dd520cebd4
clientv3: put "defaultCallOpts" back to "Client" object
...
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-06-15 13:41:28 -07:00
Joe Betz
a5b2fb5563
clientv3: Introduce custom retry interceptor based on go-grpc-middleware/retry
2018-06-15 13:41:28 -07:00
Gyuho Lee
4065735845
clientv3: remove unused "dialerrc"
...
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-06-15 13:41:28 -07:00
Joe Betz
8569b9c782
clientv3: Fix endpoint resolver to create a new resolver for each grpc client connection
2018-06-15 13:41:28 -07:00
Joe Betz
9304d1abd1
clientv3: Fix TLS test failures by returning DeadlineExceeded error from dial without any additional wrapping
2018-06-15 13:41:28 -07:00
Joe Betz
ee2747eba8
clientv3: Fix dial calls to consistently use endpoint resolver, attempt to deflake alarm test
2018-06-15 13:41:28 -07:00
Joe Betz
f84f554301
clientv3: Fix auth client to use endpoints instead of host when dialing, fix tests to block on dial when required.
2018-06-15 13:41:28 -07:00
Gyuho Lee
bb032f3e5f
clientv3: deprecate "grpc.WithTimeout" in favor of "grpc.DialContext"
...
"grpc.WithTimeout" dial option is being deprecated.
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-06-15 13:41:28 -07:00
Joe Betz
7ac2a2dd20
clientv3: Fix dialer for new balancer to correctly handle first are as endpoint, not hostname
2018-06-15 13:41:28 -07:00
Joe Betz
309208dbef
clientv3: Split out grpc balancer builder to ensure there is a balancer per ClientConn
2018-06-15 13:41:28 -07:00
Joe Betz
f20a1173d8
clientv3: Fix new load balancer integration issues
2018-06-15 13:41:28 -07:00
Joe Betz
6080fa1270
clientv3: Integrate new grpc load balancer interface with etcd client
2018-06-15 13:41:28 -07:00
Jordan Liggitt
d1579c95a2
clientv3: backoff on reestablishing watches when Unavailable errors are encountered
2018-06-13 02:05:04 -04:00
jiaxuanzhou
ad448fb280
clientv3: keep NewFromURL the same, add method NewFromURLs
2018-03-27 10:40:10 +08:00
jiaxuanzhou
e1bf612ee8
clientv3: optimize func NewFromURL
2018-03-27 09:30:12 +08:00
Hitoshi Mitake
b0ed5c1dd8
Merge pull request #8680 from mitake/auth-cleanup
...
*: don't use a string literal directly in grpc metadata
2018-03-20 18:19:23 +09:00
Gyuho Lee
3aa5711dca
clientv3: move health balancer to "balancer"
...
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-19 15:16:11 -07:00
Hitoshi Mitake
b1dd19a7aa
*: don't use string literals directly in grpc metadata
...
Current etcd code uses the string literals ("token", "authorization")
as field names of grpc and swappger metadata for passing token. It is
difficult to maintain so this commit introduces new constants for the
purpose.
2018-03-15 14:17:34 +09:00
Gyuho Lee
1f016f3b96
clientv3: use "pkg/logger"
...
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-05 13:40:58 -08:00
Sahdev P. Zala
3b7e2ce0ca
StatusFromError: handle return value of the function
...
status.FromError can return nil, false. We are handling the return values
most places in code but some places we aren't. Fixing it herewith.
Fixes #9117
2018-01-08 22:28:20 -05:00