-
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.
[#16212] YSQL: Fix conflict detection in serializable isolation in ca…
…se of explicit row locking Summary: There are 2 situations when read operations create intents: - read in context of transaction with `SERIALIZABLE` isolation level - read with explicit row lock (such as `SELECT ... FOR KEY SHARE`) In case of both conditions are met (`SELECT ... FOR KEY SHARE` within `SERIALIZABLE` txn) YB creates intents for explicit row lock only. As a result YB may detects conflict incorrectly (because row lock intents can be weaker than serializable read intents) Example: ``` -- Txn1: START TRANSACTION ISOLATION LEVEL SERIALIZABLE; UPDATE t SET v = 100 WHERE k = 1; -- Txn2: START TRANSACTION ISOLATION LEVEL SERIALIZABLE; SELECT * FROM t WHERE k = 1; -- has conflict with txn1 OK -- Txn3: START TRANSACTION ISOLATION LEVEL SERIALIZABLE; SELECT * FROM t WHERE k = 1 FOR KEY SHARE; -- has no conflicts with txn1 FAIL ``` Solution is to create both types of intents (serializable read + row lock) in case both conditions are met. **Note:** Actually 2 intents will be create only in row lock intent are stronger than serializable read intent. Jira: DB-5641 Test Plan: New unit test is introduced ``` ./yb_build.sh --cxx-test pg_misc_conflicts-test --gtest_filter PgMiscConflictsTest/PgRowLockTest.SerializableTxnUpdate/* ``` Reviewers: sergei, pjain, rsami, tnayak, tvesely Reviewed By: pjain Subscribers: mbautin, yql, ybase, bogdan Differential Revision: https://phorge.dev.yugabyte.com/D24861
- Loading branch information
1 parent
c2694db
commit decb104
Showing
15 changed files
with
329 additions
and
158 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
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
Oops, something went wrong.