[SERVER-71638] Don't let to hide the last shard key index using a key pattern Created: 28/Nov/22  Updated: 29/Oct/23  Resolved: 19/Dec/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 6.0.3, 6.1.0-rc4, 6.2.0-rc1, 6.3.0-rc0
Fix Version/s: 6.0.4, 6.3.0-rc0

Type: Bug Priority: Major - P3
Reporter: Pol Pinol Assignee: Pol Pinol
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.2, v6.0
Sprint: Sharding EMEA 2022-12-12, Sharding EMEA 2022-12-26
Participants:

 Description   

When we have only one shard key index, we cannot hide it.

This behaviour is implemented checking the name of the index:

assert.commandFailed(coll.hideIndex("skey_1")); // OK

But we can still hide the index using the key pattern (not correct):

assert.commandFailed(coll.hideIndex({skey: 1})); // KO

And we will jump the checks and hide it.

To be able to solve this issue we must get the indexName from the cmrIndex->idx and not from the local variable indexName in coll_mod.cpp.



 Comments   
Comment by Githook User [ 22/Dec/22 ]

Author:

{'name': 'Pol Pinol Castuera', 'email': 'pol.pinol@mongodb.com', 'username': 'PolPinol'}

Message: SERVER-71638 Don't let to hide the last shard key index using a key pattern

(cherry picked from commit 24f7086280a10a2d3f8a19ae42900a270c455bba)
Branch: v6.0
https://github.com/mongodb/mongo/commit/6bf83b49b7addb3b111c6ca7c2ba33e652f971af

Comment by Githook User [ 19/Dec/22 ]

Author:

{'name': 'Pol Pinol Castuera', 'email': 'pol.pinol@mongodb.com', 'username': 'PolPinol'}

Message: SERVER-71638 Don't let to hide the last shard key index using a key pattern
Branch: master
https://github.com/mongodb/mongo/commit/24f7086280a10a2d3f8a19ae42900a270c455bba

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