Commit 450ed5ae authored by unknown's avatar unknown

Bug #34458 Extreneous use of templates in server code

Patch to remove white-space left over after removing anonymous
namespace.


sql/handler.cc:
  Removing indentation and whitespace.
parent 40176e19
...@@ -3843,23 +3843,24 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat) ...@@ -3843,23 +3843,24 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat)
- table is not mysql.event - table is not mysql.event
*/ */
static bool check_table_binlog_row_based(THD *thd, TABLE *table) static 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 &&
{ binlog_filter->db_ok(table->s->db.str));
int const check(table->s->tmp_table == NO_TMP_TABLE && table->s->cached_row_logging_check= check;
binlog_filter->db_ok(table->s->db.str)); }
table->s->cached_row_logging_check= check;
}
DBUG_ASSERT(table->s->cached_row_logging_check == 0 || DBUG_ASSERT(table->s->cached_row_logging_check == 0 ||
table->s->cached_row_logging_check == 1); table->s->cached_row_logging_check == 1);
return (thd->current_stmt_binlog_row_based &&
table->s->cached_row_logging_check &&
(thd->options & OPTION_BIN_LOG) &&
mysql_bin_log.is_open());
}
return (thd->current_stmt_binlog_row_based &&
table->s->cached_row_logging_check &&
(thd->options & OPTION_BIN_LOG) &&
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
...@@ -3874,7 +3875,7 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat) ...@@ -3874,7 +3875,7 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat)
that are locked by the thread 'thd'. Either manually locked that are locked by the thread 'thd'. Either manually locked
(stored in THD::locked_tables) and automatically locked (stored (stored in THD::locked_tables) and automatically locked (stored
in THD::lock) are considered. in THD::lock) are considered.
RETURN VALUE RETURN VALUE
0 All OK 0 All OK
1 Failed to write all table maps 1 Failed to write all table maps
...@@ -3884,95 +3885,95 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat) ...@@ -3884,95 +3885,95 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat)
THD::locked_tables THD::locked_tables
*/ */
static int write_locked_table_maps(THD *thd) static 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",
(long) thd, (long) thd->lock, (long) thd, (long) thd->lock,
(long) thd->locked_tables, (long) thd->extra_lock)); (long) thd->locked_tables, (long) thd->extra_lock));
if (thd->get_binlog_table_maps() == 0) if (thd->get_binlog_table_maps() == 0)
{
MYSQL_LOCK *locks[3];
locks[0]= thd->extra_lock;
locks[1]= thd->lock;
locks[2]= thd->locked_tables;
for (uint i= 0 ; i < sizeof(locks)/sizeof(*locks) ; ++i )
{ {
MYSQL_LOCK *locks[3]; MYSQL_LOCK const *const lock= locks[i];
locks[0]= thd->extra_lock; if (lock == NULL)
locks[1]= thd->lock; continue;
locks[2]= thd->locked_tables;
for (uint i= 0 ; i < sizeof(locks)/sizeof(*locks) ; ++i ) TABLE **const end_ptr= lock->table + lock->table_count;
for (TABLE **table_ptr= lock->table ;
table_ptr != end_ptr ;
++table_ptr)
{ {
MYSQL_LOCK const *const lock= locks[i]; TABLE *const table= *table_ptr;
if (lock == NULL) DBUG_PRINT("info", ("Checking table %s", table->s->table_name.str));
continue; if (table->current_lock == F_WRLCK &&
check_table_binlog_row_based(thd, table))
TABLE **const end_ptr= lock->table + lock->table_count;
for (TABLE **table_ptr= lock->table ;
table_ptr != end_ptr ;
++table_ptr)
{ {
TABLE *const table= *table_ptr; int const has_trans= table->file->has_transactions();
DBUG_PRINT("info", ("Checking table %s", table->s->table_name.str)); int const error= thd->binlog_write_table_map(table, has_trans);
if (table->current_lock == F_WRLCK && /*
check_table_binlog_row_based(thd, table)) If an error occurs, it is the responsibility of the caller to
{ roll back the transaction.
int const has_trans= table->file->has_transactions(); */
int const error= thd->binlog_write_table_map(table, has_trans); if (unlikely(error))
/* DBUG_RETURN(1);
If an error occurs, it is the responsibility of the caller to
roll back the transaction.
*/
if (unlikely(error))
DBUG_RETURN(1);
}
} }
} }
} }
DBUG_RETURN(0);
} }
DBUG_RETURN(0);
}
typedef bool Log_func(THD*, TABLE*, bool, MY_BITMAP*, typedef bool Log_func(THD*, TABLE*, bool, MY_BITMAP*,
uint, const uchar*, const uchar*); uint, const uchar*, const uchar*);
static int binlog_log_row(TABLE* table, 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) Log_func *log_func)
{
if (table->no_replicate)
return 0;
bool error= 0;
THD *const thd= table->in_use;
if (check_table_binlog_row_based(thd, table))
{ {
if (table->no_replicate) MY_BITMAP cols;
return 0; /* Potential buffer on the stack for the bitmap */
bool error= 0; uint32 bitbuf[BITMAP_STACKBUF_SIZE/sizeof(uint32)];
THD *const thd= table->in_use; uint n_fields= table->s->fields;
my_bool use_bitbuf= n_fields <= sizeof(bitbuf)*8;
if (check_table_binlog_row_based(thd, table)) /*
If there are no table maps written to the binary log, this is
the first row handled in this statement. In that case, we need
to write table maps for all locked tables to the binary log.
*/
if (likely(!(error= bitmap_init(&cols,
use_bitbuf ? bitbuf : NULL,
(n_fields + 7) & ~7UL,
FALSE))))
{ {
MY_BITMAP cols; bitmap_set_all(&cols);
/* Potential buffer on the stack for the bitmap */ if (likely(!(error= write_locked_table_maps(thd))))
uint32 bitbuf[BITMAP_STACKBUF_SIZE/sizeof(uint32)]; error= (*log_func)(thd, table, table->file->has_transactions(),
uint n_fields= table->s->fields; &cols, table->s->fields,
my_bool use_bitbuf= n_fields <= sizeof(bitbuf)*8; before_record, after_record);
/* if (!use_bitbuf)
If there are no table maps written to the binary log, this is bitmap_free(&cols);
the first row handled in this statement. In that case, we need
to write table maps for all locked tables to the binary log.
*/
if (likely(!(error= bitmap_init(&cols,
use_bitbuf ? bitbuf : NULL,
(n_fields + 7) & ~7UL,
FALSE))))
{
bitmap_set_all(&cols);
if (likely(!(error= write_locked_table_maps(thd))))
error= (*log_func)(thd, table, table->file->has_transactions(),
&cols, table->s->fields,
before_record, after_record);
if (!use_bitbuf)
bitmap_free(&cols);
}
} }
return error ? HA_ERR_RBR_LOGGING_FAILED : 0;
} }
return error ? HA_ERR_RBR_LOGGING_FAILED : 0;
}
int handler::ha_external_lock(THD *thd, int lock_type) int handler::ha_external_lock(THD *thd, int lock_type)
{ {
......
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