Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimistic concurrency allows Fractured Read #17929

Closed
aphyr opened this issue Dec 29, 2023 · 2 comments
Closed

Optimistic concurrency allows Fractured Read #17929

aphyr opened this issue Dec 29, 2023 · 2 comments

Comments

@aphyr
Copy link

aphyr commented Dec 29, 2023

Building on #17927, it appears that transactions executed with optimistic concurrency allow G-single: read skew. Here's an example test run: in five minutes it recorded hundreds of instances of G-single, G-nonadjacent, and G2-item. These anomalies are prohibited under Serializability, Snapshot Isolation, Repeatable Read, and Consistent View. For instance, here's a G-single case involving a read-write / write-write cycle between two transactions:

Screenshot from 2023-12-29 14-14-58

The top transaction, T1, read key 1060 and saw its value was [2]. It went on to append 5 and 6 to key 1093. The bottom transaction, T2, appended 3 to key 1060; from the read of [2], we know that T2's first append must have executed after T1's first read. T2 went on to append 3 to key 1093, and then read key 1093's state as [3]--which tells us that T2 performed the first write to key 1093. From this we know that T1 must have appended 5 to key 1093 after T2 appended 3.

Here's a fractured read, in which top transaction T1 appends a value to keys 271 and 279, and bottom transaction T2 observes the write to 279 but not 271. This is forbidden under Read Atomic, and by extension Update Atomic, Causal, Prefix, Parallel Snapshot Isolation, and generalized SI.

Screenshot from 2023-12-29 14-22-38

@aphyr aphyr changed the title Optimistic concurrency allows G-single Optimistic concurrency allows Fractured Read Dec 29, 2023
@ayende
Copy link
Member

ayende commented Dec 31, 2023

This is essentially a duplicate of #17928, given that I believe they have the same root cause. Full answer is there.

@ayende ayende closed this as completed Dec 31, 2023
@arekpalinski
Copy link
Member

We have updated our documentation and provided more clarifications when talking about transactions in RavenDB and the Client API Session.

The actual changes we made can be reviewed here: ravendb/docs#1766.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants