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

This commit is contained in:
Sergei Golubchik 2017-04-11 10:18:04 -04:00
commit 663068c6ee
41 changed files with 379 additions and 151 deletions

View file

@ -1,5 +1,5 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates.
# Copyright (c) 2008, 2014, Monty Program Ab
# Copyright (c) 2006, 2017, Oracle and/or its affiliates.
# Copyright (c) 2008, 2017, 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
@ -239,12 +239,9 @@ IF (WITH_ASAN)
ENDIF()
ENDIF()
OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON)
IF(ENABLE_DEBUG_SYNC)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
ENDIF()
# Always enable debug sync for debug builds.
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF)
IF (ENABLE_GCOV AND NOT WIN32 AND NOT APPLE)

View file

@ -114,4 +114,3 @@ enum options_client
Name of the performance schema database.
*/
#define PERFORMANCE_SCHEMA_DB_NAME "performance_schema"

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB
Copyright (c) 2009, 2017, 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

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2006, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB
Copyright (c) 2010, 2017, 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
@ -1095,4 +1095,3 @@ end:
my_end(my_end_arg);
exit(0);
}

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, Monty Program Ab.
Copyright (c) 2010, 2017, 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

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2011, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB
Copyright (c) 2010, 2017, 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

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB
Copyright (c) 2010, 2017, 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
@ -2049,7 +2049,6 @@ static void print_comment(FILE *sql_file, my_bool is_error, const char *format,
print_xml_comment(sql_file, strlen(comment_buff), comment_buff);
}
/*
create_delimiter
Generate a new (null-terminated) string that does not exist in query
@ -2391,7 +2390,7 @@ static uint dump_routines_for_db(char *db)
query_buff);
print_comment(sql_file, 1,
"-- does %s have permissions on mysql.proc?\n\n",
current_user);
fix_for_comment(current_user));
maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!", current_user, query_buff);
}
else if (strlen(row[2]))

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB
Copyright (c) 2011, 2017, 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

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB
Copyright (c) 2010, 2017, 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

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2005, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB
Copyright (c) 2010, 2017, 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

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, Monty Program Ab.
Copyright (c) 2009, 2017, 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

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2011, 2016, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB
/* Copyright (c) 2011, 2017, Oracle and/or its affiliates.
Copyright (c) 2011, 2017, 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
@ -17,7 +17,7 @@
#ifndef _welcome_copyright_notice_h_
#define _welcome_copyright_notice_h_
#define COPYRIGHT_NOTICE_CURRENT_YEAR "2016"
#define COPYRIGHT_NOTICE_CURRENT_YEAR "2017"
/*
This define specifies copyright notice which is displayed by every MySQL

View file

@ -12,7 +12,6 @@
tablespace : disabled in MariaDB (no TABLESPACE table attribute)
events_time_zone : Test is not predictable as it depends on precise timing.
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836
file_contents : MDEV-6526 these files are not installed anymore
lowercase_fs_on : lower_case_table_names=0 is not an error until 10.1

View file

@ -3188,13 +3188,10 @@ sub mysql_server_start($) {
if (! $opt_start_dirty) # If dirty, keep possibly grown system db
{
# Copy datadir from installed system db
for my $path ( "$opt_vardir", "$opt_vardir/..") {
my $install_db= "$path/install.db";
copytree($install_db, $datadir)
if -d $install_db;
}
mtr_error("Failed to copy system db to '$datadir'")
unless -d $datadir;
my $path= ($opt_parallel == 1) ? "$opt_vardir" : "$opt_vardir/..";
my $install_db= "$path/install.db";
copytree($install_db, $datadir) if -d $install_db;
mtr_error("Failed to copy system db to '$datadir'") unless -d $datadir;
}
}
else

View file

@ -1,10 +1,10 @@
drop database if exists events_test;
create database events_test;
use events_test;
create event e_26 on schedule at '2027-01-01 00:00:00' disable do set @a = 5;
create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion
events_test e_26 set @a = 5 root@localhost 2027-01-01 00:00:00 DROP
events_test e_26 set @a = 5 root@localhost 2037-01-01 00:00:00 DROP
drop event e_26;
create event e_26 on schedule at NULL disable do set @a = 5;
ERROR HY000: Incorrect AT value: 'NULL'

View file

@ -316,7 +316,7 @@ FIELDS ESCAPED BY '\\'
TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n' (c0, c2);
ERROR HY000: Invalid column reference (v2.c0) in LOAD DATA
ERROR HY000: Column 'c0' is not updatable
LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v3
FIELDS ESCAPED BY '\\'

View file

@ -1,29 +1,31 @@
set @@global.log_output = 'TABLE';
set session long_query_time=10;
select get_lock('bug27638', 1);
get_lock('bug27638', 1)
1
set session long_query_time=1;
truncate table mysql.slow_log;
select get_lock('bug27638', 2);
get_lock('bug27638', 2)
0
select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
select if (query_time >= '00:00:01', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
where sql_text = 'select get_lock(\'bug27638\', 2)';
qt sql_text
OK select get_lock('bug27638', 2)
truncate table mysql.slow_log;
select get_lock('bug27638', 60);
get_lock('bug27638', 60)
0
select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
select if (query_time >= '00:00:59', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
where sql_text = 'select get_lock(\'bug27638\', 60)';
qt sql_text
OK select get_lock('bug27638', 60)
truncate table mysql.slow_log;
select get_lock('bug27638', 101);
get_lock('bug27638', 101)
0
select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
select if (query_time >= '00:01:40', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
where sql_text = 'select get_lock(\'bug27638\', 101)';
qt sql_text
OK select get_lock('bug27638', 101)
select release_lock('bug27638');
release_lock('bug27638')
1
set @@global.log_output=default;

View file

@ -5308,6 +5308,69 @@ a
DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db_20772273;
#
# Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
#
CREATE DATABASE bug25717383;
use bug25717383;
CREATE TABLE `tab
one` (a int);
CREATE VIEW `view
one` as SELECT * FROM `tab
one`;
CREATE PROCEDURE `proc
one`() SELECT * from `tab
one`;
CREATE TEMPORARY TABLE `temp
one` (id INT);
CREATE TRIGGER `trig
one` BEFORE INSERT ON `tab
one` FOR EACH ROW SET NEW.a = 1;
CREATE EVENT `event
one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;
SHOW TABLES FROM bug25717383;
Tables_in_bug25717383
tab
one
view
one
SHOW TRIGGERS FROM bug25717383;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trig
one INSERT tab
one SET NEW.a = 1 BEFORE NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci
SHOW EVENTS FROM bug25717383;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
bug25717383 event
one root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL ENABLED 1 utf8 utf8_general_ci latin1_swedish_ci
SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
ORDER BY ROUTINE_NAME;
ROUTINE_NAME
proc
one
SHOW TABLES FROM bug25717383;
Tables_in_bug25717383
tab
one
view
one
SHOW TRIGGERS FROM bug25717383;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trig
one INSERT tab
one SET NEW.a = 1 BEFORE NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci
SHOW EVENTS FROM bug25717383;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
bug25717383 event
one root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL ENABLED 1 utf8 utf8_general_ci latin1_swedish_ci
SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
ORDER BY ROUTINE_NAME;
ROUTINE_NAME
proc
one
DROP DATABASE bug25717383;
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]

View file

@ -213,3 +213,14 @@ t2 CREATE TABLE `t2` (
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop tables t1, t2;
#
# Test for bug #25514146 DB_NAME IS IGNORED WHEN CREATING TABLE
# WITH DATA DIRECTORY
#
# Make sure we have no current database
CREATE DATABASE x;
USE x;
DROP DATABASE x;
CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM
DATA DIRECTORY "MYSQLTEST_VARDIR/tmp";
DROP TABLE test.t1;

View file

@ -13,7 +13,7 @@ use events_test;
# mysql.event intact checking end
#
create event e_26 on schedule at '2027-01-01 00:00:00' disable do set @a = 5;
create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
drop event e_26;
--error ER_WRONG_VALUE

View file

@ -294,7 +294,7 @@ SELECT * FROM v2;
DELETE FROM t1;
--echo
--error ER_LOAD_DATA_INVALID_COLUMN
--error ER_NONUPDATEABLE_COLUMN
LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2
FIELDS ESCAPED BY '\\'
TERMINATED BY ','

View file

@ -7,6 +7,8 @@
# check that CSV engine was compiled in
--source include/have_csv.inc
set @@global.log_output = 'TABLE';
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
@ -18,18 +20,20 @@ set session long_query_time=10;
select get_lock('bug27638', 1);
connection con2;
set session long_query_time=1;
truncate table mysql.slow_log;
select get_lock('bug27638', 2);
select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
truncate table mysql.slow_log;
select if (query_time >= '00:00:01', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
where sql_text = 'select get_lock(\'bug27638\', 2)';
select get_lock('bug27638', 60);
select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
truncate table mysql.slow_log;
select if (query_time >= '00:00:59', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
where sql_text = 'select get_lock(\'bug27638\', 60)';
select get_lock('bug27638', 101);
select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
select if (query_time >= '00:01:40', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
where sql_text = 'select get_lock(\'bug27638\', 101)';
connection con1;
select release_lock('bug27638');
connection default;
disconnect con1;
disconnect con2;
set @@global.log_output=default;

View file

@ -2480,6 +2480,56 @@ DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db_20772273;
--echo #
--echo # Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
--echo #
CREATE DATABASE bug25717383;
use bug25717383;
CREATE TABLE `tab
one` (a int);
CREATE VIEW `view
one` as SELECT * FROM `tab
one`;
CREATE PROCEDURE `proc
one`() SELECT * from `tab
one`;
CREATE TEMPORARY TABLE `temp
one` (id INT);
CREATE TRIGGER `trig
one` BEFORE INSERT ON `tab
one` FOR EACH ROW SET NEW.a = 1;
CREATE EVENT `event
one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;
SHOW TABLES FROM bug25717383;
SHOW TRIGGERS FROM bug25717383;
--replace_column 6 #
SHOW EVENTS FROM bug25717383;
SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
ORDER BY ROUTINE_NAME;
--exec $MYSQL_DUMP --triggers --events --routines --add-drop-database --databases bug25717383 > $MYSQLTEST_VARDIR/tmp/bug25717383.sql
SHOW TABLES FROM bug25717383;
SHOW TRIGGERS FROM bug25717383;
--replace_column 6 #
SHOW EVENTS FROM bug25717383;
SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
ORDER BY ROUTINE_NAME;
DROP DATABASE bug25717383;
#
# MDEV-6091 mysqldump goes in a loop and segfaults if --dump-slave is specified and it cannot connect to the server
#

View file

@ -298,3 +298,19 @@ show create table t1;
create table t2 like t1;
show create table t2;
drop tables t1, t2;
--echo #
--echo # Test for bug #25514146 DB_NAME IS IGNORED WHEN CREATING TABLE
--echo # WITH DATA DIRECTORY
--echo #
--echo # Make sure we have no current database
CREATE DATABASE x;
USE x;
DROP DATABASE x;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM
DATA DIRECTORY "$MYSQLTEST_VARDIR/tmp";
DROP TABLE test.t1;

View file

@ -1,5 +1,5 @@
# Copyright (c) 2005, 2015, Oracle and/or its affiliates.
# Copyright (c) 2008, 2016, MariaDB
# Copyright (c) 2008, 2017, MariaDB
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@ -525,6 +525,15 @@
fun:dl_open_worker
}
{
libc pthread_exit 9
Memcheck:Leak
fun:malloc
fun:_dl_close_worker
fun:_dl_close
fun:_dl_catch_error
}
#
# This is seen internally in the system libraries on 64-bit RHAS3.
#

View file

@ -23,31 +23,37 @@ prog="mysqld"
STARTTIMEOUT=120
STOPTIMEOUT=60
# Set in /etc/sysconfig/mysqld, will be passed to mysqld_safe
MYSQLD_OPTS=
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
lockfile=/var/lock/subsys/$prog
# extract value of a MySQL option from config files
# Usage: get_mysql_option SECTION VARNAME DEFAULT
# result is returned in $result
# Extract value of a MySQL option from config files
# Usage: get_mysql_option OPTION DEFAULT SECTION1 SECTION2 SECTIONN
# Result is returned in $result
# We use my_print_defaults which prints all options from multiple files,
# with the more specific ones later; hence take the last match.
get_mysql_option(){
result=`/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1`
if [ -z "$result" ]; then
# not found, use default
result="$3"
fi
get_mysql_option () {
option=$1
default=$2
shift 2
result=$(/usr/bin/my_print_defaults "$@" | sed -n "s/^--${option}=//p" | tail -n 1)
if [ -z "$result" ]; then
# not found, use default
result="${default}"
fi
}
get_mysql_option mysqld datadir "/var/lib/mysql"
get_mysql_option datadir "/var/lib/mysql" mysqld
datadir="$result"
get_mysql_option mysqld socket "$datadir/mysql.sock"
get_mysql_option socket "$datadir/mysql.sock" mysqld
socketfile="$result"
get_mysql_option mysqld_safe log-error "/var/log/mysqld.log"
get_mysql_option log-error "/var/log/mysqld.log" mysqld mysqld_safe
errlogfile="$result"
get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
get_mysql_option pid-file "/var/run/mysqld/mysqld.pid" mysqld mysqld_safe
mypidfile="$result"
case $socketfile in
@ -100,7 +106,7 @@ start(){
# and some users might prefer to configure logging to syslog.)
# Note: set --basedir to prevent probes that might trigger SELinux
# alarms, per bug #547485
$exec --datadir="$datadir" --socket="$socketfile" \
$exec $MYSQLD_OPTS --datadir="$datadir" --socket="$socketfile" \
--pid-file="$mypidfile" \
--basedir=/usr --user=mysql >/dev/null 2>&1 &
safe_pid=$!

View file

@ -3,7 +3,7 @@
This file was modified by Oracle on 2015-05-18 for 32-bit compatibility.
Modifications copyright (c) 2015, Oracle and/or its affiliates. All rights
Modifications copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights
reserved. */
#include <my_global.h>
@ -551,6 +551,8 @@ int starordinary; /* is a leading * an ordinary character? */
assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
assert(OP(p->strip[p->pend[i]]) == ORPAREN);
(void) dupl(p, p->pbegin[i]+1, p->pend[i]);
if (p->error != 0)
break; /* purecov: inspected */
EMIT(O_BACK, i);
} else
SETERROR(REG_ESUBREG);
@ -1031,6 +1033,8 @@ int to; /* to this number of times (maybe RE_INFINITY) */
AHEAD(THERE()); /* ...so fix it */
ASTERN(O_CH, THERETHERE());
copy = dupl(p, start+1, finish+1);
if (p->error != 0)
return; /* purecov: inspected */
assert(copy == finish+4);
repeat(p, copy, 1, to-1);
break;
@ -1040,10 +1044,14 @@ int to; /* to this number of times (maybe RE_INFINITY) */
break;
case REP(N, N): /* as xx{m-1,n-1} */
copy = dupl(p, start, finish);
if (p->error != 0)
return;
repeat(p, copy, from-1, to-1);
break;
case REP(N, INF): /* as xx{n-1,INF} */
copy = dupl(p, start, finish);
if (p->error != 0)
return; /* purecov: inspected */
repeat(p, copy, from-1, to);
break;
default: /* "can't happen" */
@ -1366,6 +1374,9 @@ sopno finish; /* to this less one */
if (len == 0)
return(ret);
enlarge(p, p->ssize + len); /* this many unexpected additions */
if (p->error != 0)
return(p->error);
assert(p->ssize >= p->slen + len);
(void) memcpy((char *)(p->strip + p->slen),
(char *)(p->strip + start), (size_t)len*sizeof(sop));
@ -1438,7 +1449,7 @@ sopno pos;
}
}
{
int length=(HERE()-pos-1)*sizeof(sop);
size_t length=(HERE()-pos-1)*sizeof(sop);
bmove_upp((uchar *) &p->strip[pos+1]+length,
(uchar *) &p->strip[pos]+length,
length);
@ -1482,6 +1493,15 @@ register sopno size;
if (p->ssize >= size)
return;
DBUG_EXECUTE_IF("bug24449090_simulate_oom",
{
free(p->strip);
p->strip= NULL;
p->ssize= 0;
SETERROR(REG_ESPACE);
return;
});
sp = (sop *)realloc(p->strip, size*sizeof(sop));
if (sp == NULL) {
SETERROR(REG_ESPACE);

View file

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2002, 2012, Oracle and/or its affiliates.
# Copyright (c) 2002, 2016, 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
@ -196,6 +196,20 @@ set_echo_compat() {
esac
}
validate_reply () {
ret=0
if [ -z "$1" ]; then
reply=y
return $ret
fi
case $1 in
y|Y|yes|Yes|YES) reply=y ;;
n|N|no|No|NO) reply=n ;;
*) ret=1 ;;
esac
return $ret
}
prepare() {
touch $config $command
chmod 600 $config $command
@ -400,15 +414,18 @@ echo "Setting the root password ensures that nobody can log into the MariaDB"
echo "root user without the proper authorisation."
echo
if [ $hadpass -eq 0 ]; then
echo $echo_n "Set root password? [Y/n] $echo_c"
else
echo "You already have a root password set, so you can safely answer 'n'."
echo
echo $echo_n "Change the root password? [Y/n] $echo_c"
fi
while true ; do
if [ $hadpass -eq 0 ]; then
echo $echo_n "Set root password? [Y/n] $echo_c"
else
echo "You already have a root password set, so you can safely answer 'n'."
echo
echo $echo_n "Change the root password? [Y/n] $echo_c"
fi
read reply
validate_reply $reply && break
done
read reply
if [ "$reply" = "n" ]; then
echo " ... skipping."
else
@ -432,9 +449,11 @@ echo "go a bit smoother. You should remove them before moving into a"
echo "production environment."
echo
echo $echo_n "Remove anonymous users? [Y/n] $echo_c"
read reply
while true ; do
echo $echo_n "Remove anonymous users? [Y/n] $echo_c"
read reply
validate_reply $reply && break
done
if [ "$reply" = "n" ]; then
echo " ... skipping."
else
@ -450,9 +469,11 @@ echo
echo "Normally, root should only be allowed to connect from 'localhost'. This"
echo "ensures that someone cannot guess at the root password from the network."
echo
echo $echo_n "Disallow root login remotely? [Y/n] $echo_c"
read reply
while true ; do
echo $echo_n "Disallow root login remotely? [Y/n] $echo_c"
read reply
validate_reply $reply && break
done
if [ "$reply" = "n" ]; then
echo " ... skipping."
else
@ -470,8 +491,12 @@ echo "access. This is also intended only for testing, and should be removed"
echo "before moving into a production environment."
echo
echo $echo_n "Remove test database and access to it? [Y/n] $echo_c"
read reply
while true ; do
echo $echo_n "Remove test database and access to it? [Y/n] $echo_c"
read reply
validate_reply $reply && break
done
if [ "$reply" = "n" ]; then
echo " ... skipping."
else
@ -488,8 +513,12 @@ echo "Reloading the privilege tables will ensure that all changes made so far"
echo "will take effect immediately."
echo
echo $echo_n "Reload privilege tables now? [Y/n] $echo_c"
read reply
while true ; do
echo $echo_n "Reload privilege tables now? [Y/n] $echo_c"
read reply
validate_reply $reply && break
done
if [ "$reply" = "n" ]; then
echo " ... skipping."
else

View file

@ -950,4 +950,3 @@ do
done
log_notice "mysqld from pid file $pid_file ended"

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, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, 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
@ -3449,6 +3449,7 @@ String *Item_func_quote::val_str(String *str)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
ulong max_allowed_packet= current_thd->variables.max_allowed_packet;
char *from, *to, *end, *start;
String *arg= args[0]->val_str(str);
uint arg_length, new_length;
@ -3467,11 +3468,14 @@ String *Item_func_quote::val_str(String *str)
new_length= arg_length + 2; /* for beginning and ending ' signs */
for (from= (char*) arg->ptr(), end= from + arg_length; from < end; from++)
new_length+= get_esc_bit(escmask, (uchar) *from);
if (new_length > max_allowed_packet)
goto toolong;
}
else
{
new_length= (arg_length * 2) + /* For string characters */
(2 * collation.collation->mbmaxlen); /* For quotes */
set_if_smaller(new_length, max_allowed_packet);
}
if (tmp_value.alloc(new_length))
@ -3487,7 +3491,7 @@ String *Item_func_quote::val_str(String *str)
/* Put leading quote */
if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0)
goto null;
goto toolong;
to+= mblen;
for (start= (char*) arg->ptr(), end= start + arg_length; start < end; )
@ -3507,17 +3511,17 @@ String *Item_func_quote::val_str(String *str)
if (escape)
{
if ((mblen= cs->cset->wc_mb(cs, '\\', (uchar*) to, to_end)) <= 0)
goto null;
goto toolong;
to+= mblen;
}
if ((mblen= cs->cset->wc_mb(cs, wc, (uchar*) to, to_end)) <= 0)
goto null;
goto toolong;
to+= mblen;
}
/* Put trailing quote */
if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0)
goto null;
goto toolong;
to+= mblen;
new_length= to - tmp_value.ptr();
goto ret;
@ -3561,6 +3565,11 @@ ret:
null_value= 0;
return &tmp_value;
toolong:
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED,
ER_THD(current_thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
func_name(), max_allowed_packet);
null:
null_value= 1;
return 0;

View file

@ -1,4 +1,5 @@
/* Copyright (c) 2005, 2013, Oracle and/or its affiliates.
/* Copyright (c) 2005, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, 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
@ -2706,9 +2707,9 @@ int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len)
node.parent= data->parent; // Set parent for the new node to old parent
data->parent= numnodes; // Remember current node as new parent
DBUG_ASSERT(data->level <= MAX_LEVEL);
DBUG_ASSERT(data->level < MAX_LEVEL);
data->pos[data->level]= numnodes;
if (data->level < MAX_LEVEL)
if (data->level < MAX_LEVEL - 1)
node.level= data->level++;
else
return MY_XML_ERROR;

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2002, 2015, Oracle and/or its affiliates.
Copyright (c) 2009, 2015, MariaDB
Copyright (c) 2002, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, 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
@ -375,7 +375,7 @@ void Proc_table_intact::report_error(uint code, const char *fmt, ...)
my_vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
if (code)
if (code == ER_COL_COUNT_DOESNT_MATCH_CORRUPTED)
my_message(code, buf, MYF(0));
else
my_error(ER_CANNOT_LOAD_FROM_TABLE, MYF(0), "proc");

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2016, MariaDB
Copyright (c) 2008, 2017, 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

View file

@ -65,6 +65,7 @@
#define RAND_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-1))
#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
RAND_TABLE_BIT)
#define CONNECT_STRING_MAXLEN 65535 /* stored in 2 bytes in .frm */
#define MAX_FIELDS 4096 /* Limit in the .frm file */
#define MAX_PARTITIONS 1024

View file

@ -979,7 +979,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
{
uint length;
uchar *pos;
Item *real_item;
Item_field *real_item;
if (read_info.read_field())
break;
@ -991,16 +991,26 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
pos=read_info.row_start;
length=(uint) (read_info.row_end-pos);
real_item= item->real_item();
real_item= item->filed_for_view_update();
if ((!read_info.enclosed &&
(enclosed_length && length == 4 &&
!memcmp(pos, STRING_WITH_LEN("NULL")))) ||
(length == 1 && read_info.found_null))
{
if (real_item->type() == Item::FIELD_ITEM)
if (item->type() == Item::STRING_ITEM)
{
Field *field= ((Item_field *)real_item)->field;
((Item_user_var_as_out_param *)item)->set_null_value(
read_info.read_charset);
}
else if (!real_item)
{
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), item->name);
DBUG_RETURN(1);
}
else
{
Field *field= real_item->field;
if (field->reset())
{
my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0), field->field_name,
@ -1017,39 +1027,29 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
ER_WARN_NULL_TO_NOTNULL, 1);
}
}
else if (item->type() == Item::STRING_ITEM)
{
((Item_user_var_as_out_param *)item)->set_null_value(
read_info.read_charset);
}
else
{
my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), item->full_name());
DBUG_RETURN(1);
}
continue;
}
if (real_item->type() == Item::FIELD_ITEM)
if (item->type() == Item::STRING_ITEM)
{
Field *field= ((Item_field *)real_item)->field;
((Item_user_var_as_out_param *)item)->set_value((char*) pos, length,
read_info.read_charset);
}
else if (!real_item)
{
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), item->name);
DBUG_RETURN(1);
}
else
{
Field *field= real_item->field;
field->set_notnull();
read_info.row_end[0]=0; // Safe to change end marker
if (field == table->next_number_field)
table->auto_increment_field_not_null= TRUE;
field->store((char*) pos, length, read_info.read_charset);
}
else if (item->type() == Item::STRING_ITEM)
{
((Item_user_var_as_out_param *)item)->set_value((char*) pos, length,
read_info.read_charset);
}
else
{
my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), item->full_name());
DBUG_RETURN(1);
}
}
if (thd->is_error())
@ -1069,10 +1069,20 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
break;
for (; item ; item= it++)
{
Item *real_item= item->real_item();
if (real_item->type() == Item::FIELD_ITEM)
Item_field *real_item= item->filed_for_view_update();
if (item->type() == Item::STRING_ITEM)
{
Field *field= ((Item_field *)real_item)->field;
((Item_user_var_as_out_param *)item)->set_null_value(
read_info.read_charset);
}
else if (!real_item)
{
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), item->name);
DBUG_RETURN(1);
}
else
{
Field *field= real_item->field;
if (field->reset())
{
my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0),field->field_name,
@ -1093,16 +1103,6 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
ER(ER_WARN_TOO_FEW_RECORDS),
thd->warning_info->current_row_for_warning());
}
else if (item->type() == Item::STRING_ITEM)
{
((Item_user_var_as_out_param *)item)->set_null_value(
read_info.read_charset);
}
else
{
my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), item->full_name());
DBUG_RETURN(1);
}
}
}

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2017, 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

View file

@ -2904,6 +2904,21 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
uint total_uneven_bit_length= 0;
DBUG_ENTER("mysql_prepare_create_table");
LEX_STRING* connect_string = &create_info->connect_string;
if (connect_string->length != 0 &&
connect_string->length > CONNECT_STRING_MAXLEN &&
(system_charset_info->cset->charpos(system_charset_info,
connect_string->str,
(connect_string->str +
connect_string->length),
CONNECT_STRING_MAXLEN)
< connect_string->length))
{
my_error(ER_WRONG_STRING_LENGTH, MYF(0),
connect_string->str, "CONNECTION", CONNECT_STRING_MAXLEN);
DBUG_RETURN(TRUE);
}
select_field_pos= alter_info->create_list.elements - select_field_count;
null_fields=blob_columns=0;
create_info->varchar= 0;

View file

@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
@ -2787,6 +2787,7 @@ srv_master_thread(
ulint i;
ib_time_t last_print_time;
my_thread_init();
#ifdef UNIV_DEBUG_THREAD_CREATION
fprintf(stderr, "Master thread starts, id %lu\n",
os_thread_pf(os_thread_get_curr_id()));
@ -3242,6 +3243,7 @@ suspend_thread:
os_event_wait(slot->event);
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
my_thread_end();
os_thread_exit(NULL);
}
@ -3265,6 +3267,7 @@ srv_purge_thread(
ulint retries = 0;
ulint n_total_purged = ULINT_UNDEFINED;
my_thread_init();
ut_a(srv_n_purge_threads == 1);
#ifdef UNIV_PFS_THREAD
@ -3349,6 +3352,8 @@ srv_purge_thread(
os_thread_pf(os_thread_get_curr_id()));
#endif /* UNIV_DEBUG_THREAD_CREATION */
my_thread_end();
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
os_thread_exit(NULL);

View file

@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
Copyright (c) 2017, 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 the Free Software
@ -610,12 +611,15 @@ trx_rollback_or_clean_all_recovered(
/*!< in: a dummy parameter required by
os_thread_create */
{
my_thread_init();
#ifdef UNIV_PFS_THREAD
pfs_register_thread(trx_rollback_clean_thread_key);
#endif /* UNIV_PFS_THREAD */
trx_rollback_or_clean_recovered(TRUE);
my_thread_end();
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */

View file

@ -1,5 +1,5 @@
# Copyright (c) 2006, 2014, Oracle and/or its affiliates.
# Copyright (c) 2012, 2014, SkySQL Ab.
# Copyright (c) 2006, 2016, Oracle and/or its affiliates.
# Copyright (c) 2012, 2017, 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

View file

@ -157,8 +157,7 @@ parse_server_arguments() {
# Get arguments from the my.cnf file,
# the only group, which is read from now on is [mysqld]
if test -x $bindir/my_print_defaults
then
if test -x "$bindir/my_print_defaults"; then
print_defaults="$bindir/my_print_defaults"
else
# Try to find basedir in /etc/my.cnf
@ -176,11 +175,6 @@ else
print_defaults="$d/bin/my_print_defaults"
break
fi
if test -x "$d/bin/mysql_print_defaults"
then
print_defaults="$d/bin/mysql_print_defaults"
break
fi
done
fi
@ -381,7 +375,7 @@ case "$mode" in
fi
else
# Try to find appropriate mysqld process
mysqld_pid=`pidof $libexecdir/mysqld`
mysqld_pid=`pgrep $libexecdir/mysqld`
# test if multiple pids exist
pid_count=`echo $mysqld_pid | wc -w`