forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
132768: sql: arbiter index support under read committed isolation r=mw5h a=mw5h Previously, a read committed transaction could not perform UPSERT or INSERT .. ON CONFLICT statements against tables with implicit partitioning (e.g. regional by row tables) because the SQL engine couldn't enforce uniqueness across all partitions. A prior patch added the ability to enforce uniqueness in limited circumstances by writing a tombstone to all partitions. This patch extends the tombstone mechanism to arbiter indexes, used by UPSERT and INSERT .. ON CONFLICT. Rather than trying to prevent races with conflicting writes on the arbiter index, the SQL engine now writes tombstones to the arbiter index. The tombstones cause the KV layer to throw a "write too old" retryable error on conflict, causing the arbiter read to be retried and the conflicting value to be seen. The majority of this patch is a test that forces a race condition between the arbiter read and a conflicting write for a variety of arbiter index reads. The idea is to: * start the arbiter read. * suspend the statement. * perform a conflicting write. * complete the UPSERT/INSERT .. ON CONFLICT * verify the results are as expected. Fixes: cockroachdb#129835 Release note (sql change): UPSERT and INSERT .. ON CONFLICT statements are now supported on Regional By Row tables under READ COMMITTED isolation. Co-authored-by: Matt White <[email protected]>
- Loading branch information
Showing
15 changed files
with
336 additions
and
207 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.