#At file:///home/malff/BZR_TREE/mysql-next-mr-stage/ based on revid:alik@stripped
3169 Marc Alff 2010-07-26
Fixed build break when compiling without the performance schema
modified:
include/mysql/psi/mysql_table.h
mysys/thr_lock.c
sql/handler.cc
=== modified file 'include/mysql/psi/mysql_table.h'
--- a/include/mysql/psi/mysql_table.h 2010-07-23 17:08:41 +0000
+++ b/include/mysql/psi/mysql_table.h 2010-07-26 17:20:27 +0000
@@ -30,35 +30,56 @@
*/
/**
+ @def MYSQL_TABLE_WAIT_VARIABLES
+ Instrumentation helper for table waits.
+ This instrumentation declares local variables.
+ Do not use a ';' after this macro
+ @param LOCKER the locker
+ @param STATE the locker state
+ @sa MYSQL_START_TABLE_WAIT.
+ @sa MYSQL_END_TABLE_WAIT.
+*/
+#ifdef HAVE_PSI_INTERFACE
+ #define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE) \
+ struct PSI_table_locker* LOCKER; \
+ PSI_table_locker_state STATE;
+#else
+ #define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE)
+#endif
+
+/**
@def MYSQL_START_TABLE_WAIT
Instrumentation helper for table waits.
This instrumentation marks the start of a wait event.
- @param STATE The locker state
- @param PSI The instrumented table
- @param OP The table operation to be performed
- @param INDEX The table index used if any, or MAY_KEY.
- @param FLAGS Per table operation flags.
+ @param LOCKER the locker
+ @param STATE the locker state
+ @param PSI the instrumented table
+ @param OP the table operation to be performed
+ @param INDEX the table index used if any, or MAY_KEY.
+ @param FLAGS per table operation flags.
@sa MYSQL_END_TABLE_WAIT.
*/
#ifdef HAVE_PSI_INTERFACE
- #define MYSQL_START_TABLE_WAIT(STATE, PSI, OP, INDEX, FLAGS) \
- inline_mysql_start_table_wait(STATE, PSI, OP, INDEX, FLAGS, __FILE__, __LINE__)
+ #define MYSQL_START_TABLE_WAIT(LOCKER, STATE, PSI, OP, INDEX, FLAGS) \
+ LOCKER= inline_mysql_start_table_wait(STATE, PSI, \
+ OP, INDEX, FLAGS, __FILE__, __LINE__)
#else
- #define MYSQL_START_TABLE_WAIT(STATE, PSI, OP, INDEX, FLAGS) \
- NULL
+ #define MYSQL_START_TABLE_WAIT(LOCKER, STATE, PSI, OP, INDEX, FLAGS) \
+ do {} while (0)
#endif
/**
@def MYSQL_END_TABLE_WAIT
Instrumentation helper for table waits.
This instrumentation marks the end of a wait event.
+ @param LOCKER the locker
@sa MYSQL_START_TABLE_WAIT.
*/
#ifdef HAVE_PSI_INTERFACE
- #define MYSQL_END_TABLE_WAIT(L) \
- inline_mysql_end_table_wait(L)
+ #define MYSQL_END_TABLE_WAIT(LOCKER) \
+ inline_mysql_end_table_wait(LOCKER)
#else
- #define MYSQL_END_TABLE_WAIT(L) \
+ #define MYSQL_END_TABLE_WAIT(LOCKER) \
do {} while (0)
#endif
=== modified file 'mysys/thr_lock.c'
--- a/mysys/thr_lock.c 2010-07-23 17:08:41 +0000
+++ b/mysys/thr_lock.c 2010-07-26 17:20:27 +0000
@@ -514,8 +514,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_O
enum enum_thr_lock_result result= THR_LOCK_SUCCESS;
struct st_lock_list *wait_queue;
THR_LOCK_DATA *lock_owner;
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
DBUG_ENTER("thr_lock");
data->next=0;
@@ -523,7 +522,8 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_O
data->type=lock_type;
data->owner= owner; /* Must be reset ! */
- locker= MYSQL_START_TABLE_WAIT(& state, data->m_psi, PSI_TABLE_LOCK, 0, lock_type);
+ MYSQL_START_TABLE_WAIT(locker, &state, data->m_psi,
+ PSI_TABLE_LOCK, 0, lock_type);
mysql_mutex_lock(&lock->mutex);
DBUG_PRINT("lock",("data: 0x%lx thread: 0x%lx lock: 0x%lx type: %d",
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2010-07-23 17:08:41 +0000
+++ b/sql/handler.cc 2010-07-26 17:20:27 +0000
@@ -2191,9 +2191,10 @@ int handler::ha_close(void)
int handler::ha_rnd_next(uchar *buf)
{
int result;
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_FETCH_ROW, MAX_KEY, 0);
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_FETCH_ROW, MAX_KEY, 0);
result= rnd_next(buf);
MYSQL_END_TABLE_WAIT(locker);
return result;
@@ -2202,9 +2203,10 @@ int handler::ha_rnd_next(uchar *buf)
int handler::ha_rnd_pos(uchar *buf, uchar *pos)
{
int result;
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_FETCH_ROW, MAX_KEY, 0);
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_FETCH_ROW, MAX_KEY, 0);
result= rnd_pos(buf, pos);
MYSQL_END_TABLE_WAIT(locker);
return result;
@@ -2215,9 +2217,10 @@ int handler::ha_index_read_map(uchar *bu
enum ha_rkey_function find_flag)
{
int result;
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_FETCH_ROW, active_index, 0);
result= index_read_map(buf, key, keypart_map, find_flag);
MYSQL_END_TABLE_WAIT(locker);
return result;
@@ -2228,9 +2231,10 @@ int handler::ha_index_read_idx_map(uchar
enum ha_rkey_function find_flag)
{
int result;
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_FETCH_ROW, index, 0);
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_FETCH_ROW, index, 0);
result= index_read_idx_map(buf, index, key, keypart_map, find_flag);
MYSQL_END_TABLE_WAIT(locker);
return result;
@@ -2239,9 +2243,10 @@ int handler::ha_index_read_idx_map(uchar
int handler::ha_index_next(uchar * buf)
{
int result;
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_FETCH_ROW, active_index, 0);
result= index_next(buf);
MYSQL_END_TABLE_WAIT(locker);
return result;
@@ -2250,9 +2255,10 @@ int handler::ha_index_next(uchar * buf)
int handler::ha_index_prev(uchar * buf)
{
int result;
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_FETCH_ROW, active_index, 0);
result= index_prev(buf);
MYSQL_END_TABLE_WAIT(locker);
return result;
@@ -2261,9 +2267,10 @@ int handler::ha_index_prev(uchar * buf)
int handler::ha_index_first(uchar * buf)
{
int result;
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_FETCH_ROW, active_index, 0);
result= index_first(buf);
MYSQL_END_TABLE_WAIT(locker);
return result;
@@ -2272,9 +2279,10 @@ int handler::ha_index_first(uchar * buf)
int handler::ha_index_last(uchar * buf)
{
int result;
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_FETCH_ROW, active_index, 0);
result= index_last(buf);
MYSQL_END_TABLE_WAIT(locker);
return result;
@@ -2283,9 +2291,10 @@ int handler::ha_index_last(uchar * buf)
int handler::ha_index_next_same(uchar *buf, const uchar *key, uint keylen)
{
int result;
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_FETCH_ROW, active_index, 0);
result= index_next_same(buf, key, keylen);
MYSQL_END_TABLE_WAIT(locker);
return result;
@@ -2295,9 +2304,10 @@ int handler::ha_index_read(uchar *buf, c
enum ha_rkey_function find_flag)
{
int result;
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_FETCH_ROW, active_index, 0);
result= index_read(buf, key, key_len, find_flag);
MYSQL_END_TABLE_WAIT(locker);
return result;
@@ -2306,9 +2316,10 @@ int handler::ha_index_read(uchar *buf, c
int handler::ha_index_read_last(uchar *buf, const uchar *key, uint key_len)
{
int result;
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_FETCH_ROW, active_index, 0);
result= index_read_last(buf, key, key_len);
MYSQL_END_TABLE_WAIT(locker);
return result;
@@ -4785,6 +4796,8 @@ static int binlog_log_row(TABLE* table,
int handler::ha_external_lock(THD *thd, int lock_type)
{
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
DBUG_ENTER("handler::ha_external_lock");
/*
Whether this is lock or unlock, this should be true, and is to verify that
@@ -4814,10 +4827,8 @@ int handler::ha_external_lock(THD *thd,
}
}
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi,
- PSI_TABLE_EXTERNAL_LOCK, MAX_KEY, lock_type);
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_EXTERNAL_LOCK, MAX_KEY, lock_type);
/*
We cache the table flags if the locking succeeded. Otherwise, we
keep them as they were when they were fetched in ha_open().
@@ -4876,13 +4887,14 @@ int handler::ha_write_row(uchar *buf)
{
int error;
Log_func *log_func= Write_rows_log_event::binlog_row_logging_function;
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+
DBUG_ENTER("handler::ha_write_row");
MYSQL_INSERT_ROW_START(table_share->db.str, table_share->table_name.str);
mark_trx_read_write();
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_WRITE_ROW, MAX_KEY, 0);
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_WRITE_ROW, MAX_KEY, 0);
error= write_row(buf);
@@ -4901,6 +4913,7 @@ int handler::ha_update_row(const uchar *
{
int error;
Log_func *log_func= Update_rows_log_event::binlog_row_logging_function;
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
/*
Some storage engines require that the new record is in record[0]
@@ -4911,9 +4924,8 @@ int handler::ha_update_row(const uchar *
MYSQL_UPDATE_ROW_START(table_share->db.str, table_share->table_name.str);
mark_trx_read_write();
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_UPDATE_ROW, MAX_KEY, 0);
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_UPDATE_ROW, MAX_KEY, 0);
error= update_row(old_data, new_data);
@@ -4930,13 +4942,13 @@ int handler::ha_delete_row(const uchar *
{
int error;
Log_func *log_func= Delete_rows_log_event::binlog_row_logging_function;
+ MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
MYSQL_DELETE_ROW_START(table_share->db.str, table_share->table_name.str);
mark_trx_read_write();
- struct PSI_table_locker *locker;
- PSI_table_locker_state state;
- locker= MYSQL_START_TABLE_WAIT(&state, m_psi, PSI_TABLE_DELETE_ROW, MAX_KEY, 0);
+ MYSQL_START_TABLE_WAIT(locker, &state, m_psi,
+ PSI_TABLE_DELETE_ROW, MAX_KEY, 0);
error= delete_row(buf);
Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20100726172027-mc9h1qcxafbsx9ii.bundle
| Thread |
|---|
| • bzr commit into mysql-next-mr branch (marc.alff:3169) | Marc Alff | 26 Jul |