Skip to content
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

Merged
merged 8 commits into from
Nov 3, 2022

Conversation

kevinAlbs
Copy link
Contributor

@kevinAlbs kevinAlbs commented Sep 27, 2022

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.

@kevinAlbs kevinAlbs changed the title DRIVERS-2449 Do not connect to mongocryptd if shared library is loaded GODRIVER-2559 Do not connect to mongocryptd if shared library is loaded Oct 27, 2022
@kevinAlbs kevinAlbs marked this pull request as ready for review October 27, 2022 13:08
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)
Copy link
Collaborator

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
}

Copy link
Contributor Author

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.

mongo/integration/client_side_encryption_prose_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@prestonvasquez prestonvasquez left a comment

Choose a reason for hiding this comment

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

LGTM

kevinAlbs and others added 3 commits November 2, 2022 11:39
Co-authored-by: Matt Dale <9760375+matthewdale@users.noreply.github.com>
Co-authored-by: Preston Vasquez <24281431+prestonvasquez@users.noreply.github.com>
@kevinAlbs kevinAlbs requested a review from matthewdale November 2, 2022 15:59
Copy link
Collaborator

@matthewdale matthewdale left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@kevinAlbs kevinAlbs merged commit 28b8020 into mongodb:master Nov 3, 2022
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