diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 5f8c59b9a0c..7806262f052 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -3295,3 +3295,11 @@ info: Records: 5 Duplicates: 0 Warnings: 0 TRUNCATE TABLE t1; affected rows: 0 DROP TABLE t1; +Variable_name Value +Handler_update 0 +Variable_name Value +Handler_delete 0 +Variable_name Value +Handler_update 1 +Variable_name Value +Handler_delete 1 diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 339be87419a..eaff5867dc3 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -2475,6 +2475,7 @@ SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; DROP TABLE t2; DROP TABLE t1; # End 34920 test +# # Bug #29507 TRUNCATE shows to many rows effected # CONNECTION default; @@ -2491,6 +2492,36 @@ TRUNCATE TABLE t1; --disable_info DROP TABLE t1; # +# Bug#35537 Innodb doesn't increment handler_update and handler_delete. +# +-- disable_query_log +-- disable_result_log + +CONNECT (c1,localhost,root,,); + +DROP TABLE IF EXISTS bug35537; +CREATE TABLE bug35537 ( + c1 int +) ENGINE=InnoDB; + +INSERT INTO bug35537 VALUES (1); + +-- enable_result_log + +SHOW SESSION STATUS LIKE 'Handler_update%'; +SHOW SESSION STATUS LIKE 'Handler_delete%'; + +UPDATE bug35537 SET c1 = 2 WHERE c1 = 1; +DELETE FROM bug35537 WHERE c1 = 2; + +SHOW SESSION STATUS LIKE 'Handler_update%'; +SHOW SESSION STATUS LIKE 'Handler_delete%'; + +DROP TABLE bug35537; + +DISCONNECT c1; +CONNECTION default; + ####################################################################### # # # Please, DO NOT TOUCH this file as well as the innodb.result file. # diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 887acacbd1f..cd2b121cbf4 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3755,6 +3755,8 @@ ha_innobase::update_row( ut_a(prebuilt->trx == trx); + ha_statistic_increment(&SSV::ha_update_count); + if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) table->timestamp_field->set_time(); @@ -3844,6 +3846,8 @@ ha_innobase::delete_row( ut_a(prebuilt->trx == trx); + ha_statistic_increment(&SSV::ha_delete_count); + /* Only if the table has an AUTOINC column */ if (table->found_next_number_field && record == table->record[0]) { ulonglong dummy = 0; diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 6ff135e4f5a..c6a93d4e0d5 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -3577,9 +3577,9 @@ shortcut_fails_too_big_rec: if (trx->isolation_level <= TRX_ISO_READ_COMMITTED && prebuilt->select_lock_type != LOCK_NONE + && trx->mysql_thd != NULL && trx->mysql_query_str != NULL - && *trx->mysql_query_str != NULL - && trx->mysql_thd != NULL) { + && *trx->mysql_query_str != NULL) { /* Scan the MySQL query string; check if SELECT is the first word there */