View Current TSO

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 查看当前tso

| username: HACK

[TiDB Usage Environment] Online, Testing, Research
[TiDB Version]

[Encountered Problem]
Cluster Version: 4.0.6
When viewing the current TSO on the Grafana interface (only the physical time part is displayed), how can I view the current TSO value?

[Reproduction Path] What operations were performed to encounter the problem
[Problem Phenomenon and Impact]

[Attachments]

Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.

| username: HACK | Original post link

Found the command:
cdc cli --pd=xxxx tso query

| username: songxuecheng | Original post link

pd-ctl tso

| username: ddhe9527 | Original post link

This is for converting TSO.

| username: HACK | Original post link

I found it, use this command:
cdc cli --pd=xxxx tso query

| username: songxuecheng | Original post link

The variable tidb_current_ts can also work.

| username: HACK | Original post link

tidb_current_ts

  • Scope: SESSION
  • Default value: 0
  • This variable is a read-only variable used to get the timestamp of the current transaction.

I see it as 0.

| username: songxuecheng | Original post link

begin;
select @@tidb_current_ts;
rollback;
Is this 0?

| username: HACK | Original post link

Got it, check it within the transaction.

| username: ablewang_xiaobo | Original post link

Saved.

| username: HACK | Original post link

Using the HTTP interface, I saw this metric through curl -s pd_addr:2379/metrics|grep pd_cluster_tso, but the query result seems a bit off.

| username: TiDBer_h9um7nOg | Original post link

:+1:

| username: cs58_dba | Original post link

This trick is powerful.

| username: system | Original post link

This topic was automatically closed 1 minute after the last reply. No new replies are allowed.