I try to update shard key in a transaction using mongo shell, when i try to commitTransaction,i get the following error:
Transaction was aborted :: caused by :: from shard rs_shard03 :: caused by :: ‘prepareTransaction’ is not supported for replica sets with arbiters".
then i try to query or use currentOp() from mongos, all operations in mongos hang.
then i try to kill all mongod mongos processes, and restart them, but all operations from mongos still hang, i can ses an operation 449052 in sh_shard03 using currentOp(), currentOp shows a msg with this
operation: “errmsg” : “from shard rs_shard03 :: caused by :: ‘prepareTransaction’ is not supported for replica sets with arbiters”
i try to killOp(“rs_shard03:449052”), but after the 449052 been killed, there is another new opid with the same error msg appears in shard03.
how can i clean this hang operation
my operation which cause the hang issue:
MongoDB Enterprise mongos> var session = db.getMongo().startSession()
MongoDB Enterprise mongos> session.startTransaction()
MongoDB Enterprise mongos> var tb1 = session.getDatabase('testdb01').getCollection('table01')
MongoDB Enterprise mongos> tb1.updateOne({id:1},{$set:{"id":"88888"}},{multi:false})
{ "acknowledged" : true, "matchedCount" : 1, "modifiedCount" : 1 }
MongoDB Enterprise mongos> session.commitTransaction()
uncaught exception: Error: command failed: {
"ok" : 0,
"errmsg" : "Transaction was aborted :: caused by :: from shard rs_shard03 :: caused by :: 'prepareTransaction' is not supported for replica sets with arbiters",
"code" : 148,
"codeName" : "ReadConcernMajorityNotEnabled",
"$clusterTime" : {
"clusterTime" : Timestamp(1647248380, 3),
"signature" :
{ "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) }
},
"operationTime" : Timestamp(1647248380, 3),
"recoveryToken" :
{ "recoveryShardId" : "rs_shard03" }
} with original command request: {
"commitTransaction" : 1,
"txnNumber" : NumberLong(0),
"lsid" :
{ "id" : UUID("4baec96b-8124-4b4d-a3ac-c99a375ba7b0") }
,
"$clusterTime" : {
"clusterTime" : Timestamp(1647248371, 2),
"signature" :
{ "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) }
},
"autocommit" : false,
"stmtId" : NumberInt(1)
} on connection: connection to 127.0.0.1:32017 :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
doassert@src/mongo/shell/assert.js:18:14
_assertCommandWorked@src/mongo/shell/assert.js:737:17
assert.commandWorked@src/mongo/shell/assert.js:829:16
commitTransaction@src/mongo/shell/session.js:977:17
@(shell):1:1
currentOp() from shard03:
"type" : "op",
"host" : "redhat07:31018",
"desc" : "conn70",
"connectionId" : 70,
"client" : "192.168.17.160:49584",
"clientMetadata" : {
"driver" : {
"name" : "NetworkInterfaceTL",
"version" : "5.0.4"
},
"os" : {
"type" : "Linux",
"name" : "Red Hat Enterprise Linux release 8.2 (Ootpa)",
"architecture" : "x86_64",
"version" : "Kernel 4.18.0-193.el8.x86_64"
}
},
"active" : true,
"currentOpTime" : "2022-03-14T20:17:12.678+08:00",
"effectiveUsers" : [
{
"user" : "__system",
"db" : "local"
}
],
"threaded" : true,
"opid" : 449052,
"secs_running" : NumberLong(579),
"microsecs_running" : NumberLong(579800192),
"op" : "command",
"ns" : "config.$cmd",
"command" : {
"createIndexes" : "system.sessions",
"v" : 2,
"indexes" : [
{
"key" : {
"lastUse" : 1
},
"name" : "lsidTTLIndex",
"expireAfterSeconds" : 1800
}
],
"ignoreUnknownIndexOptions" : false,
"writeConcern" : {
},
"shardVersion" : [
Timestamp(683, 0),
ObjectId("621b2da8697e4a93cdda940a"),
Timestamp(1645974391, 1520)
],
"$clusterTime" : {
"clusterTime" : Timestamp(1647259652, 1),
"signature" : {
"hash" : BinData(0,"Z5J1pKsgLOwJc9GbxekmhHc/DmE="),
"keyId" : NumberLong("7069222986158440471")
}
},
"$configTime" : Timestamp(1647259652, 1),
"$topologyTime" : Timestamp(0, 0),
"$configServerState" : {
"opTime" : {
"ts" : Timestamp(1647259652, 1),
"t" : NumberLong(92)
}
},
"$db" : "config"
},
"numYields" : 0,
"waitingForLatch" : {
"timestamp" : ISODate("2022-03-14T12:07:32.978Z"),
"captureName" : "AnonymousLockable"
},
"locks" : {
},
"waitingForLock" : false,
"lockStats" : {
"ParallelBatchWriterMode" : {
"acquireCount" : {
"r" : NumberLong(3)
}
},
"ReplicationStateTransition" : {
"acquireCount" : {
"w" : NumberLong(3)
}
},
"Global" : {
"acquireCount" : {
"r" : NumberLong(3)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(3)
}
},
"Collection" : {
"acquireCount" : {
"r" : NumberLong(3)
}
},
"Mutex" : {
"acquireCount" : {
"r" : NumberLong(5)
}
}
},
"waitingForFlowControl" : false,
"flowControlStats" : {
}
},
{
"client" : "",
"host" : "redhat07:31018",
"connectionId" : NumberLong(0),
"appName" : "",
"clientMetadata" : {
},
"desc" : "transaction coordinator",
"twoPhaseCommitCoordinator" : {
"lsid" : {
"id" : UUID("4baec96b-8124-4b4d-a3ac-c99a375ba7b0"),
"uid" : BinData(0,"O0CMtIVItQN4IsEOsJdrPL8s7jv5xwh5a/A5Qfvs2A8=")
},
"txnNumber" : NumberLong(0),
"numParticipants" : NumberLong(2),
"state" : "waitingForDecisionAck",
"commitStartTime" : ISODate("2022-03-14T11:50:03.174Z"),
"hasRecoveredFromFailover" : true,
"stepDurations" : {
"writingParticipantListMicros" : NumberLong(22),
"totalCommitDurationMicros" : NumberLong(1629492140),
"waitingForVotesMicros" : NumberLong(1),
"writingDecisionMicros" : NumberLong(2109),
"waitingForDecisionAcksMicros" : NumberLong(1629490006)
},
"decision" : {
"decision" : "abort",
"abortStatus" : {
"code" : 148,
"codeName" : "ReadConcernMajorityNotEnabled",
"errmsg" : "from shard rs_shard03 :: caused by :: 'prepareTransaction' is not supported for replica sets with arbiters"
}
},
"deadline" : ISODate("2022-03-14T11:51:03.174Z")