[DOCS-14821] Investigate changes in SERVER-59805: Provide a way to check for and to remove invalid index catalog options Created: 24/Sep/21  Updated: 13/Nov/23  Resolved: 01/Nov/21

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 5.0.4, 5.1.0-rc0, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Ian Fogelman
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
backported by DOCS-14842 [BACKPORT] [v5.0] Provide a way to ch... Closed
Documented
documents SERVER-59805 Provide a way to check for and to rem... Closed
Related
Participants:
Days since reply: 2 years, 14 weeks, 2 days ago
Epic Link: DOCSP-14300

 Description   
Downstream Change Summary
  • Adds a new 'metadata' flag to the 'validate' command which only performs validation on the collection metadata. This is to allow users to perform a quick validation to detect invalid index options without scanning all of the documents and indexes.
  • 'validate' detects invalid index options and recommends running 'collMod' to remove the invalid index options.

Sample log messages:
2021-09-24T14:43:20.964+00:00 I COMMAND 20514 [conn1] "CMD: validate","attr":

Unknown macro: {"namespace"}

2021-09-24T14:43:20.964+00:00 I STORAGE 5980501 [conn1] "Validation of metadata complete for collection. Problems detected","attr":{"namespace":"test.validate_detects_invalid_index_options","uuid":{"uuid":

Unknown macro: {"$uuid"}

}}

  • The 'collMod' command can be used to remove the invalid index options for all indexes on the given collection.

Can be executed through:
db.runCommand(

Unknown macro: {collMod}

)

Sample log messages:
2021-09-24T14:43:22.309+00:00 I COMMAND 5324200 [conn1] "CMD: collMod","attr":{"cmdObj":{"collMod":"collmod_removes_invalid_index_options"}}
2021-09-24T14:43:22.309+00:00 W INDEX 23878 [conn1] "Removing unknown field from index spec","attr":{"fieldName":"safe","indexSpec":{"v":2,"key":

Unknown macro: {"x"}

,"name":"x_1","safe":true,"sparse":true,"force":false}}
2021-09-24T14:43:22.309+00:00 W INDEX 23878 [conn1] "Removing unknown field from index spec","attr":{"fieldName":"force","indexSpec":{"v":2,"key":

Unknown macro: {"x"}

,"name":"x_1","safe":true,"sparse":true,"force":false}}
2021-09-24T14:43:22.309+00:00 W INDEX 23878 [conn1] "Removing unknown field from index spec","attr":{"fieldName":"xyz","indexSpec":{"v":2,"key":

Unknown macro: {"z"}

,"name":"z_1","xyz":false}}

Description of Linked Ticket

Invalid index options such as "safe" may have been created in the past, before the createIndexes command started validating options more strictly.

In MongoDB 5.0, the listIndexes command more strictly validates index options, and fails when an invalid option is encountered. At this point, the only option is to drop and recreate the index.

This feature request is for the validate command to remove these invalid options as it is validating an index. This would provide a much faster way than recreating the index when fixing an invalid index option.



 Comments   
Comment by Githook User [ 01/Nov/21 ]

Author:

{'name': 'ian fogelman', 'email': 'ian.fogelman@mongodb.com', 'username': 'ianf-mongodb'}

Message: DOCS-14821 Adding metadata flag context to validate()
Branch: master
https://github.com/mongodb/docs/commit/2405b9579f4fd9af667d1685a7823cd4f6eda5a9

Comment by PM Bot [ 24/Sep/21 ]

Downstream changes updated for upstream SERVER-59805:

  • Adds a new 'metadata' flag to the 'validate' command which only performs validation on the collection metadata. This is to allow users to perform a quick validation to detect invalid index options without scanning all of the documents and indexes.
  • 'validate' detects invalid index options and recommends running 'collMod' to remove the invalid index options.

Sample log messages:
2021-09-24T14:43:20.964+00:00 I COMMAND 20514 [conn1] "CMD: validate","attr":

{"namespace":"test.validate_detects_invalid_index_options","background":false,"full":false,"enforceFastCount":false,"repair":false}

2021-09-24T14:43:20.964+00:00 I STORAGE 5980501 [conn1] "Validation of metadata complete for collection. Problems detected","attr":{"namespace":"test.validate_detects_invalid_index_options","uuid":{"uuid":

{"$uuid":"f520fef6-e052-4505-8466-94ed602df91e"}

}}

  • The 'collMod' command can be used to remove the invalid index options for all indexes on the given collection.

Can be executed through:
db.runCommand(

{collMod: <collectionName>}

)

Sample log messages:
2021-09-24T14:43:22.309+00:00 I COMMAND 5324200 [conn1] "CMD: collMod","attr":{"cmdObj":{"collMod":"collmod_removes_invalid_index_options"}}
2021-09-24T14:43:22.309+00:00 W INDEX 23878 [conn1] "Removing unknown field from index spec","attr":{"fieldName":"safe","indexSpec":{"v":2,"key":

{"x":1}

,"name":"x_1","safe":true,"sparse":true,"force":false}}
2021-09-24T14:43:22.309+00:00 W INDEX 23878 [conn1] "Removing unknown field from index spec","attr":{"fieldName":"force","indexSpec":{"v":2,"key":

{"x":1}

,"name":"x_1","safe":true,"sparse":true,"force":false}}
2021-09-24T14:43:22.309+00:00 W INDEX 23878 [conn1] "Removing unknown field from index spec","attr":{"fieldName":"xyz","indexSpec":{"v":2,"key":

{"z":1}

,"name":"z_1","xyz":false}}

Generated at Thu Feb 08 08:11:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.