tikv / tikv/client-go

PD:tso:ErrGenerateTimestamp errors should not appear on the application side

Open
#950 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
362
Forks
274
Avg merge
4d 19m
Merged PRs (30d)
12

Description

When upgrading a TiDB cluster, PD changes the leader. PD:tso:ErrGenerateTimestamp error will appear on application side.In fact, the PD leader switchover only took 1-2 s. Retries should be added to reduce the probability of this error occurring on application side.

[2023/08/10 04:03:48.262 +00:00] [ERROR] [client.go:857] ["[pd] getTS error"] [dc-location=global] [stream-addr=https://db-pd-2.db-pd-peer.tidbxxxxxxx.svc:2379] [error="[PD:client:ErrClientGetTSO]rpc error: code = Unknown desc = [PD:tso:ErrGenerateTimestamp]generate timestamp failed, requested pd is not leader of cluster: rpc error: code = Unknown desc = [PD:tso:ErrGenerateTimestamp]generate timestamp failed, requested pd is not leader of cluster"]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at client.go around line 857, where the logged getTS error is reported, and trace how PD timestamp requests handle a leader switch. Add retry behavior for the temporary ErrGenerateTimestamp failure, then verify that a 1–2 second PD leader switchover does not surface the error to the application.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.