summaryrefslogtreecommitdiff
path: root/sql/sql_truncate.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_truncate.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_truncate.cc')
-rw-r--r--sql/sql_truncate.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index 249a6e21ffc..13084b08e87 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -139,7 +139,7 @@ fk_truncate_illegal_if_parent(THD *thd, TABLE *table)
table->file->get_parent_foreign_key_list(thd, &fk_list);
/* Out of memory when building list. */
- if (thd->is_error())
+ if (unlikely(thd->is_error()))
return TRUE;
it.init(fk_list);
@@ -240,7 +240,7 @@ Sql_cmd_truncate_table::handler_truncate(THD *thd, TABLE_LIST *table_ref,
DBUG_RETURN(TRUNCATE_FAILED_SKIP_BINLOG);
error= table_ref->table->file->ha_truncate();
- if (error)
+ if (unlikely(error))
{
table_ref->table->file->print_error(error, MYF(0));
/*
@@ -447,7 +447,7 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
query must be written to the binary log. The only exception is a
unimplemented truncate method.
*/
- if (error == TRUNCATE_OK || error == TRUNCATE_FAILED_BUT_BINLOG)
+ if (unlikely(error == TRUNCATE_OK || error == TRUNCATE_FAILED_BUT_BINLOG))
binlog_stmt= true;
else
binlog_stmt= false;