[SERVER-31356] make OplogEntry immutable Created: 02/Oct/17 Updated: 30/Oct/23 Resolved: 08/Nov/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | 3.5.13 |
| Fix Version/s: | 3.6.0-rc4 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Randolph Tan | Assignee: | Benety Goh |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||
| Sprint: | Repl 2017-11-13 | ||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||
| Description |
|
Current definition of == compares the 'raw' member variable. The 'raw' variable is only set in the constructor. If the object is mutated after, for example, calling setFromMigrate(), then it will no longer match the actual object. |
| Comments |
| Comment by Githook User [ 08/Nov/17 ] |
|
Author: {'name': 'Benety Goh', 'username': 'benety', 'email': 'benety@mongodb.com'}Message: |
| Comment by Githook User [ 08/Nov/17 ] |
|
Author: {'name': 'Benety Goh', 'username': 'benety', 'email': 'benety@mongodb.com'}Message: AbstractOplogFetcher |
| Comment by Githook User [ 07/Nov/17 ] |
|
Author: {'name': 'Benety Goh', 'username': 'benety', 'email': 'benety@mongodb.com'}Message: |
| Comment by Githook User [ 07/Nov/17 ] |
|
Author: {'name': 'Benety Goh', 'username': 'benety', 'email': 'benety@mongodb.com'}Message: ChangeStreamStageTest |
| Comment by Githook User [ 07/Nov/17 ] |
|
Author: {'name': 'Benety Goh', 'username': 'benety', 'email': 'benety@mongodb.com'}Message: |
| Comment by Githook User [ 07/Nov/17 ] |
|
Author: {'name': 'Benety Goh', 'username': 'benety', 'email': 'benety@mongodb.com'}Message: |
| Comment by Spencer Brody (Inactive) [ 06/Oct/17 ] |
|
It is required for 3.6 that we at least audit users of OplogEntry to see if any are mutating them while also using == or checking the 'raw' member |
| Comment by Spencer Brody (Inactive) [ 06/Oct/17 ] |
|
One possible fix for this would be to just make OplogEntry immutable |
| Comment by Randolph Tan [ 02/Oct/17 ] |
|
spencer I ran into this while writing C++ tests. So far, I don't think I use it on anything else explicitly. On the other hand, this function can potentially be called in places where it would be hard to trace, for example, unordered_map<OplogEntry>. So, it would be beneficial to have the == be correct in all cases. |
| Comment by Judah Schvimer [ 02/Oct/17 ] |
|
|
| Comment by Spencer Brody (Inactive) [ 02/Oct/17 ] |
|
renctan, can you comment a little more on the scope of this bug? How was it found? Is this causing an actual user-visible bug in any features that utilize this code, or this this just a defensive ticket to prevent it from being misused in the future? |