Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-28352

Fix ticks increment in LogicalCLock::reserveTicks

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.6
    • Affects Version/s: None
    • Component/s: Sharding
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Repl 2017-03-27, Repl 2017-04-17

      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};
      }
      

            Assignee:
            william.schultz@mongodb.com William Schultz (Inactive)
            Reporter:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: