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

Drop view not possible when SECONDARY is down in PSA cluster

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 4.4.0
    • Component/s: Sharding
    • None
    • ALL
    • Hide

      Deploy a sharded cluster with one PRIMARY, one SECONDARY, one ARBITER for each shard.

       

      db.createView("view_name", "logging", [{ $limit: 1 }])
      

      connect to one secondary shard host and stop mongod service

       

       

      use admin
      rs.status()
      
      { 
          "set" : "shard_04", 
          "date" : ISODate("2020-10-02T09:31:39.552+0200"), 
          "myState" : 1.0, 
          "term" : 17, 
          "syncSourceHost" : "", 
          "syncSourceId" : -1.0, 
          "heartbeatIntervalMillis" : 2000, 
          "majorityVoteCount" : 2.0, 
          "writeMajorityCount" : 2.0, 
          "votingMembersCount" : 3.0, 
          "writableVotingMembersCount" : 2.0, 
          "optimes" : {
              "lastCommittedOpTime" : {
                  "ts" : Timestamp(1601623647, 19), 
                  "t" : 17
              }, 
              "lastCommittedWallTime" : ISODate("2020-10-02T09:27:27.260+0200"), 
              "readConcernMajorityOpTime" : {
                  "ts" : Timestamp(1601623647, 19), 
                  "t" : 17
              }, 
              "readConcernMajorityWallTime" : ISODate("2020-10-02T09:27:27.260+0200"), 
              "appliedOpTime" : {
                  "ts" : Timestamp(1601623897, 4), 
                  "t" : 17
              }, 
              "durableOpTime" : {
                  "ts" : Timestamp(1601623897, 4), 
                  "t" : 17
              }, 
              "lastAppliedWallTime" : ISODate("2020-10-02T09:31:37.383+0200"), 
              "lastDurableWallTime" : ISODate("2020-10-02T09:31:37.383+0200")
          }, 
          "electionCandidateMetrics" : {
              "lastElectionReason" : "electionTimeout", 
              "lastElectionDate" : ISODate("2020-10-01T19:10:25.561+0200"), 
              "electionTerm" : 17, 
              "lastCommittedOpTimeAtElection" : {
                  "ts" : Timestamp(1601572203, 22434), 
                  "t" : 16
              }, 
              "lastSeenOpTimeAtElection" : {
                  "ts" : Timestamp(1601572203, 22978), 
                  "t" : 16
              }, 
              "numVotesNeeded" : 2.0, 
              "priorityAtElection" : 1.0, 
              "electionTimeoutMillis" : 10000, 
              "numCatchUpOps" : 0, 
              "newTermStartDate" : ISODate("2020-10-01T19:10:25.571+0200"), 
              "wMajorityWriteAvailabilityDate" : ISODate("2020-10-02T08:48:23.861+0200")
          }, 
          "members" : [
              {
                  "_id" : 0.0, 
                  "name" : "d-mipmdb-sh1-04.swi.srse.net:27018", 
                  "health" : 0.0, 
                  "state" : 8.0, 
                  "stateStr" : "(not reachable/healthy)", 
                  "uptime" : 0.0, 
                  "optime" : {
                      "ts" : Timestamp(0, 0), 
                      "t" : -1
                  }, 
                  "optimeDurable" : {
                      "ts" : Timestamp(0, 0), 
                      "t" : -1
                  }, 
                  "optimeDate" : ISODate("1970-01-01T01:00:00.000+0100"), 
                  "optimeDurableDate" : ISODate("1970-01-01T01:00:00.000+0100"), 
                  "lastHeartbeat" : ISODate("2020-10-02T09:31:37.979+0200"), 
                  "lastHeartbeatRecv" : ISODate("2020-10-02T09:27:27.697+0200"), 
                  "pingMs" : 0, 
                  "lastHeartbeatMessage" : "Error connecting to d-mipmdb-sh1-04.swi.srse.net:27018 (10.192.241.232:27018) :: caused by :: Connection refused", 
                  "syncSourceHost" : "", 
                  "syncSourceId" : -1.0, 
                  "infoMessage" : "", 
                  "configVersion" : 4.0, 
                  "configTerm" : 17.0
              }, 
              {
                  "_id" : 1.0, 
                  "name" : "d-mipmdb-sh2-04.swi.srse.net:27018", 
                  "health" : 1.0, 
                  "state" : 1.0, 
                  "stateStr" : "PRIMARY", 
                  "uptime" : 609587.0, 
                  "optime" : {
                      "ts" : Timestamp(1601623897, 4), 
                      "t" : 17
                  }, 
                  "optimeDate" : ISODate("2020-10-02T09:31:37.000+0200"), 
                  "syncSourceHost" : "", 
                  "syncSourceId" : -1.0, 
                  "infoMessage" : "", 
                  "electionTime" : Timestamp(1601572225, 1), 
                  "electionDate" : ISODate("2020-10-01T19:10:25.000+0200"), 
                  "configVersion" : 4.0, 
                  "configTerm" : 17.0, 
                  "self" : true, 
                  "lastHeartbeatMessage" : ""
              }, 
              {
                  "_id" : 2.0, 
                  "name" : "d-mipmdb-arb-01.swi.srse.net:28004", 
                  "health" : 1.0, 
                  "state" : 7.0, 
                  "stateStr" : "ARBITER", 
                  "uptime" : 609585.0, 
                  "lastHeartbeat" : ISODate("2020-10-02T09:31:37.736+0200"), 
                  "lastHeartbeatRecv" : ISODate("2020-10-02T09:31:37.665+0200"), 
                  "pingMs" : 0, 
                  "lastHeartbeatMessage" : "", 
                  "syncSourceHost" : "", 
                  "syncSourceId" : -1.0, 
                  "infoMessage" : "", 
                  "configVersion" : 4.0, 
                  "configTerm" : 17.0
              }
          ], 
          "ok" : 1.0, 
          "$gleStats" : {
              "lastOpTime" : Timestamp(0, 0), 
              "electionId" : ObjectId("7fffffff0000000000000011")
          }, 
          "lastCommittedOpTime" : Timestamp(1601623647, 19), 
          "$configServerState" : {
              "opTime" : {
                  "ts" : Timestamp(1601623897, 4), 
                  "t" : 47
              }
          }, 
          "$clusterTime" : {
              "clusterTime" : Timestamp(1601623897, 4), 
              "signature" : {
                  "hash" : BinData(0, "o65tIB0ciyabvK7BgHkqzeDlGgI="), 
                  "keyId" : 6854861305854033921
              }
          }, 
          "operationTime" : Timestamp(1601623897, 4)
      }
      
      
      

       

      Then on mongos router try to drop the view:

       

      db.getCollection("view_name").drop()
      
      Error: drop failed: {
         "ok" : 0,
            "errmsg" : "Error dropping collection on shard shard_04 :: caused by :: waiting for replication timed out; Error details: { wtimeout: true, writeConcern: { w: \"majority\", wtimeout: 60000, provenance: \"clientSupplied\" } }",
               "code" : 64,
                  "codeName" : "WriteConcernFailed",
                     "operationTime" : Timestamp(1601623101, 27),
                        "$clusterTime" : {
            "clusterTime" : Timestamp(1601623101, 27),
               "signature" : {
               "hash" : BinData(0, "9paE792KGvbZH2FbsZgtWcJnTrI="),
                  "keyId" : NumberLong("6854861305854033921")
            }
         }
      } :
      _getErrorWithCode@src/mongo/shell / utils.js: 25: 13
      DBCollection.prototype.drop@src/mongo/shell / collection.js: 701: 15
      @(shell): 1: 1
      

      Even

      db.getCollection("view_name").drop( { writeConcern: { w: 1 } } );
      

      does not work. You get the same error.

       

      Show
      Deploy a sharded cluster with one PRIMARY, one SECONDARY, one ARBITER for each shard.   db.createView( "view_name" , "logging" , [{ $limit: 1 }]) connect to one secondary shard host and stop mongod service     use admin rs.status() { "set" : "shard_04" , "date" : ISODate( "2020-10-02T09:31:39.552+0200" ), "myState" : 1.0, "term" : 17, "syncSourceHost" : "", "syncSourceId" : -1.0, "heartbeatIntervalMillis" : 2000, "majorityVoteCount" : 2.0, "writeMajorityCount" : 2.0, "votingMembersCount" : 3.0, "writableVotingMembersCount" : 2.0, "optimes" : { "lastCommittedOpTime" : { "ts" : Timestamp(1601623647, 19), "t" : 17 }, "lastCommittedWallTime" : ISODate( "2020-10-02T09:27:27.260+0200" ), "readConcernMajorityOpTime" : { "ts" : Timestamp(1601623647, 19), "t" : 17 }, "readConcernMajorityWallTime" : ISODate( "2020-10-02T09:27:27.260+0200" ), "appliedOpTime" : { "ts" : Timestamp(1601623897, 4), "t" : 17 }, "durableOpTime" : { "ts" : Timestamp(1601623897, 4), "t" : 17 }, "lastAppliedWallTime" : ISODate( "2020-10-02T09:31:37.383+0200" ), "lastDurableWallTime" : ISODate( "2020-10-02T09:31:37.383+0200" ) }, "electionCandidateMetrics" : { "lastElectionReason" : "electionTimeout" , "lastElectionDate" : ISODate( "2020-10-01T19:10:25.561+0200" ), "electionTerm" : 17, "lastCommittedOpTimeAtElection" : { "ts" : Timestamp(1601572203, 22434), "t" : 16 }, "lastSeenOpTimeAtElection" : { "ts" : Timestamp(1601572203, 22978), "t" : 16 }, "numVotesNeeded" : 2.0, "priorityAtElection" : 1.0, "electionTimeoutMillis" : 10000, "numCatchUpOps" : 0, "newTermStartDate" : ISODate( "2020-10-01T19:10:25.571+0200" ), "wMajorityWriteAvailabilityDate" : ISODate( "2020-10-02T08:48:23.861+0200" ) }, "members" : [ { "_id" : 0.0, "name" : "d-mipmdb-sh1-04.swi.srse.net:27018" , "health" : 0.0, "state" : 8.0, "stateStr" : "(not reachable/healthy)" , "uptime" : 0.0, "optime" : { "ts" : Timestamp(0, 0), "t" : -1 }, "optimeDurable" : { "ts" : Timestamp(0, 0), "t" : -1 }, "optimeDate" : ISODate( "1970-01-01T01:00:00.000+0100" ), "optimeDurableDate" : ISODate( "1970-01-01T01:00:00.000+0100" ), "lastHeartbeat" : ISODate( "2020-10-02T09:31:37.979+0200" ), "lastHeartbeatRecv" : ISODate( "2020-10-02T09:27:27.697+0200" ), "pingMs" : 0, "lastHeartbeatMessage" : "Error connecting to d-mipmdb-sh1-04.swi.srse.net:27018 (10.192.241.232:27018) :: caused by :: Connection refused" , "syncSourceHost" : "", "syncSourceId" : -1.0, "infoMessage" : "", "configVersion" : 4.0, "configTerm" : 17.0 }, { "_id" : 1.0, "name" : "d-mipmdb-sh2-04.swi.srse.net:27018" , "health" : 1.0, "state" : 1.0, "stateStr" : "PRIMARY" , "uptime" : 609587.0, "optime" : { "ts" : Timestamp(1601623897, 4), "t" : 17 }, "optimeDate" : ISODate( "2020-10-02T09:31:37.000+0200" ), "syncSourceHost" : "", "syncSourceId" : -1.0, "infoMessage" : "", "electionTime" : Timestamp(1601572225, 1), "electionDate" : ISODate( "2020-10-01T19:10:25.000+0200" ), "configVersion" : 4.0, "configTerm" : 17.0, "self" : true , "lastHeartbeatMessage" : "" }, { "_id" : 2.0, "name" : "d-mipmdb-arb-01.swi.srse.net:28004" , "health" : 1.0, "state" : 7.0, "stateStr" : "ARBITER" , "uptime" : 609585.0, "lastHeartbeat" : ISODate( "2020-10-02T09:31:37.736+0200" ), "lastHeartbeatRecv" : ISODate( "2020-10-02T09:31:37.665+0200" ), "pingMs" : 0, "lastHeartbeatMessage" : "", "syncSourceHost" : "", "syncSourceId" : -1.0, "infoMessage" : "", "configVersion" : 4.0, "configTerm" : 17.0 } ], "ok" : 1.0, "$gleStats" : { "lastOpTime" : Timestamp(0, 0), "electionId" : ObjectId( "7fffffff0000000000000011" ) }, "lastCommittedOpTime" : Timestamp(1601623647, 19), "$configServerState" : { "opTime" : { "ts" : Timestamp(1601623897, 4), "t" : 47 } }, "$clusterTime" : { "clusterTime" : Timestamp(1601623897, 4), "signature" : { "hash" : BinData(0, "o65tIB0ciyabvK7BgHkqzeDlGgI=" ), "keyId" : 6854861305854033921 } }, "operationTime" : Timestamp(1601623897, 4) }   Then on mongos router try to drop the view:   db.getCollection( "view_name" ).drop() Error: drop failed: { "ok" : 0, "errmsg" : "Error dropping collection on shard shard_04 :: caused by :: waiting for replication timed out; Error details: { wtimeout: true , writeConcern: { w: \" majority\ ", wtimeout: 60000, provenance: \" clientSupplied\ " } }" , "code" : 64, "codeName" : "WriteConcernFailed" , "operationTime" : Timestamp(1601623101, 27), "$clusterTime" : { "clusterTime" : Timestamp(1601623101, 27), "signature" : { "hash" : BinData(0, "9paE792KGvbZH2FbsZgtWcJnTrI=" ), "keyId" : NumberLong( "6854861305854033921" ) } } } : _getErrorWithCode@src/mongo/shell / utils.js: 25: 13 DBCollection.prototype.drop@src/mongo/shell / collection.js: 701: 15 @(shell): 1: 1 Even db.getCollection( "view_name" ).drop( { writeConcern: { w: 1 } } ); does not work. You get the same error.  

      I have a sharded cluster in PSA configuration (PRIMARY, SECONDARY, ARBITER - one each)

      When one secondary is not available then you cannot drop views. CRUD operations are working fine as expected.

            Assignee:
            edwin.zhou@mongodb.com Edwin Zhou
            Reporter:
            wernfried.domscheit@sunrise.net Wernfried Domscheit
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: