zoukankan      html  css  js  c++  java
  • 锁排查--实例

    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                 ---被堵塞

  • 相关阅读:
    4.23上机练习
    4.17java作业
    4.16java作业
    leetcode 189
    leetcode 172
    leetcode 171
    leetcode 169
    win10内网外网智能访问
    leetcode 168
    leetcode 165
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351538.html
Copyright © 2011-2022 走看看