[CDRIVER-2331] New "with_opts" functions to accept sessionId Created: 22/Oct/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-2207 Introduce generic mongoc_client_comma... Closed
is depended on by CDRIVER-2192 Implement Driver Sessions API Closed
Related
related to CDRIVER-2296 Option to pass bson_validate_flags_t ... Closed
is related to CDRIVER-2332 New "with_opts" functions to support ... Closed

 Description   

The Driver Sessions Spec requires all functions that communicate with the server to accept a session parameter. We'll do this in the C Driver by accepting an arbitrary BSON document called "opts" that can include a variety of options, including a session.

Details:

Users create sessions with mongoc_client_start_session and bind the session to an opts document. A new function mongoc_client_session_append (mongoc_client_session_t *, bson_t *) appends an opaque integer id to the opts document, with the field name "sessionId".

When the driver executes a command with opts, the driver checks the opts for a "sessionId", retrieves the mongoc_client_session_t from a list of them in the mongoc_client_t, and adds the session's lsid and (if causally consistent) its clusterTime to the command it sends to the server.

Make a list of every public function in the driver that does not end with "_with_opts". Remove from the list any functions that have a "_with_opts" equivalent. Remove any that don't communicate with the server. For all remaining functions, add a "_with_opts" equivalent and test it in test-mongoc-client-session.c.

Done: Remove some workarounds from test-mongoc-client-session.c, like the direct call to the "insert" command (works around the current lack of mongoc_collection_insert_with_opts) and the "suspend_monitoring" field used in tests.

  • Done: mongoc_client_find_databases_with_opts
  • Done: mongoc_client_get_database_names_with_opts
  • Done: mongoc_collection_create_bulk_operation_with_opts
  • Done: mongoc_collection_find_indexes_with_opts
  • Done: mongoc_collection_insert_one_with_opts
  • Done: mongoc_database_find_collections_with_opts
  • Done: mongoc_database_get_collection_names_with_opts
  • Done: Rename the CDRIVER-2205 functions mongoc_collection_update_one/many_with_opts and mongoc_collection_replace_one_with_opts: remove "_with_opts".
  • mongoc_collection_insert_many, delete_one, delete_many

The generic command function is split out into CDRIVER-2207, GridFS work is split out in CDRIVER-2332 and delayed for a future version.

Don't do mongoc_database_create_user_with_opts, mongoc_database_remove_all_users_with_opts, or mongoc_database_remove_user_with_opts. Same justification as when we cancelled CDRIVER-326: this is not a libmongoc priority.



 Comments   
Comment by Githook User [ 11/Dec/17 ]

Author:

{'name': 'Jeremy Mikola', 'email': 'jmikola@gmail.com', 'username': 'jmikola'}

Message: CDRIVER-2331 document sessionId option for create_bulk
Branch: r1.9
https://github.com/mongodb/mongo-c-driver/commit/d8b1e19e56e704172432e7ef1c5fe6c6736bed6f

Comment by Githook User [ 11/Dec/17 ]

Author:

{'name': 'Jeremy Mikola', 'email': 'jmikola@gmail.com', 'username': 'jmikola'}

Message: CDRIVER-2331 document sessionId option for create_bulk
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/ca88b98876ae5aa96cf71314ab198049ed5e365a

Comment by Githook User [ 12/Nov/17 ]

Author:

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

Message: CDRIVER-2331 implement delete_one/many
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/760dbf8f60306dd4775c1690d3f1936b03431efe

Comment by Githook User [ 12/Nov/17 ]

Author:

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

Message: CDRIVER-2331 implement insert_many
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/b8b3f6fad8dcfaaad21eb795771894c81f7a20bf

Comment by Githook User [ 06/Nov/17 ]

Author:

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

Message: CDRIVER-2331 fix wtimeout tests
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/0758989a5ef9f5535dc77c2a2be28d8ccc30686a

Comment by Githook User [ 06/Nov/17 ]

Author:

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

Message: CDRIVER-2331 rename "with_opts" CRUD functions
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/3fee5397575e5f968ed543aaaec86c969b306b46

Comment by Githook User [ 06/Nov/17 ]

Author:

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

Message: CDRIVER-2331 finish CRUD functions with opts
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/0c5fb8f0a6533179143e58f72021fe3b5a603d62

Comment by Githook User [ 05/Nov/17 ]

Author:

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

Message: CDRIVER-2331 fix writeConcernError tests
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/06c18abd17bd73925d1004e0df82a8fd29ce3425

Comment by Githook User [ 04/Nov/17 ]

Author:

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

Message: CDRIVER-2331 use insert_one_with_opts in test

Now that we can call "insert" with an lsid, no need to call the "insert"
command directly.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/08db9b0cf253231ebcc6ae767ace2b10ae12bbdf

Comment by Githook User [ 04/Nov/17 ]

Author:

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

Message: CDRIVER-2331 use new insert function in tests

  1. Conflicts:
  2. tests/test-mongoc-collection.c
    Branch: master
    https://github.com/mongodb/mongo-c-driver/commit/9c11eb9c76b2877a9b29923c89afdf15f43d75b6
Comment by Githook User [ 04/Nov/17 ]

Author:

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

Message: CDRIVER-2331 test new CRUD functions with lsid
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/8dae9203d37c91fd2776513c252453ab8a421c49

Comment by Githook User [ 04/Nov/17 ]

Author:

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

Message: CDRIVER-2331 mongoc_collection_insert_one_with_opts

New insert function that accepts sessionId and other options.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/6d99c691c5a58f1e010b475070907bfe16aff470

Comment by Githook User [ 01/Nov/17 ]

Author:

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

Message: CDRIVER-2331 bulk tests require live server
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/f590582e1a7d11a4527ace8fee3fcf33b5923d7a

Comment by Githook User [ 01/Nov/17 ]

Author:

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

Message: CDRIVER-2331 leak in collection_info test
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/98968d51f9020ca6baf61181c56c4e3d63b1cd5f

Comment by Githook User [ 01/Nov/17 ]

Author:

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

Message: CDRIVER-2331 find_collections_with_opts handles NULL
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/87897cb7a272eef2d52599db22f7f04a26725934

Comment by Githook User [ 30/Oct/17 ]

Author:

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

Message: CDRIVER-2331 collection_names_with_opts
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/0c7fcf4b476b79bb045a0bfae000e4325c1dd969

Comment by Githook User [ 30/Oct/17 ]

Author:

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

Message: CDRIVER-2331 find_collections_with_opts
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/e0b40c7d0eb2ae946749b44c64824167c8eeb4b8

Comment by Githook User [ 30/Oct/17 ]

Author:

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

Message: CDRIVER-2331 test find_collections error
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/77e356e6df33471948826240e6c1109416b75a4c

Comment by Githook User [ 30/Oct/17 ]

Author:

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

Message: CDRIVER-2331 link to find_dbs_with_opts doc
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/360c6fdf5acd8bfcaf5ab91cb0d085a4e43cd23f

Comment by Githook User [ 29/Oct/17 ]

Author:

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

Message: CDRIVER-2331 clean up test code
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/834e0434e825e67bb1a0096d373c2dc9e0c7e8dd

Comment by Githook User [ 29/Oct/17 ]

Author:

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

Message: CDRIVER-2331 mongoc_client_find_databases_with_opts()
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/44d53a9f802feb8e4653f55fa5811796e267161a

Comment by Githook User [ 28/Oct/17 ]

Author:

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

Message: CDRIVER-2331 mongoc_collection_find_indexes_with_opts
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/320fc3f66c0f199c761221dc75e2db64d7503ce6

Comment by Githook User [ 28/Oct/17 ]

Author:

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

Message: CDRIVER-2331 mongoc_collection_create_bulk_operation_with_opts
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5ca69643b60559c51b5383a5c5c117eeeec387c4

Comment by Githook User [ 28/Oct/17 ]

Author:

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

Message: CDRIVER-2331 mongoc_client_get_database_names_with_opts
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/930d4bab1d967296aaa18422fba60eb8515a8a67

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