[SERVER-53675] Allow validate to fix up multikey metadata Created: 08/Jan/21  Updated: 29/Oct/23  Resolved: 29/Jan/21

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

Type: Improvement Priority: Major - P3
Reporter: Louis Williams Assignee: Louis Williams
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-14170 Investigate changes in SERVER-53675: ... Closed
Related
related to SERVER-56877 insert operations may fail to set ind... Closed
related to SERVER-57083 Coverity analysis defect 120111: Pars... Closed
related to SERVER-61509 full validation attempts to fix up mu... Closed
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2021-01-25, Execution Team 2021-02-08
Participants:
Case:

 Description   

Index multikey metadata can either become inconsistent with collection data or more permissive than the data requires. There are three main ways this can happen:

  1. Indexes built before 3.4 (SERVER-15086) lack path-specific multikey metadata. All fields in an index are considered multikey and require blocking sorts. See SERVER-33387.
  2. Collection data has changed such that certain document paths are no longer multikey.
  3. Bugs: SERVER-48471SERVER-47694SERVER-43074, etc.

Multikey metadata may only be made less restrictive. If a collection's data has changed such that an index no longer has multikey documents or the multikey paths include more fields than are multikey, then the multikey metadata may be inconsistent. This is correct and allowed by the implementation, but it can lead to undesirable performance problems. The only solution is to reindex.

Collection validation scans all documents and generates multikey information, and it has the ability to fix index multikey metadata without returning an error. Allow foreground validation to "fix up" the following permitted inconsistencies:

  • An index is multikey but there are no multikey fields
  • An index has multikeyPaths covering fields that are not multikey
  • An index does not have multikeyPaths but there are multikey documents (for pre-3.4 indexes)

 



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

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-53675 Allow validate to fix up multikey metadata

This allows foreground validation to fix up the following multikey
metadata inconsistencies:

  • An index is multikey but there are no multikey fields
  • An index has multikeyPaths covering fields that are not multikey
  • An index does not have multikeyPaths but there are multikey documents (for pre-3.4 indexes)

If any changes were made, a warning is included to the validate output
and the 'repaired' flag is set to true.
Branch: master
https://github.com/mongodb/mongo/commit/0d6199bb52dcae5978551816c6ac4ad98bda165b

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