Feel free to flame me if I should be posting this elsewhere, but after reading 
the "submitting a patch" guide, it appears I should ask for guidance here.

I was reading the Postgres MVCC documentation today (which is generally 
fantastic BTW), and am slightly confused by a single sentence example, 
describing possible read-only snapshot isolation anomalies. I would like to 
submit a patch to clarify this example, since I suspect others may be also 
confused, but to do that I need help understanding it. The example was added as 
part of the Serializable Snapshot Isolation patch.

Link to the commit: 

I'm referring to the following sentence of 13.2.2, which is still in the source 


"For example, even a read only transaction at this level may see a control 
record updated to show that a batch has been completed but not see one of the 
detail records which is logically part of the batch because it read an earlier 
revision of the control record."

I do not understand how this example anomaly is possible. I'm imagining 
something like the following:

1. Do a bunch of work, possibly in parallel in multiple transactions, that 
insert/update a bunch of detail records.
2. After all that work commits, insert or update a record in the "control" 
table indicating that the batch completed.

Or maybe:

1. Do a batch of work and update the "control" table in a single transaction.

The guarantee that I believe REPEATABLE READ will give you in either of these 
case is that if you see the "control" table record, you will read all the 
detail records, because the control record is only written if the updated 
detail records have been committed. What am I not understanding?

The most widely cited read-only snapshot isolation example is the bank 
withdrawl example from this paper: 
http://www.sigmod.org/publications/sigmod-record/0409/2.ROAnomONeil.pdf . 
However, I suspect we can present an anomaly that doesn't require as much 


Evan Jones

Work: https://www.mitro.co/    Personal: http://evanjones.ca/

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to