Summary:
Consider the following scenario.
The following false conflict could be detected in case of snapshot isolation:
1) txn1 insert multiple rows into table.
2) After txn1 is committed txn2 updates values in those rows.
3) The read arrives at some tablet. This tablet not yet applied intents from txn1, and currently it replicates intents for some other transactions.
4) Since it is the first tablet for txn2, we use safe time of this tablet as read time for txn2. Since it replicates write, we use this operation hybrid time. And this time is less than txn1 commit hybrid time.
5) During read we see row from txn1, and it has time equals to commit hybrid time. Since it is greater than read time, the local read restart is performed, using txn1 commit hybrid time as a new read time for txn2.
6) Then txn2 tries to read using this time on some another tablet.
7) During conflict detection it finds rows from txn1 with the time matching read time.
Because of wrong logic, we detect such rows as written after transaction start and abort txn2.
Actually there is no conflict, because txn2 would read those values, so they should not be reported as conflict.
Jira: DB-15475
Test Plan: PgTxnTest.MultiInsertUpdate
Reviewers: timur, dmitry
Reviewed By: dmitry
Subscribers: pjain, patnaik.balivada, rthallam, bkolagani, esheng, hsunder, ybase, yql
Tags: #jenkins-ready
Differential Revision: https://phorge.dev.yugabyte.com/D42043