Skip to content

Commit

Permalink
lightning: unwrap the error before call PD function (pingcap#44856)
Browse files Browse the repository at this point in the history
  • Loading branch information
lance6716 committed Jul 12, 2023
1 parent e8df3d5 commit e20f367
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion br/pkg/lightning/backend/local/checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func (e *TiKVChecksumManager) Checksum(ctx context.Context, tableInfo *checkpoin
)
physicalTS, logicalTS, err = e.manager.pdClient.GetTS(ctx)
for err != nil {
if !pd.IsLeaderChange(err) {
if !pd.IsLeaderChange(errors.Cause(err)) {
return nil, errors.Annotate(err, "fetch tso from pd failed")
}
retryTime++
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/backend/local/checksum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func (c *testPDClient) currentSafePoint() uint64 {
func (c *testPDClient) GetTS(ctx context.Context) (int64, int64, error) {
physicalTS := time.Now().UnixMilli()
if c.leaderChanging && physicalTS%2 == 0 {
return 0, 0, errs.ErrClientTSOStreamClosed
return 0, 0, errors.WithStack(errs.ErrClientTSOStreamClosed)
}
logicalTS := oracle.ExtractLogical(c.logicalTSCounter.Inc())
return physicalTS, logicalTS, nil
Expand Down

0 comments on commit e20f367

Please sign in to comment.