[DRIVERS-1953] Clarify if pinned connections can only be used for a single concurrent transaction when behind load-balancer Created: 14/Oct/21  Updated: 28/Oct/23  Resolved: 06/Jan/22

Status: Closed
Project: Drivers
Component/s: Load Balancer
Fix Version/s: None

Type: Spec Change Priority: Major - P3
Reporter: George Wangensteen Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to RUBY-2868 Pin connections instead of serviceIds... Closed
is related to SERVER-58504 Abort transactions for a connection w... Closed
Driver Changes: Not Needed

 Description   

Summary

In the specification for driver support for running MongoDB behind an L4 load-balancer, we specify connection-pinning rules for distributed transactions to ensure all transaction commands target the same service behind the load balancer. Specifically, we say:

"When executing a transaction in load balancing mode, drivers MUST follow the rules outlined in Sharded Transactions with one exception: drivers MUST use the same connection for all commands in the transaction " 

I would like to clarify in the spec whether or not this implies that:

"drivers MUST NOT use the same connection for two concurrent transactions run under different sessions from the same client"

In other words, I wonder if the following situation possible:
(1) Client A begins txn with LSID x and TxnNumber 1; the driver pins connection C to serve this txn
(2) Client A sends some pieces of txn (x, 1) but doesn’t commit or abort it yet
(3) Client A begins txn with LSID y and txnNumber 1 on connection C, and sends some pieces of it
(4) Client A commits txn (x, 1)
(5) Client A commits txn (y, 1)

I believe the answer is "this is not possible", which means we could add to the spec a clarification that a pinned connection for a transaction will only run commands for that single transaction until it either commits or aborts. 

 

Motivation

Who is the affected end user?

Adding this to the spec would make the server work for LB support much simpler.

 

Is this ticket required by a downstream team?

SERVER

 



 Comments   
Comment by Githook User [ 05/Jan/22 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: DRIVERS-1953 LB txns have exclusive connection (#1114)
Branch: master
https://github.com/mongodb/specifications/commit/d59c866f33ea408cb7db370226829ee1598b5d43

Comment by Kevin Albertson [ 22/Dec/21 ]

Apologies for the slow follow-up.

I believe the answer is "this is not possible", which means we could add to the spec a clarification that a pinned connection for a transaction will only run commands for that single transaction until it either commits or aborts.

After a survey of drivers, the answer is "this is possible" in some drivers but does not agree with the intent of the specification.

Opened https://github.com/mongodb/specifications/pull/1114 with the suggested clarification.

Generated at Thu Feb 08 08:24:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.