# Copyright (c) reifydb.com 2025
# This file is licensed under the AGPL-3.0-or-later

# This file includes and modifies code from the toydb project (https://github.com/erikgrinaker/toydb),
# originally licensed under the Apache License, Version 2.0.
# Original copyright:
#   Copyright (c) 2024 Erik Grinaker
#
# The original Apache License can be found at:
#   http://www.apache.org/licenses/LICENSE-2.0

# A lost update is when t1 and t2 both read a value and update it, where
# t2's update replaces t1. Snapshot isolation prevents this.

t1: begin
t1: get key
---
t1: "key" → None

t2: begin
t2: get key
---
t2: "key" → None

t1: set key=1
t2: !set key=2
---
t2: Error: transaction serialization conflict occurred, retry transaction
