Skip to content

First Commit Win guarantee may be broken under high concurrency #376

@xuerongNanopay

Description

@xuerongNanopay

The first-committer-wins guarantee may be broken if the (conflict check + Memtable insert) is not atomic. Especially under high concurrency.

Scenario (assume T1 and T2 run concurrently):
T1 Begin
T2 Begin
T1 write X
T2 write X
T1 call commit() in transaction
T2 call commit() in transaction
T1 check → no conflict (validate_write_conflicts function)
T2 check → no conflict (validate_write_conflicts function) // T1 may not be in memtable yet, so T2 can't figure out that there is a write write conflict.

Now both transactions commit, which violates first-committer-wins in same snapshot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions