[SERVER-11860] removeUnneededJournalFiles assumes journal files exist, causing spurious warnings Created: 26/Nov/13  Updated: 06/Dec/22  Resolved: 14/Sep/18

Status: Closed
Project: Core Server
Component/s: MMAPv1, Storage
Affects Version/s: 2.5.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Kevin Pulo Assignee: Backlog - Storage Execution Team
Resolution: Won't Fix Votes: 0
Labels: journal
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Storage Execution
Operating System: ALL
Participants:

 Description   

For files that are eligible, dur::Journal::removeUnneededJournalFiles() calls removeOldJournalFile to recycle/remove the journal file.

However, in the meantime, another thread may have already done this, via dropDatabase or fsyncLock, both of which call

  • syncDataAndTruncateJournal
  • journalCleanup
  • Journal::cleanup
  • removeJournalFiles

This causes removeOldJournalFile to spuriously complain about the missing journal file when it tries to rename/remove it, falsely suggesting that the journal file has been prematurely removed (either by mongod or by something else).

A quick fix would be for removeOldJournalFile to simply check that the given path exists and short circuit return if not. That will still leave a brief TOCTTOU race, so it might be better to figure out a real/more appropriate fix.


Generated at Thu Feb 08 03:26:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.