Link between Private View & Shared ViewĪfter the commit happens, it is marked as a process in journal directory, and there is another mapping done for current view of shared/private view (with no data sharing).
Also, the shared view has the data but journal directory has the operations.įor example, if the user is writing some data without Journaling, then whatever data is written, its memory mapping lets the user know the location where the data is written. Journaling is temporary storage, which means it keeps only write operation log as pending in journal directory. Using Journaling is like using a log, the reason being, it creates a write operation log to increase the durability. The data here is marked as processed in the journal directory, which means that every sixty seconds, it checks the data it has copied and those that are supposed to be removed from journal. Here, once a commit happens, the same operation is replayed in shared view and then, after sixty seconds, the flash disc happens.Īfter it is flashed, the data is processed. In a scenario where an abruption occurs at any point of time or flash disc remains unavailable for last 59 seconds (keeping in mind the existing data in journal directory/write operations), then when the next time mongod starts, it basically replays all write operation logs and writes into the actual data directory. The basic advantage is, we have a reduced cycle from 60 seconds to 200 milliseconds. As part of the process, it gets written to actual data directory from the shared view (as this process happens in background). Once the journal commit happens, mongod pushes data into shared view. After a specified interval, which is called a ‘journal commit interval’, the private view writes those operations in journal directory (residing in the disc). The first block is memory and the second block is ‘my disc’. In this process, a write operation occurs in mongod, which then creates changes in private view. Here, Journal Directory is a child directory inside data directory and by default is enabled. The moment the mongod process starts, the following statement can be observed: It is important to know that Journaling was disabled before version 2.4.10 by default but after that it has been enabled. Here, this process is called the No Journal Option, which means that in case there is a 60 second delay to save data from memory to disc or abrupt shutdown, it means that whatever data is in memory may not be retrieved. Here, it first pushes all data to memory and after a specified interval it flashes the data into memory, which occurs every sixty seconds and the user is not impacted in this process. It is called shared because it has memory mapping in actual disc.įor example, the user’s data file is kept at data dd and, it has a memory mapping. Mongod primarily hosts the write operations in memory in shared view.