Merge remote-tracking branch 'mysql/5.5' into 5.5

This commit is contained in:
Sergei Golubchik 2015-04-27 21:04:06 +02:00
commit 0f12ada6b6
28 changed files with 496 additions and 90 deletions

View File

@ -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
@ -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})

View File

@ -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
#

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -0,0 +1 @@
--character-set-server=utf16

View File

@ -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

View File

@ -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'
@ -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;
@ -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;
@ -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

View File

@ -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
@ -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:

View File

@ -5,7 +5,7 @@
# Access Type: Dynamic #
# Data Type: numeric #
# Default Value: 8192 #
# Range: 1024-4294967295 #
# Range: 1024-134217728 #
# #
# #
# Creation Date: 2008-02-14 #
@ -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 #
@ -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;
@ -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
@ -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
@ -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;

View File

@ -5,7 +5,7 @@
# Access Type: Dynamic #
# Data Type: numeric #
# Default Value: 4096 #
# Range: #
# Range: 1024-134217728 #
# #
# #
# Creation Date: 2008-02-14 #
@ -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 #

View File

@ -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*";
@ -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-*";

View File

@ -43,3 +43,120 @@ CALL p1();
drop procedure p1;
drop table t1,t2;
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo
--echo #
--echo # BUG 16041903: CONTINUE HANDLER NOT INVOKED
--echo # IN A STORED FUNCTION AFTER A LOCK WAIT TIMEOUT
--echo #
--echo
--echo # 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;
--echo
--echo # Create a function with exit handler:
DELIMITER //;
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//
--echo
--echo # Create a function calling f1():
CREATE FUNCTION f2() RETURNS VARCHAR(20)
BEGIN
RETURN f1();
END//
--echo
--echo # 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//
--echo
--echo # Create a function calling f3, to create
--echo # a deadlock indirectly:
CREATE FUNCTION f4() RETURNS VARCHAR(20)
BEGIN
RETURN f3();
END//
DELIMITER ;//
--echo
--echo # Open another connection, create and initialize a table
--echo # to be used for provoking deadlock, put a lock on the table:
connect (con1,localhost,root,,);
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET AUTOCOMMIT= 0;
UPDATE t1 SET i=1 WHERE i=1;
--echo
--echo # On the default connection, do an update to provoke a
--echo # deadlock, then call the function with handler. This case
--echo # fails without the patch (with error ER_NO_SUCH_TABLE):
--connection default
SET AUTOCOMMIT= 0;
--error ER_LOCK_WAIT_TIMEOUT
UPDATE t1 SET i=1 WHERE i=1;
SELECT f1() AS 'f1():';
--echo
--echo # Provoke another deadlock, then call the function with
--echo # handler indirectly. This case fails without the patch
--echo # (with error ER_NO_SUCH_TABLE):
--error ER_LOCK_WAIT_TIMEOUT
UPDATE t1 SET i= 1 WHERE i= 1;
SELECT f2() AS 'f2():';
--echo
--echo # Provoke yet another deadlock, but now from within a function,
--echo # then call the function with handler. This succeeds even
--echo # without the patch because is_fatal_sub_stmt_error is reset
--echo # in restore_sub_stmt after the failing function has been
--echo # executed. The test case is included anyway for better coverage:
--error ER_LOCK_WAIT_TIMEOUT
SELECT f3() AS 'f3():';
SELECT f1() AS 'f1():';
--echo # Provoke yet another deadlock, but now from within a function,
--echo # calling another function, then call the function with handler.
--echo # This succeeds even without the patch because
--echo # is_fatal_sub_stmt_error is reset in restore_sub_stmt after
--echo # the failing function has been executed. The test case is
--echo # included anyway for better coverage:
--error ER_LOCK_WAIT_TIMEOUT
SELECT f4() AS 'f4():';
SELECT f1() AS 'f1():';
--echo
--echo # Disconnect, drop functions and table:
--disconnect con1
DROP FUNCTION f4;
DROP FUNCTION f3;
DROP FUNCTION f2;
DROP FUNCTION f1;
DROP TABLE t1;
--echo
--echo # Reset lock wait timeouts
SET @@lock_wait_timeout= @lock_wait_timeout_saved;
SET @@innodb_lock_wait_timeout= @innodb_lock_wait_timeout_saved;
--echo #
--echo # BUG 16041903: End of test case
--echo #
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -2,6 +2,9 @@
# (or just InnoDB storage engine)
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
@ -182,3 +185,54 @@ insert into t1 values ( 654, 'a'), ( 654, 'b'), ( 654, 'c'),
select * from t2 order by b;
drop trigger t1_after_insert;
drop table t1,t2;
--echo #
--echo #Bug#19683834 SOME INNODB ERRORS CAUSES STORED FUNCTION
--echo # AND TRIGGER HANDLERS TO BE IGNORED
--echo #Code fixed in Bug#16041903
--enable_connect_log
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;
# Trigger with continue handler for ER_DUP_ENTRY(1062)
DELIMITER //;
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//
DELIMITER ;//
# Transaction 1: Grab locks on t1
START TRANSACTION;
UPDATE t1 SET val = val + 1;
# Transaction 2:
--connect (con2,localhost,root,,test,,)
SET SESSION innodb_lock_wait_timeout = 2;
# Trigger lock timeout (1205)
--error ER_LOCK_WAIT_TIMEOUT
UPDATE t1 SET val = val + 1;
# This insert should go through, as the continue handler should
# handle ER_DUP_ENTRY, even after ER_LOCK_WAIT_TIMEOUT (Bug#16041903)
INSERT INTO t2 (id) VALUES (1);
# Cleanup
disconnect con2;
--source include/wait_until_disconnected.inc
connection default;
DROP TABLE t3, t2, t1;
--disable_connect_log
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -528,7 +528,7 @@ if [ -n "${PLUGIN_DIR}" ]; then
plugin_dir="${PLUGIN_DIR}"
else
# Try to find plugin dir relative to basedir
for dir in lib/mysql/plugin lib/plugin
for dir in lib64/mysql/plugin lib64/plugin lib/mysql/plugin lib/plugin
do
if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then
plugin_dir="${MY_BASEDIR_VERSION}/${dir}"

