-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: add explain support for cursor commands #2622
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
HanaPearlman
merged 5 commits into
mongodb:master
from
HanaPearlman:NODE-2853/master/explain-cursor
Nov 19, 2020
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e408d4a
add explain functionality to find and agg
HanaPearlman b758253
add tests for find and agg explain
HanaPearlman fab6697
add explain to index for forgotten export warning
HanaPearlman 0bbcad3
clean up
HanaPearlman 5c4cfd9
remove shouldUseLegacyQuery
HanaPearlman 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
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
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
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
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
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
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
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
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
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.
This test was passing because the write concern was inherited from the client, making it look like using read concern with explain would fail on the server, when really it was the inherited write concern causing the server to return an error.
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.
I'm a little confused about this, why do we want to stop throwing an error if you use explain + readConcern? To me it looks like this test would still be passing due to the an error generated by the driver if not for the change here.
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.
The server doesn't actually throw an error when you just use explain & readConcern, so it is unnecessary to throw from the driver in this case. If you remove the driver error, the server would return an error for this test case because the write concern is inherited from the client, meaning explain is being used with writeConcern, not because there is any issue with explain & readConcern. Does that help?
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.
To clarify what I'm confused about: this test was explicitly expecting the failure to happen client-side rather than server-side, and from what I can see it was only the change to
AggregateOperation
that caused this client-side error to stop happening, so I'm not sure I see how the server throwing an error because of the inherited write concern would effect this test. I'd expect a server-side error to cause the test to fail with theExpected aggregation to fail on client instead of server for option
message.I think we were using this error as a hint to the user that read concern isn't supported by the explain operation, rather than merely as a way of avoiding a server-side error, and that we're no longer providing that guidance to the user with this change. I can see an argument in favor of this - they just want to get their explain results, and we should just ignore the read concern the way the server does; just wanted to fully understand the reason for the change.
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.
Ah, thanks for the clarification, I was misunderstanding.
I agree with what you're saying at the end. I think it makes sense to not error, since the server also ignores the read concern and since it's not really an error condition, in my opinion, in that nothing has gone wrong/is in an invalid state. I could imagine including a warning or possibly something in the documentation (for all of the explainable operations, not just aggregate), if we feel like the user needs this guidance. What do you think?
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.
I agree it seems unnecessary to warn about a read concern on explain operations. Is there any additional context you could provide about this @mbroadst ?
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.
Unfortunately, I can't recall the rationale for that check, I think it was added before my time and we don't have any specifications covering this. We have a similar situation here where we throw a client-side error if a non-local
readConcern
is provided for servers which don't support it - the server would otherwise ignore the value, it's not clear why we throw an error client-side.I'm pro this change if it doesn't break any of our tests