-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Replication
-
None
-
Environment:Server version 4.9.0-alpha-464-g21b2bc7, which was downloaded from http://downloads.10gen.com/osx/mongodb-macos-x86_64-enterprise-latest.tgz
-
Fully Compatible
-
ALL
-
Repl 2020-11-16
-
None
-
None
-
None
-
None
-
None
-
None
-
None
The Versioned API specification requires that clients only send API version-related fields on the first command in a transaction. But even for a properly-functioning client, mongos reports an error. Here's a mongo shell repro:
~$ ~/Downloads/mongodb-macos-x86_64-enterprise-4.9.0-alpha-464-g21b2bc7/bin/mongo --apiVersion 1
MongoDB shell version v4.9.0-alpha-464-g21b2bc7
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("d9cc1367-6ea0-494b-a0d0-384b26b6f1fd") }
MongoDB server version: 4.9.0-alpha-464-g21b2bc7
MongoDB Enterprise mongos> session = db.getMongo().startSession()
session { "id" : UUID("0a03fa05-795a-40bb-a9ad-05894ec979b2") }
MongoDB Enterprise mongos> session.startTransaction()
MongoDB Enterprise mongos> session.getDatabase("test").getCollection("test").insertOne({})
{
"acknowledged" : true,
"insertedId" : ObjectId("5fab0124bc766c2d5df21642")
}
MongoDB Enterprise mongos> session.getDatabase("test").getCollection("test").insertOne({})
uncaught exception: WriteCommandError({
"ok" : 0,
"errmsg" : "Only the first command in a transaction may specify API parameters",
"code" : 4937701,
"codeName" : "Location4937701"
}) :
WriteCommandError({
"ok" : 0,
"errmsg" : "Only the first command in a transaction may specify API parameters",
"code" : 4937701,
"codeName" : "Location4937701"})
WriteCommandError@src/mongo/shell/bulk_api.js:421:48
executeBatch@src/mongo/shell/bulk_api.js:936:23
Bulk/this.execute@src/mongo/shell/bulk_api.js:1184:21
DBCollection.prototype.insertOne@src/mongo/shell/crud_api.js:264:9
Note that the second insert command fails.
I've also reproduced this in a POC in Java, and confirmed that the driver is not sending any server API elements on the second command in the transaction.
- is caused by
-
SERVER-50375 Ensure mongos forwards API parameters from client request to shards
-
- Closed
-