Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-60632

Inconsistent error on mongos when renameCollection target already exists

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor - P4 Minor - P4
    • 5.2.0, 5.0.5, 5.1.1
    • 5.0.3
    • None
    • None
    • Fully Compatible
    • ALL
    • v5.1, v5.0
    • Sharding EMEA 2021-11-29

    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.

      Attachments

        Activity

          People

            pierlauro.sciarelli@mongodb.com Pierlauro Sciarelli
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: