[SERVER-53739] Validate all createIndexes options Created: 13/Jan/21  Updated: 29/Oct/23  Resolved: 20/Jan/21

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Documented
is documented by DOCS-14129 Investigate changes in SERVER-53739: ... Closed
Duplicate
is duplicated by SERVER-49224 Improve validation of index spec fields Closed
Problem/Incident
is caused by SERVER-52545 Specify input/output to listIndexes c... Closed
Related
related to SERVER-52539 Specify input/output to createIndexes... Closed
related to SERVER-53765 Validate index entries at catalog layer Backlog
is related to SERVER-26287 createIndexes should confirm that ind... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Sprint: Repl 2021-01-25
Participants:
Case:
Linked BF Score: 14

 Description   

My change to the "listIndexes" IDL (SERVER-52545) has caused an intermittent failure in jstestfuzz_replication_initsync, I think this is the sequence:

  • the fuzzer generates a createIndexes command like {createIndexes: [ {key: "foo", dropDups: "some string"}]}
  • that's wrong because "dropDups" is supposed to be a bool, but createIndexes succeeds anyway (its parameter validation is spotty, awaiting SERVER-52539) and creates a corrupt catalog entry
  • subsequent "listIndexes" commands fail with a uassert, because they now strictly parse the catalog entries. The message is like: "Could not parse catalog entry while replying to listIndexes"
  • initial sync is now impossible because the sync source can't answer "listIndexes". The initial-sync node crashes, logging:

    > "Fatal assertion","attr":{"msgid":40088,"error":"InitialSyncFailure: error cloning databases :: caused by :: Location5254501: Error cloning collection 'qa450.existingname' :: caused by :: listIndexes failed: { ok: 0.0, errmsg: \"Could not parse catalog entry while replying to listIndexes\", code: 5254501, codeName: \"Location5254501\",
    

    This may be fixed by SERVER-52539 "Specify input/output to createIndexes command in IDL", which will make createIndexes as strict as listIndexes. But I want to fix the BF sooner than that, so this ticket is a bandaid. Besides, there may be value to validating index options at several levels, that'll be more clear once SERVER-52539 is done.

(In retrospect, we should've converted createIndexes before listIndexes, but I didn't anticipate this issue.)

I made createIndexes validate the "background" option in this commit, now I'll validate the rest of the options.



 Comments   
Comment by Githook User [ 20/Jan/21 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com', 'username': 'ajdavis'}

Message: SERVER-53739 Validate all createIndexes options

Prevent createIndexes from creating invalid index catalog
entries, which would make listIndexes fail.
Branch: master
https://github.com/mongodb/mongo/commit/c4c0d3a44248a1ba0b6c45557d0e7a8ebb210386

Comment by Githook User [ 15/Jan/21 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: Revert "SERVER-53739 Temporary code to validate all createIndexes options"

This reverts commit c8e3d8c339141e4799b2c3519b54eb79025dea3d.
Branch: master
https://github.com/mongodb/mongo/commit/10a6722a4d59da05e55d778588d57b5fdb23594b

Comment by Githook User [ 14/Jan/21 ]

Author:

{'name': 'A. Jesse Jiryu Davis', 'email': 'jesse@mongodb.com', 'username': 'ajdavis'}

Message: SERVER-53739 Temporary code to validate all createIndexes options

Temporary fix to prevent createIndexes from creating invalid index catalog
entries, which would make listIndexes fail. The thorough fix will be in
SERVER-52539.
Branch: master
https://github.com/mongodb/mongo/commit/c8e3d8c339141e4799b2c3519b54eb79025dea3d

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