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

Fix DistLockCatalog ping() from failing every first call

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Sharding
    • None
    • Sharding
    • Fully Compatible
    • ALL

    Description

      FindAndModify upserts return "null" in the "value" field, which ping() inspects to determine whether the command was successful or not. So the first ping() call always fails, which appears to do no harm because the use case only logs a warning and continues to the next ping(), which succeeds.

      The unit test is incorrect and creates a return BSONObj with a filled out "value" field, so the testing passes anyway. Seems like you can just add

      request.setShouldReturnNew(true);

      in ping(), and the first ping won't be interpreted as failed because it has a non-null "value" field. The helper function _extractFindAndModifyNewObj is a little ugly, though, because it's limited to null meaning failure, so the other option is to refactor it to parse some more details from the BSONObj it inspects.

      Unit tests around the functions using _extractFindAndModifyNewObj should be checked for correctness afterwards.

      Attachments

        Activity

          People

            backlog-server-sharding [DO NOT USE] Backlog - Sharding Team
            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: