reverse scan might skip some range encoutering region merge
The following function has an issue that might lose some range of data while there is a region merge happening between two PD RPCs.
For example, If we are locating the b, a.k.a., the end key of the left region.
[x, a) [a, b) [b, c)
For the first round of the loop, we call GetRegion(b), and get the region [b, c], which is predictable.
However, if these is a region merge that happened before the GetPrevRegion(b) was issued.
[x, a) [a < b, b < c)
We might get region [x, a), then the range of [a, b) is skipped in this scan.
https://github.com/tikv/client-go/blob/884a634378d44066dd0b29395d1ce1583f17df16/internal/locate/region_cache.go#L1488-L1540
@iosmanthus Are you actively working on this? Can I pick this up?
@iosmanthus Are you actively working on this? Can I pick this up?
OK. It should be simple to fix this bug, just retry to locate the region if the result of the GetPrevRegion is invalid. https://github.com/tikv/client-go/blob/35c1ee47c4f9409ec996fa83d1724017401321ba/txnkv/txnsnapshot/scan.go#L210