stock_eu and stock_us are two replicas of the same stock data. In a real system they are on two machines. Here you play the network yourself.
- Sell one Kraken Plush (product 1) in Europe: take 1 from its stock in
stock_euonly. - A customer in the US reads the stock of product 1 from
stock_us. What does the read return? - The change reaches the US. Run the replication job, which copies every stock value from the EU replica to the US replica:
sql
UPDATE stock_us u
SET stock = (SELECT e.stock FROM stock_eu e WHERE e.product_id = u.product_id);- In step 2, the US replica answered with old data instead of an error. Which CAP property did it keep?
- After step 3, both replicas were the same again, without new writes. What is this called? Give the two words.
- During a partition, a bank's replica refuses every withdrawal until it can reach the others. Which CAP property does the bank keep?