Details
Description
Motivation
According to tx protocol in order to prevent phantom reads we should lock current key on every iteration that may be bigger than upper bound border.
Let's check following example:
tbl [3, 5, 8]
select * from tbl where k >= 3 and k <= 7 may be internally converted to sorted index scan (lowerBorder=3[included], upperBorder=7[included])
thus we won't see key 8 and won't lock it.
That means that tx2 may insert key 6, so that we finish with phantom read anomaly on select * from tbl where k >= 3 and k <= 7 re-run.
Definition of Done
Aforementioned scenario won't lead to phantom read.
Implementation Notes
We should lock ceil(upper bound key) or +INF if there's no such key, thus we should iterate over sorted index without upper bound parameter manually comparing next key with users upperBound.
Attachments
Issue Links
- is caused by
-
IGNITE-17748 Enrich InternalTable.scan API in order to support index scans
- Resolved
- links to