diff --git a/examples/local/vstream_client.go b/examples/local/vstream_client.go index 98d2129f898..48d23247086 100644 --- a/examples/local/vstream_client.go +++ b/examples/local/vstream_client.go @@ -67,7 +67,7 @@ func main() { Filter: "select * from customer", }}, } - conn, err := vtgateconn.Dial(ctx, "localhost:15991") + conn, err := vtgateconn.Dial("localhost:15991") if err != nil { log.Fatal(err) } diff --git a/go.mod b/go.mod index bb329ebaf2f..5be276aa0f1 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/HdrHistogram/hdrhistogram-go v0.9.0 // indirect github.com/aquarapid/vaultlib v0.5.1 github.com/armon/go-metrics v0.4.1 // indirect - github.com/aws/aws-sdk-go v1.51.11 + github.com/aws/aws-sdk-go v1.51.14 github.com/buger/jsonparser v1.1.1 github.com/cespare/xxhash/v2 v2.2.0 github.com/corpix/uarand v0.1.1 // indirect @@ -50,7 +50,7 @@ require ( github.com/planetscale/pargzip v0.0.0-20201116224723-90c7fc03ea8a github.com/planetscale/vtprotobuf v0.5.0 github.com/prometheus/client_golang v1.19.0 - github.com/prometheus/common v0.51.1 + github.com/prometheus/common v0.52.2 github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 github.com/sjmudd/stopwatch v0.1.1 github.com/soheilhy/cmux v0.1.5 @@ -71,7 +71,7 @@ require ( go.uber.org/mock v0.2.0 golang.org/x/crypto v0.21.0 // indirect golang.org/x/mod v0.16.0 // indirect - golang.org/x/net v0.22.0 + golang.org/x/net v0.23.0 golang.org/x/oauth2 v0.18.0 golang.org/x/sys v0.18.0 golang.org/x/term v0.18.0 @@ -79,8 +79,8 @@ require ( golang.org/x/time v0.5.0 golang.org/x/tools v0.19.0 google.golang.org/api v0.172.0 - google.golang.org/genproto v0.0.0-20240325203815-454cdb8f5daa // indirect - google.golang.org/grpc v1.62.1 + google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda // indirect + google.golang.org/grpc v1.63.0 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 google.golang.org/grpc/examples v0.0.0-20210430044426-28078834f35b google.golang.org/protobuf v1.33.0 @@ -130,7 +130,7 @@ require ( github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/ebitengine/purego v0.6.1 // indirect + github.com/ebitengine/purego v0.7.0 // indirect github.com/fatih/color v1.16.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.1 // indirect @@ -142,7 +142,7 @@ require ( github.com/googleapis/gax-go/v2 v2.12.3 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-hclog v1.6.2 // indirect + github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect @@ -160,7 +160,7 @@ require ( github.com/outcaste-io/ristretto v0.2.3 // indirect github.com/pelletier/go-toml/v2 v2.2.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_model v0.6.0 // indirect + github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/procfs v0.13.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rivo/uniseg v0.4.7 // indirect @@ -185,15 +185,15 @@ require ( go.uber.org/zap v1.27.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240325203815-454cdb8f5daa // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240401170217-c3f982113cda // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect modernc.org/libc v1.49.0 // indirect modernc.org/mathutil v1.6.0 // indirect - modernc.org/memory v1.7.2 // indirect + modernc.org/memory v1.8.0 // indirect modernc.org/strutil v1.2.0 // indirect modernc.org/token v1.1.0 // indirect ) diff --git a/go.sum b/go.sum index 8e94244481f..7d408226a68 100644 --- a/go.sum +++ b/go.sum @@ -69,8 +69,8 @@ github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJ github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.51.11 h1:El5VypsMIz7sFwAAj/j06JX9UGs4KAbAIEaZ57bNY4s= -github.com/aws/aws-sdk-go v1.51.11/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.51.14 h1:qedX6zZEO1a+5kra+D4ythOYR3TgaROC0hTPxhTFh8I= +github.com/aws/aws-sdk-go v1.51.14/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -111,8 +111,8 @@ github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUn github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/ebitengine/purego v0.6.1 h1:sjN8rfzbhXQ59/pE+wInswbU9aMDHiwlup4p/a07Mkg= -github.com/ebitengine/purego v0.6.1/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= +github.com/ebitengine/purego v0.7.0 h1:HPZpl61edMGCEW6XK2nsR6+7AnJ3unUxpTZBkkIXnMc= +github.com/ebitengine/purego v0.7.0/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -235,8 +235,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= -github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -410,12 +410,12 @@ github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1: github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= -github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.51.1 h1:eIjN50Bwglz6a/c3hAgSMcofL3nD+nFQkV6Dd4DsQCw= -github.com/prometheus/common v0.51.1/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q= +github.com/prometheus/common v0.52.2 h1:LW8Vk7BccEdONfrJBDffQGRtpSzi5CQaRZGtboOO2ck= +github.com/prometheus/common v0.52.2/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= @@ -599,8 +599,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= -golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= @@ -705,12 +705,12 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20240325203815-454cdb8f5daa h1:ePqxpG3LVx+feAUOx8YmR5T7rc0rdzK8DyxM8cQ9zq0= -google.golang.org/genproto v0.0.0-20240325203815-454cdb8f5daa/go.mod h1:CnZenrTdRJb7jc+jOm0Rkywq+9wh0QC4U8tyiRbEPPM= -google.golang.org/genproto/googleapis/api v0.0.0-20240325203815-454cdb8f5daa h1:Jt1XW5PaLXF1/ePZrznsh/aAUvI7Adfc3LY1dAKlzRs= -google.golang.org/genproto/googleapis/api v0.0.0-20240325203815-454cdb8f5daa/go.mod h1:K4kfzHtI0kqWA79gecJarFtDn/Mls+GxQcg3Zox91Ac= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa h1:RBgMaUMP+6soRkik4VoN8ojR2nex2TqZwjSSogic+eo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda h1:wu/KJm9KJwpfHWhkkZGohVC6KRrc1oJNr4jwtQMOQXw= +google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda/go.mod h1:g2LLCvCeCSir/JJSWosk19BR4NVxGqHUC6rxIRsd7Aw= +google.golang.org/genproto/googleapis/api v0.0.0-20240401170217-c3f982113cda h1:b6F6WIV4xHHD0FA4oIyzU6mHWg2WI2X1RBehwa5QN38= +google.golang.org/genproto/googleapis/api v0.0.0-20240401170217-c3f982113cda/go.mod h1:AHcE/gZH76Bk/ROZhQphlRoWo5xKDEtz3eVEO1LfA8c= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= @@ -719,8 +719,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= -google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.63.0 h1:WjKe+dnvABXyPJMD7KDNLxtoGk5tgk+YFWN6cBWjZE8= +google.golang.org/grpc v1.63.0/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y= google.golang.org/grpc/examples v0.0.0-20210430044426-28078834f35b h1:D/GTYPo6I1oEo08Bfpuj3xl5XE+UGHj7//5fVyKxhsQ= @@ -788,8 +788,8 @@ modernc.org/libc v1.49.0 h1:/kkNBuCXvlTbOGwrQdgR67eK1Y9+kR+fhdBd89C64VM= modernc.org/libc v1.49.0/go.mod h1:DNz0lgQgT6FPIPm8rHtjFj0FL5/YOr/NYFXWYBcSxMw= modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= -modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E= -modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E= +modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E= +modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc= diff --git a/go/test/endtoend/cluster/cluster_process.go b/go/test/endtoend/cluster/cluster_process.go index 3ef4e8a1b3b..d374a245560 100644 --- a/go/test/endtoend/cluster/cluster_process.go +++ b/go/test/endtoend/cluster/cluster_process.go @@ -920,7 +920,7 @@ func (cluster *LocalProcessCluster) ExecOnVTGate(ctx context.Context, addr strin return nil, err } - conn, err := vtgateconn.Dial(ctx, addr) + conn, err := vtgateconn.Dial(addr) if err != nil { return nil, err } diff --git a/go/test/endtoend/cluster/cluster_util.go b/go/test/endtoend/cluster/cluster_util.go index 5d7869a421e..b76c1bf7c2a 100644 --- a/go/test/endtoend/cluster/cluster_util.go +++ b/go/test/endtoend/cluster/cluster_util.go @@ -483,13 +483,13 @@ func WaitForHealthyShard(vtctldclient *VtctldClientProcess, keyspace, shard stri } // DialVTGate returns a VTGate grpc connection. -func DialVTGate(ctx context.Context, name, addr, username, password string) (*vtgateconn.VTGateConn, error) { +func DialVTGate(name, addr, username, password string) (*vtgateconn.VTGateConn, error) { clientCreds := &grpcclient.StaticAuthClientCreds{Username: username, Password: password} creds := grpc.WithPerRPCCredentials(clientCreds) dialerFunc := grpcvtgateconn.Dial(creds) dialerName := name vtgateconn.RegisterDialer(dialerName, dialerFunc) - return vtgateconn.DialProtocol(ctx, dialerName, addr) + return vtgateconn.DialProtocol(dialerName, addr) } // PrintFiles prints the files that are asked for. If no file is specified, all the files are printed. diff --git a/go/test/endtoend/messaging/message_test.go b/go/test/endtoend/messaging/message_test.go index 7e1190c16bb..32c4401a1da 100644 --- a/go/test/endtoend/messaging/message_test.go +++ b/go/test/endtoend/messaging/message_test.go @@ -573,7 +573,7 @@ func VtgateGrpcConn(ctx context.Context, cluster *cluster.LocalProcessCluster) ( stream := new(VTGateStream) stream.ctx = ctx stream.host = fmt.Sprintf("%s:%d", cluster.Hostname, cluster.VtgateProcess.GrpcPort) - conn, err := vtgateconn.Dial(ctx, stream.host) + conn, err := vtgateconn.Dial(stream.host) // init components stream.respChan = make(chan *sqltypes.Result) stream.VTGateConn = conn diff --git a/go/test/endtoend/recovery/unshardedrecovery/recovery.go b/go/test/endtoend/recovery/unshardedrecovery/recovery.go index 1ebb7c2647f..cd3d5bd9f04 100644 --- a/go/test/endtoend/recovery/unshardedrecovery/recovery.go +++ b/go/test/endtoend/recovery/unshardedrecovery/recovery.go @@ -308,7 +308,7 @@ func TestRecoveryImpl(t *testing.T) { // Build vtgate grpc connection grpcAddress := fmt.Sprintf("%s:%d", localCluster.Hostname, localCluster.VtgateGrpcPort) - vtgateConn, err := vtgateconn.Dial(context.Background(), grpcAddress) + vtgateConn, err := vtgateconn.Dial(grpcAddress) assert.NoError(t, err) defer vtgateConn.Close() session := vtgateConn.Session("@replica", nil) diff --git a/go/test/endtoend/tabletgateway/vtgate_test.go b/go/test/endtoend/tabletgateway/vtgate_test.go index a48a22f2cb0..0c7b68b67e2 100644 --- a/go/test/endtoend/tabletgateway/vtgate_test.go +++ b/go/test/endtoend/tabletgateway/vtgate_test.go @@ -302,7 +302,7 @@ func TestStreamingRPCStuck(t *testing.T) { } // Connect to vtgate and run a streaming query. - vtgateConn, err := cluster.DialVTGate(ctx, t.Name(), vtgateGrpcAddress, "test_user", "") + vtgateConn, err := cluster.DialVTGate(t.Name(), vtgateGrpcAddress, "test_user", "") require.NoError(t, err) stream, err := vtgateConn.Session("", &querypb.ExecuteOptions{}).StreamExecute(ctx, "select * from customer", map[string]*querypb.BindVariable{}) require.NoError(t, err) diff --git a/go/test/endtoend/vreplication/vreplication_test.go b/go/test/endtoend/vreplication/vreplication_test.go index 4c72781df29..5005b2b0acc 100644 --- a/go/test/endtoend/vreplication/vreplication_test.go +++ b/go/test/endtoend/vreplication/vreplication_test.go @@ -513,7 +513,7 @@ func testVStreamCellFlag(t *testing.T) { for _, tc := range vstreamTestCases { t.Run("VStreamCellsFlag/"+tc.cells, func(t *testing.T) { - conn, err := vtgateconn.Dial(ctx, fmt.Sprintf("localhost:%d", vc.ClusterConfig.vtgateGrpcPort)) + conn, err := vtgateconn.Dial(fmt.Sprintf("localhost:%d", vc.ClusterConfig.vtgateGrpcPort)) require.NoError(t, err) defer conn.Close() diff --git a/go/test/endtoend/vreplication/vschema_load_test.go b/go/test/endtoend/vreplication/vschema_load_test.go index 6ca8dcfe472..a5c414ad3a0 100644 --- a/go/test/endtoend/vreplication/vschema_load_test.go +++ b/go/test/endtoend/vreplication/vschema_load_test.go @@ -94,7 +94,7 @@ func TestVSchemaChangesUnderLoad(t *testing.T) { Filter: "select * from customer", }}, } - conn, err := vtgateconn.Dial(ctx, net.JoinHostPort("localhost", strconv.Itoa(vc.ClusterConfig.vtgateGrpcPort))) + conn, err := vtgateconn.Dial(net.JoinHostPort("localhost", strconv.Itoa(vc.ClusterConfig.vtgateGrpcPort))) require.NoError(t, err) defer conn.Close() diff --git a/go/test/endtoend/vreplication/vstream_test.go b/go/test/endtoend/vreplication/vstream_test.go index e13c3e24e80..48fac9b0e00 100644 --- a/go/test/endtoend/vreplication/vstream_test.go +++ b/go/test/endtoend/vreplication/vstream_test.go @@ -58,7 +58,7 @@ func testVStreamWithFailover(t *testing.T, failover bool) { testVStreamFrom(t, vtgate, "product", 2) }) ctx := context.Background() - vstreamConn, err := vtgateconn.Dial(ctx, fmt.Sprintf("%s:%d", vc.ClusterConfig.hostname, vc.ClusterConfig.vtgateGrpcPort)) + vstreamConn, err := vtgateconn.Dial(fmt.Sprintf("%s:%d", vc.ClusterConfig.hostname, vc.ClusterConfig.vtgateGrpcPort)) if err != nil { log.Fatal(err) } @@ -259,7 +259,7 @@ func testVStreamStopOnReshardFlag(t *testing.T, stopOnReshard bool, baseTabletID vc.AddKeyspace(t, []*Cell{defaultCell}, "sharded", "-80,80-", vschemaSharded, schemaSharded, defaultReplicas, defaultRdonly, baseTabletID+200, nil) ctx := context.Background() - vstreamConn, err := vtgateconn.Dial(ctx, fmt.Sprintf("%s:%d", vc.ClusterConfig.hostname, vc.ClusterConfig.vtgateGrpcPort)) + vstreamConn, err := vtgateconn.Dial(fmt.Sprintf("%s:%d", vc.ClusterConfig.hostname, vc.ClusterConfig.vtgateGrpcPort)) if err != nil { log.Fatal(err) } @@ -398,7 +398,7 @@ func testVStreamCopyMultiKeyspaceReshard(t *testing.T, baseTabletID int) numEven require.NoError(t, err) ctx := context.Background() - vstreamConn, err := vtgateconn.Dial(ctx, fmt.Sprintf("%s:%d", vc.ClusterConfig.hostname, vc.ClusterConfig.vtgateGrpcPort)) + vstreamConn, err := vtgateconn.Dial(fmt.Sprintf("%s:%d", vc.ClusterConfig.hostname, vc.ClusterConfig.vtgateGrpcPort)) if err != nil { log.Fatal(err) } @@ -550,7 +550,7 @@ func TestMultiVStreamsKeyspaceReshard(t *testing.T) { defer vtgateConn.Close() verifyClusterHealth(t, vc) - vstreamConn, err := vtgateconn.Dial(ctx, fmt.Sprintf("%s:%d", vc.ClusterConfig.hostname, vc.ClusterConfig.vtgateGrpcPort)) + vstreamConn, err := vtgateconn.Dial(fmt.Sprintf("%s:%d", vc.ClusterConfig.hostname, vc.ClusterConfig.vtgateGrpcPort)) require.NoError(t, err) defer vstreamConn.Close() diff --git a/go/test/endtoend/vtcombo/recreate/recreate_test.go b/go/test/endtoend/vtcombo/recreate/recreate_test.go index e66edb7688a..1d21a32fbf9 100644 --- a/go/test/endtoend/vtcombo/recreate/recreate_test.go +++ b/go/test/endtoend/vtcombo/recreate/recreate_test.go @@ -95,7 +95,7 @@ func TestMain(m *testing.M) { func TestDropAndRecreateWithSameShards(t *testing.T) { ctx := context.Background() - conn, err := vtgateconn.Dial(ctx, grpcAddress) + conn, err := vtgateconn.Dial(grpcAddress) require.Nil(t, err) defer conn.Close() diff --git a/go/test/endtoend/vtcombo/vttest_sample_test.go b/go/test/endtoend/vtcombo/vttest_sample_test.go index daeb5e8deb9..bb09a4ad336 100644 --- a/go/test/endtoend/vtcombo/vttest_sample_test.go +++ b/go/test/endtoend/vtcombo/vttest_sample_test.go @@ -131,7 +131,7 @@ func TestStandalone(t *testing.T) { require.Contains(t, tmp[0], "vtcombo") ctx := context.Background() - conn, err := vtgateconn.Dial(ctx, grpcAddress) + conn, err := vtgateconn.Dial(grpcAddress) require.NoError(t, err) defer conn.Close() diff --git a/go/test/endtoend/vtgate/foreignkey/fk_test.go b/go/test/endtoend/vtgate/foreignkey/fk_test.go index 5a34a2b49c0..509dc3c88b9 100644 --- a/go/test/endtoend/vtgate/foreignkey/fk_test.go +++ b/go/test/endtoend/vtgate/foreignkey/fk_test.go @@ -182,7 +182,7 @@ func TestUpdateWithFK(t *testing.T) { // TestVstreamForFKBinLog tests that dml queries with fks are written with child row first approach in the binary logs. func TestVstreamForFKBinLog(t *testing.T) { - vtgateConn, err := cluster.DialVTGate(context.Background(), t.Name(), vtgateGrpcAddress, "fk_user", "") + vtgateConn, err := cluster.DialVTGate(t.Name(), vtgateGrpcAddress, "fk_user", "") require.NoError(t, err) defer vtgateConn.Close() diff --git a/go/test/endtoend/vtgate/grpc_api/acl_test.go b/go/test/endtoend/vtgate/grpc_api/acl_test.go index 2819a3e41d1..a5957523924 100644 --- a/go/test/endtoend/vtgate/grpc_api/acl_test.go +++ b/go/test/endtoend/vtgate/grpc_api/acl_test.go @@ -32,7 +32,7 @@ func TestEffectiveCallerIDWithAccess(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - vtgateConn, err := cluster.DialVTGate(ctx, t.Name(), vtgateGrpcAddress, "some_other_user", "test_password") + vtgateConn, err := cluster.DialVTGate(t.Name(), vtgateGrpcAddress, "some_other_user", "test_password") require.NoError(t, err) defer vtgateConn.Close() @@ -48,7 +48,7 @@ func TestEffectiveCallerIDWithNoAccess(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - vtgateConn, err := cluster.DialVTGate(ctx, t.Name(), vtgateGrpcAddress, "another_unrelated_user", "test_password") + vtgateConn, err := cluster.DialVTGate(t.Name(), vtgateGrpcAddress, "another_unrelated_user", "test_password") require.NoError(t, err) defer vtgateConn.Close() @@ -66,7 +66,7 @@ func TestAuthenticatedUserWithAccess(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - vtgateConn, err := cluster.DialVTGate(ctx, t.Name(), vtgateGrpcAddress, "user_with_access", "test_password") + vtgateConn, err := cluster.DialVTGate(t.Name(), vtgateGrpcAddress, "user_with_access", "test_password") require.NoError(t, err) defer vtgateConn.Close() @@ -81,7 +81,7 @@ func TestAuthenticatedUserNoAccess(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - vtgateConn, err := cluster.DialVTGate(ctx, t.Name(), vtgateGrpcAddress, "user_no_access", "test_password") + vtgateConn, err := cluster.DialVTGate(t.Name(), vtgateGrpcAddress, "user_no_access", "test_password") require.NoError(t, err) defer vtgateConn.Close() @@ -98,7 +98,7 @@ func TestUnauthenticatedUser(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - vtgateConn, err := cluster.DialVTGate(ctx, t.Name(), vtgateGrpcAddress, "", "") + vtgateConn, err := cluster.DialVTGate(t.Name(), vtgateGrpcAddress, "", "") require.NoError(t, err) defer vtgateConn.Close() diff --git a/go/test/endtoend/vtgate/grpc_api/execute_test.go b/go/test/endtoend/vtgate/grpc_api/execute_test.go index b1a5f3b8d80..2d57e065cdd 100644 --- a/go/test/endtoend/vtgate/grpc_api/execute_test.go +++ b/go/test/endtoend/vtgate/grpc_api/execute_test.go @@ -38,7 +38,7 @@ func TestTransactionsWithGRPCAPI(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - vtgateConn, err := cluster.DialVTGate(ctx, t.Name(), vtgateGrpcAddress, "user_with_access", "test_password") + vtgateConn, err := cluster.DialVTGate(t.Name(), vtgateGrpcAddress, "user_with_access", "test_password") require.NoError(t, err) defer vtgateConn.Close() diff --git a/go/test/endtoend/vtgate/queries/reference/main_test.go b/go/test/endtoend/vtgate/queries/reference/main_test.go index 4c9440ca4ff..8953573690a 100644 --- a/go/test/endtoend/vtgate/queries/reference/main_test.go +++ b/go/test/endtoend/vtgate/queries/reference/main_test.go @@ -156,7 +156,7 @@ func TestMain(m *testing.M) { go func() { ctx := context.Background() vtgateAddr := fmt.Sprintf("%s:%d", clusterInstance.Hostname, clusterInstance.VtgateProcess.GrpcPort) - vtgateConn, err := vtgateconn.Dial(ctx, vtgateAddr) + vtgateConn, err := vtgateconn.Dial(vtgateAddr) if err != nil { done <- false return @@ -234,7 +234,7 @@ func TestMain(m *testing.M) { ctx := context.Background() vtgateAddr := fmt.Sprintf("%s:%d", clusterInstance.Hostname, clusterInstance.VtgateProcess.GrpcPort) - vtgateConn, err := vtgateconn.Dial(ctx, vtgateAddr) + vtgateConn, err := vtgateconn.Dial(vtgateAddr) if err != nil { return 1 } diff --git a/go/vt/grpcclient/client.go b/go/vt/grpcclient/client.go index 7524298514e..5cbc4d7d41b 100644 --- a/go/vt/grpcclient/client.go +++ b/go/vt/grpcclient/client.go @@ -19,7 +19,6 @@ limitations under the License. package grpcclient import ( - "context" "crypto/tls" "sync" "time" @@ -97,16 +96,6 @@ func RegisterGRPCDialOptions(grpcDialOptionsFunc func(opts []grpc.DialOption) ([ // failFast is a non-optional parameter because callers are required to specify // what that should be. func Dial(target string, failFast FailFast, opts ...grpc.DialOption) (*grpc.ClientConn, error) { - return DialContext(context.Background(), target, failFast, opts...) -} - -// DialContext creates a grpc connection to the given target. Setup steps are -// covered by the context deadline, and, if WithBlock is specified in the dial -// options, connection establishment steps are covered by the context as well. -// -// failFast is a non-optional parameter because callers are required to specify -// what that should be. -func DialContext(ctx context.Context, target string, failFast FailFast, opts ...grpc.DialOption) (*grpc.ClientConn, error) { msgSize := grpccommon.MaxMessageSize() newopts := []grpc.DialOption{ grpc.WithDefaultCallOptions( @@ -149,7 +138,7 @@ func DialContext(ctx context.Context, target string, failFast FailFast, opts ... newopts = append(newopts, interceptors()...) - return grpc.DialContext(ctx, target, newopts...) + return grpc.NewClient(target, newopts...) } func interceptors() []grpc.DialOption { diff --git a/go/vt/grpcoptionaltls/server_test.go b/go/vt/grpcoptionaltls/server_test.go index e419294b172..32fdfdc154d 100755 --- a/go/vt/grpcoptionaltls/server_test.go +++ b/go/vt/grpcoptionaltls/server_test.go @@ -97,7 +97,7 @@ func TestOptionalTLS(t *testing.T) { testFunc := func(t *testing.T, dialOpt grpc.DialOption) { ctx, cancel := context.WithTimeout(testCtx, 5*time.Second) defer cancel() - conn, err := grpc.DialContext(ctx, addr, dialOpt) + conn, err := grpc.NewClient(addr, dialOpt) if err != nil { t.Fatalf("failed to connect to the server %v", err) } diff --git a/go/vt/vitessdriver/driver.go b/go/vt/vitessdriver/driver.go index 4a965399e9c..554c5efc9cb 100644 --- a/go/vt/vitessdriver/driver.go +++ b/go/vt/vitessdriver/driver.go @@ -174,13 +174,13 @@ func (d drv) newConnector(cfg Configuration) (driver.Connector, error) { } // Connect implements the database/sql/driver.Connector interface. -func (c *connector) Connect(ctx context.Context) (driver.Conn, error) { +func (c *connector) Connect(_ context.Context) (driver.Conn, error) { conn := &conn{ cfg: c.cfg, convert: c.convert, } - if err := conn.dial(ctx); err != nil { + if err := conn.dial(); err != nil { return nil, err } @@ -267,9 +267,9 @@ type conn struct { session *vtgateconn.VTGateSession } -func (c *conn) dial(ctx context.Context) error { +func (c *conn) dial() error { var err error - c.conn, err = vtgateconn.DialProtocol(ctx, c.cfg.Protocol, c.cfg.Address) + c.conn, err = vtgateconn.DialProtocol(c.cfg.Protocol, c.cfg.Address) if err != nil { return err } diff --git a/go/vt/vtadmin/grpcserver/server_test.go b/go/vt/vtadmin/grpcserver/server_test.go index 4f43c4413ce..53f0cbcd48c 100644 --- a/go/vt/vtadmin/grpcserver/server_test.go +++ b/go/vt/vtadmin/grpcserver/server_test.go @@ -64,7 +64,7 @@ func TestServer(t *testing.T) { } close(readyCh) - conn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + conn, err := grpc.NewClient(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) assert.NoError(t, err) defer conn.Close() diff --git a/go/vt/vtgate/endtoend/vstream_test.go b/go/vt/vtgate/endtoend/vstream_test.go index 871e6cf98c3..0c3c6a6f2cd 100644 --- a/go/vt/vtgate/endtoend/vstream_test.go +++ b/go/vt/vtgate/endtoend/vstream_test.go @@ -41,7 +41,7 @@ import ( ) func initialize(ctx context.Context, t *testing.T) (*vtgateconn.VTGateConn, *mysql.Conn, *mysql.Conn, func()) { - gconn, err := vtgateconn.Dial(ctx, grpcAddress) + gconn, err := vtgateconn.Dial(grpcAddress) if err != nil { t.Fatal(err) } diff --git a/go/vt/vtgate/fakerpcvtgateconn/conn.go b/go/vt/vtgate/fakerpcvtgateconn/conn.go index 3f6236ea9ec..3c2ed352f14 100644 --- a/go/vt/vtgate/fakerpcvtgateconn/conn.go +++ b/go/vt/vtgate/fakerpcvtgateconn/conn.go @@ -61,7 +61,7 @@ func RegisterFakeVTGateConnDialer() (*FakeVTGateConn, string) { impl := &FakeVTGateConn{ execMap: make(map[string]*queryResponse), } - vtgateconn.RegisterDialer(protocol, func(ctx context.Context, address string) (vtgateconn.Impl, error) { + vtgateconn.RegisterDialer(protocol, func(address string) (vtgateconn.Impl, error) { return impl, nil }) return impl, protocol diff --git a/go/vt/vtgate/grpcvtgateconn/conn.go b/go/vt/vtgate/grpcvtgateconn/conn.go index a681e3661cd..d2b40aef6b7 100644 --- a/go/vt/vtgate/grpcvtgateconn/conn.go +++ b/go/vt/vtgate/grpcvtgateconn/conn.go @@ -72,13 +72,13 @@ type vtgateConn struct { c vtgateservicepb.VitessClient } -func dial(ctx context.Context, addr string) (vtgateconn.Impl, error) { - return Dial()(ctx, addr) +func dial(addr string) (vtgateconn.Impl, error) { + return Dial()(addr) } // Dial produces a vtgateconn.DialerFunc with custom options. func Dial(opts ...grpc.DialOption) vtgateconn.DialerFunc { - return func(ctx context.Context, address string) (vtgateconn.Impl, error) { + return func(address string) (vtgateconn.Impl, error) { opt, err := grpcclient.SecureDialOption(cert, key, ca, crl, name) if err != nil { return nil, err @@ -86,7 +86,7 @@ func Dial(opts ...grpc.DialOption) vtgateconn.DialerFunc { opts = append(opts, opt) - cc, err := grpcclient.DialContext(ctx, address, grpcclient.FailFast(false), opts...) + cc, err := grpcclient.Dial(address, grpcclient.FailFast(false), opts...) if err != nil { return nil, err } @@ -99,14 +99,6 @@ func Dial(opts ...grpc.DialOption) vtgateconn.DialerFunc { } } -// DialWithOpts allows for custom dial options to be set on a vtgateConn. -// -// Deprecated: the context parameter cannot be used by the returned -// vtgateconn.DialerFunc and thus has no effect. Use Dial instead. -func DialWithOpts(_ context.Context, opts ...grpc.DialOption) vtgateconn.DialerFunc { - return Dial(opts...) -} - func (conn *vtgateConn) Execute(ctx context.Context, session *vtgatepb.Session, query string, bindVars map[string]*querypb.BindVariable) (*vtgatepb.Session, *sqltypes.Result, error) { request := &vtgatepb.ExecuteRequest{ CallerId: callerid.EffectiveCallerIDFromContext(ctx), diff --git a/go/vt/vtgate/grpcvtgateconn/conn_rpc_test.go b/go/vt/vtgate/grpcvtgateconn/conn_rpc_test.go index 55a067807bd..6053c1e1536 100644 --- a/go/vt/vtgate/grpcvtgateconn/conn_rpc_test.go +++ b/go/vt/vtgate/grpcvtgateconn/conn_rpc_test.go @@ -50,8 +50,7 @@ func TestGRPCVTGateConn(t *testing.T) { go server.Serve(listener) // Create a Go RPC client connecting to the server - ctx := context.Background() - client, err := dial(ctx, listener.Addr().String()) + client, err := dial(listener.Addr().String()) if err != nil { t.Fatalf("dial failed: %v", err) } @@ -104,7 +103,6 @@ func TestGRPCVTGateConnAuth(t *testing.T) { } // Create a Go RPC client connecting to the server - ctx := context.Background() fs := pflag.NewFlagSet("", pflag.ContinueOnError) grpcclient.RegisterFlags(fs) @@ -114,7 +112,7 @@ func TestGRPCVTGateConnAuth(t *testing.T) { f.Name(), }) require.NoError(t, err, "failed to set `--grpc_auth_static_client_creds=%s`", f.Name()) - client, err := dial(ctx, listener.Addr().String()) + client, err := dial(listener.Addr().String()) if err != nil { t.Fatalf("dial failed: %v", err) } @@ -145,7 +143,6 @@ func TestGRPCVTGateConnAuth(t *testing.T) { } // Create a Go RPC client connecting to the server - ctx = context.Background() fs = pflag.NewFlagSet("", pflag.ContinueOnError) grpcclient.RegisterFlags(fs) @@ -155,12 +152,12 @@ func TestGRPCVTGateConnAuth(t *testing.T) { f.Name(), }) require.NoError(t, err, "failed to set `--grpc_auth_static_client_creds=%s`", f.Name()) - client, err = dial(ctx, listener.Addr().String()) + client, err = dial(listener.Addr().String()) if err != nil { t.Fatalf("dial failed: %v", err) } RegisterTestDialProtocol(client) - conn, _ := vtgateconn.DialProtocol(context.Background(), "test", "") + conn, _ := vtgateconn.DialProtocol("test", "") // run the test suite _, err = conn.Session("", nil).Execute(context.Background(), "select * from t", nil) want := "rpc error: code = Unauthenticated desc = username and password must be provided" diff --git a/go/vt/vtgate/grpcvtgateconn/suite_test.go b/go/vt/vtgate/grpcvtgateconn/suite_test.go index e5cd5c3ac81..25d81802bf4 100644 --- a/go/vt/vtgate/grpcvtgateconn/suite_test.go +++ b/go/vt/vtgate/grpcvtgateconn/suite_test.go @@ -261,7 +261,7 @@ func CreateFakeServer(t *testing.T) vtgateservice.VTGateService { // RegisterTestDialProtocol registers a vtgateconn implementation under the "test" protocol func RegisterTestDialProtocol(impl vtgateconn.Impl) { - vtgateconn.RegisterDialer("test", func(ctx context.Context, address string) (vtgateconn.Impl, error) { + vtgateconn.RegisterDialer("test", func(address string) (vtgateconn.Impl, error) { return impl, nil }) } @@ -277,10 +277,10 @@ func (f *fakeVTGateService) HandlePanic(err *error) { // RunTests runs all the tests func RunTests(t *testing.T, impl vtgateconn.Impl, fakeServer vtgateservice.VTGateService) { - vtgateconn.RegisterDialer("test", func(ctx context.Context, address string) (vtgateconn.Impl, error) { + vtgateconn.RegisterDialer("test", func(address string) (vtgateconn.Impl, error) { return impl, nil }) - conn, err := vtgateconn.DialProtocol(context.Background(), "test", "") + conn, err := vtgateconn.DialProtocol("test", "") if err != nil { t.Fatalf("Got err: %v from vtgateconn.DialProtocol", err) } @@ -304,7 +304,7 @@ func RunTests(t *testing.T, impl vtgateconn.Impl, fakeServer vtgateservice.VTGat // RunErrorTests runs all the tests that expect errors func RunErrorTests(t *testing.T, fakeServer vtgateservice.VTGateService) { - conn, err := vtgateconn.DialProtocol(context.Background(), "test", "") + conn, err := vtgateconn.DialProtocol("test", "") if err != nil { t.Fatalf("Got err: %v from vtgateconn.DialProtocol", err) } diff --git a/go/vt/vtgate/vtgateconn/vtgateconn.go b/go/vt/vtgate/vtgateconn/vtgateconn.go index ae0da3fdf43..f1f0fd77f39 100644 --- a/go/vt/vtgate/vtgateconn/vtgateconn.go +++ b/go/vt/vtgate/vtgateconn/vtgateconn.go @@ -190,7 +190,7 @@ type Impl interface { // DialerFunc represents a function that will return an Impl // object that can communicate with a VTGate. -type DialerFunc func(ctx context.Context, address string) (Impl, error) +type DialerFunc func(address string) (Impl, error) var ( dialers = make(map[string]DialerFunc) @@ -221,7 +221,7 @@ func DeregisterDialer(name string) { } // DialProtocol dials a specific protocol, and returns the *VTGateConn -func DialProtocol(ctx context.Context, protocol string, address string) (*VTGateConn, error) { +func DialProtocol(protocol string, address string) (*VTGateConn, error) { dialersM.Lock() dialer, ok := dialers[protocol] dialersM.Unlock() @@ -229,7 +229,7 @@ func DialProtocol(ctx context.Context, protocol string, address string) (*VTGate if !ok { return nil, fmt.Errorf("no dialer registered for VTGate protocol %s", protocol) } - impl, err := dialer(ctx, address) + impl, err := dialer(address) if err != nil { return nil, err } @@ -240,6 +240,6 @@ func DialProtocol(ctx context.Context, protocol string, address string) (*VTGate // Dial dials using the command-line specified protocol, and returns // the *VTGateConn. -func Dial(ctx context.Context, address string) (*VTGateConn, error) { - return DialProtocol(ctx, vtgateProtocol, address) +func Dial(address string) (*VTGateConn, error) { + return DialProtocol(vtgateProtocol, address) } diff --git a/go/vt/vtgate/vtgateconn/vtgateconn_test.go b/go/vt/vtgate/vtgateconn/vtgateconn_test.go index 523492328e9..04c696c5a8a 100644 --- a/go/vt/vtgate/vtgateconn/vtgateconn_test.go +++ b/go/vt/vtgate/vtgateconn/vtgateconn_test.go @@ -17,12 +17,11 @@ limitations under the License. package vtgateconn import ( - "context" "testing" ) func TestRegisterDialer(t *testing.T) { - dialerFunc := func(context.Context, string) (Impl, error) { + dialerFunc := func(string) (Impl, error) { return nil, nil } RegisterDialer("test1", dialerFunc) @@ -31,14 +30,14 @@ func TestRegisterDialer(t *testing.T) { func TestGetDialerWithProtocol(t *testing.T) { protocol := "test2" - _, err := DialProtocol(context.Background(), protocol, "") + _, err := DialProtocol(protocol, "") if err == nil || err.Error() != "no dialer registered for VTGate protocol "+protocol { t.Fatalf("protocol: %s is not registered, should return error: %v", protocol, err) } - RegisterDialer(protocol, func(context.Context, string) (Impl, error) { + RegisterDialer(protocol, func(string) (Impl, error) { return nil, nil }) - c, err := DialProtocol(context.Background(), protocol, "") + c, err := DialProtocol(protocol, "") if err != nil || c == nil { t.Fatalf("dialerFunc has been registered, should not get nil: %v %v", err, c) } @@ -47,13 +46,13 @@ func TestGetDialerWithProtocol(t *testing.T) { func TestDeregisterDialer(t *testing.T) { const protocol = "test3" - RegisterDialer(protocol, func(context.Context, string) (Impl, error) { + RegisterDialer(protocol, func(string) (Impl, error) { return nil, nil }) DeregisterDialer(protocol) - _, err := DialProtocol(context.Background(), protocol, "") + _, err := DialProtocol(protocol, "") if err == nil || err.Error() != "no dialer registered for VTGate protocol "+protocol { t.Fatalf("protocol: %s is not registered, should return error: %v", protocol, err) } diff --git a/go/vt/vttablet/endtoend/framework/server.go b/go/vt/vttablet/endtoend/framework/server.go index 42f2994a22c..b1bba0c5d84 100644 --- a/go/vt/vttablet/endtoend/framework/server.go +++ b/go/vt/vttablet/endtoend/framework/server.go @@ -64,7 +64,7 @@ func StartCustomServer(ctx context.Context, connParams, connAppDebugParams mysql // Setup a fake vtgate server. protocol := "resolveTest" vtgateconn.SetVTGateProtocol(protocol) - vtgateconn.RegisterDialer(protocol, func(context.Context, string) (vtgateconn.Impl, error) { + vtgateconn.RegisterDialer(protocol, func(string) (vtgateconn.Impl, error) { return &txResolver{ FakeVTGateConn: fakerpcvtgateconn.FakeVTGateConn{}, }, nil diff --git a/go/vt/vttablet/grpctmclient/cached_client.go b/go/vt/vttablet/grpctmclient/cached_client.go index c0dd751ec30..30577684048 100644 --- a/go/vt/vttablet/grpctmclient/cached_client.go +++ b/go/vt/vttablet/grpctmclient/cached_client.go @@ -143,7 +143,7 @@ func (dialer *cachedConnDialer) dial(ctx context.Context, tablet *topodatapb.Tab dialer.connWaitSema.Release(1) return client, closer, err } - return dialer.newdial(ctx, addr) + return dialer.newdial(addr) } defer func() { @@ -156,7 +156,7 @@ func (dialer *cachedConnDialer) dial(ctx context.Context, tablet *topodatapb.Tab dialerStats.DialTimeouts.Add(1) return nil, nil, ctx.Err() default: - if client, closer, found, err := dialer.pollOnce(ctx, addr); found { + if client, closer, found, err := dialer.pollOnce(addr); found { return client, closer, err } } @@ -204,7 +204,7 @@ func (dialer *cachedConnDialer) tryFromCache(addr string, locker sync.Locker) (c // // It returns a TabletManagerClient impl, an io.Closer, a flag to indicate // whether the dial() poll loop should exit, and an error. -func (dialer *cachedConnDialer) pollOnce(ctx context.Context, addr string) (client tabletmanagerservicepb.TabletManagerClient, closer io.Closer, found bool, err error) { +func (dialer *cachedConnDialer) pollOnce(addr string) (client tabletmanagerservicepb.TabletManagerClient, closer io.Closer, found bool, err error) { dialer.m.Lock() if client, closer, found, err := dialer.tryFromCache(addr, nil); found { @@ -225,7 +225,7 @@ func (dialer *cachedConnDialer) pollOnce(ctx context.Context, addr string) (clie conn.cc.Close() dialer.m.Unlock() - client, closer, err = dialer.newdial(ctx, addr) + client, closer, err = dialer.newdial(addr) return client, closer, true, err } @@ -236,14 +236,14 @@ func (dialer *cachedConnDialer) pollOnce(ctx context.Context, addr string) (clie // // It returns the three-tuple of client-interface, closer, and error that the // main dial func returns. -func (dialer *cachedConnDialer) newdial(ctx context.Context, addr string) (tabletmanagerservicepb.TabletManagerClient, io.Closer, error) { +func (dialer *cachedConnDialer) newdial(addr string) (tabletmanagerservicepb.TabletManagerClient, io.Closer, error) { opt, err := grpcclient.SecureDialOption(cert, key, ca, crl, name) if err != nil { dialer.connWaitSema.Release(1) return nil, nil, err } - cc, err := grpcclient.DialContext(ctx, addr, grpcclient.FailFast(false), opt) + cc, err := grpcclient.Dial(addr, grpcclient.FailFast(false), opt) if err != nil { dialer.connWaitSema.Release(1) return nil, nil, err diff --git a/go/vt/vttablet/grpctmclient/client_test.go b/go/vt/vttablet/grpctmclient/client_test.go index f842b216d8c..3b5b90f2a9f 100644 --- a/go/vt/vttablet/grpctmclient/client_test.go +++ b/go/vt/vttablet/grpctmclient/client_test.go @@ -60,7 +60,7 @@ func TestDialDedicatedPool(t *testing.T) { c := rpcClient.rpcDialPoolMap[dialPoolGroupThrottler][addr] assert.NotNil(t, c) - assert.Contains(t, []connectivity.State{connectivity.Connecting, connectivity.TransientFailure}, c.cc.GetState()) + assert.Contains(t, []connectivity.State{connectivity.Idle, connectivity.Connecting, connectivity.TransientFailure}, c.cc.GetState()) cachedTmc = c }) @@ -119,7 +119,7 @@ func TestDialPool(t *testing.T) { ch <- cachedTmc assert.NotNil(t, cachedTmc) - assert.Contains(t, []connectivity.State{connectivity.Connecting, connectivity.TransientFailure}, cachedTmc.cc.GetState()) + assert.Contains(t, []connectivity.State{connectivity.Idle, connectivity.Connecting, connectivity.TransientFailure}, cachedTmc.cc.GetState()) }) t.Run("CheckThrottler", func(t *testing.T) { @@ -144,7 +144,7 @@ func TestDialPool(t *testing.T) { assert.NotEmpty(t, rpcClient.rpcClientMap) assert.NotEmpty(t, rpcClient.rpcClientMap[addr]) - assert.Contains(t, []connectivity.State{connectivity.Connecting, connectivity.TransientFailure}, cachedTmc.cc.GetState()) + assert.Contains(t, []connectivity.State{connectivity.Idle, connectivity.Connecting, connectivity.TransientFailure}, cachedTmc.cc.GetState()) }) t.Run("ExecuteFetchAsDba", func(t *testing.T) { ctx, cancel := context.WithTimeout(ctx, time.Second) @@ -172,6 +172,6 @@ func TestDialPool(t *testing.T) { assert.NotEmpty(t, rpcClient.rpcClientMap[addr]) assert.NotNil(t, cachedTmc) - assert.Contains(t, []connectivity.State{connectivity.Connecting, connectivity.TransientFailure}, cachedTmc.cc.GetState()) + assert.Contains(t, []connectivity.State{connectivity.Idle, connectivity.Connecting, connectivity.TransientFailure}, cachedTmc.cc.GetState()) }) } diff --git a/go/vt/vttablet/tabletserver/tx_engine.go b/go/vt/vttablet/tabletserver/tx_engine.go index 7e8ecc06a75..cb8c3e6e51c 100644 --- a/go/vt/vttablet/tabletserver/tx_engine.go +++ b/go/vt/vttablet/tabletserver/tx_engine.go @@ -480,7 +480,7 @@ func (te *TxEngine) startWatchdog() { return } - coordConn, err := vtgateconn.Dial(ctx, te.coordinatorAddress) + coordConn, err := vtgateconn.Dial(te.coordinatorAddress) if err != nil { te.env.Stats().InternalErrors.Add("WatchdogFail", 1) log.Errorf("Error connecting to coordinator '%v': %v", te.coordinatorAddress, err) diff --git a/go/vt/vttablet/tabletserver/tx_executor_test.go b/go/vt/vttablet/tabletserver/tx_executor_test.go index 2651eb2a6cc..fe34171fea5 100644 --- a/go/vt/vttablet/tabletserver/tx_executor_test.go +++ b/go/vt/vttablet/tabletserver/tx_executor_test.go @@ -454,7 +454,7 @@ func TestExecutorResolveTransaction(t *testing.T) { defer func() { vtgateconn.SetVTGateProtocol(oldValue) }() - vtgateconn.RegisterDialer(protocol, func(context.Context, string) (vtgateconn.Impl, error) { + vtgateconn.RegisterDialer(protocol, func(string) (vtgateconn.Impl, error) { return &FakeVTGateConn{ FakeVTGateConn: fakerpcvtgateconn.FakeVTGateConn{}, }, nil diff --git a/go/vtbench/client.go b/go/vtbench/client.go index 1a6751a62db..1dbb1c6a016 100644 --- a/go/vtbench/client.go +++ b/go/vtbench/client.go @@ -93,7 +93,7 @@ func (c *grpcVtgateConn) connect(ctx context.Context, cp ConnParams) error { conn, ok := vtgateConns[address] if !ok { var err error - conn, err = vtgateconn.DialProtocol(ctx, "grpc", address) + conn, err = vtgateconn.DialProtocol("grpc", address) if err != nil { return err } diff --git a/tools/rowlog/rowlog.go b/tools/rowlog/rowlog.go index 8092159c6b6..20c9ac7902e 100644 --- a/tools/rowlog/rowlog.go +++ b/tools/rowlog/rowlog.go @@ -154,7 +154,7 @@ func startStreaming(ctx context.Context, vtgate, vtctld, keyspace, tablet, table }}, FieldEventMode: 1, } - conn, err := vtgateconn.Dial(ctx, vtgate) + conn, err := vtgateconn.Dial(vtgate) if err != nil { log.Fatal(err) }