-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#24596] YSQL: Introduce TransactionProvider for PgClientSession needs
Summary: The `TransactionProvider` is a wrapper over transaction pool used in `PgClientService`. This class allows to know id of transaction which will be used next for `PgClientSessionKind::kPlain` session type in `PgClientSession` object. The `TransactionProvider::NextTxnIdForPlain` is used for this purpose. The knowing of txn id is required to introduce object locks (will be implemented separately). By design object locks are identified by distributed txn id. But it is too costly to start distributed txn in case current postgre txn starts using object locks because this will slowdown read only transactions. In case current transaction is read only object locks will use next txn id for identification. After commit/abort of such a transaction all the object locks will be removed. As a result same distributed txn id could be used for object locks in context of next transaction. In case of performing write operation by current transaction the distributed txn will be started. And it will have same txn id which was returned by the `TransactionProvider::NextTxnIdForPlain` method. This approach guaranties that all the object locks taken prior to performing of write operation will have same txn id like all the intents written by distributed txn started within current postgres's transaction. Jira: DB-13634 Test Plan: Jenkins Reviewers: bkolagani, pjain, esheng, sergei Reviewed By: esheng Subscribers: rthallam, sergei, yql, ybase Tags: #jenkins-ready Differential Revision: https://phorge.dev.yugabyte.com/D41282
- Loading branch information
1 parent
c5ab152
commit f9d389d
Showing
4 changed files
with
114 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters