[CDRIVER-2192] Implement Driver Sessions API Created: 18/Jun/17  Updated: 28/Oct/23  Resolved: 09/Nov/17

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: 1.9.0

Type: New Feature Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CDRIVER-2331 New "with_opts" functions to accept s... Closed
is depended on by CDRIVER-2228 All writes retryable support Closed
is depended on by CDRIVER-2229 Causal consistency support Closed
is depended on by DRIVERS-395 Implement Drivers Sessions API Closed
is depended on by PHPC-980 Implement Drivers Sessions API Closed
Problem/Incident
causes CDRIVER-2576 segmentation fault occurred at _mongo... Closed
causes CDRIVER-2449 Session ID is included in authenticat... Closed
Related
related to CDRIVER-2341 Segfault destroying client if one of ... Closed
is related to CDRIVER-2355 Refactor mongoc_cmd_parts_assemble Closed
Epic Link: Cdriver MongoDB 3.6 Support
Backwards Compatibility: Fully Compatible

 Description   

Conform to the Driver Session Spec. Start and end a client-side session, and gossip the clusterTime.

  • Done in 1.8: Bundle all the data needed to run a command into a mongoc_cmd_parts_t struct and pass that around instead of adding a "session" parameter everywhere
  • Done: Implement the second part of the spec's test plan: prove that a database or collection stores a pointer to the session it came from
  • Done: Write a live test that any command sent to a 3.6 mongos includes $clusterTime
  • Done: Implement mongoc_session_opts_clone().
  • Done: Ensure that executing an empty command "{}" is still an error. Check in mongoc_cmd_parts_assemble / mongoc_cmd_parts_assemble_simple that the command name is non-NULL, before adding "$clusterTime". Update their signatures to take an error pointer and return bool. Save the command name on the mongoc_cmd_t.
  • Done: Append $clusterTime to commands in mongoc-cursor.c.
  • Done: Parse $clusterTime from all command replies
  • Done: Send and receive $clusterTime in topology scanner
  • Done: Complete clusterTime tests from Driver Sessions Spec
  • Done: Add a "session" field to mongoc_cmd_t and ensure all commands on a mongoc_session_t, mongoc_database_t, or mongoc_collection_t set it correctly.
  • Done: For most of the non-deprecated functions on a mongoc_client_t, add functions for mongoc_session_t. E.g., mongoc_session_drop_database, mongoc_session_read_write_command_with_opts, get read preference, read concern, write concern.
  • Done: Generate session ids and pass them with all commands.
  • Cancelled: mongoc_session_get_database_names and mongoc_session_find_databases.
  • Done: Get localLogicalSessionTimeoutMinutes from ismaster response.
  • Done: Delete code that adds "lsid" to OP_QUERY commands in mongoc_cmd_assemble and _mongoc_write_opquery; all commands sent to servers that support sessions will use OP_MSG (may depend on CDRIVER-2306)
  • Moved to CDRIVER-2355: Refactor mongoc_cmd_parts_assemble, $readPreference handling is particularly duplicative.

Respond to spec changes. The spec had said that we associate db / collection / gridfs objects with sessions, but now we're going to keep sessions separate, and pass a session as a parameter to each non-deprecated function that can use a session. Luckily, I think our "with_opts" functions will handle this without requiring a large number of new functions.

The spec had made retryWrites a session option, now it's a client option.

We had chosen not to implement session pooling, but pooling is practically a requirement now, because every command must be associated with some session (whether the user passes a session or not).

