[SERVER-38096] Mongos opCounter doesn't increase when last op causes the transaction to implicitly abort Created: 12/Nov/18  Updated: 06/Dec/22  Resolved: 12/Nov/21

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

Type: Task Priority: Major - P3
Reporter: Randolph Tan Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Won't Do Votes: 0
Labels: max-triage
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Sharding
Participants:

 Description   

This is because we throw an error here:
https://github.com/mongodb/mongo/blob/r4.1.5/src/mongo/s/write_ops/batch_write_exec.cpp#L284

so it will not reach this part of the code:
https://github.com/mongodb/mongo/blob/r4.1.5/src/mongo/s/commands/cluster_write_cmd.cpp#L277

This behavior is slightly different from other cases. Using insert with duplicate key error, here's a list of behavior as of master (roughtly v4.1.5):
mongos, w/ transaction: opCounter for insert does not increment
mongos, w/o transaction: opCounter for insert increments
mongod, w/ transaction: opCounter for insert increments
mongod, w/o transaction: opCounter for insert increments



 Comments   
Comment by Max Hirschhorn [ 12/Nov/21 ]

We had also closed SERVER-15863 as "Won't Do". I think if the meaning of serverStatus metrics on mongos vs mongod or in transactions vs not in transactions comes up from outside of the team, then we should add explicit testing around the behavior and makes things consistent.

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