-
Type:
Bug
-
Resolution: Works as Designed
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Python Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Context
PoolOptions stores driver metadata in two places, and only one of them gets updated: the raw DriverInfo passed to the constructor (stored as a private "driver" attribute), and a derived dict sent in the hello handshake (stored as a private "metadata" attribute). append_metadata() only updates the metadata dict, never the original driver value.
Topology._create_pool_for_monitor builds each monitor's connection from a new PoolOptions, seeded from the original driver value, not the updated metadata dict. So metadata appended after client construction never reaches monitor handshakes, even for monitors created afterward.
Definition of done
Per the handshake spec: "Drivers MUST apply updated metadata to newly created connections." Fix _create_pool_for_monitor and any similar PoolOptions-from-PoolOptions construction to read the accumulated metadata, not the original driver value.
Pitfalls
A fix must still respect "MUST NOT apply updated metadata to already established connections." Since monitors are created lazily per server, including for servers discovered later, the fix needs to distinguish monitors not yet created from monitors already running. Both sync and async code paths need the same fix.
Alternatively it's possible we don't need to update metadata for monitor pool connections, but the spec does not say anything other than "newly created connections".