Skip to content

RUBY-2682 RUBY-2443 test that driver closes cursors left open by server when result set is fully iterated #2378

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

Merged
merged 11 commits into from
Dec 14, 2021

Conversation

neilshweky
Copy link
Contributor

No description provided.

end
end
end
0
Copy link
Contributor

Choose a reason for hiding this comment

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

What would happen if this line instead raised NotImplementedError?

Copy link
Contributor Author

@neilshweky neilshweky Dec 6, 2021

Choose a reason for hiding this comment

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

I just started a patch with this, I'll let you know what the results are: Evergreen Patch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are a lot of failures at this test:

1) Mongo::Collection::View::MapReduce#each when the view has a limit applies the limit to the map/reduce
     Failure/Error: raise NotImplementedError
     
     NotImplementedError:
       NotImplementedError
     # ./lib/mongo/protocol/msg.rb:309:in `number_returned'
     # ./lib/mongo/operation/result.rb:252:in `returned_count'
     # ./lib/mongo/cursor.rb:439:in `process'
     # ./lib/mongo/cursor.rb:206:in `try_next'
     # ./lib/mongo/cursor.rb:169:in `block in each'
     # ./lib/mongo/cursor.rb:168:in `loop'
     # ./lib/mongo/cursor.rb:168:in `each'
     # ./lib/mongo/collection/view/map_reduce.rb:79:in `each'
     # ./spec/mongo/collection/view/map_reduce_spec.rb:427:in `block (4 levels) in <top (required)>'
     # ./spec/lite_spec_helper.rb:131:in `block (3 levels) in <top (required)>'
     # ./spec/lite_spec_helper.rb:130:in `block (2 levels) in <top (required)>'
     # ./spec/lite_spec_helper.rb:113:in `block (2 levels) in <top (required)>'
     # ./spec/support/background_thread_registry.rb:65:in `block (2 levels) in <top (required)>'

@@ -326,7 +326,7 @@ def set_request_id
# @return [ 0 ] This method must be overridden, otherwise, always returns 0.
#
# @since 2.5.0
def number_returned; 0; end
def number_returned; raise NotImplementedError; end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line is causing a bunch of failures. Reverting back to its original state.

end
end
end
0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also changed this line to return 0 instead of raising an exception, for consistency.

@@ -69,8 +69,7 @@ tests:
command:
getMore: { $$type: [ int, long ] }
collection: *collection0Name
# https://jira.mongodb.org/browse/RUBY-2443
batchSize: 3
batchSize: 1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test was not consistent with the specs because of how we implemented number_returned. Now that we changed the implementation of it, we can change this to be consistent with the spec tests.

Additionally, it seems that RUBY-2443 can be closed as fixed from this PR. Although, I'm not sure we implemented number_returned exactly how that ticket suggested. (Although, they also seem to default to 0)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@p

@neilshweky neilshweky requested a review from p-mongo December 7, 2021 16:04
@p-mongo p-mongo changed the title RUBY-2682 add test for finished cursors with a non-zero id RUBY-2682 RUBY-2443 test that driver closes cursors left open by server when result set is fully iterated Dec 10, 2021
@neilshweky neilshweky merged commit 1c20b64 into mongodb:master Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants