summaryrefslogtreecommitdiff
path: root/sql/sql_view.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_view.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_view.cc')
-rw-r--r--sql/sql_view.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index e910d48c75c..903e30f43a6 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1791,13 +1791,14 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
TABLES we have to simply prohibit dropping of views.
*/
- if (thd->locked_tables_mode)
+ if (unlikely(thd->locked_tables_mode))
{
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
DBUG_RETURN(TRUE);
}
- if (lock_table_names(thd, views, 0, thd->variables.lock_wait_timeout, 0))
+ if (unlikely(lock_table_names(thd, views, 0,
+ thd->variables.lock_wait_timeout, 0)))
DBUG_RETURN(TRUE);
for (view= views; view; view= view->next_local)
@@ -1835,7 +1836,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
}
continue;
}
- if (mysql_file_delete(key_file_frm, path, MYF(MY_WME)))
+ if (unlikely(mysql_file_delete(key_file_frm, path, MYF(MY_WME))))
error= TRUE;
some_views_deleted= TRUE;
@@ -1850,12 +1851,12 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
sp_cache_invalidate();
}
- if (wrong_object_name)
+ if (unlikely(wrong_object_name))
{
my_error(ER_WRONG_OBJECT, MYF(0), wrong_object_db, wrong_object_name,
"VIEW");
}
- if (non_existant_views.length())
+ if (unlikely(non_existant_views.length()))
{
my_error(ER_UNKNOWN_VIEW, MYF(0), non_existant_views.c_ptr_safe());
}
@@ -1866,11 +1867,12 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
/* if something goes wrong, bin-log with possible error code,
otherwise bin-log with error code cleared.
*/
- if (write_bin_log(thd, !something_wrong, thd->query(), thd->query_length()))
+ if (unlikely(write_bin_log(thd, !something_wrong, thd->query(),
+ thd->query_length())))
something_wrong= 1;
}
- if (something_wrong)
+ if (unlikely(something_wrong))
{
DBUG_RETURN(TRUE);
}