View File

@ -1,8 +1,8 @@
#ifndef SQL_ITEM_INCLUDED
#define SQL_ITEM_INCLUDED
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2013 Monty Program Ab.
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2009, 2015 Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -4103,7 +4103,11 @@ public:
collation.set(item->collation);
unsigned_flag= item->unsigned_flag;
if (item->type() == FIELD_ITEM)
{
cached_field= ((Item_field *)item)->field;
if (cached_field->table)
used_table_map= cached_field->table->map;
}
return 0;
};
enum Type type() const { return CACHE_ITEM; }

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2008, 2014, SkySQL Ab.
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, SkySQL Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -3607,6 +3607,9 @@ static int init_common_variables()
return 1;
set_server_version();
sql_print_information("%s (mysqld %s) starting as process %lu ...",
my_progname, server_version, (ulong) getpid());
#ifndef EMBEDDED_LIBRARY
if (opt_abort && !opt_verbose)
unireg_abort(0);

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2008, 2014, SkySQL Ab.
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, SkySQL Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -4717,7 +4717,23 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
}
#endif
/*
If server's default charset is not supported (like utf16, utf32) as client
charset, then set client charset to 'latin1' (default client charset).
*/
if (is_supported_parser_charset(default_charset_info))
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname);
else
{
sql_print_information("'%s' can not be used as client character set. "
"'%s' will be used as default client character set "
"while connecting to master.",
default_charset_info->csname,
default_client_charset_info->csname);
mysql_options(mysql, MYSQL_SET_CHARSET_NAME,
default_client_charset_info->csname);
}
/* This one is not strictly needed but we have it here for completeness */
mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir);

View File

@ -1,5 +1,6 @@
/*
Copyright (c) 2002, 2011, Oracle and/or its affiliates.
Copyright (c) 2002, 2015, Oracle and/or its affiliates.
Copyright (c) 2009, 2015, MariaDB
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
@ -1494,6 +1495,14 @@ bool lock_db_routines(THD *thd, char *db)
{
char *sp_name= get_field(thd->mem_root,
table->field[MYSQL_PROC_FIELD_NAME]);
if (sp_name == NULL)
{
table->file->ha_index_end();
my_error(ER_SP_WRONG_NAME, MYF(0), "");
close_system_tables(thd, &open_tables_state_backup);
DBUG_RETURN(true);
}
longlong sp_type= table->field[MYSQL_PROC_MYSQL_TYPE]->val_int();
MDL_request *mdl_request= new (thd->mem_root) MDL_request;
mdl_request->init(sp_type == TYPE_ENUM_FUNCTION ?

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2013 Monty Program Ab
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
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
@ -4106,7 +4106,7 @@ request_backoff_action(enum_open_table_action action_arg,
if (action_arg != OT_REOPEN_TABLES && m_has_locks)
{
my_error(ER_LOCK_DEADLOCK, MYF(0));
mark_transaction_to_rollback(m_thd, true);
m_thd->mark_transaction_to_rollback(true);
return TRUE;
}
/*

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2008, 2014, SkySQL Ab.
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB
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
@ -815,7 +815,7 @@ THD::THD()
failed_com_change_user(0),
is_fatal_error(0),
transaction_rollback_request(0),
is_fatal_sub_stmt_error(0),
is_fatal_sub_stmt_error(false),
rand_used(0),
time_zone_used(0),
in_lock_tables(0),
@ -4045,7 +4045,8 @@ extern "C" int thd_binlog_format(const MYSQL_THD thd)
extern "C" void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all)
{
mark_transaction_to_rollback(thd, all);
DBUG_ASSERT(thd);
thd->mark_transaction_to_rollback(all);
}
extern "C" bool thd_binlog_filter_ok(const MYSQL_THD thd)
@ -4241,9 +4242,12 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
If we've left sub-statement mode, reset the fatal error flag.
Otherwise keep the current value, to propagate it up the sub-statement
stack.
NOTE: is_fatal_sub_stmt_error can be set only if we've been in the
sub-statement mode.
*/
if (!in_sub_stmt)
is_fatal_sub_stmt_error= FALSE;
is_fatal_sub_stmt_error= false;
if ((variables.option_bits & OPTION_BIN_LOG) && is_update_query(lex->sql_command) &&
!is_current_stmt_binlog_format_row())
@ -4353,17 +4357,18 @@ void THD::get_definer(LEX_USER *definer)
/**
Mark transaction to rollback and mark error as fatal to a sub-statement.
@param thd Thread handle
@param all TRUE <=> rollback main transaction.
*/
void mark_transaction_to_rollback(THD *thd, bool all)
void THD::mark_transaction_to_rollback(bool all)
{
if (thd)
{
thd->is_fatal_sub_stmt_error= TRUE;
thd->transaction_rollback_request= all;
}
/*
There is no point in setting is_fatal_sub_stmt_error unless
we are actually in_sub_stmt.
*/
if (in_sub_stmt)
is_fatal_sub_stmt_error= true;
transaction_rollback_request= all;
}
/***************************************************************************
Handling of XA id cacheing

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2009, 2014, MariaDB
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
@ -700,8 +700,6 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
STATUS_VAR *dec_var);
void mark_transaction_to_rollback(THD *thd, bool all);
#ifdef MYSQL_SERVER
void free_tmp_table(THD *thd, TABLE *entry);
@ -3121,6 +3119,7 @@ public:
mysql_mutex_unlock(&LOCK_status);
}
void mark_transaction_to_rollback(bool all);
private:
/** The current internal error handler for this thread, or NULL. */
@ -4163,8 +4162,6 @@ public:
*/
#define CF_SKIP_QUESTIONS (1U << 1)
void mark_transaction_to_rollback(THD *thd, bool all);
/* Inline functions */
inline bool add_item_to_list(THD *thd, Item *item)

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2014 Oracle and/or its affiliates.
/* Copyright (c) 2000, 2015 Oracle and/or its affiliates.
Copyright (c) 2009, 2015 MariaDB
This program is free software; you can redistribute it and/or modify
@ -20309,18 +20309,33 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length,
for (;order;order=order->next,pos++)
{
Item *item= order->item[0]->real_item();
Item *const item= order->item[0], *const real_item= item->real_item();
pos->field= 0; pos->item= 0;
if (item->type() == Item::FIELD_ITEM)
pos->field= ((Item_field*) item)->field;
else if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item())
pos->field= ((Item_sum*) item)->get_tmp_table_field();
else if (item->type() == Item::COPY_STR_ITEM)
if (real_item->type() == Item::FIELD_ITEM)
{
// Could be a field, or Item_direct_view_ref wrapping a field
DBUG_ASSERT(item->type() == Item::FIELD_ITEM ||
(item->type() == Item::REF_ITEM &&
static_cast<Item_ref*>(item)->ref_type() ==
Item_ref::VIEW_REF));
pos->field= static_cast<Item_field*>(real_item)->field;
}
else if (real_item->type() == Item::SUM_FUNC_ITEM &&
!real_item->const_item())
{
// Aggregate, or Item_aggregate_ref
DBUG_ASSERT(item->type() == Item::SUM_FUNC_ITEM ||
(item->type() == Item::REF_ITEM &&
static_cast<Item_ref*>(item)->ref_type() ==
Item_ref::AGGREGATE_REF));
pos->field= item->get_tmp_table_field();
}
else if (real_item->type() == Item::COPY_STR_ITEM)
{ // Blob patch
pos->item= ((Item_copy*) item)->get_item();
pos->item= static_cast<Item_copy*>(real_item)->get_item();
}
else
pos->item= *order->item;
pos->item= item;
pos->reverse=! order->asc;
}
*length=count;
@ -20562,6 +20577,17 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
uint el= all_fields.elements;
all_fields.push_front(order_item); /* Add new field to field list. */
ref_pointer_array[el]= order_item;
/*
If the order_item is a SUM_FUNC_ITEM, when fix_fields is called
ref_by is set to order->item which is the address of order_item.
But this needs to be address of order_item in the all_fields list.
As a result, when it gets replaced with Item_aggregate_ref
object in Item::split_sum_func2, we will be able to retrieve the
newly created object.
*/
if (order_item->type() == Item::SUM_FUNC_ITEM)
((Item_sum *)order_item)->ref_by= all_fields.head_ref();
order->item= ref_pointer_array + el;
return FALSE;
}

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2014, SkySQL Ab.
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
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
@ -5580,6 +5580,10 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (!(used_fields & HA_CREATE_USED_TRANSACTIONAL))
create_info->transactional= table->s->transactional;
/* Creation of federated table with LIKE clause needs connection string */
if (!(used_fields & HA_CREATE_USED_CONNECTION))
create_info->connect_string= table->s->connect_string;
restore_record(table, s->default_values); // Empty record for DEFAULT
create_info->option_list= merge_engine_table_options(table->s->option_list,

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2010, 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
@ -288,6 +288,12 @@ static bool recreate_temporary_table(THD *thd, TABLE *table)
table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
/*
If LOCK TABLES list is not empty and contains this table
then unlock the table and remove it from this list.
*/
mysql_lock_remove(thd, thd->lock, table);
/* Don't free share. */
close_temporary_table(thd, table, FALSE, FALSE);

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2010, 2014, Monty Program Ab.
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
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
@ -14597,6 +14597,13 @@ subselect_end:
*/
lex->current_select->select_n_where_fields+=
child->select_n_where_fields;
/*
Aggregate functions in having clause may add fields to an outer
select. Count them also.
*/
lex->current_select->select_n_having_items+=
child->select_n_having_items;
}
;

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2014, Oracle and/or its affiliates.
Copyright (c) 2012, 2014, SkySQL Ab.
/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
Copyright (c) 2012, 2015, MariaDB
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
@ -1808,7 +1808,7 @@ static Sys_var_ulong Sys_trans_alloc_block_size(
"transaction_alloc_block_size",
"Allocation block size for transactions to be stored in binary log",
SESSION_VAR(trans_alloc_block_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, UINT_MAX), DEFAULT(QUERY_ALLOC_BLOCK_SIZE),
VALID_RANGE(1024, 128 * 1024 * 1024), DEFAULT(QUERY_ALLOC_BLOCK_SIZE),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_trans_mem_root));
@ -1816,7 +1816,7 @@ static Sys_var_ulong Sys_trans_prealloc_size(
"transaction_prealloc_size",
"Persistent buffer for transactions to be stored in binary log",
SESSION_VAR(trans_prealloc_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, UINT_MAX), DEFAULT(TRANS_ALLOC_PREALLOC_SIZE),
VALID_RANGE(1024, 128 * 1024 * 1024), DEFAULT(TRANS_ALLOC_PREALLOC_SIZE),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_trans_mem_root));

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2004, 2014, Oracle and/or its affiliates.
/* Copyright (c) 2004, 2015, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -2904,7 +2904,7 @@ int ha_federated::info(uint flag)
}
if (flag & HA_STATUS_AUTO)
if ((flag & HA_STATUS_AUTO) && mysql)
stats.auto_increment_value= mysql->insert_id;
mysql_free_result(result);