server: classic GetMinTS ignores GenerateTSO error and returns zero timestamp
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Read the non-independent TSO branch in server/grpc_service.go around GetMinTS and check how its error is handled before the response header is built. Follow nearby GetMinTS tests or add coverage for GenerateTSO failure; done means the endpoint returns the error in its response header instead of a successful header with a zero timestamp.
Written by the indexing model from the issue text.
Description
Bug Report
What did you do?
Called the GetMinTS gRPC endpoint on a PD server running in classic (non-independent TSO service) mode when s.tsoAllocator.GenerateTSO(ctx, 1) fails (for example, while the TSO allocator is uninitialized or resetting during leadership transition).
What did you expect to see?
GrpcServer.GetMinTS should propagate the error from s.tsoAllocator.GenerateTSO into the response error header instead of returning a zero timestamp as valid.
What did you see instead?
In server/grpc_service.go, the non-independent TSO branch assigns the error to internalErr and only uses it to guard tsoHandleDuration.Observe(...), leaving the outer err variable nil:
if s.IsServiceIndependent(constant.TSOServiceName) {
minTS, err = s.GetMinTSFromTSOService()
} else {
start := time.Now()
ts, internalErr := s.tsoAllocator.GenerateTSO(ctx, 1)
if internalErr == nil {
tsoHandleDuration.Observe(time.Since(start).Seconds())
}
minTS = &ts
}
if err != nil {
As a result, GetMinTS returns a success header (grpcutil.WrapHeader()) with a zero (0, 0) timestamp whenever GenerateTSO fails.
What version of PD are you using (pd-server -V)?
master (4be269d9ea33)
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 794
- Avg merge
- 5d 32m
- Merged PRs (30d)
- 81
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tikv/pd
-
contribution type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
type/ci
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
affects-8.5 contribution needs-type
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
contribution type/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
contribution type/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
agent-in-progress
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jordansmall/spindrift#7716 ·
Maintainers usually reply within 1 day
-
bug 🪲 needs-triage :mag:
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Azure/azure-service-operator#5880 ·
Maintainers usually reply within 1 day
-
`create_branch` returns a bare 404 when the token has no push accessPossibly taken @aloneangel45 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
github/github-mcp-server#3994 ·
Maintainers usually reply within 2 days
-
Add rebaseWhen: conflicted to major Go module Renovate updatesPossibly taken @WadekarPrashant claimed this today. Openenhancement feature good first issue ready-for-triage triaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
konflux-ci/build-definitions#3943 · 3 comments ·
Maintainers usually reply within 1 day