Skip to content

CallCommandOnLeader frequently received EpochNotMatch #415

@howz97

Description

@howz97

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
			}
		}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions