mysql-5.5 merge
This commit is contained in:
commit
0522307ed1
2
VERSION
2
VERSION
@ -1,4 +1,4 @@
|
||||
MYSQL_VERSION_MAJOR=5
|
||||
MYSQL_VERSION_MINOR=5
|
||||
MYSQL_VERSION_PATCH=24
|
||||
MYSQL_VERSION_PATCH=25
|
||||
MYSQL_VERSION_EXTRA=
|
||||
|
@ -86,6 +86,15 @@
|
||||
/* Chars needed to store LONGLONG, excluding trailing '\0'. */
|
||||
#define LONGLONG_LEN 20
|
||||
|
||||
/* general_log or slow_log tables under mysql database */
|
||||
static inline my_bool general_log_or_slow_log_tables(const char *db,
|
||||
const char *table)
|
||||
{
|
||||
return (strcmp(db, "mysql") == 0) &&
|
||||
((strcmp(table, "general_log") == 0) ||
|
||||
(strcmp(table, "slow_log") == 0));
|
||||
}
|
||||
|
||||
static void add_load_option(DYNAMIC_STRING *str, const char *option,
|
||||
const char *option_value);
|
||||
static ulong find_set(TYPELIB *lib, const char *x, uint length,
|
||||
@ -2503,6 +2512,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
"TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'";
|
||||
FILE *sql_file= md_result_file;
|
||||
int len;
|
||||
my_bool is_log_table;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
DBUG_ENTER("get_table_structure");
|
||||
@ -2587,9 +2597,12 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
/*
|
||||
Even if the "table" is a view, we do a DROP TABLE here. The
|
||||
view-specific code below fills in the DROP VIEW.
|
||||
We will skip the DROP TABLE for general_log and slow_log, since
|
||||
those stmts will fail, in case we apply dump by enabling logging.
|
||||
*/
|
||||
fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",
|
||||
opt_quoted_table);
|
||||
if (!general_log_or_slow_log_tables(db, table))
|
||||
fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",
|
||||
opt_quoted_table);
|
||||
check_io(sql_file);
|
||||
}
|
||||
|
||||
@ -2701,12 +2714,25 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
|
||||
row= mysql_fetch_row(result);
|
||||
|
||||
fprintf(sql_file, (opt_compatible_mode & 3) ? "%s;\n" :
|
||||
"/*!40101 SET @saved_cs_client = @@character_set_client */;\n"
|
||||
"/*!40101 SET character_set_client = utf8 */;\n"
|
||||
"%s;\n"
|
||||
"/*!40101 SET character_set_client = @saved_cs_client */;\n",
|
||||
row[1]);
|
||||
is_log_table= general_log_or_slow_log_tables(db, table);
|
||||
if (is_log_table)
|
||||
row[1]+= 13; /* strlen("CREATE TABLE ")= 13 */
|
||||
if (opt_compatible_mode & 3)
|
||||
{
|
||||
fprintf(sql_file,
|
||||
is_log_table ? "CREATE TABLE IF NOT EXISTS %s;\n" : "%s;\n",
|
||||
row[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(sql_file,
|
||||
"/*!40101 SET @saved_cs_client = @@character_set_client */;\n"
|
||||
"/*!40101 SET character_set_client = utf8 */;\n"
|
||||
"%s%s;\n"
|
||||
"/*!40101 SET character_set_client = @saved_cs_client */;\n",
|
||||
is_log_table ? "CREATE TABLE IF NOT EXISTS " : "",
|
||||
row[1]);
|
||||
}
|
||||
|
||||
check_io(sql_file);
|
||||
mysql_free_result(result);
|
||||
@ -4315,6 +4341,22 @@ static int dump_all_tables_in_db(char *database)
|
||||
if (opt_xml)
|
||||
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
|
||||
|
||||
if (strcmp(database, "mysql") == 0)
|
||||
{
|
||||
char table_type[NAME_LEN];
|
||||
char ignore_flag;
|
||||
uint num_fields;
|
||||
num_fields= get_table_structure((char *) "general_log",
|
||||
database, table_type, &ignore_flag);
|
||||
if (num_fields == 0)
|
||||
verbose_msg("-- Warning: get_table_structure() failed with some internal "
|
||||
"error for 'general_log' table\n");
|
||||
num_fields= get_table_structure((char *) "slow_log",
|
||||
database, table_type, &ignore_flag);
|
||||
if (num_fields == 0)
|
||||
verbose_msg("-- Warning: get_table_structure() failed with some internal "
|
||||
"error for 'slow_log' table\n");
|
||||
}
|
||||
if (lock_tables)
|
||||
{
|
||||
DYNAMIC_STRING query;
|
||||
|
@ -151,7 +151,7 @@ IF(UNIX)
|
||||
|
||||
IF(CMAKE_REQUIRED_LIBRARIES)
|
||||
LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
OPTION(WITH_LIBWRAP "Compile with tcp wrappers support" OFF)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -10,8 +10,8 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
along with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
|
||||
|
||||
/*
|
||||
* Vio Lite.
|
||||
|
@ -1518,7 +1518,7 @@ sub command_line_setup {
|
||||
|
||||
# We make the path absolute, as the server will do a chdir() before usage
|
||||
unless ( $opt_vardir =~ m,^/, or
|
||||
(IS_WINDOWS and $opt_vardir =~ m,^[a-z]:/,i) )
|
||||
(IS_WINDOWS and $opt_vardir =~ m,^[a-z]:[/\\],i) )
|
||||
{
|
||||
# Make absolute path, relative test dir
|
||||
$opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
|
||||
|
56
mysql-test/r/bug12427262.result
Normal file
56
mysql-test/r/bug12427262.result
Normal file
@ -0,0 +1,56 @@
|
||||
#
|
||||
# Bug#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE.
|
||||
#
|
||||
create database show_table_lw_db;
|
||||
use show_table_lw_db;
|
||||
create table t1 (c1 int);
|
||||
create table t2 (c1 int);
|
||||
create table t3 (c1 int);
|
||||
create table t4 (c1 int);
|
||||
create table t5 (c1 int);
|
||||
create table t6 (c1 int);
|
||||
create table t7 (c1 int);
|
||||
create table t8 (c1 int);
|
||||
create table t9 (c1 int);
|
||||
create table t10 (c1 int);
|
||||
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||
like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
|
||||
into @count_read_before;
|
||||
show tables;
|
||||
Tables_in_show_table_lw_db
|
||||
t1
|
||||
t10
|
||||
t2
|
||||
t3
|
||||
t4
|
||||
t5
|
||||
t6
|
||||
t7
|
||||
t8
|
||||
t9
|
||||
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||
like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
|
||||
into @count_read_after;
|
||||
select @count_read_after-@count_read_before;
|
||||
@count_read_after-@count_read_before
|
||||
0.000000000000000000000000000000
|
||||
show full tables;
|
||||
Tables_in_show_table_lw_db Table_type
|
||||
t1 BASE TABLE
|
||||
t10 BASE TABLE
|
||||
t2 BASE TABLE
|
||||
t3 BASE TABLE
|
||||
t4 BASE TABLE
|
||||
t5 BASE TABLE
|
||||
t6 BASE TABLE
|
||||
t7 BASE TABLE
|
||||
t8 BASE TABLE
|
||||
t9 BASE TABLE
|
||||
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||
like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
|
||||
into @count_read_after;
|
||||
select @count_read_after-@count_read_before;
|
||||
@count_read_after-@count_read_before
|
||||
10.000000000000000000000000000000
|
||||
drop table t1;
|
||||
drop database show_table_lw_db;
|
@ -204,4 +204,30 @@ SELECT BIT_XOR(t1.b) FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.pk=1;
|
||||
BIT_XOR(t1.b)
|
||||
0
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#12713907: STRANGE OPTIMIZE & WRONG RESULT UNDER ORDER BY
|
||||
# COUNT(*) LIMIT.
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
id BIGINT(20) ,
|
||||
member_id_to INT(11) ,
|
||||
r_date DATE ,
|
||||
PRIMARY KEY (id,r_date),
|
||||
KEY r_date_idx (r_date),
|
||||
KEY t1_idx01 (member_id_to)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES
|
||||
(107924526,518491,'2011-05-01'),
|
||||
(107924527,518491,'2011-05-01'),
|
||||
(107924534,518491,'2011-06-21'),
|
||||
(107924535,518491,'2011-06-21'),
|
||||
(107924542,1601319,'2011-06-21'),
|
||||
(107924543,1601319,'2011-06-21'),
|
||||
(107924544,1601319,'2011-06-21'),
|
||||
(107924545,1601319,'2011-06-21');
|
||||
SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
|
||||
'2011-06-21' GROUP BY member_id_to ORDER BY 2 LIMIT 1;
|
||||
member_id_to COUNT(*)
|
||||
518491 2
|
||||
DROP TABLE t1;
|
||||
End of 5.5 tests
|
||||
|
@ -5222,3 +5222,48 @@ DROP DATABASE b12809202_db;
|
||||
# Delete all existing binary logs.
|
||||
#
|
||||
RESET MASTER;
|
||||
#
|
||||
# Bug#45740 MYSQLDUMP DOESN'T DUMP GENERAL_LOG AND SLOW_QUERY CAUSES RESTORE PROBLEM
|
||||
#
|
||||
SET @old_log_output_state= @@global.log_output;
|
||||
SET @old_general_log_state= @@global.general_log;
|
||||
SET @old_slow_query_log_state= @@global.slow_query_log;
|
||||
call mtr.add_suppression("Failed to write to mysql.general_log");
|
||||
SET @@global.log_output="TABLE";
|
||||
SET @@global.general_log='OFF';
|
||||
SET @@global.slow_query_log='OFF';
|
||||
DROP DATABASE mysql;
|
||||
Warnings:
|
||||
Error 1146 Table 'mysql.proc' doesn't exist
|
||||
Error 1146 Table 'mysql.event' doesn't exist
|
||||
SHOW CREATE TABLE mysql.general_log;
|
||||
Table Create Table
|
||||
general_log CREATE TABLE `general_log` (
|
||||
`event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`user_host` mediumtext NOT NULL,
|
||||
`thread_id` int(11) NOT NULL,
|
||||
`server_id` int(10) unsigned NOT NULL,
|
||||
`command_type` varchar(64) NOT NULL,
|
||||
`argument` mediumtext NOT NULL
|
||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
|
||||
SHOW CREATE TABLE mysql.slow_log;
|
||||
Table Create Table
|
||||
slow_log CREATE TABLE `slow_log` (
|
||||
`start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`user_host` mediumtext NOT NULL,
|
||||
`query_time` time(6) NOT NULL,
|
||||
`lock_time` time(6) NOT NULL,
|
||||
`rows_sent` int(11) NOT NULL,
|
||||
`rows_examined` int(11) NOT NULL,
|
||||
`db` varchar(512) NOT NULL,
|
||||
`last_insert_id` int(11) NOT NULL,
|
||||
`insert_id` int(11) NOT NULL,
|
||||
`server_id` int(10) unsigned NOT NULL,
|
||||
`sql_text` mediumtext NOT NULL
|
||||
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
|
||||
SET @@global.log_output= @old_log_output_state;
|
||||
SET @@global.slow_query_log= @old_slow_query_log_state;
|
||||
SET @@global.general_log= @old_general_log_state;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
|
@ -22,3 +22,7 @@ ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) fo
|
||||
**** Clean up ****
|
||||
set global binlog_format = @saved_binlog_format;
|
||||
drop user mysqltest_1@localhost;
|
||||
GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
|
||||
SHOW MASTER LOGS;
|
||||
SHOW BINARY LOGS;
|
||||
DROP USER 'mysqltest_1'@'localhost';
|
||||
|
@ -54,3 +54,22 @@ disconnect root;
|
||||
connection default;
|
||||
set global binlog_format = @saved_binlog_format;
|
||||
drop user mysqltest_1@localhost;
|
||||
|
||||
|
||||
# Testing if REPLICATION CLIENT privilege is enough to execute
|
||||
# SHOW MASTER LOGS and SHOW BINARY.
|
||||
GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
|
||||
--connect(rpl,localhost,mysqltest_1,,)
|
||||
|
||||
--connection rpl
|
||||
# We are only interested if the following commands succeed and not on
|
||||
# their output.
|
||||
--disable_result_log
|
||||
SHOW MASTER LOGS;
|
||||
SHOW BINARY LOGS;
|
||||
--enable_result_log
|
||||
|
||||
# clean up
|
||||
--disconnect rpl
|
||||
connection default;
|
||||
DROP USER 'mysqltest_1'@'localhost';
|
||||
|
6
mysql-test/suite/innodb/r/innodb_bug12902967.result
Normal file
6
mysql-test/suite/innodb/r/innodb_bug12902967.result
Normal file
@ -0,0 +1,6 @@
|
||||
create table t1 (f1 integer primary key) engine innodb;
|
||||
alter table t1 add constraint c1 foreign key (f1) references t1(f1);
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
|
||||
InnoDB: which are not compatible with the new table definition.
|
||||
InnoDB: has or is referenced in foreign key constraints
|
||||
drop table t1;
|
56
mysql-test/suite/innodb/r/innodb_bug14007649.result
Normal file
56
mysql-test/suite/innodb/r/innodb_bug14007649.result
Normal file
@ -0,0 +1,56 @@
|
||||
create table t1 (
|
||||
rowid int,
|
||||
f1 int,
|
||||
f2 int,
|
||||
key i1 (f1, f2),
|
||||
key i2 (f2)) engine=innodb;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`rowid` int(11) DEFAULT NULL,
|
||||
`f1` int(11) DEFAULT NULL,
|
||||
`f2` int(11) DEFAULT NULL,
|
||||
KEY `i1` (`f1`,`f2`),
|
||||
KEY `i2` (`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
|
||||
start transaction with consistent snapshot;
|
||||
start transaction;
|
||||
update t1 set f2 = 4 where f1 = 1 and f2 is null;
|
||||
(b) Number of rows updated:
|
||||
select row_count();
|
||||
row_count()
|
||||
1
|
||||
insert into t1 values (3, 1, null);
|
||||
(b) After update and insert query.
|
||||
select rowid, f1, f2 from t1;
|
||||
rowid f1 f2
|
||||
1 1 10
|
||||
2 1 4
|
||||
3 1 NULL
|
||||
commit;
|
||||
(a) Before the update statement is executed.
|
||||
select rowid, f1, f2 from t1;
|
||||
rowid f1 f2
|
||||
1 1 10
|
||||
2 1 NULL
|
||||
SET SESSION debug_dbug="+d,bug14007649";
|
||||
update t1 set f2 = 6 where f1 = 1 and f2 is null;
|
||||
(a) Number of rows updated:
|
||||
select row_count();
|
||||
row_count()
|
||||
1
|
||||
(a) After the update statement is executed.
|
||||
select rowid, f1, f2 from t1;
|
||||
rowid f1 f2
|
||||
1 1 10
|
||||
2 1 NULL
|
||||
3 1 6
|
||||
commit;
|
||||
"The trx with consistent snapshot ended."
|
||||
select rowid, f1, f2 from t1;
|
||||
rowid f1 f2
|
||||
1 1 10
|
||||
2 1 4
|
||||
3 1 6
|
||||
drop table t1;
|
42
mysql-test/suite/innodb/t/innodb_bug12902967.test
Normal file
42
mysql-test/suite/innodb/t/innodb_bug12902967.test
Normal file
@ -0,0 +1,42 @@
|
||||
# Bug 12902967: Creating self referencing fk on same index unhandled,
|
||||
# confusing error
|
||||
#
|
||||
# Creating a self referencing foreign key on the same
|
||||
# column/index is an unhandled exception, it should throw a sensible
|
||||
# error but instead implies that your data dictionary may now be out
|
||||
# of sync:
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
let error_log= $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
create table t1 (f1 integer primary key) engine innodb;
|
||||
|
||||
# The below statement should produce error message in error log.
|
||||
# This error message should mention problem with foreign keys
|
||||
# rather than with data dictionary.
|
||||
--replace_regex /'\.\/test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
|
||||
--error ER_ERROR_ON_RENAME
|
||||
alter table t1 add constraint c1 foreign key (f1) references t1(f1);
|
||||
--source include/restart_mysqld.inc
|
||||
perl;
|
||||
|
||||
$file = "$ENV{'error_log'}";
|
||||
open ( FILE, $file) || die "can't open file! ($file)\n";
|
||||
@lines = <FILE>;
|
||||
close (FILE);
|
||||
$count = 0;
|
||||
foreach $line (reverse @lines) {
|
||||
if ($line =~ "^InnoDB:") {
|
||||
++$count;
|
||||
print "$line";
|
||||
if ($count == 2) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
drop table t1;
|
63
mysql-test/suite/innodb/t/innodb_bug14007649.test
Normal file
63
mysql-test/suite/innodb/t/innodb_bug14007649.test
Normal file
@ -0,0 +1,63 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
|
||||
if (`select plugin_auth_version <= "1.1.8-24.1" from information_schema.plugins where plugin_name='innodb'`)
|
||||
{
|
||||
--skip Not fixed in XtraDB 1.1.8-24.1 or earlier
|
||||
}
|
||||
|
||||
create table t1 (
|
||||
rowid int,
|
||||
f1 int,
|
||||
f2 int,
|
||||
key i1 (f1, f2),
|
||||
key i2 (f2)) engine=innodb;
|
||||
|
||||
show create table t1;
|
||||
insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
|
||||
|
||||
connect (a,localhost,root,,);
|
||||
connect (b,localhost,root,,);
|
||||
|
||||
connection a;
|
||||
start transaction with consistent snapshot;
|
||||
|
||||
connection b;
|
||||
start transaction;
|
||||
update t1 set f2 = 4 where f1 = 1 and f2 is null;
|
||||
|
||||
-- echo (b) Number of rows updated:
|
||||
select row_count();
|
||||
|
||||
insert into t1 values (3, 1, null);
|
||||
|
||||
-- echo (b) After update and insert query.
|
||||
select rowid, f1, f2 from t1;
|
||||
|
||||
commit;
|
||||
|
||||
connection a;
|
||||
|
||||
-- echo (a) Before the update statement is executed.
|
||||
select rowid, f1, f2 from t1;
|
||||
|
||||
SET SESSION debug_dbug="+d,bug14007649";
|
||||
update t1 set f2 = 6 where f1 = 1 and f2 is null;
|
||||
|
||||
-- echo (a) Number of rows updated:
|
||||
select row_count();
|
||||
|
||||
-- echo (a) After the update statement is executed.
|
||||
select rowid, f1, f2 from t1;
|
||||
|
||||
commit;
|
||||
|
||||
--echo "The trx with consistent snapshot ended."
|
||||
|
||||
select rowid, f1, f2 from t1;
|
||||
|
||||
connection default;
|
||||
disconnect a;
|
||||
disconnect b;
|
||||
|
||||
drop table t1;
|
41
mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result
Normal file
41
mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result
Normal file
@ -0,0 +1,41 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
|
||||
create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam;
|
||||
create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb;
|
||||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||
create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb;
|
||||
set @@binlog_format=statement;
|
||||
*** autoincrement field is not the first in PK warning must be there: ***
|
||||
insert into tm set b=null, a=1;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.
|
||||
*** no warning when autoincrement is the first in PK
|
||||
insert into ti set b=null, a=1;
|
||||
show warnings;
|
||||
Level Code Message
|
||||
create function multi_part_pk_with_autoinc (arg int)
|
||||
returns int
|
||||
begin
|
||||
insert into tm set b=null, a=arg;
|
||||
return arg;
|
||||
end//
|
||||
select multi_part_pk_with_autoinc (3);
|
||||
multi_part_pk_with_autoinc (3)
|
||||
3
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.
|
||||
*** autoincrement field is not the first in PK warning must be there: ***
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe.
|
||||
set @@binlog_format=mixed;
|
||||
insert into tm set b=null, a=2;
|
||||
drop table tm, ti;
|
||||
drop function multi_part_pk_with_autoinc;
|
||||
include/rpl_end.inc
|
@ -114,4 +114,23 @@ id c
|
||||
3 3
|
||||
[on master]
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b INT, c INT);
|
||||
CREATE TABLE test.t1 (a INT);
|
||||
INSERT INTO test.t1 VALUES(1);
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
CREATE TABLE test.t_slave (a INT AUTO_INCREMENT PRIMARY KEY, b INT, c INT);
|
||||
CREATE TRIGGER t1_update AFTER UPDATE ON test.t1 FOR EACH ROW
|
||||
INSERT INTO test.t_slave VALUES(NULL, ROUND(RAND() * 1000), @c);
|
||||
SET INSERT_ID=2;
|
||||
SET @c=2;
|
||||
SET @@rand_seed1=10000000, @@rand_seed2=1000000;
|
||||
INSERT INTO t5 VALUES (NULL, ROUND(RAND() * 1000), @c);
|
||||
SELECT b into @b FROM test.t5;
|
||||
UPDATE test.t1 SET a=2;
|
||||
SELECT a AS 'ONE' into @a FROM test.t_slave;
|
||||
SELECT c AS 'NULL' into @c FROM test.t_slave;
|
||||
SELECT b into @b FROM test.t_slave;
|
||||
drop table test.t5;
|
||||
drop table test.t1;
|
||||
drop table test.t_slave;
|
||||
include/rpl_end.inc
|
||||
|
@ -0,0 +1,13 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
[connection slave]
|
||||
SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end';
|
||||
SHOW BINLOG EVENTS;
|
||||
[connection slave1]
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
|
||||
FLUSH LOGS;
|
||||
SET DEBUG_SYNC= 'now SIGNAL end';
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
[connection slave]
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
include/rpl_end.inc
|
@ -3,8 +3,8 @@ include/master-slave.inc
|
||||
include/rpl_restart_server.inc [server_number=2 parameters: --report-port=9000]
|
||||
include/start_slave.inc
|
||||
[Slave restarted with the report-port set to some value]
|
||||
include/assert.inc [The value shown for the slave's port number is 9000 which is the value set for report-port.]
|
||||
include/rpl_restart_server.inc [server_number=2 parameters: --report-port=]
|
||||
include/assert.inc [The value shown for the slave's port number is user specified port number which is the value set for report-port.]
|
||||
include/rpl_restart_server.inc [server_number=2]
|
||||
include/start_slave.inc
|
||||
[Slave restarted with the report-port set to the value of slave's port number]
|
||||
include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.]
|
||||
|
62
mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test
Normal file
62
mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test
Normal file
@ -0,0 +1,62 @@
|
||||
# Test of auto-increment.
|
||||
#
|
||||
# BUG#11754117-45670
|
||||
# Multipart primary key with the autoincrement part not first in it
|
||||
# is replication unsafe.
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/have_binlog_format_mixed.inc;
|
||||
source include/have_innodb.inc;
|
||||
|
||||
call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
|
||||
|
||||
--connection master
|
||||
create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam;
|
||||
--error ER_WRONG_AUTO_KEY
|
||||
create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb;
|
||||
create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb;
|
||||
|
||||
set @@binlog_format=statement;
|
||||
--echo *** autoincrement field is not the first in PK warning must be there: ***
|
||||
insert into tm set b=null, a=1;
|
||||
show warnings;
|
||||
--echo *** no warning when autoincrement is the first in PK
|
||||
insert into ti set b=null, a=1;
|
||||
show warnings;
|
||||
|
||||
delimiter //;
|
||||
create function multi_part_pk_with_autoinc (arg int)
|
||||
returns int
|
||||
begin
|
||||
insert into tm set b=null, a=arg;
|
||||
return arg;
|
||||
end//
|
||||
delimiter ;//
|
||||
|
||||
select multi_part_pk_with_autoinc (3);
|
||||
--echo *** autoincrement field is not the first in PK warning must be there: ***
|
||||
show warnings;
|
||||
|
||||
set @@binlog_format=mixed;
|
||||
insert into tm set b=null, a=2;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
if (`select count(*) <> 3 from tm`)
|
||||
{
|
||||
--echo Wrong result from SELECT on the slave side.
|
||||
select * from tm;
|
||||
--die
|
||||
}
|
||||
|
||||
# cleanup
|
||||
|
||||
--connection master
|
||||
|
||||
drop table tm, ti;
|
||||
drop function multi_part_pk_with_autoinc;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--source include/rpl_end.inc
|
@ -206,4 +206,64 @@ SELECT * FROM t3;
|
||||
connection master;
|
||||
echo [on master];
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
#
|
||||
# BUG#11754117 - 45670: INTVAR_EVENTS FOR FILTERED-OUT QUERY_LOG_EVENTS ARE EXECUTED
|
||||
# Int-, Rand- and User- var events accompaning a filtered out Query-log-event should
|
||||
# be filtered as well.
|
||||
#
|
||||
connection master;
|
||||
CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b INT, c INT); # ignored on slave
|
||||
CREATE TABLE test.t1 (a INT); # accepted on slave
|
||||
INSERT INTO test.t1 VALUES(1);
|
||||
|
||||
--sync_slave_with_master
|
||||
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||
CREATE TABLE test.t_slave (a INT AUTO_INCREMENT PRIMARY KEY, b INT, c INT);
|
||||
CREATE TRIGGER t1_update AFTER UPDATE ON test.t1 FOR EACH ROW
|
||||
INSERT INTO test.t_slave VALUES(NULL, ROUND(RAND() * 1000), @c);
|
||||
|
||||
connection master;
|
||||
SET INSERT_ID=2;
|
||||
SET @c=2;
|
||||
SET @@rand_seed1=10000000, @@rand_seed2=1000000;
|
||||
INSERT INTO t5 VALUES (NULL, ROUND(RAND() * 1000), @c); # to be ignored
|
||||
SELECT b into @b FROM test.t5;
|
||||
--let $b_master=`select @b`
|
||||
UPDATE test.t1 SET a=2; # to run trigger on slave
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
# The proof:
|
||||
SELECT a AS 'ONE' into @a FROM test.t_slave;
|
||||
SELECT c AS 'NULL' into @c FROM test.t_slave;
|
||||
|
||||
let $count= 1;
|
||||
let $table= test.t_slave;
|
||||
source include/wait_until_rows_count.inc;
|
||||
|
||||
if (`SELECT @a != 2 and @c != NULL`)
|
||||
{
|
||||
SELECT * FROM test.t_slave;
|
||||
--die Intvar or user var from replication events unexpetedly escaped out to screw a following query applying context.
|
||||
}
|
||||
|
||||
SELECT b into @b FROM test.t_slave;
|
||||
--let $b_slave=`select @b`
|
||||
|
||||
if (`SELECT $b_slave = $b_master`)
|
||||
{
|
||||
--echo Might be pure coincidence of two randoms from master and slave table. Don not panic yet.
|
||||
}
|
||||
|
||||
# cleanup BUG#11754117
|
||||
connection master;
|
||||
drop table test.t5;
|
||||
drop table test.t1;
|
||||
|
||||
--sync_slave_with_master
|
||||
drop table test.t_slave;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
|
@ -0,0 +1,35 @@
|
||||
# BUG#13979418: SHOW BINLOG EVENTS MAY CRASH THE SERVER
|
||||
#
|
||||
# The function mysql_show_binlog_events has a local stack variable
|
||||
# 'LOG_INFO linfo;', which is assigned to thd->current_linfo, however
|
||||
# this variable goes out of scope and is destroyed before clean
|
||||
# thd->current_linfo.
|
||||
#
|
||||
# This test case runs SHOW BINLOG EVENTS and FLUSH LOGS to make sure
|
||||
# that with the fix local variable linfo is valid along all
|
||||
# mysql_show_binlog_events function scope.
|
||||
#
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
--echo [connection slave]
|
||||
--connection slave
|
||||
SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end';
|
||||
--send SHOW BINLOG EVENTS
|
||||
|
||||
--connection slave1
|
||||
--echo [connection slave1]
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
|
||||
FLUSH LOGS;
|
||||
SET DEBUG_SYNC= 'now SIGNAL end';
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
|
||||
--echo [connection slave]
|
||||
--connection slave
|
||||
--disable_result_log
|
||||
--reap
|
||||
--enable_result_log
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
|
||||
--connection master
|
||||
--source include/rpl_end.inc
|
@ -38,21 +38,23 @@ connection master;
|
||||
|
||||
# 9000 is the value of the port we should get.
|
||||
--let $report_port= query_get_value(SHOW SLAVE HOSTS, Port, 1)
|
||||
--let assert_text= The value shown for the slave's port number is 9000 which is the value set for report-port.
|
||||
--let assert_text= The value shown for the slave's port number is user specified port number which is the value set for report-port.
|
||||
--let assert_cond= $report_port = "9000"
|
||||
--source include/assert.inc
|
||||
|
||||
|
||||
# Start the server with the report-port being passed with no value. So on SHOW SLAVE HOSTS
|
||||
# on the master the value of slave's port should be the actual value of the slave port.
|
||||
connection master;
|
||||
|
||||
--let $rpl_server_number= 2
|
||||
--let $rpl_server_parameters= --report-port=
|
||||
--let $rpl_server_parameters=
|
||||
--source include/rpl_restart_server.inc
|
||||
|
||||
connection slave;
|
||||
--source include/start_slave.inc
|
||||
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
--echo [Slave restarted with the report-port set to the value of slave's port number]
|
||||
|
||||
connection master;
|
||||
|
51
mysql-test/t/bug12427262.test
Normal file
51
mysql-test/t/bug12427262.test
Normal file
@ -0,0 +1,51 @@
|
||||
--echo #
|
||||
--echo # Bug#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE.
|
||||
--echo #
|
||||
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_perfschema.inc
|
||||
|
||||
--disable_warnings
|
||||
create database show_table_lw_db;
|
||||
use show_table_lw_db;
|
||||
create table t1 (c1 int);
|
||||
create table t2 (c1 int);
|
||||
create table t3 (c1 int);
|
||||
create table t4 (c1 int);
|
||||
create table t5 (c1 int);
|
||||
create table t6 (c1 int);
|
||||
create table t7 (c1 int);
|
||||
create table t8 (c1 int);
|
||||
create table t9 (c1 int);
|
||||
create table t10 (c1 int);
|
||||
--enable_warnings
|
||||
|
||||
# Query PS to know initial read count for frm file.
|
||||
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||
like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
|
||||
into @count_read_before;
|
||||
|
||||
show tables;
|
||||
|
||||
# Query PS to know read count for frm file after above query. It should
|
||||
# not be changed as FRM file will not be opened for above query.
|
||||
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||
like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
|
||||
into @count_read_after;
|
||||
|
||||
select @count_read_after-@count_read_before;
|
||||
|
||||
show full tables;
|
||||
|
||||
# Query PS to know read count for frm file after above query. COUNT_READ
|
||||
# will be incremented by 1 as FRM file will be opened for above query.
|
||||
select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME
|
||||
like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM'
|
||||
into @count_read_after;
|
||||
|
||||
select @count_read_after-@count_read_before;
|
||||
|
||||
--disable_warnings
|
||||
drop table t1;
|
||||
drop database show_table_lw_db;
|
||||
--enable_warnings
|
@ -144,5 +144,33 @@ SELECT BIT_XOR(t1.b) FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.pk=1;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#12713907: STRANGE OPTIMIZE & WRONG RESULT UNDER ORDER BY
|
||||
--echo # COUNT(*) LIMIT.
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id BIGINT(20) ,
|
||||
member_id_to INT(11) ,
|
||||
r_date DATE ,
|
||||
PRIMARY KEY (id,r_date),
|
||||
KEY r_date_idx (r_date),
|
||||
KEY t1_idx01 (member_id_to)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES
|
||||
(107924526,518491,'2011-05-01'),
|
||||
(107924527,518491,'2011-05-01'),
|
||||
(107924534,518491,'2011-06-21'),
|
||||
(107924535,518491,'2011-06-21'),
|
||||
(107924542,1601319,'2011-06-21'),
|
||||
(107924543,1601319,'2011-06-21'),
|
||||
(107924544,1601319,'2011-06-21'),
|
||||
(107924545,1601319,'2011-06-21');
|
||||
|
||||
SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
|
||||
'2011-06-21' GROUP BY member_id_to ORDER BY 2 LIMIT 1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.5 tests
|
||||
|
@ -2413,3 +2413,30 @@ RESET MASTER;
|
||||
|
||||
# Wait till we reached the initial number of concurrent sessions
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug#45740 MYSQLDUMP DOESN'T DUMP GENERAL_LOG AND SLOW_QUERY CAUSES RESTORE PROBLEM
|
||||
--echo #
|
||||
SET @old_log_output_state= @@global.log_output;
|
||||
SET @old_general_log_state= @@global.general_log;
|
||||
SET @old_slow_query_log_state= @@global.slow_query_log;
|
||||
|
||||
call mtr.add_suppression("Failed to write to mysql.general_log");
|
||||
--exec $MYSQL_DUMP -uroot --all-databases > $MYSQLTEST_VARDIR/tmp/bug45740.sql
|
||||
# Make log_output as table and disabling general_log and slow_log
|
||||
SET @@global.log_output="TABLE";
|
||||
SET @@global.general_log='OFF';
|
||||
SET @@global.slow_query_log='OFF';
|
||||
DROP DATABASE mysql;
|
||||
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug45740.sql
|
||||
SHOW CREATE TABLE mysql.general_log;
|
||||
SHOW CREATE TABLE mysql.slow_log;
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/bug45740.sql
|
||||
|
||||
SET @@global.log_output= @old_log_output_state;
|
||||
SET @@global.slow_query_log= @old_slow_query_log_state;
|
||||
SET @@global.general_log= @old_general_log_state;
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.1 tests
|
||||
--echo #
|
||||
|
@ -4461,3 +4461,4 @@ SELECT * FROM t1, t2 WHERE a=3 AND a=b;
|
||||
drop table t1,t2;
|
||||
|
||||
--echo End of 5.3 tests
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008-2011 Monty Program Ab
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2011, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef FIELD_INCLUDED
|
||||
#define FIELD_INCLUDED
|
||||
/* Copyright (c) 2000, 2011 Oracle and/or its affiliates.
|
||||
Copyright (c) 2008-2011 Monty Program Ab
|
||||
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2011, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,5 +1,7 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2012, Monty Program Ab
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2002, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2011, Monty Program Ab
|
||||
/* Copyright (c) 2002, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2012, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -222,6 +222,11 @@ class Relay_log_info;
|
||||
extern PSI_mutex_key key_LOG_INFO_lock;
|
||||
#endif
|
||||
|
||||
/*
|
||||
Note that we destroy the lock mutex in the desctructor here.
|
||||
This means that object instances cannot be destroyed/go out of scope,
|
||||
until we have reset thd->current_linfo to NULL;
|
||||
*/
|
||||
typedef struct st_log_info
|
||||
{
|
||||
char log_file_name[FN_REFLEN];
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2012, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -5838,11 +5839,12 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
|
||||
|
||||
/*
|
||||
Intvar_log_event::do_apply_event()
|
||||
*/
|
||||
|
||||
#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
|
||||
int Intvar_log_event::do_apply_event(Relay_log_info const *rli)
|
||||
{
|
||||
/*
|
||||
@ -5851,6 +5853,9 @@ int Intvar_log_event::do_apply_event(Relay_log_info const *rli)
|
||||
*/
|
||||
const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
|
||||
|
||||
if (rli->deferred_events_collecting)
|
||||
return rli->deferred_events->add(this);
|
||||
|
||||
switch (type) {
|
||||
case LAST_INSERT_ID_EVENT:
|
||||
thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 1;
|
||||
@ -5957,6 +5962,9 @@ int Rand_log_event::do_apply_event(Relay_log_info const *rli)
|
||||
*/
|
||||
const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
|
||||
|
||||
if (rli->deferred_events_collecting)
|
||||
return rli->deferred_events->add(this);
|
||||
|
||||
thd->rand.seed1= (ulong) seed1;
|
||||
thd->rand.seed2= (ulong) seed2;
|
||||
return 0;
|
||||
@ -5983,6 +5991,29 @@ Rand_log_event::do_shall_skip(Relay_log_info *rli)
|
||||
return continue_group(rli);
|
||||
}
|
||||
|
||||
/**
|
||||
Exec deferred Int-, Rand- and User- var events prefixing
|
||||
a Query-log-event event.
|
||||
|
||||
@param thd THD handle
|
||||
|
||||
@return false on success, true if a failure in an event applying occurred.
|
||||
*/
|
||||
bool slave_execute_deferred_events(THD *thd)
|
||||
{
|
||||
bool res= false;
|
||||
Relay_log_info *rli= thd->rli_slave;
|
||||
|
||||
DBUG_ASSERT(rli && (!rli->deferred_events_collecting || rli->deferred_events));
|
||||
|
||||
if (!rli->deferred_events_collecting || rli->deferred_events->is_empty())
|
||||
return res;
|
||||
|
||||
res= rli->deferred_events->execute(rli);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif /* !MYSQL_CLIENT */
|
||||
|
||||
|
||||
@ -6421,6 +6452,10 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
|
||||
{
|
||||
Item *it= 0;
|
||||
CHARSET_INFO *charset;
|
||||
|
||||
if (rli->deferred_events_collecting)
|
||||
return rli->deferred_events->add(this);
|
||||
|
||||
if (!(charset= get_charset(charset_number, MYF(MY_WME))))
|
||||
return 1;
|
||||
LEX_STRING user_var_name;
|
||||
|
@ -4258,6 +4258,14 @@ private:
|
||||
const char* log_ident;
|
||||
uint ident_len;
|
||||
};
|
||||
|
||||
/**
|
||||
The function is called by slave applier in case there are
|
||||
active table filtering rules to force gathering events associated
|
||||
with Query-log-event into an array to execute
|
||||
them once the fate of the Query is determined for execution.
|
||||
*/
|
||||
bool slave_execute_deferred_events(THD *thd);
|
||||
#endif
|
||||
|
||||
int append_query_string(THD *thd, CHARSET_INFO *csinfo,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2007, 2010, Oracle and/or its affiliates.
|
||||
/* Copyright (c) 2007, 2012, Oracle and/or its affiliates.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2012, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -52,8 +52,8 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery)
|
||||
inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
|
||||
until_log_pos(0), retried_trans(0),
|
||||
tables_to_lock(0), tables_to_lock_count(0),
|
||||
last_event_start_time(0), m_flags(0), row_stmt_start_timestamp(0),
|
||||
long_find_row_note_printed(false),
|
||||
last_event_start_time(0), deferred_events(NULL),m_flags(0),
|
||||
row_stmt_start_timestamp(0), long_find_row_note_printed(false),
|
||||
m_annotate_event(0)
|
||||
{
|
||||
DBUG_ENTER("Relay_log_info::Relay_log_info");
|
||||
|
@ -389,6 +389,41 @@ public:
|
||||
*/
|
||||
time_t last_event_start_time;
|
||||
|
||||
/*
|
||||
A container to hold on Intvar-, Rand-, Uservar- log-events in case
|
||||
the slave is configured with table filtering rules.
|
||||
The withhold events are executed when their parent Query destiny is
|
||||
determined for execution as well.
|
||||
*/
|
||||
Deferred_log_events *deferred_events;
|
||||
|
||||
/*
|
||||
State of the container: true stands for IRU events gathering,
|
||||
false does for execution, either deferred or direct.
|
||||
*/
|
||||
bool deferred_events_collecting;
|
||||
|
||||
/*
|
||||
Returns true if the argument event resides in the containter;
|
||||
more specifically, the checking is done against the last added event.
|
||||
*/
|
||||
bool is_deferred_event(Log_event * ev)
|
||||
{
|
||||
return deferred_events_collecting ? deferred_events->is_last(ev) : false;
|
||||
};
|
||||
/* The general cleanup that slave applier may need at the end of query. */
|
||||
inline void cleanup_after_query()
|
||||
{
|
||||
if (deferred_events)
|
||||
deferred_events->rewind();
|
||||
};
|
||||
/* The general cleanup that slave applier may need at the end of session. */
|
||||
void cleanup_after_session()
|
||||
{
|
||||
if (deferred_events)
|
||||
delete deferred_events;
|
||||
};
|
||||
|
||||
/**
|
||||
Helper function to do after statement completion.
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#ifndef MYSQL_CLIENT
|
||||
#include "unireg.h" // REQUIRED by later includes
|
||||
#include "rpl_rli.h"
|
||||
#include "log_event.h"
|
||||
#include "sql_select.h"
|
||||
|
||||
/**
|
||||
@ -1057,6 +1058,7 @@ table_def::~table_def()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@param even_buf point to the buffer containing serialized event
|
||||
@param event_len length of the event accounting possible checksum alg
|
||||
@ -1112,3 +1114,67 @@ bool event_checksum_test(uchar *event_buf, ulong event_len, uint8 alg)
|
||||
}
|
||||
return DBUG_EVALUATE_IF("simulate_checksum_test_failure", TRUE, res);
|
||||
}
|
||||
|
||||
|
||||
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
|
||||
|
||||
Deferred_log_events::Deferred_log_events(Relay_log_info *rli) : last_added(NULL)
|
||||
{
|
||||
my_init_dynamic_array(&array, sizeof(Log_event *), 32, 16);
|
||||
}
|
||||
|
||||
Deferred_log_events::~Deferred_log_events()
|
||||
{
|
||||
delete_dynamic(&array);
|
||||
}
|
||||
|
||||
int Deferred_log_events::add(Log_event *ev)
|
||||
{
|
||||
last_added= ev;
|
||||
insert_dynamic(&array, (uchar*) &ev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Deferred_log_events::is_empty()
|
||||
{
|
||||
return array.elements == 0;
|
||||
}
|
||||
|
||||
bool Deferred_log_events::execute(Relay_log_info *rli)
|
||||
{
|
||||
bool res= false;
|
||||
|
||||
DBUG_ASSERT(rli->deferred_events_collecting);
|
||||
|
||||
rli->deferred_events_collecting= false;
|
||||
for (uint i= 0; !res && i < array.elements; i++)
|
||||
{
|
||||
Log_event *ev= (* (Log_event **)
|
||||
dynamic_array_ptr(&array, i));
|
||||
res= ev->apply_event(rli);
|
||||
}
|
||||
rli->deferred_events_collecting= true;
|
||||
return res;
|
||||
}
|
||||
|
||||
void Deferred_log_events::rewind()
|
||||
{
|
||||
/*
|
||||
Reset preceeding Query log event events which execution was
|
||||
deferred because of slave side filtering.
|
||||
*/
|
||||
if (!is_empty())
|
||||
{
|
||||
for (uint i= 0; i < array.elements; i++)
|
||||
{
|
||||
Log_event *ev= *(Log_event **) dynamic_array_ptr(&array, i);
|
||||
delete ev;
|
||||
}
|
||||
if (array.elements > array.max_element)
|
||||
freeze_size(&array);
|
||||
reset_dynamic(&array);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "mysql_com.h"
|
||||
|
||||
class Relay_log_info;
|
||||
|
||||
class Log_event;
|
||||
|
||||
/**
|
||||
A table definition from the master.
|
||||
@ -262,6 +262,24 @@ CPP_UNNAMED_NS_START
|
||||
};
|
||||
|
||||
CPP_UNNAMED_NS_END
|
||||
|
||||
class Deferred_log_events
|
||||
{
|
||||
private:
|
||||
DYNAMIC_ARRAY array;
|
||||
Log_event *last_added;
|
||||
|
||||
public:
|
||||
Deferred_log_events(Relay_log_info *rli);
|
||||
~Deferred_log_events();
|
||||
/* queue for exection at Query-log-event time prior the Query */;
|
||||
int add(Log_event *ev);
|
||||
bool is_empty();
|
||||
bool execute(Relay_log_info *rli);
|
||||
void rewind();
|
||||
bool is_last(Log_event *ev) { return ev == last_added; };
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// NB. number of printed bit values is limited to sizeof(buf) - 1
|
||||
|
@ -6501,6 +6501,9 @@ ER_TABLE_IN_FK_CHECK
|
||||
ER_UNUSED_1
|
||||
eng "You should never see it"
|
||||
|
||||
ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST
|
||||
eng "INSERT into autoincrement field which is not the first part in the composed primary key is unsafe."
|
||||
|
||||
#
|
||||
# End of 5.5 error messages.
|
||||
#
|
||||
|
@ -2794,7 +2794,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
|
||||
/* fall through */
|
||||
default:
|
||||
DBUG_PRINT("info", ("Deleting the event after it has been executed"));
|
||||
delete ev;
|
||||
if (!rli->is_deferred_event(ev))
|
||||
delete ev;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3458,6 +3459,12 @@ pthread_handler_t handle_slave_sql(void *arg)
|
||||
goto err_during_init;
|
||||
}
|
||||
thd->init_for_queries();
|
||||
thd->rli_slave= rli;
|
||||
if ((rli->deferred_events_collecting= rpl_filter->is_on()))
|
||||
{
|
||||
rli->deferred_events= new Deferred_log_events(rli);
|
||||
}
|
||||
|
||||
thd->temporary_tables = rli->save_temporary_tables; // restore temp tables
|
||||
set_thd_in_use_temporary_tables(rli); // (re)set sql_thd in use for saved temp tables
|
||||
/*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2002, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2011, Monty Program Ab
|
||||
Copyright (c) 2002, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2011, 2012, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -219,6 +219,7 @@ static bool
|
||||
has_write_table_with_auto_increment(TABLE_LIST *tables);
|
||||
static bool
|
||||
has_write_table_with_auto_increment_and_select(TABLE_LIST *tables);
|
||||
static bool has_write_table_auto_increment_not_first_in_pk(TABLE_LIST *tables);
|
||||
|
||||
uint cached_open_tables(void)
|
||||
{
|
||||
@ -5745,6 +5746,12 @@ bool lock_tables(THD *thd, TABLE_LIST *tables, uint count,
|
||||
if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables &&
|
||||
has_write_table_with_auto_increment_and_select(tables))
|
||||
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_WRITE_AUTOINC_SELECT);
|
||||
/* Todo: merge all has_write_table_auto_inc with decide_logging_format */
|
||||
if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables)
|
||||
{
|
||||
if (has_write_table_auto_increment_not_first_in_pk(tables))
|
||||
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_AUTOINC_NOT_FIRST);
|
||||
}
|
||||
|
||||
/*
|
||||
INSERT...ON DUPLICATE KEY UPDATE on a table with more than one unique keys
|
||||
@ -9506,6 +9513,32 @@ has_write_table_with_auto_increment_and_select(TABLE_LIST *tables)
|
||||
return(has_select && has_auto_increment_tables);
|
||||
}
|
||||
|
||||
/*
|
||||
Tells if there is a table whose auto_increment column is a part
|
||||
of a compound primary key while is not the first column in
|
||||
the table definition.
|
||||
|
||||
@param tables Table list
|
||||
|
||||
@return true if the table exists, fais if does not.
|
||||
*/
|
||||
|
||||
static bool
|
||||
has_write_table_auto_increment_not_first_in_pk(TABLE_LIST *tables)
|
||||
{
|
||||
for (TABLE_LIST *table= tables; table; table= table->next_global)
|
||||
{
|
||||
/* we must do preliminary checks as table->table may be NULL */
|
||||
if (!table->placeholder() &&
|
||||
table->table->found_next_number_field &&
|
||||
(table->lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||
&& table->table->s->next_number_keypart != 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008-2012 Monty Program Ab
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2012, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -726,7 +726,7 @@ bool Drop_table_error_handler::handle_condition(THD *thd,
|
||||
THD::THD()
|
||||
:Statement(&main_lex, &main_mem_root, STMT_CONVENTIONAL_EXECUTION,
|
||||
/* statement id */ 0),
|
||||
rli_fake(0),
|
||||
rli_fake(0), rli_slave(NULL),
|
||||
in_sub_stmt(0), log_all_errors(0),
|
||||
binlog_unsafe_warning_flags(0),
|
||||
binlog_table_maps(0),
|
||||
@ -1412,6 +1412,8 @@ THD::~THD()
|
||||
}
|
||||
|
||||
mysql_audit_free_thd(this);
|
||||
if (rli_slave)
|
||||
rli_slave->cleanup_after_session();
|
||||
#endif
|
||||
|
||||
free_root(&main_mem_root, MYF(0));
|
||||
@ -1791,6 +1793,11 @@ void THD::cleanup_after_query()
|
||||
table_map_for_update= 0;
|
||||
m_binlog_invoker= FALSE;
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (rli_slave)
|
||||
rli_slave->cleanup_after_query();
|
||||
#endif
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009-2012, Monty Program Ab
|
||||
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2012, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -1547,6 +1547,8 @@ public:
|
||||
|
||||
/* Used to execute base64 coded binlog events in MySQL server */
|
||||
Relay_log_info* rli_fake;
|
||||
/* Slave applier execution context */
|
||||
Relay_log_info* rli_slave;
|
||||
|
||||
void reset_for_next_command(bool calculate_userstat);
|
||||
/*
|
||||
|
@ -68,7 +68,8 @@ Query_tables_list::binlog_stmt_unsafe_errcode[BINLOG_STMT_UNSAFE_COUNT] =
|
||||
ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT,
|
||||
ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC,
|
||||
ER_BINLOG_UNSAFE_UPDATE_IGNORE,
|
||||
ER_BINLOG_UNSAFE_INSERT_TWO_KEYS
|
||||
ER_BINLOG_UNSAFE_INSERT_TWO_KEYS,
|
||||
ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST
|
||||
};
|
||||
|
||||
|
||||
|
@ -1433,6 +1433,12 @@ public:
|
||||
*/
|
||||
BINLOG_STMT_UNSAFE_INSERT_TWO_KEYS,
|
||||
|
||||
/**
|
||||
INSERT into auto-inc field which is not the first part of composed
|
||||
primary key.
|
||||
*/
|
||||
BINLOG_STMT_UNSAFE_AUTOINC_NOT_FIRST,
|
||||
|
||||
/* The last element of this enumeration type. */
|
||||
BINLOG_STMT_UNSAFE_COUNT
|
||||
};
|
||||
|
@ -2074,6 +2074,11 @@ mysql_execute_command(THD *thd)
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
/*
|
||||
Execute deferred events first
|
||||
*/
|
||||
if (slave_execute_deferred_events(thd))
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2685,7 +2690,7 @@ end_with_restore_list:
|
||||
goto error;
|
||||
#else
|
||||
{
|
||||
if (check_global_access(thd, SUPER_ACL))
|
||||
if (check_global_access(thd, SUPER_ACL | REPL_CLIENT_ACL))
|
||||
goto error;
|
||||
res = show_binlogs(thd);
|
||||
break;
|
||||
|
@ -1883,6 +1883,8 @@ bool mysql_show_binlog_events(THD* thd)
|
||||
File file = -1;
|
||||
MYSQL_BIN_LOG *binary_log= NULL;
|
||||
int old_max_allowed_packet= thd->variables.max_allowed_packet;
|
||||
LOG_INFO linfo;
|
||||
|
||||
DBUG_ENTER("mysql_show_binlog_events");
|
||||
|
||||
Log_event::init_show_field_list(&field_list);
|
||||
@ -1925,7 +1927,6 @@ bool mysql_show_binlog_events(THD* thd)
|
||||
char search_file_name[FN_REFLEN], *name;
|
||||
const char *log_file_name = lex_mi->log_file_name;
|
||||
mysql_mutex_t *log_lock = binary_log->get_log_lock();
|
||||
LOG_INFO linfo;
|
||||
Log_event* ev;
|
||||
|
||||
unit->set_limit(thd->lex->current_select);
|
||||
@ -2022,6 +2023,8 @@ bool mysql_show_binlog_events(THD* thd)
|
||||
|
||||
mysql_mutex_unlock(log_lock);
|
||||
}
|
||||
// Check that linfo is still on the function scope.
|
||||
DEBUG_SYNC(thd, "after_show_binlog_events");
|
||||
|
||||
ret= FALSE;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates.
|
||||
2009-2011 Monty Program Ab
|
||||
/* Copyright (c) 2000, 2012 Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2012, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -18594,8 +18594,6 @@ check_reverse_order:
|
||||
join_read_first:join_read_last;
|
||||
tab->type=JT_NEXT; // Read with index_first(), index_next()
|
||||
|
||||
if (table->covering_keys.is_set(best_key) && ! table->key_read)
|
||||
table->enable_keyread();
|
||||
if (tab->pre_idx_push_select_cond)
|
||||
{
|
||||
tab->set_cond(tab->pre_idx_push_select_cond);
|
||||
@ -18606,6 +18604,7 @@ check_reverse_order:
|
||||
orig_cond= 0;
|
||||
orig_cond_saved= false;
|
||||
}
|
||||
|
||||
table->file->ha_index_or_rnd_end();
|
||||
if (tab->join->select_options & SELECT_DESCRIBE)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2011, Monty Program Ab
|
||||
Copyright (c) 2009, 2012, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -238,10 +238,17 @@ uint explain_filename(THD* thd,
|
||||
{
|
||||
part_name_len= tmp_p - part_name - 1;
|
||||
subpart_name= tmp_p + 3;
|
||||
tmp_p+= 3;
|
||||
}
|
||||
else if ((tmp_p[1] == 'Q' || tmp_p[1] == 'q') &&
|
||||
(tmp_p[2] == 'L' || tmp_p[2] == 'l') &&
|
||||
tmp_p[3] == '-')
|
||||
{
|
||||
name_type= TEMP;
|
||||
tmp_p+= 4; /* sql- prefix found */
|
||||
}
|
||||
else
|
||||
res= 2;
|
||||
tmp_p+= 3;
|
||||
break;
|
||||
case 'T':
|
||||
case 't':
|
||||
@ -6926,21 +6933,47 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
(void) quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP);
|
||||
}
|
||||
else if (mysql_rename_table(new_db_type, new_db, tmp_name, new_db,
|
||||
new_alias, FN_FROM_IS_TMP) ||
|
||||
((new_name != table_name || new_db != db) && // we also do rename
|
||||
(need_copy_table != ALTER_TABLE_METADATA_ONLY ||
|
||||
mysql_rename_table(save_old_db_type, db, table_name, new_db,
|
||||
new_alias, NO_FRM_RENAME)) &&
|
||||
Table_triggers_list::change_table_name(thd, db, alias, table_name,
|
||||
new_db, new_alias)))
|
||||
new_alias, FN_FROM_IS_TMP))
|
||||
{
|
||||
/* Try to get everything back. */
|
||||
error=1;
|
||||
(void) quick_rm_table(new_db_type,new_db,new_alias, 0);
|
||||
error= 1;
|
||||
(void) quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP);
|
||||
(void) mysql_rename_table(old_db_type, db, old_name, db, alias,
|
||||
FN_FROM_IS_TMP);
|
||||
}
|
||||
else if (new_name != table_name || new_db != db)
|
||||
{
|
||||
if (need_copy_table == ALTER_TABLE_METADATA_ONLY &&
|
||||
mysql_rename_table(save_old_db_type, db, table_name, new_db,
|
||||
new_alias, NO_FRM_RENAME))
|
||||
{
|
||||
/* Try to get everything back. */
|
||||
error= 1;
|
||||
(void) quick_rm_table(new_db_type, new_db, new_alias, 0);
|
||||
(void) mysql_rename_table(old_db_type, db, old_name, db, alias,
|
||||
FN_FROM_IS_TMP);
|
||||
}
|
||||
else if (Table_triggers_list::change_table_name(thd, db, alias,
|
||||
table_name, new_db,
|
||||
new_alias))
|
||||
{
|
||||
/* Try to get everything back. */
|
||||
error= 1;
|
||||
(void) quick_rm_table(new_db_type, new_db, new_alias, 0);
|
||||
(void) mysql_rename_table(old_db_type, db, old_name, db,
|
||||
alias, FN_FROM_IS_TMP);
|
||||
/*
|
||||
If we were performing "fast"/in-place ALTER TABLE we also need
|
||||
to restore old name of table in storage engine as a separate
|
||||
step, as the above rename affects .FRM only.
|
||||
*/
|
||||
if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
|
||||
{
|
||||
(void) mysql_rename_table(save_old_db_type, new_db, new_alias,
|
||||
db, table_name, NO_FRM_RENAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! error)
|
||||
(void) quick_rm_table(old_db_type, db, old_name, FN_IS_TMP);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -3463,6 +3463,8 @@ btr_estimate_n_rows_in_range(
|
||||
n_rows = n_rows * 2;
|
||||
}
|
||||
|
||||
DBUG_EXECUTE_IF("bug14007649", return(n_rows););
|
||||
|
||||
/* Do not estimate the number of rows in the range
|
||||
to over 1 / 2 of the estimated rows in the whole
|
||||
table */
|
||||
|
@ -1750,8 +1750,6 @@ buf_flush_batch(
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
srv_buf_pool_flushed += count;
|
||||
|
||||
return(count);
|
||||
}
|
||||
|
||||
@ -1778,13 +1776,6 @@ buf_flush_common(
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
srv_buf_pool_flushed += page_count;
|
||||
|
||||
if (flush_type == BUF_FLUSH_LRU) {
|
||||
/* We keep track of all flushes happening as part of LRU
|
||||
flush. When estimating the desired rate at which flush_list
|
||||
should be flushed we factor in this value. */
|
||||
buf_lru_flush_page_count += page_count;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
|
@ -177,7 +177,7 @@ dict_print(void)
|
||||
monitor printout */
|
||||
|
||||
mutex_enter(&kernel_mutex);
|
||||
srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
|
||||
srv_fatal_semaphore_wait_threshold += SRV_SEMAPHORE_WAIT_EXTENSION;
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
heap = mem_heap_create(1000);
|
||||
@ -214,7 +214,7 @@ dict_print(void)
|
||||
|
||||
/* Restore the fatal semaphore wait timeout */
|
||||
mutex_enter(&kernel_mutex);
|
||||
srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
|
||||
srv_fatal_semaphore_wait_threshold -= SRV_SEMAPHORE_WAIT_EXTENSION;
|
||||
mutex_exit(&kernel_mutex);
|
||||
}
|
||||
|
||||
|
@ -1908,7 +1908,7 @@ fil_inc_pending_ops(
|
||||
|
||||
if (space == NULL) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: trying to do ibuf merge to a"
|
||||
"InnoDB: Error: trying to do an operation on a"
|
||||
" dropped tablespace %lu\n",
|
||||
(ulong) id);
|
||||
}
|
||||
|
@ -4197,6 +4197,31 @@ table_opened:
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
UNIV_INTERN
|
||||
handler*
|
||||
ha_innobase::clone(
|
||||
/*===============*/
|
||||
const char* name, /*!< in: table name */
|
||||
MEM_ROOT* mem_root) /*!< in: memory context */
|
||||
{
|
||||
ha_innobase* new_handler;
|
||||
|
||||
DBUG_ENTER("ha_innobase::clone");
|
||||
|
||||
new_handler = static_cast<ha_innobase*>(handler::clone(name,
|
||||
mem_root));
|
||||
if (new_handler) {
|
||||
DBUG_ASSERT(new_handler->prebuilt != NULL);
|
||||
DBUG_ASSERT(new_handler->user_thd == user_thd);
|
||||
DBUG_ASSERT(new_handler->prebuilt->trx == prebuilt->trx);
|
||||
|
||||
new_handler->prebuilt->select_lock_type
|
||||
= prebuilt->select_lock_type;
|
||||
}
|
||||
|
||||
DBUG_RETURN(new_handler);
|
||||
}
|
||||
|
||||
UNIV_INTERN
|
||||
uint
|
||||
ha_innobase::max_supported_key_part_length() const
|
||||
@ -8546,7 +8571,7 @@ ha_innobase::check(
|
||||
|
||||
/* Enlarge the fatal lock wait timeout during CHECK TABLE. */
|
||||
mutex_enter(&kernel_mutex);
|
||||
srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
|
||||
srv_fatal_semaphore_wait_threshold += SRV_SEMAPHORE_WAIT_EXTENSION;
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
for (index = dict_table_get_first_index(prebuilt->table);
|
||||
@ -8687,7 +8712,7 @@ ha_innobase::check(
|
||||
|
||||
/* Restore the fatal lock wait timeout after CHECK TABLE. */
|
||||
mutex_enter(&kernel_mutex);
|
||||
srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
|
||||
srv_fatal_semaphore_wait_threshold -= SRV_SEMAPHORE_WAIT_EXTENSION;
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
prebuilt->trx->op_info = "";
|
||||
|
@ -133,6 +133,7 @@ class ha_innobase: public handler
|
||||
const key_map* keys_to_use_for_scanning();
|
||||
|
||||
int open(const char *name, int mode, uint test_if_locked);
|
||||
handler* clone(const char *name, MEM_ROOT *mem_root);
|
||||
int close(void);
|
||||
double scan_time();
|
||||
double read_time(uint index, uint ranges, ha_rows rows);
|
||||
|
@ -262,6 +262,7 @@ extern ibool srv_print_latch_waits;
|
||||
|
||||
extern ulint srv_activity_count;
|
||||
extern ulint srv_fatal_semaphore_wait_threshold;
|
||||
#define SRV_SEMAPHORE_WAIT_EXTENSION 7200
|
||||
extern ulint srv_dml_needed_delay;
|
||||
|
||||
extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
|
||||
|
@ -1364,10 +1364,18 @@ innobase_start_or_create_for_mysql(void)
|
||||
}
|
||||
# endif /* __WIN__ */
|
||||
|
||||
os_aio_init(io_limit,
|
||||
srv_n_read_io_threads,
|
||||
srv_n_write_io_threads,
|
||||
SRV_MAX_N_PENDING_SYNC_IOS);
|
||||
if (!os_aio_init(io_limit,
|
||||
srv_n_read_io_threads,
|
||||
srv_n_write_io_threads,
|
||||
SRV_MAX_N_PENDING_SYNC_IOS)) {
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fprintf(stderr,
|
||||
" InnoDB: Fatal error: cannot initialize AIO"
|
||||
" sub-system\n");
|
||||
|
||||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
fil_init(srv_file_per_table ? 50000 : 5000,
|
||||
srv_max_n_open_files);
|
||||
|
@ -928,6 +928,11 @@ sync_array_print_long_waits(
|
||||
ibool fatal = FALSE;
|
||||
double longest_diff = 0;
|
||||
|
||||
/* For huge tables, skip the check during CHECK TABLE etc... */
|
||||
if (fatal_timeout > SRV_SEMAPHORE_WAIT_EXTENSION) {
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
#ifdef UNIV_DEBUG_VALGRIND
|
||||
/* Increase the timeouts if running under valgrind because it executes
|
||||
extremely slowly. UNIV_DEBUG_VALGRIND does not necessary mean that
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2001, 2011, Oracle and/or its affiliates
|
||||
Copyright (c) 2001, 2012, Oracle and/or its affiliates
|
||||
Copyright (c) 2012, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
|
Loading…
x
Reference in New Issue
Block a user