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

MongoDB - Fix write_concern param #18546

Merged
merged 5 commits into from
Dec 23, 2022
Merged

MongoDB - Fix write_concern param #18546

merged 5 commits into from
Dec 23, 2022

Conversation

Zlaticanin
Copy link
Contributor

@Zlaticanin Zlaticanin commented Dec 23, 2022

When Vault deletes a user on a MongoDB replica, it always uses WriteConcern = 'majority' despite the setting in the connection configuration.

Results from the log without the fix using write_concern="{\"W\": 1}":

{"t":{"$date":"2022-12-21T23:58:20.295+00:00"},"s":"I",  "c":"COMMAND",  "id":51803,   "ctx":"conn52","msg":"Slow query","attr":{"type":"command","ns":"admin.$cmd","appName":"mongosh 1.6.1","command":{"dropUser":"v-token-XXXXX-XXXXXXXXXXX-XXXXXX","writeConcern":{"w":"majority"},"lsid":{"id":{"$uuid":"503728f4-f4a7-45bc-bee5-cd9f36bf831b"}},"$clusterTime":{"clusterTime":{"$timestamp":{"t":1671667098,"i":1}},"signature":{"hash":{"$binary":{"base64":"AAAAAAAAAAAAAAAAAAAAAAAAAAA=","subType":"0"}},"keyId":0}},"$db":"admin","$readPreference":{"mode":"primaryPreferred"}},"numYields":0,"reslen":163,"locks":{"ParallelBatchWriterMode":{"acquireCount":{"r":2}},"FeatureCompatibilityVersion":{"acquireCount":{"r":3,"w":2}},"ReplicationStateTransition":{"acquireCount":{"w":5}},"Global":{"acquireCount":{"r":3,"w":2}},"Database":{"acquireCount":{"w":2}},"Collection":{"acquireCount":{"w":2}},"Mutex":{"acquireCount":{"r":2}}},"flowControl":{"acquireCount":2,"timeAcquiringMicros":1},"writeConcern":{"w":"majority","wtimeout":0,"provenance":"clientSupplied"},"storage":{},"remote":"172.24.0.1:62688","protocol":"op_msg","durationMillis":5}}

Results from the log with the fix using write_concern="{\"W\": 1}":

{"t":{"$date":"2022-12-23T21:26:35.031+00:00"},"s":"I",  "c":"COMMAND",  "id":51803,   "ctx":"conn76","msg":"Slow query","attr":{"type":"command","ns":"admin.$cmd","appName":"mongosh 1.6.1","command":{"dropUser":"v-token-my-role-XXXXX-XXXXXXXXXXX-XXXXXX","writeConcern":{"w":1},"lsid":{"id":{"$uuid":"07037c7b-6701-4cbb-8547-4ee40ba97542"}},"$clusterTime":{"clusterTime":{"$timestamp":{"t":1671830794,"i":1}},"signature":{"hash":{"$binary":{"base64":"AAAAAAAAAAAAAAAAAAAAAAAAAAA=","subType":"0"}},"keyId":0}},"$db":"admin","$readPreference":{"mode":"primaryPreferred"}},"numYields":0,"reslen":163,"locks":{"ParallelBatchWriterMode":{"acquireCount":{"r":2}},"FeatureCompatibilityVersion":{"acquireCount":{"r":3,"w":2}},"ReplicationStateTransition":{"acquireCount":{"w":5}},"Global":{"acquireCount":{"r":3,"w":2}},"Database":{"acquireCount":{"w":2}},"Collection":{"acquireCount":{"w":2}},"Mutex":{"acquireCount":{"r":2}}},"flowControl":{"acquireCount":2,"timeAcquiringMicros":1},"writeConcern":{"w":1,"wtimeout":0,"provenance":"clientSupplied"},"storage":{},"remote":"172.20.0.1:56816","protocol":"op_msg","durationMillis":1}}

@Zlaticanin Zlaticanin requested a review from a team December 23, 2022 21:32
Copy link
Contributor

@swenson swenson left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@austingebauer austingebauer left a comment

Choose a reason for hiding this comment

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

We should backport this as well. Thanks, @MilenaHC 👍

@Zlaticanin Zlaticanin merged commit 159b60a into main Dec 23, 2022
@Zlaticanin Zlaticanin deleted the mongodb-writeconcern-fix branch December 23, 2022 23:14
AnPucel pushed a commit that referenced this pull request Jan 14, 2023
* fix writeconcern defaulting to majority

* add changelog

* restart CI tests

* fix tests

* add package
AnPucel pushed a commit that referenced this pull request Feb 3, 2023
* fix writeconcern defaulting to majority

* add changelog

* restart CI tests

* fix tests

* add package
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.

4 participants