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

createIndexes not waiting commitQuorum votingMembers for empty collection

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • ALL
    • Hide
      mlaunch init --replicaset --node 3
      
      mongosh --quiet "mongodb://localhost:27017/?replicaSet=replset"
      > db.foo.insert({a:1})
      
      mongosh --quiet "mongodb://localhost:27018"
      > db.shutdownServer()
      
      mongosh --quiet "mongodb://localhost:27017/?replicaSet=replset"
      # empty collection 
      replset [primary] test> db.runCommand( {createIndexes:"emptyCollection",indexes: [{key :{ c:1}, name: "foo_i", unique: true},{key :{ a:1}, name: "foo_d"}]})
      {
        numIndexesBefore: 1,
        numIndexesAfter: 3,
        createdCollectionAutomatically: true,
        commitQuorum: 'votingMembers',
        ok: 1,
        '$clusterTime': {
          clusterTime: Timestamp({ t: 1725466919, i: 3 }),
          signature: {
            hash: Binary.createFromBase64('AAAAAAAAAAAAAAAAAAAAAAAAAAA=', 0),
            keyId: Long('0')
          }
        },
        operationTime: Timestamp({ t: 1725466919, i: 3 })
      }
      
      # not empty collection, wait for the quorum
      replset [primary] test> db.runCommand( {createIndexes:"foo",indexes: [{key :{ c:1}, name: "foo_i", unique: true},{key :{ a:1}, name: "foo_d"}]})
      
      Show
      mlaunch init --replicaset --node 3 mongosh --quiet "mongodb: //localhost:27017/?replicaSet=replset" > db.foo.insert({a:1}) mongosh --quiet "mongodb: //localhost:27018" > db.shutdownServer() mongosh --quiet "mongodb: //localhost:27017/?replicaSet=replset" # empty collection replset [primary] test> db.runCommand( {createIndexes: "emptyCollection" ,indexes: [{key :{ c:1}, name: "foo_i" , unique: true },{key :{ a:1}, name: "foo_d" }]}) { numIndexesBefore: 1, numIndexesAfter: 3, createdCollectionAutomatically: true , commitQuorum: 'votingMembers' , ok: 1, '$clusterTime' : { clusterTime: Timestamp({ t: 1725466919, i: 3 }), signature: { hash: Binary.createFromBase64( 'AAAAAAAAAAAAAAAAAAAAAAAAAAA=' , 0), keyId: Long ( '0' ) } }, operationTime: Timestamp({ t: 1725466919, i: 3 }) } # not empty collection, wait for the quorum replset [primary] test> db.runCommand( {createIndexes: "foo" ,indexes: [{key :{ c:1}, name: "foo_i" , unique: true },{key :{ a:1}, name: "foo_d" }]})

      createIndexes is not waiting for the default commitQuorum: votingMembers when the collection is empty.

            Assignee:
            Unassigned Unassigned
            Reporter:
            renato.riccio@mongodb.com Renato Riccio
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: