[SERVER-43412] Create a wrapper around getCursor calls for the oplog collection that ensures oplog visibility rules are enforced Created: 23/Sep/19 Updated: 06/Dec/22 Resolved: 02/Apr/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Storage |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Dianna Hohensee (Inactive) | Assignee: | Backlog - Storage Execution Team |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Storage Execution
|
||||||||
| Participants: | |||||||||
| Description |
|
Motivation: enforce oplog visibility rules. An oplog collection read should in most cases be the first operation in a WT transaction, so as to select a snapshot using the _oplogVisibleTs and not see any oplog holes. Currently, getCursor() will call setIsOplogReader() for oplog reads, so the the _oplogVisibleTs is used when opening a WT txn.
Therefore, we're proposing trying to create a wrapper function around getCursor() calls against the oplog collection, say getOplogCursor(). This new function could take a boolean for visibility rules: the default is to obey the visibility rule; but it can be explicitly overridden by callers we do not wish to follow the restrictions. Given how many callers there are of getCursor(), it may be simpler to do something like this
And swap oplog cursor only codepaths using getCursor() with getOplogCursor(/*ignoreOplogVisibilityRule*/ true) (if they ignore the visibility rules). However, there are also callers like in the createCollection code path, where we would need to add special
So maybe getCursor() should have a visibility boolean, too. May need to elevate the setIsOplogReader() and getIsOplogReader() functions from the WiredTigerRecoveryUnit to the RecoveryUnit interface, so higher level callers external to WT can call them – would need a new unsetIsOplogReader() function, too, if this implementation is desired. |