Commit 50440fb3 authored by jonas@perch.ndb.mysql.com's avatar jonas@perch.ndb.mysql.com

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

into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new
parents dca8afa9 a4eb61b8
...@@ -2910,7 +2910,7 @@ static int init_dumping(char *database) ...@@ -2910,7 +2910,7 @@ static int init_dumping(char *database)
/* /*
length of table name * 2 (if name contains quotes), 2 quotes and 0 length of table name * 2 (if name contains quotes), 2 quotes and 0
*/ */
char quoted_database_buf[64*2+3]; char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted); char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
if (opt_comments) if (opt_comments)
{ {
...@@ -3067,7 +3067,18 @@ static my_bool dump_all_views_in_db(char *database) ...@@ -3067,7 +3067,18 @@ static my_bool dump_all_views_in_db(char *database)
DB_error(sock, "when selecting the database"); DB_error(sock, "when selecting the database");
return 1; return 1;
} }
if (opt_databases || opt_alldbs)
{
char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
if (opt_comments)
{
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
check_io(md_result_file);
}
fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
check_io(md_result_file);
}
if (opt_xml) if (opt_xml)
print_xml_tag1(md_result_file, "", "database name=", database, "\n"); print_xml_tag1(md_result_file, "", "database name=", database, "\n");
if (lock_tables) if (lock_tables)
...@@ -3526,7 +3537,7 @@ static char *primary_key_fields(const char *table_name) ...@@ -3526,7 +3537,7 @@ static char *primary_key_fields(const char *table_name)
MYSQL_RES *res = NULL; MYSQL_RES *res = NULL;
MYSQL_ROW row; MYSQL_ROW row;
/* SHOW KEYS FROM + table name * 2 (escaped) + 2 quotes + \0 */ /* SHOW KEYS FROM + table name * 2 (escaped) + 2 quotes + \0 */
char show_keys_buff[15 + 64 * 2 + 3]; char show_keys_buff[15 + NAME_LEN * 2 + 3];
uint result_length = 0; uint result_length = 0;
char *result = 0; char *result = 0;
......
This diff is collapsed.
--require r/true.require --require r/not_ndb_default.require
disable_query_log; disable_query_log;
select convert(@@table_type using latin1) NOT IN ("ndbcluster","NDBCLUSTER") as "TRUE"; select convert(@@table_type using latin1) NOT IN ("ndbcluster","NDBCLUSTER") as "TRUE";
enable_query_log; enable_query_log;
--require r/true.require --require r/not_windows.require
disable_query_log; disable_query_log;
select convert(@@version_compile_os using latin1) NOT IN ("Win32","Win64","Windows") as "TRUE"; select convert(@@version_compile_os using latin1) NOT IN ("Win32","Win64","Windows") as "TRUE";
enable_query_log; enable_query_log;
#
# Include this script to wait until the connection to the
# server has been restored or timeout occurs
--disable_result_log
--disable_query_log
let $counter= 100;
while ($mysql_errno)
{
--error 0,2002,2006
show status;
dec $counter;
if (!$counter)
{
--die Server failed to restart
}
--sleep 0.1
}
--enable_query_log
--enable_result_log
--require r/true.require --require r/windows.require
disable_query_log; disable_query_log;
select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") as "TRUE"; select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") as "TRUE";
enable_query_log; enable_query_log;
...@@ -11,6 +11,7 @@ sub mtr_get_opts_from_file ($); ...@@ -11,6 +11,7 @@ sub mtr_get_opts_from_file ($);
sub mtr_fromfile ($); sub mtr_fromfile ($);
sub mtr_tofile ($@); sub mtr_tofile ($@);
sub mtr_tonewfile($@); sub mtr_tonewfile($@);
sub mtr_lastlinefromfile($);
############################################################################## ##############################################################################
# #
...@@ -113,6 +114,20 @@ sub mtr_fromfile ($) { ...@@ -113,6 +114,20 @@ sub mtr_fromfile ($) {
return $text; return $text;
} }
sub mtr_lastlinefromfile ($) {
my $file= shift;
my $text;
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
while (my $line= <FILE>)
{
$text= $line;
}
close FILE;
return $text;
}
sub mtr_tofile ($@) { sub mtr_tofile ($@) {
my $file= shift; my $file= shift;
...@@ -129,5 +144,4 @@ sub mtr_tonewfile ($@) { ...@@ -129,5 +144,4 @@ sub mtr_tonewfile ($@) {
close FILE; close FILE;
} }
1; 1;
...@@ -272,10 +272,10 @@ sub spawn_parent_impl { ...@@ -272,10 +272,10 @@ sub spawn_parent_impl {
last; last;
} }
# If one of the processes died, we want to # One of the child processes died, unless this was expected
# mark this, and kill the mysqltest process. # mysqltest should be killed and test aborted
mark_process_dead($ret_pid); check_expected_crash_and_restart($ret_pid);
} }
if ( $ret_pid != $pid ) if ( $ret_pid != $pid )
...@@ -811,6 +811,81 @@ sub mark_process_dead($) ...@@ -811,6 +811,81 @@ sub mark_process_dead($)
} }
#
# Loop through our list of processes and look for and entry
# with the provided pid, if found check for the file indicating
# expected crash and restart it.
#
sub check_expected_crash_and_restart($)
{
my $ret_pid= shift;
foreach my $mysqld (@{$::master}, @{$::slave})
{
if ( $mysqld->{'pid'} eq $ret_pid )
{
mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid");
$mysqld->{'pid'}= 0;
# Check if crash expected and restart if it was
my $expect_file= "$::opt_vardir/tmp/" . "$mysqld->{'type'}" .
"$mysqld->{'idx'}" . ".expect";
if ( -f $expect_file )
{
mtr_verbose("Crash was expected, file $expect_file exists");
mysqld_start($mysqld, $mysqld->{'start_opts'},
$mysqld->{'start_slave_master_info'});
unlink($expect_file);
}
return;
}
}
foreach my $cluster (@{$::clusters})
{
if ( $cluster->{'pid'} eq $ret_pid )
{
mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid");
$cluster->{'pid'}= 0;
# Check if crash expected and restart if it was
my $expect_file= "$::opt_vardir/tmp/ndb_mgmd_" . "$cluster->{'type'}" .
".expect";
if ( -f $expect_file )
{
mtr_verbose("Crash was expected, file $expect_file exists");
ndbmgmd_start($cluster);
unlink($expect_file);
}
return;
}
foreach my $ndbd (@{$cluster->{'ndbds'}})
{
if ( $ndbd->{'pid'} eq $ret_pid )
{
mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid");
$ndbd->{'pid'}= 0;
# Check if crash expected and restart if it was
my $expect_file= "$::opt_vardir/tmp/ndbd_" . "$cluster->{'type'}" .
"$ndbd->{'idx'}" . ".expect";
if ( -f $expect_file )
{
mtr_verbose("Crash was expected, file $expect_file exists");
ndbd_start($cluster, $ndbd->{'idx'},
$ndbd->{'start_extra_args'});
unlink($expect_file);
}
return;
}
}
}
mtr_warning("check_expected_crash_and_restart couldn't find an entry for pid: $ret_pid");
}
############################################################################## ##############################################################################
# #
# The operating system will keep information about dead children, # The operating system will keep information about dead children,
......
...@@ -1806,6 +1806,10 @@ sub ndbd_start ($$$) { ...@@ -1806,6 +1806,10 @@ sub ndbd_start ($$$) {
# Add pid to list of pids for this cluster # Add pid to list of pids for this cluster
$cluster->{'ndbds'}->[$idx]->{'pid'}= $pid; $cluster->{'ndbds'}->[$idx]->{'pid'}= $pid;
# Rememeber options used when starting
$cluster->{'ndbds'}->[$idx]->{'start_extra_args'}= $extra_args;
$cluster->{'ndbds'}->[$idx]->{'idx'}= $idx;
mtr_verbose("ndbd_start, pid: $pid"); mtr_verbose("ndbd_start, pid: $pid");
return $pid; return $pid;
...@@ -2343,8 +2347,11 @@ sub run_testcase ($) { ...@@ -2343,8 +2347,11 @@ sub run_testcase ($) {
elsif ( $res == 62 ) elsif ( $res == 62 )
{ {
# Testcase itself tell us to skip this one # Testcase itself tell us to skip this one
# FIXME get reason to skip from mysqltest
$tinfo->{'comment'}= "Detected by testcase"; # Try to get reason from mysqltest.log
my $last_line= mtr_lastlinefromfile($path_timefile) if -f $path_timefile;
my $reason= mtr_match_prefix($last_line, "reason: ");
$tinfo->{'comment'}= defined $reason ? $reason : "Detected by testcase(reason unknown) ";
mtr_report_test_skipped($tinfo); mtr_report_test_skipped($tinfo);
} }
elsif ( $res == 63 ) elsif ( $res == 63 )
...@@ -2904,6 +2911,7 @@ sub mysqld_start ($$$) { ...@@ -2904,6 +2911,7 @@ sub mysqld_start ($$$) {
# Remember options used when starting # Remember options used when starting
$mysqld->{'start_opts'}= $extra_opt; $mysqld->{'start_opts'}= $extra_opt;
$mysqld->{'start_slave_master_info'}= $slave_master_info;
mtr_verbose("mysqld pid: $pid"); mtr_verbose("mysqld pid: $pid");
return $pid; return $pid;
......
CREATE TABLE t1(a int) engine=innodb;
START TRANSACTION;
insert into t1 values(9);
SET SESSION debug="d,crash_commit_before";
COMMIT;
ERROR HY000: Lost connection to MySQL server during query
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t1;
a
...@@ -695,3 +695,103 @@ CREATE TABLE t2 (z int, y int); ...@@ -695,3 +695,103 @@ CREATE TABLE t2 (z int, y int);
CREATE TABLE t3 (a int, b int); CREATE TABLE t3 (a int, b int);
INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1); INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
DROP TABLE IF EXISTS t1,t2,t3; DROP TABLE IF EXISTS t1,t2,t3;
CREATE DATABASE meow;
CREATE TABLE table_target ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
CREATE TABLE table_target2 ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
CREATE TABLE table_target3 ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
CREATE VIEW view_target2 AS SELECT mexs_id,messzeit FROM table_target2;
CREATE SQL SECURITY INVOKER VIEW view_target3 AS SELECT mexs_id,messzeit FROM table_target3;
CREATE TABLE table_stations ( mexs_id VARCHAR(8), icao VARCHAR(4), country CHAR(2), PRIMARY KEY (mexs_id), UNIQUE KEY icao (icao), KEY country (country), CONSTRAINT stations_ibfk_8 FOREIGN KEY (country) REFERENCES countries (country) ON UPDATE CASCADE);
INSERT INTO table_stations VALUES ('87654321','XXXX','YY');
CREATE TABLE table_countries ( country CHAR(2), iso_short_en VARCHAR(64), PRIMARY KEY (country));
INSERT INTO table_countries VALUES ('YY','Entenhausen');
CREATE ALGORITHM=MERGE SQL SECURITY INVOKER VIEW view_stations AS select table_stations.mexs_id AS mexs_id, table_stations.icao AS icao, table_stations.country AS landescode from (table_stations join table_countries on((table_stations.country = table_countries.country)));
CREATE TABLE table_source ( id varchar(4), datetime TIMESTAMP, PRIMARY KEY (id));
INSERT INTO table_source VALUES ('XXXX','2006-07-12 07:50:00');
GRANT SELECT ON table_source TO user20989@localhost;
GRANT SELECT ON table_countries TO user20989@localhost;
GRANT SELECT ON table_stations TO user20989@localhost;
GRANT SELECT ON view_stations TO user20989@localhost;
GRANT SELECT ON table_target TO user20989@localhost;
GRANT SELECT ON table_target2 TO user20989@localhost;
GRANT INSERT,DELETE,SELECT ON view_target3 TO user20989@localhost;
REPLACE INTO table_target
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN table_target AS old
USING (mexs_id);
ERROR 42000: INSERT,DELETE command denied to user 'user20989'@'localhost' for table 'table_target'
REPLACE INTO view_target2
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN view_target2 AS old
USING (mexs_id);
ERROR 42000: INSERT,DELETE command denied to user 'user20989'@'localhost' for table 'view_target2'
REPLACE INTO view_target3
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN view_target3 AS old
USING (mexs_id);
ERROR HY000: View 'meow.view_target3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
GRANT INSERT,DELETE ON table_target TO user20989@localhost;
GRANT INSERT,DELETE,SELECT ON view_target2 TO user20989@localhost;
GRANT INSERT,DELETE,SELECT ON table_target3 TO user20989@localhost;
REPLACE INTO table_target
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN table_target AS old
USING (mexs_id);
REPLACE INTO table_target2 VALUES ('00X45Y78','2006-07-12 07:50:00');
ERROR 42000: INSERT,DELETE command denied to user 'user20989'@'localhost' for table 'table_target2'
REPLACE INTO view_target2 VALUES ('12X45Y78','2006-07-12 07:50:00');
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN view_target2 AS old
USING (mexs_id);
mexs_id messzeit
87654321 2006-07-12 07:50:00
REPLACE INTO view_target2
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN view_target2 AS old
USING (mexs_id);
REPLACE INTO view_target3
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN view_target3 AS old
USING (mexs_id);
SELECT * FROM table_target;
mexs_id messzeit
87654321 2006-07-12 07:50:00
SELECT * FROM view_target2;
mexs_id messzeit
12X45Y78 2006-07-12 07:50:00
87654321 2006-07-12 07:50:00
SELECT * FROM view_target3;
mexs_id messzeit
87654321 2006-07-12 07:50:00
DROP VIEW view_stations;
DROP TABLE table_source;
DROP TABLE table_countries;
DROP TABLE table_stations;
DROP TABLE table_target;
DROP TABLE table_target2;
DROP TABLE table_target3;
DROP VIEW view_target2;
DROP VIEW view_target3;
DROP USER user20989@localhost;
DROP DATABASE meow;
...@@ -2574,6 +2574,8 @@ DROP TABLE IF EXISTS `v2`; ...@@ -2574,6 +2574,8 @@ DROP TABLE IF EXISTS `v2`;
`b` varchar(32), `b` varchar(32),
`c` varchar(32) `c` varchar(32)
) */; ) */;
USE `test`;
/*!50001 DROP TABLE IF EXISTS `v0`*/; /*!50001 DROP TABLE IF EXISTS `v0`*/;
/*!50001 DROP VIEW IF EXISTS `v0`*/; /*!50001 DROP VIEW IF EXISTS `v0`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
...@@ -2827,6 +2829,8 @@ DROP TABLE IF EXISTS `v1`; ...@@ -2827,6 +2829,8 @@ DROP TABLE IF EXISTS `v1`;
/*!50001 CREATE TABLE `v1` ( /*!50001 CREATE TABLE `v1` (
`id` int(11) `id` int(11)
) */; ) */;
USE `mysqldump_test_db`;
/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
...@@ -2852,59 +2856,63 @@ create database mysqldump_views; ...@@ -2852,59 +2856,63 @@ create database mysqldump_views;
use mysqldump_views; use mysqldump_views;
create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable; create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable;
/*!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 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `mysqldump_tables`; USE `mysqldump_tables`;
DROP TABLE IF EXISTS `basetable`;
CREATE TABLE `basetable` ( CREATE TABLE `basetable` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`tag` varchar(64) DEFAULT NULL, `tag` varchar(64) DEFAULT NULL,
UNIQUE KEY `id` (`id`) UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `basetable` WRITE;
/*!40000 ALTER TABLE `basetable` DISABLE KEYS */;
/*!40000 ALTER TABLE `basetable` ENABLE KEYS */;
UNLOCK TABLES;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `mysqldump_views`; USE `mysqldump_views`;
DROP TABLE IF EXISTS `nasishnasifu`;
/*!50001 DROP VIEW IF EXISTS `nasishnasifu`*/;
/*!50001 CREATE TABLE `nasishnasifu` ( /*!50001 CREATE TABLE `nasishnasifu` (
`id` bigint(20) unsigned `id` bigint(20) unsigned
) */; ) */;
/*!50001 DROP TABLE IF EXISTS `nasishnasifu`*/;
/*!50001 DROP VIEW IF EXISTS `nasishnasifu`*/; USE `mysqldump_tables`;
USE `mysqldump_views`;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */; /*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
/*!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 nasishnasifu; drop view nasishnasifu;
drop database mysqldump_views; drop database mysqldump_views;
drop table mysqldump_tables.basetable; drop table mysqldump_tables.basetable;
drop database mysqldump_tables; drop database mysqldump_tables;
create database mysqldump_dba;
use mysqldump_dba;
create table t1 (f1 int, f2 int);
insert into t1 values (1,1);
create view v1 as select f1, f2 from t1;
create database mysqldump_dbb;
use mysqldump_dbb;
create table t1 (f1 int, f2 int);
insert into t1 values (2,2);
create view v1 as select f1, f2 from t1;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
use mysqldump_dba;
drop view v1;
drop table t1;
drop database mysqldump_dba;
select * from mysqldump_dba.v1;
f1 f2
1 1
select * from mysqldump_dbb.v1;
f1 f2
2 2
use mysqldump_dba;
drop view v1;
drop table t1;
drop database mysqldump_dba;
use mysqldump_dbb;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
use test; use test;
End of 5.0 tests End of 5.0 tests
create table t1 (a text , b text); create table t1 (a text , b text);
...@@ -3159,6 +3167,8 @@ DROP TABLE IF EXISTS `v1`; ...@@ -3159,6 +3167,8 @@ DROP TABLE IF EXISTS `v1`;
/*!50001 CREATE TABLE `v1` ( /*!50001 CREATE TABLE `v1` (
`id` int(11) `id` int(11)
) */; ) */;
USE `mysqldump_test_db`;
/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
......
reset master;
reset slave;
start slave;
show binary logs;
Log_name
master-bin.000001
master-bin.000002
drop table if exists t1;
create table t1(n int);
insert into t1 values (3351);
select * from t1;
n
3351
drop table t1;
slave stop;
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;
slave start;
reset master;
change master to master_host='127.0.0.1',master_port=9307, master_user='root';
start slave;
create temporary table t1 (a int);
create temporary table t1 (a int);
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 2
create temporary table t1 (a int);
create temporary table t1 (a int);
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 4
stop slave;
insert into t1 values(1);
create table t2 as select * from t1;
start slave;
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 4
select * from t2;
a
1
drop table t2;
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;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 1
show status like 'Rpl_status';
Variable_name Value
Rpl_status AUTH_MASTER
create table t1(n int);
drop table t1;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 2
show status like 'Rpl_status';
Variable_name Value
Rpl_status ACTIVE_SLAVE
start slave;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 3
show status like 'Rpl_status';
Variable_name Value
Rpl_status ACTIVE_SLAVE
start slave;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 4
show status like 'Rpl_status';
Variable_name Value
Rpl_status ACTIVE_SLAVE
reset master;
drop table if exists t1;
create table t1 ENGINE=HEAP select 10 as a;
insert into t1 values(11);
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use `test`; create table t1 ENGINE=HEAP select 10 as a
master-bin.001 154 Query 1 154 use `test`; insert into t1 values(11)
reset slave;
start slave;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(2) NOT NULL default '0'
) ENGINE=HEAP
select * from t1;
a
10
11
select * from t1;
a
select * from t1 limit 10;
a
show binlog events in 'master-bin.002' from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.002 79 Query 1 79 use `test`; DELETE FROM `test`.`t1`
select * from t1;
a
drop table t1;
...@@ -166,6 +166,13 @@ show variables like 'max_error_count'; ...@@ -166,6 +166,13 @@ show variables like 'max_error_count';
Variable_name Value Variable_name Value
max_error_count 10 max_error_count 10
drop table t1; drop table t1;
create table t1 (id int) engine=merge;
Warnings:
Warning 1266 Using storage engine MyISAM for table 't1'
alter table t1 engine=merge;
Warnings:
Warning 1266 Using storage engine MyISAM for table 't1'
drop table t1;
set table_type=MYISAM; set table_type=MYISAM;
Warnings: Warnings:
Warning 1541 The syntax 'table_type' is deprecated and will be removed in MySQL 5.2. Please use 'storage_engine' instead. Warning 1541 The syntax 'table_type' is deprecated and will be removed in MySQL 5.2. Please use 'storage_engine' instead.
......
--source include/have_debug.inc
CREATE TABLE t1(a int) engine=innodb;
START TRANSACTION;
insert into t1 values(9);
# Setup the mysqld to crash at certain point
SET SESSION debug="d,crash_commit_before";
# Write file to make mysql-test-run.pl expect crash and restart
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/master0.expect
# Run the crashing query
--error 2013
COMMIT;
# Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc
SHOW CREATE TABLE t1;
SELECT * FROM t1;
...@@ -41,5 +41,5 @@ rpl_sp_effects : BUG#19862 2006-06-15 mkindahl ...@@ -41,5 +41,5 @@ rpl_sp_effects : BUG#19862 2006-06-15 mkindahl
rpl_ndb_idempotent : BUG#21298 2006-07-27 msvensson rpl_ndb_idempotent : BUG#21298 2006-07-27 msvensson
rpl_row_basic_7ndb : BUG#21298 2006-07-27 msvensson rpl_row_basic_7ndb : BUG#21298 2006-07-27 msvensson
rpl_truncate_7ndb : BUG#21298 2006-07-27 msvensson rpl_truncate_7ndb : BUG#21298 2006-07-27 msvensson
crash_commit_before : 2006-08-02 msvensson
rpl_ndb_dd_advance : BUG#18679 2006-07-28 jimw (Test fails randomly) rpl_ndb_dd_advance : BUG#18679 2006-07-28 jimw (Test fails randomly)
...@@ -247,3 +247,141 @@ CREATE TABLE t2 (z int, y int); ...@@ -247,3 +247,141 @@ CREATE TABLE t2 (z int, y int);
CREATE TABLE t3 (a int, b int); CREATE TABLE t3 (a int, b int);
INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1); INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
DROP TABLE IF EXISTS t1,t2,t3; DROP TABLE IF EXISTS t1,t2,t3;
#
# Bug #20989: View '(null).(null)' references invalid table(s)... on
# SQL SECURITY INVOKER
#
# this is really the fact that REPLACE ... SELECT required additional
# INSERT privs (on tables that are part of a view) over the related
# REPLACE, SELECT
#
CREATE DATABASE meow;
connect (root,localhost,root,,meow);
connection root;
CREATE TABLE table_target ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
CREATE TABLE table_target2 ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
CREATE TABLE table_target3 ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
CREATE VIEW view_target2 AS SELECT mexs_id,messzeit FROM table_target2;
CREATE SQL SECURITY INVOKER VIEW view_target3 AS SELECT mexs_id,messzeit FROM table_target3;
CREATE TABLE table_stations ( mexs_id VARCHAR(8), icao VARCHAR(4), country CHAR(2), PRIMARY KEY (mexs_id), UNIQUE KEY icao (icao), KEY country (country), CONSTRAINT stations_ibfk_8 FOREIGN KEY (country) REFERENCES countries (country) ON UPDATE CASCADE);
INSERT INTO table_stations VALUES ('87654321','XXXX','YY');
CREATE TABLE table_countries ( country CHAR(2), iso_short_en VARCHAR(64), PRIMARY KEY (country));
INSERT INTO table_countries VALUES ('YY','Entenhausen');
CREATE ALGORITHM=MERGE SQL SECURITY INVOKER VIEW view_stations AS select table_stations.mexs_id AS mexs_id, table_stations.icao AS icao, table_stations.country AS landescode from (table_stations join table_countries on((table_stations.country = table_countries.country)));
CREATE TABLE table_source ( id varchar(4), datetime TIMESTAMP, PRIMARY KEY (id));
INSERT INTO table_source VALUES ('XXXX','2006-07-12 07:50:00');
GRANT SELECT ON table_source TO user20989@localhost;
GRANT SELECT ON table_countries TO user20989@localhost;
GRANT SELECT ON table_stations TO user20989@localhost;
GRANT SELECT ON view_stations TO user20989@localhost;
GRANT SELECT ON table_target TO user20989@localhost;
GRANT SELECT ON table_target2 TO user20989@localhost;
GRANT INSERT,DELETE,SELECT ON view_target3 TO user20989@localhost;
connect (user20989,localhost,user20989,,meow);
connection user20989;
--error 1142
REPLACE INTO table_target
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN table_target AS old
USING (mexs_id);
--error 1142
REPLACE INTO view_target2
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN view_target2 AS old
USING (mexs_id);
--error 1356
REPLACE INTO view_target3
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN view_target3 AS old
USING (mexs_id);
connection root;
disconnect user20989;
GRANT INSERT,DELETE ON table_target TO user20989@localhost;
GRANT INSERT,DELETE,SELECT ON view_target2 TO user20989@localhost;
GRANT INSERT,DELETE,SELECT ON table_target3 TO user20989@localhost;
connect (user20989,localhost,user20989,,meow);
connection user20989;
REPLACE INTO table_target
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN table_target AS old
USING (mexs_id);
--error 1142
REPLACE INTO table_target2 VALUES ('00X45Y78','2006-07-12 07:50:00');
REPLACE INTO view_target2 VALUES ('12X45Y78','2006-07-12 07:50:00');
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN view_target2 AS old
USING (mexs_id);
REPLACE INTO view_target2
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN view_target2 AS old
USING (mexs_id);
REPLACE INTO view_target3
SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
FROM table_source
INNER JOIN view_stations AS stations
ON table_source.id = stations.icao
LEFT JOIN view_target3 AS old
USING (mexs_id);
connection root;
disconnect user20989;
SELECT * FROM table_target;
SELECT * FROM view_target2;
SELECT * FROM view_target3;
DROP VIEW view_stations;
DROP TABLE table_source;
DROP TABLE table_countries;
DROP TABLE table_stations;
DROP TABLE table_target;
DROP TABLE table_target2;
DROP TABLE table_target3;
DROP VIEW view_target2;
DROP VIEW view_target3;
DROP USER user20989@localhost;
disconnect root;
connection default;
DROP DATABASE meow;
...@@ -1225,8 +1225,9 @@ drop view v1; ...@@ -1225,8 +1225,9 @@ drop view v1;
drop table t1; drop table t1;
drop database mysqldump_test_db; drop database mysqldump_test_db;
#
# Bug21014 Segmentation fault of mysqldump on view # Bug21014 Segmentation fault of mysqldump on view
#
create database mysqldump_tables; create database mysqldump_tables;
use mysqldump_tables; use mysqldump_tables;
create table basetable ( id serial, tag varchar(64) ); create table basetable ( id serial, tag varchar(64) );
...@@ -1235,12 +1236,51 @@ create database mysqldump_views; ...@@ -1235,12 +1236,51 @@ create database mysqldump_views;
use mysqldump_views; use mysqldump_views;
create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable; create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable;
--exec $MYSQL_DUMP --skip-comments --databases mysqldump_tables mysqldump_views; --exec $MYSQL_DUMP --skip-comments --compact --databases mysqldump_tables mysqldump_views;
drop view nasishnasifu; drop view nasishnasifu;
drop database mysqldump_views; drop database mysqldump_views;
drop table mysqldump_tables.basetable; drop table mysqldump_tables.basetable;
drop database mysqldump_tables; drop database mysqldump_tables;
#
# Bug20221 Dumping of multiple databases containing view(s) yields maleformed dumps
#
create database mysqldump_dba;
use mysqldump_dba;
create table t1 (f1 int, f2 int);
insert into t1 values (1,1);
create view v1 as select f1, f2 from t1;
create database mysqldump_dbb;
use mysqldump_dbb;
create table t1 (f1 int, f2 int);
insert into t1 values (2,2);
create view v1 as select f1, f2 from t1;
--exec $MYSQL_DUMP --skip-comments --add-drop-database --databases mysqldump_dba mysqldump_dbb > $MYSQLTEST_VARDIR/tmp/bug20221_backup;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
use mysqldump_dba;
drop view v1;
drop table t1;
drop database mysqldump_dba;
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20221_backup;
select * from mysqldump_dba.v1;
select * from mysqldump_dbb.v1;
use mysqldump_dba;
drop view v1;
drop table t1;
drop database mysqldump_dba;
use mysqldump_dbb;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
use test; use test;
--echo End of 5.0 tests --echo End of 5.0 tests
......
#
# Running test with abort-slave-event-count=1
# This will force slave to reconnect after every event
#
require_manager;
connect (master,localhost,root,,test,0,$MASTER_MYPORT);
connect (slave,localhost,root,,test,0,slave.sock);
connection master;
reset master;
server_stop master;
server_start master;
connection slave;
reset slave;
start slave;
connection master;
show binary logs;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1(n int);
insert into t1 values (3351);
sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
sync_slave_with_master;
# End of 4.1 tests
# This test makes some assumptions about values of thread ids, which should be
# true if the servers have been restarted for this test. So we want to
# stop/restart servers. Note that if assumptions are wrong, the test will not
# fail; it will just fail to test the error-prone scenario.
# Using the manager is the only way to have more than one slave server.
# So you must run this test with --manager.
require_manager;
server_stop master;
server_start master;
server_stop slave;
server_start slave;
# no need for slave_sec (no assumptions on thread ids for this server).
source include/master-slave.inc;
connect (slave_sec,localhost,root,,test,0,slave.sock-1);
connection master;
save_master_pos;
connection slave;
sync_with_master;
reset master;
save_master_pos;
connection slave_sec;
eval change master to master_host='127.0.0.1',master_port=$SLAVE_MYPORT, master_user='root';
start slave;
sync_with_master;
# :P now we have a chain ready-to-test.
connection master;
create temporary table t1 (a int);
save_master_pos;
connection slave;
sync_with_master;
connection master1;
create temporary table t1 (a int);
save_master_pos;
connection slave;
sync_with_master;
save_master_pos;
# First test:
connection slave_sec;
# Before BUG#1686 ("If 2 master threads with same-name temp table, slave makes
# bad binlog") was fixed, sync_with_master failed
sync_with_master;
show status like 'slave_open_temp_tables';
# 'master' and 'master1' usually have thread id 2-3 or 3-4.
# 'slave' and 'slave1' usually have thread id 2-3.
connection slave;
create temporary table t1 (a int);
connection slave1;
create temporary table t1 (a int);
# So it's likely that in the binlog of slave we get
# server_id=of_master thread_id=3 create temp...
# server_id=of_slave thread_id=3 create temp...
# which would confuse slave-sec unless slave-sec uses server id to distinguish
# between temp tables (here thread id is obviously not enough to distinguish).
save_master_pos;
# Second test:
connection slave_sec;
# If we did not use the server id to distinguish between temp tables,
# sync_with_master would fail
sync_with_master;
show status like 'slave_open_temp_tables';
# Third test (BUG#1240 "slave of slave breaks when STOP SLAVE was issud on
# parent slave and temp tables").
stop slave;
connection slave;
insert into t1 values(1);
create table t2 as select * from t1;
save_master_pos;
connection slave_sec;
start slave;
sync_with_master;
show status like 'slave_open_temp_tables';
select * from t2;
# clean up
connection slave;
drop table t2;
save_master_pos;
connection slave_sec;
sync_with_master;
# On purpose, we don't delete the temporary tables explicitely.
# So temp tables remain on slave (remember they are not deleted when the slave
# SQL thread terminates). If you run this test with
# --valgrind --valgrind-options=--show-reachable=yes
# you will see if they get cleaned up at slave's shutdown (that is, if the
# memory they use is freed (it should) by mysqld before it terminates).
# If they wouldn't be cleaned up, you would see some "still reachable" blocks in
# Valgrind.
# End of 4.1 tests
require_manager;
source include/master-slave.inc;
connect (slave_sec,localhost,root,,test,0,slave.sock-1);
connect (slave_ter,localhost,root,,test,0,slave.sock-2);
connection master;
show variables like 'rpl_recovery_rank';
show status like 'Rpl_status';
create table t1(n int);
drop table t1;
sync_slave_with_master;
show variables like 'rpl_recovery_rank';
show status like 'Rpl_status';
connection slave_sec;
start slave;
sync_with_master;
show variables like 'rpl_recovery_rank';
show status like 'Rpl_status';
connection slave_ter;
start slave;
sync_with_master;
show variables like 'rpl_recovery_rank';
show status like 'Rpl_status';
# End of 4.1 tests
# Requires statement logging
-- source include/have_binlog_format_statement.inc
# You must run this test with --manager.
require_manager;
# Don't know why, but using TCP/IP connections makes this test fail
# with "Lost connection to MySQL server during query" when we
# issue a query after the server restart.
# Maybe this is something awkward in mysqltest or in the manager?
# So we use sockets.
connect (master,localhost,root,,test,0,$MASTER_MYPORT);
connect (slave,localhost,root,,test,0,slave.sock);
connection master;
reset master;
drop table if exists t1;
# we use CREATE SELECT to verify that DELETE does not get into binlog
# before CREATE SELECT
create table t1 engine=HEAP select 10 as a;
insert into t1 values(11);
save_master_pos;
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/
show binlog events from 79;
connection slave;
reset slave;
start slave;
sync_with_master;
show create table t1;
select * from t1; # should be one row
server_stop master;
server_start master;
connection master;
select * from t1;
# to check that DELETE is not written twice
# (the LIMIT is to not use the query cache)
select * from t1 limit 10;
save_master_pos;
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/
show binlog events in 'master-bin.002' from 79;
connection slave;
sync_with_master;
select * from t1; # should be empty
# clean up
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;
# End of 4.1 tests
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
# forget to close its tables. # forget to close its tables.
# Can be run with statement-based but no interest (and long test) # Can be run with statement-based but no interest (and long test)
source include/have_binlog_format_row.inc; --source include/have_binlog_format_row.inc
source include/master-slave.inc; --source include/master-slave.inc
connection master; connection master;
create table t1 (a int not null auto_increment primary key, b int, key(b)); create table t1 (a int not null auto_increment primary key, b int, key(b));
......
--skip-isam --skip-isam --skip-merge
...@@ -116,6 +116,9 @@ drop table t1; ...@@ -116,6 +116,9 @@ drop table t1;
#create table t1 (id int) engine=isam; #create table t1 (id int) engine=isam;
#alter table t1 engine=isam; #alter table t1 engine=isam;
#drop table t1; #drop table t1;
create table t1 (id int) engine=merge;
alter table t1 engine=merge;
drop table t1;
# #
# Test for deprecated table_type variable # Test for deprecated table_type variable
......
This diff is collapsed.
...@@ -38,85 +38,6 @@ ...@@ -38,85 +38,6 @@
#define FEDERATED_QUERY_BUFFER_SIZE STRING_BUFFER_USUAL_SIZE * 5 #define FEDERATED_QUERY_BUFFER_SIZE STRING_BUFFER_USUAL_SIZE * 5
#define FEDERATED_RECORDS_IN_RANGE 2 #define FEDERATED_RECORDS_IN_RANGE 2
#define FEDERATED_INFO " SHOW TABLE STATUS LIKE "
#define FEDERATED_INFO_LEN (sizeof(FEDERATED_INFO) -1)
#define FEDERATED_SELECT "SELECT "
#define FEDERATED_SELECT_LEN (sizeof(FEDERATED_SELECT) -1)
#define FEDERATED_WHERE " WHERE "
#define FEDERATED_WHERE_LEN (sizeof(FEDERATED_WHERE) -1)
#define FEDERATED_FROM " FROM "
#define FEDERATED_FROM_LEN (sizeof(FEDERATED_FROM) -1)
#define FEDERATED_PERCENT "%"
#define FEDERATED_PERCENT_LEN (sizeof(FEDERATED_PERCENT) -1)
#define FEDERATED_IS " IS "
#define FEDERATED_IS_LEN (sizeof(FEDERATED_IS) -1)
#define FEDERATED_NULL " NULL "
#define FEDERATED_NULL_LEN (sizeof(FEDERATED_NULL) -1)
#define FEDERATED_ISNULL " IS NULL "
#define FEDERATED_ISNULL_LEN (sizeof(FEDERATED_ISNULL) -1)
#define FEDERATED_LIKE " LIKE "
#define FEDERATED_LIKE_LEN (sizeof(FEDERATED_LIKE) -1)
#define FEDERATED_TRUNCATE "TRUNCATE "
#define FEDERATED_TRUNCATE_LEN (sizeof(FEDERATED_TRUNCATE) -1)
#define FEDERATED_DELETE "DELETE "
#define FEDERATED_DELETE_LEN (sizeof(FEDERATED_DELETE) -1)
#define FEDERATED_INSERT "INSERT INTO "
#define FEDERATED_INSERT_LEN (sizeof(FEDERATED_INSERT) -1)
#define FEDERATED_OPTIMIZE "OPTIMIZE TABLE "
#define FEDERATED_OPTIMIZE_LEN (sizeof(FEDERATED_OPTIMIZE) -1)
#define FEDERATED_REPAIR "REPAIR TABLE "
#define FEDERATED_REPAIR_LEN (sizeof(FEDERATED_REPAIR) -1)
#define FEDERATED_QUICK " QUICK"
#define FEDERATED_QUICK_LEN (sizeof(FEDERATED_QUICK) -1)
#define FEDERATED_EXTENDED " EXTENDED"
#define FEDERATED_EXTENDED_LEN (sizeof(FEDERATED_EXTENDED) -1)
#define FEDERATED_USE_FRM " USE_FRM"
#define FEDERATED_USE_FRM_LEN (sizeof(FEDERATED_USE_FRM) -1)
#define FEDERATED_LIMIT1 " LIMIT 1"
#define FEDERATED_LIMIT1_LEN (sizeof(FEDERATED_LIMIT1) -1)
#define FEDERATED_VALUES "VALUES "
#define FEDERATED_VALUES_LEN (sizeof(FEDERATED_VALUES) -1)
#define FEDERATED_UPDATE "UPDATE "
#define FEDERATED_UPDATE_LEN (sizeof(FEDERATED_UPDATE) -1)
#define FEDERATED_SET " SET "
#define FEDERATED_SET_LEN (sizeof(FEDERATED_SET) -1)
#define FEDERATED_AND " AND "
#define FEDERATED_AND_LEN (sizeof(FEDERATED_AND) -1)
#define FEDERATED_CONJUNCTION ") AND ("
#define FEDERATED_CONJUNCTION_LEN (sizeof(FEDERATED_CONJUNCTION) -1)
#define FEDERATED_OR " OR "
#define FEDERATED_OR_LEN (sizeof(FEDERATED_OR) -1)
#define FEDERATED_NOT " NOT "
#define FEDERATED_NOT_LEN (sizeof(FEDERATED_NOT) -1)
#define FEDERATED_STAR "* "
#define FEDERATED_STAR_LEN (sizeof(FEDERATED_STAR) -1)
#define FEDERATED_SPACE " "
#define FEDERATED_SPACE_LEN (sizeof(FEDERATED_SPACE) -1)
#define FEDERATED_SQUOTE "'"
#define FEDERATED_SQUOTE_LEN (sizeof(FEDERATED_SQUOTE) -1)
#define FEDERATED_COMMA ", "
#define FEDERATED_COMMA_LEN (sizeof(FEDERATED_COMMA) -1)
#define FEDERATED_BTICK "`"
#define FEDERATED_BTICK_LEN (sizeof(FEDERATED_BTICK) -1)
#define FEDERATED_OPENPAREN " ("
#define FEDERATED_OPENPAREN_LEN (sizeof(FEDERATED_OPENPAREN) -1)
#define FEDERATED_CLOSEPAREN ") "
#define FEDERATED_CLOSEPAREN_LEN (sizeof(FEDERATED_CLOSEPAREN) -1)
#define FEDERATED_NE " != "
#define FEDERATED_NE_LEN (sizeof(FEDERATED_NE) -1)
#define FEDERATED_GT " > "
#define FEDERATED_GT_LEN (sizeof(FEDERATED_GT) -1)
#define FEDERATED_LT " < "
#define FEDERATED_LT_LEN (sizeof(FEDERATED_LT) -1)
#define FEDERATED_LE " <= "
#define FEDERATED_LE_LEN (sizeof(FEDERATED_LE) -1)
#define FEDERATED_GE " >= "
#define FEDERATED_GE_LEN (sizeof(FEDERATED_GE) -1)
#define FEDERATED_EQ " = "
#define FEDERATED_EQ_LEN (sizeof(FEDERATED_EQ) -1)
#define FEDERATED_FALSE " 1=0"
#define FEDERATED_FALSE_LEN (sizeof(FEDERATED_FALSE) -1)
/* /*
FEDERATED_SHARE is a structure that will be shared amoung all open handlers FEDERATED_SHARE is a structure that will be shared amoung all open handlers
The example implements the minimum of what you will probably need. The example implements the minimum of what you will probably need.
......
...@@ -551,7 +551,7 @@ bool ha_myisammrg::check_if_incompatible_data(HA_CREATE_INFO *info, ...@@ -551,7 +551,7 @@ bool ha_myisammrg::check_if_incompatible_data(HA_CREATE_INFO *info,
static int myisammrg_init() static int myisammrg_init()
{ {
myisammrg_hton.state=SHOW_OPTION_YES; myisammrg_hton.state=have_merge_db;
myisammrg_hton.db_type=DB_TYPE_MRG_MYISAM; myisammrg_hton.db_type=DB_TYPE_MRG_MYISAM;
myisammrg_hton.create=myisammrg_create_handler; myisammrg_hton.create=myisammrg_create_handler;
myisammrg_hton.panic=myrg_panic; myisammrg_hton.panic=myrg_panic;
......
...@@ -1669,6 +1669,10 @@ extern handlerton partition_hton; ...@@ -1669,6 +1669,10 @@ extern handlerton partition_hton;
extern SHOW_COMP_OPTION have_partition_db; extern SHOW_COMP_OPTION have_partition_db;
#endif #endif
extern handlerton myisammrg_hton;
/* MRG_MYISAM handler is always built, but may be skipped */
#define have_merge_db myisammrg_hton.state
extern handlerton myisam_hton; extern handlerton myisam_hton;
extern handlerton myisammrg_hton; extern handlerton myisammrg_hton;
extern handlerton heap_hton; extern handlerton heap_hton;
......
...@@ -310,7 +310,7 @@ static bool lower_case_table_names_used= 0; ...@@ -310,7 +310,7 @@ static bool lower_case_table_names_used= 0;
static bool volatile select_thread_in_use, signal_thread_in_use; static bool volatile select_thread_in_use, signal_thread_in_use;
static bool volatile ready_to_exit; static bool volatile ready_to_exit;
static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0; static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0;
static my_bool opt_bdb, opt_isam, opt_ndbcluster; static my_bool opt_bdb, opt_isam, opt_ndbcluster, opt_merge;
static my_bool opt_short_log_format= 0; static my_bool opt_short_log_format= 0;
static uint kill_cached_threads, wake_thread; static uint kill_cached_threads, wake_thread;
static ulong killed_threads, thread_created; static ulong killed_threads, thread_created;
...@@ -4838,7 +4838,8 @@ enum options_mysqld ...@@ -4838,7 +4838,8 @@ enum options_mysqld
OPT_LOG_OUTPUT, OPT_LOG_OUTPUT,
OPT_PORT_OPEN_TIMEOUT, OPT_PORT_OPEN_TIMEOUT,
OPT_GENERAL_LOG, OPT_GENERAL_LOG,
OPT_SLOW_LOG OPT_SLOW_LOG,
OPT_MERGE
}; };
...@@ -5346,6 +5347,9 @@ master-ssl", ...@@ -5346,6 +5347,9 @@ master-ssl",
#endif /* HAVE_REPLICATION */ #endif /* HAVE_REPLICATION */
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (gptr*) &locked_in_memory, {"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (gptr*) &locked_in_memory,
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"merge", OPT_MERGE, "Enable Merge storage engine. Disable with \
--skip-merge.",
(gptr*) &opt_merge, (gptr*) &opt_merge, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0},
{"myisam-recover", OPT_MYISAM_RECOVER, {"myisam-recover", OPT_MYISAM_RECOVER,
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.", "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
(gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0, (gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0,
...@@ -7556,6 +7560,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -7556,6 +7560,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
global_system_variables.tx_isolation= (type-1); global_system_variables.tx_isolation= (type-1);
break; break;
} }
case OPT_MERGE:
if (opt_merge)
have_merge_db= SHOW_OPTION_YES;
else
have_merge_db= SHOW_OPTION_DISABLED;
#ifdef WITH_BERKELEY_STORAGE_ENGINE #ifdef WITH_BERKELEY_STORAGE_ENGINE
case OPT_BDB_NOSYNC: case OPT_BDB_NOSYNC:
/* Deprecated option */ /* Deprecated option */
......
...@@ -681,6 +681,7 @@ sys_var_have_variable sys_have_federated_db("have_federated_engine", ...@@ -681,6 +681,7 @@ sys_var_have_variable sys_have_federated_db("have_federated_engine",
&have_federated_db); &have_federated_db);
sys_var_have_variable sys_have_geometry("have_geometry", &have_geometry); sys_var_have_variable sys_have_geometry("have_geometry", &have_geometry);
sys_var_have_variable sys_have_innodb("have_innodb", &have_innodb); sys_var_have_variable sys_have_innodb("have_innodb", &have_innodb);
sys_var_have_variable sys_have_merge_db("have_merge", &have_merge_db);
sys_var_have_variable sys_have_ndbcluster("have_ndbcluster", &have_ndbcluster); sys_var_have_variable sys_have_ndbcluster("have_ndbcluster", &have_ndbcluster);
sys_var_have_variable sys_have_openssl("have_openssl", &have_openssl); sys_var_have_variable sys_have_openssl("have_openssl", &have_openssl);
sys_var_have_variable sys_have_partition_db("have_partitioning", sys_var_have_variable sys_have_partition_db("have_partitioning",
...@@ -821,6 +822,7 @@ SHOW_VAR init_vars[]= { ...@@ -821,6 +822,7 @@ SHOW_VAR init_vars[]= {
{sys_have_federated_db.name,(char*) &have_federated_db, SHOW_HAVE}, {sys_have_federated_db.name,(char*) &have_federated_db, SHOW_HAVE},
{sys_have_geometry.name, (char*) &have_geometry, SHOW_HAVE}, {sys_have_geometry.name, (char*) &have_geometry, SHOW_HAVE},
{sys_have_innodb.name, (char*) &have_innodb, SHOW_HAVE}, {sys_have_innodb.name, (char*) &have_innodb, SHOW_HAVE},
{sys_have_merge_db.name, (char*) &have_merge_db, SHOW_HAVE},
{sys_have_ndbcluster.name, (char*) &have_ndbcluster, SHOW_HAVE}, {sys_have_ndbcluster.name, (char*) &have_ndbcluster, SHOW_HAVE},
{sys_have_openssl.name, (char*) &have_openssl, SHOW_HAVE}, {sys_have_openssl.name, (char*) &have_openssl, SHOW_HAVE},
{sys_have_partition_db.name,(char*) &have_partition_db, SHOW_HAVE}, {sys_have_partition_db.name,(char*) &have_partition_db, SHOW_HAVE},
......
...@@ -810,11 +810,18 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list, ...@@ -810,11 +810,18 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list,
bool insert_into_view= (table_list->view != 0); bool insert_into_view= (table_list->view != 0);
DBUG_ENTER("mysql_prepare_insert_check_table"); DBUG_ENTER("mysql_prepare_insert_check_table");
/*
first table in list is the one we'll INSERT into, requires INSERT_ACL.
all others require SELECT_ACL only. the ACL requirement below is for
new leaves only anyway (view-constituents), so check for SELECT rather
than INSERT.
*/
if (setup_tables_and_check_access(thd, &thd->lex->select_lex.context, if (setup_tables_and_check_access(thd, &thd->lex->select_lex.context,
&thd->lex->select_lex.top_join_list, &thd->lex->select_lex.top_join_list,
table_list, table_list,
&thd->lex->select_lex.leaf_tables, &thd->lex->select_lex.leaf_tables,
select_insert, INSERT_ACL)) select_insert, SELECT_ACL))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
if (insert_into_view && !fields.elements) if (insert_into_view && !fields.elements)
......
...@@ -86,7 +86,8 @@ int main(int argc,char *argv[]) ...@@ -86,7 +86,8 @@ int main(int argc,char *argv[])
init_key_cache(dflt_key_cache,MI_KEY_BLOCK_LENGTH,USE_BUFFER_INIT, 0, 0); init_key_cache(dflt_key_cache,MI_KEY_BLOCK_LENGTH,USE_BUFFER_INIT, 0, 0);
if (!(info=mi_open(argv[0],2,HA_OPEN_ABORT_IF_LOCKED|HA_OPEN_FROM_SQL_LAYER))) if (!(info=mi_open(argv[0], O_RDONLY,
HA_OPEN_ABORT_IF_LOCKED|HA_OPEN_FROM_SQL_LAYER)))
{ {
error=my_errno; error=my_errno;
goto err; goto err;
......
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