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

setIndexCommitQuorum command returns {ok: 1} when run against a mongos on a non-existent index build

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.4.11, 5.0.4, 5.1.0-rc0
    • Affects Version/s: 5.0.0, 4.4.6
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v5.0, v4.4
    • Hide
      (function() {
      "use strict";
      
      const st = new ShardingTest({shards: 1, mongos: 1, rs: {nodes: 1}});
      
      const mongosDB = st.s0.getDB(jsTestName());
      const mongosColl = mongosDB[jsTestName()];
      
      assert.commandWorked(mongosColl.insert({_id: 1}));
      
      // Should not be OK.
      assert.commandWorked(mongosDB.runCommand(
          {setIndexCommitQuorum: jsTestName(), indexNames: ["abcd"], commitQuorum: 1}));
      
      // Mongos should fail with this error code too.
      let replTest = st.rs0;
      assert.commandFailedWithCode(
          replTest.getPrimary()
              .getDB(jsTestName())
              .runCommand({setIndexCommitQuorum: jsTestName(), indexNames: ["abcd"], commitQuorum: 1}),
          ErrorCodes.IndexNotFound);
      
      st.stop();
      }());
      
      
      Show
      (function() { "use strict" ; const st = new ShardingTest({shards: 1, mongos: 1, rs: {nodes: 1}}); const mongosDB = st.s0.getDB(jsTestName()); const mongosColl = mongosDB[jsTestName()]; assert .commandWorked(mongosColl.insert({_id: 1})); // Should not be OK. assert .commandWorked(mongosDB.runCommand( {setIndexCommitQuorum: jsTestName(), indexNames: [ "abcd" ], commitQuorum: 1})); // Mongos should fail with this error code too. let replTest = st.rs0; assert .commandFailedWithCode( replTest.getPrimary() .getDB(jsTestName()) .runCommand({setIndexCommitQuorum: jsTestName(), indexNames: [ "abcd" ], commitQuorum: 1}), ErrorCodes.IndexNotFound); st.stop(); }());
    • Execution Team 2021-08-09, Execution Team 2021-08-23

      I tried to run setIndexCommitQuorum against a mongos on a non-existent index build and the command returns successfully:

      {
             "ok" : 1,
             "$clusterTime" : {
                     "clusterTime" : Timestamp(1620827363, 2),
                     "signature" : {
                             "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                             "keyId" : NumberLong(0)
                     }
             },
             "operationTime" : Timestamp(1620827363, 2)
      }
      

      Running the same command against the primary mongod returns the expected result:

      {
             "ok" : 0,
             "errmsg" : "Cannot find an index build on collection 'repro.repro' with the provided index names",
             "code" : 27,
             "codeName" : "IndexNotFound",
             "$gleStats" : {
                     "lastOpTime" : {
                             "ts" : Timestamp(1620827362, 16),
                             "t" : NumberLong(1)
                     },
                     "electionId" : ObjectId("7fffffff0000000000000001")
             },
             "lastCommittedOpTime" : Timestamp(1620827363, 2),
             "$configServerState" : {
                     "opTime" : {
                             "ts" : Timestamp(1620827362, 22),
                             "t" : NumberLong(-1)
                     }
             },
             "$clusterTime" : {
                     "clusterTime" : Timestamp(1620827363, 2),
                     "signature" : {
                             "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                             "keyId" : NumberLong(0)
                     }
             },
             "operationTime" : Timestamp(1620827363, 2)
      }
      

            Assignee:
            haley.connelly@mongodb.com Haley Connelly
            Reporter:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: