-
Notifications
You must be signed in to change notification settings - Fork 726
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
*: optimize log and make their specification consistent #2853
Conversation
/run-all-tests |
1 similar comment
/run-all-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-all-tests |
2 similar comments
/run-all-tests |
/run-all-tests |
/rebuild |
18b362f
to
1712dda
Compare
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
a315a9d
to
a4b45e7
Compare
continue | ||
} | ||
|
||
b, err := ioutil.ReadAll(resp.Body) | ||
resp.Body.Close() | ||
if err != nil { | ||
log.Error("read failed", errs.ZapError(errs.ErrReadHTTPBody, err)) | ||
log.Error("read failed", errs.ZapError(errs.ErrIORead, err)) |
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.
why change its name?
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.
I think it's an IO error
// tso errors | ||
var ( | ||
ErrInvalidTimestamp = errors.Normalize("invalid timestamp", errors.RFCCodeText("PD:tso:ErrInvalidTimestamp")) | ||
ErrLogicOverflow = errors.Normalize("logic part overflow", errors.RFCCodeText("PD:tso:ErrLogicOverflow")) | ||
ErrIncorrectSystemTime = errors.Normalize("incorrect system time", errors.RFCCodeText("PD:tso:ErrIncorrectSystemTime")) | ||
) | ||
|
||
// adapter errors | ||
// member errors |
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.
On what basis do we rank these errors?
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.
IMO, we just need to distinguish the errors generated in PD internal or in the third-party package. There is no rank concept.
Signed-off-by: Ryan Leung <[email protected]>
a4b45e7
to
6e08a84
Compare
server/election/leadership.go
Outdated
@@ -34,7 +34,7 @@ func GetLeader(c *clientv3.Client, leaderPath string) (*pdpb.Member, int64, erro | |||
leader := &pdpb.Member{} | |||
ok, rev, err := etcdutil.GetProtoMsgWithModRev(c, leaderPath, leader) | |||
if err != nil { | |||
return nil, 0, err | |||
return nil, 0, errs.ErrEtcdGetProtoMsgWithModRev.Wrap(err).FastGenWithCause() |
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.
i think we should handle errors in the lower level
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.
You're right.
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.
updated
} | ||
if !resp.Succeeded { | ||
return errors.WithStack(errTxnFailed) | ||
return errs.ErrEtcdTxn.FastGenByArgs() |
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 error has a %s
placeholder. is it ok to pass no argument?
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.
updated
Signed-off-by: Ryan Leung <[email protected]>
server/member/member.go
Outdated
err := errs.ErrEtcdLeaderNotFound.FastGenByArgs() | ||
log.Error("no etcd leader, check pd leader later", errs.ZapError(err)) |
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.
err := errs.ErrEtcdLeaderNotFound.FastGenByArgs() | |
log.Error("no etcd leader, check pd leader later", errs.ZapError(err)) | |
log.Error("no etcd leader, check pd leader later", errs.ZapError(errs.ErrEtcdLeaderNotFound)) |
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.
updated
Signed-off-by: Ryan Leung <[email protected]>
@howardlau1999,Thanks for your review. However, LGTM is restricted to Reviewers or higher roles.See the corresponding SIG page for more information. Related SIGs: scheduling(slack). |
@lhy1024 PTAL |
/run-all-tests |
/merge |
/run-all-tests |
Signed-off-by: Ryan Leung <[email protected]> Signed-off-by: Howard Lau <[email protected]>
Signed-off-by: ti-srebot <[email protected]>
cherry pick to release-4.0 in PR #2903 |
Signed-off-by: ti-srebot <[email protected]>
Signed-off-by: ti-srebot <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
What problem does this PR solve?
Related to #2704.
What is changed and how it works?
This PR does some optimization for the error log by defining the error when we first meet it.
Check List
Tests
Related changes
Release note