transaction check feature
shiyuhang0 opened this issue · 1 comments
Feature Request
Is your feature request related to a problem? Please describe:
When we use client-java to do transactions if the execute time > gc_life_time. We may get the wrong data because gc may clean the snapshot of that time.
Describe the feature you'd like:
In TiDB, GC worker will clean the obsolete data before GC safe point periodically. And the gc safe point = min{min_start_ts, now-gc_life_time}.
The min_start_ts is reported by TiDB in PD etcd. anyone who uses client-java/client-go to do transactions usually won't report the min_start_ts. So, We can regard the gc safe point for the client-java/client-go user as ${now-gc_life_time}
We do can control the gc_life_time by global system variables tidb_gc_life_time
. But client-java/client-go also need to check the start_ts is greater than gc safe point in case TiKV return the wrong result.
All in all. I'd like to add a feature that will check the transaction's start_ts >= gc safe point. If the check fails, we need to throw an exception.
Teachability, Documentation, Adoption, Migration Strategy:
Get safe point from PD:https://github.com/pingcap/kvproto/blob/fe71e5de46436af82e7a935800df1bf43dee0882/proto/pdpb.proto#L72
This feature need to ask PD for every kv request which will increase the pressure on PD. Close it before a better solution