Skip to content

DRIVERS-3547: Explicit Encryption Case 2 recreates collection with contention: 10#1952

Draft
rozza wants to merge 5 commits into
mongodb:masterfrom
rozza:DRIVERS-3547
Draft

DRIVERS-3547: Explicit Encryption Case 2 recreates collection with contention: 10#1952
rozza wants to merge 5 commits into
mongodb:masterfrom
rozza:DRIVERS-3547

Conversation

@rozza

@rozza rozza commented Jun 16, 2026

Copy link
Copy Markdown
Member

Case 2 uses contentionFactor: 10 but the shared Test Setup creates db.explicit_encryption with contention: 0. Servers implementing SERVER-91887 now reject payloads whose contentionFactor exceeds the collection's configured contention. Fix by dropping and recreating the collection with contention: 10 at the start of Case 2, matching the Python driver fix in PYTHON-5882.

Please complete the following before merging:

  • Is the relevant DRIVERS ticket in the PR title?
  • Update changelog.
  • Test changes in at least one language driver.
  • Test these changes against all server versions and topologies (including standalone, replica set, and sharded clusters).

rozza added 2 commits June 16, 2026 12:20
…ntention: 10

Case 2 uses contentionFactor: 10 but the shared Test Setup creates
db.explicit_encryption with contention: 0. Servers implementing SERVER-91887
now reject payloads whose contentionFactor exceeds the collection's configured
contention. Fix by dropping and recreating the collection with contention: 10
at the start of Case 2, matching the Python driver fix in PYTHON-5882.
Servers implementing SERVER-91887 require find payloads to exactly match
the collection's configured contention factor, not just avoid exceeding it.
Drop the find with contentionFactor=0 (which the server now rejects) and
update the note to accurately describe the server behavior.

@kevinAlbs kevinAlbs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FYI testing in the C driver revealed more test failures in the explicit encryption prose tests for QE string queries.

Suggest including 17b9c3d in this PR to address all test failures caused by SERVER-91887.

[ClientEncryptionOpts](#ClientEncryptionOpts) or [AutoEncryptionOpts](#AutoEncryptionOpts).
2. Initialize $P$ to an empty [KMSProviders](#kmsproviders) object.
3. If $K$ contains an `aws` property, and that property is an empty map:
1. Initialize $P$ to an empty [KMSProviders](#kmsproviders) object.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Revert unintended numbering changes.

Comment thread source/client-side-encryption/client-side-encryption.md Outdated

#### Case 2: can insert encrypted indexed and find with non-zero contention

> [!NOTE]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rather than requiring the test recreate the collection, suggest adding a new collection to the test setup.

Add a new file: encryptedFields-c10.json as a copy of encryptedFields.json with contention: 10. Add steps to Test Setup:

Load the file
[encryptedFields-c10.json](https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/etc/data/encryptedFields-c10.json)
as `encryptedFields_c10`.

Drop and create the collection `db.explicit_encryption_c10` using `encryptedFields` as an option. See
[FLE 2 CreateCollection() and Collection.Drop()](../client-side-encryption.md#create-collection-helper).

This may be more consistent with other tests. This was simpler to implement in the C driver (rewriting nested fields in BSON is lots of boilerplate).

@kevinAlbs

Copy link
Copy Markdown
Contributor

C driver implementation with suggested changes: mongodb/mongo-c-driver#2320

rozza and others added 3 commits June 17, 2026 09:24
Co-authored-by: Kevin Albertson <kevin.eric.albertson@gmail.com>
- Use a pre-created db.explicit_encryption_c10 collection (contention: 10)
  in Test Setup rather than requiring Case 2 to reconstruct collection BSON
- Add encryptedFields-c10.json fixture file
- Add explicit contention: 0 to encryptedFields-prefix-suffix.json and
  encryptedFields-substring.json for SERVER-91887 compatibility
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.

2 participants