[SERVER-9533] getLastError with j:true does not set err if journaling disabled Created: 01/May/13  Updated: 11/Jul/16  Resolved: 13/Sep/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 2.5.0
Fix Version/s: 2.5.3

Type: Bug Priority: Major - P3
Reporter: Andrew Emil (Inactive) Assignee: J Rassi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-10775 get_last_error.js failing on multiple... Closed
Operating System: ALL
Participants:

 Description   

Start a mongod with --nojournal, then go to your favorite driver and do and insert with j=true. The document will still insert despite the fact that it never hits the journal.

Seems like j=true should enforce that the document makes it to the journal no matter what, so it should not successfully insert and return when the journal is not on.



 Comments   
Comment by auto [ 13/Sep/13 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-9533 With --nojournal, getLastError w/ j:true should set err
Branch: master
https://github.com/mongodb/mongo/commit/f835c63943f27c57aa7281e1505c44c60f016482

Comment by J Rassi [ 06/May/13 ]

Please file an issue with the driver to catch this and expose it.

Don't think that catching jnote is the correct resolution for this. I believe "err" should be set here ("nojournal"?). Compare j:true with --nojournal to w:2 without --replSet:

> db.runCommand({"getLastError":1,w:2})
{
	"n" : 0,
	"connectionId" : 3,
	"wnote" : "no replication has been enabled, so w=2.0 won't work",
	"err" : "norepl",
	"ok" : 1
}
> db.runCommand({"getLastError":1,j:true})
{
	"n" : 0,
	"connectionId" : 3,
	"jnote" : "journaling not enabled on this server",
	"err" : null,
	"ok" : 1
}

Comment by Scott Hernandez (Inactive) [ 02/May/13 ]

An warning is returned. Please file an issue with the driver to catch this and expose it.

> db.adminCommand("getCmdLineOpts")
{
	"argv" : [...
		"--nojournal"...]
	},
	"ok" : 1
}
> db.runCommand({getLastError:true, j:true})
{
	"n" : 0,
	"lastOp" : {
		"t" : 1367429879,
		"i" : 1
	},
	"connectionId" : 1,
	"jnote" : "journaling not enabled on this server",
	"err" : null,
	"ok" : 1 }

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