[CDRIVER-1326] Design POC for The MongoDB Handshake Protocol Created: 14/Jun/16 Updated: 04/Aug/16 Resolved: 16/Jun/16 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.4.0 |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Hannes Magnusson | Assignee: | Hannes Magnusson |
| Resolution: | Done | Votes: | 0 |
| Labels: | intern2016 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Epic Link: | mongodb-handshake | ||||||||
| Description |
|
We need to be able to set, on initial handshake, our client attributes. Drivers that wrap mongoc need to be able to augment this dataset with information relevant for them. |
| Comments |
| Comment by Ian Boros [ 08/Jul/16 ] | |||||||||||||||||||||||||||
|
Just an update for where I'm at. We're changing the functions to be:
Each can still only be called once, but the mongoc_set_client_metadata() function sets the metadata for the whole process. The main tasks remaining are to: To deal with this we're doing the following: b) Determine what distro is running (if we're on linux) | |||||||||||||||||||||||||||
| Comment by Ian Boros [ 27/Jun/16 ] | |||||||||||||||||||||||||||
|
Right! I enforced these limits in my code | |||||||||||||||||||||||||||
| Comment by Hannes Magnusson [ 27/Jun/16 ] | |||||||||||||||||||||||||||
|
The appname and other metadata has a fixed byte length allowance. This is not the same as normal bson limits, but specific for this argument. | |||||||||||||||||||||||||||
| Comment by Ian Boros [ 17/Jun/16 ] | |||||||||||||||||||||||||||
|
Thanks! Does this mean the functions will also have to take a client or client pool argument? EDIT: nevermind. Thanks for explaining! | |||||||||||||||||||||||||||
| Comment by A. Jesse Jiryu Davis [ 17/Jun/16 ] | |||||||||||||||||||||||||||
|
1) Right. Add a field bson_t metadata; to the client and pool structs. bson_init it during client and pool construction. If someone calls one of these functions, sum metadata.len (its current BSON size) and the lengths of passed-in strings. If the total is greater than 16 MB, fail. 16 MB is #defined somewhere as BSON_MAX_SIZE or something. 2) Yes, these are part of the public API that PHP and C++ drivers and C applications that use the driver directly should call. | |||||||||||||||||||||||||||
| Comment by Ian Boros [ 17/Jun/16 ] | |||||||||||||||||||||||||||
|
Two questions: 1) What's it mean for the values to be too long or the app name to be too long? How big does it have to be? Is it 16mb + the max allowable bson document like it says in the link (maybe this is out of date or something totally unrelated though?): 2) Are these functions meant to be called by other drivers built on top of the C Driver? If so do I still need to follow all the procedures for adding a new symbol (in CONTRIBUTING.md) for these functions? | |||||||||||||||||||||||||||
| Comment by A. Jesse Jiryu Davis [ 16/Jun/16 ] | |||||||||||||||||||||||||||
|
Test with a mock_server_t that asserts the driver has passed "meta" to the server. | |||||||||||||||||||||||||||
| Comment by Hannes Magnusson [ 15/Jun/16 ] | |||||||||||||||||||||||||||
Where these functions can only be called once. These functions only append to the mongoc values. mongoc should identify itself as:
The CFLAGS and CC are already available in the Makefile, and since the exact configure line is available in ./config.status --config there is a way to get the actual configure line to, somehow When the mongoc_client_set_metadata is called the driver document will become
|