CallCommandOnLeader frequently received EpochNotMatch
howz97 opened this issue · 0 comments
howz97 commented
if CallCommandOnLeader request with stale region epoch (maybe split happend), client will receive EpochNotMatch, and it will retry with wrong region until timeout.
if resp.Header.Error != nil {
err := resp.Header.Error
if err.GetStaleCommand() != nil || err.GetEpochNotMatch() != nil || err.GetNotLeader() != nil {
log.Debugf("encouter retryable err %+v", resp)
// fixme: maybe region splited when requesting, resp will be EpochNotMatch until timeout
if err.GetNotLeader() != nil && err.GetNotLeader().Leader != nil {
leader = err.GetNotLeader().Leader
log.Debugf("retry on leader peer=%d,%d", leader.Id, leader.StoreId)
} else {
leader = c.LeaderOfRegion(regionID)
}
continue
}
}