mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
accrue statistics to correct handler
This commit is contained in:
committed by
Sergei Petrunia
parent
0940a96940
commit
a11a10191a
@@ -6995,6 +6995,7 @@ extern "C" check_result_t handler_index_cond_check(void* h_arg)
|
|||||||
check_result_t res;
|
check_result_t res;
|
||||||
|
|
||||||
DEBUG_SYNC(thd, "handler_index_cond_check");
|
DEBUG_SYNC(thd, "handler_index_cond_check");
|
||||||
|
DBUG_ASSERT(h->handler_stats);
|
||||||
|
|
||||||
enum thd_kill_levels killed= thd_kill_level(thd);
|
enum thd_kill_levels killed= thd_kill_level(thd);
|
||||||
if (unlikely(killed != THD_IS_NOT_KILLED))
|
if (unlikely(killed != THD_IS_NOT_KILLED))
|
||||||
@@ -7008,13 +7009,13 @@ extern "C" check_result_t handler_index_cond_check(void* h_arg)
|
|||||||
if (unlikely(h->end_range) && h->compare_key2(h->end_range) > 0)
|
if (unlikely(h->end_range) && h->compare_key2(h->end_range) > 0)
|
||||||
return CHECK_OUT_OF_RANGE;
|
return CHECK_OUT_OF_RANGE;
|
||||||
h->increment_statistics(&SSV::ha_icp_attempts);
|
h->increment_statistics(&SSV::ha_icp_attempts);
|
||||||
h->active_handler_stats.icp_attempts++;
|
h->handler_stats->icp_attempts++;
|
||||||
res= CHECK_NEG;
|
res= CHECK_NEG;
|
||||||
if (h->pushed_idx_cond->val_int())
|
if (h->pushed_idx_cond->val_int())
|
||||||
{
|
{
|
||||||
res= CHECK_POS;
|
res= CHECK_POS;
|
||||||
h->fast_increment_statistics(&SSV::ha_icp_match);
|
h->fast_increment_statistics(&SSV::ha_icp_match);
|
||||||
h->active_handler_stats.icp_match++;
|
h->handler_stats->icp_match++;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@@ -3211,7 +3211,13 @@ protected:
|
|||||||
|
|
||||||
ha_rows estimation_rows_to_insert;
|
ha_rows estimation_rows_to_insert;
|
||||||
handler *lookup_handler;
|
handler *lookup_handler;
|
||||||
/* Statistics for the query. Updated if handler_stats.in_use is set */
|
/*
|
||||||
|
Statistics for the query. Prefer to use the handler_stats pointer
|
||||||
|
below rather than this object directly as the clone() method will
|
||||||
|
modify how stats are accounted by adjusting the handler_stats
|
||||||
|
pointer. Referring to active_handler_stats directly will yield
|
||||||
|
surprising and possibly incorrect results.
|
||||||
|
*/
|
||||||
ha_handler_stats active_handler_stats;
|
ha_handler_stats active_handler_stats;
|
||||||
void set_handler_stats();
|
void set_handler_stats();
|
||||||
public:
|
public:
|
||||||
|
@@ -1938,14 +1938,14 @@ static void trace_engine_stats(handler *file, Json_writer *writer)
|
|||||||
|
|
||||||
static void print_r_icp_filtered(handler *file, Json_writer *writer)
|
static void print_r_icp_filtered(handler *file, Json_writer *writer)
|
||||||
{
|
{
|
||||||
if (file && file->handler_stats && file->pushed_idx_cond)
|
if (!file || !file->handler_stats || !file->pushed_idx_cond)
|
||||||
{
|
return;
|
||||||
|
|
||||||
ha_handler_stats *hs= file->handler_stats;
|
ha_handler_stats *hs= file->handler_stats;
|
||||||
double r_icp_filtered = hs->icp_attempts ?
|
double r_icp_filtered = hs->icp_attempts ?
|
||||||
(double)(hs->icp_match) / (double)(hs->icp_attempts) : 1.0;
|
(double)(hs->icp_match) / (double)(hs->icp_attempts) : 0.0;
|
||||||
writer->add_member("r_icp_filtered").add_double(r_icp_filtered * 100);
|
writer->add_member("r_icp_filtered").add_double(r_icp_filtered * 100);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Explain_table_access::print_explain_json(Explain_query *query,
|
void Explain_table_access::print_explain_json(Explain_query *query,
|
||||||
Json_writer *writer,
|
Json_writer *writer,
|
||||||
|
Reference in New Issue
Block a user