Records missing after successful write to DB with writeConcern w:1

Hi Team ,

Mongo java Driver : 3.12.9 (storage engine : MMapV1) , mongo server - 3.6 , PSA replica set , journalling enabled

My application uses writeConcern “w:1” while writing to database. During some load condition, with FullGC trigerred intermittenly causing App Pauses , we observed that application upserts some records in the DB successfully but after few hrs when appln tries to read the same the record it is not available in the database.

My Question: Does the “w:1” writeConcern not ensure the record is written to disk successfully ? is there a possiblity that record is created in memory but there can be failures while writing to the disk ?

With journaling enabled, yes. However the disk write here means journal file, not db data file.

this is of course possible, hardware can fail at any time. That’s why journaling is needed for prod servers.

Check out dirty pages and journaling concepts on Internet and you will notice the difference of their purposes.

In terms of why they are not there after hours, i am not sure. Maybe disk is full ? maybe it fails to flush dirty data to disk file? Check error logs.

Thanks Kobe for your reply.

Can you please indicate what logs I can check for failures for dirtty data flushes.


The most likely scenario for data loss with w:1 is because of a change of primary and subsequent rollback on the host that was previously primary.

You can read more about them here. If you have a rollback directory under the datadirectory, you have encountered a rollback at some point.

For best data durability w:'majority' is recommended.

Thanks a lot Chris for your clarification !

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.