simple speed & space optimization:
- Avoid full inline of mark_trx_read_write() for many functions - Avoid somewhat expensive tests for every write/update/delete row sql/handler.h: Adde ha_start_of_new_statement() to reset internal variables as part of the code in "open_table" that resets TABLE object for the new statement Faster mark_trx_read_write_part() sql/sql_base.cc: Don't manipulate table->file internal structs directly
This commit is contained in:
parent
2b17c453a7
commit
2c77c9ea25
@ -3110,11 +3110,14 @@ int handler::ha_check(THD *thd, HA_CHECK_OPT *check_opt)
|
|||||||
if it is started.
|
if it is started.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline
|
|
||||||
void
|
void
|
||||||
handler::mark_trx_read_write()
|
handler::mark_trx_read_write_part2()
|
||||||
{
|
{
|
||||||
Ha_trx_info *ha_info= &ha_thd()->ha_data[ht->slot].ha_info[0];
|
Ha_trx_info *ha_info= &ha_thd()->ha_data[ht->slot].ha_info[0];
|
||||||
|
|
||||||
|
/* Don't call this function again for this statement */
|
||||||
|
mark_trx_done= TRUE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
When a storage engine method is called, the transaction must
|
When a storage engine method is called, the transaction must
|
||||||
have been started, unless it's a DDL call, for which the
|
have been started, unless it's a DDL call, for which the
|
||||||
|
@ -1134,6 +1134,7 @@ public:
|
|||||||
enum {NONE=0, INDEX, RND} inited;
|
enum {NONE=0, INDEX, RND} inited;
|
||||||
bool locked;
|
bool locked;
|
||||||
bool implicit_emptied; /* Can be !=0 only if HEAP */
|
bool implicit_emptied; /* Can be !=0 only if HEAP */
|
||||||
|
bool mark_trx_done;
|
||||||
const COND *pushed_cond;
|
const COND *pushed_cond;
|
||||||
/**
|
/**
|
||||||
next_insert_id is the next value which should be inserted into the
|
next_insert_id is the next value which should be inserted into the
|
||||||
@ -1177,7 +1178,7 @@ public:
|
|||||||
ref(0), key_used_on_scan(MAX_KEY), active_index(MAX_KEY),
|
ref(0), key_used_on_scan(MAX_KEY), active_index(MAX_KEY),
|
||||||
ref_length(sizeof(my_off_t)),
|
ref_length(sizeof(my_off_t)),
|
||||||
ft_handler(0), inited(NONE),
|
ft_handler(0), inited(NONE),
|
||||||
locked(FALSE), implicit_emptied(0),
|
locked(FALSE), implicit_emptied(FALSE), mark_trx_done(FALSE),
|
||||||
pushed_cond(0), next_insert_id(0), insert_id_for_cur_row(0),
|
pushed_cond(0), next_insert_id(0), insert_id_for_cur_row(0),
|
||||||
auto_inc_intervals_count(0)
|
auto_inc_intervals_count(0)
|
||||||
{
|
{
|
||||||
@ -1232,6 +1233,13 @@ public:
|
|||||||
DBUG_RETURN(rnd_end());
|
DBUG_RETURN(rnd_end());
|
||||||
}
|
}
|
||||||
int ha_reset();
|
int ha_reset();
|
||||||
|
/* Tell handler (not storage engine) this is start of a new statement */
|
||||||
|
void ha_start_of_new_statement()
|
||||||
|
{
|
||||||
|
ft_handler= 0;
|
||||||
|
mark_trx_done= FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* this is necessary in many places, e.g. in HANDLER command */
|
/* this is necessary in many places, e.g. in HANDLER command */
|
||||||
int ha_index_or_rnd_end()
|
int ha_index_or_rnd_end()
|
||||||
{
|
{
|
||||||
@ -1943,8 +1951,13 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/* Private helpers */
|
/* Private helpers */
|
||||||
inline void mark_trx_read_write();
|
void mark_trx_read_write_part2();
|
||||||
private:
|
inline void mark_trx_read_write()
|
||||||
|
{
|
||||||
|
if (!mark_trx_done)
|
||||||
|
mark_trx_read_write_part2();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Low-level primitives for storage engines. These should be
|
Low-level primitives for storage engines. These should be
|
||||||
overridden by the storage engine class. To call these methods, use
|
overridden by the storage engine class. To call these methods, use
|
||||||
|
@ -2996,7 +2996,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
|||||||
table->status=STATUS_NO_RECORD;
|
table->status=STATUS_NO_RECORD;
|
||||||
table->insert_values= 0;
|
table->insert_values= 0;
|
||||||
table->fulltext_searched= 0;
|
table->fulltext_searched= 0;
|
||||||
table->file->ft_handler= 0;
|
table->file->ha_start_of_new_statement();
|
||||||
table->reginfo.impossible_range= 0;
|
table->reginfo.impossible_range= 0;
|
||||||
/* Catch wrong handling of the auto_increment_field_not_null. */
|
/* Catch wrong handling of the auto_increment_field_not_null. */
|
||||||
DBUG_ASSERT(!table->auto_increment_field_not_null);
|
DBUG_ASSERT(!table->auto_increment_field_not_null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user