Phenomenon G0, or Write Cycle, occurs when a set of transactions overwrite each other. If a system prevents G0, it ensures that a transaction can commit only if its writes are completely isolated from the writes of other transactions. More formally, we say that a write cycle is a cycle of transactions where each transaction has a write-write dependency on the previous one.
For example, imagine a pair of transactions Ti and Tj, operating on two objects x and y. Ti creates x. Tj updates x, then creates y. Finally, Ti updates y. Tj overwrote Ti’s write of x, but Ti overwrote Tj’s write of y. The final result is a mixed state, reflecting Ti’s version of y, but Tj’s version of x.
G0 is generally understood to be prohibited by Read Uncommitted, and all stronger consistency models. However, the ANSI SQL standard neglects to mention it! Technically, the only ANSI SQL level which prevents G0 is Serializable.
Formally
G0 is defined in Adya’s thesis, section 3.2.1, in terms of a graph of transaction dependencies called a DSG.
G0: Write Cycles. A history H exhibits phenomenon G0 if DSG(H) contains a directed cycle consisting entirely of write-dependency edges.
See Also
A write cycle captures a more general—and also more precise—form of Dirty Write (P0). P0 involves just two transactions (rather than any number) and it rules out some Serializable histories.