Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Lock View related documents #6408

Merged
merged 15 commits into from
Jun 15, 2021
Merged

Conversation

MyonKeminta
Copy link
Contributor

First-time contributors' checklist

What is changed, added or deleted? (Required)

  • Added document about the feature Lock View
    • The three new tables in infomation_schema
    • The configuration
    • The change to the lock conflict troubleshooting document.

Which TiDB version(s) do your changes apply to? (Required)

  • master (the latest development version)
  • v5.1 (TiDB 5.1 versions)
  • v5.0 (TiDB 5.0 versions)
  • v4.0 (TiDB 4.0 versions)
  • v3.1 (TiDB 3.1 versions)
  • v3.0 (TiDB 3.0 versions)
  • v2.1 (TiDB 2.1 versions)

What is the related PR or file link(s)?

  • This PR is translated from:
  • Other reference link(s):

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@ti-chi-bot ti-chi-bot requested a review from TomShawn June 4, 2021 10:18
@ti-chi-bot ti-chi-bot added missing-translation-status This PR does not have translation status info. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 4, 2021
@MyonKeminta MyonKeminta changed the title Add Lock View related document Add Lock View related documents Jun 4, 2021
| [`CLUSTER_HARDWARE`](/information-schema/information-schema-cluster-info.md) | 提供在每个 TiDB 组件上发现的底层物理硬件的详细信息。 |
| [`CLUSTER_INFO`](/information-schema/information-schema-cluster-info.md) | 提供当前集群拓扑的详细信息。 |
| [`CLUSTER_LOAD`](/information-schema/information-schema-cluster-load.md) | 提供集群中 TiDB 服务器的当前负载信息。 |
| [`CLUSTER_LOG`](/information-schema/information-schema-cluster-log.md) | 提供整个 TiDB 集群的日志。 |
| `CLUSTER_PROCESSLIST` | 提供 `PROCESSLIST` 表的集群级别的视图。 |
| `CLUSTER_SLOW_QUERY` | 提供 `SLOW_QUERY` 表的集群级别的视图。 |
| `CLUSTER_STATEMENTS_SUMMARY` | 提供 `STATEMENTS_SUMMARY` 表的集群级别的视图。 |
| `CLUSTER_STATEMENTS_SUMMARY_HISTORY` | 提供 `CLUSTER_STATEMENTS_SUMMARY_HISTORY` 表的集群级别的视图。 |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a mistake so I changed it 🤔

@TomShawn TomShawn self-assigned this Jun 4, 2021
@TomShawn TomShawn added translation/doing This PR’s assignee is translating this PR. v5.1 This PR/issue applies to TiDB v5.1. labels Jun 4, 2021
@ti-chi-bot ti-chi-bot removed the missing-translation-status This PR does not have translation status info. label Jun 4, 2021
@ti-chi-bot
Copy link
Member

@longfangsong: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@TomShawn
Copy link
Contributor

TomShawn commented Jun 7, 2021

@youjiali1995 PTAL. Thanks!

Copy link
Contributor

@youjiali1995 youjiali1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需不需要介绍一下这几张表能做什么、解决什么问题之类的?有些问题还需要这几张表一起用才能解决。

information-schema/information-schema-data-lock-waits.md Outdated Show resolved Hide resolved
information-schema/information-schema-deadlocks.md Outdated Show resolved Hide resolved

`DATA_LOCK_WAITS` 表的各列的含义如下:

* `KEY`:正在发生等锁的 KEY,以十六进制编码的形式显示。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tidb 现在有办法能解析这种 key 是哪个表哪一行或者索引吗?没有的话下个 sprint 要优化一下体验,可能用户知道了 sql 也没用,还要知道是哪一行才行。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个后续迭代可以考虑再加个字段展示把 key 解出来的信息。目前可能得借助些其它的工具才能解。我等会看下 tidb-ctl 顶用不顶用,能用的话晚点我把它补充进文档里。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tidb-ctl 好像不行...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MyonKeminta
Copy link
Contributor Author

