Skip to content

CDRIVER-5780 Support QE with Client.bulkWrite #2043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mdb-ad
Copy link
Contributor

@mdb-ad mdb-ad commented Jun 18, 2025

@mdb-ad mdb-ad requested a review from a team as a code owner June 18, 2025 00:24
@mdb-ad mdb-ad requested review from eramongodb and kevinAlbs and removed request for eramongodb June 18, 2025 00:24
"runOnRequirements": [
{
"minServerVersion": "8.0",
"serverless": "forbid"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect this test needs a csfle: true requirement. That might fix test failures on non-cse tasks. Example:

libmongoc is not built with support for Client-Side Field Level Encryption

@@ -423,6 +426,7 @@ test_bson_size_limits_and_batch_splitting (void *unused)
coll = mongoc_client_get_collection (client, "db", "coll");
/* End of setup */

/* Case 1 */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest removing "Case 1" and "Case 2" comments. AFAICT they do not refer to the prose tests directly. Whereas some other prose tests have cases (example).

// Create a newly named collection to avoid cached previous JSON Schema.
mongoc_collection_t *coll2 = mongoc_database_create_collection (db, "coll2", coll_opts, &error);
ASSERT_OR_PRINT (coll2, error);
mongoc_collection_destroy(coll2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
mongoc_collection_destroy(coll2);
mongoc_collection_destroy (coll2);

Aside: clang-format can be run with:

./tools/poetry.sh install --with=dev
./tools/poetry.sh run .evergreen/scripts/clang-format-all.sh

But that is likely to be replaced soon with #2039:

uv run --frozen --only-group format .evergreen/scripts/clang-format-all.sh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --only-group format flag is optional. Dev dependencies are included by default with uv.

mongoc_bulkwriteexception_destroy (bwr.exc);

/* Insert two documents that each exceed 2MiB after encryption occurs. Expect
* the bulk write to succeed and run as two separate inserts.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* the bulk write to succeed and run as two separate inserts.
* the bulk write to succeed and run as two separate bulkWrite commands.

@@ -340,14 +344,15 @@ _command_started (const mongoc_apm_command_started_t *event)
limits_apm_ctx_t *ctx;

ctx = (limits_apm_ctx_t *) mongoc_apm_command_started_get_context (event);
if (0 == strcmp ("insert", mongoc_apm_command_started_get_command_name (event))) {
const char *cmd_name = mongoc_apm_command_started_get_command_name(event);
if (0 == strcmp ("insert", cmd_name) || 0 == strcmp("bulkWrite", cmd_name)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest using a separate counter ctx->num_bulk_writes to distinguish insert operations from bulkWrite operations (which may not necessary be an insert).

if (0 == strcmp ("insert", cmd_name)) {
  ctx->num_inserts++;
}

if (0 == strcmp ("bulkWrite", cmd_name)) {
  ctx->num_bulk-writes++;
}

// Create a newly named collection to avoid cached previous JSON Schema.
mongoc_collection_t *coll2 = mongoc_database_create_collection (db, "coll2", coll_opts, &error);
ASSERT_OR_PRINT (coll2, error);
mongoc_collection_destroy(coll2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --only-group format flag is optional. Dev dependencies are included by default with uv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants