-
Notifications
You must be signed in to change notification settings - Fork 244
DRIVERS-3274 Send afterClusterTime on writes in causally-consistent sessions. #1930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
matthewdale
wants to merge
11
commits into
mongodb:master
Choose a base branch
from
matthewdale:drivers3274-after-cluster-time
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ec0b2df
DRIVERS-3274 Send afterClusterTime on writes in causally-consistent s…
matthewdale 1163992
Update the spec to cover all read and write commands. Add a clientBul…
matthewdale a66b592
Remove unnecessary minServerVersion and redundant prose test. Add bul…
matthewdale 2994ef4
Expect DDL operations to send afterClusterTime.
matthewdale c4c9860
Explicitly forbid 'level' in 'readConcern' for writes. Fix transactio…
matthewdale 51c4920
Replace findOne with find for the initial operation.
matthewdale 10bb34b
Writes in transactions don't require afterClusterTime.
matthewdale c5b9d04
Require afterClusterTime on writes not in a transaction.
matthewdale c3033c4
Remove confusing note about commands supporting readConcern in Read W…
matthewdale 32f3817
Make sure there are no collection name conflicts in createCollection …
matthewdale fa869a3
Correct test descrption in causal-consistency-clientBulkWrite.yml
matthewdale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
151 changes: 151 additions & 0 deletions
151
source/causal-consistency/tests/causal-consistency-clientBulkWrite.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| { | ||
| "description": "causal consistency write commands include afterClusterTime", | ||
| "schemaVersion": "1.3", | ||
| "runOnRequirements": [ | ||
| { | ||
| "minServerVersion": "8.0", | ||
| "topologies": [ | ||
| "replicaset", | ||
| "sharded", | ||
| "load-balanced" | ||
| ] | ||
| } | ||
| ], | ||
| "createEntities": [ | ||
| { | ||
| "client": { | ||
| "id": "client0", | ||
| "useMultipleMongoses": false, | ||
| "uriOptions": { | ||
| "retryWrites": false | ||
| }, | ||
| "observeEvents": [ | ||
| "commandStartedEvent" | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "database": { | ||
| "id": "database0", | ||
| "client": "client0", | ||
| "databaseName": "causal-consistency-tests" | ||
| } | ||
| }, | ||
| { | ||
| "collection": { | ||
| "id": "collection0", | ||
| "database": "database0", | ||
| "collectionName": "test" | ||
| } | ||
| }, | ||
| { | ||
| "session": { | ||
| "id": "session0", | ||
| "client": "client0", | ||
| "sessionOptions": { | ||
| "causalConsistency": true | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "initialData": [ | ||
| { | ||
| "collectionName": "test", | ||
| "databaseName": "causal-consistency-tests", | ||
| "documents": [ | ||
| { | ||
| "_id": 1, | ||
| "x": 11 | ||
| }, | ||
| { | ||
| "_id": 2, | ||
| "x": 22 | ||
| }, | ||
| { | ||
| "_id": 3, | ||
| "x": 33 | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "tests": [ | ||
| { | ||
| "description": "clientBulkWrite includes afterClusterTime in causally consistent session", | ||
| "operations": [ | ||
| { | ||
| "name": "find", | ||
| "object": "collection0", | ||
| "arguments": { | ||
| "session": "session0", | ||
| "filter": { | ||
| "_id": 1 | ||
| } | ||
| }, | ||
| "expectResult": [ | ||
| { | ||
| "_id": 1, | ||
| "x": 11 | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "clientBulkWrite", | ||
| "object": "client0", | ||
| "arguments": { | ||
| "session": "session0", | ||
| "models": [ | ||
| { | ||
| "insertOne": { | ||
| "namespace": "causal-consistency-tests.test", | ||
| "document": { | ||
| "_id": 4 | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ], | ||
| "expectEvents": [ | ||
| { | ||
| "client": "client0", | ||
| "events": [ | ||
| { | ||
| "commandStartedEvent": { | ||
| "commandName": "find", | ||
| "command": { | ||
| "find": "test", | ||
| "readConcern": { | ||
| "$$exists": false | ||
| }, | ||
| "lsid": { | ||
| "$$sessionLsid": "session0" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "commandStartedEvent": { | ||
| "commandName": "bulkWrite", | ||
| "command": { | ||
| "bulkWrite": 1, | ||
| "lsid": { | ||
| "$$sessionLsid": "session0" | ||
| }, | ||
| "readConcern": { | ||
| "afterClusterTime": { | ||
| "$$exists": true | ||
| }, | ||
| "level": { | ||
| "$$exists": false | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
75 changes: 75 additions & 0 deletions
75
source/causal-consistency/tests/causal-consistency-clientBulkWrite.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| description: "causal consistency bulkWrite include afterClusterTime" | ||
|
|
||
| schemaVersion: "1.3" | ||
|
|
||
| runOnRequirements: | ||
| - minServerVersion: "8.0" | ||
| topologies: [replicaset, sharded, load-balanced] | ||
|
|
||
| createEntities: | ||
| - client: | ||
| id: &client0 client0 | ||
| useMultipleMongoses: false | ||
| uriOptions: | ||
| retryWrites: false | ||
| observeEvents: [commandStartedEvent] | ||
| - database: | ||
| id: &database0 database0 | ||
| client: *client0 | ||
| databaseName: &databaseName causal-consistency-tests | ||
| - collection: | ||
| id: &collection0 collection0 | ||
| database: *database0 | ||
| collectionName: &collectionName test | ||
| - session: | ||
| id: &session0 session0 | ||
| client: *client0 | ||
| sessionOptions: | ||
| causalConsistency: true | ||
|
|
||
| initialData: | ||
| - collectionName: *collectionName | ||
| databaseName: *databaseName | ||
| documents: | ||
| - { _id: 1, x: 11 } | ||
| - { _id: 2, x: 22 } | ||
| - { _id: 3, x: 33 } | ||
|
|
||
| # In a causally consistent session, once an operationTime has been established by a prior | ||
| # operation, subsequent write commands MUST include readConcern.afterClusterTime so the | ||
| # server can apply the write causally after the previously-observed data. | ||
|
|
||
| tests: | ||
| - description: "clientBulkWrite includes afterClusterTime in causally consistent session" | ||
| operations: | ||
| - name: find | ||
| object: *collection0 | ||
| arguments: | ||
| session: *session0 | ||
| filter: { _id: 1 } | ||
| expectResult: [{ _id: 1, x: 11 }] | ||
| - name: clientBulkWrite | ||
| object: *client0 | ||
| arguments: | ||
| session: *session0 | ||
| models: | ||
| - insertOne: | ||
| namespace: causal-consistency-tests.test | ||
| document: { _id: 4 } | ||
| expectEvents: | ||
| - client: *client0 | ||
| events: | ||
| - commandStartedEvent: | ||
| commandName: find | ||
| command: | ||
| find: *collectionName | ||
| readConcern: { $$exists: false } | ||
| lsid: { $$sessionLsid: *session0 } | ||
| - commandStartedEvent: | ||
| commandName: bulkWrite | ||
| command: | ||
| bulkWrite: 1 | ||
| lsid: { $$sessionLsid: *session0 } | ||
| readConcern: | ||
| afterClusterTime: { $$exists: true } | ||
| level: { $$exists: false } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we specify list of commands here to avoid any confusion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll update the list in "Read Write Concern", which "Causal Consistency" links to.