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

5.0 mongos write hangs on PSA shard after second is shutdown

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • ALL
    • Repl 2022-11-14

      hello:
      i read doc,mongo 5.0 PSA default writeConcern is w:1. so i test it ok on PSA replication after second is shutdown.but i test write hangs on cluster.so defaultwriteconcern on mongos cluster is not w:1,on psa replication is w:1.please is it bug for mongos?

      if [ (#arbiters > 0) AND (#non-arbiters <= majority(#voting-nodes)) ]
      defaultWriteConcern =

      { w: 1 }

      else
      defaultWriteConcern =

      { w: "majority" }

      To reproduce on psa replication:
      shard2:PRIMARY> version()
      5.0.2
      shard2:PRIMARY> status.members.length
      shard2:PRIMARY> status.members[0].stateStr
      PRIMARY
      shard2:PRIMARY> status.members[1].stateStr
      (not reachable/healthy)
      shard2:PRIMARY> status.members[2].stateStr
      ARBITER
      shard2:PRIMARY> db.xiaoxu.insert(

      {testWriteConcer:1}

      )
      WriteResult(

      { "nInserted" : 1 }

      )

      To reproduce using mongos on single psa shard,it not wok.
      mongo cluster has one mongos,single psa shard,and one member config,when psa with secondary is shutdown.it write hangs.

      mongos> db.testWriteConcern.insert({_id:10,name:"xiaoxu"},

      {w:1}

      )
      WriteResult(

      { "nInserted" : 1 }

      )

      it is not nerver timeout when no timeout
      mongos> db.testWriteConcern.insert({_id:3,name:"xiaoxu"}).
      .....

      anon@127.0.0.1:31002:PRIMARY:[db]test> rs.status();
      {
      "set" : "shard2",
      "date" : ISODate("2022-05-16T06:09:18.876Z"),
      "myState" : 1,
      "term" : NumberLong(5),
      "syncSourceHost" : "",
      "syncSourceId" : -1,
      "heartbeatIntervalMillis" : NumberLong(2000),
      "majorityVoteCount" : 2,
      "writeMajorityCount" : 2,
      "votingMembersCount" : 3,
      "writableVotingMembersCount" : 2,
      "optimes" : {
      "lastCommittedOpTime" :

      { "ts" : Timestamp(1652671774, 1), "t" : NumberLong(5) }

      ,
      "lastCommittedWallTime" : ISODate("2022-05-16T03:29:34.156Z"),
      "readConcernMajorityOpTime" :

      { "ts" : Timestamp(1652671774, 1), "t" : NumberLong(5) }

      ,
      "appliedOpTime" :

      { "ts" : Timestamp(1652681354, 1), "t" : NumberLong(5) }

      ,
      "durableOpTime" :

      { "ts" : Timestamp(1652681354, 1), "t" : NumberLong(5) }

      ,
      "lastAppliedWallTime" : ISODate("2022-05-16T06:09:14.351Z"),
      "lastDurableWallTime" : ISODate("2022-05-16T06:09:14.351Z")
      },
      "lastStableRecoveryTimestamp" : Timestamp(1652671774, 1),
      "electionCandidateMetrics" : {
      "lastElectionReason" : "electionTimeout",
      "lastElectionDate" : ISODate("2022-05-16T03:17:24.137Z"),
      "electionTerm" : NumberLong(5),
      "lastCommittedOpTimeAtElection" :

      { "ts" : Timestamp(1652671027, 1), "t" : NumberLong(3) }

      ,
      "lastSeenOpTimeAtElection" :

      { "ts" : Timestamp(1652671027, 1), "t" : NumberLong(3) }

      ,
      "numVotesNeeded" : 2,
      "priorityAtElection" : 1,
      "electionTimeoutMillis" : NumberLong(10000),
      "numCatchUpOps" : NumberLong(0),
      "newTermStartDate" : ISODate("2022-05-16T03:17:24.143Z"),
      "wMajorityWriteAvailabilityDate" : ISODate("2022-05-16T03:17:24.780Z")
      },
      "electionParticipantMetrics" : {
      "votedForCandidate" : true,
      "electionTerm" : NumberLong(3),
      "lastVoteDate" : ISODate("2022-05-16T03:15:47.936Z"),
      "electionCandidateMemberId" : 0,
      "voteReason" : "",
      "lastAppliedOpTimeAtElection" :

      { "ts" : Timestamp(1652590596, 1), "t" : NumberLong(2) }

      ,
      "maxAppliedOpTimeInSet" :

      { "ts" : Timestamp(1652670907, 1), "t" : NumberLong(2) }

      ,
      "priorityAtElection" : 1
      },
      "members" : [
      {
      "_id" : 0,
      "name" : "10.230.10.150:31002",
      "health" : 0,
      "state" : 8,
      "stateStr" : "(not reachable/healthy)",
      "uptime" : 0,
      "optime" :

      { "ts" : Timestamp(0, 0), "t" : NumberLong(-1) }

      ,
      "optimeDurable" :

      { "ts" : Timestamp(0, 0), "t" : NumberLong(-1) }

      ,
      "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
      "optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"),
      "lastHeartbeat" : ISODate("2022-05-16T06:09:18.627Z"),
      "lastHeartbeatRecv" : ISODate("2022-05-16T03:29:34.936Z"),
      "pingMs" : NumberLong(0),
      "lastHeartbeatMessage" : "Error connecting to 10.130.10.150:31002 :: caused by :: Connection refused",
      "syncSourceHost" : "",
      "syncSourceId" : -1,
      "infoMessage" : "",
      "configVersion" : 4,
      "configTerm" : 5
      },
      {
      "_id" : 1,
      "name" : "10.230.10.149:31002",
      "health" : 1,
      "state" : 1,
      "stateStr" : "PRIMARY",
      "uptime" : 10413,
      "optime" :

      { "ts" : Timestamp(1652681354, 1), "t" : NumberLong(5) }

      ,
      "optimeDate" : ISODate("2022-05-16T06:09:14Z"),
      "syncSourceHost" : "",
      "syncSourceId" : -1,
      "infoMessage" : "",
      "electionTime" : Timestamp(1652671044, 1),
      "electionDate" : ISODate("2022-05-16T03:17:24Z"),
      "configVersion" : 4,
      "configTerm" : 5,
      "self" : true,
      "lastHeartbeatMessage" : ""
      },

      { "_id" : 2, "name" : "10.230.9.150:31002", "health" : 1, "state" : 7, "stateStr" : "ARBITER", "uptime" : 10400, "lastHeartbeat" : ISODate("2022-05-16T06:09:18.161Z"), "lastHeartbeatRecv" : ISODate("2022-05-16T06:09:18.167Z"), "pingMs" : NumberLong(0), "lastHeartbeatMessage" : "", "syncSourceHost" : "", "syncSourceId" : -1, "infoMessage" : "", "configVersion" : 4, "configTerm" : 5 }

      ],
      "ok" : 1,

        1. image-2022-05-16-14-18-00-561.png
          image-2022-05-16-14-18-00-561.png
          51 kB
        2. screenshot-1.png
          screenshot-1.png
          47 kB

            Assignee:
            ali.mir@mongodb.com Ali Mir
            Reporter:
            601290552@qq.com jing xu
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: