decouple lock file creation from storage engine initialization

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Engines, Storage Engines - Server Integration
    • SESI - 2025-09-30
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Create lock file early in mongod startup and truncate lock file at the end of the shutdown task (not as part of the storage engine shutdown).

      The mongod process creates a mongod.lock file in the data directory containing the process ID. This file is also used by process management tools to detect a running mongod process because we clear the file contents on a clean shutdown.

      For historical reasons, the creation of this lock file is done as part of storage engine initialization.

      This is generally not an issue unless we experience a long delay between process startup and storage engine creation. In those cases, the process management tools may fail to detect a live mongod process and subsequently attempt to start a new mongod, which may result in log files being clobbered or having multiple processes failing to complete the startup procedure.

      We should take into consider cases where the storage engine is shutdown and re-initialized.

            Assignee:
            Aaron Balsara
            Reporter:
            Benety Goh
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: