From 45f9c6cd2ee6656afbbafc0acc71b1c6b390c6d9 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Ferrero Date: Thu, 1 Dec 2022 17:15:27 +0100 Subject: [PATCH] chore: bump deps (#3944) --- .github/workflows/pr-e2e.yml | 2 +- go.mod | 10 +- go.sum | 16 +- .../kusto/data/errors/errors.go | 1 + .../kusto/internal/version/version.go | 2 +- .../azure-kusto-go/kusto/query_builder.go | 18 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 135 ++++++++-- .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- vendor/github.com/gocql/gocql/.travis.yml | 0 vendor/github.com/gocql/gocql/AUTHORS | 1 + vendor/github.com/gocql/gocql/CHANGELOG.md | 10 + vendor/github.com/gocql/gocql/README.md | 14 +- vendor/github.com/gocql/gocql/conn.go | 14 +- .../github.com/gocql/gocql/connectionpool.go | 4 +- vendor/github.com/gocql/gocql/debug_off.go | 1 + vendor/github.com/gocql/gocql/debug_on.go | 1 + vendor/github.com/gocql/gocql/doc.go | 251 +++++++++--------- vendor/github.com/gocql/gocql/fuzz.go | 1 + .../github.com/gocql/gocql/host_source_gen.go | 1 + vendor/github.com/gocql/gocql/marshal.go | 138 +++++----- vendor/github.com/gocql/gocql/policies.go | 141 ++++++++-- vendor/github.com/gocql/gocql/session.go | 17 +- vendor/modules.txt | 8 +- 23 files changed, 500 insertions(+), 288 deletions(-) delete mode 100644 vendor/github.com/gocql/gocql/.travis.yml diff --git a/.github/workflows/pr-e2e.yml b/.github/workflows/pr-e2e.yml index 2f7dd463bbe..b5efee52c5b 100644 --- a/.github/workflows/pr-e2e.yml +++ b/.github/workflows/pr-e2e.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: tspascoal/get-user-teams-membership@v1 + - uses: tspascoal/get-user-teams-membership@v2 id: checkUserMember with: username: ${{ github.actor }} diff --git a/go.mod b/go.mod index 14516be3920..9bbfe339eab 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( cloud.google.com/go/storage v1.28.0 github.com/Azure/azure-amqp-common-go/v3 v3.2.3 github.com/Azure/azure-event-hubs-go/v3 v3.3.20 - github.com/Azure/azure-kusto-go v0.9.1 + github.com/Azure/azure-kusto-go v0.9.2 github.com/Azure/azure-sdk-for-go v67.1.0+incompatible github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 @@ -21,7 +21,7 @@ require ( github.com/DataDog/datadog-api-client-go v1.16.0 github.com/Huawei/gophercloud v1.0.21 github.com/Shopify/sarama v1.37.2 - github.com/aws/aws-sdk-go v1.44.146 + github.com/aws/aws-sdk-go v1.44.150 github.com/denisenkom/go-mssqldb v0.12.3 github.com/dysnix/predictkube-libs v0.0.4-0.20220717101015-44c816c4fb9c github.com/dysnix/predictkube-proto v0.0.0-20220713123213-7135dce1e9c9 @@ -31,8 +31,9 @@ require ( github.com/go-redis/redis/v8 v8.11.5 github.com/go-sql-driver/mysql v1.6.0 github.com/gobwas/glob v0.2.3 - github.com/gocql/gocql v1.2.1 + github.com/gocql/gocql v1.3.0 github.com/golang/mock v1.6.0 + github.com/golang/protobuf v1.5.2 github.com/google/go-cmp v0.5.9 github.com/gophercloud/gophercloud v1.1.0 github.com/hashicorp/vault/api v1.8.2 @@ -75,7 +76,7 @@ require ( k8s.io/metrics v0.25.4 knative.dev/pkg v0.0.0-20221123154742-05b694ec4d3a sigs.k8s.io/controller-runtime v0.13.1 - sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20221128144407-9489eb5b6c77 + sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20221201045826-d9912251cd81 sigs.k8s.io/controller-tools v0.10.0 sigs.k8s.io/custom-metrics-apiserver v1.25.1 sigs.k8s.io/kustomize/kustomize/v4 v4.5.7 @@ -157,7 +158,6 @@ require ( github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/gnostic v0.6.9 // indirect github.com/google/go-querystring v1.1.0 // indirect diff --git a/go.sum b/go.sum index 21c105322e2..ae172c0a511 100644 --- a/go.sum +++ b/go.sum @@ -51,8 +51,8 @@ github.com/Azure/azure-amqp-common-go/v3 v3.2.3 h1:uDF62mbd9bypXWi19V1bN5NZEO84J github.com/Azure/azure-amqp-common-go/v3 v3.2.3/go.mod h1:7rPmbSfszeovxGfc5fSAXE4ehlXQZHpMja2OtxC2Tas= github.com/Azure/azure-event-hubs-go/v3 v3.3.20 h1:LRAy00JlV5aDqd0LFXwfwFReYzl03CtH/kD91OHrT94= github.com/Azure/azure-event-hubs-go/v3 v3.3.20/go.mod h1:5GkwDWncbqGCPjf76khiylOAD2NjkrUrLFb/S99BiA8= -github.com/Azure/azure-kusto-go v0.9.1 h1:DRYvfdynXbmicz6aV3buvO0opYyTaoLPuBN/OcD2TQM= -github.com/Azure/azure-kusto-go v0.9.1/go.mod h1:i7WCtgt4XeHge3+Oi5sq84HYhneNi7VY7hr35wsUdrg= +github.com/Azure/azure-kusto-go v0.9.2 h1:AP0bNhGyvc51XHi6nBMABDjCqgJb/KGrCrcm7KvYFyk= +github.com/Azure/azure-kusto-go v0.9.2/go.mod h1:i7WCtgt4XeHge3+Oi5sq84HYhneNi7VY7hr35wsUdrg= github.com/Azure/azure-pipeline-go v0.1.8/go.mod h1:XA1kFWRVhSK+KNFiOhfv83Fv8L9achrP7OxIzeTn1Yg= github.com/Azure/azure-pipeline-go v0.2.3 h1:7U9HBg1JFK3jHl5qmo4CTZKFTVgMwdFHMVtCdfBE21U= github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k= @@ -160,8 +160,8 @@ github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgI github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/aws/aws-sdk-go v1.44.146 h1:7YdGgPxDPRJu/yYffzZp/H7yHzQ6AqmuNFZPYraaN8I= -github.com/aws/aws-sdk-go v1.44.146/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.150 h1:X9HBhXu0ZPi+tOHUaZkjx43int7g0Ejk+IVbW25+wYg= +github.com/aws/aws-sdk-go v1.44.150/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -350,8 +350,8 @@ github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22 github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/gocql/gocql v1.2.1 h1:G/STxUzD6pGvRHzG0Fi7S04SXejMKBbRZb7pwre1edU= -github.com/gocql/gocql v1.2.1/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8= +github.com/gocql/gocql v1.3.0 h1:xAopLb2b1xCkWVrfWA5k8sOOr0wUwI4ewl9+ArNu0ag= +github.com/gocql/gocql v1.3.0/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.2.0+incompatible h1:yyYWMnhkhrKwwr8gAOcOCYxOOscHgDS9yZgBrnJfGa0= @@ -1372,8 +1372,8 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.33 h1:LYqFq+6Cj2D0g sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.33/go.mod h1:soWkSNf2tZC7aMibXEqVhCd73GOY5fJikn8qbdzemB0= sigs.k8s.io/controller-runtime v0.13.1 h1:tUsRCSJVM1QQOOeViGeX3GMT3dQF1eePPw6sEE3xSlg= sigs.k8s.io/controller-runtime v0.13.1/go.mod h1:Zbz+el8Yg31jubvAEyglRZGdLAjplZl+PgtYNI6WNTI= -sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20221128144407-9489eb5b6c77 h1:FxASXFYBbBgGhOJutMpHaF+7Mb3odcDkoaz/Jb9Opes= -sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20221128144407-9489eb5b6c77/go.mod h1:oiCXd8V7ZaS/wwvXKZ9pYkoU0BYM86CyEa0RvivM0nw= +sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20221201045826-d9912251cd81 h1:pL+hPQJQnRweJxIa5wT0EVbUwBN/g0Z28WgNLorN6vE= +sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20221201045826-d9912251cd81/go.mod h1:oiCXd8V7ZaS/wwvXKZ9pYkoU0BYM86CyEa0RvivM0nw= sigs.k8s.io/controller-tools v0.10.0 h1:0L5DTDTFB67jm9DkfrONgTGmfc/zYow0ZaHyppizU2U= sigs.k8s.io/controller-tools v0.10.0/go.mod h1:uvr0EW6IsprfB0jpQq6evtKy+hHyHCXNfdWI5ONPx94= sigs.k8s.io/custom-metrics-apiserver v1.25.1 h1:lKIvoLZR8bnFYPX7sdsUBeylGlZqeMQlJMeAI7GpHDE= diff --git a/vendor/github.com/Azure/azure-kusto-go/kusto/data/errors/errors.go b/vendor/github.com/Azure/azure-kusto-go/kusto/data/errors/errors.go index cda22bd5a19..fd16be551d5 100644 --- a/vendor/github.com/Azure/azure-kusto-go/kusto/data/errors/errors.go +++ b/vendor/github.com/Azure/azure-kusto-go/kusto/data/errors/errors.go @@ -221,6 +221,7 @@ func ES(o Op, k Kind, s string, args ...interface{}) *Error { // HTTP constructs an *Error from an *http.Response and a prefix to the error message. func HTTP(o Op, status string, statusCode int, body io.ReadCloser, prefix string) *HttpError { + defer body.Close() bodyBytes, err := io.ReadAll(body) if err != nil { bodyBytes = []byte(fmt.Sprintf("Failed to read body: %v", err)) diff --git a/vendor/github.com/Azure/azure-kusto-go/kusto/internal/version/version.go b/vendor/github.com/Azure/azure-kusto-go/kusto/internal/version/version.go index ba38825cbe9..324b4c00370 100644 --- a/vendor/github.com/Azure/azure-kusto-go/kusto/internal/version/version.go +++ b/vendor/github.com/Azure/azure-kusto-go/kusto/internal/version/version.go @@ -2,4 +2,4 @@ package version // Kusto is the version of this client package that is communicated to the server. -const Kusto = "0.9.1" +const Kusto = "0.9.2" diff --git a/vendor/github.com/Azure/azure-kusto-go/kusto/query_builder.go b/vendor/github.com/Azure/azure-kusto-go/kusto/query_builder.go index 62a96e4e737..1eecb6fc506 100644 --- a/vendor/github.com/Azure/azure-kusto-go/kusto/query_builder.go +++ b/vendor/github.com/Azure/azure-kusto-go/kusto/query_builder.go @@ -145,13 +145,13 @@ func (p ParamType) string() string { return p.name + ":bool" } v := p.Default.(bool) - return fmt.Sprintf("%s:bool = %v", p.name, v) + return fmt.Sprintf("%s:bool = bool(%v)", p.name, v) case types.DateTime: if p.Default == nil { return p.name + ":datetime" } v := p.Default.(time.Time) - return fmt.Sprintf("%s:datetime = %s", p.name, v.Format(time.RFC3339Nano)) + return fmt.Sprintf("%s:datetime = datetime(%s)", p.name, v.Format(time.RFC3339Nano)) case types.Dynamic: return p.name + ":dynamic" case types.GUID: @@ -159,37 +159,37 @@ func (p ParamType) string() string { return p.name + ":guid" } v := p.Default.(uuid.UUID) - return fmt.Sprintf("%s:guid = %s", p.name, v.String()) + return fmt.Sprintf("%s:guid = guid(%s)", p.name, v.String()) case types.Int: if p.Default == nil { return p.name + ":int" } v := p.Default.(int32) - return fmt.Sprintf("%s:int = %d", p.name, v) + return fmt.Sprintf("%s:int = int(%d)", p.name, v) case types.Long: if p.Default == nil { return p.name + ":long" } v := p.Default.(int64) - return fmt.Sprintf("%s:long = %d", p.name, v) + return fmt.Sprintf("%s:long = long(%d)", p.name, v) case types.Real: if p.Default == nil { return p.name + ":real" } v := p.Default.(float64) - return fmt.Sprintf("%s:real = %f", p.name, v) + return fmt.Sprintf("%s:real = real(%f)", p.name, v) case types.String: if p.Default == nil { return p.name + ":string" } v := p.Default.(string) - return fmt.Sprintf(`%s:string = "%s"`, p.name, v) + return fmt.Sprintf(`%s:string = "%s"`, p.name, v) // TODO - escape the string when we have the functionaity case types.Timespan: if p.Default == nil { return p.name + ":timespan" } v := p.Default.(time.Duration) - return fmt.Sprintf("%s:timespan = %s", p.name, value.Timespan{Value: v, Valid: true}.Marshal()) + return fmt.Sprintf("%s:timespan = timespan(%s)", p.name, value.Timespan{Value: v, Valid: true}.Marshal()) case types.Decimal: if p.Default == nil { return p.name + ":decimal" @@ -202,7 +202,7 @@ func (p ParamType) string() string { case *big.Float: sval = v.String() } - return fmt.Sprintf("%s:decimal = %s", p.name, sval) + return fmt.Sprintf("%s:decimal = decimal(%s)", p.name, sval) } panic("internal bug: ParamType.string() called without a call to .validate()") } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index a1417674eb5..0499c8f38f5 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -1456,6 +1456,26 @@ var awsPartition = partition{ }, }, }, + "api.ecr-public": service{ + Endpoints: serviceEndpoints{ + endpointKey{ + Region: "us-east-1", + }: endpoint{ + Hostname: "api.ecr-public.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + endpointKey{ + Region: "us-west-2", + }: endpoint{ + Hostname: "api.ecr-public.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, "api.elastic-inference": service{ Endpoints: serviceEndpoints{ endpointKey{ @@ -3123,6 +3143,37 @@ var awsPartition = partition{ }: endpoint{}, }, }, + "arc-zonal-shift": service{ + Endpoints: serviceEndpoints{ + endpointKey{ + Region: "ap-northeast-1", + }: endpoint{}, + endpointKey{ + Region: "ap-southeast-2", + }: endpoint{}, + endpointKey{ + Region: "ap-southeast-3", + }: endpoint{}, + endpointKey{ + Region: "eu-central-1", + }: endpoint{}, + endpointKey{ + Region: "eu-north-1", + }: endpoint{}, + endpointKey{ + Region: "eu-west-1", + }: endpoint{}, + endpointKey{ + Region: "us-east-1", + }: endpoint{}, + endpointKey{ + Region: "us-east-2", + }: endpoint{}, + endpointKey{ + Region: "us-west-2", + }: endpoint{}, + }, + }, "athena": service{ Endpoints: serviceEndpoints{ endpointKey{ @@ -12057,22 +12108,6 @@ var awsPartition = partition{ endpointKey{ Region: "ca-central-1", }: endpoint{}, - endpointKey{ - Region: "dataplane-ap-south-1", - }: endpoint{ - Hostname: "greengrass-ats.iot.ap-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-south-1", - }, - }, - endpointKey{ - Region: "dataplane-us-east-2", - }: endpoint{ - Hostname: "greengrass-ats.iot.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, endpointKey{ Region: "eu-central-1", }: endpoint{}, @@ -21659,6 +21694,13 @@ var awsPartition = partition{ }: endpoint{}, }, }, + "sagemaker-geospatial": service{ + Endpoints: serviceEndpoints{ + endpointKey{ + Region: "us-west-2", + }: endpoint{}, + }, + }, "savingsplans": service{ PartitionEndpoint: "aws-global", IsRegionalized: boxedFalse, @@ -22082,6 +22124,31 @@ var awsPartition = partition{ }, }, }, + "securitylake": service{ + Endpoints: serviceEndpoints{ + endpointKey{ + Region: "ap-northeast-1", + }: endpoint{}, + endpointKey{ + Region: "ap-southeast-2", + }: endpoint{}, + endpointKey{ + Region: "eu-central-1", + }: endpoint{}, + endpointKey{ + Region: "eu-west-1", + }: endpoint{}, + endpointKey{ + Region: "us-east-1", + }: endpoint{}, + endpointKey{ + Region: "us-east-2", + }: endpoint{}, + endpointKey{ + Region: "us-west-2", + }: endpoint{}, + }, + }, "serverlessrepo": service{ Defaults: endpointDefaults{ defaultKey{}: endpoint{ @@ -22826,6 +22893,34 @@ var awsPartition = partition{ }, }, }, + "simspaceweaver": service{ + Endpoints: serviceEndpoints{ + endpointKey{ + Region: "ap-southeast-1", + }: endpoint{}, + endpointKey{ + Region: "ap-southeast-2", + }: endpoint{}, + endpointKey{ + Region: "eu-central-1", + }: endpoint{}, + endpointKey{ + Region: "eu-north-1", + }: endpoint{}, + endpointKey{ + Region: "eu-west-1", + }: endpoint{}, + endpointKey{ + Region: "us-east-1", + }: endpoint{}, + endpointKey{ + Region: "us-east-2", + }: endpoint{}, + endpointKey{ + Region: "us-west-2", + }: endpoint{}, + }, + }, "sms": service{ Endpoints: serviceEndpoints{ endpointKey{ @@ -28063,14 +28158,6 @@ var awscnPartition = partition{ endpointKey{ Region: "cn-north-1", }: endpoint{}, - endpointKey{ - Region: "dataplane-cn-north-1", - }: endpoint{ - Hostname: "greengrass.ats.iot.cn-north-1.amazonaws.com.cn", - CredentialScope: credentialScope{ - Region: "cn-north-1", - }, - }, }, }, "guardduty": service{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 244216b0940..fc0d4a89f73 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.44.146" +const SDKVersion = "1.44.150" diff --git a/vendor/github.com/gocql/gocql/.travis.yml b/vendor/github.com/gocql/gocql/.travis.yml deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/vendor/github.com/gocql/gocql/AUTHORS b/vendor/github.com/gocql/gocql/AUTHORS index 50e173ad733..04a97c91398 100644 --- a/vendor/github.com/gocql/gocql/AUTHORS +++ b/vendor/github.com/gocql/gocql/AUTHORS @@ -131,3 +131,4 @@ Sergei Karetnikov Stefan Miklosovic Adam Burk Valerii Ponomarov +Neal Turett diff --git a/vendor/github.com/gocql/gocql/CHANGELOG.md b/vendor/github.com/gocql/gocql/CHANGELOG.md index cff2dad25d6..cb70a892b45 100644 --- a/vendor/github.com/gocql/gocql/CHANGELOG.md +++ b/vendor/github.com/gocql/gocql/CHANGELOG.md @@ -12,6 +12,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +## [1.3.0] - 2022-11-29 + +### Added + +- Added a RackAwareRoundRobinPolicy that attempts to keep client->server traffic in the same rack when possible. + +### Changed + +- Supported versions of Go that we test against are now Go 1.18 and Go 1.19. + ## [1.2.1] - 2022-09-02 ### Changed diff --git a/vendor/github.com/gocql/gocql/README.md b/vendor/github.com/gocql/gocql/README.md index e9fe2325c27..0cc502dd3b3 100644 --- a/vendor/github.com/gocql/gocql/README.md +++ b/vendor/github.com/gocql/gocql/README.md @@ -2,7 +2,7 @@ gocql ===== [![Join the chat at https://gitter.im/gocql/gocql](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gocql/gocql?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Build Status](https://travis-ci.org/gocql/gocql.svg?branch=master)](https://travis-ci.org/gocql/gocql) +![go build](https://github.com/gocql/gocql/actions/workflows/main.yml/badge.svg) [![GoDoc](https://godoc.org/github.com/gocql/gocql?status.svg)](https://godoc.org/github.com/gocql/gocql) Package gocql implements a fast and robust Cassandra client for the @@ -17,12 +17,14 @@ Supported Versions The following matrix shows the versions of Go and Cassandra that are tested with the integration test suite as part of the CI build: -Go/Cassandra | 2.1.x | 2.2.x | 3.x.x --------------| -------| ------| --------- -1.17 | yes | yes | yes -1.18 | yes | yes | yes +Go/Cassandra | 3.0.x | 3.11.x | 4.0.x +-------------| ------| -------| -------- +1.18 | yes | yes | WIP +1.19 | yes | yes | WIP -Gocql has been tested in production against many different versions of Cassandra. Due to limits in our CI setup we only test against the latest 3 major releases, which coincide with the official support from the Apache project. +Gocql has been tested in production against many different versions of Cassandra. Due to limits in our CI setup we only +test against the latest 3 major releases, which coincides with the official support from the Apache project. We are +currently adding CI jobs against Cassandra 4.0. Sunsetting Model ---------------- diff --git a/vendor/github.com/gocql/gocql/conn.go b/vendor/github.com/gocql/gocql/conn.go index 0f1d50be1ef..e67c0f3be08 100644 --- a/vendor/github.com/gocql/gocql/conn.go +++ b/vendor/github.com/gocql/gocql/conn.go @@ -91,13 +91,13 @@ func (p PasswordAuthenticator) Success(data []byte) error { // to true if no Config is set. Most users should set SslOptions.Config to a *tls.Config. // SslOptions and Config.InsecureSkipVerify interact as follows: // -// Config.InsecureSkipVerify | EnableHostVerification | Result -// Config is nil | false | do not verify host -// Config is nil | true | verify host -// false | false | verify host -// true | false | do not verify host -// false | true | verify host -// true | true | verify host +// Config.InsecureSkipVerify | EnableHostVerification | Result +// Config is nil | false | do not verify host +// Config is nil | true | verify host +// false | false | verify host +// true | false | do not verify host +// false | true | verify host +// true | true | verify host type SslOptions struct { *tls.Config diff --git a/vendor/github.com/gocql/gocql/connectionpool.go b/vendor/github.com/gocql/gocql/connectionpool.go index ca52c2956dc..c81d9d1857b 100644 --- a/vendor/github.com/gocql/gocql/connectionpool.go +++ b/vendor/github.com/gocql/gocql/connectionpool.go @@ -350,7 +350,7 @@ func (pool *hostConnPool) Pick() *Conn { return leastBusyConn } -//Size returns the number of connections currently active in the pool +// Size returns the number of connections currently active in the pool func (pool *hostConnPool) Size() int { pool.mu.RLock() defer pool.mu.RUnlock() @@ -358,7 +358,7 @@ func (pool *hostConnPool) Size() int { return len(pool.conns) } -//Close the connection pool +// Close the connection pool func (pool *hostConnPool) Close() { pool.mu.Lock() diff --git a/vendor/github.com/gocql/gocql/debug_off.go b/vendor/github.com/gocql/gocql/debug_off.go index 3af3ae0f3eb..31e622599d4 100644 --- a/vendor/github.com/gocql/gocql/debug_off.go +++ b/vendor/github.com/gocql/gocql/debug_off.go @@ -1,3 +1,4 @@ +//go:build !gocql_debug // +build !gocql_debug package gocql diff --git a/vendor/github.com/gocql/gocql/debug_on.go b/vendor/github.com/gocql/gocql/debug_on.go index e94a00ce5b7..b3bdfab8db6 100644 --- a/vendor/github.com/gocql/gocql/debug_on.go +++ b/vendor/github.com/gocql/gocql/debug_on.go @@ -1,3 +1,4 @@ +//go:build gocql_debug // +build gocql_debug package gocql diff --git a/vendor/github.com/gocql/gocql/doc.go b/vendor/github.com/gocql/gocql/doc.go index af8f4c86ca5..b48cef88e50 100644 --- a/vendor/github.com/gocql/gocql/doc.go +++ b/vendor/github.com/gocql/gocql/doc.go @@ -5,15 +5,15 @@ // Package gocql implements a fast and robust Cassandra driver for the // Go programming language. // -// Connecting to the cluster +// # Connecting to the cluster // // Pass a list of initial node IP addresses to NewCluster to create a new cluster configuration: // -// cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3") +// cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3") // // Port can be specified as part of the address, the above is equivalent to: // -// cluster := gocql.NewCluster("192.168.1.1:9042", "192.168.1.2:9042", "192.168.1.3:9042") +// cluster := gocql.NewCluster("192.168.1.1:9042", "192.168.1.2:9042", "192.168.1.3:9042") // // It is recommended to use the value set in the Cassandra config for broadcast_address or listen_address, // an IP address not a domain name. This is because events from Cassandra will use the configured IP @@ -22,9 +22,9 @@ // // Then you can customize more options (see ClusterConfig): // -// cluster.Keyspace = "example" -// cluster.Consistency = gocql.Quorum -// cluster.ProtoVersion = 4 +// cluster.Keyspace = "example" +// cluster.Consistency = gocql.Quorum +// cluster.ProtoVersion = 4 // // The driver tries to automatically detect the protocol version to use if not set, but you might want to set the // protocol version explicitly, as it's not defined which version will be used in certain situations (for example @@ -32,13 +32,13 @@ // // When ready, create a session from the configuration. Don't forget to Close the session once you are done with it: // -// session, err := cluster.CreateSession() -// if err != nil { -// return err -// } -// defer session.Close() +// session, err := cluster.CreateSession() +// if err != nil { +// return err +// } +// defer session.Close() // -// Authentication +// # Authentication // // CQL protocol uses a SASL-based authentication mechanism and so consists of an exchange of server challenges and // client response pairs. The details of the exchanged messages depend on the authenticator used. @@ -47,18 +47,18 @@ // // PasswordAuthenticator is provided to use for username/password authentication: // -// cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3") -// cluster.Authenticator = gocql.PasswordAuthenticator{ -// Username: "user", -// Password: "password" -// } -// session, err := cluster.CreateSession() -// if err != nil { -// return err -// } -// defer session.Close() +// cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3") +// cluster.Authenticator = gocql.PasswordAuthenticator{ +// Username: "user", +// Password: "password" +// } +// session, err := cluster.CreateSession() +// if err != nil { +// return err +// } +// defer session.Close() // -// Transport layer security +// # Transport layer security // // It is possible to secure traffic between the client and server with TLS. // @@ -69,38 +69,38 @@ // to true if no Config is set. Most users should set SslOptions.Config to a *tls.Config. // SslOptions and Config.InsecureSkipVerify interact as follows: // -// Config.InsecureSkipVerify | EnableHostVerification | Result -// Config is nil | false | do not verify host -// Config is nil | true | verify host -// false | false | verify host -// true | false | do not verify host -// false | true | verify host -// true | true | verify host +// Config.InsecureSkipVerify | EnableHostVerification | Result +// Config is nil | false | do not verify host +// Config is nil | true | verify host +// false | false | verify host +// true | false | do not verify host +// false | true | verify host +// true | true | verify host // // For example: // -// cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3") -// cluster.SslOpts = &gocql.SslOptions{ -// EnableHostVerification: true, -// } -// session, err := cluster.CreateSession() -// if err != nil { -// return err -// } -// defer session.Close() +// cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3") +// cluster.SslOpts = &gocql.SslOptions{ +// EnableHostVerification: true, +// } +// session, err := cluster.CreateSession() +// if err != nil { +// return err +// } +// defer session.Close() // -// Data-center awareness and query routing +// # Data-center awareness and query routing // // To route queries to local DC first, use DCAwareRoundRobinPolicy. For example, if the datacenter you // want to primarily connect is called dc1 (as configured in the database): // -// cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3") -// cluster.PoolConfig.HostSelectionPolicy = gocql.DCAwareRoundRobinPolicy("dc1") +// cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3") +// cluster.PoolConfig.HostSelectionPolicy = gocql.DCAwareRoundRobinPolicy("dc1") // // The driver can route queries to nodes that hold data replicas based on partition key (preferring local DC). // -// cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3") -// cluster.PoolConfig.HostSelectionPolicy = gocql.TokenAwareHostPolicy(gocql.DCAwareRoundRobinPolicy("dc1")) +// cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3") +// cluster.PoolConfig.HostSelectionPolicy = gocql.TokenAwareHostPolicy(gocql.DCAwareRoundRobinPolicy("dc1")) // // Note that TokenAwareHostPolicy can take options such as gocql.ShuffleReplicas and gocql.NonLocalReplicasFallback. // @@ -109,50 +109,59 @@ // The driver can only use token-aware routing for queries where all partition key columns are query parameters. // For example, instead of // -// session.Query("select value from mytable where pk1 = 'abc' AND pk2 = ?", "def") +// session.Query("select value from mytable where pk1 = 'abc' AND pk2 = ?", "def") // // use // -// session.Query("select value from mytable where pk1 = ? AND pk2 = ?", "abc", "def") +// session.Query("select value from mytable where pk1 = ? AND pk2 = ?", "abc", "def") // -// Executing queries +// # Rack-level awareness +// +// The DCAwareRoundRobinPolicy can be replaced with RackAwareRoundRobinPolicy, which takes two parameters, datacenter and rack. +// +// Instead of dividing hosts with two tiers (local datacenter and remote datacenters) it divides hosts into three +// (the local rack, the rest of the local datacenter, and everything else). +// +// RackAwareRoundRobinPolicy can be combined with TokenAwareHostPolicy in the same way as DCAwareRoundRobinPolicy. +// +// # Executing queries // // Create queries with Session.Query. Query values must not be reused between different executions and must not be // modified after starting execution of the query. // // To execute a query without reading results, use Query.Exec: // -// err := session.Query(`INSERT INTO tweet (timeline, id, text) VALUES (?, ?, ?)`, -// "me", gocql.TimeUUID(), "hello world").WithContext(ctx).Exec() +// err := session.Query(`INSERT INTO tweet (timeline, id, text) VALUES (?, ?, ?)`, +// "me", gocql.TimeUUID(), "hello world").WithContext(ctx).Exec() // // Single row can be read by calling Query.Scan: // -// err := session.Query(`SELECT id, text FROM tweet WHERE timeline = ? LIMIT 1`, -// "me").WithContext(ctx).Consistency(gocql.One).Scan(&id, &text) +// err := session.Query(`SELECT id, text FROM tweet WHERE timeline = ? LIMIT 1`, +// "me").WithContext(ctx).Consistency(gocql.One).Scan(&id, &text) // // Multiple rows can be read using Iter.Scanner: // -// scanner := session.Query(`SELECT id, text FROM tweet WHERE timeline = ?`, -// "me").WithContext(ctx).Iter().Scanner() -// for scanner.Next() { -// var ( -// id gocql.UUID -// text string -// ) -// err = scanner.Scan(&id, &text) -// if err != nil { -// log.Fatal(err) -// } -// fmt.Println("Tweet:", id, text) -// } -// // scanner.Err() closes the iterator, so scanner nor iter should be used afterwards. -// if err := scanner.Err(); err != nil { -// log.Fatal(err) -// } +// scanner := session.Query(`SELECT id, text FROM tweet WHERE timeline = ?`, +// "me").WithContext(ctx).Iter().Scanner() +// for scanner.Next() { +// var ( +// id gocql.UUID +// text string +// ) +// err = scanner.Scan(&id, &text) +// if err != nil { +// log.Fatal(err) +// } +// fmt.Println("Tweet:", id, text) +// } +// // scanner.Err() closes the iterator, so scanner nor iter should be used afterwards. +// if err := scanner.Err(); err != nil { +// log.Fatal(err) +// } // // See Example for complete example. // -// Prepared statements +// # Prepared statements // // The driver automatically prepares DML queries (SELECT/INSERT/UPDATE/DELETE/BATCH statements) and maintains a cache // of prepared statements. @@ -163,71 +172,71 @@ // The main advantage is the ability to keep the same prepared statement even when you don't // want to update some fields, where before you needed to make another prepared statement. // -// Executing multiple queries concurrently +// # Executing multiple queries concurrently // // Session is safe to use from multiple goroutines, so to execute multiple concurrent queries, just execute them // from several worker goroutines. Gocql provides synchronously-looking API (as recommended for Go APIs) and the queries // are executed asynchronously at the protocol level. // -// results := make(chan error, 2) -// go func() { -// results <- session.Query(`INSERT INTO tweet (timeline, id, text) VALUES (?, ?, ?)`, -// "me", gocql.TimeUUID(), "hello world 1").Exec() -// }() -// go func() { -// results <- session.Query(`INSERT INTO tweet (timeline, id, text) VALUES (?, ?, ?)`, -// "me", gocql.TimeUUID(), "hello world 2").Exec() -// }() +// results := make(chan error, 2) +// go func() { +// results <- session.Query(`INSERT INTO tweet (timeline, id, text) VALUES (?, ?, ?)`, +// "me", gocql.TimeUUID(), "hello world 1").Exec() +// }() +// go func() { +// results <- session.Query(`INSERT INTO tweet (timeline, id, text) VALUES (?, ?, ?)`, +// "me", gocql.TimeUUID(), "hello world 2").Exec() +// }() // -// Nulls +// # Nulls // // Null values are are unmarshalled as zero value of the type. If you need to distinguish for example between text // column being null and empty string, you can unmarshal into *string variable instead of string. // -// var text *string -// err := scanner.Scan(&text) -// if err != nil { -// // handle error -// } -// if text != nil { -// // not null -// } -// else { -// // null -// } +// var text *string +// err := scanner.Scan(&text) +// if err != nil { +// // handle error +// } +// if text != nil { +// // not null +// } +// else { +// // null +// } // // See Example_nulls for full example. // -// Reusing slices +// # Reusing slices // // The driver reuses backing memory of slices when unmarshalling. This is an optimization so that a buffer does not // need to be allocated for every processed row. However, you need to be careful when storing the slices to other // memory structures. // -// scanner := session.Query(`SELECT myints FROM table WHERE pk = ?`, "key").WithContext(ctx).Iter().Scanner() -// var myInts []int -// for scanner.Next() { -// // This scan reuses backing store of myInts for each row. -// err = scanner.Scan(&myInts) -// if err != nil { -// log.Fatal(err) -// } -// } +// scanner := session.Query(`SELECT myints FROM table WHERE pk = ?`, "key").WithContext(ctx).Iter().Scanner() +// var myInts []int +// for scanner.Next() { +// // This scan reuses backing store of myInts for each row. +// err = scanner.Scan(&myInts) +// if err != nil { +// log.Fatal(err) +// } +// } // // When you want to save the data for later use, pass a new slice every time. A common pattern is to declare the // slice variable within the scanner loop: // -// scanner := session.Query(`SELECT myints FROM table WHERE pk = ?`, "key").WithContext(ctx).Iter().Scanner() -// for scanner.Next() { -// var myInts []int -// // This scan always gets pointer to fresh myInts slice, so does not reuse memory. -// err = scanner.Scan(&myInts) -// if err != nil { -// log.Fatal(err) -// } -// } +// scanner := session.Query(`SELECT myints FROM table WHERE pk = ?`, "key").WithContext(ctx).Iter().Scanner() +// for scanner.Next() { +// var myInts []int +// // This scan always gets pointer to fresh myInts slice, so does not reuse memory. +// err = scanner.Scan(&myInts) +// if err != nil { +// log.Fatal(err) +// } +// } // -// Paging +// # Paging // // The driver supports paging of results with automatic prefetch, see ClusterConfig.PageSize, Session.SetPrefetch, // Query.PageSize, and Query.Prefetch. @@ -258,14 +267,14 @@ // // See Example_paging for an example of manual paging. // -// Dynamic list of columns +// # Dynamic list of columns // // There are certain situations when you don't know the list of columns in advance, mainly when the query is supplied // by the user. Iter.Columns, Iter.RowData, Iter.MapScan and Iter.SliceMap can be used to handle this case. // // See Example_dynamicColumns. // -// Batches +// # Batches // // The CQL protocol supports sending batches of DML statements (INSERT/UPDATE/DELETE) and so does gocql. // Use Session.NewBatch to create a new batch and then fill-in details of individual queries. @@ -292,7 +301,7 @@ // // See Example_batch for an example. // -// Lightweight transactions +// # Lightweight transactions // // Query.ScanCAS or Query.MapScanCAS can be used to execute a single-statement lightweight transaction (an // INSERT/UPDATE .. IF statement) and reading its result. See example for Query.MapScanCAS. @@ -302,7 +311,7 @@ // Session.MapExecuteBatchCAS when executing the batch to learn about the result of the LWT. See example for // Session.MapExecuteBatchCAS. // -// Retries and speculative execution +// # Retries and speculative execution // // Queries can be marked as idempotent. Marking the query as idempotent tells the driver that the query can be executed // multiple times without affecting its result. Non-idempotent queries are not eligible for retrying nor speculative @@ -316,21 +325,21 @@ // is still executing. The two parallel executions of the query race to return a result, the first received result will // be returned. // -// User-defined types +// # User-defined types // // UDTs can be mapped (un)marshaled from/to map[string]interface{} a Go struct (or a type implementing // UDTUnmarshaler, UDTMarshaler, Unmarshaler or Marshaler interfaces). // // For structs, cql tag can be used to specify the CQL field name to be mapped to a struct field: // -// type MyUDT struct { -// FieldA int32 `cql:"a"` -// FieldB string `cql:"b"` -// } +// type MyUDT struct { +// FieldA int32 `cql:"a"` +// FieldB string `cql:"b"` +// } // // See Example_userDefinedTypesMap, Example_userDefinedTypesStruct, ExampleUDTMarshaler, ExampleUDTUnmarshaler. // -// Metrics and tracing +// # Metrics and tracing // // It is possible to provide observer implementations that could be used to gather metrics: // diff --git a/vendor/github.com/gocql/gocql/fuzz.go b/vendor/github.com/gocql/gocql/fuzz.go index 3606f9381d7..0d4cff0e57f 100644 --- a/vendor/github.com/gocql/gocql/fuzz.go +++ b/vendor/github.com/gocql/gocql/fuzz.go @@ -1,3 +1,4 @@ +//go:build gofuzz // +build gofuzz package gocql diff --git a/vendor/github.com/gocql/gocql/host_source_gen.go b/vendor/github.com/gocql/gocql/host_source_gen.go index c82193cbd49..8c096ffd6de 100644 --- a/vendor/github.com/gocql/gocql/host_source_gen.go +++ b/vendor/github.com/gocql/gocql/host_source_gen.go @@ -1,3 +1,4 @@ +//go:build genhostinfo // +build genhostinfo package main diff --git a/vendor/github.com/gocql/gocql/marshal.go b/vendor/github.com/gocql/gocql/marshal.go index e3082508e63..d476449018b 100644 --- a/vendor/github.com/gocql/gocql/marshal.go +++ b/vendor/github.com/gocql/gocql/marshal.go @@ -51,45 +51,45 @@ type Unmarshaler interface { // // Supported conversions are as follows, other type combinations may be added in the future: // -// CQL type | Go type (value) | Note -// varchar, ascii, blob, text | string, []byte | -// boolean | bool | -// tinyint, smallint, int | integer types | -// tinyint, smallint, int | string | formatted as base 10 number -// bigint, counter | integer types | -// bigint, counter | big.Int | -// bigint, counter | string | formatted as base 10 number -// float | float32 | -// double | float64 | -// decimal | inf.Dec | -// time | int64 | nanoseconds since start of day -// time | time.Duration | duration since start of day -// timestamp | int64 | milliseconds since Unix epoch -// timestamp | time.Time | -// list, set | slice, array | -// list, set | map[X]struct{} | -// map | map[X]Y | -// uuid, timeuuid | gocql.UUID | -// uuid, timeuuid | [16]byte | raw UUID bytes -// uuid, timeuuid | []byte | raw UUID bytes, length must be 16 bytes -// uuid, timeuuid | string | hex representation, see ParseUUID -// varint | integer types | -// varint | big.Int | -// varint | string | value of number in decimal notation -// inet | net.IP | -// inet | string | IPv4 or IPv6 address string -// tuple | slice, array | -// tuple | struct | fields are marshaled in order of declaration -// user-defined type | gocql.UDTMarshaler | MarshalUDT is called -// user-defined type | map[string]interface{} | -// user-defined type | struct | struct fields' cql tags are used for column names -// date | int64 | milliseconds since Unix epoch to start of day (in UTC) -// date | time.Time | start of day (in UTC) -// date | string | parsed using "2006-01-02" format -// duration | int64 | duration in nanoseconds -// duration | time.Duration | -// duration | gocql.Duration | -// duration | string | parsed with time.ParseDuration +// CQL type | Go type (value) | Note +// varchar, ascii, blob, text | string, []byte | +// boolean | bool | +// tinyint, smallint, int | integer types | +// tinyint, smallint, int | string | formatted as base 10 number +// bigint, counter | integer types | +// bigint, counter | big.Int | +// bigint, counter | string | formatted as base 10 number +// float | float32 | +// double | float64 | +// decimal | inf.Dec | +// time | int64 | nanoseconds since start of day +// time | time.Duration | duration since start of day +// timestamp | int64 | milliseconds since Unix epoch +// timestamp | time.Time | +// list, set | slice, array | +// list, set | map[X]struct{} | +// map | map[X]Y | +// uuid, timeuuid | gocql.UUID | +// uuid, timeuuid | [16]byte | raw UUID bytes +// uuid, timeuuid | []byte | raw UUID bytes, length must be 16 bytes +// uuid, timeuuid | string | hex representation, see ParseUUID +// varint | integer types | +// varint | big.Int | +// varint | string | value of number in decimal notation +// inet | net.IP | +// inet | string | IPv4 or IPv6 address string +// tuple | slice, array | +// tuple | struct | fields are marshaled in order of declaration +// user-defined type | gocql.UDTMarshaler | MarshalUDT is called +// user-defined type | map[string]interface{} | +// user-defined type | struct | struct fields' cql tags are used for column names +// date | int64 | milliseconds since Unix epoch to start of day (in UTC) +// date | time.Time | start of day (in UTC) +// date | string | parsed using "2006-01-02" format +// duration | int64 | duration in nanoseconds +// duration | time.Duration | +// duration | gocql.Duration | +// duration | string | parsed with time.ParseDuration func Marshal(info TypeInfo, value interface{}) ([]byte, error) { if info.Version() < protoVersion1 { panic("protocol version not set") @@ -172,36 +172,36 @@ func Marshal(info TypeInfo, value interface{}) ([]byte, error) { // // Supported conversions are as follows, other type combinations may be added in the future: // -// CQL type | Go type (value) | Note -// varchar, ascii, blob, text | *string | -// varchar, ascii, blob, text | *[]byte | non-nil buffer is reused -// bool | *bool | -// tinyint, smallint, int, bigint, counter | *integer types | -// tinyint, smallint, int, bigint, counter | *big.Int | -// tinyint, smallint, int, bigint, counter | *string | formatted as base 10 number -// float | *float32 | -// double | *float64 | -// decimal | *inf.Dec | -// time | *int64 | nanoseconds since start of day -// time | *time.Duration | -// timestamp | *int64 | milliseconds since Unix epoch -// timestamp | *time.Time | -// list, set | *slice, *array | -// map | *map[X]Y | -// uuid, timeuuid | *string | see UUID.String -// uuid, timeuuid | *[]byte | raw UUID bytes -// uuid, timeuuid | *gocql.UUID | -// timeuuid | *time.Time | timestamp of the UUID -// inet | *net.IP | -// inet | *string | IPv4 or IPv6 address string -// tuple | *slice, *array | -// tuple | *struct | struct fields are set in order of declaration -// user-defined types | gocql.UDTUnmarshaler | UnmarshalUDT is called -// user-defined types | *map[string]interface{} | -// user-defined types | *struct | cql tag is used to determine field name -// date | *time.Time | time of beginning of the day (in UTC) -// date | *string | formatted with 2006-01-02 format -// duration | *gocql.Duration | +// CQL type | Go type (value) | Note +// varchar, ascii, blob, text | *string | +// varchar, ascii, blob, text | *[]byte | non-nil buffer is reused +// bool | *bool | +// tinyint, smallint, int, bigint, counter | *integer types | +// tinyint, smallint, int, bigint, counter | *big.Int | +// tinyint, smallint, int, bigint, counter | *string | formatted as base 10 number +// float | *float32 | +// double | *float64 | +// decimal | *inf.Dec | +// time | *int64 | nanoseconds since start of day +// time | *time.Duration | +// timestamp | *int64 | milliseconds since Unix epoch +// timestamp | *time.Time | +// list, set | *slice, *array | +// map | *map[X]Y | +// uuid, timeuuid | *string | see UUID.String +// uuid, timeuuid | *[]byte | raw UUID bytes +// uuid, timeuuid | *gocql.UUID | +// timeuuid | *time.Time | timestamp of the UUID +// inet | *net.IP | +// inet | *string | IPv4 or IPv6 address string +// tuple | *slice, *array | +// tuple | *struct | struct fields are set in order of declaration +// user-defined types | gocql.UDTUnmarshaler | UnmarshalUDT is called +// user-defined types | *map[string]interface{} | +// user-defined types | *struct | cql tag is used to determine field name +// date | *time.Time | time of beginning of the day (in UTC) +// date | *string | formatted with 2006-01-02 format +// duration | *gocql.Duration | func Unmarshal(info TypeInfo, data []byte, value interface{}) error { if v, ok := value.(Unmarshaler); ok { return v.UnmarshalCQL(info, data) diff --git a/vendor/github.com/gocql/gocql/policies.go b/vendor/github.com/gocql/gocql/policies.go index e63e83ae914..f31fc707af5 100644 --- a/vendor/github.com/gocql/gocql/policies.go +++ b/vendor/github.com/gocql/gocql/policies.go @@ -133,12 +133,11 @@ type RetryPolicy interface { // // See below for examples of usage: // -// //Assign to the cluster -// cluster.RetryPolicy = &gocql.SimpleRetryPolicy{NumRetries: 3} -// -// //Assign to a query -// query.RetryPolicy(&gocql.SimpleRetryPolicy{NumRetries: 1}) +// //Assign to the cluster +// cluster.RetryPolicy = &gocql.SimpleRetryPolicy{NumRetries: 3} // +// //Assign to a query +// query.RetryPolicy(&gocql.SimpleRetryPolicy{NumRetries: 1}) type SimpleRetryPolicy struct { NumRetries int //Number of times to retry a query } @@ -260,6 +259,20 @@ type KeyspaceUpdateEvent struct { Change string } +type HostTierer interface { + // HostTier returns an integer specifying how far a host is from the client. + // Tier must start at 0. + // The value is used to prioritize closer hosts during host selection. + // For example this could be: + // 0 - local rack, 1 - local DC, 2 - remote DC + // or: + // 0 - local DC, 1 - remote DC + HostTier(host *HostInfo) uint + + // This function returns the maximum possible host tier + MaxHostTier() uint +} + // HostSelectionPolicy is an interface for selecting // the most appropriate host to execute a given query. // HostSelectionPolicy instances cannot be shared between sessions. @@ -578,18 +591,42 @@ func (t *tokenAwareHostPolicy) Pick(qry ExecutableQuery) NextHost { var ( fallbackIter NextHost - i, j int - remote []*HostInfo + i, j, k int + remote [][]*HostInfo + tierer HostTierer + tiererOk bool + maxTier uint ) + if tierer, tiererOk = t.fallback.(HostTierer); tiererOk { + maxTier = tierer.MaxHostTier() + } else { + maxTier = 1 + } + + if t.nonLocalReplicasFallback { + remote = make([][]*HostInfo, maxTier) + } + used := make(map[*HostInfo]bool, len(replicas)) return func() SelectedHost { for i < len(replicas) { h := replicas[i] i++ - if !t.fallback.IsLocal(h) { - remote = append(remote, h) + var tier uint + if tiererOk { + tier = tierer.HostTier(h) + } else if t.fallback.IsLocal(h) { + tier = 0 + } else { + tier = 1 + } + + if tier != 0 { + if t.nonLocalReplicasFallback { + remote[tier-1] = append(remote[tier-1], h) + } continue } @@ -600,9 +637,14 @@ func (t *tokenAwareHostPolicy) Pick(qry ExecutableQuery) NextHost { } if t.nonLocalReplicasFallback { - for j < len(remote) { - h := remote[j] - j++ + for j < len(remote) && k < len(remote[j]) { + h := remote[j][k] + k++ + + if k >= len(remote[j]) { + j++ + k = 0 + } if h.IsUp() { used[h] = true @@ -634,14 +676,13 @@ func (t *tokenAwareHostPolicy) Pick(qry ExecutableQuery) NextHost { // use an empty slice of hosts as the hostpool will be populated later by gocql. // See below for examples of usage: // -// // Create host selection policy using a simple host pool -// cluster.PoolConfig.HostSelectionPolicy = HostPoolHostPolicy(hostpool.New(nil)) -// -// // Create host selection policy using an epsilon greedy pool -// cluster.PoolConfig.HostSelectionPolicy = HostPoolHostPolicy( -// hostpool.NewEpsilonGreedy(nil, 0, &hostpool.LinearEpsilonValueCalculator{}), -// ) +// // Create host selection policy using a simple host pool +// cluster.PoolConfig.HostSelectionPolicy = HostPoolHostPolicy(hostpool.New(nil)) // +// // Create host selection policy using an epsilon greedy pool +// cluster.PoolConfig.HostSelectionPolicy = HostPoolHostPolicy( +// hostpool.NewEpsilonGreedy(nil, 0, &hostpool.LinearEpsilonValueCalculator{}), +// ) func HostPoolHostPolicy(hp hostpool.HostPool) HostSelectionPolicy { return &hostPoolHostPolicy{hostMap: map[string]*HostInfo{}, hp: hp} } @@ -858,6 +899,64 @@ func (d *dcAwareRR) Pick(q ExecutableQuery) NextHost { return roundRobbin(int(nextStartOffset), d.localHosts.get(), d.remoteHosts.get()) } +// RackAwareRoundRobinPolicy is a host selection policies which will prioritize and +// return hosts which are in the local rack, before hosts in the local datacenter but +// a different rack, before hosts in all other datercentres + +type rackAwareRR struct { + localDC string + localRack string + hosts []cowHostList + lastUsedHostIdx uint64 +} + +func RackAwareRoundRobinPolicy(localDC string, localRack string) HostSelectionPolicy { + hosts := make([]cowHostList, 3) + return &rackAwareRR{localDC: localDC, localRack: localRack, hosts: hosts} +} + +func (d *rackAwareRR) Init(*Session) {} +func (d *rackAwareRR) KeyspaceChanged(KeyspaceUpdateEvent) {} +func (d *rackAwareRR) SetPartitioner(p string) {} + +func (d *rackAwareRR) MaxHostTier() uint { + return 2 +} + +func (d *rackAwareRR) HostTier(host *HostInfo) uint { + if host.DataCenter() == d.localDC { + if host.Rack() == d.localRack { + return 0 + } else { + return 1 + } + } else { + return 2 + } +} + +func (d *rackAwareRR) IsLocal(host *HostInfo) bool { + return d.HostTier(host) == 0 +} + +func (d *rackAwareRR) AddHost(host *HostInfo) { + dist := d.HostTier(host) + d.hosts[dist].add(host) +} + +func (d *rackAwareRR) RemoveHost(host *HostInfo) { + dist := d.HostTier(host) + d.hosts[dist].remove(host.ConnectAddress()) +} + +func (d *rackAwareRR) HostUp(host *HostInfo) { d.AddHost(host) } +func (d *rackAwareRR) HostDown(host *HostInfo) { d.RemoveHost(host) } + +func (d *rackAwareRR) Pick(q ExecutableQuery) NextHost { + nextStartOffset := atomic.AddUint64(&d.lastUsedHostIdx, 1) + return roundRobbin(int(nextStartOffset), d.hosts[0].get(), d.hosts[1].get(), d.hosts[2].get()) +} + // ReadyPolicy defines a policy for when a HostSelectionPolicy can be used. After // each host connects during session initialization, the Ready method will be // called. If you only need a single Host to be up you can wrap a @@ -926,7 +1025,6 @@ func (e *SimpleConvictionPolicy) Reset(host *HostInfo) {} // ReconnectionPolicy interface is used by gocql to determine if reconnection // can be attempted after connection error. The interface allows gocql users // to implement their own logic to determine how to attempt reconnection. -// type ReconnectionPolicy interface { GetInterval(currentRetry int) time.Duration GetMaxRetries() int @@ -936,8 +1034,7 @@ type ReconnectionPolicy interface { // // Examples of usage: // -// cluster.ReconnectionPolicy = &gocql.ConstantReconnectionPolicy{MaxRetries: 10, Interval: 8 * time.Second} -// +// cluster.ReconnectionPolicy = &gocql.ConstantReconnectionPolicy{MaxRetries: 10, Interval: 8 * time.Second} type ConstantReconnectionPolicy struct { MaxRetries int Interval time.Duration diff --git a/vendor/github.com/gocql/gocql/session.go b/vendor/github.com/gocql/gocql/session.go index c72dec853a2..8300a8846ab 100644 --- a/vendor/github.com/gocql/gocql/session.go +++ b/vendor/github.com/gocql/gocql/session.go @@ -926,7 +926,7 @@ func (q Query) String() string { return fmt.Sprintf("[query statement=%q values=%+v consistency=%s]", q.stmt, q.values, q.cons) } -//Attempts returns the number of times the query was executed. +// Attempts returns the number of times the query was executed. func (q *Query) Attempts() int { return q.metrics.attempts() } @@ -935,7 +935,7 @@ func (q *Query) AddAttempts(i int, host *HostInfo) { q.metrics.attempt(i, 0, host, false) } -//Latency returns the average amount of nanoseconds per attempt of the query. +// Latency returns the average amount of nanoseconds per attempt of the query. func (q *Query) Latency() int64 { return q.metrics.latency() } @@ -1319,9 +1319,10 @@ func (q *Query) MapScanCAS(dest map[string]interface{}) (applied bool, err error // cannot be reused. // // Example: -// qry := session.Query("SELECT * FROM my_table") -// qry.Exec() -// qry.Release() +// +// qry := session.Query("SELECT * FROM my_table") +// qry.Exec() +// qry.Release() func (q *Query) Release() { q.reset() queryPool.Put(q) @@ -1712,7 +1713,7 @@ func (b *Batch) AddAttempts(i int, host *HostInfo) { b.metrics.attempt(i, 0, host, false) } -//Latency returns the average number of nanoseconds to execute a single attempt of the batch. +// Latency returns the average number of nanoseconds to execute a single attempt of the batch. func (b *Batch) Latency() int64 { return b.metrics.latency() } @@ -1978,8 +1979,8 @@ func (r *routingKeyInfoLRU) Remove(key string) { r.mu.Unlock() } -//Max adjusts the maximum size of the cache and cleans up the oldest records if -//the new max is lower than the previous value. Not concurrency safe. +// Max adjusts the maximum size of the cache and cleans up the oldest records if +// the new max is lower than the previous value. Not concurrency safe. func (r *routingKeyInfoLRU) Max(max int) { r.mu.Lock() for r.lru.Len() > max { diff --git a/vendor/modules.txt b/vendor/modules.txt index f78fc3c943e..e5b7d7974b7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -44,7 +44,7 @@ github.com/Azure/azure-amqp-common-go/v3/uuid github.com/Azure/azure-event-hubs-go/v3 github.com/Azure/azure-event-hubs-go/v3/atom github.com/Azure/azure-event-hubs-go/v3/persist -# github.com/Azure/azure-kusto-go v0.9.1 +# github.com/Azure/azure-kusto-go v0.9.2 ## explicit; go 1.16 github.com/Azure/azure-kusto-go/kusto github.com/Azure/azure-kusto-go/kusto/data/errors @@ -223,7 +223,7 @@ github.com/armon/go-radix # github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a ## explicit github.com/asaskevich/govalidator -# github.com/aws/aws-sdk-go v1.44.146 +# github.com/aws/aws-sdk-go v1.44.150 ## explicit; go 1.11 github.com/aws/aws-sdk-go/aws github.com/aws/aws-sdk-go/aws/awserr @@ -426,7 +426,7 @@ github.com/gobwas/glob/syntax/ast github.com/gobwas/glob/syntax/lexer github.com/gobwas/glob/util/runes github.com/gobwas/glob/util/strings -# github.com/gocql/gocql v1.2.1 +# github.com/gocql/gocql v1.3.0 ## explicit; go 1.13 github.com/gocql/gocql github.com/gocql/gocql/internal/lru @@ -2201,7 +2201,7 @@ sigs.k8s.io/controller-runtime/pkg/webhook sigs.k8s.io/controller-runtime/pkg/webhook/admission sigs.k8s.io/controller-runtime/pkg/webhook/conversion sigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics -# sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20221128144407-9489eb5b6c77 +# sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20221201045826-d9912251cd81 ## explicit; go 1.17 sigs.k8s.io/controller-runtime/tools/setup-envtest sigs.k8s.io/controller-runtime/tools/setup-envtest/env