From a364012ae0a9f439dae30c968ad0bfbcf0a932dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Oct 2021 20:07:02 +0100 Subject: [PATCH] Bump go.mongodb.org/mongo-driver from 1.7.1 to 1.7.2 (#156) --- go.mod | 2 +- go.sum | 4 ++-- .../mongo-driver/mongo/change_stream.go | 13 ++++++++----- vendor/go.mongodb.org/mongo-driver/mongo/mongo.go | 11 +++++++++++ .../go.mongodb.org/mongo-driver/version/version.go | 2 +- .../x/mongo/driver/topology/connection.go | 3 +++ .../mongo-driver/x/mongo/driver/topology/pool.go | 14 ++++++++++++-- vendor/modules.txt | 2 +- 8 files changed, 39 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 23ab52ef..f7d25ab0 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/pierrec/lz4 v2.6.0+incompatible // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/stretchr/testify v1.7.0 - go.mongodb.org/mongo-driver v1.7.1 + go.mongodb.org/mongo-driver v1.7.2 golang.org/x/mod v0.5.1 golang.org/x/sync v0.0.0-20201207232520-09787c993a3a gopkg.in/Shopify/sarama.v1 v1.20.1 diff --git a/go.sum b/go.sum index 2b1ff2e2..4253577c 100644 --- a/go.sum +++ b/go.sum @@ -290,8 +290,8 @@ github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.mongodb.org/mongo-driver v1.7.1 h1:jwqTeEM3x6L9xDXrCxN0Hbg7vdGfPBOTIkr0+/LYZDA= -go.mongodb.org/mongo-driver v1.7.1/go.mod h1:Q4oFMbo1+MSNqICAdYMlC/zSTrwCogR4R8NzkI+yfU8= +go.mongodb.org/mongo-driver v1.7.2 h1:pFttQyIiJUHEn50YfZgC9ECjITMT44oiN36uArf/OFg= +go.mongodb.org/mongo-driver v1.7.2/go.mod h1:Q4oFMbo1+MSNqICAdYMlC/zSTrwCogR4R8NzkI+yfU8= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/vendor/go.mongodb.org/mongo-driver/mongo/change_stream.go b/vendor/go.mongodb.org/mongo-driver/mongo/change_stream.go index f05dc8cb..c10c0396 100644 --- a/vendor/go.mongodb.org/mongo-driver/mongo/change_stream.go +++ b/vendor/go.mongodb.org/mongo-driver/mongo/change_stream.go @@ -104,11 +104,14 @@ func newChangeStream(ctx context.Context, config changeStreamConfig, pipeline in } cs := &ChangeStream{ - client: config.client, - registry: config.registry, - streamType: config.streamType, - options: options.MergeChangeStreamOptions(opts...), - selector: description.ReadPrefSelector(config.readPreference), + client: config.client, + registry: config.registry, + streamType: config.streamType, + options: options.MergeChangeStreamOptions(opts...), + selector: description.CompositeSelector([]description.ServerSelector{ + description.ReadPrefSelector(config.readPreference), + description.LatencySelector(config.client.localThreshold), + }), cursorOptions: config.client.createBaseCursorOptions(), } diff --git a/vendor/go.mongodb.org/mongo-driver/mongo/mongo.go b/vendor/go.mongodb.org/mongo-driver/mongo/mongo.go index a0535877..3ceb7aa9 100644 --- a/vendor/go.mongodb.org/mongo-driver/mongo/mongo.go +++ b/vendor/go.mongodb.org/mongo-driver/mongo/mongo.go @@ -228,6 +228,17 @@ func transformAggregatePipeline(registry *bsoncodec.Registry, pipeline interface aidx, arr := bsoncore.AppendArrayStart(nil) var hasOutputStage bool valLen := val.Len() + + // Explicitly forbid non-empty pipelines that are semantically single documents + // and are implemented as slices. + switch t := pipeline.(type) { + case bson.D, bson.Raw, bsoncore.Document: + if valLen > 0 { + return nil, false, + fmt.Errorf("%T is not an allowed pipeline type as it represents a single document. Use bson.A or mongo.Pipeline instead", t) + } + } + for idx := 0; idx < valLen; idx++ { doc, err := transformBsoncoreDocument(registry, val.Index(idx).Interface(), true, fmt.Sprintf("pipeline stage :%v", idx)) if err != nil { diff --git a/vendor/go.mongodb.org/mongo-driver/version/version.go b/vendor/go.mongodb.org/mongo-driver/version/version.go index 460ff3a7..5bb8e71c 100644 --- a/vendor/go.mongodb.org/mongo-driver/version/version.go +++ b/vendor/go.mongodb.org/mongo-driver/version/version.go @@ -7,4 +7,4 @@ package version // import "go.mongodb.org/mongo-driver/version" // Driver is the current version of the driver. -var Driver = "v1.7.1" +var Driver = "v1.7.2" diff --git a/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection.go b/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection.go index e23aeeaf..4255a7e2 100644 --- a/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection.go +++ b/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection.go @@ -46,6 +46,7 @@ type connection struct { idleDeadline atomic.Value // Stores a time.Time readTimeout time.Duration writeTimeout time.Duration + descMu sync.RWMutex // Guards desc. TODO: Remove with or after GODRIVER-2038. desc description.Server isMasterRTT time.Duration compressor wiremessage.CompressorID @@ -228,7 +229,9 @@ func (c *connection) connect(ctx context.Context) { if err == nil { // We only need to retain the Description field as the connection's description. The authentication-related // fields in handshakeInfo are tracked by the handshaker if necessary. + c.descMu.Lock() c.desc = handshakeInfo.Description + c.descMu.Unlock() c.isMasterRTT = time.Since(handshakeStartTime) // If the application has indicated that the cluster is load balanced, ensure the server has included serviceId diff --git a/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go b/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go index 21bc2a69..16a3c31d 100644 --- a/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go +++ b/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go @@ -196,7 +196,14 @@ func newPool(config poolConfig, connOpts ...ConnectionOption) (*pool, error) { // stale checks if a given connection's generation is below the generation of the pool func (p *pool) stale(c *connection) bool { - return c == nil || p.generation.stale(c.desc.ServiceID, c.generation) + if c == nil { + return true + } + + c.descMu.RLock() + serviceID := c.desc.ServiceID + c.descMu.RUnlock() + return p.generation.stale(serviceID, c.generation) } // connect puts the pool into the connected state, allowing it to be used and will allow items to begin being processed from the wait queue @@ -532,7 +539,10 @@ func (p *pool) removeConnection(c *connection, reason string) error { // Only update the generation numbers map if the connection has retrieved its generation number. Otherwise, we'd // decrement the count for the generation even though it had never been incremented. if c.hasGenerationNumber() { - p.generation.removeConnection(c.desc.ServiceID) + c.descMu.RLock() + serviceID := c.desc.ServiceID + c.descMu.RUnlock() + p.generation.removeConnection(serviceID) } if publishEvent && p.monitor != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index 7bef6808..cf4b0372 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -181,7 +181,7 @@ github.com/xeipuuv/gojsonreference github.com/xeipuuv/gojsonschema # github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d github.com/youmark/pkcs8 -# go.mongodb.org/mongo-driver v1.7.1 +# go.mongodb.org/mongo-driver v1.7.2 ## explicit go.mongodb.org/mongo-driver/bson go.mongodb.org/mongo-driver/bson/bsoncodec