Commit 05459903 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-5.1

into  janus.mylan:/usr/home/serg/Abk/mysql-5.1


client/mysqldump.c:
  Auto merged
mysql-test/r/mysqldump.result:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
mysql-test/t/mysqldump.test:
  Auto merged
sql/handler.cc:
  Auto merged
sql/lock.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/table.cc:
  Auto merged
sql/table.h:
  Auto merged
parents 5713d2e0 1acc3441
......@@ -2116,7 +2116,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
MYSQL_FIELD *field;
my_snprintf(buff, sizeof(buff), "show create table %s", result_table);
if (mysql_query_with_error_report(mysql, 0, buff))
if (switch_character_set_results(mysql, "binary") ||
mysql_query_with_error_report(mysql, &result, buff) ||
switch_character_set_results(mysql, default_charset))
DBUG_RETURN(0);
if (path)
......@@ -2147,7 +2150,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
check_io(sql_file);
}
result= mysql_store_result(mysql);
field= mysql_fetch_field_direct(result, 0);
if (strcmp(field->name, "View") == 0)
{
......@@ -2174,7 +2176,9 @@ static uint get_table_structure(char *table, char *db, char *table_type,
*/
my_snprintf(query_buff, sizeof(query_buff),
"SHOW FIELDS FROM %s", result_table);
if (mysql_query_with_error_report(mysql, 0, query_buff))
if (switch_character_set_results(mysql, "binary") ||
mysql_query_with_error_report(mysql, &result, query_buff) ||
switch_character_set_results(mysql, default_charset))
{
/*
View references invalid or privileged table/col/fun (err 1356),
......@@ -2192,43 +2196,50 @@ static uint get_table_structure(char *table, char *db, char *table_type,
else
my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
if ((result= mysql_store_result(mysql)))
if (mysql_num_rows(result))
{
if (mysql_num_rows(result))
if (opt_drop)
{
if (opt_drop)
{
/*
We have already dropped any table of the same name
above, so here we just drop the view.
*/
We have already dropped any table of the same name above, so
here we just drop the view.
*/
fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n",
opt_quoted_table);
check_io(sql_file);
}
fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n",
opt_quoted_table);
check_io(sql_file);
}
fprintf(sql_file, "/*!50001 CREATE TABLE %s (\n", result_table);
/*
Get first row, following loop will prepend comma - keeps
from having to know if the row being printed is last to
determine if there should be a _trailing_ comma.
*/
row= mysql_fetch_row(result);
fprintf(sql_file,
"SET @saved_cs_client = @@character_set_client;\n"
"SET character_set_client = utf8;\n"
"/*!50001 CREATE TABLE %s (\n",
result_table);
fprintf(sql_file, " %s %s", quote_name(row[0], name_buff, 0),
row[1]);
/*
Get first row, following loop will prepend comma - keeps from
having to know if the row being printed is last to determine if
there should be a _trailing_ comma.
*/
while((row= mysql_fetch_row(result)))
{
/* col name, col type */
fprintf(sql_file, ",\n %s %s",
quote_name(row[0], name_buff, 0), row[1]);
}
fprintf(sql_file, "\n) */;\n");
check_io(sql_file);
row= mysql_fetch_row(result);
fprintf(sql_file, " %s %s", quote_name(row[0], name_buff, 0),
row[1]);
while((row= mysql_fetch_row(result)))
{
/* col name, col type */
fprintf(sql_file, ",\n %s %s",
quote_name(row[0], name_buff, 0), row[1]);
}
fprintf(sql_file,
"\n) */;\n"
"SET character_set_client = @saved_cs_client;\n");
check_io(sql_file);
}
mysql_free_result(result);
if (path)
......@@ -2239,7 +2250,14 @@ static uint get_table_structure(char *table, char *db, char *table_type,
}
row= mysql_fetch_row(result);
fprintf(sql_file, "%s;\n", row[1]);
fprintf(sql_file,
"SET @saved_cs_client = @@character_set_client;\n"
"SET character_set_client = utf8;\n"
"%s;\n"
"SET character_set_client = @saved_cs_client;\n",
row[1]);
check_io(sql_file);
mysql_free_result(result);
}
......@@ -3726,11 +3744,12 @@ static int dump_all_tables_in_db(char *database)
{
DYNAMIC_STRING query;
init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
for (numrows= 0 ; (table= getTableName(1)) ; numrows++)
for (numrows= 0 ; (table= getTableName(1)) ; )
{
char *end= strmov(afterdot, table);
if (include_table(hash_key,end - hash_key))
{
numrows++;
dynstr_append_checked(&query, quote_name(table, table_buff, 1));
dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
}
......@@ -3804,6 +3823,11 @@ static my_bool dump_all_views_in_db(char *database)
char *table;
uint numrows;
char table_buff[NAME_LEN*2+3];
char hash_key[2*NAME_LEN+2]; /* "db.tablename" */
char *afterdot;
afterdot= strmov(hash_key, database);
*afterdot++= '.';
if (init_dumping(database, init_dumping_views))
return 1;
......@@ -3813,10 +3837,15 @@ static my_bool dump_all_views_in_db(char *database)
{
DYNAMIC_STRING query;
init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
for (numrows= 0 ; (table= getTableName(1)); numrows++)
for (numrows= 0 ; (table= getTableName(1)); )
{
dynstr_append_checked(&query, quote_name(table, table_buff, 1));
dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
char *end= strmov(afterdot, table);
if (include_table(hash_key,end - hash_key))
{
numrows++;
dynstr_append_checked(&query, quote_name(table, table_buff, 1));
dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
}
}
if (numrows && mysql_real_query(mysql, query.str, query.length-1))
DB_error(mysql, "when using LOCK TABLES");
......@@ -3830,7 +3859,11 @@ static my_bool dump_all_views_in_db(char *database)
/* We shall continue here, if --force was given */
}
while ((table= getTableName(0)))
get_view_structure(table, database);
{
char *end= strmov(afterdot, table);
if (include_table(hash_key, end - hash_key))
get_view_structure(table, database);
}
if (opt_xml)
{
fputs("</database>\n", md_result_file);
......
......@@ -1689,12 +1689,18 @@ DELETE FROM mysqltest2.log|
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */;
USE `mysqltest1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `log` (
`msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES (1),(0),(1);
ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
......@@ -1762,12 +1768,18 @@ ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */;
USE `mysqltest2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `log` (
`msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES (1),(0),(1);
ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
......
......@@ -1689,12 +1689,18 @@ DELETE FROM mysqltest2.log|
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */;
USE `mysqltest1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `log` (
`msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES (1),(0),(1);
ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
......@@ -1762,12 +1768,18 @@ ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */;
USE `mysqltest2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `log` (
`msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` (
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES (1),(0),(1);
ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
......
......@@ -611,3 +611,10 @@ id ev_nm ev_cnt
DROP TABLE event_log;
SET GLOBAL event_scheduler = OFF;
DROP DATABASE events_test;
SET GLOBAL event_scheduler= ON;
CREATE EVENT bug28641 ON SCHEDULE AT '2038.01.18 03:00:00'
DO BEGIN
SELECT 1;
END;|
SET GLOBAL event_scheduler= OFF;
DROP EVENT bug28641;
......@@ -37,9 +37,10 @@ log-slow-queries option_value
language option_value
character-sets-dir option_value
basedir option_value
shutdown-delay option_value
skip-stack-trace option_value
skip-innodb option_value
skip-ndbcluster option_value
loose-skip-innodb option_value
loose-skip-ndbcluster option_value
nonguarded option_value
log-output option_value
SET mysqld2.server_id = 2;
......@@ -57,9 +58,10 @@ log-slow-queries option_value
language option_value
character-sets-dir option_value
basedir option_value
shutdown-delay option_value
skip-stack-trace option_value
skip-innodb option_value
skip-ndbcluster option_value
loose-skip-innodb option_value
loose-skip-ndbcluster option_value
nonguarded option_value
log-output option_value
server_id option_value
......
......@@ -153,3 +153,25 @@ select * from mysql.general_log;
event_time user_host thread_id server_id command_type argument
TIMESTAMP USER_HOST # 1 Query drop table t1
TIMESTAMP USER_HOST # 1 Query select * from mysql.general_log
SET @old_general_log_state = @@global.general_log;
SET @old_slow_log_state = @@global.slow_query_log;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
FLUSH TABLES WITH READ LOCK;
SET GLOBAL general_log = OFF;
SET GLOBAL slow_query_log = OFF;
UNLOCK TABLES;
FLUSH TABLES WITH READ LOCK;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
UNLOCK TABLES;
SET GLOBAL READ_ONLY = ON;
SET GLOBAL general_log = OFF;
SET GLOBAL slow_query_log = OFF;
SET GLOBAL READ_ONLY = OFF;
SET GLOBAL READ_ONLY = ON;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
SET GLOBAL READ_ONLY = OFF;
SET GLOBAL general_log = @old_general_log_state;
SET GLOBAL slow_query_log = @old_slow_log_state;
This diff is collapsed.
......@@ -93,55 +93,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` (
`id` int(8) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t2` (
`id` int(8) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t3` (
`id` int(8) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t4` (
`id` int(8) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t5` (
`id` int(8) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t6` (
`id` int(8) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
......@@ -172,55 +190,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` (
`id` int(8) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t2` (
`id` int(8) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t3` (
`id` int(8) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t4` (
`id` int(8) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t5` (
`id` int(8) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t6` (
`id` int(8) DEFAULT NULL,
`name` varchar(32) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
......
This diff is collapsed.
......@@ -99,9 +99,12 @@ INSERT INTO t1 VALUES (1), (2);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
);
SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
......@@ -130,9 +133,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
);
SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
......@@ -161,9 +167,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
);
SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
......
......@@ -1850,61 +1850,57 @@ create procedure proc_1() flush tables;
flush tables;
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
mysql slow_log 0 0
mysql host 0 0
mysql user 0 0
call proc_1();
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
mysql slow_log 0 0
mysql host 0 0
mysql user 0 0
call proc_1();
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
mysql slow_log 0 0
mysql host 0 0
mysql user 0 0
call proc_1();
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
mysql slow_log 0 0
mysql host 0 0
mysql user 0 0
flush tables;
......@@ -1922,54 +1918,50 @@ select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql host 0 0
mysql user 0 0
mysql general_log 0 0
mysql host 0 0
prepare abc from "flush tables";
execute abc;
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
mysql slow_log 0 0
mysql host 0 0
mysql user 0 0
execute abc;
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
mysql slow_log 0 0
mysql host 0 0
mysql user 0 0
execute abc;
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
select Host, User from mysql.user limit 0;
Host User
select Host, Db from mysql.host limit 0;
Host Db
show open tables from mysql;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
mysql slow_log 0 0
mysql host 0 0
mysql user 0 0
flush tables;
......
......@@ -251,14 +251,13 @@ drop table t1;
flush tables;
show open tables;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
create table t1(n int);
insert into t1 values (1);
show open tables;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
mysql slow_log 0 0
test t1 0 0
drop table t1;
create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
......@@ -672,24 +671,23 @@ SELECT 1 FROM mysql.db, mysql.proc, mysql.user, mysql.time_zone, mysql.time_zone
1
SHOW OPEN TABLES;
Database Table In_use Name_locked
mysql proc 0 0
mysql db 0 0
test urkunde 0 0
mysql time_zone 0 0
mysql db 0 0
mysql general_log 0 0
test txt1 0 0
mysql slow_log 1 0
mysql proc 0 0
test tyt2 0 0
mysql general_log 1 0
mysql user 0 0
mysql time_zone_name 0 0
SHOW OPEN TABLES FROM mysql;
Database Table In_use Name_locked
mysql proc 0 0
mysql time_zone 0 0
mysql db 0 0
mysql slow_log 1 0
mysql general_log 1 0
mysql time_zone 0 0
mysql general_log 0 0
mysql slow_log 0 0
mysql user 0 0
mysql proc 0 0
mysql time_zone_name 0 0
SHOW OPEN TABLES FROM mysql LIKE 'u%';
Database Table In_use Name_locked
......@@ -702,16 +700,15 @@ test tyt2 0 0
mysql time_zone_name 0 0
SHOW OPEN TABLES LIKE '%o%';
Database Table In_use Name_locked
mysql proc 0 0
mysql time_zone 0 0
mysql slow_log 1 0
mysql general_log 1 0
mysql general_log 0 0
mysql slow_log 0 0
mysql proc 0 0
mysql time_zone_name 0 0
FLUSH TABLES;
SHOW OPEN TABLES;
Database Table In_use Name_locked
mysql general_log 1 0
mysql slow_log 1 0
mysql general_log 0 0
DROP TABLE txt1;
DROP TABLE tyt2;
DROP TABLE urkunde;
......@@ -1148,6 +1145,26 @@ DROP TABLE t1;
DROP VIEW v1;
DROP PROCEDURE p1;
DROP FUNCTION f1;
set names koi8r;
DROP DATABASE IF EXISTS mysqltest1;
CREATE DATABASE mysqltest1;
use mysqltest1;
CREATE TABLE t1(1 INT);
---> Dumping mysqltest1 to show_check.mysqltest1.sql
DROP DATABASE mysqltest1;
---> Restoring mysqltest1...
SHOW CREATE TABLE mysqltest1.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP DATABASE mysqltest1;
use test;
flush status;
show variables like "log_queries_not_using_indexes";
Variable_name Value
......
......@@ -289,4 +289,34 @@ create table t1 select f_bug22427() as i;
ERROR 42S01: Table 't1' already exists
drop table t1;
drop function f_bug22427;
#
# Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables
#
DROP table IF EXISTS t1,t2;
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c2 INT);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
BEGIN
UPDATE t2 SET c2= c2 + 1;
END//
# Take a table lock on t1.
# This should pre-lock t2 through the trigger.
LOCK TABLE t1 WRITE;
INSERT INTO t1 VALUES (3);
UNLOCK TABLES;
LOCK TABLE t1 READ;
INSERT INTO t2 values(4);
ERROR HY000: Table 't2' was not locked with LOCK TABLES
UNLOCK TABLES;
SELECT * FROM t1;
c1
1
3
SELECT * FROM t2;
c2
3
DROP TRIGGER t1_ai;
DROP TABLE t1, t2;
End of 5.0 tests
flush status;
show status like 'Table_lock%';
Variable_name Value
Table_locks_immediate 0
Table_locks_immediate 1
Table_locks_waited 0
select * from information_schema.session_status where variable_name like 'Table_lock%';
VARIABLE_NAME VARIABLE_VALUE
TABLE_LOCKS_IMMEDIATE 0
TABLE_LOCKS_IMMEDIATE 2
TABLE_LOCKS_WAITED 0
SET SQL_LOG_BIN=0;
drop table if exists t1;
......@@ -18,11 +18,11 @@ update t1 set n = 3;
unlock tables;
show status like 'Table_lock%';
Variable_name Value
Table_locks_immediate 3
Table_locks_immediate 17
Table_locks_waited 1
select * from information_schema.session_status where variable_name like 'Table_lock%';
VARIABLE_NAME VARIABLE_VALUE
TABLE_LOCKS_IMMEDIATE 3
TABLE_LOCKS_IMMEDIATE 18
TABLE_LOCKS_WAITED 1
drop table t1;
select 1;
......@@ -97,7 +97,7 @@ Variable_name Value
Com_show_status 3
show status like 'hand%write%';
Variable_name Value
Handler_write 0
Handler_write 5
show status like '%tmp%';
Variable_name Value
Created_tmp_disk_tables 0
......@@ -105,7 +105,7 @@ Created_tmp_files 0
Created_tmp_tables 0
show status like 'hand%write%';
Variable_name Value
Handler_write 0
Handler_write 7
show status like '%tmp%';
Variable_name Value
Created_tmp_disk_tables 0
......
......@@ -19,6 +19,7 @@ im_instance_conf : Bug#20294 2007-05-30 alik Instance manager tests
im_life_cycle : BUG#27851 Instance manager dies on ASSERT in ~Thread_registry() or from not being able to close a mysqld instance.
im_instance_conf : BUG#28743 Instance manager generates warnings in test suite
im_utils : BUG#28743 Instance manager generates warnings in test suite
concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences
ctype_big5 : BUG#26711 2007-06-21 Lars Test has never worked on Double Whopper
......
......@@ -722,3 +722,18 @@ let $wait_condition=
--source include/wait_condition.inc
DROP DATABASE events_test;
#
# Bug#28641 CREATE EVENT with '2038.01.18 03:00:00' let server crash.
#
SET GLOBAL event_scheduler= ON;
DELIMITER |;
CREATE EVENT bug28641 ON SCHEDULE AT '2038.01.18 03:00:00'
DO BEGIN
SELECT 1;
END;|
DELIMITER ;|
SET GLOBAL event_scheduler= OFF;
DROP EVENT bug28641;
......@@ -126,6 +126,59 @@ drop table t1;
--replace_column 1 TIMESTAMP 2 USER_HOST 3 #
select * from mysql.general_log;
#
# Bug#29129 (Resetting general_log while the GLOBAL READ LOCK is set causes
# a deadlock)
# save state
SET @old_general_log_state = @@global.general_log;
SET @old_slow_log_state = @@global.slow_query_log;
# Test ON->OFF transition under a GLOBAL READ LOCK
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
FLUSH TABLES WITH READ LOCK;
SET GLOBAL general_log = OFF;
SET GLOBAL slow_query_log = OFF;
UNLOCK TABLES;
# Test OFF->ON transition under a GLOBAL READ LOCK
FLUSH TABLES WITH READ LOCK;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
UNLOCK TABLES;
# Test ON->OFF transition under a GLOBAL READ_ONLY
SET GLOBAL READ_ONLY = ON;
SET GLOBAL general_log = OFF;
SET GLOBAL slow_query_log = OFF;
SET GLOBAL READ_ONLY = OFF;
# Test OFF->ON transition under a GLOBAL READ_ONLY
SET GLOBAL READ_ONLY = ON;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
SET GLOBAL READ_ONLY = OFF;
# Restore state
SET GLOBAL general_log = @old_general_log_state;
SET GLOBAL slow_query_log = @old_slow_log_state;
--enable_ps_protocol
#
......
This diff is collapsed.
......@@ -1698,6 +1698,63 @@ drop database mysqldump_test_db;
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug26121.sql
--remove_file $MYSQLTEST_VARDIR/tmp/bug26121.sql
###########################################################################
--echo #
--echo # Bug #30027: mysqldump does not dump views properly.
--echo #
--echo
--echo # Cleanup.
--disable_warnings
DROP DATABASE IF EXISTS mysqldump_test_db;
--enable_warnings
--echo
--echo # Create objects.
CREATE DATABASE mysqldump_test_db;
set names koi8r;
CREATE VIEW mysqldump_test_db.v2 AS SELECT 1 AS 1;
CREATE VIEW mysqldump_test_db.v1 AS SELECT 1 FROM mysqldump_test_db.v2;
set names latin1;
--echo
--echo # Dump mysqldump_test_db to bug30027.sql.
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --default-character-set=latin1 --databases mysqldump_test_db > $MYSQLTEST_VARDIR/tmp/bug30027.sql
--echo
--echo # Drop mysqldump_test_db.
DROP DATABASE mysqldump_test_db;
--echo
--echo # Restore mysqldump_test_db from bug30027.sql.
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug30027.sql
--echo
--echo # Check the view.
set names utf8;
SHOW CREATE VIEW mysqldump_test_db.v1;
SHOW CREATE VIEW mysqldump_test_db.v2;
set names latin1;
--echo
--echo # Cleanup.
DROP DATABASE mysqldump_test_db;
###########################################################################
--echo #
--echo # End of 5.1 tests
--echo #
......@@ -2018,10 +2018,17 @@ delimiter ;|
select func_1(), func_1(), func_1() from dual;
drop function func_1;
drop procedure proc_1;
# make the output deterministic:
# the order used in SHOW OPEN TABLES
# is too much implementation dependent
--disable_ps_protocol
flush tables;
select Host, User from mysql.user limit 0;
select Host, Db from mysql.host limit 0;
show open tables from mysql;
--enable_ps_protocol
prepare abc from "flush tables";
execute abc;
show open tables from mysql;
......
......@@ -438,6 +438,11 @@ drop table if exists t1;
CREATE TABLE txt1(a int);
CREATE TABLE tyt2(a int);
CREATE TABLE urkunde(a int);
# make the output deterministic:
# the order used in SHOW OPEN TABLES
# is too much implementation dependent
--disable_ps_protocol
FLUSH TABLES;
SELECT 1 FROM mysql.db, mysql.proc, mysql.user, mysql.time_zone, mysql.time_zone_name, txt1, tyt2, urkunde LIMIT 0;
SHOW OPEN TABLES;
......@@ -447,6 +452,8 @@ SHOW OPEN TABLES LIKE 't%';
SHOW OPEN TABLES LIKE '%o%';
FLUSH TABLES;
SHOW OPEN TABLES;
--enable_ps_protocol
DROP TABLE txt1;
DROP TABLE tyt2;
DROP TABLE urkunde;
......@@ -554,6 +561,10 @@ show status like 'slow_queries';
# FROM I_S.
#
#
# Part 1: check that meta-data specifies not-binary character set.
#
# Ensure that all needed objects are dropped.
--disable_warnings
......@@ -761,6 +772,59 @@ DROP VIEW v1;
DROP PROCEDURE p1;
DROP FUNCTION f1;
#
# Part 2: check that table with non-latin1 characters are dumped/restored
# correctly.
#
# Ensure that all needed objects are dropped.
set names koi8r;
--disable_warnings
DROP DATABASE IF EXISTS mysqltest1;
--enable_warnings
# Create objects.
CREATE DATABASE mysqltest1;
use mysqltest1;
CREATE TABLE t1(1 INT);
# Check:
# - Dump mysqltest1;
--echo
--echo ---> Dumping mysqltest1 to show_check.mysqltest1.sql
--exec $MYSQL_DUMP --default-character-set=latin1 --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
# - Clean mysqltest1;
--echo
--echo
DROP DATABASE mysqltest1;
# - Restore mysqltest1;
--echo
--echo
--echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
# - Check definition of the table.
SHOW CREATE TABLE mysqltest1.t1;
# Cleanup.
DROP DATABASE mysqltest1;
use test;
#
# Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored
#
......
......@@ -356,4 +356,35 @@ create table t1 select f_bug22427() as i;
drop table t1;
drop function f_bug22427;
--echo #
--echo # Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables
--echo #
--disable_warnings
DROP table IF EXISTS t1,t2;
--enable_warnings
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c2 INT);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
DELIMITER //;
CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
BEGIN
UPDATE t2 SET c2= c2 + 1;
END//
DELIMITER ;//
--echo # Take a table lock on t1.
--echo # This should pre-lock t2 through the trigger.
LOCK TABLE t1 WRITE;
INSERT INTO t1 VALUES (3);
UNLOCK TABLES;
LOCK TABLE t1 READ;
--error ER_TABLE_NOT_LOCKED
INSERT INTO t2 values(4);
UNLOCK TABLES;
SELECT * FROM t1;
SELECT * FROM t2;
DROP TRIGGER t1_ai;
DROP TABLE t1, t2;
--echo End of 5.0 tests
......@@ -63,16 +63,21 @@ CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NUL
CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
-- Create general_log if CSV is enabled.
delimiter ;;
CREATE PROCEDURE create_general_log_table() BEGIN DECLARE is_csv_enabled int DEFAULT 0; SELECT @@have_csv = 'YES' INTO is_csv_enabled; IF (is_csv_enabled) THEN CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT, thread_id INTEGER, server_id INTEGER, command_type VARCHAR(64), argument MEDIUMTEXT) engine=CSV CHARACTER SET utf8 comment='General log'; END IF; END;;
CALL create_general_log_table();;
DROP PROCEDURE create_general_log_table;;
SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT, thread_id INTEGER, server_id INTEGER, command_type VARCHAR(64), argument MEDIUMTEXT) engine=CSV CHARACTER SET utf8 comment="General log"', 'SET @dummy = 0');
CREATE PROCEDURE create_slow_log_table() BEGIN DECLARE is_csv_enabled int DEFAULT 0; SELECT @@have_csv = 'YES' INTO is_csv_enabled; IF (is_csv_enabled) THEN CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512), last_insert_id INTEGER, insert_id INTEGER, server_id INTEGER, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment='Slow log'; END IF; END;;
CALL create_slow_log_table();;
DROP PROCEDURE create_slow_log_table;;
delimiter ;
PREPARE stmt FROM @str;
EXECUTE stmt;
DROP PREPARE stmt;
-- Create slow_log if CSV is enabled.
SET @str = IF (@@have_csv = 'YES', 'CREATE TABLE IF NOT EXISTS slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512), last_insert_id INTEGER, insert_id INTEGER, server_id INTEGER, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment="Slow log"', 'SET @dummy = 0');
PREPARE stmt FROM @str;
EXECUTE stmt;
DROP PREPARE stmt;
CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
......
......@@ -403,6 +403,8 @@ void Guardian::init()
void Guardian::stop_instances()
{
static const int NUM_STOP_ATTEMPTS = 100;
Instance_map::Iterator instances_it(instance_map);
Instance *instance;
......@@ -438,7 +440,34 @@ void Guardian::stop_instances()
/* Request mysqld to stop. */
instance->kill_mysqld(SIGTERM);
bool instance_stopped= FALSE;
for (int cur_attempt= 0; cur_attempt < NUM_STOP_ATTEMPTS; ++cur_attempt)
{
if (!instance->kill_mysqld(SIGTERM))
{
instance_stopped= TRUE;
break;
}
if (!instance->is_active())
{
instance_stopped= TRUE;
break;
}
/* Sleep for 0.3 sec and check again. */
my_sleep(300000);
}
/*
Abort if we failed to stop mysqld instance. That should not happen,
but if it happened, we don't know what to do and prefer to have clear
failure with coredump.
*/
DBUG_ASSERT(instance_stopped);
instance->unlock();
}
......
......@@ -524,24 +524,17 @@ bool Instance::init(const LEX_STRING *name_arg)
/**
Complete instance options initialization.
@brief Complete instance options initialization.
SYNOPSIS
complete_initialization()
RETURN
FALSE - ok
TRUE - error
@return Error status.
@retval FALSE ok
@retval TRUE error
*/
bool Instance::complete_initialization()
{
configured= ! options.complete_initialization();
return FALSE;
/*
TODO: return actual status (from
Instance_options::complete_initialization()) here.
*/
return !configured;
}
/**************************************************************************
......@@ -644,25 +637,24 @@ bool Instance::is_mysqld_running()
/**
Start mysqld.
@brief Start mysqld.
SYNOPSIS
start_mysqld()
DESCRIPTION
Reset flags and start Instance Monitor thread, which will start mysqld.
Reset flags and start Instance Monitor thread, which will start mysqld.
MT-NOTE: instance must be locked before calling the operation.
@note Instance must be locked before calling the operation.
RETURN
FALSE - ok
TRUE - could not start instance
@return Error status code
@retval FALSE Ok
@retval TRUE Could not start instance
*/
bool Instance::start_mysqld()
{
Instance_monitor *instance_monitor;
if (!configured)
return TRUE;
/*
Prepare instance to start Instance Monitor thread.
......@@ -779,7 +771,7 @@ bool Instance::stop_mysqld()
These operations should also be used in Guardian to manage instances.
*/
void Instance::kill_mysqld(int signum)
bool Instance::kill_mysqld(int signum)
{
pid_t mysqld_pid= options.load_pid();
......@@ -788,7 +780,7 @@ void Instance::kill_mysqld(int signum)
log_info("Instance '%s': no pid file to send a signal (%d).",
(const char *) get_name()->str,
(int) signum);
return;
return TRUE;
}
log_info("Instance '%s': sending %d to %d...",
......@@ -800,7 +792,7 @@ void Instance::kill_mysqld(int signum)
{
log_info("Instance '%s': kill() failed.",
(const char *) get_name()->str);
return;
return TRUE;
}
/* Kill suceeded */
......@@ -812,6 +804,8 @@ void Instance::kill_mysqld(int signum)
/* After sucessful hard kill the pidfile need to be removed */
options.unlink_pidfile();
}
return FALSE;
}
......
......@@ -104,7 +104,7 @@ public:
bool start_mysqld();
bool stop_mysqld();
void kill_mysqld(int signo);
bool kill_mysqld(int signo);
void lock();
void unlock();
......
......@@ -156,7 +156,8 @@ int Instance_options::get_default_option(char *result, size_t result_len,
goto err;
/* +2 eats first "--" from the option string (E.g. "--datadir") */
rc= parse_output_and_get_value((char*) cmd.buffer, option_name + 2,
rc= parse_output_and_get_value((char*) cmd.buffer,
option_name + 2, strlen(option_name + 2),
result, result_len, GET_VALUE);
err:
return rc;
......@@ -194,8 +195,8 @@ bool Instance_options::fill_instance_version()
bzero(result, MAX_VERSION_LENGTH);
if (parse_output_and_get_value((char*) cmd.buffer, "Ver", result,
MAX_VERSION_LENGTH, GET_LINE))
if (parse_output_and_get_value((char*) cmd.buffer, STRING_WITH_LEN("Ver"),
result, MAX_VERSION_LENGTH, GET_LINE))
{
log_error("Failed to get version of '%s': unexpected output.",
(const char *) mysqld_path.str);
......@@ -206,8 +207,7 @@ bool Instance_options::fill_instance_version()
{
char *start;
/* chop the newline from the end of the version string */
result[strlen(result) - NEWLINE_LEN]= '\0';
/* trim leading whitespaces */
start= result;
while (my_isspace(default_charset_info, *start))
......@@ -255,7 +255,8 @@ bool Instance_options::fill_mysqld_real_path()
bzero(result, FN_REFLEN);
if (parse_output_and_get_value((char*) cmd.buffer, "Usage: ",
if (parse_output_and_get_value((char*) cmd.buffer,
STRING_WITH_LEN("Usage: "),
result, FN_REFLEN,
GET_LINE))
{
......
......@@ -17,11 +17,17 @@
#include <my_global.h>
#define GET_VALUE 1
#define GET_LINE 2
enum enum_option_type
{
GET_VALUE = 1,
GET_LINE
};
int parse_output_and_get_value(const char *command, const char *word,
char *result, size_t input_buffer_len,
uint flag);
bool parse_output_and_get_value(const char *command,
const char *option_name_str,
uint option_name_length,
char *option_value_buf,
size_t option_value_buf_size,
enum_option_type option_type);
#endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_PARSE_OUTPUT_H */
......@@ -48,11 +48,16 @@ typedef int pid_t;
#define NEWLINE "\r\n"
#define NEWLINE_LEN 2
const char CR = '\r';
const char LF = '\n';
#else /* ! __WIN__ */
#define NEWLINE "\n"
#define NEWLINE_LEN 1
const char LF = '\n';
#endif /* __WIN__ */
#endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_PORTABILITY_H */
......
......@@ -64,11 +64,14 @@ Thread_registry::~Thread_registry()
/* Check that no one uses the repository. */
pthread_mutex_lock(&LOCK_thread_registry);
if (head.next != &head)
log_error("Not all threads died properly\n");
for (Thread_info *ti= head.next; ti != &head; ti= ti->next)
{
log_error("Thread_registry: unregistered thread: %lu.",
(unsigned long) ti->thread_id);
}
/* All threads must unregister */
// Disabled assert temporarily - BUG#28030
// DBUG_ASSERT(head.next == &head);
DBUG_ASSERT(head.next == &head);
pthread_mutex_unlock(&LOCK_thread_registry);
pthread_cond_destroy(&COND_thread_registry_is_empty);
......
......@@ -979,17 +979,18 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table)
DBUG_RETURN(TRUE);
starts_null= table->field[ET_FIELD_STARTS]->is_null();
my_bool not_used= FALSE;
if (!starts_null)
{
table->field[ET_FIELD_STARTS]->get_date(&time, TIME_NO_ZERO_DATE);
starts= sec_since_epoch_TIME(&time);
starts= my_tz_OFFSET0->TIME_to_gmt_sec(&time,&not_used);
}
ends_null= table->field[ET_FIELD_ENDS]->is_null();
if (!ends_null)
{
table->field[ET_FIELD_ENDS]->get_date(&time, TIME_NO_ZERO_DATE);
ends= sec_since_epoch_TIME(&time);
ends= my_tz_OFFSET0->TIME_to_gmt_sec(&time,&not_used);
}
if (!table->field[ET_FIELD_INTERVAL_EXPR]->is_null())
......@@ -1007,7 +1008,7 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table)
if (table->field[ET_FIELD_EXECUTE_AT]->get_date(&time,
TIME_NO_ZERO_DATE))
DBUG_RETURN(TRUE);
execute_at= sec_since_epoch_TIME(&time);
execute_at= my_tz_OFFSET0->TIME_to_gmt_sec(&time,&not_used);
}
/*
......@@ -1039,7 +1040,7 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table)
{
table->field[ET_FIELD_LAST_EXECUTED]->get_date(&time,
TIME_NO_ZERO_DATE);
last_executed= sec_since_epoch_TIME(&time);
last_executed= my_tz_OFFSET0->TIME_to_gmt_sec(&time,&not_used);
}
last_executed_changed= FALSE;
......
......@@ -250,7 +250,7 @@ mysql_event_fill_row(THD *thd,
if (!et->starts_null)
{
MYSQL_TIME time;
my_tz_UTC->gmt_sec_to_TIME(&time, et->starts);
my_tz_OFFSET0->gmt_sec_to_TIME(&time, et->starts);
fields[ET_FIELD_STARTS]->set_notnull();
fields[ET_FIELD_STARTS]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
......@@ -259,7 +259,7 @@ mysql_event_fill_row(THD *thd,
if (!et->ends_null)
{
MYSQL_TIME time;
my_tz_UTC->gmt_sec_to_TIME(&time, et->ends);
my_tz_OFFSET0->gmt_sec_to_TIME(&time, et->ends);
fields[ET_FIELD_ENDS]->set_notnull();
fields[ET_FIELD_ENDS]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
......@@ -278,7 +278,7 @@ mysql_event_fill_row(THD *thd,
fields[ET_FIELD_ENDS]->set_null();
MYSQL_TIME time;
my_tz_UTC->gmt_sec_to_TIME(&time, et->execute_at);
my_tz_OFFSET0->gmt_sec_to_TIME(&time, et->execute_at);
fields[ET_FIELD_EXECUTE_AT]->set_notnull();
fields[ET_FIELD_EXECUTE_AT]->
......@@ -1004,7 +1004,7 @@ update_timing_fields_for_event(THD *thd,
if (update_last_executed)
{
MYSQL_TIME time;
my_tz_UTC->gmt_sec_to_TIME(&time, last_executed);
my_tz_OFFSET0->gmt_sec_to_TIME(&time, last_executed);
fields[ET_FIELD_LAST_EXECUTED]->set_notnull();
fields[ET_FIELD_LAST_EXECUTED]->store_time(&time,
......
......@@ -740,7 +740,7 @@ Event_queue::dump_internal_status()
printf("WOC : %s\n", waiting_on_cond? "YES":"NO");
MYSQL_TIME time;
my_tz_UTC->gmt_sec_to_TIME(&time, next_activation_at);
my_tz_OFFSET0->gmt_sec_to_TIME(&time, next_activation_at);
if (time.year != 1970)
printf("Next activation : %04d-%02d-%02d %02d:%02d:%02d\n",
time.year, time.month, time.day, time.hour, time.minute, time.second);
......
......@@ -1516,34 +1516,6 @@ THD *handler::ha_thd(void) const
}
bool handler::check_if_log_table_locking_is_allowed(uint sql_command,
ulong type, TABLE *table)
{
/*
Deny locking of the log tables, which is incompatible with
concurrent insert. The routine is not called if the table is
being locked from a logger THD (general_log_thd or slow_log_thd)
or from a privileged thread (see log.cc for details)
*/
if (table->s->log_table &&
sql_command != SQLCOM_TRUNCATE &&
sql_command != SQLCOM_ALTER_TABLE &&
!(sql_command == SQLCOM_FLUSH &&
type & REFRESH_LOG) &&
(table->reginfo.lock_type >= TL_READ_NO_INSERT))
{
/*
The check >= TL_READ_NO_INSERT denies all write locks
plus the only read lock (TL_READ_NO_INSERT itself)
*/
table->reginfo.lock_type == TL_READ_NO_INSERT ?
my_error(ER_CANT_READ_LOCK_LOG_TABLE, MYF(0)) :
my_error(ER_CANT_WRITE_LOCK_LOG_TABLE, MYF(0));
return FALSE;
}
return TRUE;
}
/** @brief
Open database-handler.
......@@ -3687,6 +3659,7 @@ int handler::ha_write_row(uchar *buf)
return 0;
}
int handler::ha_update_row(const uchar *old_data, uchar *new_data)
{
int error;
......
......@@ -1035,44 +1035,6 @@ public:
{
cached_table_flags= table_flags();
}
/*
Check whether a handler allows to lock the table.
SYNOPSIS
check_if_locking_is_allowed()
thd Handler of the thread, trying to lock the table
table Table handler to check
count Total number of tables to be locked
current Index of the current table in the list of the tables
to be locked.
system_count Pointer to the counter of system tables seen thus
far.
called_by_privileged_thread TRUE if called from a logger THD
(general_log_thd or slow_log_thd)
or by a privileged thread, which
has the right to lock log tables.
DESCRIPTION
Check whether a handler allows to lock the table. For instance,
MyISAM does not allow to lock mysql.proc along with other tables.
This limitation stems from the fact that MyISAM does not support
row-level locking and we have to add this limitation to avoid
deadlocks.
RETURN
TRUE Locking is allowed
FALSE Locking is not allowed. The error was thrown.
*/
virtual bool check_if_locking_is_allowed(uint sql_command,
ulong type, TABLE *table,
uint count, uint current,
uint *system_count,
bool called_by_privileged_thread)
{
return TRUE;
}
bool check_if_log_table_locking_is_allowed(uint sql_command,
ulong type, TABLE *table);
int ha_open(TABLE *table, const char *name, int mode, int test_if_locked);
void adjust_next_insert_id_after_explicit_value(ulonglong nr);
int update_auto_increment();
......
......@@ -116,16 +116,90 @@ static void print_lock_error(int error, const char *);
static int thr_lock_errno_to_mysql[]=
{ 0, 1, ER_LOCK_WAIT_TIMEOUT, ER_LOCK_DEADLOCK };
/**
Perform semantic checks for mysql_lock_tables.
@param thd The current thread
@param tables The tables to lock
@param count The number of tables to lock
@param flags Lock flags
@return 0 if all the check passed, non zero if a check failed.
*/
int mysql_lock_tables_check(THD *thd, TABLE **tables, uint count, uint flags)
{
bool log_table_write_query;
uint system_count;
uint i;
DBUG_ENTER("mysql_lock_tables_check");
system_count= 0;
log_table_write_query= (is_log_table_write_query(thd->lex->sql_command)
|| ((flags & MYSQL_LOCK_PERF_SCHEMA) != 0));
for (i=0 ; i<count; i++)
{
TABLE *t= tables[i];
/* Protect against 'fake' partially initialized TABLE_SHARE */
DBUG_ASSERT(t->s->table_category != TABLE_UNKNOWN_CATEGORY);
/*
Table I/O to performance schema tables is performed
only internally by the server implementation.
When a user is requesting a lock, the following
constraints are enforced:
*/
if (t->s->require_write_privileges() &&
! log_table_write_query)
{
/*
A user should not be able to prevent writes,
or hold any type of lock in a session,
since this would be a DOS attack.
*/
if ((t->reginfo.lock_type >= TL_READ_NO_INSERT)
|| (thd->lex->sql_command == SQLCOM_LOCK_TABLES))
{
my_error(ER_CANT_LOCK_LOG_TABLE, MYF(0));
DBUG_RETURN(1);
}
}
if ((t->s->table_category == TABLE_CATEGORY_SYSTEM) &&
(t->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE))
{
system_count++;
}
}
/*
Locking of system tables is restricted:
locking a mix of system and non-system tables in the same lock
is prohibited, to prevent contention.
*/
if ((system_count > 0) && (system_count < count))
{
my_error(ER_WRONG_LOCK_OF_SYSTEM_TABLE, MYF(0));
DBUG_RETURN(1);
}
DBUG_RETURN(0);
}
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
uint flags, bool *need_reopen)
{
MYSQL_LOCK *sql_lock;
TABLE *write_lock_used;
int rc;
DBUG_ENTER("mysql_lock_tables");
*need_reopen= FALSE;
if (mysql_lock_tables_check(thd, tables, count, flags))
DBUG_RETURN (NULL);
for (;;)
{
if (! (sql_lock= get_lock_data(thd, tables, count, GET_LOCK_STORE_LOCKS,
......@@ -445,7 +519,8 @@ void mysql_lock_downgrade_write(THD *thd, TABLE *table,
{
MYSQL_LOCK *locked;
TABLE *write_lock_used;
if ((locked = get_lock_data(thd,&table,1,1,&write_lock_used)))
if ((locked = get_lock_data(thd, &table, 1, GET_LOCK_UNLOCK,
&write_lock_used)))
{
for (uint i=0; i < locked->lock_count; i++)
thr_downgrade_write_lock(locked->locks[i], new_lock_type);
......@@ -704,25 +779,19 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
TABLE **to, **table_buf;
DBUG_ENTER("get_lock_data");
DBUG_ASSERT((flags == GET_LOCK_UNLOCK) || (flags == GET_LOCK_STORE_LOCKS));
DBUG_PRINT("info", ("count %d", count));
*write_lock_used=0;
uint system_count= 0;
for (i=tables=lock_count=0 ; i < count ; i++)
{
if (table_ptr[i]->s->tmp_table != NON_TRANSACTIONAL_TMP_TABLE)
TABLE *t= table_ptr[i];
if (t->s->tmp_table != NON_TRANSACTIONAL_TMP_TABLE)
{
tables+=table_ptr[i]->file->lock_count();
tables+= t->file->lock_count();
lock_count++;
}
/*
Check if we can lock the table. For some tables we cannot do that
beacause of handler-specific locking issues.
*/
if (!table_ptr[i]-> file->
check_if_locking_is_allowed(thd->lex->sql_command, thd->lex->type,
table_ptr[i], count, i, &system_count,
logger.is_privileged_thread(thd)))
DBUG_RETURN(0);
}
/*
......
This diff is collapsed.
......@@ -212,6 +212,7 @@ public:
return open(generate_name(log_name, ".log", 0, buf), LOG_NORMAL, 0,
WRITE_CACHE);
}
private:
time_t last_time;
};
......@@ -398,7 +399,7 @@ public:
const char *sql_text, uint sql_text_len)= 0;
virtual bool log_error(enum loglevel level, const char *format,
va_list args)= 0;
virtual bool log_general(time_t event_time, const char *user_host,
virtual bool log_general(THD *thd, time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
const char *sql_text, uint sql_text_len,
......@@ -412,27 +413,7 @@ int check_if_log_table(uint db_len, const char *db, uint table_name_len,
class Log_to_csv_event_handler: public Log_event_handler
{
/*
We create artificial THD for each of the logs. This is to avoid
locking issues: we don't want locks on the log tables reside in the
THD's of the query. The reason is the locking order and duration.
*/
THD *general_log_thd, *slow_log_thd;
/*
This is for the thread, which called tmp_close_log_tables. The thread
will be allowed to write-lock the log tables (as it explicitly disabled
logging). This is used for such operations as REPAIR, which require
exclusive lock on the log tables.
NOTE: there can be only one priviliged thread, as one should
lock logger with logger.lock() before calling tmp_close_log_tables().
So no other thread could get privileged status at the same time.
*/
THD *privileged_thread;
friend class LOGGER;
TABLE_LIST general_log, slow_log;
private:
bool open_log_table(uint log_type);
public:
Log_to_csv_event_handler();
......@@ -447,18 +428,13 @@ public:
const char *sql_text, uint sql_text_len);
virtual bool log_error(enum loglevel level, const char *format,
va_list args);
virtual bool log_general(time_t event_time, const char *user_host,
virtual bool log_general(THD *thd, time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
const char *sql_text, uint sql_text_len,
CHARSET_INFO *client_cs);
void tmp_close_log_tables(THD *thd);
void close_log_table(uint log_type, bool lock_in_use);
bool reopen_log_table(uint log_type);
THD* get_privileged_thread()
{
return privileged_thread;
}
CHARSET_INFO *client_cs);
int activate_log(THD *thd, uint log_type);
};
......@@ -484,7 +460,7 @@ public:
const char *sql_text, uint sql_text_len);
virtual bool log_error(enum loglevel level, const char *format,
va_list args);
virtual bool log_general(time_t event_time, const char *user_host,
virtual bool log_general(THD *thd, time_t event_time, const char *user_host,
uint user_host_len, int thread_id,
const char *command_type, uint command_type_len,
const char *sql_text, uint sql_text_len,
......@@ -499,7 +475,7 @@ public:
/* Class which manages slow, general and error log event handlers */
class LOGGER
{
pthread_mutex_t LOCK_logger;
rw_lock_t LOCK_logger;
/* flag to check whether logger mutex is initialized */
uint inited;
......@@ -519,21 +495,10 @@ public:
LOGGER() : inited(0), table_log_handler(NULL),
file_log_handler(NULL), is_log_tables_initialized(FALSE)
{}
void lock() { (void) pthread_mutex_lock(&LOCK_logger); }
void unlock() { (void) pthread_mutex_unlock(&LOCK_logger); }
void tmp_close_log_tables(THD *thd);
bool is_log_table_enabled(uint log_table_type)
{
switch (log_table_type) {
case QUERY_LOG_SLOW:
return table_log_handler && table_log_handler->slow_log.table != 0;
case QUERY_LOG_GENERAL:
return table_log_handler && table_log_handler->general_log.table != 0;
default:
DBUG_ASSERT(0);
return FALSE; /* make compiler happy */
}
}
void lock_shared() { rw_rdlock(&LOCK_logger); }
void lock_exclusive() { rw_wrlock(&LOCK_logger); }
void unlock() { rw_unlock(&LOCK_logger); }
bool is_log_table_enabled(uint log_table_type);
/*
We want to initialize all log mutexes as soon as possible,
but we cannot do it in constructor, as safe_mutex relies on
......@@ -543,20 +508,6 @@ public:
void init_base();
void init_log_tables();
bool flush_logs(THD *thd);
THD *get_general_log_thd()
{
if (table_log_handler)
return (THD *) table_log_handler->general_log_thd;
else
return NULL;
}
THD *get_slow_log_thd()
{
if (table_log_handler)
return (THD *) table_log_handler->slow_log_thd;
else
return NULL;
}
/* Perform basic logger cleanup. this will leave e.g. error log open. */
void cleanup_base();
/* Free memory. Nothing could be logged after this function is called */
......@@ -568,10 +519,6 @@ public:
bool general_log_print(THD *thd,enum enum_server_command command,
const char *format, va_list args);
void close_log_table(uint log_type, bool lock_in_use);
bool reopen_log_table(uint log_type);
bool reopen_log_tables();
/* we use this function to setup all enabled log event handlers */
int set_handlers(uint error_log_printer,
uint slow_log_printer,
......@@ -593,19 +540,6 @@ public:
return file_log_handler->get_mysql_log();
return NULL;
}
THD* get_privileged_thread()
{
if (table_log_handler)
return table_log_handler->get_privileged_thread();
else
return NULL;
}
bool is_privileged_thread(THD *thd)
{
return thd == get_general_log_thd() ||
thd == get_slow_log_thd() ||
thd == get_privileged_thread();
}
};
enum enum_binlog_format {
......
......@@ -944,6 +944,7 @@ void mysql_parse(THD *thd, const char *inBuf, uint length,
bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length);
bool is_update_query(enum enum_sql_command command);
bool is_log_table_write_query(enum enum_sql_command command);
bool alloc_query(THD *thd, const char *packet, uint packet_length);
void mysql_init_select(LEX *lex);
void mysql_reset_thd_for_next_command(THD *thd);
......@@ -1123,7 +1124,8 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
uint key_length, uint db_flags, int *error);
void release_table_share(TABLE_SHARE *share, enum release_type type);
TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update);
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
uint lock_flags);
TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT* mem,
bool *refresh, uint flags);
bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list, bool link_in);
......@@ -1231,6 +1233,11 @@ void reset_status_vars();
/* information schema */
extern LEX_STRING INFORMATION_SCHEMA_NAME;
/* log tables */
extern LEX_STRING MYSQL_SCHEMA_NAME;
extern LEX_STRING GENERAL_LOG_NAME;
extern LEX_STRING SLOW_LOG_NAME;
extern const LEX_STRING partition_keywords[];
ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name);
ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx);
......@@ -1557,6 +1564,10 @@ bool open_system_tables_for_read(THD *thd, TABLE_LIST *table_list,
void close_system_tables(THD *thd, Open_tables_state *backup);
TABLE *open_system_table_for_update(THD *thd, TABLE_LIST *one_table);
TABLE *open_performance_schema_table(THD *thd, TABLE_LIST *one_table,
Open_tables_state *backup);
void close_performance_schema_table(THD *thd, Open_tables_state *backup);
bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables, bool have_lock = FALSE);
bool close_cached_connection_tables(THD *thd, bool wait_for_refresh,
LEX_STRING *connect_string,
......@@ -1891,6 +1902,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count,
#define MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN 0x0004
#define MYSQL_OPEN_TEMPORARY_ONLY 0x0008
#define MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY 0x0010
#define MYSQL_LOCK_PERF_SCHEMA 0x0020
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
......
This diff is collapsed.
......@@ -5936,8 +5936,8 @@ ER_WARN_DEPRECATED_SYNTAX_WITH_VER
ER_CANT_WRITE_LOCK_LOG_TABLE
eng "You can't write-lock a log table. Only read access is possible"
ger "Eine Log-Tabelle kann nicht schreibgesperrt werden. Es ist ohnehin nur Lesezugriff mglich"
ER_CANT_READ_LOCK_LOG_TABLE
eng "You can't use usual read lock with log tables. Try READ LOCAL instead"
ER_CANT_LOCK_LOG_TABLE
eng "You can't use locks with log tables."
ger "Log-Tabellen knnen nicht mit normalen Lesesperren gesperrt werden. Verwenden Sie statt dessen READ LOCAL"
ER_FOREIGN_DUPLICATE_KEY 23000 S1009
eng "Upholding foreign key constraints for table '%.192s', entry '%-.192s', key %d would lead to a duplicate entry"
......
......@@ -977,7 +977,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
thd->proc_info = "Opening master dump table";
tables.lock_type = TL_WRITE;
if (!open_ltable(thd, &tables, TL_WRITE))
if (!open_ltable(thd, &tables, TL_WRITE, 0))
{
sql_print_error("create_table_from_dump: could not open created table");
goto err;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
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