Commit 59b2bb9a authored by Sergey Petrunya's avatar Sergey Petrunya

Added back MRR counters. The new names are: Handler_mrr_init,

 Handler_mrr_key_refills, Handler_mrr_rowid_refills.
parent c299e027
......@@ -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;
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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},
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment