Recurse Center Day 12: Isolation Anomalies
This is a draft post that I have prematurely published. Currently, I am attending RC and I want to write as much as possible, log my daily learnings and activities. But, I also don't want to spend time on grammar and prose, so I am publishing all the posts which usually I'd have kept in my draft folder.
Read and Write Anomalies
I was researching concurrency and isolation levels, I read about Read Anomalies which are also referred to as Phenomena.
Dirty read: Say transaction T1 made changes to some row and transaction T2 read or updated it before T1 committed. Now if T1 aborts, T2 read something which never existed in the first place.
Non-repeatable read (or fuzzy read): is when a transaction queries the same row twice and gets different results
Phantoms: pretty much the same as fuzzy read but when applied over a range of queries. Fuzzy read applies to a single record and phantoms to a range of records.
How do these affect isolation levels? Here is a handy chart:
Source: Transaction Isolation Levels (this page is also a good reference on the topic)
I also started reading a related paper: A Critique of ANSI SQL Isolation Levels
I paired with Jake earlier, to work on my B Tree project. Some thoughts:
- I spent way too much explaining the B Tree. I am not sure if I am bad at explaining or B Tree is too complex.
- I am adding tests as I am writing. This helped a lot during the pairing session, we were quick to write, test and reiterate.