diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2012-02-22 16:48:29 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2012-02-22 16:48:29 +0400 |
commit | 59b2bb9aca0fb037ab4c770a8fd684a3d4a40587 (patch) | |
tree | 03b80603727eb6ad72737bdbe2d1b1b59fc81739 | |
parent | c299e027eeddc35e0197ebc70805e0a303a4b135 (diff) | |
download | mariadb-git-59b2bb9aca0fb037ab4c770a8fd684a3d4a40587.tar.gz |
Added back MRR counters. The new names are: Handler_mrr_init,
Handler_mrr_key_refills, Handler_mrr_rowid_refills.
-rw-r--r-- | mysql-test/r/myisam_mrr.result | 15 | ||||
-rw-r--r-- | mysql-test/r/status.result | 8 | ||||
-rw-r--r-- | mysql-test/r/status_user.result | 3 | ||||
-rw-r--r-- | sql/multi_range_read.cc | 12 | ||||
-rw-r--r-- | sql/mysqld.cc | 11 | ||||
-rw-r--r-- | sql/sql_class.h | 6 |
6 files changed, 41 insertions, 14 deletions
diff --git a/mysql-test/r/myisam_mrr.result b/mysql-test/r/myisam_mrr.result index c2f382eb9e6..0ea75c8aebb 100644 --- a/mysql-test/r/myisam_mrr.result +++ b/mysql-test/r/myisam_mrr.result @@ -563,6 +563,9 @@ drop table t1; flush status; show status like 'Handler_mrr%'; Variable_name Value +Handler_mrr_init 0 +Handler_mrr_key_refills 0 +Handler_mrr_rowid_refills 0 create table t0 (a int); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t1 (a int, b int, filler char(200), key(a)); @@ -578,6 +581,9 @@ sum(b) 1230 show status like 'handler_mrr%'; Variable_name Value +Handler_mrr_init 1 +Handler_mrr_key_refills 0 +Handler_mrr_rowid_refills 0 set @mrr_buffer_size_save= @@mrr_buffer_size; set mrr_buffer_size=128; explain select sum(b) from t1 where a < 1600; @@ -590,6 +596,9 @@ sum(b) 196800 show status like 'handler_mrr%'; Variable_name Value +Handler_mrr_init 1 +Handler_mrr_key_refills 0 +Handler_mrr_rowid_refills 1 set @@mrr_buffer_size= @mrr_buffer_size_save; #Now, let's check BKA: set @join_cache_level_save= @@join_cache_level; @@ -605,6 +614,9 @@ sum(t1.b) 1230 show status like 'handler_mrr%'; Variable_name Value +Handler_mrr_init 1 +Handler_mrr_key_refills 0 +Handler_mrr_rowid_refills 0 set join_buffer_size=10; explain select sum(t1.b) from t0,t1 where t0.a=t1.a; id select_type table type possible_keys key key_len ref rows Extra @@ -616,6 +628,9 @@ sum(t1.b) 1230 show status like 'handler_mrr%'; Variable_name Value +Handler_mrr_init 1or2 +Handler_mrr_key_refills 1or2 +Handler_mrr_rowid_refills 1or2 set join_cache_level= @join_cache_level_save; set join_buffer_size= @join_buffer_size_save; drop table t0, t1; diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result index b5bae659eed..d3e1d26cbbd 100644 --- a/mysql-test/r/status.result +++ b/mysql-test/r/status.result @@ -277,6 +277,9 @@ Handler_delete 0 Handler_discover 0 Handler_icp_attempts 0 Handler_icp_match 0 +Handler_mrr_init 0 +Handler_mrr_key_refills 0 +Handler_mrr_rowid_refills 0 Handler_prepare 0 Handler_read_first 0 Handler_read_key 4 @@ -299,7 +302,7 @@ Created_tmp_files 0 Created_tmp_tables 2 Handler_tmp_update 2 Handler_tmp_write 7 -Rows_tmp_read 37 +Rows_tmp_read 40 drop table t1; CREATE TABLE t1 (i int(11) DEFAULT NULL, KEY i (i) ) ENGINE=MyISAM; insert into t1 values (1),(2),(3),(4),(5); @@ -314,6 +317,9 @@ Handler_delete 0 Handler_discover 0 Handler_icp_attempts 0 Handler_icp_match 0 +Handler_mrr_init 0 +Handler_mrr_key_refills 0 +Handler_mrr_rowid_refills 0 Handler_prepare 0 Handler_read_first 0 Handler_read_key 2 diff --git a/mysql-test/r/status_user.result b/mysql-test/r/status_user.result index be0cfef79dc..b2d4b6f761f 100644 --- a/mysql-test/r/status_user.result +++ b/mysql-test/r/status_user.result @@ -102,6 +102,9 @@ Handler_delete 1 Handler_discover 0 Handler_icp_attempts 0 Handler_icp_match 0 +Handler_mrr_init 0 +Handler_mrr_key_refills 0 +Handler_mrr_rowid_refills 0 Handler_prepare 18 Handler_read_first 0 Handler_read_key 3 diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index 6ecc64207de..e86c9ca251c 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -510,7 +510,7 @@ int Mrr_ordered_index_reader::refill_buffer(bool initial) { /* This is a non-initial buffer fill and we've got a non-empty buffer */ THD *thd= current_thd; - status_var_increment(thd->status_var.ha_mrr_extra_key_sorts); + status_var_increment(thd->status_var.ha_mrr_key_refills_count); } key_buffer->sort((key_buffer->type() == Lifo_buffer::FORWARD)? @@ -610,7 +610,7 @@ int Mrr_ordered_rndpos_reader::refill_buffer(bool initial) { /* Ok, this was a successful buffer refill operation */ THD *thd= current_thd; - status_var_increment(thd->status_var.ha_mrr_extra_rowid_sorts); + status_var_increment(thd->status_var.ha_mrr_rowid_refills_count); } DBUG_RETURN(res); @@ -845,8 +845,6 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, strategy= disk_strategy= &reader_factory.ordered_rndpos_reader; } - status_var_increment(thd->status_var.ha_multi_range_read_init_count); - full_buf= buf->buffer; full_buf_end= buf->buffer_end; @@ -936,6 +934,12 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, goto error; } } + + /* + At this point, we're sure that we're running a native MRR scan (i.e. we + didnt fall back to default implementation for some reason). + */ + status_var_increment(thd->status_var.ha_mrr_init_count); res= strategy->refill_buffer(TRUE); if (res) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 147c2e80be3..484bfd168c7 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -8101,12 +8101,11 @@ SHOW_VAR status_vars[]= { {"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS}, {"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS}, {"Handler_discover", (char*) offsetof(STATUS_VAR, ha_discover_count), SHOW_LONG_STATUS}, -#if 0 - /* Made 3 counters below temporarily invisible until we agree upon their names */ - {"Handler_mrr_extra_key_sorts", (char*) offsetof(STATUS_VAR, ha_mrr_extra_key_sorts), SHOW_LONG_STATUS}, - {"Handler_mrr_extra_rowid_sorts", (char*) offsetof(STATUS_VAR, ha_mrr_extra_rowid_sorts), SHOW_LONG_STATUS}, - {"Handler_mrr_init", (char*) offsetof(STATUS_VAR, ha_multi_range_read_init_count), SHOW_LONG_STATUS}, -#endif + + {"Handler_mrr_key_refills", (char*) offsetof(STATUS_VAR, ha_mrr_key_refills_count), SHOW_LONG_STATUS}, + {"Handler_mrr_rowid_refills", (char*) offsetof(STATUS_VAR, ha_mrr_rowid_refills_count), SHOW_LONG_STATUS}, + {"Handler_mrr_init", (char*) offsetof(STATUS_VAR, ha_mrr_init_count), SHOW_LONG_STATUS}, + {"Handler_icp_attempts ", (char*) offsetof(STATUS_VAR, ha_icp_attempts), SHOW_LONG_STATUS}, {"Handler_icp_match", (char*) offsetof(STATUS_VAR, ha_icp_match), SHOW_LONG_STATUS}, {"Handler_prepare", (char*) offsetof(STATUS_VAR, ha_prepare_count), SHOW_LONG_STATUS}, diff --git a/sql/sql_class.h b/sql/sql_class.h index 3b94270ae08..c5f500a6b18 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -577,9 +577,9 @@ typedef struct system_status_var calls made by range access. The intent is to count only calls made by BatchedKeyAccess. */ - ulong ha_multi_range_read_init_count; - ulong ha_mrr_extra_key_sorts; - ulong ha_mrr_extra_rowid_sorts; + ulong ha_mrr_init_count; + ulong ha_mrr_key_refills_count; + ulong ha_mrr_rowid_refills_count; ulong ha_rollback_count; ulong ha_update_count; |