-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(NODE-3648): run get more ops through server selection #3030
Conversation
66941be
to
a95b0fd
Compare
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.
Some initial thoughts. This is very close to ready as is, but there's another component to fixing the original bug that we could consider to include here. Only in this version of the driver have we now dropped support for versions of MongoDB that don't support sessions. Part of the issue was that our hasSessionSupport logic was omitting the session because the monitors downgraded it. Now that we run getMores through serverSelection we shouldn't encounter this issue.
But should additionally remove the checks altogether? and in fact maybe we should consider throwing Connection#getMore if we don't have a session at that point. (possibly too far) but IIUC of all operations getMores 100% need to have a session defined. (with our currently supported server vers)
Co-authored-by: Neal Beeken <[email protected]>
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.
LGTM
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.
Just a few small suggestions around the testing
describe('GetMoreOperation', function () { | ||
const ns = 'db.coll'; | ||
const cursorId = Long.fromNumber(1); | ||
const options = { |
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 freeze these so that we can make sure the options aren't mutated? (otherwise that deep equal check below doesn't guarantee as much)
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.
Now all params are frozen.
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.
One small nit
Co-authored-by: Daria Pardue <[email protected]>
Description
Runs
getmore
command operations through server selection, selecting the same server.What is changing?
A new server selector has been added,
sameServerSelector
, which takes aServerDescription
and returns aServerDescription[]
. This will always select the same server as the description provided, unless the server has transitioned into an unknown state, where it will return an empty array. In this case, server selection will force monitor checks to potentially update the server and select the same one again.A new
GetMoreOperation
has been added in order for the cursors ongetMore
to execute this operation with server selection. The pinned server's description on the operation will be used in conjunction with the new server selector.Is there new documentation needed for these changes?
No
What is the motivation for this change?
NODE-3648
NODE-3453
HELP-28682
Double check the following
npm run check:lint
script<type>(NODE-xxxx)<!>: <description>