[SERVER-64462] 更新shard key并abortTransaction得到报错并导致mongos hang Created: 14/Mar/22  Updated: 27/Oct/23  Resolved: 22/Sep/22

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

Type: Bug Priority: Major - P3
Reporter: Yi deng Assignee: Yuan Fang
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to COMPASS-4715 'prepareTransaction' is not supported... Closed
is related to DOCS-15643 Add "Change shard key is not supporte... Backlog
Operating System: ALL
Participants:

 Description   

mongo5.0.4   redhat 8

操作步骤:

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

然后mongos上find,currentOp等操作都无响应了。

 



 Comments   
Comment by Yuan Fang [ 21/Sep/22 ]

Hi 251237926@qq.com ,

Thank you for your report. Kindly note that MongoDB Jira and Support are only available in English. Since the issue has already been addressed in a post in MongoDB Community Forum, I would like to summarize the answers here: transactions were errored and aborted because modifying shard keys uses transactions, and "prepareTransaction" is not supported for replica sets with arbiters.

I'm glad your issue has been resolved, and I'm going to close this ticket. 

Regards,
Yuan

Comment by Yi deng [ 18/Mar/22 ]

此问题由于shard cluster中包含了arbiter member导致,但是发生hang之后,不知道如何让系统恢复正常。

Comment by Yi deng [ 14/Mar/22 ]

不好意思,写错了,是commitTransaction

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