CallCommandOnLeader 收到 EpochNotMatch 错误后(通常是发生split导致),测试代码目前是更新leader并重试,但是region不变所以会继续失败直到超时(5s)。我觉得应该更新region再重试。
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
}
}