summaryrefslogtreecommitdiff
path: root/sql/handler.h
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-03-25 15:33:39 +0200
committerMichael Widenius <monty@askmonty.org>2010-03-25 15:33:39 +0200
commit2c77c9ea25d8d01d8e7d6d35f1fdd2e4809be865 (patch)
tree54a80f2cf0feb2e9be862e1917c8ed21877d69a6 /sql/handler.h
parent2b17c453a7267dad0ad9cca1e2d929b05f1e226d (diff)
downloadmariadb-git-2c77c9ea25d8d01d8e7d6d35f1fdd2e4809be865.tar.gz
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
Diffstat (limited to 'sql/handler.h')
-rw-r--r--sql/handler.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/sql/handler.h b/sql/handler.h
index 08242094d73..f2061a69587 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1134,6 +1134,7 @@ public:
enum {NONE=0, INDEX, RND} inited;
bool locked;
bool implicit_emptied; /* Can be !=0 only if HEAP */
+ bool mark_trx_done;
const COND *pushed_cond;
/**
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_length(sizeof(my_off_t)),
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),
auto_inc_intervals_count(0)
{
@@ -1232,6 +1233,13 @@ public:
DBUG_RETURN(rnd_end());
}
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 */
int ha_index_or_rnd_end()
{
@@ -1943,8 +1951,13 @@ protected:
private:
/* Private helpers */
- inline void mark_trx_read_write();
-private:
+ void mark_trx_read_write_part2();
+ inline void mark_trx_read_write()
+ {
+ if (!mark_trx_done)
+ mark_trx_read_write_part2();
+ }
+
/*
Low-level primitives for storage engines. These should be
overridden by the storage engine class. To call these methods, use