Commit 440858b8 authored by Satya B's avatar Satya B

merge to latest 5.1-bugteam

parents 58fa483a 543abcd4
...@@ -7,125 +7,126 @@ ...@@ -7,125 +7,126 @@
# (Guilhem) have seen the test manage to provoke lock wait timeout # (Guilhem) have seen the test manage to provoke lock wait timeout
# error but not deadlock error; that is ok as code deals with the two # error but not deadlock error; that is ok as code deals with the two
# errors in exactly the same way. # errors in exactly the same way.
# We don't 'show status like 'slave_retried_transactions'' because this
# is not repeatable (depends on sleeps).
-- source include/master-slave.inc --source include/master-slave.inc
# 0) Prepare tables and data
--echo *** Prepare tables and data ***
connection master; connection master;
eval CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type; eval CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
eval CREATE TABLE t2 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type; eval CREATE TABLE t2 (a INT) ENGINE=$engine_type;
# requiring 'unique' for the timeout part of the test eval CREATE TABLE t3 (a INT NOT NULL, KEY(a)) ENGINE=$engine_type;
eval CREATE TABLE t3 (a INT UNIQUE) ENGINE=$engine_type;
eval CREATE TABLE t4 (a INT) ENGINE=$engine_type;
show variables like 'slave_transaction_retries';
sync_slave_with_master; sync_slave_with_master;
show create table t1; SHOW CREATE TABLE t1;
show create table t2; SHOW CREATE TABLE t2;
show variables like 'slave_transaction_retries'; SHOW CREATE TABLE t3;
stop slave; SHOW VARIABLES LIKE 'slave_transaction_retries';
--source include/stop_slave.inc
# 1) Test deadlock
connection master; connection master;
begin; BEGIN;
# Let's keep BEGIN and the locked statement in two different relay logs. INSERT INTO t1 VALUES (1);
insert into t2 values (0); # t2,t1 actors of deadlock in repl-ed ta # We make a long transaction here
#insert into t3 select * from t2 for update; INSERT INTO t2 VALUES (2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
let $1=10; INSERT INTO t3 VALUES (3);
disable_query_log; COMMIT;
while ($1)
{
eval insert into t3 values( $1 );
dec $1;
}
enable_query_log;
insert into t1 values(1);
commit;
save_master_pos; save_master_pos;
# Save BEGIN event into variable
let $master_pos_begin= query_get_value(SHOW BINLOG EVENTS, Pos, 5);
--echo
connection slave; # 1) Test deadlock
begin; # Block slave SQL thread, wait retries of transaction, unlock slave before lock timeout
# Let's make our transaction large so that it's repl-ed msta that's victim --echo *** Test deadlock ***
let $1=100;
disable_query_log;
while ($1)
{
eval insert into t4 values( $1 );
dec $1;
}
enable_query_log;
select * from t1 for update; # t1,t2 on local slave's
start slave;
# bad option, todo: replicate a non-transactional t_sync with the transaction
# and use wait_until_rows_count macro below
--real_sleep 3 # hope that slave is blocked now
#let $count=11;
#let $table=t_sync;
#--include wait_until_rows_count.inc
select * from t2 for update /* dl */; # provoke deadlock, repl-ed should be victim connection slave;
commit; BEGIN;
SELECT * FROM t1 FOR UPDATE;
# Save variable 'Slave_retried_transactions' before deadlock
let $slave_retried_transactions= query_get_value(SHOW GLOBAL STATUS LIKE 'Slave_retried_transactions', Value, 1);
START SLAVE;
# Wait until SQL thread blocked: variable 'Slave_retried_transactions' will incremented
let $status_var= Slave_retried_transactions;
let $status_var_value= $slave_retried_transactions;
let $status_type= GLOBAL;
let $status_var_comparsion= >;
--source include/wait_for_status_var.inc
SELECT COUNT(*) FROM t2;
COMMIT;
sync_with_master; sync_with_master;
select * from t1; # check that repl-ed succeeded finally
select * from t2 /* must be 1 */; # Check the data
# check that no error is reported SELECT * FROM t1;
--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # SELECT * FROM t3;
--replace_result $MASTER_MYPORT MASTER_MYPORT # Check that no error is reported
--vertical_results --source include/show_slave_status2.inc
show slave status; --echo
--horizontal_results
# 2) Test lock wait timeout # 2) Test lock wait timeout
# Block slave and wait lock timeout error
--echo *** Test lock wait timeout ***
stop slave; connection slave;
delete from t3; --source include/stop_slave.inc
change master to master_log_pos=548; # the BEGIN log event DELETE FROM t2;
begin; # Set slave position to the BEGIN log event
select * from t2 for update; # hold lock --replace_result $master_pos_begin MASTER_POS_BEGIN
start slave; eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin;
--real_sleep 10 # repl-ed should have blocked, and be retrying BEGIN;
select count(*) from t3 /* must be zero */; # replaying begins after rollback # Hold lock
commit; SELECT * FROM t1 FOR UPDATE;
# Wait until slave stopped with error 'Lock wait timeout exceeded'
START SLAVE;
let $slave_sql_errno= 1205;
--source include/wait_for_slave_sql_error.inc
SELECT COUNT(*) FROM t2;
COMMIT;
--source include/start_slave.inc
sync_with_master; sync_with_master;
select * from t1; # check that repl-ed succeeded finally # Check data from tables
select * from t2; SELECT * FROM t1;
# check that no error is reported SELECT * FROM t3;
--replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 # # Check that no error is reported
--replace_result $MASTER_MYPORT MASTER_MYPORT --source include/show_slave_status2.inc
--vertical_results --echo
show slave status;
--horizontal_results
# Now we repeat 2), but with BEGIN in the same relay log as # 3) Test lock wait timeout and purged relay log
# COMMIT (to see if seeking into hot log is ok). # Set max_relay_log_size=0, block slave and wait lock timeout error.
set @my_max_relay_log_size= @@global.max_relay_log_size; # Restart slave and check that no erros appear
set global max_relay_log_size=0; --echo *** Test lock wait timeout and purged relay logs ***
# This is really copy-paste of 2) of above connection slave;
stop slave; SET @my_max_relay_log_size= @@global.max_relay_log_size;
delete from t3; SET global max_relay_log_size=0;
change master to master_log_pos=548; --source include/stop_slave.inc
begin; DELETE FROM t2;
select * from t2 for update; # Set slave position to the BEGIN log event
start slave; eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin;
--real_sleep 10 BEGIN;
select count(*) from t3 /* must be zero */; # replaying begins after rollback # Hold lock
commit; SELECT * FROM t1 FOR UPDATE;
# Wait until slave stopped with error 'Lock wait timeout exceeded'
START SLAVE;
let $slave_sql_errno= 1205;
--source include/wait_for_slave_sql_error.inc
SELECT COUNT(*) FROM t2;
COMMIT;
--source include/start_slave.inc
sync_with_master; sync_with_master;
select * from t1; # Check data from tables
select * from t2; SELECT * FROM t1;
--replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 # 35 # 36 # SELECT * FROM t3;
--replace_result $MASTER_MYPORT MASTER_MYPORT # Check that no error is reported
--vertical_results --source include/show_slave_status2.inc
show slave status; --echo
--horizontal_results
# Clean up
--echo *** Clean up ***
connection master; connection master;
drop table t1,t2,t3,t4; DROP TABLE t1,t2,t3;
sync_slave_with_master; sync_slave_with_master;
set global max_relay_log_size= @my_max_relay_log_size; SET global max_relay_log_size= @my_max_relay_log_size;
--echo End of 5.1 tests --echo End of 5.1 tests
# ==== Purpose ====
#
# Waits until a variable from SHOW STATUS has returned a specified
# value, or until a timeout is reached.
#
# ==== Usage ====
#
# let $status_var= Threads_connected;
# let $status_var_value= 1;
# --source include/wait_for_status_var.inc
#
# Parameters:
#
# $status_var, $status_var_value
# This macro will wait until the variable of SHOW STATUS
# named $status_var gets the value $status_var_value. See
# the example above.
#
# $status_type= GLOBAL|SESSION
# To specify the type (attribute) of status variable and
# run either SHOW GLOBAL STATUS or SHOW SESSION STATUS.
#
# $status_var_comparsion
# By default, this file waits until $status_var becomes equal to
# $status_var_value. If you want to wait until $status_var
# becomes *unequal* to $status_var_value, set this parameter to the
# string '!=', like this:
# let $status_var_comparsion= !=;
#
# $status_timeout
# The default timeout is 1 minute. You can change the timeout by
# setting $status_timeout. The unit is tenths of seconds.
#
if (`SELECT STRCMP('$status_type', '') * STRCMP(UPPER('$status_type'), 'SESSION') * STRCMP(UPPER('$status_type'), 'GLOBAL')`)
{
--echo **** ERROR: Unknown type of variable status_type: allowed values are: SESSION or GLOBAL ****
exit;
}
let $_status_timeout_counter= $status_timeout;
if (!$_status_timeout_counter)
{
let $_status_timeout_counter= 600;
}
let $_status_var_comparsion= $status_var_comparsion;
if (`SELECT '$_status_var_comparsion' = ''`)
{
let $_status_var_comparsion= =;
}
let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE '$status_var'", Value, 1);
while (`SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_value')`)
{
if (!$_status_timeout_counter)
{
--echo **** ERROR: failed while waiting for $status_type $status_var $_status_var_comparison $status_var_value ****
--echo Note: the following output may have changed since the failure was detected
--echo **** Showing STATUS, PROCESSLIST ****
eval SHOW $status_type STATUS LIKE '$status_var';
SHOW PROCESSLIST;
exit;
}
dec $_status_timeout_counter;
sleep 0.1;
let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE '$status_var'", Value, 1);
}
...@@ -96,6 +96,61 @@ alter table t1 auto_increment=0; ...@@ -96,6 +96,61 @@ alter table t1 auto_increment=0;
alter table t1 auto_increment=0; alter table t1 auto_increment=0;
unlock tables; unlock tables;
drop table t1; drop table t1;
create table t1 (a int);
create table t2 like t1;
# con1
lock tables t1 write;
# con2
flush tables with read lock;
# con5
# global read lock is taken
# con3
select * from t2 for update;
# waiting for release of read lock
# con4
# would hang and later cause a deadlock
flush tables t2;
# clean up
unlock tables;
unlock tables;
a
drop table t1,t2;
#
# Lightweight version:
# Ensure that the wait for a GRL is done before opening tables.
#
create table t1 (a int);
create table t2 like t1;
#
# UPDATE
#
# default
flush tables with read lock;
# con1
update t2 set a = 1;
# default
# statement is waiting for release of read lock
# con2
flush table t2;
# default
unlock tables;
# con1
#
# LOCK TABLES .. WRITE
#
# default
flush tables with read lock;
# con1
lock tables t2 write;
# default
# statement is waiting for release of read lock
# con2
flush table t2;
# default
unlock tables;
# con1
unlock tables;
drop table t1,t2;
End of 5.0 tests End of 5.0 tests
create table t1 (i int); create table t1 (i int);
lock table t1 read; lock table t1 read;
......
...@@ -65,3 +65,25 @@ SELECT COUNT(*) FROM t1; ...@@ -65,3 +65,25 @@ SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
1024 1024
DROP TABLE t1; DROP TABLE t1;
#
# Bug #43973 - backup_myisam.test fails on 6.0-bugteam
#
CREATE DATABASE mysql_db1;
CREATE TABLE mysql_db1.t1 (c1 VARCHAR(5), c2 int);
CREATE INDEX i1 ON mysql_db1.t1 (c1, c2);
INSERT INTO mysql_db1.t1 VALUES ('A',1);
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
FLUSH TABLE mysql_db1.t1;
# Compress the table using MYISAMPACK tool
# Run MYISAMCHK tool on the compressed table
SELECT COUNT(*) FROM mysql_db1.t1 WHERE c2 < 5;
COUNT(*)
128
DROP TABLE mysql_db1.t1;
DROP DATABASE mysql_db1;
...@@ -9,7 +9,17 @@ SET timestamp=1000000000; ...@@ -9,7 +9,17 @@ SET timestamp=1000000000;
# #
# We need big packets. # We need big packets.
# #
# Capture initial value to reset at the end of the test
# Now adjust max_allowed_packet
SET @@global.max_allowed_packet= 1024*1024*1024; SET @@global.max_allowed_packet= 1024*1024*1024;
max_allowed_packet is a global variable.
In order for the preceding change in max_allowed_packets' value
to be seen and used, we must start a new connection.
The change does not take effect with the current one.
For simplicity, we just disconnect / reconnect connection default here.
Disconnecting default connection...
Reconnecting default connection...
default connection established, continuing with the test
# #
# Delete all existing binary logs. # Delete all existing binary logs.
# #
...@@ -21,40 +31,56 @@ CREATE TABLE t1 ( ...@@ -21,40 +31,56 @@ CREATE TABLE t1 (
c1 LONGTEXT c1 LONGTEXT
) ENGINE=MyISAM DEFAULT CHARSET latin1; ) ENGINE=MyISAM DEFAULT CHARSET latin1;
# #
# Show how much rows are affected by each statement. # Show how many rows are affected by each statement.
# #
# #
# Insert a big row. # Insert some big rows.
# #
256MB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 16777216));
affected rows: 1
32MB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152)); INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
affected rows: 1 affected rows: 1
4MB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 262144));
affected rows: 1
512KB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 32768));
affected rows: 1
# #
# Show what we have in the table. # Show what we have in the table.
# Do not display the column value itself, just its length. # Do not display the column value itself, just its length.
# #
SELECT LENGTH(c1) FROM t1; SELECT LENGTH(c1) FROM t1;
LENGTH(c1) 268435456
LENGTH(c1) 33554432 LENGTH(c1) 33554432
affected rows: 1 LENGTH(c1) 4194304
LENGTH(c1) 524288
affected rows: 4
# #
# Grow the row by updating. # Grow the rows by updating.
# #
UPDATE t1 SET c1 = CONCAT(c1, c1); UPDATE t1 SET c1 = CONCAT(c1, c1);
affected rows: 1 affected rows: 4
info: Rows matched: 1 Changed: 1 Warnings: 0 info: Rows matched: 4 Changed: 4 Warnings: 0
# #
# Show what we have in the table. # Show what we have in the table.
# Do not display the column value itself, just its length. # Do not display the column value itself, just its length.
# #
SELECT LENGTH(c1) FROM t1; SELECT LENGTH(c1) FROM t1;
LENGTH(c1) 536870912
LENGTH(c1) 1048576
LENGTH(c1) 67108864 LENGTH(c1) 67108864
affected rows: 1 LENGTH(c1) 8388608
affected rows: 4
# #
# Delete the row. # Delete the rows.
# #
DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck'; DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck';
affected rows: 1 affected rows: 4
# #
# Hide how much rows are affected by each statement. # Hide how many rows are affected by each statement.
# #
# #
# Flush all log buffers to the log file. # Flush all log buffers to the log file.
...@@ -70,5 +96,7 @@ FLUSH LOGS; ...@@ -70,5 +96,7 @@ FLUSH LOGS;
# #
# Cleanup. # Cleanup.
# #
# reset variable value to pass testcase checks
SET @@global.max_allowed_packet = 1048576;
DROP TABLE t1; DROP TABLE t1;
remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out
...@@ -11,7 +11,7 @@ prepare s from "insert into t1 select 100 limit ?"; ...@@ -11,7 +11,7 @@ prepare s from "insert into t1 select 100 limit ?";
set @a=100; set @a=100;
execute s using @a; execute s using @a;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (a int) master-bin.000001 # Query # # use `test`; create table t1 (a int)
......
...@@ -10,25 +10,25 @@ INSERT DELAYED INTO t1 VALUES (5); ...@@ -10,25 +10,25 @@ INSERT DELAYED INTO t1 VALUES (5);
---- Insert directly ---- ---- Insert directly ----
INSERT INTO t1 VALUES (@@global.sync_binlog); INSERT INTO t1 VALUES (@@global.sync_binlog);
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
INSERT INTO t1 VALUES (@@session.insert_id); INSERT INTO t1 VALUES (@@session.insert_id);
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
INSERT INTO t1 VALUES (@@global.auto_increment_increment); INSERT INTO t1 VALUES (@@global.auto_increment_increment);
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
INSERT INTO t2 SELECT UUID(); INSERT INTO t2 SELECT UUID();
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
INSERT INTO t2 VALUES (@@session.sql_mode); INSERT INTO t2 VALUES (@@session.sql_mode);
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
INSERT INTO t2 VALUES (@@global.init_slave); INSERT INTO t2 VALUES (@@global.init_slave);
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
INSERT INTO t2 VALUES (@@hostname); INSERT INTO t2 VALUES (@@hostname);
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
---- Insert from stored procedure ---- ---- Insert from stored procedure ----
CREATE PROCEDURE proc() CREATE PROCEDURE proc()
BEGIN BEGIN
...@@ -42,13 +42,13 @@ INSERT INTO t2 VALUES (@@hostname); ...@@ -42,13 +42,13 @@ INSERT INTO t2 VALUES (@@hostname);
END| END|
CALL proc(); CALL proc();
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
---- Insert from stored function ---- ---- Insert from stored function ----
CREATE FUNCTION func() CREATE FUNCTION func()
RETURNS INT RETURNS INT
...@@ -66,13 +66,13 @@ SELECT func(); ...@@ -66,13 +66,13 @@ SELECT func();
func() func()
0 0
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
---- Insert from trigger ---- ---- Insert from trigger ----
CREATE TRIGGER trig CREATE TRIGGER trig
BEFORE INSERT ON trigger_table BEFORE INSERT ON trigger_table
...@@ -88,14 +88,14 @@ INSERT INTO t2 VALUES (@@hostname); ...@@ -88,14 +88,14 @@ INSERT INTO t2 VALUES (@@hostname);
END| END|
INSERT INTO trigger_table VALUES ('bye.'); INSERT INTO trigger_table VALUES ('bye.');
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
---- Insert from prepared statement ---- ---- Insert from prepared statement ----
PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)'; PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)';
PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)'; PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)';
...@@ -106,25 +106,25 @@ PREPARE p6 FROM 'INSERT INTO t2 VALUES (@@global.init_slave)'; ...@@ -106,25 +106,25 @@ PREPARE p6 FROM 'INSERT INTO t2 VALUES (@@global.init_slave)';
PREPARE p7 FROM 'INSERT INTO t2 VALUES (@@hostname)'; PREPARE p7 FROM 'INSERT INTO t2 VALUES (@@hostname)';
EXECUTE p1; EXECUTE p1;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
EXECUTE p2; EXECUTE p2;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
EXECUTE p3; EXECUTE p3;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
EXECUTE p4; EXECUTE p4;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
EXECUTE p5; EXECUTE p5;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
EXECUTE p6; EXECUTE p6;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
EXECUTE p7; EXECUTE p7;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
---- Insert from nested call of triggers / functions / procedures ---- ---- Insert from nested call of triggers / functions / procedures ----
CREATE PROCEDURE proc1() CREATE PROCEDURE proc1()
INSERT INTO trigger_table VALUES ('ha!')| INSERT INTO trigger_table VALUES ('ha!')|
...@@ -154,13 +154,13 @@ EXECUTE prep6; ...@@ -154,13 +154,13 @@ EXECUTE prep6;
func5() func5()
0 0
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
==== Variables that should *not* be unsafe ==== ==== Variables that should *not* be unsafe ====
INSERT INTO t1 VALUES (@@session.pseudo_thread_id); INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
INSERT INTO t1 VALUES (@@session.pseudo_thread_id); INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
...@@ -195,16 +195,16 @@ DROP TABLE t1, t2, t3, trigger_table, trigger_table2; ...@@ -195,16 +195,16 @@ DROP TABLE t1, t2, t3, trigger_table, trigger_table2;
CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b)); CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b));
INSERT INTO t1 SELECT * FROM t1 LIMIT 1; INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
REPLACE INTO t1 SELECT * FROM t1 LIMIT 1; REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
UPDATE t1 SET a=1 LIMIT 1; UPDATE t1 SET a=1 LIMIT 1;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
DELETE FROM t1 LIMIT 1; DELETE FROM t1 LIMIT 1;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
INSERT INTO t1 SELECT * FROM t1 LIMIT 1; INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
...@@ -214,10 +214,10 @@ DELETE FROM t1 LIMIT 1; ...@@ -214,10 +214,10 @@ DELETE FROM t1 LIMIT 1;
END| END|
CALL p1(); CALL p1();
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
...@@ -225,7 +225,7 @@ CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100)); ...@@ -225,7 +225,7 @@ CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100));
INSERT INTO t1 VALUES ('a','b'); INSERT INTO t1 VALUES ('a','b');
UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1; UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
DROP TABLE t1; DROP TABLE t1;
DROP TABLE IF EXISTS t1, t2; DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1(i INT PRIMARY KEY); CREATE TABLE t1(i INT PRIMARY KEY);
...@@ -234,7 +234,7 @@ CREATE TABLE t3(i INT, ch CHAR(50)); ...@@ -234,7 +234,7 @@ CREATE TABLE t3(i INT, ch CHAR(50));
"Should issue message Statement is not safe to log in statement format." "Should issue message Statement is not safe to log in statement format."
INSERT INTO t1 SELECT * FROM t2 LIMIT 1; INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
CREATE FUNCTION func6() CREATE FUNCTION func6()
RETURNS INT RETURNS INT
BEGIN BEGIN
...@@ -246,7 +246,7 @@ END| ...@@ -246,7 +246,7 @@ END|
"Should issue message Statement is not safe to log in statement format only once" "Should issue message Statement is not safe to log in statement format only once"
INSERT INTO t3 VALUES(func6(), UUID()); INSERT INTO t3 VALUES(func6(), UUID());
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
"Check whether SET @@SQL_LOG_BIN = 0/1 doesn't work in substatements" "Check whether SET @@SQL_LOG_BIN = 0/1 doesn't work in substatements"
CREATE FUNCTION fun_check_log_bin() RETURNS INT CREATE FUNCTION fun_check_log_bin() RETURNS INT
BEGIN BEGIN
...@@ -259,7 +259,7 @@ SELECT fun_check_log_bin(); ...@@ -259,7 +259,7 @@ SELECT fun_check_log_bin();
fun_check_log_bin() fun_check_log_bin()
100 100
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
"SQL_LOG_BIN should be ON still" "SQL_LOG_BIN should be ON still"
SHOW VARIABLES LIKE "SQL_LOG_BIN"; SHOW VARIABLES LIKE "SQL_LOG_BIN";
Variable_name Value Variable_name Value
...@@ -309,4 +309,22 @@ DROP FUNCTION func7; ...@@ -309,4 +309,22 @@ DROP FUNCTION func7;
DROP TRIGGER trig; DROP TRIGGER trig;
DROP TABLE t1, t2, t3, trigger_table; DROP TABLE t1, t2, t3, trigger_table;
set @@SESSION.SQL_LOG_BIN = @save_log_bin; set @@SESSION.SQL_LOG_BIN = @save_log_bin;
SET @save_sql_mode = @@SESSION.SQL_MODE;
SET @@SESSION.SQL_MODE = STRICT_ALL_TABLES;
CREATE TABLE t1(i INT PRIMARY KEY);
CREATE TABLE t2(i INT PRIMARY KEY);
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
Warnings:
Note 1592 Statement is not safe to log in statement format.
INSERT INTO t1 VALUES(@@global.sync_binlog);
Warnings:
Note 1592 Statement is not safe to log in statement format.
UPDATE t1 SET i = 999 LIMIT 1;
Warnings:
Note 1592 Statement is not safe to log in statement format.
DELETE FROM t1 LIMIT 1;
Warnings:
Note 1592 Statement is not safe to log in statement format.
DROP TABLE t1, t2;
SET @@SESSION.SQL_MODE = @save_sql_mode;
"End of tests" "End of tests"
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
# BUG#34732: mysqlbinlog does not print default values for auto_increment variables # BUG#34732: mysqlbinlog does not print default values for auto_increment variables
# BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed # BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed
# BUG#41980, SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0 # BUG#41980, SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0
# BUG#42640: mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLES mode)
# #
# ==== Related test cases ==== # ==== Related test cases ====
# #
...@@ -369,4 +370,22 @@ DROP FUNCTION func7; ...@@ -369,4 +370,22 @@ DROP FUNCTION func7;
DROP TRIGGER trig; DROP TRIGGER trig;
DROP TABLE t1, t2, t3, trigger_table; DROP TABLE t1, t2, t3, trigger_table;
set @@SESSION.SQL_LOG_BIN = @save_log_bin; set @@SESSION.SQL_LOG_BIN = @save_log_bin;
#
# For BUG#42640: mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLES mode)
#
SET @save_sql_mode = @@SESSION.SQL_MODE;
SET @@SESSION.SQL_MODE = STRICT_ALL_TABLES;
CREATE TABLE t1(i INT PRIMARY KEY);
CREATE TABLE t2(i INT PRIMARY KEY);
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
INSERT INTO t1 VALUES(@@global.sync_binlog);
UPDATE t1 SET i = 999 LIMIT 1;
DELETE FROM t1 LIMIT 1;
DROP TABLE t1, t2;
SET @@SESSION.SQL_MODE = @save_sql_mode;
--echo "End of tests" --echo "End of tests"
reset master; reset master;
call mtr.add_suppression("Failed during slave.*thread initialization"); call mtr.add_suppression("Failed during slave thread initialization");
stop slave; stop slave;
reset slave; reset slave;
SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
...@@ -23,8 +23,8 @@ Replicate_Do_Table ...@@ -23,8 +23,8 @@ Replicate_Do_Table
Replicate_Ignore_Table Replicate_Ignore_Table
Replicate_Wild_Do_Table Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table Replicate_Wild_Ignore_Table
Last_Errno 0 Last_Errno #
Last_Error Last_Error Failed during slave thread initialization
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 0 Exec_Master_Log_Pos 0
Relay_Log_Space # Relay_Log_Space #
...@@ -41,6 +41,6 @@ Seconds_Behind_Master # ...@@ -41,6 +41,6 @@ Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0 Last_IO_Errno 0
Last_IO_Error Last_IO_Error
Last_SQL_Errno 0 Last_SQL_Errno #
Last_SQL_Error Last_SQL_Error Failed during slave thread initialization
SET GLOBAL debug=""; SET GLOBAL debug="";
...@@ -4,51 +4,57 @@ reset master; ...@@ -4,51 +4,57 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
*** Prepare tables and data ***
CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=innodb; CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=innodb;
CREATE TABLE t2 (a INT NOT NULL, KEY(a)) ENGINE=innodb; CREATE TABLE t2 (a INT) ENGINE=innodb;
CREATE TABLE t3 (a INT UNIQUE) ENGINE=innodb; CREATE TABLE t3 (a INT NOT NULL, KEY(a)) ENGINE=innodb;
CREATE TABLE t4 (a INT) ENGINE=innodb; SHOW CREATE TABLE t1;
show variables like 'slave_transaction_retries';
Variable_name Value
slave_transaction_retries 10
show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL, `a` int(11) NOT NULL,
KEY `a` (`a`) KEY `a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
show create table t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL, `a` int(11) NOT NULL,
KEY `a` (`a`) KEY `a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
show variables like 'slave_transaction_retries'; SHOW VARIABLES LIKE 'slave_transaction_retries';
Variable_name Value Variable_name Value
slave_transaction_retries 2 slave_transaction_retries 2
stop slave; include/stop_slave.inc
begin; BEGIN;
insert into t2 values (0); INSERT INTO t1 VALUES (1);
insert into t1 values(1); INSERT INTO t2 VALUES (2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
commit; INSERT INTO t3 VALUES (3);
begin; COMMIT;
select * from t1 for update;
*** Test deadlock ***
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a a
start slave; START SLAVE;
select * from t2 for update /* dl */; SELECT COUNT(*) FROM t2;
a COUNT(*)
commit; 0
select * from t1; COMMIT;
SELECT * FROM t1;
a a
1 1
select * from t2 /* must be 1 */; SELECT * FROM t3;
a a
0 3
show slave status; SHOW SLAVE STATUS;
Slave_IO_State # Slave_IO_State #
Master_Host 127.0.0.1 Master_Host 127.0.0.1
Master_User root Master_User root
Master_Port MASTER_MYPORT Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos # Read_Master_Log_Pos #
...@@ -83,38 +89,41 @@ Last_IO_Errno # ...@@ -83,38 +89,41 @@ Last_IO_Errno #
Last_IO_Error # Last_IO_Error #
Last_SQL_Errno 0 Last_SQL_Errno 0
Last_SQL_Error Last_SQL_Error
stop slave;
delete from t3; *** Test lock wait timeout ***
change master to master_log_pos=548; include/stop_slave.inc
begin; DELETE FROM t2;
select * from t2 for update; CHANGE MASTER TO MASTER_LOG_POS=MASTER_POS_BEGIN;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a a
1
START SLAVE;
SELECT COUNT(*) FROM t2;
COUNT(*)
0 0
start slave; COMMIT;
select count(*) from t3 /* must be zero */; include/start_slave.inc
count(*) SELECT * FROM t1;
0
commit;
select * from t1;
a a
1 1
1 1
select * from t2; SELECT * FROM t3;
a a
0 3
0 3
show slave status; SHOW SLAVE STATUS;
Slave_IO_State # Slave_IO_State #
Master_Host 127.0.0.1 Master_Host 127.0.0.1
Master_User root Master_User root
Master_Port MASTER_MYPORT Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos # Read_Master_Log_Pos #
Relay_Log_File # Relay_Log_File #
Relay_Log_Pos # Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
Slave_IO_Running # Slave_IO_Running Yes
Slave_SQL_Running Yes Slave_SQL_Running Yes
Replicate_Do_DB Replicate_Do_DB
Replicate_Ignore_DB Replicate_Ignore_DB
...@@ -138,47 +147,50 @@ Master_SSL_Cipher ...@@ -138,47 +147,50 @@ Master_SSL_Cipher
Master_SSL_Key Master_SSL_Key
Seconds_Behind_Master # Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0 Last_IO_Errno #
Last_IO_Error Last_IO_Error #
Last_SQL_Errno 0 Last_SQL_Errno 0
Last_SQL_Error Last_SQL_Error
set @my_max_relay_log_size= @@global.max_relay_log_size;
set global max_relay_log_size=0; *** Test lock wait timeout and purged relay logs ***
stop slave; SET @my_max_relay_log_size= @@global.max_relay_log_size;
delete from t3; SET global max_relay_log_size=0;
change master to master_log_pos=548; include/stop_slave.inc
begin; DELETE FROM t2;
select * from t2 for update; CHANGE MASTER TO MASTER_LOG_POS=440;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a a
1
1
START SLAVE;
SELECT COUNT(*) FROM t2;
COUNT(*)
0 0
0 COMMIT;
start slave; include/start_slave.inc
select count(*) from t3 /* must be zero */; SELECT * FROM t1;
count(*)
0
commit;
select * from t1;
a a
1 1
1 1
1 1
select * from t2; SELECT * FROM t3;
a a
0 3
0 3
0 3
show slave status; SHOW SLAVE STATUS;
Slave_IO_State # Slave_IO_State #
Master_Host 127.0.0.1 Master_Host 127.0.0.1
Master_User root Master_User root
Master_Port MASTER_MYPORT Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos # Read_Master_Log_Pos #
Relay_Log_File # Relay_Log_File #
Relay_Log_Pos # Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
Slave_IO_Running # Slave_IO_Running Yes
Slave_SQL_Running Yes Slave_SQL_Running Yes
Replicate_Do_DB Replicate_Do_DB
Replicate_Ignore_DB Replicate_Ignore_DB
...@@ -206,6 +218,8 @@ Last_IO_Errno # ...@@ -206,6 +218,8 @@ Last_IO_Errno #
Last_IO_Error # Last_IO_Error #
Last_SQL_Errno 0 Last_SQL_Errno 0
Last_SQL_Error Last_SQL_Error
drop table t1,t2,t3,t4;
set global max_relay_log_size= @my_max_relay_log_size; *** Clean up ***
DROP TABLE t1,t2,t3;
SET global max_relay_log_size= @my_max_relay_log_size;
End of 5.1 tests End of 5.1 tests
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;
stop slave;
reset slave;
SET GLOBAL debug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
Reporting the following error: Failed during slave thread initialization
SET GLOBAL debug= "";
stop slave;
reset slave;
SET GLOBAL init_slave= "garbage";
start slave;
Reporting the following error: Slave SQL thread aborted. Can't execute init_slave query
SET GLOBAL init_slave= "";
...@@ -76,7 +76,7 @@ create table t1(a int primary key); ...@@ -76,7 +76,7 @@ create table t1(a int primary key);
insert into t1 values (1),(2); insert into t1 values (1),(2);
delete from t1 where @@server_id=1; delete from t1 where @@server_id=1;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
set sql_mode=strict_trans_tables; set sql_mode=strict_trans_tables;
insert into t1 values (7), (8), (9); insert into t1 values (7), (8), (9);
[on slave] [on slave]
......
...@@ -10,7 +10,7 @@ CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); ...@@ -10,7 +10,7 @@ CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
INSERT INTO test.t1 VALUES(1,'test'); INSERT INTO test.t1 VALUES(1,'test');
UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1; UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1;
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
create procedure test.p1() create procedure test.p1()
begin begin
INSERT INTO test.t1 VALUES(2,'test'); INSERT INTO test.t1 VALUES(2,'test');
...@@ -18,7 +18,7 @@ UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2; ...@@ -18,7 +18,7 @@ UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2;
end| end|
CALL test.p1(); CALL test.p1();
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
SELECT * FROM test.t1 ORDER BY blob_column; SELECT * FROM test.t1 ORDER BY blob_column;
a blob_column a blob_column
1 abase 1 abase
......
...@@ -182,19 +182,19 @@ CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM; ...@@ -182,19 +182,19 @@ CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
affected rows: 0 affected rows: 0
INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00)); INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
affected rows: 1 affected rows: 1
INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00)); INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
affected rows: 1 affected rows: 1
INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00)); INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
affected rows: 1 affected rows: 1
INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00)); INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
Warnings: Warnings:
Warning 1592 Statement is not safe to log in statement format. Note 1592 Statement is not safe to log in statement format.
affected rows: 1 affected rows: 1
SELECT * FROM t1 ORDER BY sum; SELECT * FROM t1 ORDER BY sum;
sum price sum price
......
...@@ -15,7 +15,7 @@ reset master; ...@@ -15,7 +15,7 @@ reset master;
connection slave; connection slave;
# Add suppression for expected warnings in slaves error log # Add suppression for expected warnings in slaves error log
call mtr.add_suppression("Failed during slave.*thread initialization"); call mtr.add_suppression("Failed during slave thread initialization");
--disable_warnings --disable_warnings
stop slave; stop slave;
...@@ -38,7 +38,7 @@ connection slave; ...@@ -38,7 +38,7 @@ connection slave;
source include/wait_for_slave_to_stop.inc; source include/wait_for_slave_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 # --replace_column 1 # 8 # 9 # 19 # 23 # 33 # 37 #
query_vertical show slave status; query_vertical show slave status;
# #
......
######################################################################
# Some errors that cause the slave SQL thread to stop are not shown in
# the Slave_SQL_Error column of "SHOW SLAVE STATUS". Instead, the error
# is only in the server's error log.
#
# Two failures and their respective reporting are verified:
#
# 1 - Failures during slave thread initialization
# 2 - Failures while processing queries passed through the init_slave
# option.
#
# In order to check the first type of failure, we inject a fault in the
# SQL/IO Threads through SET GLOBAL debug.
#
# To check the second type, we set @@global.init_slave to an invalid
# command thus preventing the initialization of the SQL Thread.
#
# Obs:
# 1 - Note that testing failures while initializing the relay log position
# is hard as the same function is called before the code reaches the point
# that we want to test.
#
# 2 - This test does not target failures that are reported while applying
# events such as duplicate keys, errors while reading the relay-log.bin*,
# etc. Such errors are already checked on other tests.
######################################################################
######################################################################
# Configuring the Environment
######################################################################
source include/have_debug.inc;
source include/master-slave.inc;
source include/have_log_bin.inc;
connection slave;
--disable_warnings
stop slave;
--enable_warnings
reset slave;
######################################################################
# Injecting faults in the threads' initialization
######################################################################
connection slave;
# Set debug flags on slave to force errors to occur
SET GLOBAL debug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
#
# slave is going to stop because of emulated failures
# but there won't be any crashes nor asserts hit.
#
source include/wait_for_slave_to_stop.inc;
let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1);
echo Reporting the following error: $error;
SET GLOBAL debug= "";
######################################################################
# Injecting faults in the init_slave option
######################################################################
connection slave;
--disable_warnings
stop slave;
--enable_warnings
source include/wait_for_slave_to_stop.inc;
reset slave;
SET GLOBAL init_slave= "garbage";
start slave;
source include/wait_for_slave_sql_to_stop.inc;
let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1);
echo Reporting the following error: $error;
######################################################################
# Clean up
######################################################################
SET GLOBAL init_slave= "";
...@@ -44,7 +44,7 @@ SET @@global.binlog_cache_size = 10000.01; ...@@ -44,7 +44,7 @@ SET @@global.binlog_cache_size = 10000.01;
ERROR 42000: Incorrect argument type to variable 'binlog_cache_size' ERROR 42000: Incorrect argument type to variable 'binlog_cache_size'
SET @@global.binlog_cache_size = -1024; SET @@global.binlog_cache_size = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect binlog_cache_size value: '0' Warning 1292 Truncated incorrect binlog_cache_size value: '-1024'
SELECT @@global.binlog_cache_size; SELECT @@global.binlog_cache_size;
@@global.binlog_cache_size @@global.binlog_cache_size
4096 4096
......
...@@ -66,6 +66,8 @@ SELECT @@global.bulk_insert_buffer_size; ...@@ -66,6 +66,8 @@ SELECT @@global.bulk_insert_buffer_size;
@@global.bulk_insert_buffer_size @@global.bulk_insert_buffer_size
42949672950 42949672950
SET @@global.bulk_insert_buffer_size = -1024; SET @@global.bulk_insert_buffer_size = -1024;
Warnings:
Warning 1292 Truncated incorrect bulk_insert_buffer_size value: '-1024'
SELECT @@global.bulk_insert_buffer_size; SELECT @@global.bulk_insert_buffer_size;
@@global.bulk_insert_buffer_size @@global.bulk_insert_buffer_size
0 0
...@@ -80,6 +82,8 @@ SELECT @@session.bulk_insert_buffer_size; ...@@ -80,6 +82,8 @@ SELECT @@session.bulk_insert_buffer_size;
@@session.bulk_insert_buffer_size @@session.bulk_insert_buffer_size
42949672950 42949672950
SET @@session.bulk_insert_buffer_size = -2; SET @@session.bulk_insert_buffer_size = -2;
Warnings:
Warning 1292 Truncated incorrect bulk_insert_buffer_size value: '-2'
SELECT @@session.bulk_insert_buffer_size; SELECT @@session.bulk_insert_buffer_size;
@@session.bulk_insert_buffer_size @@session.bulk_insert_buffer_size
0 0
......
...@@ -35,7 +35,7 @@ SELECT @@global.delayed_insert_limit; ...@@ -35,7 +35,7 @@ SELECT @@global.delayed_insert_limit;
1 1
SET @@global.delayed_insert_limit = -1024; SET @@global.delayed_insert_limit = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect delayed_insert_limit value: '0' Warning 1292 Truncated incorrect delayed_insert_limit value: '-1024'
SELECT @@global.delayed_insert_limit; SELECT @@global.delayed_insert_limit;
@@global.delayed_insert_limit @@global.delayed_insert_limit
1 1
......
...@@ -35,7 +35,7 @@ SELECT @@global.delayed_queue_size; ...@@ -35,7 +35,7 @@ SELECT @@global.delayed_queue_size;
1 1
SET @@global.delayed_queue_size = -1024; SET @@global.delayed_queue_size = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect delayed_queue_size value: '0' Warning 1292 Truncated incorrect delayed_queue_size value: '-1024'
SELECT @@global.delayed_queue_size; SELECT @@global.delayed_queue_size;
@@global.delayed_queue_size @@global.delayed_queue_size
1 1
......
...@@ -71,7 +71,7 @@ SELECT @@global.join_buffer_size=8200 OR @@global.join_buffer_size= 8228; ...@@ -71,7 +71,7 @@ SELECT @@global.join_buffer_size=8200 OR @@global.join_buffer_size= 8228;
1 1
SET @@global.join_buffer_size = -1024; SET @@global.join_buffer_size = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect join_buffer_size value: '0' Warning 1292 Truncated incorrect join_buffer_size value: '-1024'
SELECT @@global.join_buffer_size=8200 OR @@global.join_buffer_size= 8228; SELECT @@global.join_buffer_size=8200 OR @@global.join_buffer_size= 8228;
@@global.join_buffer_size=8200 OR @@global.join_buffer_size= 8228 @@global.join_buffer_size=8200 OR @@global.join_buffer_size= 8228
1 1
...@@ -103,7 +103,7 @@ SELECT @@session.join_buffer_size=8200 OR @@session.join_buffer_size= 8228; ...@@ -103,7 +103,7 @@ SELECT @@session.join_buffer_size=8200 OR @@session.join_buffer_size= 8228;
1 1
SET @@session.join_buffer_size = -2; SET @@session.join_buffer_size = -2;
Warnings: Warnings:
Warning 1292 Truncated incorrect join_buffer_size value: '0' Warning 1292 Truncated incorrect join_buffer_size value: '-2'
SELECT @@session.join_buffer_size=8200 OR @@session.join_buffer_size= 8228; SELECT @@session.join_buffer_size=8200 OR @@session.join_buffer_size= 8228;
@@session.join_buffer_size=8200 OR @@session.join_buffer_size= 8228 @@session.join_buffer_size=8200 OR @@session.join_buffer_size= 8228
1 1
......
...@@ -17,8 +17,6 @@ SELECT @@global.key_buffer_size BETWEEN 8 AND 36; ...@@ -17,8 +17,6 @@ SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size BETWEEN 8 AND 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
SET @@global.key_buffer_size = 1800; SET @@global.key_buffer_size = 1800;
Warnings:
Warning 1292 Truncated incorrect key_buffer_size value: '1800'
SELECT @@global.key_buffer_size BETWEEN 8 AND 36; SELECT @@global.key_buffer_size BETWEEN 8 AND 36;
@@global.key_buffer_size BETWEEN 8 AND 36 @@global.key_buffer_size BETWEEN 8 AND 36
1 1
......
...@@ -74,6 +74,8 @@ SELECT @@global.log_warnings; ...@@ -74,6 +74,8 @@ SELECT @@global.log_warnings;
@@global.log_warnings @@global.log_warnings
100000000000 100000000000
SET @@global.log_warnings = -1024; SET @@global.log_warnings = -1024;
Warnings:
Warning 1292 Truncated incorrect log_warnings value: '-1024'
SELECT @@global.log_warnings; SELECT @@global.log_warnings;
@@global.log_warnings @@global.log_warnings
0 0
...@@ -92,6 +94,8 @@ SELECT @@session.log_warnings; ...@@ -92,6 +94,8 @@ SELECT @@session.log_warnings;
@@session.log_warnings @@session.log_warnings
100000000000 100000000000
SET @@session.log_warnings = -2; SET @@session.log_warnings = -2;
Warnings:
Warning 1292 Truncated incorrect log_warnings value: '-2'
SELECT @@session.log_warnings; SELECT @@session.log_warnings;
@@session.log_warnings @@session.log_warnings
0 0
......
SET @start_value = @@global.max_binlog_cache_size; SET @start_value = @@global.max_binlog_cache_size;
SELECT @start_value; SELECT @start_value;
@start_value @start_value
18446744073709551615 18446744073709547520
'#--------------------FN_DYNVARS_072_01------------------------#' '#--------------------FN_DYNVARS_072_01------------------------#'
SET @@global.max_binlog_cache_size = 5000; SET @@global.max_binlog_cache_size = 5000;
SET @@global.max_binlog_cache_size = DEFAULT; SET @@global.max_binlog_cache_size = DEFAULT;
...@@ -39,7 +39,7 @@ SELECT @@global.max_binlog_cache_size; ...@@ -39,7 +39,7 @@ SELECT @@global.max_binlog_cache_size;
'#--------------------FN_DYNVARS_072_04-------------------------#' '#--------------------FN_DYNVARS_072_04-------------------------#'
SET @@global.max_binlog_cache_size = -1; SET @@global.max_binlog_cache_size = -1;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_binlog_cache_size value: '0' Warning 1292 Truncated incorrect max_binlog_cache_size value: '-1'
SELECT @@global.max_binlog_cache_size; SELECT @@global.max_binlog_cache_size;
@@global.max_binlog_cache_size @@global.max_binlog_cache_size
4096 4096
...@@ -54,7 +54,7 @@ SELECT @@global.max_binlog_cache_size; ...@@ -54,7 +54,7 @@ SELECT @@global.max_binlog_cache_size;
99999997952 99999997952
SET @@global.max_binlog_cache_size = -1024; SET @@global.max_binlog_cache_size = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_binlog_cache_size value: '0' Warning 1292 Truncated incorrect max_binlog_cache_size value: '-1024'
SELECT @@global.max_binlog_cache_size; SELECT @@global.max_binlog_cache_size;
@@global.max_binlog_cache_size @@global.max_binlog_cache_size
4096 4096
......
...@@ -39,7 +39,7 @@ SELECT @@global.max_connect_errors; ...@@ -39,7 +39,7 @@ SELECT @@global.max_connect_errors;
'#--------------------FN_DYNVARS_073_04-------------------------#' '#--------------------FN_DYNVARS_073_04-------------------------#'
SET @@global.max_connect_errors = -1; SET @@global.max_connect_errors = -1;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_connect_errors value: '0' Warning 1292 Truncated incorrect max_connect_errors value: '-1'
SELECT @@global.max_connect_errors; SELECT @@global.max_connect_errors;
@@global.max_connect_errors @@global.max_connect_errors
1 1
...@@ -54,7 +54,7 @@ SELECT @@global.max_connect_errors; ...@@ -54,7 +54,7 @@ SELECT @@global.max_connect_errors;
100000000000 100000000000
SET @@global.max_connect_errors = -1024; SET @@global.max_connect_errors = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_connect_errors value: '0' Warning 1292 Truncated incorrect max_connect_errors value: '-1024'
SELECT @@global.max_connect_errors; SELECT @@global.max_connect_errors;
@@global.max_connect_errors @@global.max_connect_errors
1 1
......
...@@ -73,13 +73,13 @@ SELECT @@session.max_heap_table_size; ...@@ -73,13 +73,13 @@ SELECT @@session.max_heap_table_size;
'#------------------FN_DYNVARS_077_05-----------------------#' '#------------------FN_DYNVARS_077_05-----------------------#'
SET @@global.max_heap_table_size = -1; SET @@global.max_heap_table_size = -1;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_heap_table_size value: '0' Warning 1292 Truncated incorrect max_heap_table_size value: '-1'
SELECT @@global.max_heap_table_size; SELECT @@global.max_heap_table_size;
@@global.max_heap_table_size @@global.max_heap_table_size
16384 16384
SET @@global.max_heap_table_size = -1024; SET @@global.max_heap_table_size = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_heap_table_size value: '0' Warning 1292 Truncated incorrect max_heap_table_size value: '-1024'
SELECT @@global.max_heap_table_size; SELECT @@global.max_heap_table_size;
@@global.max_heap_table_size @@global.max_heap_table_size
16384 16384
...@@ -111,7 +111,7 @@ SELECT @@global.max_heap_table_size; ...@@ -111,7 +111,7 @@ SELECT @@global.max_heap_table_size;
4294967296 4294967296
SET @@session.max_heap_table_size = -1; SET @@session.max_heap_table_size = -1;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_heap_table_size value: '0' Warning 1292 Truncated incorrect max_heap_table_size value: '-1'
SELECT @@session.max_heap_table_size; SELECT @@session.max_heap_table_size;
@@session.max_heap_table_size @@session.max_heap_table_size
16384 16384
......
...@@ -77,7 +77,7 @@ SELECT @@global.max_seeks_for_key; ...@@ -77,7 +77,7 @@ SELECT @@global.max_seeks_for_key;
1 1
SET @@global.max_seeks_for_key = -1024; SET @@global.max_seeks_for_key = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_seeks_for_key value: '0' Warning 1292 Truncated incorrect max_seeks_for_key value: '-1024'
SELECT @@global.max_seeks_for_key; SELECT @@global.max_seeks_for_key;
@@global.max_seeks_for_key @@global.max_seeks_for_key
1 1
...@@ -103,7 +103,7 @@ SELECT @@session.max_seeks_for_key; ...@@ -103,7 +103,7 @@ SELECT @@session.max_seeks_for_key;
1 1
SET @@session.max_seeks_for_key = -2; SET @@session.max_seeks_for_key = -2;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_seeks_for_key value: '0' Warning 1292 Truncated incorrect max_seeks_for_key value: '-2'
SELECT @@session.max_seeks_for_key; SELECT @@session.max_seeks_for_key;
@@session.max_seeks_for_key @@session.max_seeks_for_key
1 1
......
...@@ -71,7 +71,7 @@ SELECT @@session.max_tmp_tables; ...@@ -71,7 +71,7 @@ SELECT @@session.max_tmp_tables;
'#------------------FN_DYNVARS_086_05-----------------------#' '#------------------FN_DYNVARS_086_05-----------------------#'
SET @@global.max_tmp_tables = -1024; SET @@global.max_tmp_tables = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_tmp_tables value: '0' Warning 1292 Truncated incorrect max_tmp_tables value: '-1024'
SELECT @@global.max_tmp_tables; SELECT @@global.max_tmp_tables;
@@global.max_tmp_tables @@global.max_tmp_tables
1 1
...@@ -81,7 +81,7 @@ SELECT @@global.max_tmp_tables; ...@@ -81,7 +81,7 @@ SELECT @@global.max_tmp_tables;
4294967296 4294967296
SET @@global.max_tmp_tables = -1; SET @@global.max_tmp_tables = -1;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_tmp_tables value: '0' Warning 1292 Truncated incorrect max_tmp_tables value: '-1'
SELECT @@global.max_tmp_tables; SELECT @@global.max_tmp_tables;
@@global.max_tmp_tables @@global.max_tmp_tables
1 1
...@@ -105,7 +105,7 @@ SELECT @@session.max_tmp_tables; ...@@ -105,7 +105,7 @@ SELECT @@session.max_tmp_tables;
4294967296 4294967296
SET @@session.max_tmp_tables = -1; SET @@session.max_tmp_tables = -1;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_tmp_tables value: '0' Warning 1292 Truncated incorrect max_tmp_tables value: '-1'
SELECT @@session.max_tmp_tables; SELECT @@session.max_tmp_tables;
@@session.max_tmp_tables @@session.max_tmp_tables
1 1
...@@ -115,7 +115,7 @@ SELECT @@session.max_tmp_tables; ...@@ -115,7 +115,7 @@ SELECT @@session.max_tmp_tables;
429496729500 429496729500
SET @@session.max_tmp_tables = -001; SET @@session.max_tmp_tables = -001;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_tmp_tables value: '0' Warning 1292 Truncated incorrect max_tmp_tables value: '-1'
SELECT @@session.max_tmp_tables; SELECT @@session.max_tmp_tables;
@@session.max_tmp_tables @@session.max_tmp_tables
1 1
......
...@@ -37,7 +37,7 @@ SELECT @@global.max_write_lock_count; ...@@ -37,7 +37,7 @@ SELECT @@global.max_write_lock_count;
'#------------------FN_DYNVARS_088_04-----------------------#' '#------------------FN_DYNVARS_088_04-----------------------#'
SET @@global.max_write_lock_count = -1024; SET @@global.max_write_lock_count = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_write_lock_count value: '0' Warning 1292 Truncated incorrect max_write_lock_count value: '-1024'
SELECT @@global.max_write_lock_count; SELECT @@global.max_write_lock_count;
@@global.max_write_lock_count @@global.max_write_lock_count
1 1
...@@ -47,7 +47,7 @@ SELECT @@global.max_write_lock_count; ...@@ -47,7 +47,7 @@ SELECT @@global.max_write_lock_count;
4294967296 4294967296
SET @@global.max_write_lock_count = -1; SET @@global.max_write_lock_count = -1;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_write_lock_count value: '0' Warning 1292 Truncated incorrect max_write_lock_count value: '-1'
SELECT @@global.max_write_lock_count; SELECT @@global.max_write_lock_count;
@@global.max_write_lock_count @@global.max_write_lock_count
1 1
......
...@@ -82,6 +82,8 @@ SELECT @@global.min_examined_row_limit; ...@@ -82,6 +82,8 @@ SELECT @@global.min_examined_row_limit;
@@global.min_examined_row_limit @@global.min_examined_row_limit
429496726 429496726
SET @@global.min_examined_row_limit = -1024; SET @@global.min_examined_row_limit = -1024;
Warnings:
Warning 1292 Truncated incorrect min_examined_row_limit value: '-1024'
SELECT @@global.min_examined_row_limit; SELECT @@global.min_examined_row_limit;
@@global.min_examined_row_limit @@global.min_examined_row_limit
0 0
...@@ -104,6 +106,8 @@ SELECT @@session.min_examined_row_limit; ...@@ -104,6 +106,8 @@ SELECT @@session.min_examined_row_limit;
@@session.min_examined_row_limit @@session.min_examined_row_limit
4294967296 4294967296
SET @@session.min_examined_row_limit = -1; SET @@session.min_examined_row_limit = -1;
Warnings:
Warning 1292 Truncated incorrect min_examined_row_limit value: '-1'
SELECT @@session.min_examined_row_limit; SELECT @@session.min_examined_row_limit;
@@session.min_examined_row_limit @@session.min_examined_row_limit
0 0
......
...@@ -81,7 +81,7 @@ SELECT @@global.multi_range_count; ...@@ -81,7 +81,7 @@ SELECT @@global.multi_range_count;
4294967296 4294967296
SET @@global.multi_range_count = -1024; SET @@global.multi_range_count = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect multi_range_count value: '0' Warning 1292 Truncated incorrect multi_range_count value: '-1024'
SELECT @@global.multi_range_count; SELECT @@global.multi_range_count;
@@global.multi_range_count @@global.multi_range_count
1 1
...@@ -111,7 +111,7 @@ SELECT @@session.multi_range_count; ...@@ -111,7 +111,7 @@ SELECT @@session.multi_range_count;
4294967296 4294967296
SET @@session.multi_range_count = -1; SET @@session.multi_range_count = -1;
Warnings: Warnings:
Warning 1292 Truncated incorrect multi_range_count value: '0' Warning 1292 Truncated incorrect multi_range_count value: '-1'
SELECT @@session.multi_range_count; SELECT @@session.multi_range_count;
@@session.multi_range_count @@session.multi_range_count
1 1
......
SET @start_global_value = @@global.myisam_max_sort_file_size; SET @start_global_value = @@global.myisam_max_sort_file_size;
SELECT @start_global_value; SELECT @start_global_value;
@start_global_value @start_global_value
9223372036854775807 9223372036853727232
'#--------------------FN_DYNVARS_094_01-------------------------#' '#--------------------FN_DYNVARS_094_01-------------------------#'
SET @@global.myisam_max_sort_file_size = 500000; SET @@global.myisam_max_sort_file_size = 500000;
SET @@global.myisam_max_sort_file_size = DEFAULT; SET @@global.myisam_max_sort_file_size = DEFAULT;
...@@ -48,14 +48,20 @@ SET @@local.myisam_max_sort_file_size = 4; ...@@ -48,14 +48,20 @@ SET @@local.myisam_max_sort_file_size = 4;
ERROR HY000: Variable 'myisam_max_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'myisam_max_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL
'#------------------FN_DYNVARS_094_05-----------------------#' '#------------------FN_DYNVARS_094_05-----------------------#'
SET @@global.myisam_max_sort_file_size = -1; SET @@global.myisam_max_sort_file_size = -1;
Warnings:
Warning 1292 Truncated incorrect myisam_max_sort_file_size value: '-1'
SELECT @@global.myisam_max_sort_file_size; SELECT @@global.myisam_max_sort_file_size;
@@global.myisam_max_sort_file_size @@global.myisam_max_sort_file_size
0 0
SET @@global.myisam_max_sort_file_size = -2147483648; SET @@global.myisam_max_sort_file_size = -2147483648;
Warnings:
Warning 1292 Truncated incorrect myisam_max_sort_file_size value: '-2147483648'
SELECT @@global.myisam_max_sort_file_size; SELECT @@global.myisam_max_sort_file_size;
@@global.myisam_max_sort_file_size @@global.myisam_max_sort_file_size
0 0
SET @@global.myisam_max_sort_file_size = -2147483649; SET @@global.myisam_max_sort_file_size = -2147483649;
Warnings:
Warning 1292 Truncated incorrect myisam_max_sort_file_size value: '-2147483649'
SELECT @@global.myisam_max_sort_file_size; SELECT @@global.myisam_max_sort_file_size;
@@global.myisam_max_sort_file_size @@global.myisam_max_sort_file_size
0 0
......
...@@ -61,7 +61,7 @@ SELECT @@global.myisam_repair_threads ; ...@@ -61,7 +61,7 @@ SELECT @@global.myisam_repair_threads ;
1 1
SET @@global.myisam_repair_threads = -1024; SET @@global.myisam_repair_threads = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect myisam_repair_threads value: '0' Warning 1292 Truncated incorrect myisam_repair_threads value: '-1024'
SELECT @@global.myisam_repair_threads ; SELECT @@global.myisam_repair_threads ;
@@global.myisam_repair_threads @@global.myisam_repair_threads
1 1
...@@ -102,7 +102,7 @@ SELECT @@session.myisam_repair_threads ; ...@@ -102,7 +102,7 @@ SELECT @@session.myisam_repair_threads ;
1 1
SET @@session.myisam_repair_threads = -2; SET @@session.myisam_repair_threads = -2;
Warnings: Warnings:
Warning 1292 Truncated incorrect myisam_repair_threads value: '0' Warning 1292 Truncated incorrect myisam_repair_threads value: '-2'
SELECT @@session.myisam_repair_threads ; SELECT @@session.myisam_repair_threads ;
@@session.myisam_repair_threads @@session.myisam_repair_threads
1 1
......
...@@ -61,7 +61,7 @@ SELECT @@global.myisam_sort_buffer_size ; ...@@ -61,7 +61,7 @@ SELECT @@global.myisam_sort_buffer_size ;
4 4
SET @@global.myisam_sort_buffer_size = -1024; SET @@global.myisam_sort_buffer_size = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '0' Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '-1024'
SELECT @@global.myisam_sort_buffer_size ; SELECT @@global.myisam_sort_buffer_size ;
@@global.myisam_sort_buffer_size @@global.myisam_sort_buffer_size
4 4
...@@ -102,7 +102,7 @@ SELECT @@session.myisam_sort_buffer_size ; ...@@ -102,7 +102,7 @@ SELECT @@session.myisam_sort_buffer_size ;
4 4
SET @@session.myisam_sort_buffer_size = -2; SET @@session.myisam_sort_buffer_size = -2;
Warnings: Warnings:
Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '0' Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '-2'
SELECT @@session.myisam_sort_buffer_size ; SELECT @@session.myisam_sort_buffer_size ;
@@session.myisam_sort_buffer_size @@session.myisam_sort_buffer_size
4 4
......
...@@ -77,7 +77,7 @@ SELECT @@global.net_retry_count; ...@@ -77,7 +77,7 @@ SELECT @@global.net_retry_count;
1 1
SET @@global.net_retry_count = -1024; SET @@global.net_retry_count = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect net_retry_count value: '0' Warning 1292 Truncated incorrect net_retry_count value: '-1024'
SELECT @@global.net_retry_count; SELECT @@global.net_retry_count;
@@global.net_retry_count @@global.net_retry_count
1 1
...@@ -107,7 +107,7 @@ SELECT @@session.net_retry_count; ...@@ -107,7 +107,7 @@ SELECT @@session.net_retry_count;
1 1
SET @@session.net_retry_count = -2; SET @@session.net_retry_count = -2;
Warnings: Warnings:
Warning 1292 Truncated incorrect net_retry_count value: '0' Warning 1292 Truncated incorrect net_retry_count value: '-2'
SELECT @@session.net_retry_count; SELECT @@session.net_retry_count;
@@session.net_retry_count @@session.net_retry_count
1 1
......
...@@ -78,7 +78,7 @@ SELECT @@global.query_alloc_block_size; ...@@ -78,7 +78,7 @@ SELECT @@global.query_alloc_block_size;
1024 1024
SET @@global.query_alloc_block_size = -1; SET @@global.query_alloc_block_size = -1;
Warnings: Warnings:
Warning 1292 Truncated incorrect query_alloc_block_size value: '0' Warning 1292 Truncated incorrect query_alloc_block_size value: '-1'
SELECT @@global.query_alloc_block_size; SELECT @@global.query_alloc_block_size;
@@global.query_alloc_block_size @@global.query_alloc_block_size
1024 1024
...@@ -110,7 +110,7 @@ SELECT @@session.query_alloc_block_size; ...@@ -110,7 +110,7 @@ SELECT @@session.query_alloc_block_size;
1024 1024
SET @@session.query_alloc_block_size = -2; SET @@session.query_alloc_block_size = -2;
Warnings: Warnings:
Warning 1292 Truncated incorrect query_alloc_block_size value: '0' Warning 1292 Truncated incorrect query_alloc_block_size value: '-2'
SELECT @@session.query_alloc_block_size; SELECT @@session.query_alloc_block_size;
@@session.query_alloc_block_size @@session.query_alloc_block_size
1024 1024
......
...@@ -32,6 +32,8 @@ SELECT @@global.query_cache_limit; ...@@ -32,6 +32,8 @@ SELECT @@global.query_cache_limit;
1048575 1048575
'#--------------------FN_DYNVARS_131_04-------------------------#' '#--------------------FN_DYNVARS_131_04-------------------------#'
SET @@global.query_cache_limit = -1; SET @@global.query_cache_limit = -1;
Warnings:
Warning 1292 Truncated incorrect query_cache_limit value: '-1'
SELECT @@global.query_cache_limit; SELECT @@global.query_cache_limit;
@@global.query_cache_limit @@global.query_cache_limit
0 0
...@@ -49,6 +51,8 @@ SELECT @@global.query_cache_limit; ...@@ -49,6 +51,8 @@ SELECT @@global.query_cache_limit;
@@global.query_cache_limit @@global.query_cache_limit
10240022115 10240022115
SET @@global.query_cache_limit = -1024; SET @@global.query_cache_limit = -1024;
Warnings:
Warning 1292 Truncated incorrect query_cache_limit value: '-1024'
SELECT @@global.query_cache_limit; SELECT @@global.query_cache_limit;
@@global.query_cache_limit @@global.query_cache_limit
0 0
......
...@@ -42,6 +42,8 @@ SELECT @@global.query_cache_min_res_unit; ...@@ -42,6 +42,8 @@ SELECT @@global.query_cache_min_res_unit;
1048576 1048576
'#--------------------FN_DYNVARS_132_04-------------------------#' '#--------------------FN_DYNVARS_132_04-------------------------#'
SET @@global.query_cache_min_res_unit = -1; SET @@global.query_cache_min_res_unit = -1;
Warnings:
Warning 1292 Truncated incorrect query_cache_min_res_unit value: '-1'
SELECT @@global.query_cache_min_res_unit; SELECT @@global.query_cache_min_res_unit;
@@global.query_cache_min_res_unit @@global.query_cache_min_res_unit
512 512
...@@ -59,6 +61,8 @@ SELECT @@global.query_cache_min_res_unit; ...@@ -59,6 +61,8 @@ SELECT @@global.query_cache_min_res_unit;
@@global.query_cache_min_res_unit @@global.query_cache_min_res_unit
512 512
SET @@global.query_cache_min_res_unit = -1024; SET @@global.query_cache_min_res_unit = -1024;
Warnings:
Warning 1292 Truncated incorrect query_cache_min_res_unit value: '-1024'
SELECT @@global.query_cache_min_res_unit; SELECT @@global.query_cache_min_res_unit;
@@global.query_cache_min_res_unit @@global.query_cache_min_res_unit
512 512
......
...@@ -41,6 +41,8 @@ SELECT @@global.query_cache_size; ...@@ -41,6 +41,8 @@ SELECT @@global.query_cache_size;
1047552 1047552
'#--------------------FN_DYNVARS_133_04-------------------------#' '#--------------------FN_DYNVARS_133_04-------------------------#'
SET @@global.query_cache_size = -1; SET @@global.query_cache_size = -1;
Warnings:
Warning 1292 Truncated incorrect query_cache_size value: '-1'
SELECT @@global.query_cache_size; SELECT @@global.query_cache_size;
@@global.query_cache_size @@global.query_cache_size
0 0
...@@ -58,6 +60,8 @@ SELECT @@global.query_cache_size; ...@@ -58,6 +60,8 @@ SELECT @@global.query_cache_size;
@@global.query_cache_size @@global.query_cache_size
0 0
SET @@global.query_cache_size = -1024; SET @@global.query_cache_size = -1024;
Warnings:
Warning 1292 Truncated incorrect query_cache_size value: '-1024'
SELECT @@global.query_cache_size; SELECT @@global.query_cache_size;
@@global.query_cache_size @@global.query_cache_size
0 0
......
...@@ -35,10 +35,6 @@ SET @@global.query_prealloc_size = 8192; ...@@ -35,10 +35,6 @@ SET @@global.query_prealloc_size = 8192;
SELECT @@global.query_prealloc_size ; SELECT @@global.query_prealloc_size ;
@@global.query_prealloc_size @@global.query_prealloc_size
8192 8192
SET @@global.query_prealloc_size = 4294967295;
SELECT @@global.query_prealloc_size ;
@@global.query_prealloc_size
4294966272
SET @@global.query_prealloc_size = 655354; SET @@global.query_prealloc_size = 655354;
SELECT @@global.query_prealloc_size ; SELECT @@global.query_prealloc_size ;
@@global.query_prealloc_size @@global.query_prealloc_size
...@@ -48,10 +44,6 @@ SET @@session.query_prealloc_size = 8192; ...@@ -48,10 +44,6 @@ SET @@session.query_prealloc_size = 8192;
SELECT @@session.query_prealloc_size ; SELECT @@session.query_prealloc_size ;
@@session.query_prealloc_size @@session.query_prealloc_size
8192 8192
SET @@session.query_prealloc_size = 4294967295;
SELECT @@session.query_prealloc_size ;
@@session.query_prealloc_size
4294966272
SET @@session.query_prealloc_size = 655345; SET @@session.query_prealloc_size = 655345;
SELECT @@session.query_prealloc_size ; SELECT @@session.query_prealloc_size ;
@@session.query_prealloc_size @@session.query_prealloc_size
...@@ -63,48 +55,32 @@ Warning 1292 Truncated incorrect query_prealloc_size value: '0' ...@@ -63,48 +55,32 @@ Warning 1292 Truncated incorrect query_prealloc_size value: '0'
SELECT @@global.query_prealloc_size ; SELECT @@global.query_prealloc_size ;
@@global.query_prealloc_size @@global.query_prealloc_size
8192 8192
SET @@global.query_prealloc_size = -1024;
Warnings:
Warning 1292 Truncated incorrect query_prealloc_size value: '0'
SELECT @@global.query_prealloc_size ;
@@global.query_prealloc_size
8192
SET @@global.query_prealloc_size = 429496729533;
SELECT @@global.query_prealloc_size ;
@@global.query_prealloc_size
429496728576
SET @@global.query_prealloc_size = 65530.34.; SET @@global.query_prealloc_size = 65530.34.;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.' at line 1
SELECT @@global.query_prealloc_size ; SELECT @@global.query_prealloc_size ;
@@global.query_prealloc_size @@global.query_prealloc_size
429496728576 8192
SET @@global.query_prealloc_size = test; SET @@global.query_prealloc_size = test;
ERROR 42000: Incorrect argument type to variable 'query_prealloc_size' ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
SELECT @@global.query_prealloc_size ; SELECT @@global.query_prealloc_size ;
@@global.query_prealloc_size @@global.query_prealloc_size
429496728576 8192
SET @@global.query_prealloc_size = "test"; SET @@global.query_prealloc_size = "test";
ERROR 42000: Incorrect argument type to variable 'query_prealloc_size' ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
SELECT @@global.query_prealloc_size ; SELECT @@global.query_prealloc_size ;
@@global.query_prealloc_size @@global.query_prealloc_size
429496728576 8192
SET @@global.query_prealloc_size = 'test'; SET @@global.query_prealloc_size = 'test';
ERROR 42000: Incorrect argument type to variable 'query_prealloc_size' ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
SELECT @@global.query_prealloc_size ; SELECT @@global.query_prealloc_size ;
@@global.query_prealloc_size @@global.query_prealloc_size
429496728576 8192
SET @@global.query_prealloc_size = ON; SET @@global.query_prealloc_size = ON;
ERROR 42000: Incorrect argument type to variable 'query_prealloc_size' ERROR 42000: Incorrect argument type to variable 'query_prealloc_size'
SELECT @@global.query_prealloc_size ; SELECT @@global.query_prealloc_size ;
@@global.query_prealloc_size @@global.query_prealloc_size
429496728576
SET @@session.query_prealloc_size = 0;
Warnings:
Warning 1292 Truncated incorrect query_prealloc_size value: '0'
SELECT @@session.query_prealloc_size ;
@@session.query_prealloc_size
8192 8192
SET @@session.query_prealloc_size = -2; SET @@session.query_prealloc_size = 0;
Warnings: Warnings:
Warning 1292 Truncated incorrect query_prealloc_size value: '0' Warning 1292 Truncated incorrect query_prealloc_size value: '0'
SELECT @@session.query_prealloc_size ; SELECT @@session.query_prealloc_size ;
......
...@@ -71,7 +71,7 @@ SELECT @@global.range_alloc_block_size; ...@@ -71,7 +71,7 @@ SELECT @@global.range_alloc_block_size;
4096 4096
SET @@global.range_alloc_block_size = -1024; SET @@global.range_alloc_block_size = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect range_alloc_block_size value: '0' Warning 1292 Truncated incorrect range_alloc_block_size value: '-1024'
SELECT @@global.range_alloc_block_size; SELECT @@global.range_alloc_block_size;
@@global.range_alloc_block_size @@global.range_alloc_block_size
4096 4096
...@@ -97,7 +97,7 @@ SELECT @@session.range_alloc_block_size; ...@@ -97,7 +97,7 @@ SELECT @@session.range_alloc_block_size;
4096 4096
SET @@session.range_alloc_block_size = -2; SET @@session.range_alloc_block_size = -2;
Warnings: Warnings:
Warning 1292 Truncated incorrect range_alloc_block_size value: '0' Warning 1292 Truncated incorrect range_alloc_block_size value: '-2'
SELECT @@session.range_alloc_block_size; SELECT @@session.range_alloc_block_size;
@@session.range_alloc_block_size @@session.range_alloc_block_size
4096 4096
......
...@@ -45,14 +45,20 @@ SET @@local.rpl_recovery_rank = 4; ...@@ -45,14 +45,20 @@ SET @@local.rpl_recovery_rank = 4;
ERROR HY000: Variable 'rpl_recovery_rank' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'rpl_recovery_rank' is a GLOBAL variable and should be set with SET GLOBAL
'#------------------FN_DYNVARS_142_04-----------------------#' '#------------------FN_DYNVARS_142_04-----------------------#'
SET @@global.rpl_recovery_rank = -1; SET @@global.rpl_recovery_rank = -1;
Warnings:
Warning 1292 Truncated incorrect rpl_recovery_rank value: '-1'
SELECT @@global.rpl_recovery_rank; SELECT @@global.rpl_recovery_rank;
@@global.rpl_recovery_rank @@global.rpl_recovery_rank
0 0
SET @@global.rpl_recovery_rank = -2147483648; SET @@global.rpl_recovery_rank = -2147483648;
Warnings:
Warning 1292 Truncated incorrect rpl_recovery_rank value: '-2147483648'
SELECT @@global.rpl_recovery_rank; SELECT @@global.rpl_recovery_rank;
@@global.rpl_recovery_rank @@global.rpl_recovery_rank
0 0
SET @@global.rpl_recovery_rank = -2147483649; SET @@global.rpl_recovery_rank = -2147483649;
Warnings:
Warning 1292 Truncated incorrect rpl_recovery_rank value: '-2147483649'
SELECT @@global.rpl_recovery_rank; SELECT @@global.rpl_recovery_rank;
@@global.rpl_recovery_rank @@global.rpl_recovery_rank
0 0
......
...@@ -55,6 +55,8 @@ SET @@local.slave_transaction_retries = 4; ...@@ -55,6 +55,8 @@ SET @@local.slave_transaction_retries = 4;
ERROR HY000: Variable 'slave_transaction_retries' is a GLOBAL variable and should be set with SET GLOBAL ERROR HY000: Variable 'slave_transaction_retries' is a GLOBAL variable and should be set with SET GLOBAL
'#------------------FN_DYNVARS_149_05-----------------------#' '#------------------FN_DYNVARS_149_05-----------------------#'
SET @@global.slave_transaction_retries = -1; SET @@global.slave_transaction_retries = -1;
Warnings:
Warning 1292 Truncated incorrect slave_transaction_retries value: '-1'
SELECT @@global.slave_transaction_retries; SELECT @@global.slave_transaction_retries;
@@global.slave_transaction_retries @@global.slave_transaction_retries
0 0
......
...@@ -36,6 +36,8 @@ SELECT @@global.sync_binlog; ...@@ -36,6 +36,8 @@ SELECT @@global.sync_binlog;
65536 65536
'#--------------------FN_DYNVARS_168_04-------------------------#' '#--------------------FN_DYNVARS_168_04-------------------------#'
SET @@global.sync_binlog = -1; SET @@global.sync_binlog = -1;
Warnings:
Warning 1292 Truncated incorrect sync_binlog value: '-1'
SELECT @@global.sync_binlog; SELECT @@global.sync_binlog;
@@global.sync_binlog @@global.sync_binlog
0 0
...@@ -53,6 +55,8 @@ SELECT @@global.sync_binlog; ...@@ -53,6 +55,8 @@ SELECT @@global.sync_binlog;
@@global.sync_binlog @@global.sync_binlog
10240022115 10240022115
SET @@global.sync_binlog = -1024; SET @@global.sync_binlog = -1024;
Warnings:
Warning 1292 Truncated incorrect sync_binlog value: '-1024'
SELECT @@global.sync_binlog; SELECT @@global.sync_binlog;
@@global.sync_binlog @@global.sync_binlog
0 0
......
...@@ -67,7 +67,7 @@ SELECT @@global.transaction_alloc_block_size; ...@@ -67,7 +67,7 @@ SELECT @@global.transaction_alloc_block_size;
1024 1024
SET @@global.transaction_alloc_block_size = -1024; SET @@global.transaction_alloc_block_size = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect transaction_alloc_block_size value: '0' Warning 1292 Truncated incorrect transaction_alloc_block_size value: '-1024'
SELECT @@global.transaction_alloc_block_size; SELECT @@global.transaction_alloc_block_size;
@@global.transaction_alloc_block_size @@global.transaction_alloc_block_size
1024 1024
......
...@@ -66,7 +66,7 @@ SELECT @@global.transaction_prealloc_size; ...@@ -66,7 +66,7 @@ SELECT @@global.transaction_prealloc_size;
1024 1024
SET @@global.transaction_prealloc_size = -1024; SET @@global.transaction_prealloc_size = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect transaction_prealloc_size value: '0' Warning 1292 Truncated incorrect transaction_prealloc_size value: '-1024'
SELECT @@global.transaction_prealloc_size; SELECT @@global.transaction_prealloc_size;
@@global.transaction_prealloc_size @@global.transaction_prealloc_size
1024 1024
......
...@@ -44,7 +44,7 @@ Warnings: ...@@ -44,7 +44,7 @@ Warnings:
Warning 1292 Truncated incorrect wait_timeout value: '0' Warning 1292 Truncated incorrect wait_timeout value: '0'
SET @@global.wait_timeout = -1024; SET @@global.wait_timeout = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect wait_timeout value: '0' Warning 1292 Truncated incorrect wait_timeout value: '-1024'
'Bug # 34837: Errors are not coming on assigning invalid values to variable'; 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
SET @@global.wait_timeout = ON; SET @@global.wait_timeout = ON;
ERROR 42000: Incorrect argument type to variable 'wait_timeout' ERROR 42000: Incorrect argument type to variable 'wait_timeout'
......
...@@ -317,6 +317,134 @@ reap; ...@@ -317,6 +317,134 @@ reap;
connection locker; connection locker;
drop table t1; drop table t1;
#
# Bug#43230: SELECT ... FOR UPDATE can hang with FLUSH TABLES WITH READ LOCK indefinitely
#
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connect (con3,localhost,root,,);
connect (con4,localhost,root,,);
connect (con5,localhost,root,,);
create table t1 (a int);
create table t2 like t1;
connection con1;
--echo # con1
lock tables t1 write;
connection con2;
--echo # con2
send flush tables with read lock;
connection con5;
--echo # con5
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Flushing tables';
--source include/wait_show_condition.inc
--echo # global read lock is taken
connection con3;
--echo # con3
send select * from t2 for update;
connection con5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Waiting for release of readlock';
--source include/wait_show_condition.inc
--echo # waiting for release of read lock
connection con4;
--echo # con4
--echo # would hang and later cause a deadlock
flush tables t2;
connection con1;
--echo # clean up
unlock tables;
connection con2;
--reap
unlock tables;
connection con3;
--reap
connection default;
disconnect con5;
disconnect con4;
disconnect con3;
disconnect con2;
disconnect con1;
drop table t1,t2;
--echo #
--echo # Lightweight version:
--echo # Ensure that the wait for a GRL is done before opening tables.
--echo #
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
create table t1 (a int);
create table t2 like t1;
--echo #
--echo # UPDATE
--echo #
connection default;
--echo # default
flush tables with read lock;
connection con1;
--echo # con1
send update t2 set a = 1;
connection default;
--echo # default
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Waiting for release of readlock';
--source include/wait_show_condition.inc
--echo # statement is waiting for release of read lock
connection con2;
--echo # con2
flush table t2;
connection default;
--echo # default
unlock tables;
connection con1;
--echo # con1
--reap
--echo #
--echo # LOCK TABLES .. WRITE
--echo #
connection default;
--echo # default
flush tables with read lock;
connection con1;
--echo # con1
send lock tables t2 write;
connection default;
--echo # default
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Waiting for release of readlock';
--source include/wait_show_condition.inc
--echo # statement is waiting for release of read lock
connection con2;
--echo # con2
flush table t2;
connection default;
--echo # default
unlock tables;
connection con1;
--echo # con1
--reap
unlock tables;
connection default;
disconnect con2;
disconnect con1;
drop table t1,t2;
--echo End of 5.0 tests --echo End of 5.0 tests
......
...@@ -81,3 +81,29 @@ let $MYSQLD_DATADIR= `select @@datadir`; ...@@ -81,3 +81,29 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--exec $MYISAMPACK $MYSQLD_DATADIR/test/t1 --exec $MYISAMPACK $MYSQLD_DATADIR/test/t1
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug #43973 - backup_myisam.test fails on 6.0-bugteam
--echo #
CREATE DATABASE mysql_db1;
CREATE TABLE mysql_db1.t1 (c1 VARCHAR(5), c2 int);
CREATE INDEX i1 ON mysql_db1.t1 (c1, c2);
INSERT INTO mysql_db1.t1 VALUES ('A',1);
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
FLUSH TABLE mysql_db1.t1;
#
--echo # Compress the table using MYISAMPACK tool
let $MYSQLD_DATADIR= `select @@datadir`;
--exec $MYISAMPACK -s $MYSQLD_DATADIR/mysql_db1/t1
--echo # Run MYISAMCHK tool on the compressed table
--exec $MYISAMCHK -srq $MYSQLD_DATADIR/mysql_db1/t1
SELECT COUNT(*) FROM mysql_db1.t1 WHERE c2 < 5;
#
DROP TABLE mysql_db1.t1;
DROP DATABASE mysql_db1;
...@@ -38,8 +38,26 @@ SET timestamp=1000000000; ...@@ -38,8 +38,26 @@ SET timestamp=1000000000;
--echo # --echo #
--echo # We need big packets. --echo # We need big packets.
--echo # --echo #
--echo # Capture initial value to reset at the end of the test
# use let $<var> = query_get_value as FLUSH statements
# in the test will set @<var> values to NULL
let $orig_max_allowed_packet =
query_get_value(SELECT @@global.max_allowed_packet, @@global.max_allowed_packet, 1);
--echo # Now adjust max_allowed_packet
SET @@global.max_allowed_packet= 1024*1024*1024; SET @@global.max_allowed_packet= 1024*1024*1024;
--echo max_allowed_packet is a global variable.
--echo In order for the preceding change in max_allowed_packets' value
--echo to be seen and used, we must start a new connection.
--echo The change does not take effect with the current one.
--echo For simplicity, we just disconnect / reconnect connection default here.
--echo Disconnecting default connection...
disconnect default;
--echo Reconnecting default connection...
connect (default, localhost,root,,);
--echo default connection established, continuing with the test
--echo # --echo #
--echo # Delete all existing binary logs. --echo # Delete all existing binary logs.
--echo # --echo #
...@@ -53,34 +71,35 @@ eval CREATE TABLE t1 ( ...@@ -53,34 +71,35 @@ eval CREATE TABLE t1 (
) ENGINE=$engine_type DEFAULT CHARSET latin1; ) ENGINE=$engine_type DEFAULT CHARSET latin1;
--echo # --echo #
--echo # Show how much rows are affected by each statement. --echo # Show how many rows are affected by each statement.
--echo # --echo #
--enable_info --enable_info
--echo # --echo #
--echo # Insert a big row. --echo # Insert some big rows.
--echo # --echo #
#
# 256MB --echo 256MB
#INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 16777216)); INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 16777216));
#
# 32MB --echo 32MB
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152)); INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
#
# 4MB --echo 4MB
#INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 262144)); INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 262144));
#
# 512KB --echo 512KB
#INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 32768)); INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 32768));
--echo # --echo #
--echo # Show what we have in the table. --echo # Show what we have in the table.
--echo # Do not display the column value itself, just its length. --echo # Do not display the column value itself, just its length.
--echo # --echo #
--sorted_result
query_vertical SELECT LENGTH(c1) FROM t1; query_vertical SELECT LENGTH(c1) FROM t1;
--echo # --echo #
--echo # Grow the row by updating. --echo # Grow the rows by updating.
--echo # --echo #
UPDATE t1 SET c1 = CONCAT(c1, c1); UPDATE t1 SET c1 = CONCAT(c1, c1);
...@@ -88,15 +107,16 @@ UPDATE t1 SET c1 = CONCAT(c1, c1); ...@@ -88,15 +107,16 @@ UPDATE t1 SET c1 = CONCAT(c1, c1);
--echo # Show what we have in the table. --echo # Show what we have in the table.
--echo # Do not display the column value itself, just its length. --echo # Do not display the column value itself, just its length.
--echo # --echo #
--sorted_result
query_vertical SELECT LENGTH(c1) FROM t1; query_vertical SELECT LENGTH(c1) FROM t1;
--echo # --echo #
--echo # Delete the row. --echo # Delete the rows.
--echo # --echo #
DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck'; DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck';
--echo # --echo #
--echo # Hide how much rows are affected by each statement. --echo # Hide how many rows are affected by each statement.
--echo # --echo #
--disable_info --disable_info
...@@ -113,13 +133,15 @@ FLUSH LOGS; ...@@ -113,13 +133,15 @@ FLUSH LOGS;
--echo # at the bottom of the test script. --echo # at the bottom of the test script.
--echo # --echo #
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/
--exec $MYSQL_BINLOG -v -v $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output --exec $MYSQL_BINLOG -v -v $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output
--echo # --echo #
--echo # Cleanup. --echo # Cleanup.
--echo # --echo #
--echo # reset variable value to pass testcase checks
eval SET @@global.max_allowed_packet = $orig_max_allowed_packet;
DROP TABLE t1; DROP TABLE t1;
--echo remove_file \$MYSQLTEST_VARDIR/$mysqlbinlog_output --echo remove_file \$MYSQLTEST_VARDIR/$mysqlbinlog_output
......
...@@ -494,21 +494,27 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) ...@@ -494,21 +494,27 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags)
{ {
char buf[FN_REFLEN]; char buf[FN_REFLEN];
CHARSET_INFO *cs; CHARSET_INFO *cs;
if ((cs= all_charsets[cs_number]))
{
if (cs->state & MY_CS_READY) /* if CS is already initialized */
return cs;
/* /*
To make things thread safe we are not allowing other threads to interfere To make things thread safe we are not allowing other threads to interfere
while we may changing the cs_info_table while we may changing the cs_info_table
*/ */
pthread_mutex_lock(&THR_LOCK_charset); pthread_mutex_lock(&THR_LOCK_charset);
if ((cs= all_charsets[cs_number]))
{ if (!(cs->state & (MY_CS_COMPILED|MY_CS_LOADED))) /* if CS is not in memory */
if (!(cs->state & MY_CS_COMPILED) && !(cs->state & MY_CS_LOADED))
{ {
strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS); strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS);
my_read_charset_file(buf,flags); my_read_charset_file(buf,flags);
} }
cs= (cs->state & MY_CS_AVAILABLE) ? cs : NULL;
} if (cs->state & MY_CS_AVAILABLE)
if (cs && !(cs->state & MY_CS_READY)) {
if (!(cs->state & MY_CS_READY))
{ {
if ((cs->cset->init && cs->cset->init(cs, cs_alloc)) || if ((cs->cset->init && cs->cset->init(cs, cs_alloc)) ||
(cs->coll->init && cs->coll->init(cs, cs_alloc))) (cs->coll->init && cs->coll->init(cs, cs_alloc)))
...@@ -516,7 +522,12 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) ...@@ -516,7 +522,12 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags)
else else
cs->state|= MY_CS_READY; cs->state|= MY_CS_READY;
} }
}
else
cs= NULL;
pthread_mutex_unlock(&THR_LOCK_charset); pthread_mutex_unlock(&THR_LOCK_charset);
}
return cs; return cs;
} }
......
...@@ -293,12 +293,7 @@ sub start_mysqlds() ...@@ -293,12 +293,7 @@ sub start_mysqlds()
@groups = &find_groups($groupids); @groups = &find_groups($groupids);
for ($i = 0; defined($groups[$i]); $i++) for ($i = 0; defined($groups[$i]); $i++)
{ {
# Defaults are made explicit parameters to server execution...
@options = defaults_for_group($groups[$i]); @options = defaults_for_group($groups[$i]);
# ...so server MUST NOT try to read again from some config file, especially
# as the "right" file may be unknown to the server if we are using
# --defaults-file=... params in here.
unshift(@options,"--no-defaults");
$mysqld_found= 1; # The default $mysqld_found= 1; # The default
$mysqld_found= 0 if (!length($mysqld)); $mysqld_found= 0 if (!length($mysqld));
......
...@@ -2713,7 +2713,8 @@ pthread_handler_t handle_slave_sql(void *arg) ...@@ -2713,7 +2713,8 @@ pthread_handler_t handle_slave_sql(void *arg)
*/ */
pthread_cond_broadcast(&rli->start_cond); pthread_cond_broadcast(&rli->start_cond);
pthread_mutex_unlock(&rli->run_lock); pthread_mutex_unlock(&rli->run_lock);
sql_print_error("Failed during slave thread initialization"); rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
"Failed during slave thread initialization");
goto err; goto err;
} }
thd->init_for_queries(); thd->init_for_queries();
...@@ -2758,8 +2759,8 @@ pthread_handler_t handle_slave_sql(void *arg) ...@@ -2758,8 +2759,8 @@ pthread_handler_t handle_slave_sql(void *arg)
1 /*need data lock*/, &errmsg, 1 /*need data lock*/, &errmsg,
1 /*look for a description_event*/)) 1 /*look for a description_event*/))
{ {
sql_print_error("Error initializing relay log position: %s", rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
errmsg); "Error initializing relay log position: %s", errmsg);
goto err; goto err;
} }
THD_CHECK_SENTRY(thd); THD_CHECK_SENTRY(thd);
...@@ -2812,8 +2813,8 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME, ...@@ -2812,8 +2813,8 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
execute_init_command(thd, &sys_init_slave, &LOCK_sys_init_slave); execute_init_command(thd, &sys_init_slave, &LOCK_sys_init_slave);
if (thd->is_slave_error) if (thd->is_slave_error)
{ {
sql_print_error("\ rli->report(ERROR_LEVEL, thd->main_da.sql_errno(),
Slave SQL thread aborted. Can't execute init_slave query"); "Slave SQL thread aborted. Can't execute init_slave query");
goto err; goto err;
} }
} }
...@@ -2863,10 +2864,20 @@ Slave SQL thread aborted. Can't execute init_slave query"); ...@@ -2863,10 +2864,20 @@ Slave SQL thread aborted. Can't execute init_slave query");
thd->main_da.sql_errno(), last_errno)); thd->main_da.sql_errno(), last_errno));
if (last_errno == 0) if (last_errno == 0)
{ {
/*
This function is reporting an error which was not reported
while executing exec_relay_log_event().
*/
rli->report(ERROR_LEVEL, thd->main_da.sql_errno(), errmsg); rli->report(ERROR_LEVEL, thd->main_da.sql_errno(), errmsg);
} }
else if (last_errno != thd->main_da.sql_errno()) else if (last_errno != thd->main_da.sql_errno())
{ {
/*
* An error was reported while executing exec_relay_log_event()
* however the error code differs from what is in the thread.
* This function prints out more information to help finding
* what caused the problem.
*/
sql_print_error("Slave (additional info): %s Error_code: %d", sql_print_error("Slave (additional info): %s Error_code: %d",
errmsg, thd->main_da.sql_errno()); errmsg, thd->main_da.sql_errno());
} }
......
...@@ -3676,7 +3676,11 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg, ...@@ -3676,7 +3676,11 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
if (sql_log_bin_toplevel && lex->is_stmt_unsafe() && if (sql_log_bin_toplevel && lex->is_stmt_unsafe() &&
variables.binlog_format == BINLOG_FORMAT_STMT) variables.binlog_format == BINLOG_FORMAT_STMT)
{ {
push_warning(this, MYSQL_ERROR::WARN_LEVEL_WARN, /*
A warning can be elevated a error when STRICT sql mode.
But we don't want to elevate binlog warning to error here.
*/
push_warning(this, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_BINLOG_UNSAFE_STATEMENT, ER_BINLOG_UNSAFE_STATEMENT,
ER(ER_BINLOG_UNSAFE_STATEMENT)); ER(ER_BINLOG_UNSAFE_STATEMENT));
if (!(binlog_flags & BINLOG_FLAG_UNSAFE_STMT_PRINTED)) if (!(binlog_flags & BINLOG_FLAG_UNSAFE_STMT_PRINTED))
......
...@@ -348,6 +348,7 @@ void lex_start(THD *thd) ...@@ -348,6 +348,7 @@ void lex_start(THD *thd)
lex->nest_level=0 ; lex->nest_level=0 ;
lex->allow_sum_func= 0; lex->allow_sum_func= 0;
lex->in_sum_func= NULL; lex->in_sum_func= NULL;
lex->protect_against_global_read_lock= FALSE;
/* /*
ok, there must be a better solution for this, long-term ok, there must be a better solution for this, long-term
I tried "bzero" in the sql_yacc.yy code, but that for I tried "bzero" in the sql_yacc.yy code, but that for
......
...@@ -1745,6 +1745,22 @@ typedef struct st_lex : public Query_tables_list ...@@ -1745,6 +1745,22 @@ typedef struct st_lex : public Query_tables_list
bool escape_used; bool escape_used;
bool is_lex_started; /* If lex_start() did run. For debugging. */ bool is_lex_started; /* If lex_start() did run. For debugging. */
/*
Special case for SELECT .. FOR UPDATE and LOCK TABLES .. WRITE.
Protect from a impending GRL as otherwise the thread might deadlock
if it starts waiting for the GRL in mysql_lock_tables.
The protection is needed because there is a race between setting
the global read lock and waiting for all open tables to be closed.
The problem is a circular wait where a thread holding "old" open
tables will wait for the global read lock to be released while the
thread holding the global read lock will wait for all "old" open
tables to be closed -- the flush part of flush tables with read
lock.
*/
bool protect_against_global_read_lock;
st_lex(); st_lex();
virtual ~st_lex() virtual ~st_lex()
......
...@@ -2200,7 +2200,14 @@ mysql_execute_command(THD *thd) ...@@ -2200,7 +2200,14 @@ mysql_execute_command(THD *thd)
res= check_access(thd, res= check_access(thd,
lex->exchange ? SELECT_ACL | FILE_ACL : SELECT_ACL, lex->exchange ? SELECT_ACL | FILE_ACL : SELECT_ACL,
any_db, 0, 0, 0, 0); any_db, 0, 0, 0, 0);
if (!res)
if (res)
break;
if (!thd->locked_tables && lex->protect_against_global_read_lock &&
!(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))
break;
res= execute_sqlcom_select(thd, all_tables); res= execute_sqlcom_select(thd, all_tables);
break; break;
case SQLCOM_PREPARE: case SQLCOM_PREPARE:
...@@ -3006,6 +3013,9 @@ end_with_restore_list: ...@@ -3006,6 +3013,9 @@ end_with_restore_list:
DBUG_ASSERT(first_table == all_tables && first_table != 0); DBUG_ASSERT(first_table == all_tables && first_table != 0);
if (update_precheck(thd, all_tables)) if (update_precheck(thd, all_tables))
break; break;
if (!thd->locked_tables &&
!(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))
goto error;
DBUG_ASSERT(select_lex->offset_limit == 0); DBUG_ASSERT(select_lex->offset_limit == 0);
unit->set_limit(select_lex); unit->set_limit(select_lex);
res= (up_result= mysql_update(thd, all_tables, res= (up_result= mysql_update(thd, all_tables,
...@@ -3032,6 +3042,15 @@ end_with_restore_list: ...@@ -3032,6 +3042,15 @@ end_with_restore_list:
else else
res= 0; res= 0;
/*
Protection might have already been risen if its a fall through
from the SQLCOM_UPDATE case above.
*/
if (!thd->locked_tables &&
lex->sql_command == SQLCOM_UPDATE_MULTI &&
!(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))
goto error;
res= mysql_multi_update_prepare(thd); res= mysql_multi_update_prepare(thd);
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
...@@ -3229,7 +3248,8 @@ end_with_restore_list: ...@@ -3229,7 +3248,8 @@ end_with_restore_list:
ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0)); ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
goto error; goto error;
} }
if (!(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))
goto error;
res= mysql_truncate(thd, first_table, 0); res= mysql_truncate(thd, first_table, 0);
break; break;
case SQLCOM_DELETE: case SQLCOM_DELETE:
...@@ -3402,6 +3422,10 @@ end_with_restore_list: ...@@ -3402,6 +3422,10 @@ end_with_restore_list:
if (check_one_table_access(thd, privilege, all_tables)) if (check_one_table_access(thd, privilege, all_tables))
goto error; goto error;
if (!thd->locked_tables &&
!(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))
goto error;
res= mysql_load(thd, lex->exchange, first_table, lex->field_list, res= mysql_load(thd, lex->exchange, first_table, lex->field_list,
lex->update_list, lex->value_list, lex->duplicates, lex->update_list, lex->value_list, lex->duplicates,
lex->ignore, (bool) lex->local_file); lex->ignore, (bool) lex->local_file);
...@@ -3472,6 +3496,9 @@ end_with_restore_list: ...@@ -3472,6 +3496,9 @@ end_with_restore_list:
if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables, if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables,
UINT_MAX, FALSE)) UINT_MAX, FALSE))
goto error; goto error;
if (lex->protect_against_global_read_lock &&
!(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))
goto error;
thd->in_lock_tables=1; thd->in_lock_tables=1;
thd->options|= OPTION_TABLE_LOCK; thd->options|= OPTION_TABLE_LOCK;
......
...@@ -6538,6 +6538,7 @@ select_lock_type: ...@@ -6538,6 +6538,7 @@ select_lock_type:
lex->current_select->set_lock_for_tables(TL_WRITE); lex->current_select->set_lock_for_tables(TL_WRITE);
lex->current_select->lock_option= TL_WRITE; lex->current_select->lock_option= TL_WRITE;
lex->safe_to_cache_query=0; lex->safe_to_cache_query=0;
lex->protect_against_global_read_lock= TRUE;
} }
| LOCK_SYM IN_SYM SHARE_SYM MODE_SYM | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
{ {
...@@ -12182,8 +12183,12 @@ table_lock_list: ...@@ -12182,8 +12183,12 @@ table_lock_list:
table_lock: table_lock:
table_ident opt_table_alias lock_option table_ident opt_table_alias lock_option
{ {
if (!Select->add_table_to_list(YYTHD, $1, $2, 0, (thr_lock_type) $3)) thr_lock_type lock_type= (thr_lock_type) $3;
if (!Select->add_table_to_list(YYTHD, $1, $2, 0, lock_type))
MYSQL_YYABORT; MYSQL_YYABORT;
/* If table is to be write locked, protect from a impending GRL. */
if (lock_type >= TL_WRITE_ALLOW_WRITE)
Lex->protect_against_global_read_lock= TRUE;
} }
; ;
......
...@@ -209,10 +209,17 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) ...@@ -209,10 +209,17 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
This segment will be reallocated after construction of the tables. This segment will be reallocated after construction of the tables.
*/ */
length=(uint) (elements*2+trees*(1 << myisam_quick_table_bits)); length=(uint) (elements*2+trees*(1 << myisam_quick_table_bits));
/*
To keep some algorithms simpler, we accept that they access
bytes beyond the end of the input data. This can affect up to
one byte less than the "word size" size used in this file,
which is BITS_SAVED / 8. To avoid accessing non-allocated
data, we add (BITS_SAVED / 8) - 1 bytes to the buffer size.
*/
if (!(share->decode_tables=(uint16*) if (!(share->decode_tables=(uint16*)
my_malloc((length + OFFSET_TABLE_SIZE) * sizeof(uint16) + my_malloc((length + OFFSET_TABLE_SIZE) * sizeof(uint16) +
(uint) (share->pack.header_length - sizeof(header)), (uint) (share->pack.header_length - sizeof(header) +
MYF(MY_WME | MY_ZEROFILL)))) (BITS_SAVED / 8) - 1), MYF(MY_WME | MY_ZEROFILL))))
goto err1; goto err1;
tmp_buff=share->decode_tables+length; tmp_buff=share->decode_tables+length;
disk_cache= (uchar*) (tmp_buff+OFFSET_TABLE_SIZE); disk_cache= (uchar*) (tmp_buff+OFFSET_TABLE_SIZE);
...@@ -1431,31 +1438,6 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff) ...@@ -1431,31 +1438,6 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff)
bit_buff->current_byte=0; bit_buff->current_byte=0;
return; return;
} }
else
{
uint len= 0;
uint i= 0;
/*
Check if the remaining buffer/record to read is less than the word size.
If so read byte by byte
Note: if this branch becomes a bottleneck it can be removed, assuming
that the second memory segment allocates 7 extra bytes (see
_mi_read_pack_info()).
*/
len= bit_buff->end - bit_buff->pos;
if (len < (BITS_SAVED / 8))
{
bit_buff->current_byte= 0;
for (i=0 ; i < len ; i++)
{
bit_buff->current_byte+= (((uint) ((uchar) bit_buff->pos[len - i - 1]))
<< (8 * i));
}
bit_buff->pos= bit_buff->end;
return;
}
}
#if BITS_SAVED == 64 #if BITS_SAVED == 64
bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) + bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) +
......
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