[SERVER-60632] Inconsistent error on mongos when renameCollection target already exists Created: 12/Oct/21  Updated: 29/Oct/23  Resolved: 15/Nov/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 5.0.3
Fix Version/s: 5.2.0, 5.0.5, 5.1.1

Type: Bug Priority: Minor - P4
Reporter: Jeremy Mikola Assignee: Pierlauro Sciarelli
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-65802 mongos returns inconsistent error cod... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.1, v5.0
Sprint: Sharding EMEA 2021-11-29
Participants:

 Description   

 

When renaming a collection to a target that already exists (without specifying dropTarget) renameCollection will fail with the following:

  • errmsg: "target namespace exists"
  • code: 48
  • codeName: "NamespaceExists"

This corresponds to a documented error code: NamespaceExists(48) (message: "target namespace exists").

On mongos, the command responds is more cryptic:

  • errmsg: "Target collection %s exists but dropTarget is not set"
  • code: 5807601
  • codeName: "Location5807601"

This error code originates from checkShardedRenamePreconditions.

Is it intentional for these errors to be inconsistent?

Note: This was tested on 5.0.x, but I presume the inconsistency goes back to older server versions.



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

Author:

{'name': 'Pierlauro Sciarelli', 'email': 'pierlauro.sciarelli@mongodb.com', 'username': 'pierlauro'}

Message: SERVER-60632 return NamespaceExists from mongos when dropTarget=false
Branch: v5.0
https://github.com/mongodb/mongo/commit/2db00cf3b10b7e380cd0222b50945d2d4a434232

Comment by Githook User [ 18/Nov/21 ]

Author:

{'name': 'Pierlauro Sciarelli', 'email': 'pierlauro.sciarelli@mongodb.com', 'username': 'pierlauro'}

Message: SERVER-60632 return NamespaceExists from mongos when dropTarget=false
Branch: v5.1
https://github.com/mongodb/mongo/commit/8d791cdf65904d31b5dc79a34f4d1082004eb4cf

Comment by Githook User [ 15/Nov/21 ]

Author:

{'name': 'Pierlauro Sciarelli', 'email': 'pierlauro.sciarelli@mongodb.com', 'username': 'pierlauro'}

Message: SERVER-60632 return NamespaceExists from mongos when dropTarget=false
Branch: master
https://github.com/mongodb/mongo/commit/912d318e7f44241ee6ecacdcffd83f1539c5c43e

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