[SERVER-51305] Drop view not possible when SECONDARY is down in PSA cluster Created: 02/Oct/20  Updated: 27/Oct/23  Resolved: 05/Oct/20

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 4.4.0
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Wernfried Domscheit Assignee: Edwin Zhou
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

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.

 

Participants:

 Description   

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.



 Comments   
Comment by Edwin Zhou [ 05/Oct/20 ]

Hi wernfried.domscheit@sunrise.net,

Thank you for the detailed report. The behavior works as designed for both dropping views and collections. mongos will convert the writeConcern propagation value of the drop helper to "majority." You can read more about the behavior here for the writeConcern field: db.collection.drop()

Generated at Thu Feb 08 05:25:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.