You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the same as read committed but with the following anomaly not allowed:
P2 (“Non-repeatable read”): SQL-transaction T1 reads a row. SQL-transaction T2 then modifies or deletes that row and performs a COMMIT.
If T1 then attempts to reread the row, it may receive the modified value or discover that the row has been deleted. Thus breaking the consistency guarantee from ACID properties.
// Repeatable Read, Snapshot Isolation and Serializable further restricts Read Committed so only versions from transactions that completed before this one started are visible.
135
+
// we will add additional checks for the Read Committed logic that make sure the value was not created and not deleted within a transaction that started before this transaction started.
136
+
// As it happens, this is the same logic that will be necessary for Snapshot Isolation and Serializable Isolation.
137
+
// The additional logic (that makes Snapshot Isolation and Serializable Isolation different) happens at commit time.
////// now the specifics for a RepeatableReadIsolation level and above, rest of the checks for stricter isolation levels happens at Commit Time.
142
+
143
+
// ignore values from transactions started after the current one
144
+
ifvalue.txStartId>t.id {
145
+
returnfalse
146
+
}
147
+
148
+
// ignore values created from transactions in-progress i.e. ongoing when this transaction began but may have committed when this transaction was in progress.
149
+
// if we didn't check for this, then our current transaction may have performed some reads at the beginning, then an in-progress transaction committed and if we made
150
+
// another read, we might see the values because now that would be a committed transaction as per ReadCommittedIsolation level. Thus it would be a dirty read and violate
151
+
// RepeatableReadIsolation guarantee.
152
+
ift.inprogress.Contains(value.txStartId) {
153
+
returnfalse
154
+
}
155
+
156
+
////// a copy of all checks we did for ReadUncommittedIsolation is below with slight **MODIFICATION** to the second statement in the bigger IF block
157
+
158
+
// If the value wasn't created by current transaction and the other transaction that created it isn't committed yet, then it's no good.
0 commit comments