Skip to content

Commit 025b2d9

Browse files
prestonvasquezJulien-Beezeelinx
authored andcommitted
GODRIVER-2539 Remove MinWireVersion < 6 Logic (mongodb#1084)
1 parent 38d3726 commit 025b2d9

File tree

4 files changed

+4
-1062
lines changed

4 files changed

+4
-1062
lines changed

mongo/change_stream.go

+3-9
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func (cs *ChangeStream) executeOperation(ctx context.Context, resuming bool) err
287287
// Execute the aggregate, retrying on retryable errors once (1) if retryable reads are enabled and
288288
// infinitely (-1) if context is a Timeout context.
289289
var retries int
290-
if cs.client.retryReads && cs.wireVersion != nil && cs.wireVersion.Max >= 6 {
290+
if cs.client.retryReads {
291291
retries = 1
292292
}
293293
if internal.IsTimeoutContext(ctx) {
@@ -325,11 +325,8 @@ AggregateExecuteLoop:
325325
}
326326
defer conn.Close()
327327

328-
// If wire version is now < 6, do not retry.
328+
// Update the wire version with data from the new connection.
329329
cs.wireVersion = conn.Description().WireVersion
330-
if cs.wireVersion == nil || cs.wireVersion.Max < 6 {
331-
break AggregateExecuteLoop
332-
}
333330

334331
// Reset deployment.
335332
cs.aggregate.Deployment(cs.createOperationDeployment(server, conn))
@@ -435,10 +432,7 @@ func (cs *ChangeStream) createPipelineOptionsDoc() (bsoncore.Document, error) {
435432
}
436433

437434
if cs.options.FullDocument != nil {
438-
// Only append a default "fullDocument" field if wire version is less than 6 (3.6). Otherwise,
439-
// the server will assume users want the default behavior, and "fullDocument" does not need to be
440-
// specified.
441-
if *cs.options.FullDocument != options.Default || (cs.wireVersion != nil && cs.wireVersion.Max < 6) {
435+
if *cs.options.FullDocument != options.Default {
442436
plDoc = bsoncore.AppendStringElement(plDoc, "fullDocument", string(*cs.options.FullDocument))
443437
}
444438
}

mongo/integration/operation_legacy_test.go

-301
This file was deleted.

x/mongo/driver/operation.go

+1-21
Original file line numberDiff line numberDiff line change
@@ -505,24 +505,6 @@ func (op Operation) Execute(ctx context.Context) error {
505505
}
506506

507507
desc := description.SelectedServer{Server: conn.Description(), Kind: op.Deployment.Kind()}
508-
if desc.WireVersion == nil || desc.WireVersion.Max < 4 {
509-
switch op.Legacy {
510-
case LegacyFind:
511-
return op.legacyFind(ctx, (*wm)[:0], srvr, conn, desc, maxTimeMS)
512-
case LegacyGetMore:
513-
return op.legacyGetMore(ctx, (*wm)[:0], srvr, conn, desc)
514-
case LegacyKillCursors:
515-
return op.legacyKillCursors(ctx, (*wm)[:0], srvr, conn, desc)
516-
}
517-
}
518-
if desc.WireVersion == nil || desc.WireVersion.Max < 3 {
519-
switch op.Legacy {
520-
case LegacyListCollections:
521-
return op.legacyListCollections(ctx, (*wm)[:0], srvr, conn, desc)
522-
case LegacyListIndexes:
523-
return op.legacyListIndexes(ctx, (*wm)[:0], srvr, conn, desc, maxTimeMS)
524-
}
525-
}
526508

527509
if batching {
528510
targetBatchSize := desc.MaxDocumentSize
@@ -830,7 +812,6 @@ func (op Operation) retryable(desc description.Server) bool {
830812
return true
831813
}
832814
if retryWritesSupported(desc) &&
833-
desc.WireVersion != nil && desc.WireVersion.Max >= 6 &&
834815
op.Client != nil && !(op.Client.TransactionInProgress() || op.Client.TransactionStarting()) &&
835816
writeconcern.AckWrite(op.WriteConcern) {
836817
return true
@@ -839,8 +820,7 @@ func (op Operation) retryable(desc description.Server) bool {
839820
if op.Client != nil && (op.Client.Committing || op.Client.Aborting) {
840821
return true
841822
}
842-
if desc.WireVersion != nil && desc.WireVersion.Max >= 6 &&
843-
(op.Client == nil || !(op.Client.TransactionInProgress() || op.Client.TransactionStarting())) {
823+
if op.Client == nil || !(op.Client.TransactionInProgress() || op.Client.TransactionStarting()) {
844824
return true
845825
}
846826
}

0 commit comments

Comments
 (0)