Tidb: table with read lock can be updated

Created on 9 Nov 2020  路  3Comments  路  Source: pingcap/tidb

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

lock tablse sbtest1 read;
update sbtest1 set k = 2 where id = 1;

2. What did you expect to see? (Required)

update unsuccessful

3. What did you see instead (Required)

update success
MySQL [benchmark]> unlock tables;
Query OK, 0 rows affected (1.01 sec)

MySQL [benchmark]> lock table sbtest1 read;
Query OK, 0 rows affected (1.01 sec)

MySQL [benchmark]> insert into sbtest1 values(12121,3232,'a','df');
ERROR 1099 (HY000): Table 'sbtest1' was locked with a READ lock and can't be updated
MySQL [benchmark]> update sbtest1 set k=2 where id=1;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0

4. What is your TiDB version? (Required)

master

| Release Version: None
Edition: Community
Git Commit Hash: None
Git Branch: None
UTC Build Time: None
GoVersion: go1.15.2
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |

need-more-info severitmajor typbug

Most helpful comment

@crazycs520 I can reproduce it. This is because update with where goes PointGetPlan and this path is missing table lock check code.

All 3 comments

@Lvnszn Could you check the config value of enable-table-lock is true? You can use the following SQL to query.

select * from information_schema.cluster_config where type='tidb' and `key` like "%lock%";

You need to make sure enable-table-lock is true when you want to use the table lock feature.

@crazycs520 I can reproduce it. This is because update with where goes PointGetPlan and this path is missing table lock check code.

Please edit this comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: https://github.com/pingcap/tidb/issues/20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Was this page helpful?
0 / 5 - 0 ratings