Commit 97817fb5 authored by Otto Kekäläinen's avatar Otto Kekäläinen
Browse files

Merge tag 'upstream/5.5.53' into ubuntu-14.04

Upstream version 5.5.53
parents fa322efd ad9e6670
......@@ -512,6 +512,14 @@ DROP DATABASE connected_db;
create database `aa``bb````cc`;
DATABASE()
aa`bb``cc
DATABASE()
test
DATABASE()
aa`bb``cc
DATABASE()
test
DATABASE()
aa`bb``cc
drop database `aa``bb````cc`;
a
>>\ndelimiter\n<<
......
......@@ -3,3 +3,9 @@ a
1
End of tests
1
1
2
2
X
3
create database `mysqltest1
1tsetlqsym`;
use `mysqltest1
1tsetlqsym`;
create table `t1
1t` (`foobar
raboof` int);
create view `v1
1v` as select * from `t1
1t`;
create procedure sp() select * from `v1
1v`;
flush tables;
use test;
--
-- Current Database: `mysqltest1
-- 1tsetlqsym`
--
/*!40000 DROP DATABASE IF EXISTS `mysqltest1
1tsetlqsym`*/;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1
1tsetlqsym` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `mysqltest1
1tsetlqsym`;
--
-- Table structure for table `t1
-- 1t`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1
1t` (
`foobar
raboof` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t1
-- 1t`
--
--
-- Temporary table structure for view `v1
-- 1v`
--
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE TABLE `v1
1v` (
`foobar
raboof` tinyint NOT NULL
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
--
-- Dumping routines for database 'mysqltest1
-- 1tsetlqsym'
--
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = latin1 */ ;
/*!50003 SET character_set_results = latin1 */ ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp`()
select * from `v1
1v` ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Current Database: `mysqltest1
-- 1tsetlqsym`
--
USE `mysqltest1
1tsetlqsym`;
--
-- Final view structure for view `v1
-- 1v`
--
/*!50001 DROP TABLE IF EXISTS `v1
1v`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = latin1 */;
/*!50001 SET character_set_results = latin1 */;
/*!50001 SET collation_connection = latin1_swedish_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1
1v` AS select `t1
1t`.`foobar
raboof` AS `foobar
raboof` from `t1
1t` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
show tables from `mysqltest1
1tsetlqsym`;
Tables_in_mysqltest1
1tsetlqsym
t1
1t
v1
1v
drop database `mysqltest1
1tsetlqsym`;
......@@ -269,12 +269,6 @@ source database
echo message echo message
mysqltest: At line 1: Missing argument in exec
1
1
2
2
X
3
MySQL
"MySQL"
MySQL: The
......
......@@ -8,7 +8,6 @@ server_audit_file_rotate_now OFF
server_audit_file_rotate_size 1000000
server_audit_file_rotations 9
server_audit_incl_users
server_audit_loc_info
server_audit_logging OFF
server_audit_mode 0
server_audit_output_type file
......@@ -72,7 +71,6 @@ server_audit_file_rotate_now OFF
server_audit_file_rotate_size 1000000
server_audit_file_rotations 9
server_audit_incl_users odin, root, dva, tri
server_audit_loc_info
server_audit_logging ON
server_audit_mode 0
server_audit_output_type file
......@@ -218,7 +216,6 @@ server_audit_file_rotate_now OFF
server_audit_file_rotate_size 1000000
server_audit_file_rotations 9
server_audit_incl_users odin, root, dva, tri
server_audit_loc_info
server_audit_logging ON
server_audit_mode 1
server_audit_output_type file
......
......@@ -8,7 +8,6 @@ server_audit_file_rotate_now OFF
server_audit_file_rotate_size 1000000
server_audit_file_rotations 9
server_audit_incl_users
server_audit_loc_info
server_audit_logging OFF
server_audit_mode 0
server_audit_output_type file
......@@ -72,7 +71,6 @@ server_audit_file_rotate_now OFF
server_audit_file_rotate_size 1000000
server_audit_file_rotations 9
server_audit_incl_users odin, root, dva, tri
server_audit_loc_info
server_audit_logging ON
server_audit_mode 0
server_audit_output_type file
......@@ -218,7 +216,6 @@ server_audit_file_rotate_now OFF
server_audit_file_rotate_size 1000000
server_audit_file_rotations 9
server_audit_incl_users odin, root, dva, tri
server_audit_loc_info
server_audit_logging ON
server_audit_mode 1
server_audit_output_type file
......
......@@ -586,8 +586,16 @@ DROP DATABASE connected_db;
# USE and names with backticks
#
--write_file $MYSQLTEST_VARDIR/tmp/backticks.sql
\u aa`bb``cc
SELECT DATABASE();
USE test
SELECT DATABASE();
USE aa`bb``cc
SELECT DATABASE();
USE test
SELECT DATABASE();
USE `aa``bb````cc`
SELECT DATABASE();
EOF
create database `aa``bb````cc`;
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/backticks.sql
......
......@@ -13,3 +13,12 @@
--echo
--echo End of tests
# Multi-line exec
exec $MYSQL \
test -e "select 1";
exec $MYSQL test -e "select
2";
let $query = select 3
as X;
exec $MYSQL test -e "$query";
#
# New lines in identifiers
#
# embedded server doesn't support external clients
--source include/not_embedded.inc
# cmd.exe doesn't like new lines on the command line
--source include/not_windows.inc
create database `mysqltest1
1tsetlqsym`;
use `mysqltest1
1tsetlqsym`;
create table `t1
1t` (`foobar
raboof` int);
create view `v1
1v` as select * from `t1
1t`;
create procedure sp() select * from `v1
1v`;
flush tables;
use test;
exec $MYSQL_DUMP --compact --comment --routines --add-drop-database --databases 'mysqltest1
1tsetlqsym';
exec $MYSQL_DUMP --compact --comment --routines --add-drop-database --databases 'mysqltest1
1tsetlqsym' | $MYSQL;
show tables from `mysqltest1
1tsetlqsym`;
drop database `mysqltest1
1tsetlqsym`;
......@@ -741,15 +741,6 @@ echo ;
--error 1
--exec echo "--exec " | $MYSQL_TEST 2>&1
# Multi-line exec
exec $MYSQL
test -e "select 1";
exec $MYSQL test -e "select
2";
let $query = select 3
as X;
exec $MYSQL test -e "$query";
# ----------------------------------------------------------------------------
# Test let command
# ----------------------------------------------------------------------------
......
......@@ -102,6 +102,7 @@ static FILE *my_win_freopen(const char *path, const char *mode, FILE *stream)
HANDLE osfh;
DBUG_ASSERT(path && stream);
DBUG_ASSERT(strchr(mode, 'a')); /* We use FILE_APPEND_DATA below */
/* Services don't have stdout/stderr on Windows, so _fileno returns -1. */
if (fd < 0)
......@@ -112,15 +113,14 @@ static FILE *my_win_freopen(const char *path, const char *mode, FILE *stream)
fd= _fileno(stream);
}
if ((osfh= CreateFile(path, GENERIC_READ | GENERIC_WRITE,
if ((osfh= CreateFile(path, GENERIC_READ | FILE_APPEND_DATA,
FILE_SHARE_READ | FILE_SHARE_WRITE |
FILE_SHARE_DELETE, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
NULL)) == INVALID_HANDLE_VALUE)
return NULL;
if ((handle_fd= _open_osfhandle((intptr_t)osfh,
_O_APPEND | _O_TEXT)) == -1)
if ((handle_fd= _open_osfhandle((intptr_t)osfh, _O_TEXT)) == -1)
{
CloseHandle(osfh);
return NULL;
......
......@@ -43,7 +43,11 @@ static const char *get_os_version_name(OSVERSIONINFOEX *ver)
{
DWORD major = ver->dwMajorVersion;
DWORD minor = ver->dwMinorVersion;
if (major == 10 && minor == 0)
{
return (ver->wProductType == VER_NT_WORKSTATION) ?
"Windows 10" : "Windows Server 2016";
}
if (major == 6 && minor == 3)
{
return (ver->wProductType == VER_NT_WORKSTATION)?
......@@ -102,7 +106,12 @@ static int uname(struct utsname *buf)
if(version_str && version_str[0])
sprintf(buf->version, "%s %s",version_str, ver.szCSDVersion);
else
sprintf(buf->version, "%s", ver.szCSDVersion);
{
/* Fallback for unknown versions, e.g "Windows <major_ver>.<minor_ver>" */
sprintf(buf->version, "Windows %d.%d%s",
ver.dwMajorVersion, ver.dwMinorVersion,
(ver.wProductType == VER_NT_WORKSTATION ? "" : " Server"));
}
#ifdef _WIN64
strcpy(buf->machine, "x64");
......
......@@ -429,9 +429,8 @@ static MYSQL_SYSVAR_UINT(query_log_limit, query_log_limit,
char locinfo_ini_value[sizeof(struct connection_info)+4];
static MYSQL_THDVAR_STR(loc_info,
PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC,
"Auxiliary info.", NULL, NULL,
locinfo_ini_value);
PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_MEMALLOC,
"Internal info", NULL, NULL, locinfo_ini_value);
static const char *syslog_facility_names[]=
{
......
......@@ -620,6 +620,10 @@ else
logging=syslog
fi
# close stdout and stderr, everything goes to $logging now
exec 1>&-
exec 2>&-
USER_OPTION=""
if test -w / -o "$USER" = "root"
then
......@@ -650,7 +654,7 @@ if [ ! -d $mysql_unix_port_dir ]
then
if ! `mkdir -p $mysql_unix_port_dir`
then
echo "Fatal error Can't create database directory '$mysql_unix_port'"
log_error "Fatal error Can't create database directory '$mysql_unix_port'"
exit 1
fi
chown $user $mysql_unix_port_dir
......
......@@ -2863,7 +2863,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
if (! write_error)
{
write_error= 1;
sql_print_error(ER(ER_ERROR_ON_WRITE), name, error);
sql_print_error(ER(ER_ERROR_ON_WRITE), name, tmp_errno);
}
}
}
......
......@@ -42,9 +42,9 @@ enum file_opt_type {
struct File_option
{
LEX_STRING name; /**< Name of the option */
int offset; /**< offset to base address of value */
file_opt_type type; /**< Option type */
LEX_STRING name; /**< Name of the option */
my_ptrdiff_t offset; /**< offset to base address of value */
file_opt_type type; /**< Option type */
};
......
......@@ -2756,6 +2756,22 @@ static st_bookmark *find_bookmark(const char *plugin, const char *name,
}
static size_t var_storage_size(int flags)
{
switch (flags & PLUGIN_VAR_TYPEMASK) {
case PLUGIN_VAR_BOOL: return sizeof(my_bool);
case PLUGIN_VAR_INT: return sizeof(int);
case PLUGIN_VAR_LONG: return sizeof(long);
case PLUGIN_VAR_ENUM: return sizeof(long);
case PLUGIN_VAR_LONGLONG: return sizeof(ulonglong);
case PLUGIN_VAR_SET: return sizeof(ulonglong);
case PLUGIN_VAR_STR: return sizeof(char*);
case PLUGIN_VAR_DOUBLE: return sizeof(double);
default: DBUG_ASSERT(0); return 0;
}
}
/*
returns a bookmark for thd-local variables, creating if neccessary.
returns null for non thd-local variables.
......@@ -2764,39 +2780,13 @@ static st_bookmark *find_bookmark(const char *plugin, const char *name,
static st_bookmark *register_var(const char *plugin, const char *name,
int flags)
{
uint length= strlen(plugin) + strlen(name) + 3, size= 0, offset, new_size;
uint length= strlen(plugin) + strlen(name) + 3, size, offset, new_size;
st_bookmark *result;
char *varname, *p;
if (!(flags & PLUGIN_VAR_THDLOCAL))
return NULL;
switch (flags & PLUGIN_VAR_TYPEMASK) {
case PLUGIN_VAR_BOOL:
size= sizeof(my_bool);
break;
case PLUGIN_VAR_INT:
size= sizeof(int);
break;
case PLUGIN_VAR_LONG:
case PLUGIN_VAR_ENUM:
size= sizeof(long);
break;
case PLUGIN_VAR_LONGLONG:
case PLUGIN_VAR_SET:
size= sizeof(ulonglong);
break;
case PLUGIN_VAR_STR:
size= sizeof(char*);
break;
case PLUGIN_VAR_DOUBLE:
size= sizeof(double);
break;
default:
DBUG_ASSERT(0);
return NULL;
};
DBUG_ASSERT(flags & PLUGIN_VAR_THDLOCAL);
size= var_storage_size(flags);
varname= ((char*) my_alloca(length));
strxmov(varname + 1, plugin, "_", name, NullS);
for (p= varname + 1; *p; p++)
......@@ -3005,25 +2995,17 @@ void sync_dynamic_session_variables(THD* thd, bool global_lock)
*/
for (idx= 0; idx < bookmark_hash.records; idx++)
{
sys_var_pluginvar *pi;
sys_var *var;
st_bookmark *v= (st_bookmark*) my_hash_element(&bookmark_hash,idx);
if (v->version <= thd->variables.dynamic_variables_version)
continue; /* already in thd->variables */
if (!(var= intern_find_sys_var(v->key + 1, v->name_len)) ||
!(pi= var->cast_pluginvar()) ||
v->key[0] != plugin_var_bookmark_key(pi->plugin_var->flags))
continue;
/* Here we do anything special that may be required of the data types */
if ((pi->plugin_var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR &&
pi->plugin_var->flags & PLUGIN_VAR_MEMALLOC)
if ((v->key[0] & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR &&
v->key[0] & BOOKMARK_MEMALLOC)
{
int offset= ((thdvar_str_t *)(pi->plugin_var))->offset;
char **pp= (char**) (thd->variables.dynamic_variables_ptr + offset);
char **pp= (char**) (thd->variables.dynamic_variables_ptr + v->offset);
if (*pp)
*pp= my_strdup(*pp, MYF(MY_WME|MY_FAE));
}
......@@ -3284,69 +3266,58 @@ bool sys_var_pluginvar::session_update(THD *thd, set_var *var)
return false;
}
bool sys_var_pluginvar::global_update(THD *thd, set_var *var)
static const void *var_def_ptr(st_mysql_sys_var *pv)
{
DBUG_ASSERT(!is_readonly());
mysql_mutex_assert_owner(&LOCK_global_system_variables);
void *tgt= real_value_ptr(thd, var->type);
const void *src= &var->save_result;
if (!var->value)
{
switch (plugin_var->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_THDLOCAL)) {
switch (pv->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_THDLOCAL)) {
case PLUGIN_VAR_INT:
src= &((sysvar_uint_t*) plugin_var)->def_val;
break;
return &((sysvar_uint_t*) pv)->def_val;
case PLUGIN_VAR_LONG:
src= &((sysvar_ulong_t*) plugin_var)->def_val;
break;
return &((sysvar_ulong_t*) pv)->def_val;
case PLUGIN_VAR_LONGLONG:
src= &((sysvar_ulonglong_t*) plugin_var)->def_val;
break;
return &((sysvar_ulonglong_t*) pv)->def_val;
case PLUGIN_VAR_ENUM:
src= &((sysvar_enum_t*) plugin_var)->def_val;
break;
return &((sysvar_enum_t*) pv)->def_val;
case PLUGIN_VAR_SET:
src= &((sysvar_set_t*) plugin_var)->def_val;
break;
return &((sysvar_set_t*) pv)->def_val;
case PLUGIN_VAR_BOOL:
src= &((sysvar_bool_t*) plugin_var)->def_val;
break;
return &((sysvar_bool_t*) pv)->def_val;
case PLUGIN_VAR_STR:
src= &((sysvar_str_t*) plugin_var)->def_val;
break;
return &((sysvar_str_t*) pv)->def_val;
case PLUGIN_VAR_DOUBLE:
src= &((sysvar_double_t*) plugin_var)->def_val;
break;
return &((sysvar_double_t*) pv)->def_val;
case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL:
src= &((thdvar_uint_t*) plugin_var)->def_val;
break;
return &((thdvar_uint_t*) pv)->def_val;
case PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL:
src= &((thdvar_ulong_t*) plugin_var)->def_val;
break;
return &((thdvar_ulong_t*) pv)->def_val;
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL:
src= &((thdvar_ulonglong_t*) plugin_var)->def_val;
break;
return &((thdvar_ulonglong_t*) pv)->def_val;
case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL:
src= &((thdvar_enum_t*) plugin_var)->def_val;
break;
return &((thdvar_enum_t*) pv)->def_val;
case PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL:
src= &((thdvar_set_t*) plugin_var)->def_val;
break;
return &((thdvar_set_t*) pv)->def_val;
case PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL:
src= &((thdvar_bool_t*) plugin_var)->def_val;
break;
return &((thdvar_bool_t*) pv)->def_val;
case PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL:
src= &((thdvar_str_t*) plugin_var)->def_val;
break;
return &((thdvar_str_t*) pv)->def_val;
case PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL:
src= &((thdvar_double_t*) plugin_var)->def_val;
break;
return &((thdvar_double_t*) pv)->def_val;
default:
DBUG_ASSERT(0);
return NULL;
}
}
}
bool sys_var_pluginvar::global_update(THD *thd, set_var *var)
{
DBUG_ASSERT(!is_readonly());
mysql_mutex_assert_owner(&LOCK_global_system_variables);
void *tgt= real_value_ptr(thd, var->type);
const void *src= &var->save_result;
if (!var->value)
src= var_def_ptr(plugin_var);
plugin_var->update(thd, plugin_var, tgt, src);
return false;
......@@ -3713,7 +3684,18 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
*(int*)(opt + 1)= offset= v->offset;
if (opt->flags & PLUGIN_VAR_NOCMDOPT)
{
char *val= global_system_variables.dynamic_variables_ptr + offset;
if (((opt->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR) &&
(opt->flags & PLUGIN_VAR_MEMALLOC))
{
char *def_val= *(char**)var_def_ptr(opt);
*(char**)val= def_val ? my_strdup(def_val, MYF(0)) : NULL;
}
else
memcpy(val, var_def_ptr(opt), var_storage_size(opt->flags));
continue;
}
optname= (char*) memdup_root(mem_root, v->key + 1,
(optnamelen= v->name_len) + 1);
......@@ -3912,9 +3894,10 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
*str->value= strdup_root(mem_root, *str->value);
}
var= find_bookmark(plugin_name.str, o->name, o->flags);
if (o->flags & PLUGIN_VAR_NOSYSVAR)
continue;
if ((var= find_bookmark(plugin_name.str, o->name, o->flags)))
if (var)
v= new (mem_root) sys_var_pluginvar(&chain, var->key + 1, o, tmp);
else
{
......
......@@ -76,7 +76,7 @@ btr_corruption_report(
buf_block_get_zip_size(block),
BUF_PAGE_PRINT_NO_CRASH);
}
buf_page_print(buf_block_get_frame_fast(block), 0, 0);
buf_page_print(buf_nonnull_block_get_frame(block), 0, 0);
}
#ifndef UNIV_HOTBACKUP
......@@ -1077,7 +1077,7 @@ btr_get_size(
SRV_CORRUPT_TABLE_CHECK(root,
{
mtr_commit(mtr);
return(0);
return(ULINT_UNDEFINED);
});
if (flag == BTR_N_LEAF_PAGES) {
......
......@@ -469,6 +469,19 @@ innobase_is_fake_change(
THD* thd) __attribute__((unused)); /*!< in: MySQL thread handle of the user for
whom the transaction is being committed */
/** Get the list of foreign keys referencing a specified table
table.
@param thd The thread handle
@param path Path to the table
@param f_key_list[out] The list of foreign keys
@return error code or zero for success */
static
int
innobase_get_parent_fk_list(
THD* thd,
const char* path,
List<FOREIGN_KEY_INFO>* f_key_list) __attribute__((unused));
/******************************************************************//**
Maps a MySQL trx isolation level code to the InnoDB isolation level code
......@@ -10008,7 +10021,14 @@ ha_innobase::check(
prebuilt->select_lock_type = LOCK_NONE;
if (!row_check_index_for_mysql(prebuilt, index, &n_rows)) {
bool check_result
= row_check_index_for_mysql(prebuilt, index, &n_rows);
DBUG_EXECUTE_IF(
"dict_set_index_corrupted",
if (!(index->type & DICT_CLUSTERED)) {
check_result = false;
});
if (!check_result) {
innobase_format_name(
index_name, sizeof index_name,
index->name, TRUE);
......@@ -10344,6 +10364,73 @@ get_foreign_key_info(
return(pf_key_info);
}
/** Get the list of foreign keys referencing a specified table
table.
@param thd The thread handle
@param path Path to the table
@param f_key_list[out] The list of foreign keys */
static
void
fill_foreign_key_list(THD* thd,
const dict_table_t* table,
List<FOREIGN_KEY_INFO>* f_key_list)
{
ut_ad(mutex_own(&dict_sys->mutex));
for (dict_foreign_t* foreign
= UT_LIST_GET_FIRST(table->referenced_list);
foreign != NULL;
foreign = UT_LIST_GET_NEXT(referenced_list, foreign)) {
FOREIGN_KEY_INFO* pf_key_info
= get_foreign_key_info(thd, foreign);
if (pf_key_info) {
f_key_list->push_back(pf_key_info);
}
}
}
/** Get the list of foreign keys referencing a specified table
table.
@param thd The thread handle
@param path Path to the table
@param f_key_list[out] The list of foreign keys
@return error code or zero for success */
static
int
innobase_get_parent_fk_list(
THD* thd,
const char* path,
List<FOREIGN_KEY_INFO>* f_key_list)
{
ut_a(strlen(path) <= FN_REFLEN);
char norm_name[FN_REFLEN + 1];
normalize_table_name(norm_name, path);
trx_t* parent_trx = check_trx_exists(thd);
parent_trx->op_info = "getting list of referencing foreign keys";
trx_search_latch_release_if_reserved(parent_trx);
mutex_enter(&dict_sys->mutex);
dict_table_t* table
= dict_table_get_low(norm_name,
static_cast<dict_err_ignore_t>(
DICT_ERR_IGNORE_INDEX_ROOT
| DICT_ERR_IGNORE_CORRUPT));
if (!table) {
mutex_exit(&dict_sys->mutex);
return(HA_ERR_NO_SUCH_TABLE);
}
fill_foreign_key_list(thd, table, f_key_list);
mutex_exit(&dict_sys->mutex);
parent_trx->op_info = "";
return(0);
}
/*******************************************************************//**
Gets the list of foreign keys in this table.
@return always 0, that is, always succeeds */
......@@ -10392,9 +10479,6 @@ ha_innobase::get_parent_foreign_key_list(
THD* thd, /*!< in: user thread handle */
List<FOREIGN_KEY_INFO>* f_key_list) /*!< out: foreign key list */
{
FOREIGN_KEY_INFO* pf_key_info;
dict_foreign_t* foreign;
ut_a(prebuilt != NULL);
update_thd(ha_thd());
......@@ -10403,16 +10487,7 @@ ha_innobase::get_parent_foreign_key_list(
trx_search_latch_release_if_reserved(prebuilt->trx);
mutex_enter(&(dict_sys->mutex));
for (foreign = UT_LIST_GET_FIRST(prebuilt->table->referenced_list);
foreign != NULL;
foreign = UT_LIST_GET_NEXT(referenced_list, foreign)) {
pf_key_info = get_foreign_key_info(thd, foreign);
if (pf_key_info) {
f_key_list->push_back(pf_key_info);
}
}
fill_foreign_key_list(thd, prebuilt->table, f_key_list);
mutex_exit(&(dict_sys->mutex));
prebuilt->trx->op_info = "";
......@@ -12817,7 +12892,6 @@ innodb_track_changed_pages_validate(
for update function */
struct st_mysql_value* value) /*!< in: incoming bool */
{
static bool enabled_on_startup = false;
long long intbuf = 0;
if (value->val_int(value, &intbuf)) {
......@@ -12825,8 +12899,7 @@ innodb_track_changed_pages_validate(
return 1;
}
if (srv_track_changed_pages || enabled_on_startup) {
enabled_on_startup = true;
if (srv_redo_log_thread_started) {
*reinterpret_cast<ulong*>(save)
= static_cast<ulong>(intbuf);
return 0;
......
......@@ -1110,10 +1110,20 @@ buf_block_get_frame(
/*================*/
const buf_block_t* block) /*!< in: pointer to the control block */
__attribute__((pure));
# define buf_block_get_frame_fast(block) buf_block_get_frame(block)
/*********************************************************************//**
Gets a pointer to the memory frame of a block, where block is known not to be
NULL.
@return pointer to the frame */
UNIV_INLINE
buf_frame_t*
buf_nonnull_block_get_frame(
const buf_block_t* block) /*!< in: pointer to the control block */
__attribute__((pure));
#else /* UNIV_DEBUG */
# define buf_block_get_frame(block) (block ? (block)->frame : 0)
# define buf_block_get_frame_fast(block) (block)->frame
# define buf_nonnull_block_get_frame(block) ((block)->frame)
#endif /* UNIV_DEBUG */
/*********************************************************************//**
Gets the space id of a block.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment