summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc37
1 files changed, 19 insertions, 18 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 8475d8b163a..9b5089c19b0 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -677,7 +677,7 @@ err:
mysql_file_close(file, MYF(MY_WME));
err_not_open:
- if (share->error && !error_given)
+ if (unlikely(share->error && !error_given))
{
share->open_errno= my_errno;
open_table_error(share, share->error, share->open_errno);
@@ -2764,8 +2764,8 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
thd->reset_db(&db);
lex_start(thd);
- if ((error= parse_sql(thd, & parser_state, NULL) ||
- sql_unusable_for_discovery(thd, hton, sql_copy)))
+ if (unlikely((error= parse_sql(thd, & parser_state, NULL) ||
+ sql_unusable_for_discovery(thd, hton, sql_copy))))
goto ret;
thd->lex->create_info.db_type= hton;
@@ -2797,7 +2797,7 @@ ret:
reenable_binlog(thd);
thd->variables.sql_mode= saved_mode;
thd->variables.character_set_client= old_cs;
- if (thd->is_error() || error)
+ if (unlikely(thd->is_error() || error))
{
thd->clear_error();
my_error(ER_SQL_DISCOVER_ERROR, MYF(0),
@@ -2957,14 +2957,14 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table,
res.errors= 0;
int error= func_expr->walk(&Item::check_vcol_func_processor, 0, &res);
- if (error || (res.errors & VCOL_IMPOSSIBLE))
+ if (unlikely(error || (res.errors & VCOL_IMPOSSIBLE)))
{
// this can only happen if the frm was corrupted
my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0), res.name,
vcol->get_vcol_type_name(), vcol->name.str);
DBUG_RETURN(1);
}
- else if (res.errors & VCOL_AUTO_INC)
+ else if (unlikely(res.errors & VCOL_AUTO_INC))
{
/*
An auto_increment field may not be used in an expression for
@@ -3045,7 +3045,7 @@ unpack_vcol_info_from_frm(THD *thd, MEM_ROOT *mem_root, TABLE *table,
lex.last_field= &vcol_storage;
error= parse_sql(thd, &parser_state, NULL);
- if (error)
+ if (unlikely(error))
goto end;
if (lex.current_select->table_list.first[0].next_global)
@@ -3314,7 +3314,8 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
if (share->table_check_constraints || share->field_check_constraints)
outparam->check_constraints= check_constraint_ptr;
- if (parse_vcol_defs(thd, &outparam->mem_root, outparam, &error_reported))
+ if (unlikely(parse_vcol_defs(thd, &outparam->mem_root, outparam,
+ &error_reported)))
{
error= OPEN_FRM_CORRUPTED;
goto err;
@@ -4346,7 +4347,7 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def)
}
}
- if (! error)
+ if (likely(! error))
table->s->table_field_def_cache= table_def;
end:
@@ -7919,7 +7920,7 @@ bool TABLE::insert_all_rows_into_tmp_table(THD *thd,
tmp_table->file->ha_disable_indexes(HA_KEY_SWITCH_ALL);
file->ha_index_or_rnd_end();
- if (file->ha_rnd_init_with_error(1))
+ if (unlikely(file->ha_rnd_init_with_error(1)))
DBUG_RETURN(1);
if (tmp_table->no_rows)
@@ -7931,10 +7932,10 @@ bool TABLE::insert_all_rows_into_tmp_table(THD *thd,
tmp_table->file->ha_start_bulk_insert(file->stats.records);
}
- while (!file->ha_rnd_next(tmp_table->record[0]))
+ while (likely(!file->ha_rnd_next(tmp_table->record[0])))
{
write_err= tmp_table->file->ha_write_tmp_row(tmp_table->record[0]);
- if (write_err)
+ if (unlikely(write_err))
{
bool is_duplicate;
if (tmp_table->file->is_fatal_error(write_err, HA_CHECK_DUP) &&
@@ -7945,7 +7946,7 @@ bool TABLE::insert_all_rows_into_tmp_table(THD *thd,
DBUG_RETURN(1);
}
- if (thd->check_killed())
+ if (unlikely(thd->check_killed()))
{
thd->send_kill_message();
goto err_killed;
@@ -8606,7 +8607,7 @@ bool TR_table::update(ulonglong start_id, ulonglong end_id)
store_iso_level(thd->tx_isolation);
int error= table->file->ha_write_row(table->record[0]);
- if (error)
+ if (unlikely(error))
table->file->print_error(error, MYF(0));
return error;
}
@@ -8625,10 +8626,10 @@ bool TR_table::query(ulonglong trx_id)
Item *field= newx Item_field(thd, &slex.context, (*this)[FLD_TRX_ID]);
Item *value= newx Item_int(thd, trx_id);
COND *conds= newx Item_func_eq(thd, field, value);
- if ((error= setup_conds(thd, this, dummy, &conds)))
+ if (unlikely((error= setup_conds(thd, this, dummy, &conds))))
return false;
select= make_select(table, 0, 0, conds, NULL, 0, &error);
- if (error || !select)
+ if (unlikely(error || !select))
return false;
// FIXME: (performance) force index 'transaction_id'
error= init_read_record(&info, thd, table, select, NULL,
@@ -8659,11 +8660,11 @@ bool TR_table::query(MYSQL_TIME &commit_time, bool backwards)
conds= newx Item_func_ge(thd, field, value);
else
conds= newx Item_func_le(thd, field, value);
- if ((error= setup_conds(thd, this, dummy, &conds)))
+ if (unlikely((error= setup_conds(thd, this, dummy, &conds))))
return false;
// FIXME: (performance) force index 'commit_timestamp'
select= make_select(table, 0, 0, conds, NULL, 0, &error);
- if (error || !select)
+ if (unlikely(error || !select))
return false;
error= init_read_record(&info, thd, table, select, NULL,
1 /* use_record_cache */, true /* print_error */,