-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix pd_control: not rely on error text #197
Conversation
/run-e2e-tests |
1 similar comment
/run-e2e-tests |
if strings.Contains(err2.Error(), schedulerExisted) { | ||
return nil | ||
|
||
evictLeaderSchedulers, err := pc.GetEvictLeaderSchedulers() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be exec before create evict leader, if the scheduler leader exists, then not need to post sheduler leader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This replaces of strings.Contains
, placed behind evicting leader is ok.
err2 := readErrorBody(res.Body) | ||
if strings.Contains(err2.Error(), schedulerNotFound) { | ||
return nil | ||
evictLeaderSchedulers, err := pc.GetEvictLeaderSchedulers() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This replaces of strings.Contains
, placed behind evicting leader is ok.
if strings.Contains(bodyStr, "store has been removed") { | ||
return nil | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PD now actually returns a structured json response with an error code and an error code as a header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but the older version don't have the error code and header.
Return the error is ok for this situation. The DeleteStore
function is reentrant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. But the code looks weird, especially the BeginEvictLeader
and EndEvictLeader
. Could you add a comment to say that this is a just a workaround for now, when PD returns standard json response, we should get rid of this verbose code.
/run-e2e-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-e2e-tests |
Co-authored-by: Lilian Lee <lilin@pingcap.com>
Signed-off-by: liubo02 <liubo02@pingcap.com>
GetEvictLeaderSchedulers
instead@tennix @xiaojingchen PTAL