Received null actualCollection when unsplittable collection exists with given uuid

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 7.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • ALL
    • Hide
      const st = new ShardingTest({
          mongos: 1,
          shards: 2,
          rs: \{nodes: 1},
      });
      
      const testDB = st.s.getDB(jsTestName());
      const shard0 = st.shard0.shardName;
      const shard1 = st.shard1.shardName;
      
      assert.commandWorked(st.s.adminCommand(\{enableSharding: testDB.getName(), primaryShard: shard0}));
      
      // create collA with 1 index on the DBPrimary shard
      const collA = testDB['collA'];
      assert.commandWorked(testDB.runCommand(\{createUnsplittableCollection: 'collA'}));
      assert.commandWorked(collA.insert(\{x: 1, y: 2}));
      assert.commandWorked(collA.createIndex(\{y: 1}));
      
      const uuidCollA =
          testDB.getSiblingDB('config').collections.findOne(\{_id: collA.getFullName()}).uuid;
      
      // create collB with 1 index not on the DBPrimary shard
      const collB = testDB['collB'];
      assert.commandWorked(testDB.runCommand(\{createUnsplittableCollection: 'collB', dataShard: shard1}));
      assert.commandWorked(collB.insert(\{x: 1, y: 1}));
      assert.commandWorked(collB.createIndex(\{y: 1}));
      
      // send dropIndexes with a wrong collectionUUID field
      const res = assert.commandFailedWithCode(
          testDB.runCommand(\{dropIndexes: "collB", index: {y: 1}, collectionUUID: uuidCollA}),
          ErrorCodes.CollectionUUIDMismatch);
      
      assert.eq(res.actualCollection, collA.getName());
      
      st.stop();
      
      Show
      const st = new ShardingTest({     mongos: 1,     shards: 2,     rs: \{nodes: 1}, }); const testDB = st.s.getDB(jsTestName()); const shard0 = st.shard0.shardName; const shard1 = st.shard1.shardName; assert.commandWorked(st.s.adminCommand(\{enableSharding: testDB.getName(), primaryShard: shard0})); // create collA with 1 index on the DBPrimary shard const collA = testDB['collA']; assert.commandWorked(testDB.runCommand(\{createUnsplittableCollection: 'collA'})); assert.commandWorked(collA.insert(\{x: 1, y: 2})); assert.commandWorked(collA.createIndex(\{y: 1})); const uuidCollA =     testDB.getSiblingDB('config').collections.findOne(\{_id: collA.getFullName()}).uuid; // create collB with 1 index not on the DBPrimary shard const collB = testDB['collB']; assert.commandWorked(testDB.runCommand(\{createUnsplittableCollection: 'collB', dataShard: shard1})); assert.commandWorked(collB.insert(\{x: 1, y: 1})); assert.commandWorked(collB.createIndex(\{y: 1})); // send dropIndexes with a wrong collectionUUID field const res = assert.commandFailedWithCode(     testDB.runCommand(\{dropIndexes: "collB", index: {y: 1}, collectionUUID: uuidCollA}),     ErrorCodes.CollectionUUIDMismatch); assert.eq(res.actualCollection, collA.getName()); st.stop();
    • CAR Team 2023-11-27, CAR Team 2023-12-11
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Given 2 unsplittable collections living on different shards (collA and collB), when a command is sent with the opposite collectionUUID field, the returned actualCollection is null when it's expected to receive the name of the other collection.

       

      For instance:

      • collA has uuidA
      • collB has uuidB

      Command {dropIndexes: "collA", index: {x:1}, collectionUUID: uuidB} will return a null actualCollection field.

       

            Assignee:
            Jordi Olivares Provencio
            Reporter:
            Silvia Surroca
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: