- Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-2899 Remove code for MongoDB <= 3.4 #729
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.
LGTM!
elif sock_info.max_wire_version >= 3: | ||
return _authenticate_scram(credentials, sock_info, 'SCRAM-SHA-1') | ||
else: | ||
return _authenticate_mongo_cr(credentials, sock_info) |
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.
It looks like MONGODB-CR is still supported in 3.6, so I don't think you can remove it here.
https://docs.mongodb.com/v4.0/core/security-scram/
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.
It is still supported by pymongo if you explicitly add authMechanism=MONGODB-CR
. What I've removed here is the default auth path used for MongoDB 2.6 servers.
flags, cursor_id, _, number_returned = cls.UNPACK_FROM(msg) | ||
| ||
documents = bytes(msg[20:]) | ||
documents = msg[20:] |
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.
Is this taking a slice of a memoryview, or are we making a copy?
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.
It's the memoryview created in network._receive_data_on_socket().
raise ProtocolError("Unsupported OP_MSG reply: >1 section") | ||
| ||
payload_document = bytes(msg[5:]) | ||
payload_document = msg[5:] |
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 question 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.
It's the memoryview created in network._receive_data_on_socket().
} | ||
| ||
| ||
def _first_batch(sock_info, db, coll, query, ntoreturn, |
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.
Good riddance!
self._raise_if_not_writable(not with_last_error) | ||
| ||
self._raise_if_not_writable(True) | ||
self.send_message(msg, max_doc_size) |
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 docs for this say msg is an OP_OPTYPE message. Do the docs just need to be updated?
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.
It's always OP_MSG, the docs were out of date. Updated.
func=func) | ||
| ||
def check_auth_with_sharding(self, func): | ||
"""Skip a test when connected to mongos < 2.0 and running with auth.""" |
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.
Wow. This could have been removed ages ago.
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.
Updated to remove the unused OP_KILL_CURSORS code path.
elif sock_info.max_wire_version >= 3: | ||
return _authenticate_scram(credentials, sock_info, 'SCRAM-SHA-1') | ||
else: | ||
return _authenticate_mongo_cr(credentials, sock_info) |
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.
It is still supported by pymongo if you explicitly add authMechanism=MONGODB-CR
. What I've removed here is the default auth path used for MongoDB 2.6 servers.
self._raise_if_not_writable(not with_last_error) | ||
| ||
self._raise_if_not_writable(True) | ||
self.send_message(msg, max_doc_size) |
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.
It's always OP_MSG, the docs were out of date. Updated.
flags, cursor_id, _, number_returned = cls.UNPACK_FROM(msg) | ||
| ||
documents = bytes(msg[20:]) | ||
documents = msg[20:] |
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.
It's the memoryview created in network._receive_data_on_socket().
raise ProtocolError("Unsupported OP_MSG reply: >1 section") | ||
| ||
payload_document = bytes(msg[5:]) | ||
payload_document = msg[5:] |
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.
It's the memoryview created in network._receive_data_on_socket().
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! No going back now.
Remove unneeded memoryview to bytes conversion.
No description provided.