Occasional Long Locking Time

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

Original topic: 偶发加锁时间长

| username: 今天不想写代码

[TiDB Usage Environment] Production Environment
[TiDB Version] 6.5
[Reproduction Path] Occasional
[Encountered Problem: Problem Phenomenon and Impact]
Occasional long duration for update by id, upon checking the execution process, it was found that the locking time is long.
[Attachments: Screenshots/Logs/Monitoring]


image

| username: TiDBer_jYQINSnf | Original post link

Check the monitoring, go to tikv → scheduler → prewrite and see if the latch wait duration is long?

| username: changpeng75 | Original post link

Is the cluster status normal? Are pessimistic memory locks and pipelined locking enabled?

| username: 今天不想写代码 | Original post link

Suddenly realized that I forgot the Prometheus password…

| username: 今天不想写代码 | Original post link

Normally, how can I check if these two mentioned locks are enabled? I started using them with the default configuration.

| username: DBRE | Original post link

Have you configured basic auth for Prometheus? Or did you forget the Grafana password?

| username: changpeng75 | Original post link

By default, it is enabled. If the business logic does not require pessimistic locking extensively, you can set the global mode to optimistic locking and manually enable it in transactions that require pessimistic locking. You can refer to the documentation:

| username: 数据源的TiDB学习之路 | Original post link

You can refer to this and give it a try: Prometheus|云原生|grafana的admin用户密码重置备忘记录_grafana密码忘记了-CSDN博客

| username: TiDBer_jYQINSnf | Original post link

Navigate to the /usr/share/grafana/bin directory
grafana-cli admin reset-admin-password xxxx

| username: DBRE | Original post link

If Prometheus has basic auth enabled, modify the file specified by the Prometheus startup parameter --web.config.file, refer to this article, and then restart Prometheus.

If you forgot the Grafana password, refer to the reply from the expert above.

| username: 今天不想写代码 | Original post link

Grafana CLI admin: ‘reset-admin-password’ is not a Grafana CLI admin command. See ‘./grafana-cli --help’.

| username: TiDBer_jYQINSnf | Original post link

This is how we reset it, take a look at the help.

| username: 今天不想写代码 | Original post link

Is this normal?

| username: TiDBer_CQ | Original post link

Is it possible to perform lock troubleshooting to see what the issue is?

| username: TiDBer_jYQINSnf | Original post link

Add more monitoring. This is ops, representing the amount for this scheduler. Also, check the wait duration to see how much it is.
Additionally, post the total CPU and thread CPU for review.

| username: 小龙虾爱大龙虾 | Original post link

I understand it as waiting for a pessimistic lock.