summaryrefslogtreecommitdiff
path: root/sql/sql_sequence.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-04-04 12:16:12 +0300
committerMonty <monty@mariadb.org>2018-05-07 00:07:32 +0300
commit30ebc3ee9efcab635b1f3e14b9198a58ae93c233 (patch)
tree81e3ad66cd4ec8693964317cbf23515d0e9ecf35 /sql/sql_sequence.cc
parenta22a339f8e044a1e8df011beb0b4c8f43792ac96 (diff)
downloadmariadb-git-30ebc3ee9efcab635b1f3e14b9198a58ae93c233.tar.gz
Add likely/unlikely to speed up execution
Added to: - if (error) - Lex - sql_yacc.yy and sql_yacc_ora.yy - In header files to alloc() calls - Added thd argument to thd_net_is_killed()
Diffstat (limited to 'sql/sql_sequence.cc')
-rw-r--r--sql/sql_sequence.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc
index 4d0f15386e7..cb208a7b2e0 100644
--- a/sql/sql_sequence.cc
+++ b/sql/sql_sequence.cc
@@ -341,7 +341,7 @@ bool sequence_insert(THD *thd, LEX *lex, TABLE_LIST *org_table_list)
MYSQL_OPEN_HAS_MDL_LOCK);
thd->open_options&= ~HA_OPEN_FOR_CREATE;
thd->m_reprepare_observer= save_reprepare_observer;
- if (error)
+ if (unlikely(error))
{
lex->restore_backup_query_tables_list(&query_tables_list_backup);
thd->restore_backup_open_tables_state(&open_tables_backup);
@@ -471,7 +471,7 @@ int SEQUENCE::read_initial_values(TABLE *table)
DBUG_RETURN(HA_ERR_LOCK_WAIT_TIMEOUT);
}
DBUG_ASSERT(table->reginfo.lock_type == TL_READ);
- if (!(error= read_stored_values(table)))
+ if (likely(!(error= read_stored_values(table))))
initialized= SEQ_READY_TO_USE;
mysql_unlock_tables(thd, lock);
if (mdl_lock_used)
@@ -510,7 +510,7 @@ int SEQUENCE::read_stored_values(TABLE *table)
error= table->file->ha_read_first_row(table->record[0], MAX_KEY);
tmp_restore_column_map(table->read_set, save_read_set);
- if (error)
+ if (unlikely(error))
{
table->file->print_error(error, MYF(0));
DBUG_RETURN(error);
@@ -591,7 +591,7 @@ int sequence_definition::write_initial_sequence(TABLE *table)
table->s->sequence->initialized= SEQUENCE::SEQ_UNINTIALIZED;
reenable_binlog(thd);
table->write_set= save_write_set;
- if (error)
+ if (unlikely(error))
table->file->print_error(error, MYF(0));
else
{
@@ -633,7 +633,7 @@ int sequence_definition::write(TABLE *table, bool all_fields)
table->read_set= table->write_set= &table->s->all_set;
table->file->column_bitmaps_signal();
store_fields(table);
- if ((error= table->file->ha_write_row(table->record[0])))
+ if (unlikely((error= table->file->ha_write_row(table->record[0]))))
table->file->print_error(error, MYF(0));
table->rpl_write_set= save_rpl_write_set;
table->read_set= save_read_set;
@@ -740,7 +740,7 @@ longlong SEQUENCE::next_value(TABLE *table, bool second_round, int *error)
DBUG_RETURN(next_value(table, 1, error));
}
- if ((*error= write(table, 0)))
+ if (unlikely((*error= write(table, 0))))
{
reserved_until= org_reserved_until;
next_free_value= res_value;
@@ -892,7 +892,7 @@ bool Sql_cmd_alter_sequence::execute(THD *thd)
trapped_errors= no_such_table_handler.safely_trapped_errors();
thd->pop_internal_handler();
}
- if (error)
+ if (unlikely(error))
{
if (trapped_errors)
{
@@ -948,7 +948,7 @@ bool Sql_cmd_alter_sequence::execute(THD *thd)
}
table->s->sequence->write_lock(table);
- if (!(error= new_seq->write(table, 1)))
+ if (likely(!(error= new_seq->write(table, 1))))
{
/* Store the sequence values in table share */
table->s->sequence->copy(new_seq);
@@ -960,9 +960,9 @@ bool Sql_cmd_alter_sequence::execute(THD *thd)
error= 1;
if (trans_commit_implicit(thd))
error= 1;
- if (!error)
+ if (likely(!error))
error= write_bin_log(thd, 1, thd->query(), thd->query_length());
- if (!error)
+ if (likely(!error))
my_ok(thd);
end: