How does a PD server generate timestamps? #66415
sykp241095
started this conversation in
Migrated from Forum
Replies: 1 comment
|
原帖作者:winkyao\n原帖时间:2022-12-09 08:33:27.488779\n\n The transaction id in TiDB, we call it “TSO”, which means “TimeStamp Oracle”. It is constructed by Physical time and Logical time. physical here represents the unix timestamp in milliseconds. and logical try to solve the conflict with the same milliseconds in physical time, to make the TSO to be global unique. Basically, it don’t just use a thread to generate the TSO, you can refer to this code: pd/allocator_manager.go at 8227cdba21205fea57b0aca9644e97c2c53a94a8 · tikv/pd · GitHub It generate TSO concurrently in PD leader and generally requests will be batched by the client, and use mutex lock to deal with the multi-thread data race. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
原帖作者:erickaufmann16\n原帖时间:2022-10-06 16:14:19.822228\n原帖ID/Slug:49 / how-does-a-pd-server-generate-timestamps\n\n
Does it use a thread to generate an increasing sequence of numbers like what is usually done in a snapshot isolation implementation? Or does it refer to the local clock of the PD server for that purpose?
All reactions