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

Creating a clustered collection is not idempotent

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • ALL

      Creating a clustered collection is not idempotent. For example, running the following with the sharding_clustered_collections suite:

      const rs = new ReplSetTest({nodes: 3});
      rs.startSet();
      rs.initiate();
      const db = rs.getPrimary().getDB("db");
      assert.commandWorked(db.runCommand({create: "coll"}));
      assert.commandWorked(db.runCommand({create: "coll"}));
      rs.stopSet();

      results in the following error on the second call to `create`:

       uncaught exception: Error: command failed: {
       	"ok" : 0,
       	"errmsg" : "namespace db.coll already exists, but with different options: { uuid: UUID(\"1d5b16a6-2424-4778-8e1d-bc397571bbc1\"), clusteredIndex: { v: 2, key: { _id: 1 }, name: \"_id_\", unique: true } }",
       	"code" : 48,
       	"codeName" : "NamespaceExists",
       	},

            Assignee:
            Unassigned Unassigned
            Reporter:
            wenqin.ye@mongodb.com Wenqin Ye
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: