[SERVER-66744] Renaming view return wrong error on sharded cluster Created: 25/May/22  Updated: 29/Oct/23  Resolved: 26/Oct/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 5.0.7, 5.3.0-rc4, 6.0.0-rc7
Fix Version/s: 6.2.0-rc0

Type: Bug Priority: Major - P3
Reporter: Tommaso Tocci Assignee: Enrico Golfieri
Resolution: Fixed Votes: 0
Labels: read-only-views, sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
related to SERVER-78217 Renaming view return wrong error on s... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.1, v6.0, v5.0
Sprint: Sharding EMEA 2022-10-03, Sharding EMEA 2022-10-17, Sharding EMEA 2022-10-31
Participants:

 Description   

Renaming a view a is not supported and should return CommandNotSupportedOnView while this is the case on replica set and standalone it is not on sharded cluster.

In fact,  in sharded cluster, we return NamespaceNotFound error instead of CommandNotSupportedOnView.
This is because before to check if the nss is a view we throw NamespaceNotFound if the collection is not present in the local catalog

As part of this ticket we should also add test coverage for renaming view on sharded cluster.



 Comments   
Comment by Githook User [ 25/Oct/22 ]

Author:

{'name': 'Enrico Golfieri', 'email': 'enrico.golfieri@mongodb.com', 'username': 'enricogolfieri'}

Message: SERVER-66744 Renaming view in a sharded cluster must return same errors of plain replica set
Branch: master
https://github.com/mongodb/mongo/commit/81c7aea1d98d4d3e25bbed2ee7115b3bcd405702

Comment by Pierlauro Sciarelli [ 10/Jun/22 ]

sean.zimmerman@mongodb.com also noticed a similar inconsistency, pasting his original message:

I have a view named foo and a collection named bar and I am trying to rename bar to name foo. On a replica set I get error "NamespaceExists a view already exists with that name: test.foo", on a sharded cluster I get "CommandNotSupportedOnView Can't rename to target collection test.foo because it is a view."

Since sharded rename exists only since v5.0, we should align the error messages to be consistent with plain replica sets.

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