[SERVER-34339] Aggregation error aborts the transaction without letting the shell helper know Created: 05/Apr/18  Updated: 06/Dec/22  Resolved: 12/Apr/18

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

Type: Bug Priority: Major - P3
Reporter: Xiangyu Yao (Inactive) Assignee: Backlog - Replication Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-34094 Change snapshot read tests to use mul... Closed
is depended on by SERVER-34388 Continue converting snapshot reads te... Closed
Duplicate
duplicates SERVER-34441 Error when aborting/committing a none... Closed
Assigned Teams:
Replication
Operating System: ALL
Steps To Reproduce:

Extract from read_concern_snapshot_aggregation.js
// Test that $changeStream is disallowed with snapshot reads.
session.startTransaction({readConcern: {level: "snapshot"}});
assert.commandFailedWithCode({aggregate: coll, pipeline: [{$changeStream: {}], cursor: {}});
session.commitTransaction();

Participants:

 Description   

Error due to aggregation not supporting snapshot reads will abort the transaction. So if we commit/abort the transaction from the shell helper, we will get an “transaction has been aborted” error. And the shell helper doesn’t know about the abort, so starting a new transaction triggers an error: `There is already an active transaction on this session`.
I think the fix would be either handling the aggregation error differently or letting shell helper end the transaction quietly with commit/abortTransaction even when there is an "transaction has been aborted" error.



 Comments   
Comment by Shane Harvey [ 12/Apr/18 ]

The abortTransaction should ignore the "NoSuchTransaction" error because it means the transaction was already aborted on the server.

Comment by Kyle Suarez [ 12/Apr/18 ]

It's more than just aggregation. Running a runCommand also gives the same frustrating experience; e.g.:

    session.startTransaction({readConcern: {level: "snapshot"}});
 
    // This will implicitly abort the transaction.
    assert.commandFailedWithCode(
        localDB.coll.runCommand("findAndModify", {query: {name: "kyle"}, update: {}}),
        ErrorCodes.IllegalOperation);
 
    // This would complain that the session already has an active transaction.
    // session.startTransaction({readConcern: {level: "snapshot"}});
 
    // This would throw with "NoSuchTransaction".
    // session.abortTransaction();

Comment by Gregory McKeon (Inactive) [ 09/Apr/18 ]

ping spencer, this may have gotten missed.

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