[SERVER-38420] Mongos returns confusing error message if receives request with higher transaction number without 'startTransaction' Created: 05/Dec/18  Updated: 06/Dec/22  Resolved: 05/Dec/18

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

Type: Task Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-37344 Implement recovery token for retrying... Closed
Assigned Teams:
Sharding
Participants:

 Description   

Based on this conversation in the driver's spec for pinning a transaction to a single mongos, I found that mongos returns NoSuchTransaction if the mongos receives a request for a transaction number different from the last transaction number it had heard but without 'startTransaction'. Perhaps this error message can be more clear? I had assumed the error would be something like "cannot start new transaction unless 'startTransaction' is specified."

There's a TODO in the code without a SERVER ticket, so I'm just filing this ticket to go back to it.



 Comments   
Comment by Shane Harvey [ 05/Dec/18 ]

For easier reference, the current confusing error message is:

{
  'ok': 0.0,
  'errmsg': 'cannot continue txnId -1 for session 28938f50-9d29-4ca5-8de5-ddaf261267c4 - 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= with txnId 1',
  'code': 251,
  'codeName': 'NoSuchTransaction',
  'errorLabels': ['TransientTransactionError']
}

Where "txnId -1" is what the server knows and "txnId 1" is the value the client sent ("txnNumber": 1).

Comment by Randolph Tan [ 05/Dec/18 ]

esha.maharishi Yes, this for the case for retrying commit on a totally different mongos. Since commit doesn't have startTransaction and can be called on a mongos that doesn't have any knowledge about the transaction, it has to be handled differently. This will be taken care of as part of SERVER-37344.

Comment by Esha Maharishi (Inactive) [ 05/Dec/18 ]

renctan, do you remember why there was a TODO there?

Generated at Thu Feb 08 04:48:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.