Tidb: select lock in share mode Unexpected behavior

Created on 20 Aug 2020  路  12Comments  路  Source: pingcap/tidb

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

<!-- a step by step guide for reproducing the bug. -->
([email protected]:4000)[test]
([email protected]:4000)[test]show create table t;
+-------+------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                               |
+-------+------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+------------------------------------------------------------------------------------------------------------+
1 row in set (0.05 sec)

([email protected]:4000)[test]select * from t lock in share mode;
ERROR 1105 (HY000): Can't find column test.t._tidb_rowid in schema Column: [test.t.id] Unique key: []
([email protected]:4000)[test]

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

select * from t lock in share mode;
Empty set (0.00 sec)

3. What did you see instead (Required)

ERROR 1105 (HY000): Can't find column test.t._tidb_rowid in schema Column: [test.t.id] Unique key: []

4. What is your TiDB version? (Required)

v4.0.3 and v4.0.4

SIG slack channel

#sig-exec

Score

  • 300

Mentor

  • @SunRunAway
challenge-program difficulteasy high-performance need-more-info prioritP2 severitcritical siexecution typbug

Most helpful comment

I am going to cherry pick only SELECT .. LOCK IN SHARE MODE. I am concerned about cherry picking CALC_FOUND_ROWS to the release branch.

All 12 comments

/label sig/execution

Can't reproduce on master branch.

tidb(localhost:4000) > create table t (a int);
Query OK, 0 rows affected (0.14 sec)

tidb(localhost:4000) > select * from t lock in share mode;
ERROR 1235 (42000): function LOCK IN SHARE MODE has only noop implementation in tidb now, use tidb_enable_noop_functions to enable these functions
tidb(localhost:4000) > set @@tidb_enable_noop_functions = 1;
Query OK, 0 rows affected (0.00 sec)

tidb(localhost:4000) > select * from t lock in share mode;
Empty set (0.01 sec)

But it can be reproduced on release-4.0 branch.

tidb(localhost:4000) > select * from t lock in share mode;
ERROR 1105 (HY000): Can't find column test.t._tidb_rowid in schema Column: [test.t.a] Unique key: []

Maybe we should cherry-pick
https://github.com/pingcap/tidb/pull/19506
https://github.com/pingcap/tidb/pull/19630
to release-4.0 branch.

@cfzjywxk @nullnotnil PTAL.

/assign @cfzjywxk

/assign @nullnotnil

OK, I'll take a look.

I am going to cherry pick only SELECT .. LOCK IN SHARE MODE. I am concerned about cherry picking CALC_FOUND_ROWS to the release branch.

@nullnotnil A friendly ping

@nullnotnil A friendly ping

PR https://github.com/pingcap/tidb/pull/21005 created and merged. There has not been a cherry pick for https://github.com/pingcap/tidb/pull/19630 yet, so I will leave this issue open.

Maybe we should cherry-pick

19506

19630

to release-4.0 branch.

@cfzjywxk @nullnotnil PTAL.

I checked that master dose not have this problem because master has another bug which may cover this one..

closed by #21126

Please edit this comment or add a new 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