[SERVER-15117] Bulk write with invalid writeConcern blindly accepted Created: 02/Sep/14  Updated: 10/Dec/14  Resolved: 02/Sep/14

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.6.4, 2.7.5
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jonathan Abrahams Assignee: Unassigned
Resolution: Done Votes: 0
Labels: 28qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File bulk_writeConcern.js     File fixed_bulk_writeConcern.js    
Issue Links:
Related
related to SERVER-15119 Accept a named "writeConcern" option ... Closed
is related to DOCS-3973 Add write concern example to bulk.exe... Closed
Operating System: ALL
Steps To Reproduce:
  • Create a 5 node replica set
  • Issue a bulk write of 1000 documents, with writeConcern of all nodes, i.e.,

    {writeConcern: {w: 5}}

  • Check each node for number of documents
  • See attached jstest for specific steps
Participants:

 Description   

Issuing a bulk write and specifying a writeConcern of all nodes is not enforced. The number of documents on the secondary nodes is not equal to the primary.



 Comments   
Comment by Eric Milkie [ 02/Sep/14 ]

In lieu of any code changes, let's add a documentation example for this usage. Linking to a docs ticket.

Comment by Scott Hernandez (Inactive) [ 02/Sep/14 ]

This is the same behavior as gle:

db.runCommand({getLastError:1, writeConcern:1})
{
	"lastOp" : Timestamp(0, 0),
	"connectionId" : 1,
	"n" : 0,
	"syncMillis" : 0,
	"writtenTo" : null,
	"err" : null,
	"ok" : 1
}

I do agree we can do better with validation, but we should fix it all at once. Pretty sure this issue already exists, much like validating command args.

Comment by Eric Milkie [ 02/Sep/14 ]

Seems like an issue with the Bulk interface in the shell.

Comment by Eric Milkie [ 02/Sep/14 ]

It's also an issue that if you pass an invalid writeConcern parameter, you get no error. Passing the same badness to the getLastError command results in an error, I believe.

Comment by Scott Hernandez (Inactive) [ 02/Sep/14 ]

Uploaded a fixed test, and it passes. I think we have test coverage for this already, but if not it might be good to add it in a sep. issue.

Comment by Eric Milkie [ 02/Sep/14 ]

I think this is a problem with the documentation: http://docs.mongodb.org/manual/reference/method/Bulk.execute/#Bulk.execute
It mentions a "writeConcern" parameter but it's not obvious that that is the documentation's name for it, not the key name actually used.

Comment by Scott Hernandez (Inactive) [ 02/Sep/14 ]

This js test is wrong. The arg to execute should be

{w:#}

, not

{writeConcern: {w:#}}

I think this is completely invalid.

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