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

Merged
merged 1 commit into from
Sep 10, 2019

Conversation

csuzhangxc
Copy link
Member

What problem does this PR solve?

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/enhancement Performance improvement or refactoring needs-cherry-pick-release-1.0 This PR should be cherry-picked to release-1.0. Remove this label after cherry-picked to release-1.0 labels Sep 9, 2019
@codecov
Copy link

codecov bot commented Sep 9, 2019

Codecov Report

Merging #276 into master will increase coverage by 0.0474%.
The diff coverage is 0%.

@@               Coverage Diff               @@
##            master       #276        +/-   ##
===============================================
+ Coverage   60.004%   60.0514%   +0.0474%     
===============================================
  Files          134        134                
  Lines        14759      14759                
===============================================
+ Hits          8856       8863         +7     
+ Misses        5057       5052         -5     
+ Partials       846        844         -2

@csuzhangxc
Copy link
Member Author

@amyangfei @WangXiangUSTC PTAL

@WangXiangUSTC
Copy link
Contributor

LGTM

@WangXiangUSTC WangXiangUSTC 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 9, 2019
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/LGT2 Two reviewers already commented LGTM, ready for merge and removed status/LGT1 One reviewer already commented LGTM labels Sep 10, 2019
@csuzhangxc csuzhangxc merged commit 519c2ab into pingcap:master Sep 10, 2019
@csuzhangxc csuzhangxc deleted the refine-checker-db-error branch September 10, 2019 01:49
csuzhangxc added a commit to csuzhangxc/dm that referenced this pull request Sep 10, 2019
@csuzhangxc csuzhangxc added already-cherry-pick-1.0 The related PR is already cherry-picked to release-1.0. Add this label once the PR is cherry-picked and removed needs-cherry-pick-release-1.0 This PR should be cherry-picked to release-1.0. Remove this label after cherry-picked to release-1.0 labels Mar 13, 2020
lichunzhu pushed a commit to lichunzhu/dm that referenced this pull request Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
already-cherry-pick-1.0 The related PR is already cherry-picked to release-1.0. Add this label once the PR is cherry-picked priority/normal Minor change, requires approval from ≥1 primary reviewer status/LGT2 Two reviewers already commented LGTM, ready for merge type/enhancement Performance improvement or refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants