Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "specifications"]
[submodule "testdata/specifications"]
path = testdata/specifications
url = https://github.com/mongodb/specifications
url = https://github.com/matthewdale/specifications.git
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: You don't need to change the source here. On GitHub, all commits from forks are also accessible from the main project: it's a single Git repository.
Here: mongodb/specifications@51c4920

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that's great to know! Thanks!

1 change: 1 addition & 0 deletions internal/integration/unified/unified_spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var (
"mongodb-handshake/tests/unified",
"client-backpressure/tests",
"transactions/tests/unified",
"causal-consistency/tests",
}
failDirectories = []string{
"unified-test-format/tests/valid-fail",
Expand Down
2 changes: 1 addition & 1 deletion testdata/specifications
Submodule specifications updated 26 files
+18 −14 source/causal-consistency/causal-consistency.md
+151 −0 source/causal-consistency/tests/causal-consistency-clientBulkWrite.json
+75 −0 source/causal-consistency/tests/causal-consistency-clientBulkWrite.yml
+1,283 −0 source/causal-consistency/tests/causal-consistency-write-commands.json
+430 −0 source/causal-consistency/tests/causal-consistency-write-commands.yml
+1 −12 source/client-side-encryption/tests/README.md
+0 −1 source/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.json
+0 −1 source/client-side-encryption/tests/unified/QE-Text-cleanupStructuredEncryptionData.yml
+0 −1 source/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.json
+0 −1 source/client-side-encryption/tests/unified/QE-Text-compactStructuredEncryptionData.yml
+0 −1 source/client-side-encryption/tests/unified/QE-Text-prefixPreview.json
+0 −1 source/client-side-encryption/tests/unified/QE-Text-prefixPreview.yml
+1 −1 source/client-side-encryption/tests/unified/QE-Text-substringPreview.json
+1 −1 source/client-side-encryption/tests/unified/QE-Text-substringPreview.yml
+0 −1 source/client-side-encryption/tests/unified/QE-Text-suffixPreview.json
+0 −1 source/client-side-encryption/tests/unified/QE-Text-suffixPreview.yml
+11 −1 source/read-write-concern/read-write-concern.md
+5 −3 source/transactions-convenient-api/tests/unified/callback-aborts.json
+2 −1 source/transactions-convenient-api/tests/unified/callback-aborts.yml
+5 −3 source/transactions-convenient-api/tests/unified/callback-commits.json
+2 −1 source/transactions-convenient-api/tests/unified/callback-commits.yml
+6 −2 source/transactions/tests/unified/commit.json
+4 −2 source/transactions/tests/unified/commit.yml
+6 −2 source/transactions/tests/unified/retryable-writes.json
+4 −2 source/transactions/tests/unified/retryable-writes.yml
+5 −0 source/unified-test-format/tests/Makefile
21 changes: 21 additions & 0 deletions x/mongo/driver/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,27 @@ func (op Operation) addReadConcern(dst []byte, desc description.SelectedServer)
rc = &readconcern.ReadConcern{}
}

// If this is a write operation, then we add an empty read concern so the
// following code can set "afterClusterTime". That avoids a data correctness
// problem that can happen when there is a network partition in a sharded
// cluster. See DRIVERS-3274 for more details.
isWrite := op.Name == driverutil.InsertOp ||
op.Name == driverutil.UpdateOp ||
op.Name == driverutil.FindAndModifyOp ||
op.Name == driverutil.DeleteOp ||
op.Name == driverutil.BulkWriteOp ||
op.Name == driverutil.CreateOp ||
op.Name == driverutil.CreateIndexesOp ||
op.Name == driverutil.DropOp ||
op.Name == driverutil.DropDatabaseOp ||
op.Name == driverutil.DropIndexesOp
isNotInTxn := client != nil && (client.TransactionState == session.None ||
client.TransactionState == session.Committed ||
client.TransactionState == session.Aborted)
if rc == nil && client != nil && client.Consistent && client.OperationTime != nil && isWrite && isNotInTxn {
rc = &readconcern.ReadConcern{}
}

if client != nil && client.Snapshot {
if desc.WireVersion.Max < readSnapshotMinWireVersion {
return dst, errors.New("snapshot reads require MongoDB 5.0 or later")
Expand Down
1 change: 1 addition & 0 deletions x/mongo/driver/operation/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func (c *Create) Execute(ctx context.Context) error {
WriteConcern: c.writeConcern,
ServerAPI: c.serverAPI,
Authenticator: c.authenticator,
Name: driverutil.CreateOp,
}.Execute(ctx)
}

Expand Down
Loading