summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraelkin/andrei@mysql1000.(none) <>2008-03-29 15:00:12 +0200
committeraelkin/andrei@mysql1000.(none) <>2008-03-29 15:00:12 +0200
commitd3d0a00635856063df1a60ac5c1fceaf23af46cb (patch)
treeb69f6a865d08077895e9ab32d8392e140da59380
parent22536fc53eae41e27847e815878830366d5bcdcf (diff)
parent68fc98bdb3f0a02c61eba23e8588da05c04ece8d (diff)
downloadmariadb-git-d3d0a00635856063df1a60ac5c1fceaf23af46cb.tar.gz
Merge mysql1000.(none):/home/andrei/MySQL/MERGE/5.0-main2rpl
into mysql1000.(none):/home/andrei/MySQL/MERGE/5.1-main2rpl
-rw-r--r--mysql-test/extra/binlog_tests/blackhole.test27
-rw-r--r--mysql-test/r/binlog_index.result39
-rw-r--r--mysql-test/r/rpl_auto_increment_bug33029.result165
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_blackhole.result16
-rw-r--r--mysql-test/t/binlog_index.test69
-rw-r--r--mysql-test/t/rpl_auto_increment_bug33029.test109
-rw-r--r--sql/log.cc150
-rw-r--r--sql/share/errmsg.txt2
-rw-r--r--sql/sql_class.cc13
-rw-r--r--storage/blackhole/ha_blackhole.cc2
10 files changed, 566 insertions, 26 deletions
diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test
index 59d31c3a08b..2d63ae27aa3 100644
--- a/mysql-test/extra/binlog_tests/blackhole.test
+++ b/mysql-test/extra/binlog_tests/blackhole.test
@@ -151,7 +151,6 @@ CREATE TABLE t1(a INT) ENGINE=BLACKHOLE;
INSERT DELAYED INTO t1 VALUES(1);
DROP TABLE t1;
-# End of 4.1 tests
#
#Bug#19717: DELETE Query Error on BLACKHOLE when using WHERE on column with UNIQUE INDEX
@@ -168,7 +167,6 @@ ALTER TABLE t1 ADD PRIMARY KEY(a);
DELETE FROM t1 WHERE a=10;
DROP TABLE t1;
-# End of 5.0 tests
# Test that a transaction which is rolled back does not go into binlog
# and that a transaction which is committed does
@@ -193,4 +191,27 @@ show binlog events;
drop table if exists t1;
-# End of 5.1 tests
+#
+# Bug#35178 INSERT_ID not written to binary log for inserts against BLACKHOLE backed tables
+#
+#
+# the test checks that explicitly prescribed with set insert_id= value
+# preceeds the following autoincrement insert in a blachhole
+#
+
+reset master;
+create table t1 (a int auto_increment, primary key (a)) engine=blackhole;
+
+# not insert_id prescribed insert binlogs with the default set insert_id 1
+insert into t1 values (11), (NULL), (NULL), (NULL);
+set insert_id= 3;
+insert into t1 values (NULL), (33), (NULL);
+set insert_id= 5;
+insert into t1 values (55), (NULL);
+source include/show_binlog_events2.inc;
+
+# cleanup
+drop table t1;
+
+
+# End of tests
diff --git a/mysql-test/r/binlog_index.result b/mysql-test/r/binlog_index.result
new file mode 100644
index 00000000000..9c22a33435a
--- /dev/null
+++ b/mysql-test/r/binlog_index.result
@@ -0,0 +1,39 @@
+flush logs;
+flush logs;
+flush logs;
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+master-bin.000002 #
+master-bin.000003 #
+master-bin.000004 #
+purge binary logs TO 'master-bin.000004';
+Warnings:
+Warning 1476 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
+*** must show a list starting from the 'TO' argument of PURGE ***
+show binary logs;
+Log_name File_size
+master-bin.000004 #
+reset master;
+flush logs;
+flush logs;
+flush logs;
+*** must be a warning master-bin.000001 was not found ***
+Warnings:
+Warning 1476 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
+*** must show one record, of the active binlog, left in the index file after PURGE ***
+show binary logs;
+Log_name File_size
+master-bin.000004 #
+reset master;
+flush logs;
+flush logs;
+flush logs;
+purge binary logs TO 'master-bin.000002';
+ERROR HY000: Fatal error during log purge
+show warnings;
+Level Code Message
+Error 1377 a problem with deleting MYSQLTEST_VARDIR/log/master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files
+Error 1377 Fatal error during log purge
+reset master;
+End of tests
diff --git a/mysql-test/r/rpl_auto_increment_bug33029.result b/mysql-test/r/rpl_auto_increment_bug33029.result
new file mode 100644
index 00000000000..fb17553f5a0
--- /dev/null
+++ b/mysql-test/r/rpl_auto_increment_bug33029.result
@@ -0,0 +1,165 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS t1, t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p2;
+DROP TRIGGER IF EXISTS tr1;
+DROP FUNCTION IF EXISTS f1;
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY);
+CREATE TABLE t2 (id INT AUTO_INCREMENT PRIMARY KEY);
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE ins_count INT DEFAULT 10;
+WHILE ins_count > 0 DO
+INSERT INTO t1 VALUES (NULL);
+SET ins_count = ins_count - 1;
+END WHILE;
+DELETE FROM t1 WHERE id = 1;
+DELETE FROM t1 WHERE id = 2;
+DELETE FROM t2 WHERE id = 1;
+DELETE FROM t2 WHERE id = 2;
+END//
+CREATE PROCEDURE p2()
+BEGIN
+INSERT INTO t1 VALUES (NULL);
+DELETE FROM t1 WHERE id = f1(3);
+DELETE FROM t1 WHERE id = f1(4);
+DELETE FROM t2 WHERE id = 3;
+DELETE FROM t2 WHERE id = 4;
+END//
+CREATE TRIGGER tr1 BEFORE DELETE
+ON t1 FOR EACH ROW
+BEGIN
+INSERT INTO t2 VALUES (NULL);
+END//
+CREATE FUNCTION f1 (i int) RETURNS int
+BEGIN
+INSERT INTO t2 VALUES (NULL);
+RETURN i;
+END//
+CALL p1();
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL)
+master-bin.000001 # Intvar # # INSERT_ID=2
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL)
+master-bin.000001 # Intvar # # INSERT_ID=3
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL)
+master-bin.000001 # Intvar # # INSERT_ID=4
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL)
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL)
+master-bin.000001 # Intvar # # INSERT_ID=6
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL)
+master-bin.000001 # Intvar # # INSERT_ID=7
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL)
+master-bin.000001 # Intvar # # INSERT_ID=8
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL)
+master-bin.000001 # Intvar # # INSERT_ID=9
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL)
+master-bin.000001 # Intvar # # INSERT_ID=10
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL)
+master-bin.000001 # Query # # use `test`; DELETE FROM t1 WHERE id = 1
+master-bin.000001 # Query # # use `test`; DELETE FROM t1 WHERE id = 2
+master-bin.000001 # Query # # use `test`; DELETE FROM t2 WHERE id = 1
+master-bin.000001 # Query # # use `test`; DELETE FROM t2 WHERE id = 2
+# Result on master
+SELECT * FROM t1;
+id
+3
+4
+5
+6
+7
+8
+9
+10
+SELECT * FROM t2;
+id
+# Result on slave
+SELECT * FROM t1;
+id
+3
+4
+5
+6
+7
+8
+9
+10
+SELECT * FROM t2;
+id
+DROP TRIGGER tr1;
+CALL p2();
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Intvar # # INSERT_ID=11
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (NULL)
+master-bin.000001 # Query # # use `test`; DELETE FROM t1 WHERE id = f1(3)
+master-bin.000001 # Query # # use `test`; DELETE FROM t1 WHERE id = f1(4)
+master-bin.000001 # Query # # use `test`; DELETE FROM t2 WHERE id = 3
+master-bin.000001 # Query # # use `test`; DELETE FROM t2 WHERE id = 4
+# Result on master
+SELECT * FROM t1;
+id
+5
+6
+7
+8
+9
+10
+11
+SELECT * FROM t2;
+id
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+# Result on slave
+SELECT * FROM t1;
+id
+5
+6
+7
+8
+9
+10
+11
+SELECT * FROM t2;
+id
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+DROP TABLE IF EXISTS t1, t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p2;
+DROP FUNCTION IF EXISTS f1;
+DROP TRIGGER IF EXISTS tr1;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
index a96d2fd1bab..cef1d2f94c8 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
@@ -172,3 +172,19 @@ master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(1)
master-bin.000001 # Query # # use `test`; COMMIT
drop table if exists t1;
+create table t1 (a int auto_increment, primary key (a)) engine=blackhole;
+insert into t1 values (11), (NULL), (NULL), (NULL);
+set insert_id= 3;
+insert into t1 values (NULL), (33), (NULL);
+set insert_id= 5;
+insert into t1 values (55), (NULL);
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; create table t1 (a int auto_increment, primary key (a)) engine=blackhole
+master-bin.000001 # Intvar 1 # INSERT_ID=1
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (11), (NULL), (NULL), (NULL)
+master-bin.000001 # Intvar 1 # INSERT_ID=3
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL), (33), (NULL)
+master-bin.000001 # Intvar 1 # INSERT_ID=5
+master-bin.000001 # Query 1 # use `test`; insert into t1 values (55), (NULL)
+drop table t1;
diff --git a/mysql-test/t/binlog_index.test b/mysql-test/t/binlog_index.test
new file mode 100644
index 00000000000..1e44a9b02e2
--- /dev/null
+++ b/mysql-test/t/binlog_index.test
@@ -0,0 +1,69 @@
+#
+# testing of purging of binary log files bug#18199/Bug#18453
+#
+source include/have_log_bin.inc;
+source include/not_embedded.inc;
+
+#
+# testing purge binary logs TO
+#
+
+flush logs;
+flush logs;
+flush logs;
+
+source include/show_binary_logs.inc;
+
+remove_file $MYSQLTEST_VARDIR/log/master-bin.000001;
+
+# there must be a warning with file names
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+purge binary logs TO 'master-bin.000004';
+
+--echo *** must show a list starting from the 'TO' argument of PURGE ***
+source include/show_binary_logs.inc;
+
+#
+# testing purge binary logs BEFORE
+#
+
+reset master;
+
+flush logs;
+flush logs;
+flush logs;
+remove_file $MYSQLTEST_VARDIR/log/master-bin.000001;
+
+--echo *** must be a warning master-bin.000001 was not found ***
+let $date=`select NOW() + INTERVAL 1 MINUTE`;
+--disable_query_log
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval purge binary logs BEFORE '$date';
+--enable_query_log
+
+--echo *** must show one record, of the active binlog, left in the index file after PURGE ***
+source include/show_binary_logs.inc;
+
+#
+# testing a fatal error
+# Turning a binlog file into a directory must be a portable setup
+#
+
+reset master;
+
+flush logs;
+flush logs;
+flush logs;
+
+remove_file $MYSQLTEST_VARDIR/log/master-bin.000001;
+mkdir $MYSQLTEST_VARDIR/log/master-bin.000001;
+
+--error ER_BINLOG_PURGE_FATAL_ERR
+purge binary logs TO 'master-bin.000002';
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show warnings;
+rmdir $MYSQLTEST_VARDIR/log/master-bin.000001;
+--disable_warnings
+reset master;
+--enable_warnings
+--echo End of tests
diff --git a/mysql-test/t/rpl_auto_increment_bug33029.test b/mysql-test/t/rpl_auto_increment_bug33029.test
new file mode 100644
index 00000000000..db548945c7f
--- /dev/null
+++ b/mysql-test/t/rpl_auto_increment_bug33029.test
@@ -0,0 +1,109 @@
+# BUG#33029 5.0 to 5.1 replication fails on dup key when inserting
+# using a trig in SP
+
+# For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive,
+# if one statement in a SP generated AUTO_INCREMENT value by the top
+# statement, all statements after it would be considered generated
+# AUTO_INCREMENT value by the top statement, and a erroneous INSERT_ID
+# value might be associated with these statement, which could cause
+# duplicate entry error and stop the slave.
+
+source include/master-slave.inc;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p2;
+DROP TRIGGER IF EXISTS tr1;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY);
+CREATE TABLE t2 (id INT AUTO_INCREMENT PRIMARY KEY);
+
+delimiter //;
+
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE ins_count INT DEFAULT 10;
+
+ WHILE ins_count > 0 DO
+ INSERT INTO t1 VALUES (NULL);
+ SET ins_count = ins_count - 1;
+ END WHILE;
+
+ DELETE FROM t1 WHERE id = 1;
+ DELETE FROM t1 WHERE id = 2;
+ DELETE FROM t2 WHERE id = 1;
+ DELETE FROM t2 WHERE id = 2;
+END//
+
+CREATE PROCEDURE p2()
+BEGIN
+ INSERT INTO t1 VALUES (NULL);
+ DELETE FROM t1 WHERE id = f1(3);
+ DELETE FROM t1 WHERE id = f1(4);
+ DELETE FROM t2 WHERE id = 3;
+ DELETE FROM t2 WHERE id = 4;
+END//
+
+CREATE TRIGGER tr1 BEFORE DELETE
+ ON t1 FOR EACH ROW
+ BEGIN
+ INSERT INTO t2 VALUES (NULL);
+ END//
+
+CREATE FUNCTION f1 (i int) RETURNS int
+ BEGIN
+ INSERT INTO t2 VALUES (NULL);
+ RETURN i;
+ END//
+
+delimiter ;//
+
+# the $binlog_start will be used by the show_binlog_events.inc, so
+# that we can skip binlog events we don't care
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+CALL p1();
+source include/show_binlog_events.inc;
+
+echo # Result on master;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+sync_slave_with_master;
+
+echo # Result on slave;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+connection master;
+
+DROP TRIGGER tr1;
+
+# the $binlog_start will be used by the show_binlog_events.inc, so
+# that we can skip binlog events we don't care
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+CALL p2();
+source include/show_binlog_events.inc;
+
+echo # Result on master;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+sync_slave_with_master;
+
+echo # Result on slave;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+# clean up
+connection master;
+disable_warnings;
+DROP TABLE IF EXISTS t1, t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p2;
+DROP FUNCTION IF EXISTS f1;
+DROP TRIGGER IF EXISTS tr1;
+enable_warnings;
+sync_slave_with_master;
diff --git a/sql/log.cc b/sql/log.cc
index c4882ddb145..8789dce4cd4 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2913,6 +2913,8 @@ int MYSQL_BIN_LOG::update_log_index(LOG_INFO* log_info, bool need_update_threads
0 ok
@retval
LOG_INFO_EOF to_log not found
+ LOG_INFO_FATAL if any other than ENOENT error from
+ my_stat() or my_delete()
*/
int MYSQL_BIN_LOG::purge_logs(const char *to_log,
@@ -2942,21 +2944,70 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
while ((strcmp(to_log,log_info.log_file_name) || (exit_loop=included)) &&
!log_in_use(log_info.log_file_name))
{
- ulong file_size= 0;
- if (decrease_log_space) //stat the file we want to delete
+ MY_STAT s;
+ if (!my_stat(log_info.log_file_name, &s, MYF(0)))
{
- MY_STAT s;
-
- /*
- If we could not stat, we can't know the amount
- of space that deletion will free. In most cases,
- deletion won't work either, so it's not a problem.
- */
- if (my_stat(log_info.log_file_name,&s,MYF(0)))
- file_size= s.st_size;
- else
- sql_print_information("Failed to execute my_stat on file '%s'",
+ if (my_errno == ENOENT)
+ {
+ /*
+ It's not fatal if we can't stat a log file that does not exist;
+ If we could not stat, we won't delete.
+ */
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
+ log_info.log_file_name);
+ sql_print_information("Failed to execute my_stat on file '%s'",
log_info.log_file_name);
+ my_errno= 0;
+ }
+ else
+ {
+ /*
+ Other than ENOENT are fatal
+ */
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_BINLOG_PURGE_FATAL_ERR,
+ "a problem with getting info on being purged %s; "
+ "consider examining correspondence "
+ "of your binlog index file "
+ "to the actual binlog files",
+ log_info.log_file_name);
+ error= LOG_INFO_FATAL;
+ goto err;
+ }
+ }
+ else
+ {
+ DBUG_PRINT("info",("purging %s",log_info.log_file_name));
+ if (!my_delete(log_info.log_file_name, MYF(0)))
+ {
+ if (decrease_log_space)
+ *decrease_log_space-= s.st_size;
+ }
+ else
+ {
+ if (my_errno == ENOENT)
+ {
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
+ log_info.log_file_name);
+ sql_print_information("Failed to delete file '%s'",
+ log_info.log_file_name);
+ my_errno= 0;
+ }
+ else
+ {
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_BINLOG_PURGE_FATAL_ERR,
+ "a problem with deleting %s; "
+ "consider examining correspondence "
+ "of your binlog index file "
+ "to the actual binlog files",
+ log_info.log_file_name);
+ error= LOG_INFO_FATAL;
+ goto err;
+ }
+ }
}
/*
It's not fatal if we can't delete a log file ;
@@ -2979,7 +3030,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log,
if (find_next_log(&log_info, 0) || exit_loop)
break;
}
-
+
/*
If we get killed -9 here, the sysadmin would have to edit
the log index file after restart - otherwise, this should be safe
@@ -3010,6 +3061,8 @@ err:
0 ok
@retval
LOG_INFO_PURGE_NO_ROTATE Binary file that can't be rotated
+ LOG_INFO_FATAL if any other than ENOENT error from
+ my_stat() or my_delete()
*/
int MYSQL_BIN_LOG::purge_logs_before_date(time_t purge_time)
@@ -3033,14 +3086,67 @@ int MYSQL_BIN_LOG::purge_logs_before_date(time_t purge_time)
while (strcmp(log_file_name, log_info.log_file_name) &&
!log_in_use(log_info.log_file_name))
{
- /* It's not fatal even if we can't delete a log file */
- if (!my_stat(log_info.log_file_name, &stat_area, MYF(0)) ||
- stat_area.st_mtime >= purge_time)
- break;
- my_delete(log_info.log_file_name, MYF(0));
-
- ha_binlog_index_purge_file(current_thd, log_info.log_file_name);
-
+ if (!my_stat(log_info.log_file_name, &stat_area, MYF(0)))
+ {
+ if (my_errno == ENOENT)
+ {
+ /*
+ It's not fatal if we can't stat a log file that does not exist.
+ */
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
+ log_info.log_file_name);
+ sql_print_information("Failed to execute my_stat on file '%s'",
+ log_info.log_file_name);
+ my_errno= 0;
+ }
+ else
+ {
+ /*
+ Other than ENOENT are fatal
+ */
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_BINLOG_PURGE_FATAL_ERR,
+ "a problem with getting info on being purged %s; "
+ "consider examining correspondence "
+ "of your binlog index file "
+ "to the actual binlog files",
+ log_info.log_file_name);
+ error= LOG_INFO_FATAL;
+ goto err;
+ }
+ }
+ else
+ {
+ if (stat_area.st_mtime >= purge_time)
+ break;
+ if (my_delete(log_info.log_file_name, MYF(0)))
+ {
+ if (my_errno == ENOENT)
+ {
+ /* It's not fatal even if we can't delete a log file */
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_LOG_PURGE_NO_FILE, ER(ER_LOG_PURGE_NO_FILE),
+ log_info.log_file_name);
+ sql_print_information("Failed to delete file '%s'",
+ log_info.log_file_name);
+ my_errno= 0;
+ }
+ else
+ {
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_BINLOG_PURGE_FATAL_ERR,
+ "a problem with deleting %s; "
+ "consider examining correspondence "
+ "of your binlog index file "
+ "to the actual binlog files",
+ log_info.log_file_name);
+ error= LOG_INFO_FATAL;
+ goto err;
+ }
+ }
+ ha_binlog_index_purge_file(current_thd, log_info.log_file_name);
+ }
if (find_next_log(&log_info, 0))
break;
}
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index 7990baa6bb7..3e12cbf4f22 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -6120,3 +6120,5 @@ ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT
eng "The BINLOG statement of type `%s` was not preceded by a format description BINLOG statement."
ER_SLAVE_CORRUPT_EVENT
eng "Corrupted replication event was detected"
+ER_LOG_PURGE_NO_FILE
+ eng "Being purged log %s was not found"
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 48ab3ea64c1..247cccfa838 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1069,6 +1069,19 @@ bool THD::store_globals()
void THD::cleanup_after_query()
{
+ last_insert_id_used= FALSE;
+ if (clear_next_insert_id)
+ {
+ clear_next_insert_id= 0;
+ next_insert_id= 0;
+
+ /*
+ BUG#33029, if one statement in a SP set this member to 1, all
+ statment after this statement in the SP would be considered used
+ INSERT_ID value, reset this member after each query to fix this.
+ */
+ insert_id_used= 0;
+ }
/*
Reset rand_used so that detection of calls to rand() will save random
seeds if needed by the slave.
diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc
index 4e12e9f0ee7..85b8117e501 100644
--- a/storage/blackhole/ha_blackhole.cc
+++ b/storage/blackhole/ha_blackhole.cc
@@ -97,7 +97,7 @@ const char *ha_blackhole::index_type(uint key_number)
int ha_blackhole::write_row(uchar * buf)
{
DBUG_ENTER("ha_blackhole::write_row");
- DBUG_RETURN(0);
+ DBUG_RETURN(table->next_number_field ? update_auto_increment() : 0);
}
int ha_blackhole::rnd_init(bool scan)