ss_get_mysql_stats.php converts 5.6 transaction and purged value from hexadecimal to decimal but these values are in decimal to begin with

Bug #1512946 reported by Jaime Sicam
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Monitoring Plugins
Fix Released
Medium
Roman Vynar

Bug Description

SHOW ENGINE INNODB STATUS on 5.5:
------------
TRANSACTIONS
------------
Trx id counter 69D8E
Purge done for trx's n:o < 69D8E undo n:o < 0

SHOW ENGINE INNODB STATUS on 5.6
------------
TRANSACTIONS
------------
Trx id counter 508056
Purge done for trx's n:o < 508056 undo n:o < 0 state: running but idle

Code:
      # TRANSACTIONS
      elseif ( strpos($line, 'Trx id counter') === 0 ) {
         # The beginning of the TRANSACTIONS section: start counting
         # transactions
         # Trx id counter 0 1170664159
         # Trx id counter 861B144C
         $results['innodb_transactions'] = make_bigint(
            $row[3], (isset($row[4]) ? $row[4] : null));
         $txn_seen = TRUE;
      }
      elseif ( strpos($line, 'Purge done for trx') === 0 ) {
         # Purge done for trx's n:o < 0 1170663853 undo n:o < 0 0
         # Purge done for trx's n:o < 861B135D undo n:o < 0
         $purged_to = make_bigint($row[6], $row[7] == 'undo' ? null : $row[7]);
         $results['unpurged_txns']
            = big_sub($results['innodb_transactions'], $purged_to);
      }

Modified to debug:
      # TRANSACTIONS
      elseif ( strpos($line, 'Trx id counter') === 0 ) {
         # The beginning of the TRANSACTIONS section: start counting
         # transactions
         # Trx id counter 0 1170664159
         # Trx id counter 861B144C
         $results['innodb_transactions'] = make_bigint(
            $row[3], (isset($row[4]) ? $row[4] : null));
         echo ("Row 3: ".strval($row[3])."\n");
         echo ("Transaction No: ". make_bigint($row[3], (isset($row[4]) ? $row[4] : null)) ."\n" );
         $txn_seen = TRUE;
      }
      elseif ( strpos($line, 'Purge done for trx') === 0 ) {
         # Purge done for trx's n:o < 0 1170663853 undo n:o < 0 0
         # Purge done for trx's n:o < 861B135D undo n:o < 0
         $purged_to = make_bigint($row[6], $row[7] == 'undo' ? null : $row[7]);
         echo ("Purged to: ". $purged_to ."\n" );
         $results['unpurged_txns']
            = big_sub($results['innodb_transactions'], $purged_to);
      }

Test:
php ss_get_mysql_stats.php --host 192.168.0.13 --items innodb_transactions --user cacti --pass cacti --port 5546
Row 3: 69D8E
Transaction No: 433550
Purged to: 433550

php ss_get_mysql_stats.php --host 192.168.0.13 --items innodb_transactions --user cacti --pass cacti --port 5626
Row 3: 508056
Transaction No: 5275734
Purged to: 5275734

So, the second output of ss_get_mysql_stats.php: Transaction No and Purged To should be 508056 and not 5275734

select conv('508056',16,10);
+----------------------+
| conv('508056',16,10) |
+----------------------+
| 5275734 |
+----------------------+
1 row in set (0.00 sec)

Tags: i61665
Jaime Sicam (jssicam)
tags: added: i61665
Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote :

Verified.

With 5.5

------------
TRANSACTIONS
------------
Trx id counter E56834
Purge done for trx's n:o < E56833 undo n:o < 0
History list length 1729
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0, not started
MySQL thread id 9, OS thread handle 0x7ffff4184700, query id 133 localhost root
show engine innodb status

nilnandan.joshi@bm-support01:~/percona-monitoring-plugins-1.1.5/cacti/scripts$ php ss_get_mysql_stats.php --host 127.0.0.1 --user root --pass msandbox --port 5545 --items innodb_transactions --nocache
Row 3: E56834
Transaction No: 15034420
Purged to: 15034419

With 5.6

------------
TRANSACTIONS
------------
Trx id counter 230598
Purge done for trx's n:o < 230598 undo n:o < 0 state: running but idle
History list length 663
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0, not started
MySQL thread id 35, OS thread handle 0x7ffdbc0c7700, query id 800057 localhost root init
show engine innodb status

nilnandan.joshi@bm-support01:~/percona-monitoring-plugins-1.1.5/cacti/scripts$ php ss_get_mysql_stats.php --host 127.0.0.1 --user root --pass msandbox --port 5625 --items innodb_transactions --nocache
Row 3: 230598
Transaction No: 2295192
Purged to: 2295192

mysql> select conv('230598',16,10);
+----------------------+
| conv('230598',16,10) |
+----------------------+
| 2295192 |
+----------------------+
1 row in set (0.08 sec)

mysql>

Changed in percona-monitoring-plugins:
status: New → Confirmed
Changed in percona-monitoring-plugins:
status: Confirmed → In Progress
importance: Undecided → Medium
assignee: nobody → Roman Vynar (roman-vynar)
Changed in percona-monitoring-plugins:
status: In Progress → Fix Committed
Revision history for this message
Roman Vynar (roman-vynar) wrote :
Changed in percona-monitoring-plugins:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.