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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 5.0.0, 4.4.6
    • Fix Version/s: 4.4.11, 5.0.4, 5.1.0-rc0
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v5.0, v4.4
    • Steps To Reproduce:
      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(); }());
    • Sprint:
      Execution Team 2021-08-09, Execution Team 2021-08-23

      Description

      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)
      }
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: