-
Notifications
You must be signed in to change notification settings - Fork 245
DRIVERS-2888 Support QE with Client.bulkWrite #1770
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
mdb-ad
wants to merge
19
commits into
mongodb:master
Choose a base branch
from
mdb-ad:bulkwrite-qe
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+460
−15
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c6f645d
add qe to unified tests
mdb-ad aa51fc3
move encryptedFields to initialData
mdb-ad fe8ed1c
Apply suggestions from code review
mdb-ad 44d883c
poc test feedback
mdb-ad ad2fd55
make keyVaultNamespace required
mdb-ad 573aac1
remaining auto encrypt options
mdb-ad 112d5bd
simple schema for schemaMap and encryptedFieldsMap
mdb-ad f910f65
convert localSchema.yml
mdb-ad 364eb4c
convert fle2v2-EncryptedFields-vs-EncryptedFieldsMap
mdb-ad 01505fc
document auto encrypt fields
mdb-ad 87d3c41
client bulkWrite test
mdb-ad 7f4021a
Merge branch 'master' into bulkwrite-qe
mdb-ad bd7a0fc
keyvault namespace
mdb-ad b2893e7
use unencrypted client to check collection contents
mdb-ad 28b2ced
remove bulkWrite QE error
mdb-ad 6415c1a
add csfle requirement to test
mdb-ad a388a7e
bulkWrite prose tests
mdb-ad 148ed07
errorContains in test
mdb-ad f85e42e
add limits-qe-doc
mdb-ad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"foo": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -565,10 +565,13 @@ First, perform the setup. | |
2. Using `client`, drop and create the collection `db.coll` configured with the included JSON schema | ||
[limits/limits-schema.json](../limits/limits-schema.json). | ||
|
||
3. Using `client`, drop the collection `keyvault.datakeys`. Insert the document | ||
3. Using `client`, drop and create the collection `db.coll2` configured with the included encryptedFields | ||
[limits/limits-encryptedFields.json](../limits/limits-encryptedFields.json). | ||
|
||
4. Using `client`, drop the collection `keyvault.datakeys`. Insert the document | ||
[limits/limits-key.json](../limits/limits-key.json) | ||
|
||
4. Create a MongoClient configured with auto encryption (referred to as `client_encrypted`) | ||
5. Create a MongoClient configured with auto encryption (referred to as `client_encrypted`) | ||
|
||
Configure with the `local` KMS provider as follows: | ||
|
||
|
@@ -580,27 +583,27 @@ First, perform the setup. | |
|
||
Using `client_encrypted` perform the following operations: | ||
|
||
1. Insert `{ "_id": "over_2mib_under_16mib", "unencrypted": <the string "a" repeated 2097152 times> }`. | ||
1. Insert `{ "_id": "over_2mib_under_16mib", "unencrypted": <the string "a" repeated 2097152 times> }` into `coll`. | ||
|
||
Expect this to succeed since this is still under the `maxBsonObjectSize` limit. | ||
|
||
2. Insert the document [limits/limits-doc.json](../limits/limits-doc.json) concatenated with | ||
`{ "_id": "encryption_exceeds_2mib", "unencrypted": < the string "a" repeated (2097152 - 2000) times > }` Note: | ||
`{ "_id": "encryption_exceeds_2mib", "unencrypted": < the string "a" repeated (2097152 - 2000) times > }` into `coll`. Note: | ||
limits-doc.json is a 1005 byte BSON document that encrypts to a ~10,000 byte document. | ||
|
||
Expect this to succeed since after encryption this still is below the normal maximum BSON document size. Note, before | ||
auto encryption this document is under the 2 MiB limit. After encryption it exceeds the 2 MiB limit, but does NOT | ||
exceed the 16 MiB limit. | ||
|
||
3. Bulk insert the following: | ||
3. Use MongoCollection.bulkWrite to insert the following into `coll`: | ||
|
||
- `{ "_id": "over_2mib_1", "unencrypted": <the string "a" repeated (2097152) times> }` | ||
- `{ "_id": "over_2mib_2", "unencrypted": <the string "a" repeated (2097152) times> }` | ||
|
||
Expect the bulk write to succeed and split after first doc (i.e. two inserts occur). This may be verified using | ||
[command monitoring](../../command-logging-and-monitoring/command-logging-and-monitoring.md). | ||
|
||
4. Bulk insert the following: | ||
4. Use MongoCollection.bulkWrite insert the following into `coll`: | ||
|
||
- The document [limits/limits-doc.json](../limits/limits-doc.json) concatenated with | ||
`{ "_id": "encryption_exceeds_2mib_1", "unencrypted": < the string "a" repeated (2097152 - 2000) times > }` | ||
|
@@ -610,15 +613,33 @@ Using `client_encrypted` perform the following operations: | |
Expect the bulk write to succeed and split after first doc (i.e. two inserts occur). This may be verified using | ||
[command logging and monitoring](../../command-logging-and-monitoring/command-logging-and-monitoring.md). | ||
|
||
5. Insert `{ "_id": "under_16mib", "unencrypted": <the string "a" repeated 16777216 - 2000 times>`. | ||
5. Insert `{ "_id": "under_16mib", "unencrypted": <the string "a" repeated 16777216 - 2000 times>` into `coll`. | ||
|
||
Expect this to succeed since this is still (just) under the `maxBsonObjectSize` limit. | ||
|
||
6. Insert the document [limits/limits-doc.json](../limits/limits-doc.json) concatenated with | ||
`{ "_id": "encryption_exceeds_16mib", "unencrypted": < the string "a" repeated (16777216 - 2000) times > }` | ||
`{ "_id": "encryption_exceeds_16mib", "unencrypted": < the string "a" repeated (16777216 - 2000) times > }` into `coll`. | ||
|
||
Expect this to fail since encryption results in a document exceeding the `maxBsonObjectSize` limit. | ||
|
||
7. Use MongoClient.bulkWrite to insert the following into `coll2`: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two tests should note that an 8.0+ server is required for |
||
|
||
- `{ "_id": "over_2mib_3", "unencrypted": <the string "a" repeated (2097152 - 1500) times> }` | ||
- `{ "_id": "over_2mib_4", "unencrypted": <the string "a" repeated (2097152 - 1500) times> }` | ||
|
||
Expect the bulk write to succeed and split after first doc (i.e. two inserts occur). This may be verified using | ||
[command logging and monitoring](../../command-logging-and-monitoring/command-logging-and-monitoring.md). | ||
|
||
8. Use MongoClient.bulkWrite to insert the following into `coll2`: | ||
|
||
- The document [limits/limits-qe-doc.json](../limits/limits-qe-doc.json) concatenated with | ||
`{ "_id": "encryption_exceeds_2mib_3", "foo": < the string "a" repeated (2097152 - 2000 - 1500) times > }` | ||
- The document [limits/limits-qe-doc.json](../limits/limits-qe-doc.json) concatenated with | ||
`{ "_id": "encryption_exceeds_2mib_4", "foo": < the string "a" repeated (2097152 - 2000 - 1500) times > }` | ||
|
||
Expect the bulk write to succeed and split after first doc (i.e. two inserts occur). This may be verified using | ||
[command logging and monitoring](../../command-logging-and-monitoring/command-logging-and-monitoring.md). | ||
|
||
Optionally, if it is possible to mock the maxWriteBatchSize (i.e. the maximum number of documents in a batch) test that | ||
setting maxWriteBatchSize=1 and inserting the two documents `{ "_id": "a" }, { "_id": "b" }` with `client_encrypted` | ||
splits the operation into two inserts. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing this file, can you add it to the PR?