Required changes:

  • Done: Temporarily disable compilation of example-session.c
  • Done: Remove the functions that create a database, collection or gridfs struct that is associated with a session. We're not associating these structs with sessions anymore. Keep the session field in bulk operation and cursor structs, however.
  • Done: Remove the session field from the db / collection / gridfs structs.
  • Done: Remove read concern, write concern, and read preferences from session.
  • Done: Remove documentation of the relationship among db / collection / gridfs and sessions.
  • Done: Remove retryWrites from mongoc_session_opts_t
  • Done: Remove mongoc_session_read_command_with_opts and similar functions - we're not executing commands on a session anymore, we pass the session to the command function
  • Done: Rename mongoc_session_t to mongoc_client_session_t
  • Done: Replace term "causally consistent reads" with "causal consistency".
  • Done: Add mongoc_client_session_append, analogous to mongoc_write_concern_append: it will add an "lsid" to a bson_t "opts"
  • In CDRIVER-2331: Test that all "with_opts" functions properly handle the "lsid" field.
  • In CDRIVER-2331: Add "with_opts" functions as necessary to support sessions everywhere: CDRIVER-2331
  • Done: Update example-session.c to not show retryable writes, only causally consistent reads, and to use new API. Re-enable compilation and re-enable the literalinclude in mongoc_session_t.rst
  • Done: Implement a server session pool, and move txn_num field from mongoc_client_session_t to a new internal struct mongoc_server_session_t. Use logicalSessionTimeoutMinutes to determine whether sessions are supported in the topology, and return an error from mongoc_client_start_session otherwise. _mongoc_topology_pop_server_session must trigger topology discovery if there are no known servers, so it can detect whether the topology supports sessions (logical_session_timeout_minutes is not -1).
  • Done: Call endSessions when destroying a client or client pool.
  • Done: Update sessions API for recent changes: set the clusterTime on a mongoc_client_session_t (operationTime will be handled in CDRIVER-2229)
  • Done: Implement compute the $clusterTime to send to a server from the spec
  • Done: Include "lsid" with all commands, even if no explicit session is passed. Add a section to run_session_test() that executes the command with no "sessionId" and ensure all commands include the same lsid anyway. Make sure not to send lsid with "endSessions".
  • Done: Use random numbers, instead of consecutive ones, for sessionIds. This ensures that a session from the wrong client really is prohibited.
  • Done: Update server session's last_used.


 Comments   
Comment by Githook User [ 12/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 more "const" in session API
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/ffdf560d9e7fc582e2b9e5b05b36564b7d91c41b

Comment by Githook User [ 09/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 cursor_set_hint enables secondary read w/ OP_MSG
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/38e72de45fe1b3ec71be275bd507e29bb0d45a4e

Comment by Githook User [ 09/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 avoid endSessions warnings in tests
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/4aec3980c1a0e1cb7cd86d974c0237b3f16943e1

Comment by Githook User [ 08/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 fix session last_use_time test on Win
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/e829bada678a444a4c121479dcceece8071c7b46

Comment by Githook User [ 08/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 no $clusterTime from OP_QUERY

Dead code.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/f7f0a8a406f8be3b196669694e8147a1e4da7fba

Comment by Githook User [ 08/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 track sessions' last use time
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/ce7afa23c8acc5379446b1b87dc9ec0073a229c1

Comment by Githook User [ 08/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 use random sessionId
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/a64115012c0385f476440500b07403a870922a8e

Comment by Githook User [ 08/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 handle endSessions in APM

Update tests and examples to deal with endSessions command events during mongoc_client_destroy.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/adbabe0ca5b03dd5832c5a16467102bd2e6c4640

Comment by Githook User [ 08/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 auth earlier in tests

Now that we use lsid everywhere, the test framework must auth even to
call ismaster and determine if we're connected to a replset or not.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5163877590520e2b75095d43c5d476e502155d13

Comment by Githook User [ 08/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 fix bulk test for sessions
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/fc620ac58b7dd6cf93d199693a799dd625ec2cfa

Comment by Githook User [ 08/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 leak in sessions tests, part 2
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/2b32a08cbdb5d44eac7b410bc11e2f03c8329a19

Comment by Githook User [ 08/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 implicit sessions with all commands
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5b1081fb23fa0376d029eb5de79fe4b2cf5d7080

Comment by Githook User [ 08/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 leak in session tests
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/ca522f437147b9703a595f2aa4994c67b5771956

Comment by Githook User [ 08/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 fix logging in endSessions
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/2019b3910bebcd44dafeb4749a2f2c8fac61e063

Comment by Githook User [ 07/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 send session's cluster time if newer
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/fc7bdc660c78dbcd42a56177fd2ef5a25cfb8903

Comment by Githook User [ 07/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 skip cluster time tests when needed
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/bf11cd9633425b0de9226e0a897cb180b1d5ff18

Comment by Githook User [ 07/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 store clusterTime on session
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/ca66f8f1fc81b2a414987be1e455c01738676902

Comment by Githook User [ 07/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 send $clusterTime in ismaster
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/90850d1b811aa2144a9b21e8e7007f5ad042d47b

Comment by Githook User [ 06/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 leak calling endSessions
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/7c82183034bf564be34518caef4be2ec5d68d27b

Comment by Githook User [ 04/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 session tests don't require mongos
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/ed91ee0790940c9f80042066ee294595f1e85d51

Comment by Githook User [ 03/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 call "endSessions"
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5f6f3c4d29c329aaa5b51b612c9d6b745a60e185

Comment by Githook User [ 03/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 connect, then check session timeout
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/4e3fef6aa00516739f2e81d8d7ff3c8177ecdfc5

Comment by A. Jesse Jiryu Davis [ 03/Nov/17 ]

Right, implicit sessions aren't implemented yet. Only the things marked "done" are done =)

I've updated the description to add your suggestions: We'll implement mongoc_bulk_operation_set_client_session, and we'll add examples for findAndModify with sessions.

Comment by Jeremy Mikola [ 03/Nov/17 ]

jesse: I realized that implicit sessions were not implemented after debugging some odd test failures for retryable writes in CDRIVER-2228. The following is still outstanding:

Include "lsid" with all commands, even if no explicit session is passed. Add a section to run_session_test() that executes the command with no "sessionId" and ensure all commands include the same lsid anyway. Make sure not to send lsid with "endSessions".

While working around this, I realized that mongoc_bulk_operation_t has a session field, but there is no setter. PHPC still relies on the mongoc_bulk_operation_t and methods like mongoc_bulk_operation_set_client(), so I think we'll definitely need a setter for the client session as well (to be added down in this section).

Additionally, it looks like we may need some examples/documentation to demonstrate how to add "sessionId" to a find_and_modify_opts_t via mongoc_find_and_modify_opts_append(). I expect this will be similar to the process in test_find_and_modify_opts_write_concern().

Comment by Githook User [ 03/Nov/17 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis', 'email': 'jesse@mongodb.com'}

Message: CDRIVER-2192 error if sessions are not supported
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/fedb86275bab6ed0c2c6978359282c789c406206

Comment by Githook User [ 28/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2192 mongoc_client_session_append
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/6b263c44b2be48a3e7ea28ab53e54b31e5133b3a

Comment by Githook User [ 28/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2192 fix test_session_no_crypto
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/75f4576a89613b08e776ea9fd5baf2323da40443

Comment by Githook User [ 26/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2192 server session pool

Try 2: use circular doubly-linked list macros from utlist.h, rather than
the non-circular macros. Add some BSON_ASSERTs to silence scan-build
warnings, and correctly select which tests to run.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/c9d6c8fc708c522eefa102a806a444d65fd1b502

Comment by Githook User [ 25/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2192 remove WIRE_VERSION_CLUSTER_TIME
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/af15a77df9256ef3d65ff8c973da7a6ace0d8e25

Comment by Githook User [ 25/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2192 no lsid or $clusterTime with OP_QUERY

Now that we've implemented OP_MSG in the mock server we can test lsid
and $clusterTime in realistic scenarios where the driver sends them in
an OP_MSG. Code that had sent lsid and $clusterTime with OP_QUERY is
now dead.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/ee490a5a7cd38761c564f8ffb28c8fe756f227df

Comment by Githook User [ 12/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: Revert "CDRIVER-2192 server session pool"

5cb9050e716f8793db25b719493783a1d6bf6524
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5049dc8af37078aaf2ed7afc08772ec61db66fa4

Comment by Githook User [ 11/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2192 server session pool
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5cb9050e716f8793db25b719493783a1d6bf6524

Comment by Githook User [ 11/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2192 rename session header guards
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/b8dc5830f6632a5e66f85a5de77dee29300677b5

Comment by Githook User [ 09/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2192 "causally consistent" ->"causal consistency"
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/02889951229d5263766f2dde9baa3331f053395d

Comment by Githook User [ 05/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2192 don't send $clusterTime with OP_QUERY
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/569a1ecd505db6145471309313c7ebb28a139ce7

Comment by Jeremy Mikola [ 03/Oct/17 ]

Observation while I was working on retryable writes: if mongoc_cmd_parts_assemble only adds "lsid" for OP_MSG, _mongoc_write_opquery likely doesn't need to take a session parameter nor assign it to parts.session.

Comment by Githook User [ 03/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2192 gossip replica set $clusterTime

Spec change: both replica sets and mongos servers report $clusterTime.
The driver gossips cluster time for all servers that report it, checking
wire version but not server type.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/9a4832981974a8ee52a8131388ce4d787cb6f32b

Comment by Githook User [ 02/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2192 parse session timeout from ismaster
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/555379dc8f736e03f29ebb50ff51a7417ad4a2a4

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 rename mongoc_session_t to mongoc_client_session_t
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/cf3ece6b49166d74a5caecabca91dd906868da68

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 code improvements, fix leaks
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/e1c3b072b984ac6c9934d57e45edbe52a137bace

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 leak in _mongoc_stream_run_ismaster
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/c6b610baecd0be48a635899e8922b0e5a6b6df7f

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 remove APIs from prior session spec
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/971bcaa0dcfebaca847b247686b3fe7b7d0773e9

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 $clusterTime fixes
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/3e4454e947c05040c582d8b56522079cc00f0413

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 generate and send session ids
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/270666bc736a95af3491f352acdf0b9e682e26d7

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 new session functions
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/4e6ca92e9517186a737c1e7c99c6055eea9bd01c

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 refactor cursor option handling

mongoc_collection_aggregate, in particular, was prone to merging
options into the command body twice. And when talking with mongos, it
was very complex to handle $query, $readPreference, and $clusterTime
properly. The logic that merges options into a command to produce a
command cursor is now in one place, and the functions that do so for
mongos and mongod are now separated.
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/21c13d0d678d468f3cb565d150a15be841ebb90e

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 mock mongos returns $clusterTime
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/cf1e1d1fe3b761ec30ed8738a562cda3902e34dc

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 test $clusterTime comparison
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/b0ad845e456e2ce294d3142bdf764f7442dd7585

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 parse $clusterTime from server reply
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/f5f16b0f9ed9fe536808b41016711c4581c70f55

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 send $clusterTime in cursor commands

Send $clusterTime to MongoDB 3.6 mongos from mongoc_collection_aggregate
and old mongoc_client_command.
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/ed6ec91eace54f5a955048709c8f024f289a7d2d

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 detect empty command body

Now that we add "$clusterTime" to commands sent to MongoDB 3.6+ mongos
servers, we must still ensure that executing an empty command "{}" is an
error. Check in mongoc_cmd_parts_assemble that the command is not empty
before adding "$clusterTime".
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/4e76b4ac877fb98693cc8bad0b200371678ed971

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 add mongoc_session_t
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/659841f98c4fc80a2eb54c87748575a3609d0d30

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 const correctness in session API
Branch:session-squashing
https://github.com/mongodb/mongo-c-driver/commit/2e2e7b78f1373bb733bd4ad6c3d9b22777ad5dd5

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 rename mongoc_session_t to mongoc_client_session_t
Branch:session-squashing
https://github.com/mongodb/mongo-c-driver/commit/fea9c9edec3a1867dd7f31e8d7ca2fe117a59073

Comment by Ramon Fernandez Marina [ 13/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 code improvements, fix leaks
Branch:session-squashing
https://github.com/mongodb/mongo-c-driver/commit/fca599133794ee9b97b9186f1d52b232607fe5ac

Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 send $clusterTime in cursor commands

Send $clusterTime to MongoDB 3.6 mongos from mongoc_collection_aggregate
and old mongoc_client_command.
Branch:session
https://github.com/mongodb/mongo-c-driver/commit/0b978a0a030c7208da2cab8094f860eb95580ffb

Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 parse $clusterTime from server reply
Branch:session
https://github.com/mongodb/mongo-c-driver/commit/2723b90c17f0fd93fb3937de878bf03477847dc0

Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 send $clusterTime in cursor commands

Send $clusterTime to MongoDB 3.6 mongos from mongoc_collection_aggregate
and old mongoc_client_command.
Branch:session
https://github.com/mongodb/mongo-c-driver/commit/6530bc3e30c6c98700a24c44d95175ab7d828825

Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:CDRIVER-2192 detect empty command body

Now that we add "$clusterTime" to commands sent to MongoDB 3.6+ mongos
servers, we must still ensure that executing an empty command "{}" is an
error. Check in mongoc_cmd_parts_assemble that the command is not empty
before adding "$clusterTime".
Branch:session
https://github.com/mongodb/mongo-c-driver/commit/807541242576021927badc1089707ec401be8885

Comment by Githook User [ 14/Jul/17 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-2192 assert in Cyrus auth
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/04127a0dab4683fcd27872dfcde0314bd76f8ea5

Comment by Githook User [ 11/Jul/17 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-2192 internal struct mongoc_cmd_t

Prepare to implement sessions and OP_MSG.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/2f85890370b2c1e77450c85573465781671eda54

Generated at Wed Feb 07 21:14:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.