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

Inconsistent error on mongos when renameCollection target already exists

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 5.2.0, 5.0.5, 5.1.1
    • Affects Version/s: 5.0.3
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v5.1, v5.0
    • Sharding EMEA 2021-11-29

      Unable to find source-code formatter for language: 48,name: namespaceexists. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      
      

      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.

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

              Created:
              Updated:
              Resolved: