Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-5976

fsyncLock documentation does not discuss behaviour of multiple locks

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Critical - P2 Critical - P2
    • Server_Docs_20231030
    • None
    • manual
    • None

    Description

      If you issue multiple calls to db.fsyncLock, each invocation takes a separate lock, and you need to ensure you pair an exact number (or greater number) of matching db.fsyncUnlock commands to unlock things.

      This is not necessarily intuitive behaviour - many people might assume there are only two states - locked and unlocked, and that multiple calls to db.fsyncLock whilst locked are simply idempotent (and similarly for db.fsyncUnclock).

      The output of the commands also doesn't give any clues about this behaviour either:

      > db.fsyncLock()
      {
              "info" : "now locked against writes, use db.fsyncUnlock() to unlock",
              "seeAlso" : "http://dochub.mongodb.org/core/fsynccommand",
              "ok" : 1
      }
      

      > db.fsyncUnlock()
      { "ok" : 1, "info" : "unlock completed" }
      

      Nor is it mentioned on either the documentation for fsync or db.fsyncLock:

      Is it possible to document this behaviour in either/both of those locations?

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            victor.hooi Victor Hooi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              5 years, 45 weeks, 6 days ago