Bug #97944 data_locks lack record

Submitted: 10 Dec 2019 12:06 Modified: 10 Dec 2019 14:27
Reporter: gaotuan gao Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.18 Homebrew OS:MacOS (10.16)
Assigned to: CPU Architecture:Any
Tags: data_locks

[10 Dec 2019 12:06] gaotuan gao
Description:
data_locks lack record 

How to repeat:
CREATE TABLE `t` (
  `id` int(11) NOT NULL,
  `c1` int(11) DEFAULT NULL,
  `k2` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `i_k2` (`k2`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci 
1 row in set (0.00 sec)

root[test]19:45:08>select * from t;
+----+------+------+
| id | c1   | k2   |
+----+------+------+
|  1 |    1 |    6 |
| 11 |   11 |   11 |
| 22 |   22 |   22 |
+----+------+------+
3 rows in set (0.01 sec)

root[test]19:45:14>
root[test]19:45:48>begin;
Query OK, 0 rows affected (0.00 sec)

root[test]19:45:49>update t set k2=7  where id=1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

At this time ,i did the query:
select * from  performance_schema.data_locks ;
+--------+-----------------------------------+-----------------------+-----------+----------+---------------+-------------+----------------+-------------------+------------+-----------------------+-----------+---------------+-------------+-----------+
| ENGINE | ENGINE_LOCK_ID                    | ENGINE_TRANSACTION_ID | THREAD_ID | EVENT_ID | OBJECT_SCHEMA | OBJECT_NAME | PARTITION_NAME | SUBPARTITION_NAME | INDEX_NAME | OBJECT_INSTANCE_BEGIN | LOCK_TYPE | LOCK_MODE     | LOCK_STATUS | LOCK_DATA |
+--------+-----------------------------------+-----------------------+-----------+----------+---------------+-------------+----------------+-------------------+------------+-----------------------+-----------+---------------+-------------+-----------+
| INNODB | 4785056296:1180:140574704557768   |                 16042 |        64 |       25 | test          | t           | NULL           | NULL              | NULL       |       140574704557768 | TABLE     | IX            | GRANTED     | NULL      |
| INNODB | 4785056296:33:4:2:140574716132888 |                 16042 |        64 |       25 | test          | t           | NULL           | NULL              | PRIMARY    |       140574716132888 | RECORD    | X,REC_NOT_GAP | GRANTED     | 1         |
+--------+-----------------------------------+-----------------------+-----------+----------+---------------+-------------+----------------+-------------------+------------+-----------------------+-----------+---------------+-------------+-----------+

I think data_locks shoud have three records,but there are two only,  i think  data_locks lack of a record on index i_k2
[10 Dec 2019 14:27] MySQL Verification Team
Hi Mr. gao,

Thank you for your bug report.

However, this is not a bug.

Number of lock is sufficient. This is because entire record is locked, by the primary key lock, which prevents changes in the nodes of other indices.

Not a bug.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.071 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.