Skip to content

Commit

Permalink
Merge remote-tracking branch 'mysql/5.5' into 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Apr 27, 2015
2 parents e4df6e5 + e02fe87 commit 0f12ada
Show file tree
Hide file tree
Showing 28 changed files with 496 additions and 90 deletions.
8 changes: 4 additions & 4 deletions cmake/compile_flags.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -18,11 +18,11 @@
MACRO(ADD_COMPILE_FLAGS)
SET(FILES "")
SET(FLAGS "")
SET(COMPILE_FLAGS)
SET(COMPILE_FLAGS_SEEN)
FOREACH(ARG ${ARGV})
IF(ARG STREQUAL "COMPILE_FLAGS")
SET(COMPILE_FLAGS "COMPILE_FLAGS")
ELSEIF(COMPILE_FLAGS)
SET(COMPILE_FLAGS_SEEN 1)
ELSEIF(COMPILE_FLAGS_SEEN)
LIST(APPEND FLAGS ${ARG})
ELSE()
LIST(APPEND FILES ${ARG})
Expand Down
108 changes: 108 additions & 0 deletions mysql-test/r/sp-innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,111 @@ CALL p1();
CALL p1();
drop procedure p1;
drop table t1,t2;

#
# BUG 16041903: CONTINUE HANDLER NOT INVOKED
# IN A STORED FUNCTION AFTER A LOCK WAIT TIMEOUT
#

# Save and set lock wait timeout
SET @lock_wait_timeout_saved= @@lock_wait_timeout;
SET @innodb_lock_wait_timeout_saved= @@innodb_lock_wait_timeout;
SET @@lock_wait_timeout= 1;
SET @@innodb_lock_wait_timeout= 1;

# Create a function with exit handler:
CREATE FUNCTION f1() RETURNS VARCHAR(20)
BEGIN
DECLARE EXIT HANDLER FOR SQLSTATE '42S02' RETURN 'No such table';
INSERT INTO no_such_table VALUES (1);
END//

# Create a function calling f1():
CREATE FUNCTION f2() RETURNS VARCHAR(20)
BEGIN
RETURN f1();
END//

# Create a function provoking deadlock:
CREATE FUNCTION f3() RETURNS VARCHAR(20)
BEGIN
UPDATE t1 SET i= 1 WHERE i= 1;
RETURN 'Will never get here';
END//

# Create a function calling f3, to create
# a deadlock indirectly:
CREATE FUNCTION f4() RETURNS VARCHAR(20)
BEGIN
RETURN f3();
END//

# Open another connection, create and initialize a table
# to be used for provoking deadlock, put a lock on the table:
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET AUTOCOMMIT= 0;
UPDATE t1 SET i=1 WHERE i=1;

# On the default connection, do an update to provoke a
# deadlock, then call the function with handler. This case
# fails without the patch (with error ER_NO_SUCH_TABLE):
SET AUTOCOMMIT= 0;
UPDATE t1 SET i=1 WHERE i=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT f1() AS 'f1():';
f1():
No such table
Warnings:
Error 1146 Table 'test.no_such_table' doesn't exist

# Provoke another deadlock, then call the function with
# handler indirectly. This case fails without the patch
# (with error ER_NO_SUCH_TABLE):
UPDATE t1 SET i= 1 WHERE i= 1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT f2() AS 'f2():';
f2():
No such table
Warnings:
Error 1146 Table 'test.no_such_table' doesn't exist

# Provoke yet another deadlock, but now from within a function,
# then call the function with handler. This succeeds even
# without the patch because is_fatal_sub_stmt_error is reset
# in restore_sub_stmt after the failing function has been
# executed. The test case is included anyway for better coverage:
SELECT f3() AS 'f3():';
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT f1() AS 'f1():';
f1():
No such table
Warnings:
Error 1146 Table 'test.no_such_table' doesn't exist
# Provoke yet another deadlock, but now from within a function,
# calling another function, then call the function with handler.
# This succeeds even without the patch because
# is_fatal_sub_stmt_error is reset in restore_sub_stmt after
# the failing function has been executed. The test case is
# included anyway for better coverage:
SELECT f4() AS 'f4():';
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT f1() AS 'f1():';
f1():
No such table
Warnings:
Error 1146 Table 'test.no_such_table' doesn't exist

# Disconnect, drop functions and table:
DROP FUNCTION f4;
DROP FUNCTION f3;
DROP FUNCTION f2;
DROP FUNCTION f1;
DROP TABLE t1;

# Reset lock wait timeouts
SET @@lock_wait_timeout= @lock_wait_timeout_saved;
SET @@innodb_lock_wait_timeout= @innodb_lock_wait_timeout_saved;
#
# BUG 16041903: End of test case
#
25 changes: 25 additions & 0 deletions mysql-test/r/trigger-trans.result
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,28 @@ b val
14 g
drop trigger t1_after_insert;
drop table t1,t2;
#
#Bug#19683834 SOME INNODB ERRORS CAUSES STORED FUNCTION
# AND TRIGGER HANDLERS TO BE IGNORED
#Code fixed in Bug#16041903
CREATE TABLE t1 (id int unsigned PRIMARY KEY, val int DEFAULT 0)
ENGINE=InnoDB;
INSERT INTO t1 (id) VALUES (1), (2);
CREATE TABLE t2 (id int PRIMARY KEY);
CREATE TABLE t3 LIKE t2;
CREATE TRIGGER bef_insert BEFORE INSERT ON t2 FOR EACH ROW
BEGIN
DECLARE CONTINUE HANDLER FOR 1062 BEGIN END;
INSERT INTO t3 (id) VALUES (NEW.id);
INSERT INTO t3 (id) VALUES (NEW.id);
END//
START TRANSACTION;
UPDATE t1 SET val = val + 1;
connect con2,localhost,root,,test,,;
SET SESSION innodb_lock_wait_timeout = 2;
UPDATE t1 SET val = val + 1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t2 (id) VALUES (1);
disconnect con2;
connection default;
DROP TABLE t3, t2, t1;
7 changes: 7 additions & 0 deletions mysql-test/suite/rpl/r/rpl_special_charset.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1(i VARCHAR(20));
INSERT INTO t1 VALUES (0xFFFF);
include/diff_tables.inc [master:t1, slave:t1]
DROP TABLE t1;
include/rpl_end.inc
2 changes: 2 additions & 0 deletions mysql-test/suite/rpl/t/rpl_drop_db_fail.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use db1;
CREATE TABLE a(id INT);
CREATE VIEW v AS SELECT * FROM a;
CREATE TABLE table_father(id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(20)) ENGINE=INNODB;
--sync_slave_with_master

connection master;
use db2;
CREATE TABLE table_child(id INT PRIMARY KEY, info VARCHAR(20), father_id INT) ENGINE=INNODB;
ALTER TABLE table_child ADD CONSTRAINT aaa FOREIGN KEY (father_id) REFERENCES db1.table_father(id);
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/rpl/t/rpl_special_charset.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--character-set-server=utf16
25 changes: 25 additions & 0 deletions mysql-test/suite/rpl/t/rpl_special_charset.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
################################################################################
# Bug#19855907 IO THREAD AUTHENTICATION ISSUE WITH SOME CHARACTER SETS
# Problem: IO thread fails to connect to master if servers are configured with
# special character sets like utf16, utf32, ucs2.
#
# Analysis: MySQL server does not support few special character sets like
# utf16,utf32 and ucs2 as "client's character set"(eg: utf16,utf32, ucs2).
# When IO thread is trying to connect to Master, it sets server's character
# set as client's character set. When Slave server is started with these
# special character sets, IO thread (a connection to Master) fails because
# of the above said reason.
#
# Fix: If server's character set is not supported as client's character set,
# then set default's client character set(latin1) as client's character set.
###############################################################################
--source include/master-slave.inc
CREATE TABLE t1(i VARCHAR(20));
INSERT INTO t1 VALUES (0xFFFF);
--sync_slave_with_master
--let diff_tables=master:t1, slave:t1
--source include/diff_tables.inc
# Cleanup
--connection master
DROP TABLE t1;
--source include/rpl_end.inc
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,11 @@ Warning 1292 Truncated incorrect transaction_alloc_block_size value: '60020'
SELECT @@global.transaction_alloc_block_size;
@@global.transaction_alloc_block_size
59392
SET @@global.transaction_alloc_block_size = 4294967295;
Warnings:
Warning 1292 Truncated incorrect transaction_alloc_block_size value: '4294967295'
SELECT @@global.transaction_alloc_block_size;
@@global.transaction_alloc_block_size
4294966272
'#--------------------FN_DYNVARS_005_04-------------------------#'
SET @@session.transaction_alloc_block_size = 1024;
SELECT @@session.transaction_alloc_block_size;
@@session.transaction_alloc_block_size
1024
SET @@session.transaction_alloc_block_size =4294967295;
Warnings:
Warning 1292 Truncated incorrect transaction_alloc_block_size value: '4294967295'
SELECT @@session.transaction_alloc_block_size;
@@session.transaction_alloc_block_size
4294966272
SET @@session.transaction_alloc_block_size = 65535;
Warnings:
Warning 1292 Truncated incorrect transaction_alloc_block_size value: '65535'
Expand All @@ -77,12 +65,12 @@ Warning 1292 Truncated incorrect transaction_alloc_block_size value: '-1024'
SELECT @@global.transaction_alloc_block_size;
@@global.transaction_alloc_block_size
1024
SET @@global.transaction_alloc_block_size = 123456789201;
SET @@global.transaction_alloc_block_size = 135217728;
Warnings:
Warning 1292 Truncated incorrect transaction_alloc_block_size value: '123456789201'
Warning 1292 Truncated incorrect transaction_alloc_block_size value: '135217728'
SELECT @@global.transaction_alloc_block_size;
@@global.transaction_alloc_block_size
4294966272
134217728
SET @@global.transaction_alloc_block_size = ON;
ERROR 42000: Incorrect argument type to variable 'transaction_alloc_block_size'
SET @@global.transaction_alloc_block_size = OFF;
Expand All @@ -109,12 +97,12 @@ Warning 1292 Truncated incorrect transaction_alloc_block_size value: '1000'
SELECT @@global.transaction_alloc_block_size;
@@global.transaction_alloc_block_size
1024
SET @@session.transaction_alloc_block_size = 12345678901;
SET @@session.transaction_alloc_block_size = 135217728;
Warnings:
Warning 1292 Truncated incorrect transaction_alloc_block_size value: '12345678901'
Warning 1292 Truncated incorrect transaction_alloc_block_size value: '135217728'
SELECT @@session.transaction_alloc_block_size;
@@session.transaction_alloc_block_size
4294966272
134217728
SET @@session.transaction_alloc_block_size = ON;
ERROR 42000: Incorrect argument type to variable 'transaction_alloc_block_size'
SET @@session.transaction_alloc_block_size = OFF;
Expand Down Expand Up @@ -149,9 +137,7 @@ WHERE VARIABLE_NAME='transaction_alloc_block_size';
1
'#---------------------FN_DYNVARS_001_08----------------------#'
SET @@transaction_alloc_block_size = 1024;
SET @@global.transaction_alloc_block_size = 4294967295;
Warnings:
Warning 1292 Truncated incorrect transaction_alloc_block_size value: '4294967295'
SET @@global.transaction_alloc_block_size = 134217728;
SELECT @@transaction_alloc_block_size = @@global.transaction_alloc_block_size;
@@transaction_alloc_block_size = @@global.transaction_alloc_block_size
0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ SELECT @@session.transaction_prealloc_size;
1024
SET @@session.transaction_prealloc_size = "Test";
ERROR 42000: Incorrect argument type to variable 'transaction_prealloc_size'
SET @@session.transaction_prealloc_size = 135217728;
Warnings:
Warning 1292 Truncated incorrect transaction_prealloc_size value: '135217728'
SELECT @@session.transaction_prealloc_size;
@@session.transaction_prealloc_size
134217728
'#------------------FN_DYNVARS_005_06-----------------------#'
SELECT @@global.transaction_prealloc_size = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
Expand All @@ -128,7 +134,7 @@ Warnings:
Warning 1292 Truncated incorrect transaction_prealloc_size value: '10'
SELECT @@transaction_prealloc_size = @@global.transaction_prealloc_size;
@@transaction_prealloc_size = @@global.transaction_prealloc_size
1
0
'#---------------------FN_DYNVARS_001_10----------------------#'
SET @@transaction_prealloc_size = 100;
Warnings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Access Type: Dynamic #
# Data Type: numeric #
# Default Value: 8192 #
# Range: 1024-4294967295 #
# Range: 1024-134217728 #
# #
# #
# Creation Date: 2008-02-14 #
Expand Down Expand Up @@ -80,9 +80,6 @@ SELECT @@global.transaction_alloc_block_size;
SET @@global.transaction_alloc_block_size = 60020;
SELECT @@global.transaction_alloc_block_size;

SET @@global.transaction_alloc_block_size = 4294967295;
SELECT @@global.transaction_alloc_block_size;

--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
###################################################################
# Change the value of variable to a valid value for SESSION Scope #
Expand All @@ -91,9 +88,6 @@ SELECT @@global.transaction_alloc_block_size;
SET @@session.transaction_alloc_block_size = 1024;
SELECT @@session.transaction_alloc_block_size;

SET @@session.transaction_alloc_block_size =4294967295;
SELECT @@session.transaction_alloc_block_size;

SET @@session.transaction_alloc_block_size = 65535;
SELECT @@session.transaction_alloc_block_size;

Expand All @@ -110,7 +104,7 @@ SET @@global.transaction_alloc_block_size = -1024;
SELECT @@global.transaction_alloc_block_size;


SET @@global.transaction_alloc_block_size = 123456789201;
SET @@global.transaction_alloc_block_size = 135217728;
SELECT @@global.transaction_alloc_block_size;

-- Error ER_WRONG_TYPE_FOR_VAR
Expand All @@ -136,7 +130,7 @@ SET @@global.transaction_alloc_block_size ="Test";
SET @@global.transaction_alloc_block_size = 1000;
SELECT @@global.transaction_alloc_block_size;

SET @@session.transaction_alloc_block_size = 12345678901;
SET @@session.transaction_alloc_block_size = 135217728;
SELECT @@session.transaction_alloc_block_size;

-- Error ER_WRONG_TYPE_FOR_VAR
Expand Down Expand Up @@ -185,7 +179,7 @@ WHERE VARIABLE_NAME='transaction_alloc_block_size';
###########################################################################

SET @@transaction_alloc_block_size = 1024;
SET @@global.transaction_alloc_block_size = 4294967295;
SET @@global.transaction_alloc_block_size = 134217728;
SELECT @@transaction_alloc_block_size = @@global.transaction_alloc_block_size;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Access Type: Dynamic #
# Data Type: numeric #
# Default Value: 4096 #
# Range: #
# Range: 1024-134217728 #
# #
# #
# Creation Date: 2008-02-14 #
Expand Down Expand Up @@ -137,6 +137,10 @@ SELECT @@session.transaction_prealloc_size;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@session.transaction_prealloc_size = "Test";

SET @@session.transaction_prealloc_size = 135217728;
SELECT @@session.transaction_prealloc_size;


--echo '#------------------FN_DYNVARS_005_06-----------------------#'
####################################################################
# Check if the value in GLOBAL Table matches value in variable #
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/t/file_contents.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if ($dir_bin eq '/usr/') {
$dir_docs =~ s|/lib|/share/doc|;
if(-d "$dir_docs/packages") {
# SuSE: "packages/" in the documentation path
$dir_docs = glob "$dir_docs/packages/MySQL-server*";
$dir_docs = glob "$dir_docs/packages/*-server*";
} else {
# RedHat: version number in directory name
$dir_docs = glob "$dir_docs/MySQL-server*";
Expand All @@ -27,7 +27,7 @@ if ($dir_bin eq '/usr/') {
$dir_docs = "$dir_bin/share/doc";
if(-d "$dir_docs/packages") {
# SuSE: "packages/" in the documentation path
$dir_docs = glob "$dir_docs/packages/MySQL-server*";
$dir_docs = glob "$dir_docs/packages/*-server*";
} else {
# RedHat/Debian: version number in directory name
$dir_docs = glob "$dir_docs/mariadb-server-*";
Expand Down
Loading

0 comments on commit 0f12ada

Please sign in to comment.