[SERVER-56690] dassert() in TransactionRouter incorrectly forbids explicitly specifying empty readConcern object Created: 06/May/21  Updated: 06/Oct/21  Resolved: 10/Sep/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 5.1.0-rc0

Type: Task Priority: Minor - P4
Reporter: Max Hirschhorn Assignee: Jonathan Lee
Resolution: Done Votes: 0
Labels: sharding-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Sprint: Sharding 2021-09-20
Participants:
Linked BF Score: 37

 Description   

A mongod process won't reject an explicit {readConcern: {}} object even when it is not the first statement within a multi-statement transaction. The {readConcern: {}} object has no practical effect and won't lead the request to do any additional waiting. (Note also that an empty readConcern object overrides the cluster-wide readConcern value.)

A mongos process is therefore safe to propagate the explicit {readConcern: {}} object and so this dassert() in TransactionRouter should be adjusted to avoid false positives in testing.

419
// The first command sent to a participant must start a transaction, unless it is a transaction
420
// command, which don't support the options that start transactions, i.e. startTransaction and
421
// readConcern. Otherwise the command must not have a read concern.
422
auto cmdName = cmd.firstElement().fieldNameStringData();
423
bool mustStartTransaction = isFirstStatementInThisParticipant && !isTransactionCommand(cmdName);
424
 
425
if (!mustStartTransaction) {
426
    dassert(!cmd.hasField(repl::ReadConcernArgs::kReadConcernFieldName));
427
}



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 10/Sep/21 ]

Author:

{'name': 'Jonathan Lee', 'email': 'jonathan.lee@mongodb.com', 'username': 'jonatlee'}

Message: SERVER-56690 allow propagation of empty readConcern object for non-first statement in a multi-statement transaction in transaction_router.cpp
Branch: master
https://github.com/mongodb/mongo/commit/b31190548f52079892f9d3e4dc4d096ad2a273a1

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