-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-2164 Remove client max_bson_size/max_message_size/max_write_batch_size #766
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
…tch_size Use the hello command instead: doc = client.admin.command('hello') max_bson_size = doc['maxBsonObjectSize'] max_message_size = doc['maxMessageSizeBytes'] max_write_batch_size = doc['maxWriteBatchSize']
@@ -173,6 +173,27 @@ can be changed to this:: | |||
|
|||
names = client.list_database_names() | |||
|
|||
MongoClient.max_bson_size/max_message_size/max_write_batch_size are removed |
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.
Explain why we're removing them.
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.
Done. Waiting for the tests to pass.
…ology and run server selection
return [s for s in selection.server_descriptions | ||
if (s.round_trip_time - fastest) <= threshold] | ||
|
||
def apply_selector(self, selector, address=None, custom_selector=None): |
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 is a minor quality improvement. The method was already "public" I just added docs and refactored apply_local_threshold to be a method instead of an inline function.
pymongo/mongo_client.py
Outdated
@@ -937,16 +937,16 @@ def address(self): | |||
|
|||
.. versionadded:: 3.0 | |||
""" | |||
topology_type = self._topology._description.topology_type | |||
# Block until we discover the topology type. |
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 was a minor bug exposed by one of the test changes. The bug was that client.address on a connect=False client would not open the topology as the documentation suggests:
If the client is not connected, this will block until a connection is
established or raise ServerSelectionTimeoutError if no server is
available.
This fix is to attempt server selection once before doing the topology_type/primary checks. I don't think it's worth backporting to v3.
… the topology and run server selection" This reverts commit ffb340b.
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!
@behackett did you want to review this again? |
…tch_size (mongodb#766) Use the hello command instead: doc = client.admin.command('hello') max_bson_size = doc['maxBsonObjectSize'] max_message_size = doc['maxMessageSizeBytes'] max_write_batch_size = doc['maxWriteBatchSize'] Also add documentation for TopologyDescription.apply_selector.
…tch_size (mongodb#766) Use the hello command instead: doc = client.admin.command('hello') max_bson_size = doc['maxBsonObjectSize'] max_message_size = doc['maxMessageSizeBytes'] max_write_batch_size = doc['maxWriteBatchSize'] Also add documentation for TopologyDescription.apply_selector.
Apps should use the hello command instead:
I'll address the remaining configuration attributes (max_pool_size, min_pool_size, max_idle_time_ms, local_threshold_ms, server_selection_timeout, etc.) in a new PR.