Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Barkov committed Jul 12, 2017
2 parents 0f348bc + 1d730ac commit daec000
Show file tree
Hide file tree
Showing 79 changed files with 7,183 additions and 6,410 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ matrix:
- psmisc
- zlib1g-dev
- libcrack2-dev
- cracklib-runtime
- libjemalloc-dev
- libsnappy-dev
- liblzma-dev
Expand Down Expand Up @@ -170,6 +171,7 @@ addons:
- psmisc
- zlib1g-dev
- libcrack2-dev
- cracklib-runtime
- libjemalloc-dev
- libsnappy-dev
- liblzma-dev
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=2
MYSQL_VERSION_PATCH=7
MYSQL_VERSION_PATCH=8
5 changes: 3 additions & 2 deletions client/mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4805,10 +4805,11 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
#endif

if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
const char *pos;
if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0] &&
(pos= strchr(status_str,' ')))
{
ulong sec;
const char *pos= strchr(status_str,' ');
/* print label */
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str);
if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec)))
Expand Down
2 changes: 2 additions & 0 deletions client/mysql_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,8 @@ int main(int argc, char **argv)
{
int fd= create_temp_file(cnf_file_path, opt_tmpdir[0] ? opt_tmpdir : NULL,
"mysql_upgrade-", O_CREAT | O_WRONLY, MYF(MY_FAE));
if (fd < 0)
die(NULL);
my_write(fd, USTRING_WITH_LEN( "[client]\n"), MYF(MY_FAE));
my_write(fd, (uchar*)ds_args.str, ds_args.length, MYF(MY_FAE));
my_close(fd, MYF(0));
Expand Down
5 changes: 2 additions & 3 deletions client/mysqldump.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@

static void add_load_option(DYNAMIC_STRING *str, const char *option,
const char *option_value);
static ulong find_set(TYPELIB *lib, const char *x, size_t length,
char **err_pos, uint *err_len);
static ulong find_set(TYPELIB *, const char *, size_t, char **, uint *);
static char *alloc_query_str(ulong size);

static void field_escape(DYNAMIC_STRING* in, const char *from);
Expand Down Expand Up @@ -5485,7 +5484,7 @@ static ulong find_set(TYPELIB *lib, const char *x, size_t length,
var_len= (uint) (pos - start);
strmake(buff, start, MY_MIN(sizeof(buff) - 1, var_len));
find= find_type(buff, lib, FIND_TYPE_BASIC);
if (!find)
if (find <= 0)
{
*err_pos= (char*) start;
*err_len= var_len;
Expand Down
2 changes: 1 addition & 1 deletion client/mysqlimport.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ int main(int argc, char **argv)
MYF(0))))
return -2;

