-
Notifications
You must be signed in to change notification settings - Fork 246
DRIVERS-2477: use w:'majority' in consecutive resume change stream tests #1323
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
Conversation
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.
Your explanation makes sense, but I'm surprised other tests are not failing in Node (sounds like this is somehow not a problem in other drivers). I may have missed something in your description, but do you know why the lack of propagation to multiple nodes' oplogs is only a problem in this test and not in the others for Node?
@@ -854,14 +854,20 @@ tests: | |||
object: *globalCollection0 | |||
arguments: | |||
document: { x: 1 } | |||
writeConcern: |
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.
Can we leave a comment above this writeConcern
to explain that this is needed to make sure the insert propagates and a change stream event is present on all oplogs?
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.
Yup, will do!
@@ -172,14 +172,20 @@ tests: | |||
object: *collection1 | |||
arguments: | |||
document: { x: 1 } | |||
writeConcern: |
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.
Same thing here.
@benjirewis
I misread your comment! I don't know why this only fails in Node but I can look closely at it |
The root cause of the issue was a bug Node introduced last spring into our change streams (this test did continue to pass for a long while though, it only started failing recently). You can see the fix PR here - mongodb/node-mongodb-native#3453. Should we close this PR and the associated drivers ticket? |
Yeah if it was just a bug in Node's change streams code, then closing this PR and the associated drivers ticket SGTM. |
https://jira.mongodb.org/browse/DRIVERS-2477
POC in Node: mongodb/node-mongodb-native#3451
The change stream consecutive resume test (here) fails intermittently in Node because the test inserts documents with write the default write concern instead of majority.
Change events are not reported by the server until they are majority committed. The test inserts multiple documents and attempts to iterate the change stream, expecting change events. If the documents haven't been committed by the time the test attempts to iterate the stream, no change will be reported and the test will fail.
This only impacts the consecutive resume test and does not impact users because the change event will eventually be reported. This test specifically sets up fail commands on getMores, so that the getMore fail and the subsequent aggregate call succeeds and returns a change event in the firstBatch. The race condition is present only because we expect the aggregate to immediately return documents in the firstBatch.
Please complete the following before merging: