3617 Luis Soares 2011-03-16
Fix for BUG#11868903 (BUG#59717)
There is a race between two threads: user thread and the dump
thread. The former sets a debug instruction that makes the latter wait
before processing an Xid event. There can be cases that the dump
thread has not yet processed the previous Xid event, causing it to
wait one Xid event too soon, thus causing sync_slave_with_master never
to resume.
We fix this by moving the instructions that set the debug variable
after calling sync_slave_with_master.
modified:
mysql-test/suite/rpl/r/rpl_stop_slave.result
mysql-test/suite/rpl/t/rpl_stop_slave.test
3616 Dmitry Shulga 2011-03-15
Fixed Bug#11764168 "56976: SEVERE DENIAL OF SERVICE IN PREPARED STATEMENTS".
The problem was that server didn't check resulting size of prepared
statement argument which was set using mysql_send_long_data() API.
By calling mysql_send_long_data() several times it was possible
to create overly big string and thus force server to allocate
memory for it. There was no way to limit this allocation.
The solution is to add check for size of result string against
value of max_long_data_size start-up parameter. When intermediate
string exceeds max_long_data_size value an appropriate error message
is emitted.
We can't use existing max_allowed_packet parameter for this purpose
since its value is limited by 1GB and therefore using it as a limit
for data set through mysql_send_long_data() API would have been an
incompatible change. Newly introduced max_long_data_size parameter
gets value from max_allowed_packet parameter unless its value is
specified explicitly. This new parameter is marked as deprecated
and will be eventually replaced by max_allowed_packet parameter.
Value of max_long_data_size parameter can be set only at server
startup.
@ mysql-test/t/variables.test
Added checking for new start-up parameter max_long_data_size.
@ sql/item.cc
Added call to my_message() when accumulated string exceeds
max_long_data_size value. my_message() calls error handler
that was installed in mysql_stmt_get_longdata before call
to Item_param::set_longdata.
The error handler then sets state, last_error and last_errno
fields for current statement to values which correspond to
error which was caught.
@ sql/mysql_priv.h
Added max_long_data_size variable declaration.
@ sql/mysqld.cc
Added support for start-up parameter 'max_long_data_size'.
This parameter limits size of data which can be sent from
client to server using mysql_send_long_data() API.
@ sql/set_var.cc
Added variable 'max_long_data_size' into list of variables
displayed by command 'show variables'.
@ sql/sql_prepare.cc
Added error handler class Set_longdata_error_handler.
This handler is used to catch any errors that can be
generated during execution of Item_param::set_longdata().
Source code snippet that makes checking for statement's state
during statement execution is moved from Prepared_statement::execute()
to Prepared_statement::execute_loop() in order not to call
set_parameters() when statement has failed during
set_long_data() execution. If this hadn't been done
the call to set_parameters() would have failed.
@ tests/mysql_client_test.c
A testcase for the bug #56976 was added.
modified:
mysql-test/r/variables.result
mysql-test/t/variables.test
sql/item.cc
sql/mysql_priv.h
sql/mysqld.cc
sql/set_var.cc
sql/sql_prepare.cc
tests/mysql_client_test.c
=== modified file 'mysql-test/suite/rpl/r/rpl_stop_slave.result'
--- a/mysql-test/suite/rpl/r/rpl_stop_slave.result 2011-01-18 17:23:49 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result 2011-03-16 15:11:54 +0000
@@ -146,6 +146,7 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (c1 INT KEY, c2 INT) ENGINE=InnoDB;
CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES(1, 1);
+[connection master]
SET GLOBAL debug= 'd,dump_thread_wait_before_send_xid';
[connection slave]
include/restart_slave.inc
=== modified file 'mysql-test/suite/rpl/t/rpl_stop_slave.test'
--- a/mysql-test/suite/rpl/t/rpl_stop_slave.test 2011-01-18 17:23:49 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test 2011-03-16 15:11:54 +0000
@@ -76,11 +76,13 @@ CREATE TABLE t1 (c1 INT KEY, c2 INT) ENG
CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES(1, 1);
+sync_slave_with_master;
+
+--source include/rpl_connection_master.inc
+
let $debug_save= `SELECT @@GLOBAL.debug`;
SET GLOBAL debug= 'd,dump_thread_wait_before_send_xid';
-sync_slave_with_master;
-
--source include/rpl_connection_slave.inc
source include/restart_slave_sql.inc;
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1 branch (luis.soares:3616 to 3617) Bug#59717Bug#11868903 | Luis Soares | 16 Mar |