[SERVER-36570] Make OplogEntry mutable Created: 10/Aug/18 Updated: 29/Oct/23 Resolved: 13/Jun/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | None |
| Fix Version/s: | 4.2.1, 4.3.1 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Siyuan Zhou | Assignee: | Lingzhi Deng |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | former-quick-wins | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Backport Requested: |
v4.2
|
||||||||||||||||||||
| Sprint: | Repl 2019-06-17 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
The goal is to allow building OplogEntry progressively and pass OplogEntry into logOp(), which has 13 arguments right now, and the functions under it. This ticket is a prerequisite of that work. Building oplog entry with 16 arguments is cumbersome and hard to read. We've seen people define various makeOplogEntry() helpers, especially in tests, to ease it. The ticket will help on that too. In As of now, I think it's possible to make OplogEntry mutable again. The comparison of OplogEntry is only called by dasserts and in tests. It's fine to replace them with a slower version or invariant raw is set. After benety.goh's applier refactoring, OplogEntry replaces BSONObj in the whole oplog application process after popping from the oplog buffer (SyncTail::tryPopAndWaitForMore). The raw field is only used at where we write down the original oplog entry on secondary, which makes sense for performance reasons. We could make raw private as this comment says, expose a getter and add an invariant to ensure it's set. We'll need to audit the types in secondary oplog application to make sure OplogEntry is referenced as const everywhere. Another idea is to rename OplogEntry to MutableOplogEntry and make OplogEntry as const MutableOplogEntry. Private inheritance or explicitly delete the inherited methods in a subclass are other ideas.
|
| Comments |
| Comment by Githook User [ 30/Aug/19 ] |
|
Author: {'name': 'Lingzhi Deng', 'username': 'ldennis', 'email': 'lingzhi.deng@mongodb.com'}Message: Also make OplogEntry.raw private (cherry picked from commit 25f11192a656ff72a2fe54e8b5e1373f84381953) |
| Comment by Githook User [ 12/Jun/19 ] |
|
Author: {'name': 'Lingzhi Deng', 'email': 'lingzhi.deng@mongodb.com', 'username': 'ldennis'}Message: Also make OplogEntry.raw private |