What is the impact of concurrency on "primary replica set?
During the copy Copy process, when a write operation is performed on the master database, MongoDB is also writing the oplog of the master database. The oplog is a special set in the local database. (In replica set mode, local. oplog. RS is a capped collection set used to store oplog ). Therefore, MongoDB must lock the database for the current write operation and the local database. Mongod must lock these two databases to maintain data consistency and ensure that write operations are "All or all" operations.
Under what circumstances will multiple databases be locked?
MongoDB will lock Multiple databases in the following operations:
DB. copydatabase () enable global lock
Journaling is an internal operation that locks all databases in a short time. All libraries will share a journal.
User Authentication: locks the admin database and the database logged on.
All writes to a replica set's primary locks the database that receives write operations and the local database, and locks the local database so that mongod writes oplog in the primary.
The original text is as follows:
How Does concurrency affect a replica Set primary?
In replication, when MongoDB writes to a collection on the primary, MongoDB also writes to the primary's oplog, which is a special collection in the local database. therefore, MongoDB must lock both the collection's database and the local database. the specified D must lock both databases at the same time keep both data consistent and ensure that write operations, even with replication, are "all-or-nothing" operations.
Does a MongoDB operation ever lock more than one database?
The following MongoDB operations lock Multiple databases:
DB. copydatabase () must lock the entire specified D instance at once.
Journaling, which is an internal operation, locks all databases for short intervals. All databases share a single journal.
User Authentication locks the admin database as well as the database the user is accessing.
All writes to a replica set's primary lock both the database processing the writes and the local database. The lock for the local database allows the prior D to write to the primary's oplog.
Reference http://docs.mongodb.org/manual/faq/concurrency/