| Bug #35537 | Innodb doesn't increment handler_update and handler_delete | ||
|---|---|---|---|
| Submitted: | 24 Mar 22:44 | Modified: | 25 Jun 3:47 |
| Reporter: | Eric Bergen | ||
| Status: | Need Doc Info | ||
| Category: | Server: InnoDB | Severity: | S3 (Non-critical) |
| Version: | 4.1, 5.0, 5.1, 6.0 | OS: | Any |
| Assigned to: | Tim Smith | Target Version: | 5.0+ |
| Tags: | Contribution, handler_update, handler_delete, v6 | ||
| Triage: | D3 (Medium) | ||
[24 Mar 23:40]
Sveta Smirnova
Thank you for the report. Verified as described. You can relay on Handler_commit value though.
[25 Mar 17:29]
Heikki Tuuri
Calvin, please fix this in 5.1 and 6.0. --Heikki
[14 Apr 19:41]
Eric Bergen
Taso Du Val wants me to note that he actually found the bug. I just fixed it. :)
[25 Apr 21:26]
Calvin Sun
Pushed into InnoDB 5.1 repository.
[14 May 17:21]
Bugs System
Pushed into 5.1.25-rc
[15 May 3:19]
Paul DuBois
Noted in 5.1.25 changelog. InnoDB was not updating the Handler_delete or Handler_update status variables. Setting report to Patch queued pending push into 6.0.x.
[15 May 17:53]
Paul DuBois
Setting report to Need Doc Info pending push into 6.0.x.
[19 May 22:18]
Paul DuBois
Setting report to Patch queued pending re-push of this patch.
[22 May 11:50]
Bugs System
Pushed into 6.0.6-alpha
[27 May 20:33]
Paul DuBois
The push into 5.1 was reverted, so there is no 5.1.x changelog entry.
[27 May 20:39]
Paul DuBois
The push into 6.0.x was a null merge that changed nothing. Resetting report to Patch Approved pending further push of patch into 6.0.x. The "parent" report for this set of bugs is Bug#32440.
[24 Jun 23:49]
Calvin Sun
Merged into 6.0.6-alpha, according to Tim. But the patch has not been pushed into 5.1 yet.
[25 Jun 3:47]
Paul DuBois
Noted in 6.0.6 changelog. Setting report to Need Doc Info pending push into 5.1.x.

Description: In ha_innodb.cc delete_row and update_row methods don't update handler statistics like myisam and other storage engines do. This patch is a quick fix. I would rather see the statistics management moved above the storage engine layer so this doesn't happen with other engines in the future. How to repeat: mysql> create table t (t int) engine=innodb; Query OK, 0 rows affected (0.00 sec) mysql> insert into t set t=1; Query OK, 1 row affected (0.00 sec) mysql> show status like 'handler%'; +----------------------------+-------+ | Variable_name | Value | +----------------------------+-------+ | Handler_commit | 10 | | Handler_delete | 0 | | Handler_discover | 0 | | Handler_prepare | 10 | | Handler_read_first | 2 | | Handler_read_key | 4 | | Handler_read_next | 0 | | Handler_read_prev | 0 | | Handler_read_rnd | 0 | | Handler_read_rnd_next | 62 | | Handler_rollback | 0 | | Handler_savepoint | 0 | | Handler_savepoint_rollback | 0 | | Handler_update | 0 | | Handler_write | 67 | +----------------------------+-------+ 15 rows in set (0.00 sec) mysql> delete from t where t = 1; Query OK, 1 row affected (0.00 sec) mysql> show status like 'handler%'; +----------------------------+-------+ | Variable_name | Value | +----------------------------+-------+ | Handler_commit | 12 | | Handler_delete | 0 | | Handler_discover | 0 | | Handler_prepare | 12 | | Handler_read_first | 3 | | Handler_read_key | 6 | | Handler_read_next | 0 | | Handler_read_prev | 0 | | Handler_read_rnd | 0 | | Handler_read_rnd_next | 80 | | Handler_rollback | 0 | | Handler_savepoint | 0 | | Handler_savepoint_rollback | 0 | | Handler_update | 0 | | Handler_write | 82 | +----------------------------+-------+ 15 rows in set (0.00 sec) Suggested fix: diff -urN mysql-5.0.51a-orig/sql/ha_innodb.cc mysql-5.0.51a/sql/ha_innodb.cc --- mysql-5.0.51a-orig/sql/ha_innodb.cc 2008-01-11 06:43:39.000000000 -0800 +++ mysql-5.0.51a/sql/ha_innodb.cc 2008-03-24 14:29:46.000000000 -0700 @@ -3495,6 +3495,9 @@ int error = 0; DBUG_ENTER("ha_innobase::update_row"); + + statistic_increment(current_thd->status_var.ha_update_count, + &LOCK_status); ut_ad(prebuilt->trx == (trx_t*) current_thd->ha_data[innobase_hton.slot]); @@ -3578,6 +3581,9 @@ DBUG_ENTER("ha_innobase::delete_row"); + statistic_increment(current_thd->status_var.ha_delete_count, + &LOCK_status); + ut_ad(prebuilt->trx == (trx_t*) current_thd->ha_data[innobase_hton.slot]);