1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3

TODO: enable MDEV-13049 optimization for 10.3
This commit is contained in:
Alexander Barkov
2017-10-30 20:47:39 +04:00
644 changed files with 35267 additions and 4099 deletions

View File

@ -1424,8 +1424,7 @@ out:
@retval FALSE The statement isn't updating any relevant tables.
*/
static my_bool deny_updates_if_read_only_option(THD *thd,
TABLE_LIST *all_tables)
static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables)
{
DBUG_ENTER("deny_updates_if_read_only_option");
@ -1447,10 +1446,20 @@ static my_bool deny_updates_if_read_only_option(THD *thd,
if (lex->sql_command == SQLCOM_UPDATE_MULTI)
DBUG_RETURN(FALSE);
/* a table-to-create is not in the temp table list, needs a special check */
/*
a table-to-be-created is not in the temp table list yet,
so CREATE TABLE needs a special treatment
*/
if (lex->sql_command == SQLCOM_CREATE_TABLE)
DBUG_RETURN(!lex->tmp_table());
/*
a table-to-be-dropped might not exist (DROP TEMPORARY TABLE IF EXISTS),
cannot use the temp table list either.
*/
if (lex->sql_command == SQLCOM_DROP_TABLE && lex->tmp_table())
DBUG_RETURN(FALSE);
/* Check if we created or dropped databases */
if ((sql_command_flags[lex->sql_command] & CF_DB_CHANGE))
DBUG_RETURN(TRUE);
@ -4065,7 +4074,7 @@ mysql_execute_command(THD *thd)
#ifdef WITH_PARTITION_STORAGE_ENGINE
{
partition_info *part_info= thd->lex->part_info;
if (part_info && !(part_info= thd->lex->part_info->get_clone(thd)))
if (part_info && !(part_info= part_info->get_clone(thd)))
{
res= -1;
goto end_with_restore_list;
@ -4541,7 +4550,7 @@ end_with_restore_list:
if (up_result != 2)
break;
}
/* Fall through */
/* fall through */
case SQLCOM_UPDATE_MULTI:
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
@ -4653,7 +4662,7 @@ end_with_restore_list:
DBUG_PRINT("debug", ("Just after generate_incident()"));
}
#endif
/* fall through */
/* fall through */
case SQLCOM_INSERT:
{
WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE);
@ -5275,7 +5284,6 @@ end_with_restore_list:
if (res)
break;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
switch (lex->sql_command) {
case SQLCOM_CREATE_EVENT:
{
@ -5309,7 +5317,6 @@ end_with_restore_list:
&lex->spname->m_name);
break;
case SQLCOM_DROP_EVENT:
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
if (!(res= Events::drop_event(thd,
&lex->spname->m_db, &lex->spname->m_name,
lex->if_exists())))
@ -5437,11 +5444,10 @@ end_with_restore_list:
}
if (first_table)
{
if (lex->type == TYPE_ENUM_PROCEDURE ||
lex->type == TYPE_ENUM_FUNCTION)
const Sp_handler *sph= Sp_handler::handler((stored_procedure_type)
lex->type);
if (sph)
{
const Sp_handler *sph= Sp_handler::handler((stored_procedure_type)
lex->type);
uint grants= lex->all_privileges
? (PROC_ACLS & ~GRANT_ACL) | (lex->grant & GRANT_ACL)
: lex->grant;
@ -6049,7 +6055,6 @@ end_with_restore_list:
Note: SQLCOM_CREATE_VIEW also handles 'ALTER VIEW' commands
as specified through the thd->lex->create_view->mode flag.
*/
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
res= mysql_create_view(thd, first_table, thd->lex->create_view->mode);
break;
}
@ -6065,7 +6070,6 @@ end_with_restore_list:
case SQLCOM_CREATE_TRIGGER:
{
/* Conditionally writes to binlog. */
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
res= mysql_create_or_drop_trigger(thd, all_tables, 1);
break;
@ -6073,7 +6077,6 @@ end_with_restore_list:
case SQLCOM_DROP_TRIGGER:
{
/* Conditionally writes to binlog. */
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
res= mysql_create_or_drop_trigger(thd, all_tables, 0);
break;
}
@ -6138,13 +6141,11 @@ end_with_restore_list:
my_ok(thd);
break;
case SQLCOM_INSTALL_PLUGIN:
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
if (! (res= mysql_install_plugin(thd, &thd->lex->comment,
&thd->lex->ident)))
my_ok(thd);
break;
case SQLCOM_UNINSTALL_PLUGIN:
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
if (! (res= mysql_uninstall_plugin(thd, &thd->lex->comment,
&thd->lex->ident)))
my_ok(thd);