MongoDB Read Concern/Write Concern in IAP
  • 27 Apr 2023
  • Dark
    Light
  • PDF

MongoDB Read Concern/Write Concern in IAP

  • Dark
    Light
  • PDF

Article summary

When MongoDB is upgraded to version 5.0, the default settings for readConcern and writeConcern operations will change. Moreover, the default settings may impact the execution of workflow jobs or deteriorate overall job execution performance. Hence, Itential recommends that additional care is taken when setting these default values. This release alert provides additional guidance on how to configure the default values for readConcern and writeConcern in MongoDB.


⁃ For detailed information on read/write concern operations, please refer to the official MongoDB guide: Default MongDB Read Concerns/Write Concerns.

⁃ For information on installing and configuring MongoDB with Itential Automation Platform (IAP), see: Installing MongoDB Dependency.

Read Concern

If the default value of readConcern is set to "majority", the IAP database client is not configured to observe this setting. Additionally, you may have issues where the execution of jobs are impacted. To resolve this situation, set readConcern to "local" on MongoDB.

  1. Run this command to check the existing default settings.

    db.adminCommand({ getDefaultRWConcern: 1 })
    
  2. Set the default readConcern to "local" level.

    db.adminCommand(
      {
        setDefaultRWConcern : 1,
        defaultReadConcern: { “level“: “local“ }
      }
    )
    

Write Concern

If the default value of writeConcern is set to "majority", there could be a delay in job execution because the client not only has to write to a primary MongoDB, but also to secondary databases. Itential recommends that you evaluate how critical the data is within replica sets and set the writeConcern value accordingly.


If having a write replication is not important, you can disable this property with the following command.

db.adminCommand(
  {
    setDefaultRWConcern: 1,
    defaultWriteConcern: {},
  }
)

If you want replication on the "majority" of the replica sets, use the following command.

db.adminCommand(
  {
    setDefaultRWConcern : 1,
    defaultWriteConcern: {"level": "majority"},
  }
)

Further Reading

For detailed information on the database commands to retrieve default read/write concern settings, see:

Customer Support

If you are unsure of how to specify the default read/write concern settings and need assistance, please open a service request ticket using the Customer Portal. The Itential Support Team is available to help with any clarifications.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.