Commit dfc77d19 authored by Otto Kekäläinen's avatar Otto Kekäläinen

Imported Upstream version 10.0.21

parent bbbf51f8
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*.dat -text -whitespace *.dat -text -whitespace
storage/connect/mysql-test/connect/std_data/*.txt -text storage/connect/mysql-test/connect/std_data/*.txt -text
pcre/testdata/greppatN4 -text
# Denote all files that are truly binary and should not be modified. # Denote all files that are truly binary and should not be modified.
*.png binary *.png binary
......
...@@ -277,6 +277,10 @@ storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result ...@@ -277,6 +277,10 @@ storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
*.vcproj.* *.vcproj.*
*.vcproj.*.* *.vcproj.*.*
*.vcproj.*.*.* *.vcproj.*.*.*
*.vcxproj
*.vcxproj.*
*.vcxproj.*.*
*.vcxproj.*.*.*
# Build results # Build results
[Dd]ebug/ [Dd]ebug/
......
...@@ -424,7 +424,6 @@ IF(NOT WITHOUT_SERVER) ...@@ -424,7 +424,6 @@ IF(NOT WITHOUT_SERVER)
IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt) IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt)
ADD_SUBDIRECTORY(internal) ADD_SUBDIRECTORY(internal)
ENDIF() ENDIF()
ADD_SUBDIRECTORY(packaging/rpm-oel)
ENDIF() ENDIF()
IF(UNIX) IF(UNIX)
...@@ -438,7 +437,6 @@ IF(WIN32) ...@@ -438,7 +437,6 @@ IF(WIN32)
ADD_SUBDIRECTORY(win/upgrade_wizard) ADD_SUBDIRECTORY(win/upgrade_wizard)
ADD_SUBDIRECTORY(win/packaging) ADD_SUBDIRECTORY(win/packaging)
ENDIF() ENDIF()
ADD_SUBDIRECTORY(packaging/solaris)
IF(NOT CMAKE_CROSSCOMPILING) IF(NOT CMAKE_CROSSCOMPILING)
SET(EXPORTED comp_err comp_sql factorial) SET(EXPORTED comp_err comp_sql factorial)
......
commit: a6087e7dc1ef3561d8189c8db15e9591d0f9b520 commit: 0403790722e3941779ccea26e85fcd818e2320b5
date: 2015-06-17 16:13:02 +0200 date: 2015-08-05 20:07:46 +0200
build-date: 2015-06-17 16:54:14 +0200 build-date: 2015-08-05 20:11:37 +0200
short: a6087e7 short: 0403790
branch: HEAD branch: HEAD
MySQL source 10.0.20 MySQL source 10.0.21
MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=0 MYSQL_VERSION_MINOR=0
MYSQL_VERSION_PATCH=20 MYSQL_VERSION_PATCH=21
...@@ -1095,7 +1095,7 @@ int main(int argc, char **argv) ...@@ -1095,7 +1095,7 @@ int main(int argc, char **argv)
printf("This installation of MySQL is already upgraded to %s, " printf("This installation of MySQL is already upgraded to %s, "
"use --force if you still need to run mysql_upgrade\n", "use --force if you still need to run mysql_upgrade\n",
MYSQL_SERVER_VERSION); MYSQL_SERVER_VERSION);
die(NULL); goto end;
} }
if (opt_version_check && check_version_match()) if (opt_version_check && check_version_match())
...@@ -1124,6 +1124,7 @@ int main(int argc, char **argv) ...@@ -1124,6 +1124,7 @@ int main(int argc, char **argv)
DBUG_ASSERT(phase == phases_total); DBUG_ASSERT(phase == phases_total);
end:
free_used_memory(); free_used_memory();
my_end(my_end_arg); my_end(my_end_arg);
exit(0); exit(0);
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
/* Global Thread counter */ /* Global Thread counter */
uint counter; uint counter= 0;
pthread_mutex_t counter_mutex; pthread_mutex_t counter_mutex;
pthread_cond_t count_threshhold; pthread_cond_t count_threshhold;
...@@ -489,6 +489,11 @@ static void safe_exit(int error, MYSQL *mysql) ...@@ -489,6 +489,11 @@ static void safe_exit(int error, MYSQL *mysql)
{ {
if (error && ignore_errors) if (error && ignore_errors)
return; return;
/* in multi-threaded mode protect from concurrent safe_exit's */
if (counter)
pthread_mutex_lock(&counter_mutex);
if (mysql) if (mysql)
mysql_close(mysql); mysql_close(mysql);
......
/* /*
Copyright (c) 2005, 2012, Oracle and/or its affiliates. Copyright (c) 2005, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -242,7 +243,7 @@ void print_conclusions_csv(conclusions *con); ...@@ -242,7 +243,7 @@ void print_conclusions_csv(conclusions *con);
void generate_stats(conclusions *con, option_string *eng, stats *sptr); void generate_stats(conclusions *con, option_string *eng, stats *sptr);
uint parse_comma(const char *string, uint **range); uint parse_comma(const char *string, uint **range);
uint parse_delimiter(const char *script, statement **stmt, char delm); uint parse_delimiter(const char *script, statement **stmt, char delm);
uint parse_option(const char *origin, option_string **stmt, char delm); int parse_option(const char *origin, option_string **stmt, char delm);
static int drop_schema(MYSQL *mysql, const char *db); static int drop_schema(MYSQL *mysql, const char *db);
uint get_random_string(char *buf); uint get_random_string(char *buf);
static statement *build_table_string(void); static statement *build_table_string(void);
...@@ -1264,7 +1265,13 @@ get_options(int *argc,char ***argv) ...@@ -1264,7 +1265,13 @@ get_options(int *argc,char ***argv)
if (num_int_cols_opt) if (num_int_cols_opt)
{ {
option_string *str; option_string *str;
parse_option(num_int_cols_opt, &str, ','); if(parse_option(num_int_cols_opt, &str, ',') == -1)
{
fprintf(stderr, "Invalid value specified for the option "
"'number-int-cols'\n");
option_cleanup(str);
return 1;
}
num_int_cols= atoi(str->string); num_int_cols= atoi(str->string);
if (str->option) if (str->option)
num_int_cols_index= atoi(str->option); num_int_cols_index= atoi(str->option);
...@@ -1275,7 +1282,13 @@ get_options(int *argc,char ***argv) ...@@ -1275,7 +1282,13 @@ get_options(int *argc,char ***argv)
if (num_char_cols_opt) if (num_char_cols_opt)
{ {
option_string *str; option_string *str;
parse_option(num_char_cols_opt, &str, ','); if(parse_option(num_char_cols_opt, &str, ',') == -1)
{
fprintf(stderr, "Invalid value specified for the option "
"'number-char-cols'\n");
option_cleanup(str);
return 1;
}
num_char_cols= atoi(str->string); num_char_cols= atoi(str->string);
if (str->option) if (str->option)
num_char_cols_index= atoi(str->option); num_char_cols_index= atoi(str->option);
...@@ -1512,7 +1525,13 @@ get_options(int *argc,char ***argv) ...@@ -1512,7 +1525,13 @@ get_options(int *argc,char ***argv)
printf("Parsing engines to use.\n"); printf("Parsing engines to use.\n");
if (default_engine) if (default_engine)
parse_option(default_engine, &engine_options, ','); {
if(parse_option(default_engine, &engine_options, ',') == -1)
{
fprintf(stderr, "Invalid value specified for the option 'engine'\n");
return 1;
}
}
if (tty_password) if (tty_password)
opt_password= get_tty_password(NullS); opt_password= get_tty_password(NullS);
...@@ -1989,7 +2008,7 @@ pthread_handler_t run_task(void *p) ...@@ -1989,7 +2008,7 @@ pthread_handler_t run_task(void *p)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
uint int
parse_option(const char *origin, option_string **stmt, char delm) parse_option(const char *origin, option_string **stmt, char delm)
{ {
char *retstr; char *retstr;
...@@ -2014,6 +2033,13 @@ parse_option(const char *origin, option_string **stmt, char delm) ...@@ -2014,6 +2033,13 @@ parse_option(const char *origin, option_string **stmt, char delm)
char buffer[HUGE_STRING_LENGTH]= ""; char buffer[HUGE_STRING_LENGTH]= "";
char *buffer_ptr; char *buffer_ptr;
/*
Return an error if the length of the any of the comma seprated value
exceeds HUGE_STRING_LENGTH.
*/
if ((size_t)(retstr - ptr) > HUGE_STRING_LENGTH)
return -1;
count++; count++;
strncpy(buffer, ptr, (size_t)(retstr - ptr)); strncpy(buffer, ptr, (size_t)(retstr - ptr));
/* /*
...@@ -2053,6 +2079,13 @@ parse_option(const char *origin, option_string **stmt, char delm) ...@@ -2053,6 +2079,13 @@ parse_option(const char *origin, option_string **stmt, char delm)
{ {
char *origin_ptr; char *origin_ptr;
/*
Return an error if the length of the any of the comma seprated value
exceeds HUGE_STRING_LENGTH.
*/
if (strlen(ptr) > HUGE_STRING_LENGTH)
return -1;
if ((origin_ptr= strchr(ptr, ':'))) if ((origin_ptr= strchr(ptr, ':')))
{ {
char *option_ptr; char *option_ptr;
...@@ -2063,13 +2096,13 @@ parse_option(const char *origin, option_string **stmt, char delm) ...@@ -2063,13 +2096,13 @@ parse_option(const char *origin, option_string **stmt, char delm)
option_ptr= (char *)ptr + 1 + tmp->length; option_ptr= (char *)ptr + 1 + tmp->length;
/* Move past the : and the first string */ /* Move past the : and the first string */
tmp->option_length= (size_t)((ptr + length) - option_ptr); tmp->option_length= strlen(option_ptr);
tmp->option= my_strndup(option_ptr, tmp->option_length, tmp->option= my_strndup(option_ptr, tmp->option_length,
MYF(MY_FAE)); MYF(MY_FAE));
} }
else else
{ {
tmp->length= (size_t)((ptr + length) - ptr); tmp->length= strlen(ptr);
tmp->string= my_strndup(ptr, tmp->length, MYF(MY_FAE)); tmp->string= my_strndup(ptr, tmp->length, MYF(MY_FAE));
} }
......
[mysqld_safe] [mysqld_safe]
skip_log_error
syslog syslog
...@@ -228,7 +228,7 @@ rollback; ...@@ -228,7 +228,7 @@ rollback;
create table t0 (n int); create table t0 (n int);
insert t0 select * from t1; insert t0 select * from t1;
set autocommit=1; set autocommit=1;
insert into t0 select GET_LOCK("lock1",null); insert into t0 select GET_LOCK("lock1",0);
set autocommit=0; set autocommit=0;
create table t2 (n int) engine=innodb; create table t2 (n int) engine=innodb;
insert into t2 values (3); insert into t2 values (3);
......
...@@ -2686,15 +2686,18 @@ sub setup_vardir() { ...@@ -2686,15 +2686,18 @@ sub setup_vardir() {
{ {
$plugindir="$opt_vardir/plugins"; $plugindir="$opt_vardir/plugins";
mkpath($plugindir); mkpath($plugindir);
if (IS_WINDOWS && !$opt_embedded_server) if (IS_WINDOWS)
{ {
for (<$bindir/storage/*$opt_vs_config/*.dll>, if (!$opt_embedded_server)
<$bindir/plugin/*$opt_vs_config/*.dll>,
<$bindir/sql$opt_vs_config/*.dll>)
{ {
my $pname=basename($_); for (<$bindir/storage/*$opt_vs_config/*.dll>,
copy rel2abs($_), "$plugindir/$pname"; <$bindir/plugin/*$opt_vs_config/*.dll>,
set_plugin_var($pname); <$bindir/sql$opt_vs_config/*.dll>)
{
my $pname=basename($_);
copy rel2abs($_), "$plugindir/$pname";
set_plugin_var($pname);
}
} }
} }
else else
...@@ -4859,6 +4862,7 @@ sub extract_warning_lines ($$) { ...@@ -4859,6 +4862,7 @@ sub extract_warning_lines ($$) {
qr|InnoDB: Setting thread \d+ nice to \d+ failed, current nice \d+, errno 13|, # setpriority() fails under valgrind qr|InnoDB: Setting thread \d+ nice to \d+ failed, current nice \d+, errno 13|, # setpriority() fails under valgrind
qr|Failed to setup SSL|, qr|Failed to setup SSL|,
qr|SSL error: Failed to set ciphers to use|, qr|SSL error: Failed to set ciphers to use|,
qr/Plugin 'InnoDB' will be forced to shutdown/,
); );
my $matched_lines= []; my $matched_lines= [];
......
...@@ -1773,8 +1773,8 @@ ALTER TABLE tm1 DROP INDEX im3; ...@@ -1773,8 +1773,8 @@ ALTER TABLE tm1 DROP INDEX im3;
affected rows: 2 affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0 info: Records: 2 Duplicates: 0 Warnings: 0
ALTER TABLE ti1 DROP COLUMN d2; ALTER TABLE ti1 DROP COLUMN d2;
affected rows: 2 affected rows: 0
info: Records: 2 Duplicates: 0 Warnings: 0 info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tm1 DROP COLUMN d2; ALTER TABLE tm1 DROP COLUMN d2;
affected rows: 2 affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0 info: Records: 2 Duplicates: 0 Warnings: 0
......
...@@ -5,7 +5,7 @@ Warning 1266 Using storage engine MyISAM for table 't1' ...@@ -5,7 +5,7 @@ Warning 1266 Using storage engine MyISAM for table 't1'
DROP TABLE t1; DROP TABLE t1;
INSTALL PLUGIN blackhole SONAME 'ha_blackhole.so'; INSTALL PLUGIN blackhole SONAME 'ha_blackhole.so';
INSTALL PLUGIN BLACKHOLE SONAME 'ha_blackhole.so'; INSTALL PLUGIN BLACKHOLE SONAME 'ha_blackhole.so';
ERROR HY000: Function 'BLACKHOLE' already exists ERROR HY000: Plugin 'BLACKHOLE' already installed
UNINSTALL PLUGIN blackhole; UNINSTALL PLUGIN blackhole;
INSTALL PLUGIN blackhole SONAME 'ha_blackhole.so'; INSTALL PLUGIN blackhole SONAME 'ha_blackhole.so';
CREATE TABLE t1(a int) ENGINE=BLACKHOLE; CREATE TABLE t1(a int) ENGINE=BLACKHOLE;
......
...@@ -1103,3 +1103,19 @@ ORDER BY field; ...@@ -1103,3 +1103,19 @@ ORDER BY field;
field field
c,c c,c
drop table t3, t2, t1; drop table t3, t2, t1;
#
# MDEV-7821 - Server crashes in Item_func_group_concat::fix_fields on 2nd
# execution of PS
#
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(1),(2);
PREPARE stmt FROM "SELECT GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0) FROM t1 AS t1a, t1 AS t1b GROUP BY t1a.a";
EXECUTE stmt;
GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0)
1,1
2,2
EXECUTE stmt;
GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0)
1,1
2,2
DROP TABLE t1;
...@@ -361,6 +361,19 @@ set optimizer_switch=@optimizer_switch_save; ...@@ -361,6 +361,19 @@ set optimizer_switch=@optimizer_switch_save;
drop view v_merge, vm; drop view v_merge, vm;
drop table t1,tv; drop table t1,tv;
# #
# MDEV-4017 - GET_LOCK() with negative timeouts has strange behavior
#
SELECT GET_LOCK('ul1', NULL);
GET_LOCK('ul1', NULL)
NULL
Warnings:
Warning 1411 Incorrect timeout value: 'NULL' for function get_lock
SELECT GET_LOCK('ul1', -1);
GET_LOCK('ul1', -1)
NULL
Warnings:
Warning 1411 Incorrect timeout value: '-1' for function get_lock
#
# GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test # GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test
# #
# IS_USED_LOCK, IS_FREE_LOCK: the lock is not acquired # IS_USED_LOCK, IS_FREE_LOCK: the lock is not acquired
......
...@@ -1689,6 +1689,7 @@ Assigning privileges without procs_priv table. ...@@ -1689,6 +1689,7 @@ Assigning privileges without procs_priv table.
CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest1;
CREATE PROCEDURE mysqltest1.test() SQL SECURITY DEFINER CREATE PROCEDURE mysqltest1.test() SQL SECURITY DEFINER
SELECT 1; SELECT 1;
CREATE FUNCTION mysqltest1.test() RETURNS INT RETURN 1;
GRANT EXECUTE ON FUNCTION mysqltest1.test TO mysqltest_1@localhost; GRANT EXECUTE ON FUNCTION mysqltest1.test TO mysqltest_1@localhost;
ERROR 42S02: Table 'mysql.procs_priv' doesn't exist ERROR 42S02: Table 'mysql.procs_priv' doesn't exist
GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost; GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
...@@ -2551,3 +2552,25 @@ ERROR 42000: Access denied for user 'untrusted'@'localhost' to database 'secret' ...@@ -2551,3 +2552,25 @@ ERROR 42000: Access denied for user 'untrusted'@'localhost' to database 'secret'
# Connection default # Connection default
DROP USER untrusted@localhost; DROP USER untrusted@localhost;
DROP DATABASE secret; DROP DATABASE secret;
#
# BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
# DIFFERENTLY'.
#
drop database if exists mysqltest_db1;
create database mysqltest_db1;
create user mysqltest_u1;
# Both GRANT statements below should fail with the same error.
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
ERROR 42000: FUNCTION or PROCEDURE f1 does not exist
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
ERROR 42000: FUNCTION or PROCEDURE p1 does not exist
# Let us show that GRANT behaviour for routines is consistent
# with GRANT behaviour for tables. Attempt to grant privilege
# on non-existent table also results in an error.
grant select on mysqltest_db1.t1 to mysqltest_u1;
ERROR 42S02: Table 'mysqltest_db1.t1' doesn't exist
show grants for mysqltest_u1;
Grants for mysqltest_u1@%
GRANT USAGE ON *.* TO 'mysqltest_u1'@'%'
drop database mysqltest_db1;
drop user mysqltest_u1;
...@@ -19,3 +19,5 @@ mysqld-bin.000001 # Query # # use `test`; insert t1 values (2) ...@@ -19,3 +19,5 @@ mysqld-bin.000001 # Query # # use `test`; insert t1 values (2)
mysqld-bin.000001 # Query # # COMMIT mysqld-bin.000001 # Query # # COMMIT
drop table t1; drop table t1;
uninstall plugin innodb; uninstall plugin innodb;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
# #
# Test of MyISAM MRG tables with corrupted children. # Tests for corrupted MyISAM tables and MyISAMMRG tables with corrupted
# children..
#
# Run with --myisam-recover=force option. # Run with --myisam-recover=force option.
# #
# Preparation: we need to make sure that the merge parent # Preparation: we need to make sure that the merge parent
...@@ -44,20 +46,20 @@ drop procedure p_create; ...@@ -44,20 +46,20 @@ drop procedure p_create;
# Switching to connection 'default' # Switching to connection 'default'
# #
# #
# We have to disable the ps-protocol, to avoid # We have to disable the ps-protocol, to avoid
# "Prepared statement needs to be re-prepared" errors # "Prepared statement needs to be re-prepared" errors
# -- table def versions change all the time with full table cache. # -- table def versions change all the time with full table cache.
# #
drop table if exists t1, t1_mrg, t1_copy; drop table if exists t1, t1_mrg, t1_copy;
# #
# Prepare a MERGE engine table, that refers to a corrupted # Prepare a MERGE engine table, that refers to a corrupted
# child. # child.
# #
create table t1 (a int, key(a)) engine=myisam; create table t1 (a int, key(a)) engine=myisam;
create table t1_mrg (a int) union (t1) engine=merge; create table t1_mrg (a int) union (t1) engine=merge;
# #
# Create a table with a corrupted index file: # Create a table with a corrupted index file:
# save an old index file, insert more rows, # save an old index file, insert more rows,
# overwrite the new index file with the old one. # overwrite the new index file with the old one.
# #
insert into t1 (a) values (1), (2), (3); insert into t1 (a) values (1), (2), (3);
...@@ -101,3 +103,48 @@ execute stmt; ...@@ -101,3 +103,48 @@ execute stmt;
deallocate prepare stmt; deallocate prepare stmt;
set @@global.table_definition_cache=default; set @@global.table_definition_cache=default;
set @@global.table_open_cache=default; set @@global.table_open_cache=default;
#
# 18075170 - sql node restart required to avoid deadlock after
# restore
#
# Check that auto-repair for MyISAM tables can now happen in the
# middle of transaction, without aborting it.
create table t1 (a int, key(a)) engine=myisam;
create table t2 (a int);
insert into t2 values (1);
# Create a table with a corrupted index file:
# save an old index file, insert more rows,
# overwrite the new index file with the old one.
insert into t1 (a) values (1);
flush table t1;
insert into t1 (a) values (4);
flush table t1;
# Check table is needed to mark the table as crashed.
check table t1;
Table Op Msg_type Msg_text
test.t1 check warning Size of datafile is: 14 Should be: 7
test.t1 check error Record-count is not ok; is 2 Should be: 1
test.t1 check warning Found 2 key parts. Should be: 1
test.t1 check error Corrupt
# At this point we have a corrupt t1
set autocommit = 0;
select * from t2;
a
1
# Without fix select from t1 will break the transaction. After the fix
# transaction should be active and should hold lock on table t2. Alter
# table from con2 will wait only if the transaction is not broken.
select * from t1;
a
1
4
Warnings:
Error 145 Table 't1' is marked as crashed and should be repaired
Error 1194 Table 't1' is marked as crashed and should be repaired
Error 1034 Number of rows changed from 1 to 2
ALTER TABLE t2 ADD val INT;
# With fix we should have alter table waiting for t2 lock here.
ROLLBACK;
SET autocommit = 1;
# Cleanup
drop table t1, t2;
...@@ -634,6 +634,9 @@ The following options may be given as the first argument: ...@@ -634,6 +634,9 @@ The following options may be given as the first argument:
--performance-schema-max-cond-instances=# --performance-schema-max-cond-instances=#
Maximum number of instrumented condition objects. Use 0 Maximum number of instrumented condition objects. Use 0
to disable, -1 for automated sizing. to disable, -1 for automated sizing.