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

fsyncLock documentation does not discuss behaviour of multiple locks

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Critical - P2 Critical - P2
    • Server_Docs_20231030
    • Affects Version/s: None
    • Component/s: manual
    • Labels:
      None

      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?

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

              Created:
              Updated:
              Resolved:
              6 years, 5 weeks, 1 day ago