• 锁排查--实例


    mysql>  show processlist;
    +----+------+-----------+------+---------+------+-------+------------------+
    | Id | User | Host      | db   | Command | Time | State | Info             |
    +----+------+-----------+------+---------+------+-------+------------------+
    |  1 | root | localhost | NULL | Query   |    0 | init  | show processlist |
    |  2 | test | localhost | NULL | Sleep   |   43 |       | NULL             |
    +----+------+-----------+------+---------+------+-------+------------------+
    2 rows in set (0.00 sec)
    
    mysql> 
    
    
    
    SESSION 1:
    
    3 | test | localhost | test | Sleep   |   25 |       | NULL            
    
    mysql> create table t7(id int);
    Query OK, 0 rows affected (0.33 sec)
    
    mysql>  lock table  t7 read;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> insert into t1 values(1);
    ERROR 1100 (HY000): Table 't1' was not locked with LOCK TABLES
    
    
    SESSION 2:
    
    |  4 | test | localhost | test | Sleep   |   10 |       | NULL   
    
    mysql> insert into t7 values(1);  ----HANG
    
    
    
    清空/var/log/mysql/mysqld.log ,执行mysqladmin -uroot -p1234567 -h127.0.0.1 debug
    
    
    
    Thread database.table_name          Locked/Waiting        Lock_type
    
    3       test.t7                     Locked - read         Read lock without concurrent inserts   ---持有读锁
    4       test.t7                     Waiting - write       Concurrent insert lock                 ---被堵塞

  • 相关阅读:
    数据库使用动态监听导致EM起不来的解决方法
    OCP-1Z0-053-V12.02-115题
    OCP-1Z0-053-V12.02-150题
    OCP-1Z0-053-V12.02-136题
    OCP-1Z0-053-V12.02-154题
    OCP-1Z0-053-V12.02-149题
    OCP-1Z0-053-V12.02-146题
    OCP-1Z0-053-V12.02-160题
    OCP-1Z0-053-V12.02-157题
    OCP-1Z0-053-V12.02-164题
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351538.html
Copyright © 2020-2023  润新知