-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add a client-side operation timeout for automatic and explicit field Encryption/Decryption. #1308
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
Conversation
@@ -110,7 +110,7 @@ | |||
"listCollections" | |||
], | |||
"blockConnection": true, | |||
"blockTimeMS": 60 |
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.
The timeouts are increased to accommodate for the additional time required for SSL handshake when authentication is enabled. This adjustment ensures that the timeout does not expire before the expected steps in our tests are completed.
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.
Can you add a comment in below the file description - just so its easier to understand if / when these files get updated in the future
One example is change-streams.json:
"comment": "Manually updated some of the timeoutMS and blockTimeMS to remove race conditions",
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.
Great suggestion, thank you! I've added the comment.
Fix test. JAVA-4055
JAVA-4055
JAVA-4055
JAVA-4055
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.
Looks really good - a couple of nits then LGTM.
// Tests expect maxTimeMS to be int32, but Java API requires maxTime to be a long. This massage seems preferable to casting | ||
if (command.containsKey("maxTimeMS")) { | ||
command.put("maxTimeMS", new BsonInt32(command.getNumber("maxTimeMS").intValue())); | ||
if (actualCommand.containsKey("maxTimeMS") && !isExpectedMaxTimeMsLong(expectedCommand)) { |
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.
Ugh - this is fun!!
@@ -110,7 +110,7 @@ | |||
"listCollections" | |||
], | |||
"blockConnection": true, | |||
"blockTimeMS": 60 |
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.
Can you add a comment in below the file description - just so its easier to understand if / when these files get updated in the future
One example is change-streams.json:
"comment": "Manually updated some of the timeoutMS and blockTimeMS to remove race conditions",
|
||
public static Mono<MongoDatabase> databaseWithTimeoutDeferred(final MongoDatabase database, | ||
@Nullable final Timeout timeout) { | ||
return Mono.defer(() -> databaseWithTimeoutMono(database, DEFAULT_TIMEOUT_MESSAGE, timeout)); |
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.
Nit: Chain to use databaseWithTimeoutDeferred
below.
Chain methods. JAVA-4055
# Conflicts: # driver-reactive-streams/src/test/functional/com/mongodb/reactivestreams/client/ClientSideOperationTimeoutProseTest.java
JAVA-4045
JAVA-4045
@vbabanin not sure if you were waiting for me on this, but I removed myself as a reviewer. |
JAVA-4045
This PR introduces support for the
timeoutMS
option in both automatic and explicit client-side encryption/decryption within the driver.Automatic encryption/decryption now uses the
timeoutMS
value for operational timeouts inlistCollections
,find
commands, and HTTP requests toKMS
servers.For explicit encryption/decryption, the
timeoutMS
option has been added inClientEncryptionSettings
, offering precise control over timeouts on the ClientEncryption object.Important Notes:
The handling of the
maxTimeMS
field for mongocryptd commands, as specified, will not be included in this PR due to current design limitations. The removal ofmaxTimeMS
in these scenarios, to maintain command integrity post-libmongocrypt processing, is scheduled for implementation in JAVA-5322, post a necessary refactoring.Similarly, spec requirement to ensure
maxTimeMS
is not sent to cryptd servers will be addressed in JAVA-5322, following the aforementioned refactoring.JAVA-4055