LP #1082104: pt-deadlock-logger doesn't handle usernames with dashes

Description

**Reported in Launchpad by Martin Arrieta last update 14-01-2013 22:18:09

When you create a deadlock with a user that have a dash in the name, pt-deadlock-logger will not store the user name and will store the host name in the user field instead.

pt-deadlock-logger version 2.1.7

Deadlock example:

  1.  

    1.  

      1.  

        1.  

          1. With a user name with a dash in the name (mar-tin) #####
            ------------------------
            LATEST DETECTED DEADLOCK
            ------------------------
            121119 18:56:52

      • (1) TRANSACTION:
        TRANSACTION 5CD, ACTIVE 10 sec, process no 9490, OS thread id 139862860961536 starting index read
        mysql tables in use 1, locked 1
        LOCK WAIT 6 lock struct(s), heap size 1248, 3 row lock(s), undo log entries 1
        MySQL thread id 26, query id 5024 localhost mar-tin Updating
        UPDATE parent SET age=age+1 WHERE id=1

      • (1) WAITING FOR THIS LOCK TO BE GRANTED:
        RECORD LOCKS space id 0 page no 4624 n bits 72 index `PRIMARY` of table `employees`.`parent` trx id 5CD lock_mode X locks rec but not gap waiting

      • (2) TRANSACTION:
        TRANSACTION 5CC, ACTIVE 23 sec, process no 9490, OS thread id 139862861227776 starting index read
        mysql tables in use 1, locked 1
        7 lock struct(s), heap size 1248, 4 row lock(s), undo log entries 2
        MySQL thread id 38, query id 5043 localhost mar-tin Updating
        UPDATE parent SET age=age+1 WHERE id=2

      • (2) HOLDS THE LOCK(S):
        RECORD LOCKS space id 0 page no 4624 n bits 72 index `PRIMARY` of table `employees`.`parent` trx id 5CC lock_mode X locks rec but not gap

      • (2) WAITING FOR THIS LOCK TO BE GRANTED:
        RECORD LOCKS space id 0 page no 4624 n bits 72 index `PRIMARY` of table `employees`.`parent` trx id 5CC lock_mode X locks rec but not gap waiting

      • WE ROLL BACK TRANSACTION (1)

> select * from deadlocks\G

*************************** 1. row ***************************
server: Localhost
ts: 2012-11-19 18:56:52
thread: 26
txn_id: 0
txn_time: 10
user: localhost
hostname:
ip:
db: employees
tbl: parent
idx: PRIMARY
lock_type: RECORD
lock_mode: X
wait_hold: w
victim: 1
query: UPDATE parent SET age=age+1 WHERE id=1
*************************** 2. row ***************************
server: Localhost
ts: 2012-11-19 18:56:52
thread: 38
txn_id: 0
txn_time: 23
user: localhost <------ Here is the error.
hostname:
ip:
db: employees
tbl: parent
idx: PRIMARY
lock_type: RECORD
lock_mode: X
wait_hold: w
victim: 0
query: UPDATE parent SET age=age+1 WHERE id=2

Thanks!

Martin Arrieta
@martinarrietac

Environment

None

Smart Checklist

Activity

Done

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 24, 2018 at 5:23 PM
Updated January 24, 2018 at 5:24 PM
Resolved January 24, 2018 at 5:24 PM

Flag notifications