Skip to content

Commit

Permalink
Merge pull request #2 from Yisaer/release-5.3-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 authored Dec 9, 2021
2 parents dd78177 + ca901be commit c4a7853
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions expression/builtin_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -7188,11 +7188,21 @@ func CalAppropriateTime(minTime, maxTime, minSafeTime time.Time) time.Time {
// 2. If t2 < t, we will use t2 as the result,
// and with it, a read request won't fail because it's bigger than the latest SafeTS.
func calAppropriateTime(minTime, maxTime, minSafeTime time.Time) time.Time {
if minSafeTime.Before(minTime) {
return minTime
} else if minSafeTime.After(maxTime) {
return maxTime
}
if minSafeTime.Before(minTime) || minSafeTime.After(maxTime) {
logutil.BgLogger().Warn("calAppropriateTime",
zap.Time("minTime", minTime),
zap.Time("maxTime", maxTime),
zap.Time("minSafeTime", minSafeTime))
if minSafeTime.Before(minTime) {
return minTime
} else if minSafeTime.After(maxTime) {
return maxTime
}
}
logutil.BgLogger().Debug("calAppropriateTime",
zap.Time("minTime", minTime),
zap.Time("maxTime", maxTime),
zap.Time("minSafeTime", minSafeTime))
return minSafeTime
}

Expand Down

0 comments on commit c4a7853

Please sign in to comment.