Skip to content
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

The status code of Not Leader is sometimes wrong #4797

Closed
YuJuncen opened this issue Apr 8, 2022 · 6 comments
Closed

The status code of Not Leader is sometimes wrong #4797

YuJuncen opened this issue Apr 8, 2022 · 6 comments

Comments

@YuJuncen
Copy link

YuJuncen commented Apr 8, 2022

Bug Report

What did you do?

Try to access the ScanRegions gRPC endpoint in a non-leader PD.

What did you expect to see?

The gRPC status code should be Unavailable, according to the definition of ErrNotLeader.

What did you see instead?

The error code is Unknown, and the error message is nested.

rpc error: code = Unknown desc = rpc error: code = Unavailable desc = not leader
                                 ^ The real `ErrNotLeader`.
github.com/tikv/pd/client.(*client).ScanRegions
	/go/pkg/mod/github.com/tikv/pd/[email protected]/client.go:1500
github.com/pingcap/tidb/br/pkg/restore.(*pdClient).ScanRegions
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/pkg/restore/split_client.go:502
github.com/pingcap/tidb/br/pkg/restore.PaginateScanRegion.func1
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/pkg/restore/split.go:452

What version of PD are you using (pd-server -V)?

Nightly

Notes

The cause of this error may be:

@YuJuncen YuJuncen added the type/bug The issue is confirmed as a bug. label Apr 8, 2022
@mayjiang0203
Copy link

mayjiang0203 commented Apr 8, 2022

/found automation
/severity major
/assign rleungx

@rleungx
Copy link
Member

rleungx commented Apr 8, 2022

Another problem is we also wrap the error of send or receive, which makes the status code change to unknown.

@rleungx
Copy link
Member

rleungx commented Apr 8, 2022

There might be two ways to solve this bug: one is we abandon the stack, another is we turn it into gRPC status, modify some fields and wrap it again.

@nolouch
Copy link
Contributor

nolouch commented May 23, 2022

Does this issue already fixed? @rleungx

@rleungx
Copy link
Member

rleungx commented May 23, 2022

The issue mentioned problem is fixed.

Another problem is we also wrap the error of send or receive, which makes the status code change to unknown.

This has not been fixed yet

@rleungx
Copy link
Member

rleungx commented May 24, 2022

Another problem is we also wrap the error of send or receive, which makes the status code change to unknown.

Create another issue to track the problem. See #5020

ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jun 22, 2022
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jun 22, 2022
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jun 22, 2022
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jun 22, 2022
ti-chi-bot added a commit that referenced this issue Jun 23, 2022
ref #4797, ref #4798

Signed-off-by: ti-chi-bot <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>

Co-authored-by: Ryan Leung <[email protected]>
ti-chi-bot added a commit that referenced this issue Jul 5, 2022
ref #4797, ref #4798

Signed-off-by: ti-chi-bot <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>

Co-authored-by: Ryan Leung <[email protected]>
ti-chi-bot added a commit that referenced this issue Jul 5, 2022
ref #4797, ref #4798

Signed-off-by: ti-chi-bot <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>

Co-authored-by: Ryan Leung <[email protected]>
ti-chi-bot added a commit that referenced this issue Jul 18, 2022
ref #4797, ref #4798

Signed-off-by: ti-chi-bot <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>

Co-authored-by: Ryan Leung <[email protected]>
ti-chi-bot added a commit that referenced this issue Sep 21, 2022
ref #4797, ref #4798

Signed-off-by: ti-chi-bot <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>

Co-authored-by: Ryan Leung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants