[SERVER-28352] Fix ticks increment in LogicalCLock::reserveTicks Created: 16/Mar/17  Updated: 06/Dec/17  Resolved: 30/Mar/17

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 3.5.6

Type: Bug Priority: Major - P3
Reporter: Misha Tyulenev Assignee: William Schultz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-17887 Overflow generated OpTimes from i fie... Closed
Related
related to SERVER-28420 For unit testing add LogicalClock tha... Closed
is related to SERVER-18557 Change oplog OpTime format to raw 64b... Backlog
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Repl 2017-03-27, Repl 2017-04-17
Participants:

 Description   

https://github.com/mongodb/mongo/blob/master/src/mongo/db/logical_clock.cpp#L130-L135 :
this code has at least two bugs in it:
1) it should be ">="
2) ticks suppose to overflow into the seconds if they are > 2**31.

the fix is something like

invariant(ticks < 1U << 30)
if (clusterTimestamp.asTimestamp().getInc() + ticks >= 1U << 31) {
        clusterTimestamp = {clusterTimestamp.asTimestamp().getTime() + 1, 1};
}



 Comments   
Comment by Githook User [ 30/Mar/17 ]

Author:

{u'username': u'DiannaHohensee', u'name': u'Dianna Hohensee', u'email': u'dianna.hohensee@10gen.com'}

Message: SERVER-28352 fix lint
Branch: master
https://github.com/mongodb/mongo/commit/44a255411673084a9ec10ce34a9535b828943d90

Comment by Githook User [ 30/Mar/17 ]

Author:

{u'username': u'will62794', u'name': u'William Schultz', u'email': u'william.schultz@mongodb.com'}

Message: SERVER-28352 Fix ticks increment in LogicalClock::reserveTicks
Branch: master
https://github.com/mongodb/mongo/commit/e77e2d54ab07f5d08580ea66e733b49372cf00e2

Generated at Thu Feb 08 04:17:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.