[SERVER-47193] createIndexes command accepts "commitQuorum" option on 4.2 servers Created: 30/Mar/20  Updated: 29/Oct/23  Resolved: 08/Apr/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 4.2.5
Fix Version/s: 4.2.6

Type: Bug Priority: Major - P3
Reporter: Patrick Freed Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-47337 [v4.4] Only allow the commitQuorum op... Closed
Documented
is documented by DOCS-13575 Investigate changes in SERVER-47193: ... Closed
Related
is related to SERVER-47462 Remove 'SetIndexCommitQuorum' command... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Steps To Reproduce:

> db.runCommand({createIndexes: "test", indexes: [{ name: "a", key: { a: 1 }}], commitQuorum: "all" })
{
        "createdCollectionAutomatically" : false,
        "numIndexesBefore" : 5,
        "numIndexesAfter" : 6,
        "ok" : 1
}
> db.runCommand({createIndexes: "test", indexes: [{ name: "aaa", key: { xaaaaaa: 1 }}], asdfasdf: "all" })
{
        "ok" : 0,
        "errmsg" : "Invalid field specified for createIndexes command: asdfasdf",
        "code" : 2,
        "codeName" : "BadValue"
}

Sprint: Execution Team 2020-04-20
Participants:

 Description   

commitQuorum is accepted without error on 4.2 servers despite not having any effect on createIndexes (it does have an effect starting in 4.3/4.4). All other invalid options passed to createIndexes do return errors, and the drivers rely on this to communicate errors to end users. Since commitQuorum doesn't have an effect on 4.2, it should throw an error as if it's invalid too.



 Comments   
Comment by Githook User [ 08/Apr/20 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-47193 createIndexes should not accept the 'commitQuorum' option
Branch: v4.2
https://github.com/mongodb/mongo/commit/2326917dd1e6b19f48cc4f10c5ba8e80e6a10270

Comment by Eric Milkie [ 31/Mar/20 ]

After some team discussion, we've decided we can make this change in a 4.2 release, as it is not a dangerous backport to make.

Comment by Louis Williams [ 31/Mar/20 ]

The danger is that if a user builds an index with a 'commitQuorum' setting on a 4.2 mongod or even a 4.4 mongod in FCV 4.2, they will run into issues surrounding single-phase index builds (i.e. SERVER-21307) without being aware they did anything wrong.

Comment by Eric Milkie [ 31/Mar/20 ]

commitQuorum is already a valid option to createIndexes in 4.2.0-4.2.5; there is simply no reason to use it other than for internal testing. I don't see a compelling reason to make it an invalid option in 4.2.6, as there is no danger if a user specifies the option, even if by mistake.

Comment by Patrick Freed [ 31/Mar/20 ]

I can't think of any reason why someone would want the commitQuorum flag on 4.2 to do anything, since its behavior is only necessary to prevent loss of write availability on 4.4+.

Exactly, so the suggestion is that the server should return an error if the flag is specified. As of SERVER-769, createIndexes validates all the options passed to it, and as far as a 4.2 user is concerned, commitQuorum isn't a valid option, so it would be inconsistent to silently accept it. Consistency is important here because drivers rely on the server's validation to return errors, making that validation effectively an extension of the drivers' API.

 

Comment by Eric Milkie [ 31/Mar/20 ]

I think we should just document it has no effect on 4.2. I can't think of any reason why someone would want the commitQuorum flag on 4.2 to do anything, since its behavior is only necessary to prevent loss of write availability on 4.4+.

Generated at Thu Feb 08 05:13:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.