pt-deadlock-logger使用
CREATE TABLE deadlocks (
server char() NOT NULL,
ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
thread int unsigned NOT NULL,
txn_id bigint unsigned NOT NULL,
txn_time smallint unsigned NOT NULL,
user char() NOT NULL,
hostname char() NOT NULL,
ip char() NOT NULL, -- alternatively, ip int unsigned NOT NULL
db char() NOT NULL,
tbl char() NOT NULL,
idx char() NOT NULL,
lock_type char() NOT NULL,
lock_mode char() NOT NULL,
wait_hold char() NOT NULL,
victim tinyint unsigned NOT NULL,
query text NOT NULL,
PRIMARY KEY (server,ts,thread)
) ENGINE=InnoDB;
[root@mxqmongodb2 bin]# ./pt-deadlock-logger h=172.16.16.35,P=,u=root,p= --dest h=172.16.16.35,P=,D=test,t=deadlocks,u=root,p=
server ts thread txn_id txn_time user hostname ip db tbl idx lock_type lock_mode wait_hold victim query
172.16.16.35 --21T14:: root 172.16.16.35 test test idx RECORD X w update test set id1= where id=
172.16.16.35 --21T14:: root 172.16.16.35 test test idx RECORD X w update test set id1= where id=
mysql> show create table test;
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
| test | CREATE TABLE `test` (
`id` int() DEFAULT NULL,
`id1` int() DEFAULT NULL,
KEY `idx` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+------------------------------------------------------------------------------------------------------------------------------------------+
row in set (0.00 sec)
mysql> select * from test;
+------+------+
| id | id1 |
+------+------+
| | |
| | |
| | |
+------+------+
rows in set (0.00 sec)
mysql> begin;
Query OK, rows affected (0.00 sec)
mysql> select id1 from test where id= for update;
+------+
| id1 |
+------+
| |
| |
+------+
rows in set (0.00 sec)
mysql> update test set id1= where id=;
Query OK, row affected (0.00 sec)
Rows matched: Changed: Warnings:
mysql> commit
mysql> begin;
Query OK, rows affected (0.00 sec)
mysql> select id1 from test where id= for update;
+------+
| id1 |
+------+
| |
+------+
row in set (0.00 sec)
mysql> update test set id1= where id=;
ERROR (): Deadlock found when trying to get lock; try restarting transaction
mysql> commit
mysql> select * from deadlocks\G
*************************** . row ***************************
server: 172.16.16.35
ts: -- ::
thread:
txn_id:
txn_time:
user: root
hostname:
ip: 172.16.16.35
db: test
tbl: test
idx: idx
lock_type: RECORD
lock_mode: X
wait_hold: w
victim:
query: update test set id1= where id=
*************************** . row ***************************
server: 172.16.16.35
ts: -- ::
thread:
txn_id:
txn_time:
user: root
hostname:
ip: 172.16.16.35
db: test
tbl: test
idx: idx
lock_type: RECORD
lock_mode: X
wait_hold: w
victim:
query: update test set id1= where id=
rows in set (0.00 sec)
pt-deadlock-logger使用的更多相关文章
- c3p0 APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks
2018-01-04 15:02:03,319 ---com.mchange.v2.async.ThreadPoolAsynchronousRunner: com.mchange.v2.async.T ...
- ABP源码分析八:Logger集成
ABP使用Castle日志记录工具,并且可以使用不同的日志类库,比如:Log4Net, NLog, Serilog... 等等.对于所有的日志类库,Castle提供了一个通用的接口来实现,我们可以很方 ...
- org.apache.log4j.Logger详解
org.apache.log4j.Logger 详解 1. 概述 1.1. 背景 在应用程序中添加日志记录总的来说基于三个目的 :监视代码中变量的变化情况,周期性的记录到文件中供其他应用进行统计分析工 ...
- Java程序日志:java.util.logging.Logger类
一.Logger 的级别 比log4j的级别详细,全部定义在java.util.logging.Level里面.各级别按降序排列如下:SEVERE(最高值)WARNINGINFOCONFIGFINEF ...
- [LeetCode] Logger Rate Limiter 记录速率限制器
Design a logger system that receive stream of messages along with its timestamps, each message shoul ...
- .Net Core Logger 实现log写入本地文件系统
.net core 自带一个基础的logger框架Microsoft.Extensions.Logging. 微软默认实现了Microsoft.Extensions.Logging.Console.d ...
- Android源码——Logger日志系统
Android的Logger日志系统是基于内核中的Logger日志驱动程序实现的. 日志保存在内核空间中 缓冲区保存日志 分类方法:日志的类型 + 日志的输出量 日志类型: main ...
- java.lang.NoClassDefFoundError: Lorg/slf4j/Logger;
如果你出现类似如下错误 1. Install tomcat7 in my home directory and set up `CATALINA_HOME` environment variable ...
- PX 和PT的区别
字体大小的设置单位,常用的有2种:px.pt.这两个有什么区别呢? 先搞清基本概念:px就是表示pixel,像素,是屏幕上显示数据的最基本的点: pt就是point,是印刷行业常用单位,等于1/72英 ...
- LeetCode 359 Logger Rate Limiter
Problem: Design a logger system that receive stream of messages along with its timestamps, each mess ...
随机推荐
- php 图片上传 并返回上传文件位置 支持多文件上传
<?php /** * Created by PhpStorm. * User: DY040 * Date: 2018/4/26 * Time: 13:23 */ echo '<pre&g ...
- 更新Mac双系统多分区
前言制作Mac USB系统安装盘安装Mac OS 10.12制作win10 USB系统安装盘安装win10windows多分区实现 前言 同事有一台mac pro,系统是mac os 10.9+win ...
- 高效的JS数组操作
1.向数组的末尾添加元素 var arr=[1,2,3]; arr[arr.length]=1; 2.向数组的头部添加元素 var arr=[1,2,3]; [0].concat(arr); 3.向数 ...
- OC SEL (@selector) 原理及使用总结(转)
SEL 类成员方法的指针 可以理解 @selector()就是取类方法的编号,他的行为基本可以等同C语言的中函数指针,只不过C语言中,可以把函数名直接赋给一个函数指针,而Object-C的类不能直接应 ...
- vue-cli 基础搭建
1.安装node 2.npm install webpack -g 3.npm install vue-cli -g 4.然后进入到文件下边 vue init webpack 文件名字 5.进入工程文 ...
- [转]OLAP的12条准则
OLAP的12条准则 Multidimensional conceptual view OLAP模型必须提供多维概念视图 User-analysts would view an enterprise ...
- [转]MSBuild Target Framework and Target Platform
本文转自;https://msdn.microsoft.com/en-us/library/hh264221.aspx A project can be built to run on a targe ...
- git记住提交密码的技巧
修改.git包里面的config文件,添加 [credential] helper = store
- 嵌套Golang对象的初始化
比如有这样一个对象: type ProductConfig struct { Site map[string]string } 对应的初始化可以如下写: var pc ProductCon ...
- Java基础 深拷贝浅拷贝
Java基础 深拷贝浅拷贝 非基本数据类型 需要new新空间 class Student implements Cloneable{ private int id; private String na ...