mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge tag 'mariadb-10.0.30' into bb-sachin-10.0-galera-merge
Signed-off-by: Sachin Setiya <sachin.setiya@mariadb.com>
This commit is contained in:
132
sql/sql_parse.cc
132
sql/sql_parse.cc
@ -2119,12 +2119,12 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
|
||||
#endif
|
||||
case SCH_COLUMNS:
|
||||
case SCH_STATISTICS:
|
||||
{
|
||||
#ifdef DONT_ALLOW_SHOW_COMMANDS
|
||||
my_message(ER_NOT_ALLOWED_COMMAND,
|
||||
ER(ER_NOT_ALLOWED_COMMAND), MYF(0)); /* purecov: inspected */
|
||||
DBUG_RETURN(1);
|
||||
#else
|
||||
{
|
||||
DBUG_ASSERT(table_ident);
|
||||
TABLE_LIST **query_tables_last= lex->query_tables_last;
|
||||
schema_select_lex= new SELECT_LEX();
|
||||
@ -2424,7 +2424,7 @@ static bool wsrep_is_show_query(enum enum_sql_command command)
|
||||
int
|
||||
mysql_execute_command(THD *thd)
|
||||
{
|
||||
int res= FALSE;
|
||||
int res= 0;
|
||||
int up_result= 0;
|
||||
LEX *lex= thd->lex;
|
||||
/* first SELECT_LEX (have special meaning for many of non-SELECTcommands) */
|
||||
@ -2983,10 +2983,17 @@ case SQLCOM_PREPARE:
|
||||
|
||||
if (check_global_access(thd, SUPER_ACL))
|
||||
goto error;
|
||||
/*
|
||||
In this code it's ok to use LOCK_active_mi as we are adding new things
|
||||
into master_info_index
|
||||
*/
|
||||
mysql_mutex_lock(&LOCK_active_mi);
|
||||
|
||||
if (!master_info_index)
|
||||
{
|
||||
mysql_mutex_unlock(&LOCK_active_mi);
|
||||
my_error(ER_SERVER_SHUTDOWN, MYF(0));
|
||||
goto error;
|
||||
}
|
||||
|
||||
mi= master_info_index->get_master_info(&lex_mi->connection_name,
|
||||
Sql_condition::WARN_LEVEL_NOTE);
|
||||
@ -3015,7 +3022,7 @@ case SQLCOM_PREPARE:
|
||||
If new master was not added, we still need to free mi.
|
||||
*/
|
||||
if (master_info_added)
|
||||
master_info_index->remove_master_info(&lex_mi->connection_name);
|
||||
master_info_index->remove_master_info(mi);
|
||||
else
|
||||
delete mi;
|
||||
}
|
||||
@ -3033,22 +3040,24 @@ case SQLCOM_PREPARE:
|
||||
/* Accept one of two privileges */
|
||||
if (check_global_access(thd, SUPER_ACL | REPL_CLIENT_ACL))
|
||||
goto error;
|
||||
mysql_mutex_lock(&LOCK_active_mi);
|
||||
|
||||
if (lex->verbose)
|
||||
{
|
||||
mysql_mutex_lock(&LOCK_active_mi);
|
||||
res= show_all_master_info(thd);
|
||||
mysql_mutex_unlock(&LOCK_active_mi);
|
||||
}
|
||||
else
|
||||
{
|
||||
LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
|
||||
Master_info *mi;
|
||||
mi= master_info_index->get_master_info(&lex_mi->connection_name,
|
||||
Sql_condition::WARN_LEVEL_ERROR);
|
||||
if (mi != NULL)
|
||||
if ((mi= get_master_info(&lex_mi->connection_name,
|
||||
Sql_condition::WARN_LEVEL_ERROR)))
|
||||
{
|
||||
res= show_master_info(thd, mi, 0);
|
||||
mi->release();
|
||||
}
|
||||
}
|
||||
mysql_mutex_unlock(&LOCK_active_mi);
|
||||
break;
|
||||
}
|
||||
case SQLCOM_SHOW_MASTER_STAT:
|
||||
@ -3383,22 +3392,23 @@ end_with_restore_list:
|
||||
|
||||
load_error= rpl_load_gtid_slave_state(thd);
|
||||
|
||||
mysql_mutex_lock(&LOCK_active_mi);
|
||||
|
||||
if ((mi= (master_info_index->
|
||||
get_master_info(&lex_mi->connection_name,
|
||||
Sql_condition::WARN_LEVEL_ERROR))))
|
||||
/*
|
||||
We don't need to ensure that only one user is using master_info
|
||||
as start_slave is protected against simultaneous usage
|
||||
*/
|
||||
if ((mi= get_master_info(&lex_mi->connection_name,
|
||||
Sql_condition::WARN_LEVEL_ERROR)))
|
||||
{
|
||||
if (load_error)
|
||||
{
|
||||
/*
|
||||
We cannot start a slave using GTID if we cannot load the GTID position
|
||||
from the mysql.gtid_slave_pos table. But we can allow non-GTID
|
||||
replication (useful eg. during upgrade).
|
||||
We cannot start a slave using GTID if we cannot load the
|
||||
GTID position from the mysql.gtid_slave_pos table. But we
|
||||
can allow non-GTID replication (useful eg. during upgrade).
|
||||
*/
|
||||
if (mi->using_gtid != Master_info::USE_GTID_NO)
|
||||
{
|
||||
mysql_mutex_unlock(&LOCK_active_mi);
|
||||
mi->release();
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -3406,8 +3416,8 @@ end_with_restore_list:
|
||||
}
|
||||
if (!start_slave(thd, mi, 1 /* net report*/))
|
||||
my_ok(thd);
|
||||
mi->release();
|
||||
}
|
||||
mysql_mutex_unlock(&LOCK_active_mi);
|
||||
break;
|
||||
}
|
||||
case SQLCOM_SLAVE_STOP:
|
||||
@ -3437,13 +3447,17 @@ end_with_restore_list:
|
||||
}
|
||||
|
||||
lex_mi= &thd->lex->mi;
|
||||
mysql_mutex_lock(&LOCK_active_mi);
|
||||
if ((mi= (master_info_index->
|
||||
get_master_info(&lex_mi->connection_name,
|
||||
Sql_condition::WARN_LEVEL_ERROR))))
|
||||
if (!stop_slave(thd, mi, 1/* net report*/))
|
||||
if ((mi= get_master_info(&lex_mi->connection_name,
|
||||
Sql_condition::WARN_LEVEL_ERROR)))
|
||||
{
|
||||
if (stop_slave(thd, mi, 1/* net report*/))
|
||||
res= 1;
|
||||
mi->release();
|
||||
if (rpl_parallel_resize_pool_if_no_slaves())
|
||||
res= 1;
|
||||
if (!res)
|
||||
my_ok(thd);
|
||||
mysql_mutex_unlock(&LOCK_active_mi);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SQLCOM_SLAVE_ALL_START:
|
||||
@ -4744,11 +4758,13 @@ end_with_restore_list:
|
||||
reload_acl_and_cache binlog interactions failed
|
||||
*/
|
||||
res= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!res)
|
||||
my_ok(thd);
|
||||
}
|
||||
else
|
||||
res= 1; // reload_acl_and_cache failed
|
||||
#ifdef HAVE_REPLICATION
|
||||
if (lex->type & REFRESH_READ_LOCK)
|
||||
rpl_unpause_after_ftwrl(thd);
|
||||
@ -7123,7 +7139,7 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
/*
|
||||
When you modify mysql_parse(), you may need to mofify
|
||||
When you modify mysql_parse(), you may need to modify
|
||||
mysql_test_parse_for_slave() in this same file.
|
||||
*/
|
||||
|
||||
@ -9113,48 +9129,24 @@ bool check_ident_length(LEX_STRING *ident)
|
||||
}
|
||||
|
||||
|
||||
C_MODE_START
|
||||
|
||||
/*
|
||||
Check if path does not contain mysql data home directory
|
||||
|
||||
SYNOPSIS
|
||||
test_if_data_home_dir()
|
||||
dir directory
|
||||
path_starts_from_data_home_dir()
|
||||
dir directory, with all symlinks resolved
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
1 error ; Given path contains data directory
|
||||
*/
|
||||
extern "C" {
|
||||
|
||||
int test_if_data_home_dir(const char *dir)
|
||||
int path_starts_from_data_home_dir(const char *path)
|
||||
{
|
||||
char path[FN_REFLEN];
|
||||
int dir_len;
|
||||
DBUG_ENTER("test_if_data_home_dir");
|
||||
int dir_len= strlen(path);
|
||||
DBUG_ENTER("path_starts_from_data_home_dir");
|
||||
|
||||
if (!dir)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
/*
|
||||
data_file_name and index_file_name include the table name without
|
||||
extension. Mostly this does not refer to an existing file. When
|
||||
comparing data_file_name or index_file_name against the data
|
||||
directory, we try to resolve all symbolic links. On some systems,
|
||||
we use realpath(3) for the resolution. This returns ENOENT if the
|
||||
resolved path does not refer to an existing file. my_realpath()
|
||||
does then copy the requested path verbatim, without symlink
|
||||
resolution. Thereafter the comparison can fail even if the
|
||||
requested path is within the data directory. E.g. if symlinks to
|
||||
another file system are used. To make realpath(3) return the
|
||||
resolved path, we strip the table name and compare the directory
|
||||
path only. If the directory doesn't exist either, table creation
|
||||
will fail anyway.
|
||||
*/
|
||||
|
||||
(void) fn_format(path, dir, "", "",
|
||||
(MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS));
|
||||
dir_len= strlen(path);
|
||||
if (mysql_unpacked_real_data_home_len<= dir_len)
|
||||
{
|
||||
if (dir_len > mysql_unpacked_real_data_home_len &&
|
||||
@ -9182,7 +9174,31 @@ int test_if_data_home_dir(const char *dir)
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
C_MODE_END
|
||||
}
|
||||
|
||||
/*
|
||||
Check if path does not contain mysql data home directory
|
||||
|
||||
SYNOPSIS
|
||||
test_if_data_home_dir()
|
||||
dir directory
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
1 error ; Given path contains data directory
|
||||
*/
|
||||
|
||||
int test_if_data_home_dir(const char *dir)
|
||||
{
|
||||
char path[FN_REFLEN];
|
||||
DBUG_ENTER("test_if_data_home_dir");
|
||||
|
||||
if (!dir)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
(void) fn_format(path, dir, "", "", MY_RETURN_REAL_PATH);
|
||||
DBUG_RETURN(path_starts_from_data_home_dir(path));
|
||||
}
|
||||
|
||||
|
||||
int error_if_data_home_dir(const char *path, const char *what)
|
||||
|
Reference in New Issue
Block a user