I'll continue adding contents tomorrow

@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 8, 2021
troubleshoot-lock-conflicts.md Outdated Show resolved Hide resolved
troubleshoot-lock-conflicts.md Outdated Show resolved Hide resolved
troubleshoot-lock-conflicts.md Outdated Show resolved Hide resolved
MyonKeminta and others added 2 commits June 9, 2021 17:43
Co-authored-by: Lei Zhao <zlwgx1023@gmail.com>
@ti-chi-bot
Copy link
Member

@youjiali1995: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

information-schema/information-schema-deadlocks.md Outdated Show resolved Hide resolved
information-schema/information-schema-deadlocks.md Outdated Show resolved Hide resolved
information-schema/information-schema-deadlocks.md Outdated Show resolved Hide resolved
3. 事务 B 执行第二条语句试图对 `id = 1` 的行上锁,被事务 A 阻塞
4. 事务 A 试图对 `id = 2` 的行上锁,被 B 阻塞,形成死锁

对于这种情况,由于事务 A 阻塞其它事务的语句也是当前正在执行的语句,因而可以解除当前语句所上的悲观锁(使得事务 B 可以继续运行),并重试当前语句。TiDB 内部使用 key 的 hash 来判断是否属于这种情况。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“这种情况”是指情况二吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的

troubleshoot-lock-conflicts.md Outdated Show resolved Hide resolved
troubleshoot-lock-conflicts.md Outdated Show resolved Hide resolved
troubleshoot-lock-conflicts.md Outdated Show resolved Hide resolved
troubleshoot-lock-conflicts.md Outdated Show resolved Hide resolved
troubleshoot-lock-conflicts.md Outdated Show resolved Hide resolved
MyonKeminta and others added 2 commits June 11, 2021 18:11
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
tidb-configuration-file.md Outdated Show resolved Hide resolved
Copy link
Contributor

@TomShawn TomShawn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • TomShawn

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 15, 2021
@TomShawn
Copy link
Contributor

/remove-status LGT1
/status LGT2

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 15, 2021
Co-authored-by: Grace Cai <qqzczy@126.com>
@TomShawn
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 5560738

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 15, 2021
@ti-chi-bot ti-chi-bot merged commit 56793a8 into pingcap:master Jun 15, 2021
@MyonKeminta MyonKeminta deleted the m/lock-view branch June 15, 2021 03:59
@TomShawn TomShawn mentioned this pull request Jun 16, 2021
11 tasks
@TomShawn TomShawn added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. and removed translation/doing This PR’s assignee is translating this PR. labels Jun 16, 2021
2 rows in set (0.01 sec)
```

以上查询结果显示,ID 为 `425405024158875649` 的事务在执行 Digest 为 `"f7530877a35ae65300c42250abd8bc731bbaf0a7cabc05dab843565230611bb22"` 的语句的过程中,试图在 `"7480000000000000355f728000000000000002"` 这个 key 上获取悲观锁,但是该 key 目前被 ID 为 `425405016242126849` 的事务持有。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>
> 目前,`DEADLOCKS` 表暂不支持收集可重试的死锁错误相关的信息。

当事务 A 被另一个事务已经持有的锁阻塞,而事务 B 直接或间接地被当前事务持有的锁阻塞,将会引发一个死锁错误。这里:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomShawn TomShawn added the requires-followup This PR requires a follow-up task after being merged. label Jun 18, 2021
@TomShawn
Copy link
Contributor

pingcap/docs#5798 (comment)

@TomShawn
Copy link
Contributor

pingcap/docs#5798 (comment)

@TomShawn TomShawn removed the requires-followup This PR requires a follow-up task after being merged. label Jul 2, 2021
@TomShawn
Copy link
Contributor

TomShawn commented Jul 2, 2021

All followup comments are addressed in https://github.com/pingcap/docs-cn/pull/6577/files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. v5.1 This PR/issue applies to TiDB v5.1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants