Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

checker: keep the original database error in the error message (#276) #278

Merged
merged 1 commit into from
Sep 10, 2019

Conversation

csuzhangxc
Copy link
Member

What problem does this PR solve?

cherry-pick #276

keep the original database error in the error message for checker.

What is changed and how it works?

use Error.Delegate to replace Error.Generate.

Check List

Tests

  • Manual test (add detailed scripts or steps below)
    1. set a wrong password for DM-worker
    2. start-task
      the original error message is
      [code=26002:class=dm-master:scope=upstream:level=high] fail to initial checker: failed to open DSN root:***@127.0.0.1:3306\ngit.luolix.top/pingcap/dm/pkg/terror.(*Error).Generate\n\t/Users/zhangxc/gopath/src/github.com/pingcap/dm/pkg/terror/terror.go:232\ngit.luolix.top/pingcap/dm/checker.(*Checker).Init\n\t/Users/zhangxc/gopath/src/github.com/pingcap/dm/checker/checker.go:129\ngit.luolix.top/pingcap/dm/checker.CheckSyncConfig\n\t/Users/zhangxc/gopath/src/github.com/pingcap/dm/checker/cmd.go:50\ngit.luolix.top/pingcap/dm/dm/master.(*Server).generateSubTask\n\t/Users/zhangxc/gopath/src/github.com/pingcap/dm/dm/master/server.go:1847\ngit.luolix.top/pingcap/dm/dm/master.(*Server).StartTask\n\t/Users/zhangxc/gopath/src/github.com/pingcap/dm/dm/master/server.go:220\ngit.luolix.top/pingcap/dm/dm/pb._Master_StartTask_Handler\n\t/Users/zhangxc/gopath/src/github.com/pingcap/dm/dm/pb/dmmaster.pb.go:1530\ngoogle.golang.org/grpc.(*Server).processUnaryRPC\n\t/Users/zhangxc/gopath/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:995\ngoogle.golang.org/grpc.(*Server).handleStream\n\t/Users/zhangxc/gopath/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:1275\ngoogle.golang.org/grpc.(*Server).serveStreams.func1.1\n\t/Users/zhangxc/gopath/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:710\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1337
      
      the error message now is
      [code=26002:class=dm-master:scope=upstream:level=high] fail to initial checker: failed to open DSN root:***@127.0.0.1:3306: Error 1045: Access denied for user 'root'@'172.18.0.1' (using password: YES)\ngit.luolix.top/pingcap/dm/pkg/terror.(*Error).Delegate\n\t/Users/zhangxc/gopath/src/github.com/pingcap/dm/pkg/terror/terror.go:267\ngit.luolix.top/pingcap/dm/checker.(*Checker).Init\n\t/Users/zhangxc/gopath/src/github.com/pingcap/dm/checker/checker.go:129\ngit.luolix.top/pingcap/dm/checker.CheckSyncConfig\n\t/Users/zhangxc/gopath/src/github.com/pingcap/dm/checker/cmd.go:50\ngit.luolix.top/pingcap/dm/dm/master.(*Server).generateSubTask\n\t/Users/zhangxc/gopath/src/github.com/pingcap/dm/dm/master/server.go:1847\ngit.luolix.top/pingcap/dm/dm/master.(*Server).StartTask\n\t/Users/zhangxc/gopath/src/github.com/pingcap/dm/dm/master/server.go:220\ngit.luolix.top/pingcap/dm/dm/pb._Master_StartTask_Handler\n\t/Users/zhangxc/gopath/src/github.com/pingcap/dm/dm/pb/dmmaster.pb.go:1530\ngoogle.golang.org/grpc.(*Server).processUnaryRPC\n\t/Users/zhangxc/gopath/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:995\ngoogle.golang.org/grpc.(*Server).handleStream\n\t/Users/zhangxc/gopath/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:1275\ngoogle.golang.org/grpc.(*Server).serveStreams.func1.1\n\t/Users/zhangxc/gopath/pkg/mod/google.golang.org/grpc@v1.23.0/server.go:710\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1337
      

Related changes

  • Need to cherry-pick to the release branch

@csuzhangxc csuzhangxc added priority/normal Minor change, requires approval from ≥1 primary reviewer status/PTAL This PR is ready for review. Add this label back after committing new changes type/cherry-pick This PR is just a cherry-pick (backport) type/enhancement Performance improvement or refactoring labels Sep 10, 2019
@codecov
Copy link

codecov bot commented Sep 10, 2019

Codecov Report

Merging #278 into release-1.0 will increase coverage by 0.0542%.
The diff coverage is 0%.

@@                 Coverage Diff                 @@
##           release-1.0       #278        +/-   ##
===================================================
+ Coverage       60.004%   60.0582%   +0.0542%     
===================================================
  Files              134        134                
  Lines            14759      14759                
===================================================
+ Hits              8856       8864         +8     
+ Misses            5057       5049         -8     
  Partials           846        846

@csuzhangxc
Copy link
Member Author

@amyangfei @WangXiangUSTC PTAL

Copy link
Contributor

@amyangfei amyangfei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@amyangfei amyangfei added status/LGT1 One reviewer already commented LGTM and removed status/PTAL This PR is ready for review. Add this label back after committing new changes labels Sep 10, 2019
Copy link
Contributor

@WangXiangUSTC WangXiangUSTC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@csuzhangxc csuzhangxc merged commit 54e8edf into pingcap:release-1.0 Sep 10, 2019
@csuzhangxc csuzhangxc deleted the pick-1.0-276 branch September 10, 2019 05:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority/normal Minor change, requires approval from ≥1 primary reviewer status/LGT1 One reviewer already commented LGTM type/cherry-pick This PR is just a cherry-pick (backport) type/enhancement Performance improvement or refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants