This is the highlight of my summer: I just released 1.2.0-beta of libmongoc, the C driver for MongoDB. You can download the tarball here:
The main feature is Jason Carey and Samantha Ritter's rewrite of the
mongoc_client_t internals. They overhauled it to match the Server Discovery And Monitoring Spec and the
Server Selection Spec. The payoff is huge:
- All replica set members or mongos servers are discovered and periodically checked in parallel. The driver's performance is dramatically better and more predictable with multi-server deployments, or with a flaky network, or when some servers are slow or down.
- Clients from the same
mongoc_client_pool_tshare a background thread that discovers and monitors all servers in parallel.
- Unnecessary round trips for server checks and pings are eliminated.
- Behavior is documented in the specs, and consistent with other drivers, even in complex or unusual scenarios.
- The URI's "replicaSet" option is enforced: the driver now refuses to connect to a server unless it is a member of a replica set with the right setName.
- Many race conditions related to changing deployment conditions are fixed.
The worst code in the old driver, the cause of most of the bugfix releases in the 1.1.x series, has been completely replaced with a well-designed architecture.
To conform to the new specs, the client accepts these options in the MongoDB
URI; see the
mongoc_uri_t documentation for details:
- All timeouts that can be configured in the URI now interpret 0 to mean "use the default value for this timeout".
- The client's read preference can be configured in the URI with the new
options "readPreference" and "readPreferenceTags", see the
- The new
mongoc_uri_get_read_prefs_tfunction retrieves both the read mode and tags from a mongoc_uri_t.
- New accessors:
- Debug tracing can be controlled at runtime with
Notable bugs fixed:
- "wtimeoutms" was ignored for write concerns besides "majority".
- Bulk write operations might fail in mixed-version sharded clusters with some pre-2.6 mongos servers.
- Normal operations were logged during startup and could not be silenced.
- A variety of bugs and incorrect results in
- Numerous compiler warnings and build failures on various platforms.
- Copious refinements to the documentation.
Thanks to everyone who contributed to this version of libmongoc.
- A. Jesse Jiryu Davis
- Sujan Dutta
- Jason Carey
- Hannes Magnusson
- Jeremy Mikola
- Derick Rethans
- Samantha Ritter
- Yuchen Xie
- Lloyd Zhou
I hope you'll try this beta and let me know how it goes. Open a ticket in our bug tracker if you find an issue. If you try it and it goes well, email me! I'm firstname.lastname@example.org. I'd love to hear from you, and I need to know how the beta period is going for libmongoc users.
— A. Jesse Jiryu Davis