for (counter= 0; *argv != NULL; argv++) /* Loop through tables */
for (; *argv != NULL; argv++) /* Loop through tables */
{
pthread_mutex_lock(&counter_mutex);
while (counter == opt_use_threads)
Expand Down
5 changes: 3 additions & 2 deletions client/mysqltest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
void str_to_file(const char *fname, char *str, int size);
void str_to_file2(const char *fname, char *str, int size, my_bool append);

void fix_win_paths(char *val, int len);
void fix_win_paths(char *val, size_t len);
const char *get_errname_from_code (uint error_code);
int multi_reg_replace(struct st_replace_regex* r,char* val);

Expand Down Expand Up @@ -2652,6 +2652,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
if (!mysql)
{
struct st_command command;
DBUG_ASSERT(query_end);
memset(&command, 0, sizeof(command));
command.query= (char*)query;
command.first_word_len= (*query_end - query);
Expand Down Expand Up @@ -7468,7 +7469,7 @@ void free_win_path_patterns()
=> all \ from c:\mysql\m... until next space is converted into /
*/

void fix_win_paths(char *val, int len)
void fix_win_paths(char *val, size_t len)
{
#ifdef _WIN32
uint i;
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion libmysqld/libmysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ typedef struct st_mysql_stmt_extension
1 could not initialize environment (out of memory or thread keys)
*/

int STDCALL mysql_server_init(int argc, char **argv, char **groups)
int STDCALL mysql_server_init(int argc __attribute__((unused)),
char **argv __attribute__((unused)),
char **groups __attribute__((unused)))
{
int result= 0;
if (!mysql_client_init)
Expand Down
13 changes: 9 additions & 4 deletions mysql-test/mysql-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2282,10 +2282,15 @@ sub environment_setup {
$ENV{'MYSQL_EMBEDDED'}= $exe_mysql_embedded;

my $client_config_exe=
native_path("$bindir/libmariadb/mariadb_config$opt_vs_config/mariadb_config");
my $tls_info= `$client_config_exe --tlsinfo`;
($ENV{CLIENT_TLS_LIBRARY},$ENV{CLIENT_TLS_LIBRARY_VERSION})=
split(/ /, $tls_info, 2);
mtr_exe_maybe_exists(
"$bindir/libmariadb/mariadb_config$opt_vs_config/mariadb_config",
"$bindir/bin/mariadb_config");
if ($client_config_exe)
{
my $tls_info= `$client_config_exe --tlsinfo`;
($ENV{CLIENT_TLS_LIBRARY},$ENV{CLIENT_TLS_LIBRARY_VERSION})=
split(/ /, $tls_info, 2);
}
my $exe_mysqld= find_mysqld($basedir);
$ENV{'MYSQLD'}= $exe_mysqld;
my $extra_opts= join (" ", @opt_extra_mysqld_opt);
Expand Down
60 changes: 60 additions & 0 deletions mysql-test/r/analyze_format_json.result
Original file line number Diff line number Diff line change
Expand Up @@ -758,3 +758,63 @@ ANALYZE
}
}
drop table t1,t2,t3;
#
# MDEV-13286: Floating point exception in Filesort_tracker::print_json_members(Json_writer*)
#
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (a int, b int, c int);
insert into t1 select a,a,a from t0;
create table t2 as select * from t1;
analyze format=json select a, (select t2.b from t2 where t2.a<t1.a order by t2.c limit 1) from t1 where t1.a<0;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 0,
"attached_condition": "t1.a < 0"
},
"subqueries": [
{
"expression_cache": {
"state": "uninitialized",
"r_loops": 0,
"query_block": {
"select_id": 2,
"read_sorted_file": {
"r_rows": null,
"filesort": {
"sort_key": "t2.c",
"r_loops": null,
"r_limit": null,
"r_used_priority_queue": null,
"r_output_rows": null,
"table": {
"table_name": "t2",
"access_type": "ALL",
"r_loops": 0,
"rows": 10,
"r_rows": null,
"filtered": 100,
"r_filtered": null,
"attached_condition": "t2.a < t1.a"
}
}
}
}
}
}
]
}
}
drop table t0,t1,t2;
43 changes: 34 additions & 9 deletions mysql-test/r/subselect.result
Original file line number Diff line number Diff line change
Expand Up @@ -4707,7 +4707,7 @@ pk
SET SESSION sql_mode=@old_sql_mode;
drop table t2, t1;
drop view v1;
End of 5.0 tests.
# End of 5.0 tests.
create table t_out (subcase char(3),
a1 char(2), b1 char(2), c1 char(2));
create table t_in (a2 char(2), b2 char(2), c2 char(2));
Expand Down Expand Up @@ -5582,7 +5582,7 @@ insert into t2 values ('x'), ('y');
select * from t2 where a=(select a from t1) and a='x';
ERROR 21000: Subquery returns more than 1 row
drop table t1,t2;
End of 5.1 tests
# End of 5.1 tests
#
# Bug #11765713 58705:
# OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
Expand Down Expand Up @@ -6194,7 +6194,7 @@ WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
DROP TABLE t1,t2;
End of 5.2 tests
# End of 5.2 tests
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
#
Expand Down Expand Up @@ -7151,19 +7151,21 @@ INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT, KEY(f2));
INSERT INTO t2 VALUES (3);
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
ERROR 42000: Can't group on 'sq'
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
3
ERROR 42000: Can't group on 'sq'
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
f2
3
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
count(*)
1
delete from t1;
SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
ERROR 42000: Can't group on 'sq'
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
NULL
ERROR 42000: Can't group on 'sq'
drop view v2;
drop table t1,t2;
#
Expand All @@ -7178,6 +7180,29 @@ f1 f2
foo bar
DROP TABLE t1;
#
# MDEV-10146: Wrong result (or questionable result and behavior)
# with aggregate function in uncorrelated SELECT subquery
#
CREATE TABLE t1 (f1 INT);
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 int);
INSERT INTO t2 VALUES (3);
SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
( SELECT MAX(f1) FROM t2 )
2
SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
( SELECT MAX(f1) FROM t2 )
2
INSERT INTO t2 VALUES (4);
SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
ERROR 21000: Subquery returns more than 1 row
SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
ERROR 21000: Subquery returns more than 1 row
drop view v1;
drop table t1,t2;
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
# with UNION in ALL subquery
#
Expand All @@ -7204,7 +7229,7 @@ SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo');
f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
# End of 10.1 tests
#
# MDEV-12564: IN TO EXISTS transformation for rows after
# conversion an outer join to inner join
Expand All @@ -7218,4 +7243,4 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
End of 10.2 tests
# End of 10.2 tests
43 changes: 34 additions & 9 deletions mysql-test/r/subselect_no_exists_to_in.result
Original file line number Diff line number Diff line change
Expand Up @@ -4709,7 +4709,7 @@ pk
SET SESSION sql_mode=@old_sql_mode;
drop table t2, t1;
drop view v1;
End of 5.0 tests.
# End of 5.0 tests.
create table t_out (subcase char(3),
a1 char(2), b1 char(2), c1 char(2));
create table t_in (a2 char(2), b2 char(2), c2 char(2));
Expand Down Expand Up @@ -5584,7 +5584,7 @@ insert into t2 values ('x'), ('y');
select * from t2 where a=(select a from t1) and a='x';
ERROR 21000: Subquery returns more than 1 row
drop table t1,t2;
End of 5.1 tests
# End of 5.1 tests
#
# Bug #11765713 58705:
# OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
Expand Down Expand Up @@ -6194,7 +6194,7 @@ WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
DROP TABLE t1,t2;
End of 5.2 tests
# End of 5.2 tests
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
#
Expand Down Expand Up @@ -7151,19 +7151,21 @@ INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT, KEY(f2));
INSERT INTO t2 VALUES (3);
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
ERROR 42000: Can't group on 'sq'
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
3
ERROR 42000: Can't group on 'sq'
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
f2
3
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
count(*)
1
delete from t1;
SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
ERROR 42000: Can't group on 'sq'
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
NULL
ERROR 42000: Can't group on 'sq'
drop view v2;
drop table t1,t2;
#
Expand All @@ -7178,6 +7180,29 @@ f1 f2
foo bar
DROP TABLE t1;
#
# MDEV-10146: Wrong result (or questionable result and behavior)
# with aggregate function in uncorrelated SELECT subquery
#
CREATE TABLE t1 (f1 INT);
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 int);
INSERT INTO t2 VALUES (3);
SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
( SELECT MAX(f1) FROM t2 )
2
SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
( SELECT MAX(f1) FROM t2 )
2
INSERT INTO t2 VALUES (4);
SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
ERROR 21000: Subquery returns more than 1 row
SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
ERROR 21000: Subquery returns more than 1 row
drop view v1;
drop table t1,t2;
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
# with UNION in ALL subquery
#
Expand All @@ -7204,7 +7229,7 @@ SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo');
f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
# End of 10.1 tests
#
# MDEV-12564: IN TO EXISTS transformation for rows after
# conversion an outer join to inner join
Expand All @@ -7218,7 +7243,7 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
End of 10.2 tests
# End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%exists_to_in=off%';
@@optimizer_switch like '%exists_to_in=off%'
Expand Down
Loading

0 comments on commit daec000

Please sign in to comment.