What are the impacts of disabling metadata locking in TiDB 7.1.0?

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

Original topic: 7.1.0TiDB 关闭元数据锁有哪些影响?

| username: TiDBer_yyy

[TiDB Usage Environment] Production Environment
[TiDB Version] 7.1.0
[Reproduction Path] Not reproduced
[Encountered Problem: Problem Phenomenon and Impact]

  1. What are the impacts of disabling metadata lock in version 7.1.0 on the service?

Background:

  1. In the production environment, DDL is frequently blocked by MDL locks. After investigation, it was found that metadata locks were added after version 6.5. 元数据锁 | PingCAP 文档中心

  2. Architecture background:

  1. The cluster was upgraded from version 5.0 to version 7.1.
| username: Hacker_6ASfgBFe | Original post link

We upgraded our STG environment to 6.5 and encountered the same issue. We couldn’t resolve it; executing DDL statements would get stuck, and we couldn’t find any related transactions. In the end, we had to disable the metadata lock, and after doing so, the issue was resolved. Currently, the development team hasn’t reported any problems, but we haven’t upgraded the production environment yet.

| username: 啦啦啦啦啦 | Original post link

Older versions did not introduce metadata locks. If metadata changes occur on the related table during the execution of a transaction, TiDB will return an Information schema is changed error to ensure data consistency, causing the user transaction to fail. The upgraded version will automatically enable this by default, but it can be turned off.

| username: Hacker_6ASfgBFe | Original post link

It doesn’t work at all. As long as you execute DDL, it gets stuck. Even the simplest create table gets stuck.

| username: TiDBer_yyy | Original post link

Thank you, boss. Very useful information.

Could you please provide the data volume, business characteristics, TPS, and QPS?

| username: Hacker_6ASfgBFe | Original post link

We are only using it in the testing environment, it hasn’t been deployed online yet.

| username: 啦啦啦啦啦 | Original post link

Creating tables is being blocked? That shouldn’t be the case. Check mysql.tidb_mdl_view.

| username: TiDBer_yyy | Original post link

Received, received :saluting_face: :saluting_face:. Gather more opinions from other classmates.

| username: Hacker_6ASfgBFe | Original post link

During the issue, no data could be retrieved from this table at all.

| username: juecong | Original post link

We are using version 7.1.1 in production and have not encountered any issues with DDL stalling so far.

| username: Hacker_6ASfgBFe | Original post link

First, check if yours is running, and also see if there are many DDL operations being executed.

| username: TiDBer_yyy | Original post link

We have a lot of SQL incompatibilities here, so we didn’t upgrade.

| username: DBAER | Original post link

It depends on the business. In the past, when there was no metadata, queries might fail. If the business can accept this, I think it’s not a big deal, or you can add business retries.

| username: TiDBer_yyy | Original post link

There was no feedback before upgrading to 5.0.

| username: Hacker_6ASfgBFe | Original post link

Turn it off first, if there are any issues, solve them later. If you don’t turn it off, it will always be a problem.

| username: TiDBer_yyy | Original post link

Steady, accurate, and ruthless. In one word, just do it.

| username: TIDB-Learner | Original post link

Remember, one thing to pay attention to during the upgrade.

| username: zhaokede | Original post link

Will it have any impact if it’s turned off?

| username: aytrack | Original post link

How long does this blocking last? Based on the function of MDL and your business, is this MDL blocking expected?

Turning off MDL doesn’t have much impact.

| username: TiDBer_yyy | Original post link

The leader doesn’t allow intervention, opting for post-processing.