MongoDB Journaling : Is the journal file used when the client request a non journal write and journaling is activated on Mongod

我是研究僧i 提交于 2019-12-12 02:57:41

问题


I try to uderstand how journaling is exactly working : is that correct ?

When no journaling is activated on the server side (mongod --nojournal) :

  1. (a) If the client request a journaled write it will output an error (from 2.6, before it was ignored),
  2. (b) If the client request a non journaled write, journaling will not be used so I guess change will be made on RAM, then the OS will flush changes to data file evry 60s.

When journaling is activated on Mongod (mongod --journal (default on 64 bits version):

  1. (a) If the client request a journaled write, mongoDB will acknowledge write in the master node only after commiting data into journal, also so as to make the client not to take too much time to perfrom the write, Mongod will reduce the commit interval.
  2. (b) If the client request a non journaled write, mongoDB will use the journal and acknowledge write from the master node without waiting the data to be committed to the journal.

I actually did not find anything in the official documentation about case 2(b), could someone confirm if journal is used when j is false on the client side but journaling is activated on the mongod ?


回答1:


Your assertions are all correct. I think the language you are using is confusing and may be confusing you a little bit, however. Clients don't request writes that are journaled or non-journaled. If journaling is on, writes will be journaled, regardless of what the client does. What the client includes is a write concern that requires a certain level of data replication (the w parameter) and/or journaling (the j parameter) before the server responds that the write is a success. What you mean by a non-journaled write is j = 0, which means the server will respond with success without waiting for the write to be committed to the journal; j = 1 means the server will not respond to the write until it has been committed to the journal.

The w parameter controls the level of replication of the data necessary for a successful response. There's more detail in the link above.



来源:https://stackoverflow.com/questions/25344559/mongodb-journaling-is-the-journal-file-used-when-the-client-request-a-non-jour

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!