mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0-rpl
into mysql.com:/users/lthalmann/bk/MERGE/mysql-5.0-merge
This commit is contained in:
@@ -129,8 +129,8 @@ static const char *mysql_universal_client_charset=
|
||||
static char *default_charset;
|
||||
static CHARSET_INFO *charset_info= &my_charset_latin1;
|
||||
const char *default_dbug_option="d:t:o,/tmp/mysqldump.trace";
|
||||
/* do we met VIEWs during tables scaning */
|
||||
my_bool was_views= 0;
|
||||
/* have we seen any VIEWs during table scanning? */
|
||||
my_bool seen_views= 0;
|
||||
|
||||
const char *compatible_mode_names[]=
|
||||
{
|
||||
@@ -1388,7 +1388,7 @@ static uint dump_routines_for_db(char *db)
|
||||
ARGS
|
||||
table - table name
|
||||
db - db name
|
||||
table_type - table type ie "InnoDB"
|
||||
table_type - table type, e.g. "MyISAM" or "InnoDB", but also "VIEW"
|
||||
ignore_flag - what we must particularly ignore - see IGNORE_ defines above
|
||||
|
||||
RETURN
|
||||
@@ -1480,13 +1480,22 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
}
|
||||
if (!opt_xml && opt_comments)
|
||||
{
|
||||
if (strcmp (table_type, "VIEW") == 0) /* view */
|
||||
fprintf(sql_file, "\n--\n-- Temporary table structure for view %s\n--\n\n",
|
||||
result_table);
|
||||
else
|
||||
fprintf(sql_file, "\n--\n-- Table structure for table %s\n--\n\n",
|
||||
result_table);
|
||||
check_io(sql_file);
|
||||
}
|
||||
if (opt_drop)
|
||||
{
|
||||
fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", opt_quoted_table);
|
||||
/*
|
||||
Even if the "table" is a view, we do a DROP TABLE here. The
|
||||
view-specific code below fills in the DROP VIEW.
|
||||
*/
|
||||
fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",
|
||||
opt_quoted_table);
|
||||
check_io(sql_file);
|
||||
}
|
||||
|
||||
@@ -1524,10 +1533,13 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
{
|
||||
if (opt_drop)
|
||||
{
|
||||
/*
|
||||
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);
|
||||
fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n",
|
||||
opt_quoted_table);
|
||||
check_io(sql_file);
|
||||
}
|
||||
|
||||
@@ -1554,7 +1566,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
}
|
||||
mysql_free_result(result);
|
||||
|
||||
was_views= 1;
|
||||
seen_views= 1;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
@@ -2053,6 +2065,12 @@ static void dump_table(char *table, char *db)
|
||||
*/
|
||||
num_fields= get_table_structure(table, db, table_type, &ignore_flag);
|
||||
|
||||
/*
|
||||
The "table" could be a view. If so, we don't do anything here.
|
||||
*/
|
||||
if (strcmp (table_type, "VIEW") == 0)
|
||||
return;
|
||||
|
||||
/* Check --no-data flag */
|
||||
if (dFlag)
|
||||
{
|
||||
@@ -2538,7 +2556,7 @@ static int dump_all_databases()
|
||||
if (dump_all_tables_in_db(row[0]))
|
||||
result=1;
|
||||
}
|
||||
if (was_views)
|
||||
if (seen_views)
|
||||
{
|
||||
if (mysql_query(sock, "SHOW DATABASES") ||
|
||||
!(tableres = mysql_store_result(sock)))
|
||||
@@ -2567,7 +2585,7 @@ static int dump_databases(char **db_names)
|
||||
if (dump_all_tables_in_db(*db))
|
||||
result=1;
|
||||
}
|
||||
if (!result && was_views)
|
||||
if (!result && seen_views)
|
||||
{
|
||||
for (db= db_names ; *db ; db++)
|
||||
{
|
||||
@@ -2741,8 +2759,6 @@ static my_bool dump_all_views_in_db(char *database)
|
||||
uint numrows;
|
||||
char table_buff[NAME_LEN*2+3];
|
||||
|
||||
if (init_dumping(database))
|
||||
return 1;
|
||||
if (opt_xml)
|
||||
print_xml_tag1(md_result_file, "", "database name=", database, "\n");
|
||||
if (lock_tables)
|
||||
@@ -2896,7 +2912,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
}
|
||||
|
||||
/* Dump each selected view */
|
||||
if (was_views)
|
||||
if (seen_views)
|
||||
{
|
||||
for (pos= dump_tables; pos < end; pos++)
|
||||
get_view_structure(*pos, db);
|
||||
@@ -3354,7 +3370,7 @@ static my_bool get_view_structure(char *table, char* db)
|
||||
|
||||
if (!opt_xml && opt_comments)
|
||||
{
|
||||
fprintf(sql_file, "\n--\n-- View structure for view %s\n--\n\n",
|
||||
fprintf(sql_file, "\n--\n-- Final view structure for view %s\n--\n\n",
|
||||
result_table);
|
||||
check_io(sql_file);
|
||||
}
|
||||
|
@@ -2570,14 +2570,14 @@ do not allow the discard. We also reserve the data dictionary latch. */
|
||||
}
|
||||
}
|
||||
funct_exit:
|
||||
trx_commit_for_mysql(trx);
|
||||
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
if (graph) {
|
||||
que_graph_free(graph);
|
||||
}
|
||||
|
||||
trx_commit_for_mysql(trx);
|
||||
|
||||
trx->op_info = "";
|
||||
|
||||
return((int) err);
|
||||
@@ -2707,10 +2707,10 @@ row_import_tablespace_for_mysql(
|
||||
}
|
||||
|
||||
funct_exit:
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
trx_commit_for_mysql(trx);
|
||||
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
trx->op_info = "";
|
||||
|
||||
return((int) err);
|
||||
@@ -3398,6 +3398,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
|
||||
}
|
||||
funct_exit:
|
||||
|
||||
trx_commit_for_mysql(trx);
|
||||
|
||||
if (locked_dictionary) {
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
}
|
||||
@@ -3408,8 +3410,6 @@ funct_exit:
|
||||
|
||||
que_graph_free(graph);
|
||||
|
||||
trx_commit_for_mysql(trx);
|
||||
|
||||
trx->op_info = "";
|
||||
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
@@ -3488,10 +3488,10 @@ loop:
|
||||
}
|
||||
}
|
||||
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
trx_commit_for_mysql(trx);
|
||||
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
trx->op_info = "";
|
||||
|
||||
return(err);
|
||||
@@ -3905,6 +3905,8 @@ row_rename_table_for_mysql(
|
||||
}
|
||||
}
|
||||
funct_exit:
|
||||
trx_commit_for_mysql(trx);
|
||||
|
||||
if (!recovering_temp_table) {
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
}
|
||||
@@ -3917,8 +3919,6 @@ funct_exit:
|
||||
mem_heap_free(heap);
|
||||
}
|
||||
|
||||
trx_commit_for_mysql(trx);
|
||||
|
||||
trx->op_info = "";
|
||||
|
||||
return((int) err);
|
||||
|
@@ -1064,11 +1064,12 @@ row_sel_try_search_shortcut(
|
||||
ut_ad(plan->pcur.latch_mode == node->latch_mode);
|
||||
|
||||
plan->n_rows_fetched++;
|
||||
ret = SEL_FOUND;
|
||||
func_exit:
|
||||
if (UNIV_LIKELY_NULL(heap)) {
|
||||
mem_heap_free(heap);
|
||||
}
|
||||
return(SEL_FOUND);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|
@@ -1458,7 +1458,6 @@ UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
|
||||
DROP TABLE IF EXISTS `v2`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
/*!50001 DROP TABLE IF EXISTS `v2`*/;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` varchar(30)
|
||||
) */;
|
||||
@@ -1764,7 +1763,6 @@ UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
DROP TABLE IF EXISTS `v1`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
/*!50001 DROP TABLE IF EXISTS `v1`*/;
|
||||
/*!50001 CREATE TABLE `v1` (
|
||||
`a` int(11)
|
||||
) */;
|
||||
@@ -1822,7 +1820,6 @@ UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
|
||||
DROP TABLE IF EXISTS `v2`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
/*!50001 DROP TABLE IF EXISTS `v2`*/;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` varchar(30)
|
||||
) */;
|
||||
@@ -1915,7 +1912,6 @@ UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
DROP TABLE IF EXISTS `v1`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
/*!50001 DROP TABLE IF EXISTS `v1`*/;
|
||||
/*!50001 CREATE TABLE `v1` (
|
||||
`a` int(11),
|
||||
`b` int(11),
|
||||
@@ -1923,13 +1919,11 @@ DROP TABLE IF EXISTS `v1`;
|
||||
) */;
|
||||
DROP TABLE IF EXISTS `v2`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
/*!50001 DROP TABLE IF EXISTS `v2`*/;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` int(11)
|
||||
) */;
|
||||
DROP TABLE IF EXISTS `v3`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v3`*/;
|
||||
/*!50001 DROP TABLE IF EXISTS `v3`*/;
|
||||
/*!50001 CREATE TABLE `v3` (
|
||||
`a` int(11),
|
||||
`b` int(11),
|
||||
@@ -2490,7 +2484,6 @@ UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
DROP TABLE IF EXISTS `v0`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v0`*/;
|
||||
/*!50001 DROP TABLE IF EXISTS `v0`*/;
|
||||
/*!50001 CREATE TABLE `v0` (
|
||||
`a` int(11),
|
||||
`b` varchar(32),
|
||||
@@ -2498,7 +2491,6 @@ DROP TABLE IF EXISTS `v0`;
|
||||
) */;
|
||||
DROP TABLE IF EXISTS `v1`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
/*!50001 DROP TABLE IF EXISTS `v1`*/;
|
||||
/*!50001 CREATE TABLE `v1` (
|
||||
`a` int(11),
|
||||
`b` varchar(32),
|
||||
@@ -2506,16 +2498,11 @@ DROP TABLE IF EXISTS `v1`;
|
||||
) */;
|
||||
DROP TABLE IF EXISTS `v2`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
/*!50001 DROP TABLE IF EXISTS `v2`*/;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` int(11),
|
||||
`b` varchar(32),
|
||||
`c` varchar(32)
|
||||
) */;
|
||||
|
||||
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
|
||||
|
||||
USE `test`;
|
||||
/*!50001 DROP TABLE IF EXISTS `v0`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v0`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
@@ -2770,3 +2757,61 @@ p CREATE DEFINER=`root`@`localhost` PROCEDURE `p`()
|
||||
select 42
|
||||
drop function f;
|
||||
drop procedure p;
|
||||
drop database if exists test;
|
||||
create database test;
|
||||
use test;
|
||||
create table t1 (id int);
|
||||
create view v1 as select * from t1;
|
||||
insert into t1 values (1232131);
|
||||
insert into t1 values (4711);
|
||||
insert into t1 values (3231);
|
||||
insert into t1 values (0815);
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
/*!40000 DROP DATABASE IF EXISTS `test`*/;
|
||||
|
||||
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
|
||||
|
||||
USE `test`;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES (1232131),(4711),(3231),(815);
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
DROP TABLE IF EXISTS `v1`;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
/*!50001 CREATE TABLE `v1` (
|
||||
`id` int(11)
|
||||
) */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v1`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v1` AS select `t1`.`id` AS `id` from `t1` */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
drop view v1;
|
||||
|
46
mysql-test/r/ndb_loaddatalocal.result
Normal file
46
mysql-test/r/ndb_loaddatalocal.result
Normal file
@@ -0,0 +1,46 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1(a int) engine=myisam;
|
||||
select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
|
||||
drop table t1;
|
||||
create table t1(a int) engine=ndb;
|
||||
load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
10000
|
||||
drop table t1;
|
||||
create table t1(a int) engine=myisam;
|
||||
insert into t1 values (1), (2), (2), (3);
|
||||
select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
|
||||
drop table t1;
|
||||
create table t1(a int primary key) engine=ndb;
|
||||
load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
drop table t1;
|
||||
create table t1(a int) engine=myisam;
|
||||
insert into t1 values (1), (1), (2), (3);
|
||||
select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
|
||||
drop table t1;
|
||||
create table t1(a int primary key) engine=ndb;
|
||||
load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
drop table t1;
|
||||
create table t1(a int) engine=myisam;
|
||||
insert into t1 values (1), (2), (3), (3);
|
||||
select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
|
||||
drop table t1;
|
||||
create table t1(a int primary key) engine=ndb;
|
||||
load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
drop table t1;
|
47
mysql-test/r/rpl_auto_increment_11932.result
Normal file
47
mysql-test/r/rpl_auto_increment_11932.result
Normal file
@@ -0,0 +1,47 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
drop database if exists test1;
|
||||
create database test1;
|
||||
use test1;
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`fname` varchar(100) default NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
|
||||
INSERT INTO `t1` VALUES (1, 'blablabla');
|
||||
CREATE TABLE `t2` (
|
||||
`id` int(10) NOT NULL auto_increment,
|
||||
`comment` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=3 ;
|
||||
INSERT INTO `t2` VALUES (1, 'testtest 1');
|
||||
INSERT INTO `t2` VALUES (2, 'test 2');
|
||||
CREATE PROCEDURE simpleproc3 ()
|
||||
NOT DETERMINISTIC
|
||||
BEGIN
|
||||
INSERT INTO t1 (fname) (SELECT t2.comment FROM t2 WHERE t2.id = '1');
|
||||
INSERT INTO t1 (fname) VALUES('test');
|
||||
END
|
||||
$
|
||||
CALL simpleproc3();
|
||||
select * from t2;
|
||||
id comment
|
||||
1 testtest 1
|
||||
2 test 2
|
||||
TRUNCATE TABLE `t1`;
|
||||
CALL simpleproc3();
|
||||
select * from t1;
|
||||
id fname
|
||||
1 testtest 1
|
||||
2 test
|
||||
use test1;
|
||||
select * from t1;
|
||||
id fname
|
||||
1 testtest 1
|
||||
2 test
|
||||
drop database test1;
|
||||
drop database test1;
|
@@ -485,6 +485,10 @@ set sql_mode=2097152;
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
STRICT_TRANS_TABLES
|
||||
set sql_mode=4194304;
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
STRICT_ALL_TABLES
|
||||
set sql_mode=16384+(65536*4);
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
|
@@ -2196,3 +2196,16 @@ drop table t2, t1;
|
||||
#
|
||||
--error ER_TABLE_CANT_HANDLE_SPKEYS
|
||||
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
|
||||
|
||||
#######################################################################
|
||||
# #
|
||||
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
|
||||
# These files are to be modified ONLY BY INNOBASE guys. #
|
||||
# #
|
||||
# Use innodb_mysql.[test|result] files instead. #
|
||||
# #
|
||||
# If nevertheless you need to make some changes here, please, forward #
|
||||
# your commit message To: dev@innodb.com Cc: dev-innodb@mysql.com #
|
||||
# (otherwise your changes may be erased). #
|
||||
# #
|
||||
#######################################################################
|
||||
|
@@ -1161,3 +1161,19 @@ show create procedure p;
|
||||
drop function f;
|
||||
drop procedure p;
|
||||
|
||||
#
|
||||
# BUG#17201 Spurious 'DROP DATABASE' in output,
|
||||
# also confusion between tables and views.
|
||||
# Example code from Markus Popp
|
||||
|
||||
drop database if exists test;
|
||||
create database test;
|
||||
use test;
|
||||
create table t1 (id int);
|
||||
create view v1 as select * from t1;
|
||||
insert into t1 values (1232131);
|
||||
insert into t1 values (4711);
|
||||
insert into t1 values (3231);
|
||||
insert into t1 values (0815);
|
||||
--exec $MYSQL_DUMP --skip-comments --add-drop-database --databases test
|
||||
drop view v1;
|
||||
|
70
mysql-test/t/ndb_loaddatalocal.test
Normal file
70
mysql-test/t/ndb_loaddatalocal.test
Normal file
@@ -0,0 +1,70 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(a int) engine=myisam;
|
||||
let $1=10000;
|
||||
disable_query_log;
|
||||
set SQL_LOG_BIN=0;
|
||||
while ($1)
|
||||
{
|
||||
insert into t1 values(1);
|
||||
dec $1;
|
||||
}
|
||||
set SQL_LOG_BIN=1;
|
||||
enable_query_log;
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
|
||||
#This will generate a 20KB file, now test LOAD DATA LOCAL
|
||||
drop table t1;
|
||||
|
||||
create table t1(a int) engine=ndb;
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
|
||||
select count(*) from t1;
|
||||
system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile ;
|
||||
drop table t1;
|
||||
|
||||
create table t1(a int) engine=myisam;
|
||||
insert into t1 values (1), (2), (2), (3);
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1(a int primary key) engine=ndb;
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
|
||||
system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
|
||||
select * from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
create table t1(a int) engine=myisam;
|
||||
insert into t1 values (1), (1), (2), (3);
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1(a int primary key) engine=ndb;
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
|
||||
system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
|
||||
select * from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
create table t1(a int) engine=myisam;
|
||||
insert into t1 values (1), (2), (3), (3);
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1(a int primary key) engine=ndb;
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
|
||||
system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
|
||||
select * from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
63
mysql-test/t/rpl_auto_increment_11932.test
Normal file
63
mysql-test/t/rpl_auto_increment_11932.test
Normal file
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# Test of auto_increment
|
||||
# BUG#11932
|
||||
#
|
||||
# Bug reported that master and slave get out of sync after TRUNCATE
|
||||
# TABLE.
|
||||
#
|
||||
# Test supplied by Are Casilla
|
||||
|
||||
source include/master-slave.inc;
|
||||
--disable_warnings
|
||||
connection master;
|
||||
drop database if exists test1;
|
||||
--enable_warnings
|
||||
create database test1;
|
||||
use test1;
|
||||
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`fname` varchar(100) default NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
|
||||
|
||||
INSERT INTO `t1` VALUES (1, 'blablabla');
|
||||
|
||||
CREATE TABLE `t2` (
|
||||
`id` int(10) NOT NULL auto_increment,
|
||||
`comment` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=3 ;
|
||||
|
||||
INSERT INTO `t2` VALUES (1, 'testtest 1');
|
||||
INSERT INTO `t2` VALUES (2, 'test 2');
|
||||
|
||||
DELIMITER $;
|
||||
CREATE PROCEDURE simpleproc3 ()
|
||||
NOT DETERMINISTIC
|
||||
BEGIN
|
||||
INSERT INTO t1 (fname) (SELECT t2.comment FROM t2 WHERE t2.id = '1');
|
||||
INSERT INTO t1 (fname) VALUES('test');
|
||||
END
|
||||
$
|
||||
DELIMITER ;$
|
||||
|
||||
CALL simpleproc3();
|
||||
|
||||
select * from t2;
|
||||
|
||||
TRUNCATE TABLE `t1`;
|
||||
CALL simpleproc3();
|
||||
|
||||
select * from t1;
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
|
||||
use test1;
|
||||
select * from t1;
|
||||
|
||||
drop database test1;
|
||||
connection master;
|
||||
drop database test1;
|
@@ -258,6 +258,9 @@ drop table t1, t2;
|
||||
select @@sql_mode;
|
||||
set sql_mode=2097152;
|
||||
select @@sql_mode;
|
||||
# BUG#14675
|
||||
set sql_mode=4194304;
|
||||
select @@sql_mode;
|
||||
set sql_mode=16384+(65536*4);
|
||||
select @@sql_mode;
|
||||
--error 1231
|
||||
|
@@ -2133,6 +2133,11 @@ int ha_ndbcluster::write_row(byte *record)
|
||||
*/
|
||||
if (!m_use_write && m_ignore_dup_key)
|
||||
{
|
||||
/*
|
||||
compare if expression with that in start_bulk_insert()
|
||||
start_bulk_insert will set parameters to ensure that each
|
||||
write_row is committed individually
|
||||
*/
|
||||
int peek_res= peek_indexed_rows(record);
|
||||
|
||||
if (!peek_res)
|
||||
@@ -3270,6 +3275,19 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows)
|
||||
DBUG_PRINT("enter", ("rows: %d", (int)rows));
|
||||
|
||||
m_rows_inserted= (ha_rows) 0;
|
||||
if (!m_use_write && m_ignore_dup_key)
|
||||
{
|
||||
/*
|
||||
compare if expression with that in write_row
|
||||
we have a situation where peek_indexed_rows() will be called
|
||||
so we cannot batch
|
||||
*/
|
||||
DBUG_PRINT("info", ("Batching turned off as duplicate key is "
|
||||
"ignored by using peek_row"));
|
||||
m_rows_to_insert= 1;
|
||||
m_bulk_insert_rows= 1;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
if (rows == (ha_rows) 0)
|
||||
{
|
||||
/* We don't know how many will be inserted, guess */
|
||||
@@ -4467,6 +4485,7 @@ int ha_ndbcluster::delete_table(const char *name)
|
||||
|
||||
int ha_ndbcluster::drop_table()
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
Ndb *ndb= get_ndb();
|
||||
NdbDictionary::Dictionary *dict= ndb->getDictionary();
|
||||
|
||||
@@ -4474,8 +4493,21 @@ int ha_ndbcluster::drop_table()
|
||||
DBUG_PRINT("enter", ("Deleting %s", m_tabname));
|
||||
|
||||
release_metadata();
|
||||
if (dict->dropTable(m_tabname))
|
||||
while (dict->dropTable(m_tabname))
|
||||
{
|
||||
const NdbError err= dict->getNdbError();
|
||||
switch (err.status)
|
||||
{
|
||||
case NdbError::TemporaryError:
|
||||
if (!thd->killed)
|
||||
continue; // retry indefinitly
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ERR_RETURN(dict->getNdbError());
|
||||
}
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
@@ -4884,14 +4916,24 @@ int ndbcluster_drop_database(const char *path)
|
||||
List_iterator_fast<char> it(drop_list);
|
||||
while ((tabname=it++))
|
||||
{
|
||||
if (dict->dropTable(tabname))
|
||||
while (dict->dropTable(tabname))
|
||||
{
|
||||
const NdbError err= dict->getNdbError();
|
||||
if (err.code != 709)
|
||||
switch (err.status)
|
||||
{
|
||||
case NdbError::TemporaryError:
|
||||
if (!thd->killed)
|
||||
continue; // retry indefinitly
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (err.code != 709) // 709: No such table existed
|
||||
{
|
||||
ERR_PRINT(err);
|
||||
ret= ndb_to_mysql_error(&err);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(ret);
|
||||
|
Reference in New Issue
Block a user