mgo

SetSafe with Safe.J=true causes an error in Mongo 2.6.3 when journalling is disabled

Bug #1340275 reported by Andrew Wilkins on 2014-07-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mgo
Undecided
Unassigned

Bug Description

If I call SetSafe, with Safe.J=true, then I get an error if mongod was started with --nojournal. This conflicts with the documentation, which says:

"Since MongoDB 2.0.0, the safe.J option can also be used instead of FSync to force the server to wait for a group commit in case journaling is enabled. The option has no effect if the server has journaling disabled."

It appears that Mongo behaviour has changed. Either the mgo docs need changing, or mgo needs to somehow deal with 2.6.x differently. I've captured the SetSafe error message below:

... value *errors.errorString = &errors.errorString{s:"failed to initialize state: cannot create database index: cannot use 'j' option when a host does not have journaling enabled"} ("failed to initialize state: cannot create database index: cannot use 'j' option when a host does not have journaling enabled")

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Indeed. It's a shame that their behavior has changed, as it forces the code to change according to server flags users decide to use. I'll ponder a bit on what to do there.

Changed in mgo:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers