[SERVER-15645] Order writes to replication oplog under document-level locking Created: 14/Oct/14  Updated: 11/Jul/16  Resolved: 10/Nov/14

Status: Closed
Project: Core Server
Component/s: Replication, Storage
Affects Version/s: None
Fix Version/s: 2.8.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

With the current state of replication, writes to the oplog need to be ordered. This was guaranteed through the database lock in 2.6, but now with document-level locking this is no longer true, so we need to have something, which serializes writers, but doesn't block readers.

One option is to add a 'REPL' lock resource. Might be able to do this with a simple boost mutex as well if we can prove that there cannot be deadlocks. Here is the sequence of an updater to a given database A:

Lock (A, IX)
Lock (A.Collection, IX)
... Do write using document-level locking, under the storage engine's transaction. Locks will be held till the end of the operation.
 
Lock (REPL, X)
 
Lock (LocalDB, IX)
Lock (LocalDB.Collection, IX)
... Do write under the same storage engine transaction
 
Unlock (REPL)       // This is a performance optimisation to release the lock early
 
Unlock All other locks

The oplog reader will look like this (it will skip locking the REPL resource):

Lock (LocalDB, IS)
Lock (LocalDB.Collection, IS)
... Locate the last unreplicated location
Unlock All



 Comments   
Comment by Githook User [ 10/Nov/14 ]

Author:

{u'username': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: SERVER-15645: allow writes to oplog in IX by managing reads to block on oldest ts
Branch: master
https://github.com/mongodb/mongo/commit/dd5b2d7f5cd96b4ca8acd01d15c5ac369c4f50f2

Comment by Githook User [ 10/Nov/14 ]

Author:

{u'username': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: SERVER-15645: clean up WiredTigerRecordStore::insertXXX
Branch: master
https://github.com/mongodb/mongo/commit/cdb864a8276b3e0f6c8b99fe68fc17989fbb15a4

Generated at Thu Feb 08 03:38:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.