-
Notifications
You must be signed in to change notification settings - Fork 897
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
GODRIVER-2559 Do not connect to mongocryptd if shared library is loaded #1082
Conversation
mongo/client.go
Outdated
@@ -437,7 +437,7 @@ func (c *Client) configureAutoEncryption(clientOpts *options.ClientOptions) erro | |||
} | |||
|
|||
// If the crypt_shared library was loaded successfully, signal to the mongocryptd client creator | |||
// that it can bypass spawning mongocryptd. | |||
// that it can bypass spawning or connecting to mongocryptd. | |||
cryptSharedLibAvailable := mc.CryptSharedLibVersionString() != "" | |||
mongocryptdFLE, err := newMongocryptdClient(cryptSharedLibAvailable, clientOpts.AutoEncryptionOptions) |
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.
Is there anything in the mongocryptdClient
that we need when the crypt_shared library is loaded? Can we skip creating the client completely?
E.g.
if mc.CryptSharedLibVersionString() == "" {
mongocryptdFLE, err := newMongocryptdClient(clientOpts.AutoEncryptionOptions)
if err != nil {
return err
}
c.mongocryptdFLE = mongocryptdFLE
}
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 think no. Skipping creating the client seems preferable. Thank you for the suggested code. Updated.
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.
LGTM
Co-authored-by: Matt Dale <9760375+matthewdale@users.noreply.github.com>
Co-authored-by: Preston Vasquez <24281431+prestonvasquez@users.noreply.github.com>
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 good 👍
GODRIVER-2559
Summary
Background & Motivation
mongocryptd and the crypt shared library share the same functionality. Creating a
mongo.Client
to mongocryptd is unnecessary if using the shared library. mongocryptd will not be used if the shared library is used.