Commit f56754b3 authored by unknown's avatar unknown

Merge kindahl-laptop.dnsalias.net:/home/bkroot/mysql-5.1-rpl

into  kindahl-laptop.dnsalias.net:/home/bk/b34458-mysql-5.1-rpl

parents dcb1b60b 450ed5ae
...@@ -3843,12 +3843,8 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat) ...@@ -3843,12 +3843,8 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat)
- table is not mysql.event - table is not mysql.event
*/ */
/* The Sun compiler cannot instantiate the template below if this is static bool check_table_binlog_row_based(THD *thd, TABLE *table)
declared static, but it works by putting it into an anonymous {
namespace. */
namespace {
bool check_table_binlog_row_based(THD *thd, TABLE *table)
{
if (table->s->cached_row_logging_check == -1) if (table->s->cached_row_logging_check == -1)
{ {
int const check(table->s->tmp_table == NO_TMP_TABLE && int const check(table->s->tmp_table == NO_TMP_TABLE &&
...@@ -3863,9 +3859,9 @@ namespace { ...@@ -3863,9 +3859,9 @@ namespace {
table->s->cached_row_logging_check && table->s->cached_row_logging_check &&
(thd->options & OPTION_BIN_LOG) && (thd->options & OPTION_BIN_LOG) &&
mysql_bin_log.is_open()); mysql_bin_log.is_open());
}
} }
/** @brief /** @brief
Write table maps for all (manually or automatically) locked tables Write table maps for all (manually or automatically) locked tables
to the binary log. to the binary log.
...@@ -3888,10 +3884,9 @@ namespace { ...@@ -3888,10 +3884,9 @@ namespace {
THD::lock THD::lock
THD::locked_tables THD::locked_tables
*/ */
namespace
static int write_locked_table_maps(THD *thd)
{ {
int write_locked_table_maps(THD *thd)
{
DBUG_ENTER("write_locked_table_maps"); DBUG_ENTER("write_locked_table_maps");
DBUG_PRINT("enter", ("thd: 0x%lx thd->lock: 0x%lx thd->locked_tables: 0x%lx " DBUG_PRINT("enter", ("thd: 0x%lx thd->lock: 0x%lx thd->locked_tables: 0x%lx "
"thd->extra_lock: 0x%lx", "thd->extra_lock: 0x%lx",
...@@ -3933,13 +3928,17 @@ namespace ...@@ -3933,13 +3928,17 @@ namespace
} }
} }
DBUG_RETURN(0); DBUG_RETURN(0);
} }
template<class RowsEventT> int typedef bool Log_func(THD*, TABLE*, bool, MY_BITMAP*,
binlog_log_row(TABLE* table, uint, const uchar*, const uchar*);
static int binlog_log_row(TABLE* table,
const uchar *before_record, const uchar *before_record,
const uchar *after_record) const uchar *after_record,
{ Log_func *log_func)
{
if (table->no_replicate) if (table->no_replicate)
return 0; return 0;
bool error= 0; bool error= 0;
...@@ -3965,38 +3964,17 @@ namespace ...@@ -3965,38 +3964,17 @@ namespace
{ {
bitmap_set_all(&cols); bitmap_set_all(&cols);
if (likely(!(error= write_locked_table_maps(thd)))) if (likely(!(error= write_locked_table_maps(thd))))
{ error= (*log_func)(thd, table, table->file->has_transactions(),
error=
RowsEventT::binlog_row_logging_function(thd, table,
table->file->
has_transactions(),
&cols, table->s->fields, &cols, table->s->fields,
before_record, before_record, after_record);
after_record);
}
if (!use_bitbuf) if (!use_bitbuf)
bitmap_free(&cols); bitmap_free(&cols);
} }
} }
return error ? HA_ERR_RBR_LOGGING_FAILED : 0; return error ? HA_ERR_RBR_LOGGING_FAILED : 0;
}
/*
Instantiate the versions we need for the above template function,
because we have -fno-implicit-template as compiling option.
*/
template int
binlog_log_row<Write_rows_log_event>(TABLE *, const uchar *, const uchar *);
template int
binlog_log_row<Delete_rows_log_event>(TABLE *, const uchar *, const uchar *);
template int
binlog_log_row<Update_rows_log_event>(TABLE *, const uchar *, const uchar *);
} }
int handler::ha_external_lock(THD *thd, int lock_type) int handler::ha_external_lock(THD *thd, int lock_type)
{ {
DBUG_ENTER("handler::ha_external_lock"); DBUG_ENTER("handler::ha_external_lock");
...@@ -4041,10 +4019,11 @@ int handler::ha_reset() ...@@ -4041,10 +4019,11 @@ int handler::ha_reset()
int handler::ha_write_row(uchar *buf) int handler::ha_write_row(uchar *buf)
{ {
int error; int error;
Log_func *log_func= Write_rows_log_event::binlog_row_logging_function;
DBUG_ENTER("handler::ha_write_row"); DBUG_ENTER("handler::ha_write_row");
if (unlikely(error= write_row(buf))) if (unlikely(error= write_row(buf)))
DBUG_RETURN(error); DBUG_RETURN(error);
if (unlikely(error= binlog_log_row<Write_rows_log_event>(table, 0, buf))) if (unlikely(error= binlog_log_row(table, 0, buf, log_func)))
DBUG_RETURN(error); /* purecov: inspected */ DBUG_RETURN(error); /* purecov: inspected */
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -4053,6 +4032,7 @@ int handler::ha_write_row(uchar *buf) ...@@ -4053,6 +4032,7 @@ int handler::ha_write_row(uchar *buf)
int handler::ha_update_row(const uchar *old_data, uchar *new_data) int handler::ha_update_row(const uchar *old_data, uchar *new_data)
{ {
int error; int error;
Log_func *log_func= Update_rows_log_event::binlog_row_logging_function;
/* /*
Some storage engines require that the new record is in record[0] Some storage engines require that the new record is in record[0]
...@@ -4062,7 +4042,7 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data) ...@@ -4062,7 +4042,7 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data)
if (unlikely(error= update_row(old_data, new_data))) if (unlikely(error= update_row(old_data, new_data)))
return error; return error;
if (unlikely(error= binlog_log_row<Update_rows_log_event>(table, old_data, new_data))) if (unlikely(error= binlog_log_row(table, old_data, new_data, log_func)))
return error; return error;
return 0; return 0;
} }
...@@ -4070,9 +4050,10 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data) ...@@ -4070,9 +4050,10 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data)
int handler::ha_delete_row(const uchar *buf) int handler::ha_delete_row(const uchar *buf)
{ {
int error; int error;
Log_func *log_func= Delete_rows_log_event::binlog_row_logging_function;
if (unlikely(error= delete_row(buf))) if (unlikely(error= delete_row(buf)))
return error; return error;
if (unlikely(error= binlog_log_row<Delete_rows_log_event>(table, buf, 0))) if (unlikely(error= binlog_log_row(table, buf, 0, log_func)))
return error; return error;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment