Counters for Index Condition Pushdown added (MDEV-130).

This commit is contained in:
unknown 2012-02-16 08:49:10 +02:00
commit 607aab9c1d
16 changed files with 181 additions and 6 deletions

View file

@ -2248,12 +2248,18 @@ C_MODE_START
ICP_RESULT index_cond_func_maria(void *arg)
{
ha_maria *h= (ha_maria*)arg;
THD *thd= ((TABLE*) h->file->external_ref)->in_use;
ICP_RESULT res;
if (h->end_range)
{
if (h->compare_key2(h->end_range) > 0)
return ICP_OUT_OF_RANGE; /* caller should return HA_ERR_END_OF_FILE already */
}
return h->pushed_idx_cond->val_int() ? ICP_MATCH : ICP_NO_MATCH;
status_var_increment(thd->status_var.ha_pushed_index_cond_checks);
if ((res= h->pushed_idx_cond->val_int() ? ICP_MATCH : ICP_NO_MATCH) ==
ICP_NO_MATCH)
status_var_increment(thd->status_var.ha_pushed_index_cond_filtered);
return res;
}
C_MODE_END

View file

@ -1770,12 +1770,18 @@ C_MODE_START
ICP_RESULT index_cond_func_myisam(void *arg)
{
ha_myisam *h= (ha_myisam*)arg;
THD *thd= ((TABLE*) h->file->external_ref)->in_use;
ICP_RESULT res;
if (h->end_range)
{
if (h->compare_key2(h->end_range) > 0)
return ICP_OUT_OF_RANGE; /* caller should return HA_ERR_END_OF_FILE already */
}
return (ICP_RESULT) test(h->pushed_idx_cond->val_int());
status_var_increment(thd->status_var.ha_pushed_index_cond_checks);
if ((res= (ICP_RESULT) test(h->pushed_idx_cond->val_int())) ==
ICP_NO_MATCH)
status_var_increment(thd->status_var.ha_pushed_index_cond_filtered);
return res;
}
C_MODE_END

View file

@ -12583,6 +12583,8 @@ innobase_index_cond(
void* file) /*!< in/out: pointer to ha_innobase */
{
ha_innobase *h= (ha_innobase*) file;
THD *thd= h->thd();
enum icp_result res;
if (h->is_thd_killed())
return ICP_ABORTED_BY_USER;
@ -12592,7 +12594,11 @@ innobase_index_cond(
if (h->compare_key2(h->end_range) > 0)
return ICP_OUT_OF_RANGE; /* caller should return HA_ERR_END_OF_FILE already */
}
return h->pushed_idx_cond->val_int()? ICP_MATCH : ICP_NO_MATCH;
status_var_increment(thd->status_var.ha_pushed_index_cond_checks);
if ((res= h->pushed_idx_cond->val_int()? ICP_MATCH : ICP_NO_MATCH) ==
ICP_NO_MATCH)
status_var_increment(thd->status_var.ha_pushed_index_cond_filtered);
return res;
}
/** Attempt to push down an index condition.

View file

@ -223,6 +223,8 @@ class ha_innobase: public handler
bool check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes);
bool check_if_supported_virtual_columns(void) { return TRUE; }
THD *thd() { return user_thd; }
private:
/** Builds a 'template' to the prebuilt struct.