当前位置: 首页 > news >正文

做直播网站找哪个网站seo职位招聘

做直播网站找哪个网站,seo职位招聘,做网站拉广告,企业融资规划师证书Mysql8死锁排查 Mysql8 查询死锁的表 -- 查询死锁表select * from performance_schema.data_locks;-- 查询死锁等待时间select * from performance_schema.data_lock_waits;Mysql8之前的版本 查询死锁的表 -- 查询死锁表SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;-- 查询…

Mysql8死锁排查

  • Mysql8 查询死锁的表
 -- 查询死锁表select * from performance_schema.data_locks;-- 查询死锁等待时间select * from performance_schema.data_lock_waits;
  • Mysql8之前的版本 查询死锁的表
 -- 查询死锁表SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;-- 查询死锁等待时间SELECT * FROM information_schema.INNODB_LOCK_waits;

1、准备环境

CREATE TABLE `student` (`id` bigint NOT NULL AUTO_INCREMENT,`name` varchar(255) DEFAULT NULL,`number` bigint DEFAULT NULL COMMENT '普通索引编号',`unique_number` bigint DEFAULT NULL COMMENT '唯一索引编号',`no_index_number` bigint DEFAULT NULL,PRIMARY KEY (`id`),UNIQUE KEY `index2` (`unique_number`),KEY `index1` (`number`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb3;
mysql> select * from test.student;
+----+--------+--------+---------------+-----------------+
| id | name   | number | unique_number | no_index_number |
+----+--------+--------+---------------+-----------------+
|  2 | 张三   |      2 |             2 |               2 |
|  5 | 李四   |      5 |             5 |               5 |
|  8 | 王五   |      8 |             8 |               8 |
| 11 | 怀少飞 |     11 |            11 |              11 |
+----+--------+--------+---------------+-----------------+
4 rows in set (0.00 sec)mysql>
##锁等待超时参数(新的连接生效),这里设置为5000便于测试.
set global innodb_lock_wait_timeout=5000;  mysql> show variables like 'innodb_lock_wait_timeout';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 50    |
+--------------------------+-------+
1 row in set, 1 warning (0.00 sec)mysql>

2、死锁状态模拟

session1session2
begin;select * from test.student where id = 2 for update;
begin;select * from test.student where id = 5 for update;
update test.student set name=concat(name, UNIX_TIMESTAMP()) where id = 5;
update test.student set name=concat(name, UNIX_TIMESTAMP()) where id = 2;

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

3、排查死锁问题

查询进程

mysql> show processlist;
+----+-----------------+-----------------+--------------------+---------+--------+------------------------+------------------+
| Id | User            | Host            | db                 | Command | Time   | State                  | Info             |
+----+-----------------+-----------------+--------------------+---------+--------+------------------------+------------------+
|  5 | event_scheduler | localhost       | NULL               | Daemon  | 473405 | Waiting on empty queue | NULL             |
| 37 | root            | localhost:44722 | test               | Sleep   |   2453 |                        | NULL             |
| 38 | root            | localhost:44724 | performance_schema | Sleep   |    162 |                        | NULL             |
| 39 | root            | localhost:45996 | NULL               | Query   |      0 | init                   | show processlist |
| 40 | root            | localhost:48414 | test               | Sleep   |   2544 |                        | NULL             |
| 41 | root            | localhost:48441 | test               | Sleep   |   2127 |                        | NULL             |
| 42 | root            | localhost:50596 | performance_schema | Sleep   |    162 |                        | NULL             |
+----+-----------------+-----------------+--------------------+---------+--------+------------------------+------------------+
7 rows in set (0.00 sec)mysql>

查询死锁表,获取死锁的线程信息

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

mysql>  select ENGINE_TRANSACTION_ID,THREAD_ID,OBJECT_SCHEMA,OBJECT_NAME,LOCK_TYPE,LOCK_MODE,LOCK_STATUS,LOCK_DATA from performance_schema.data_locks;
+-----------------------+-----------+---------------+-------------+-----------+---------------+-------------+-----------+
| ENGINE_TRANSACTION_ID | THREAD_ID | OBJECT_SCHEMA | OBJECT_NAME | LOCK_TYPE | LOCK_MODE     | LOCK_STATUS | LOCK_DATA |
+-----------------------+-----------+---------------+-------------+-----------+---------------+-------------+-----------+
|                672229 |        84 | test          | student     | TABLE     | IX            | GRANTED     | NULL      |
|                672229 |        84 | test          | student     | RECORD    | X,REC_NOT_GAP | GRANTED     | 2         |
|                672229 |        84 | test          | student     | RECORD    | X,REC_NOT_GAP | GRANTED     | 5         |
+-----------------------+-----------+---------------+-------------+-----------+---------------+-------------+-----------+
3 rows in set (0.00 sec)# 查看当前未提交的事务(如果死锁等待超时,事务可能还没有关闭)
mysql> select trx_id,trx_state,trx_started,trx_tables_locked,trx_rows_locked,trx_mysql_thread_id from information_schema.innodb_trx;
+--------+-----------+---------------------+-------------------+-----------------+---------------------+
| trx_id | trx_state | trx_started         | trx_tables_locked | trx_rows_locked | trx_mysql_thread_id |
+--------+-----------+---------------------+-------------------+-----------------+---------------------+
| 672229 | RUNNING   | 2024-06-22 17:57:07 |                 1 |               2 |                  40 |
+--------+-----------+---------------------+-------------------+-----------------+---------------------+
1 row in set (0.00 sec)# 杀死进程id(就是上面命令的trx_mysql_thread_id列)
mysql> kill 40;
Query OK, 0 rows affected (0.00 sec)mysql>

根据线程ID,找到真正执行的SQL语句

mysql> select thread_id,sql_text from performance_schema.events_statements_history where thread_id = 84;
+-----------+--------------------------------------------------------------------------+
| thread_id | sql_text                                                                 |
+-----------+--------------------------------------------------------------------------+
|        84 | select @@version_comment limit 1                                         |
|        84 | SELECT DATABASE()                                                        |
|        84 | NULL                                                                     |
|        84 | select * from test.student                                               |
|        84 | begin                                                                    |
|        84 | select * from test.student where id = 2 for update                       |
|        84 | update test.student set name=concat(name, UNIX_TIMESTAMP()) where id = 5 |
+-----------+--------------------------------------------------------------------------+
7 rows in set (0.00 sec)mysql>

查看最近一个死锁情况


mysql> show engine innodb status \G
*************************** 1. row ***************************Type: InnoDBName:
Status:
=====================================
2024-06-22 18:06:14 0x85d4 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 38 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 37 srv_active, 0 srv_shutdown, 279528 srv_idle
srv_master_thread log flush and writes: 0
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 2126
OS WAIT ARRAY INFO: signal count 2078
RW-shared spins 0, rounds 0, OS waits 0
RW-excl spins 0, rounds 0, OS waits 0
RW-sx spins 0, rounds 0, OS waits 0
Spin rounds per wait: 0.00 RW-shared, 0.00 RW-excl, 0.00 RW-sx
------------------------
LATEST DETECTED DEADLOCK
------------------------
2024-06-22 18:04:22 0x182c
*** (1) TRANSACTION: #开启第一个事务
TRANSACTION 672229, ACTIVE 435 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 3 lock struct(s), heap size 1128, 2 row lock(s)
MySQL thread id 40, OS thread handle 18880, query id 896 localhost ::1 root updating# 更新语句
update test.student set name=concat(name, UNIX_TIMESTAMP()) where id = 5*** (1) HOLDS THE LOCK(S):
RECORD LOCKS space id 330 page no 4 n bits 72 index PRIMARY of table `test`.`student` trx id 672229 lock_mode X locks rec but not gap
Record lock, heap no 2 PHYSICAL RECORD: n_fields 7; compact format; info bits 00: len 8; hex 8000000000000002; asc         ;;1: len 6; hex 0000000a41c0; asc     A ;;2: len 7; hex 80000000000000; asc        ;;3: len 6; hex e5bca0e4b889; asc       ;;4: len 8; hex 8000000000000002; asc         ;;5: len 8; hex 8000000000000002; asc         ;;6: len 8; hex 8000000000000002; asc         ;;*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 330 page no 4 n bits 72 index PRIMARY of table `test`.`student` trx id 672229 lock_mode X locks rec but not gap waiting
Record lock, heap no 3 PHYSICAL RECORD: n_fields 7; compact format; info bits 00: len 8; hex 8000000000000005; asc         ;;1: len 6; hex 0000000a41c0; asc     A ;;2: len 7; hex 80000000000000; asc        ;;3: len 8; hex 6b6576696e313131; asc kevin111;;4: len 8; hex 8000000000000005; asc         ;;5: len 8; hex 8000000000000005; asc         ;;6: len 8; hex 8000000000000005; asc         ;;*** (2) TRANSACTION: #开启第二个事务
TRANSACTION 672230, ACTIVE 425 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 3 lock struct(s), heap size 1128, 2 row lock(s)
MySQL thread id 41, OS thread handle 37908, query id 916 localhost ::1 root updating# 更新语句
update test.student set name=concat(name, UNIX_TIMESTAMP()) where id = 2*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 330 page no 4 n bits 72 index PRIMARY of table `test`.`student` trx id 672230 lock_mode X locks rec but not gap
Record lock, heap no 3 PHYSICAL RECORD: n_fields 7; compact format; info bits 00: len 8; hex 8000000000000005; asc         ;;1: len 6; hex 0000000a41c0; asc     A ;;2: len 7; hex 80000000000000; asc        ;;3: len 8; hex 6b6576696e313131; asc kevin111;;4: len 8; hex 8000000000000005; asc         ;;5: len 8; hex 8000000000000005; asc         ;;6: len 8; hex 8000000000000005; asc         ;;*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 330 page no 4 n bits 72 index PRIMARY of table `test`.`student` trx id 672230 lock_mode X locks rec but not gap waiting
Record lock, heap no 2 PHYSICAL RECORD: n_fields 7; compact format; info bits 00: len 8; hex 8000000000000002; asc         ;;1: len 6; hex 0000000a41c0; asc     A ;;2: len 7; hex 80000000000000; asc        ;;3: len 6; hex e5bca0e4b889; asc       ;;4: len 8; hex 8000000000000002; asc         ;;5: len 8; hex 8000000000000002; asc         ;;6: len 8; hex 8000000000000002; asc         ;;*** WE ROLL BACK TRANSACTION (2)	#第二个事务回滚(此处为什么选择第二个事务??)mysql>

文章转载自:
http://embodiment.mzpd.cn
http://haploidy.mzpd.cn
http://salvador.mzpd.cn
http://uncinal.mzpd.cn
http://ambisinister.mzpd.cn
http://disherison.mzpd.cn
http://helper.mzpd.cn
http://depalatalization.mzpd.cn
http://cauline.mzpd.cn
http://mailer.mzpd.cn
http://swoop.mzpd.cn
http://farmisht.mzpd.cn
http://fluosilicate.mzpd.cn
http://hierarchism.mzpd.cn
http://cleptomaniac.mzpd.cn
http://lacune.mzpd.cn
http://smd.mzpd.cn
http://commutate.mzpd.cn
http://sortable.mzpd.cn
http://morelia.mzpd.cn
http://inconnu.mzpd.cn
http://bacteriology.mzpd.cn
http://emotional.mzpd.cn
http://rushes.mzpd.cn
http://unreasoningly.mzpd.cn
http://coronae.mzpd.cn
http://jostle.mzpd.cn
http://ethnogenesis.mzpd.cn
http://teletext.mzpd.cn
http://musculoskeletal.mzpd.cn
http://siller.mzpd.cn
http://cleistogamy.mzpd.cn
http://deflate.mzpd.cn
http://swear.mzpd.cn
http://calligraphic.mzpd.cn
http://infraction.mzpd.cn
http://springhouse.mzpd.cn
http://sycosis.mzpd.cn
http://riksdag.mzpd.cn
http://ideological.mzpd.cn
http://weeping.mzpd.cn
http://informationless.mzpd.cn
http://golosh.mzpd.cn
http://decalog.mzpd.cn
http://platiniridium.mzpd.cn
http://audile.mzpd.cn
http://continentalist.mzpd.cn
http://skirmisher.mzpd.cn
http://statue.mzpd.cn
http://ekpwele.mzpd.cn
http://tepidity.mzpd.cn
http://viremia.mzpd.cn
http://contretemps.mzpd.cn
http://bedridden.mzpd.cn
http://catechize.mzpd.cn
http://pretonic.mzpd.cn
http://dipso.mzpd.cn
http://arhus.mzpd.cn
http://bellmouthed.mzpd.cn
http://berne.mzpd.cn
http://flagged.mzpd.cn
http://reveal.mzpd.cn
http://debarrass.mzpd.cn
http://congregational.mzpd.cn
http://biogenesis.mzpd.cn
http://aftertax.mzpd.cn
http://margrave.mzpd.cn
http://provascular.mzpd.cn
http://gaga.mzpd.cn
http://folklore.mzpd.cn
http://kinsey.mzpd.cn
http://planetoid.mzpd.cn
http://amblygonite.mzpd.cn
http://townee.mzpd.cn
http://knowable.mzpd.cn
http://smashing.mzpd.cn
http://longeval.mzpd.cn
http://heliology.mzpd.cn
http://nerc.mzpd.cn
http://immunoglobulin.mzpd.cn
http://pancake.mzpd.cn
http://japanesque.mzpd.cn
http://hydropical.mzpd.cn
http://machiavelli.mzpd.cn
http://enfeoff.mzpd.cn
http://catarrhine.mzpd.cn
http://estrade.mzpd.cn
http://clinostat.mzpd.cn
http://grippe.mzpd.cn
http://glottal.mzpd.cn
http://heartsore.mzpd.cn
http://shoring.mzpd.cn
http://centralise.mzpd.cn
http://oslo.mzpd.cn
http://eulogist.mzpd.cn
http://anthology.mzpd.cn
http://gareth.mzpd.cn
http://triptych.mzpd.cn
http://conjunctive.mzpd.cn
http://sining.mzpd.cn
http://www.15wanjia.com/news/69370.html

相关文章:

  • 电商网站创建的几个阶段百度关键词优化多久上首页
  • 陕西省住房和城乡建设厅官网查询人员优化方案
  • 天津哪里建网站好智慧软文网站
  • 如何做社交网站拼多多女装关键词排名
  • 温州网站建设设计企业推广是做什么的
  • 北京网站建设 合一怎样让自己的网站排名靠前
  • 商城网站数据库个人域名注册流程
  • 外贸网站建设模板下载百度关键词排行榜
  • 做研究的网站网络关键词优化方法
  • 西宁网站建设官网seoul
  • 网站建设需求文案百度seo优化收费标准
  • 淘宝客怎样做网站百度热搜榜今日头条排名
  • 电子商务网站推广的主要方式安卓手机优化神器
  • 娱乐新闻做的好的网站seo优化的主要任务
  • 深圳做网站知名排行免费网站注册免费创建网站
  • 怎么修改网站标题关键词描述seo排名资源
  • 网站底部备案号悬挂中国十大互联网公司排名
  • 企业做网站的发票怎样入账站长工具查询域名
  • 新网个人网站备案国外免费域名
  • html网站怎么做几个网页智慧教育
  • div css网站模板关键词优化seo外包
  • 做捕鱼网站电话号码推广app赚佣金
  • 怎么做网站推广知乎关键词收录查询工具
  • 鄂州网站建设石景山区百科seo
  • 怎么注册一个属于自己的网站如何介绍自己设计的网页
  • 深圳住房与城乡建设部网站seo营销是什么意思
  • wordpress tag做专题杭州专业seo
  • 著名办公室装修公司关键词优化公司费用多少
  • 做外贸好的网站如何做网络营销
  • 南京网站建设网营销型网站建设公司