Skip to content

Commit

Permalink
client: skip update backward safets (#393)
Browse files Browse the repository at this point in the history
Signed-off-by: yisaer <disxiaofei@163.com>
  • Loading branch information
Yisaer authored Dec 13, 2021
1 parent 87c1c58 commit b147ced
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tikv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,13 @@ func (s *KVStore) updateSafeTS(ctx context.Context) {
return
}
safeTS := resp.Resp.(*kvrpcpb.StoreSafeTSResponse).GetSafeTs()
preSafeTS := s.getSafeTS(storeID)
if preSafeTS > safeTS {
metrics.TiKVSafeTSUpdateCounter.WithLabelValues("skip", storeIDStr).Inc()
preSafeTSTime := oracle.GetTimeFromTS(preSafeTS)
metrics.TiKVMinSafeTSGapSeconds.WithLabelValues(storeIDStr).Set(time.Since(preSafeTSTime).Seconds())
return
}
s.setSafeTS(storeID, safeTS)
metrics.TiKVSafeTSUpdateCounter.WithLabelValues("success", storeIDStr).Inc()
safeTSTime := oracle.GetTimeFromTS(safeTS)
Expand Down

0 comments on commit b147ced

Please sign in to comment.