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

Use lambda instead of repeating code in resharding coordinator

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 5.0.13, 6.0.2, 6.1.0-rc3, 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • v6.1, v6.0, v5.0

      In src/mongo/db/s/resharding/resharding_coordinator_commit_monitor.cpp we have code 

      remainingTimes.max == Milliseconds::max() ? Milliseconds(-1) : remainingTimes.max 

      and 

      remainingTimes.min == Milliseconds::max() ? Milliseconds(-1) : remainingTimes.min 

      Because repeating code like this is error prone (although not a bug), and to be consistent with branches 5.0 and 6.0, we should rewrite this to use a lambda

                  auto returnIfNotMax = [](Milliseconds t) {
                      return t != Milliseconds::max() ? t : Milliseconds(-1);
                  }; 

            Assignee:
            andrew.witten@mongodb.com Andrew Witten (Inactive)
            Reporter:
            andrew.witten@mongodb.com Andrew Witten (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: