MongoDB 3.6 – Cleaning Up Journal Files to Save Disk Space

mongodbmongodb-3.6

We have recently upgraded to MongoDB 3.6 and since then we have noticed that the journal files keep building up and are not getting cleaned. Due to this, the disk usage keeps growing until there is no space left on the disk.

This issue does not occur with MongoDB 3.4. Is there anyway to enforce cleanup of journal files in MongoDB 3.6?

Update on data volumes:
We process around 148 GB of data every day. The disk space that the MongoDB data files use is around 60 GB. However, the journal files use up additional 70 GB of space everyday. Since the journal files are not getting cleaned up, the total disk space used increases by 70 GB everyday.

Best Answer

This is a known issue recently discovered in the MongoDB 3.6.3 release when using WiredTiger on Windows: SERVER-33982: Unbounded growth of pre-allocated log files.

This issue will be corrected in the 3.6.4 production release, so upgrading to MongoDB 3.6.4 (or newer) when available should resolve the issue.

In the interim, possible workarounds are:

  • Disable WiredTiger preallocation in 3.6.3

    • In your MongoDB config file:

      storage:
        wiredTiger:
          engineConfig:
            configString: log=(prealloc=false)
      
    • Or, via command-line parameter:

      --wiredTigerEngineConfigString=log=(prealloc=false)
      
  • Downgrade to MongoDB 3.6.2

  • Restart your mongod to free up the preallocated space