Skip to content

Commit

Permalink
Merge 10.3 into 10.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Jun 8, 2021
2 parents bb28bff + 6e9642b commit 72b2489
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 19 deletions.
2 changes: 1 addition & 1 deletion cmake/FindJNI.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if(JAVA_AWT_LIBRARY)
if(JAVA_AWT_LIBRARY AND JAVA_INCLUDE_PATH)
set(JNI_FOUND TRUE)
return()
endif()
Expand Down
4 changes: 0 additions & 4 deletions debian/mariadb-plugin-connect.install
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
etc/mysql/conf.d/connect.cnf etc/mysql/mariadb.conf.d
usr/lib/mysql/plugin/ha_connect.so
usr/share/mysql/Mongo2.jar
usr/share/mysql/Mongo3.jar
usr/share/mysql/JavaWrappers.jar
usr/share/mysql/JdbcInterface.jar
39 changes: 39 additions & 0 deletions mysql-test/main/derived_cond_pushdown.result
Original file line number Diff line number Diff line change
Expand Up @@ -10631,6 +10631,45 @@ m
7
drop view v1;
drop table t1;
#
# MDEV-25635: pushdown into grouping view using aggregate functions
# with constant arguments via a mergeable derived table
#
create table t1 (a int);
insert into t1 values (3), (7), (1), (3), (7), (7), (3);
create view v1 as select a, sum(1) as f, sum(1) as g from t1 group by a;
select * from v1;
a f g
1 1 1
3 3 3
7 3 3
select * from (select * from v1) as dt where a=f and a=g;
a f g
1 1 1
3 3 3
explain extended select * from (select * from v1) as dt where a=f and a=g;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 7 100.00 Using where
3 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using temporary; Using filesort
Warnings:
Note 1003 /* select#1 */ select `v1`.`a` AS `a`,`v1`.`f` AS `f`,`v1`.`g` AS `g` from `test`.`v1` where `v1`.`a` = `v1`.`f` and `v1`.`a` = `v1`.`g`
create view v2 as select a, min(1) as f, min(1) as g from t1 group by a;
select * from v2;
a f g
1 1 1
3 1 1
7 1 1
select * from (select * from v2) as dt where a=f and a=g;
a f g
1 1 1
explain extended select * from (select * from v2) as dt where a=f and a=g;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 7 100.00 Using where
3 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using temporary; Using filesort
Warnings:
Note 1003 /* select#1 */ select `v2`.`a` AS `a`,`v2`.`f` AS `f`,`v2`.`g` AS `g` from `test`.`v2` where `v2`.`a` = `v2`.`f` and `v2`.`a` = `v2`.`g`
drop view v1,v2;
drop table t1;
# End of 10.2 tests
#
# MDEV-14579: pushdown conditions into materialized views/derived tables
Expand Down
25 changes: 25 additions & 0 deletions mysql-test/main/derived_cond_pushdown.test
Original file line number Diff line number Diff line change
Expand Up @@ -2213,6 +2213,31 @@ select * from v1 where m > 0;
drop view v1;
drop table t1;

--echo #
--echo # MDEV-25635: pushdown into grouping view using aggregate functions
--echo # with constant arguments via a mergeable derived table
--echo #

create table t1 (a int);
insert into t1 values (3), (7), (1), (3), (7), (7), (3);

create view v1 as select a, sum(1) as f, sum(1) as g from t1 group by a;
select * from v1;
let $q1=
select * from (select * from v1) as dt where a=f and a=g;
eval $q1;
eval explain extended $q1;

create view v2 as select a, min(1) as f, min(1) as g from t1 group by a;
select * from v2;
let $q2=
select * from (select * from v2) as dt where a=f and a=g;
eval $q2;
eval explain extended $q2;

drop view v1,v2;
drop table t1;

--echo # End of 10.2 tests

--echo #
Expand Down
11 changes: 10 additions & 1 deletion mysql-test/suite/vcol/r/vcol_syntax.result
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drop table if exists t1;
set @OLD_SQL_MODE=@@SESSION.SQL_MODE;
create table t1 (a int, b int generated always as (a+1));
show create table t1;
Expand Down Expand Up @@ -88,3 +87,13 @@ create table t1 (x int, y int default test2.t1.x);
ERROR 42S22: Unknown column '`test2`.`t1`.`x`' in 'DEFAULT'
create table t1 (x int, check (test2.t1.x > 0));
ERROR 42S22: Unknown column '`test2`.`t1`.`x`' in 'CHECK'
#
# MDEV-25672 table alias from previous statement interferes later commands
#
create table t1 (a int, v_a int generated always as (a));
update t1 as x set a = 1;
alter table t1 force;
drop table t1;
#
# End of 10.2 tests
#
17 changes: 13 additions & 4 deletions mysql-test/suite/vcol/t/vcol_syntax.test
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#
# test syntax
#
--disable_warnings
drop table if exists t1;
--enable_warnings

set @OLD_SQL_MODE=@@SESSION.SQL_MODE;
create table t1 (a int, b int generated always as (a+1));
show create table t1;
Expand Down Expand Up @@ -72,3 +68,16 @@ create table t1 (x int, y int check (y > test2.t1.x));
create table t1 (x int, y int default test2.t1.x);
--error ER_BAD_FIELD_ERROR
create table t1 (x int, check (test2.t1.x > 0));

--echo #
--echo # MDEV-25672 table alias from previous statement interferes later commands
--echo #
create table t1 (a int, v_a int generated always as (a));
update t1 as x set a = 1;
alter table t1 force;
drop table t1;


--echo #
--echo # End of 10.2 tests
--echo #
7 changes: 5 additions & 2 deletions sql/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -3521,7 +3521,7 @@ class Item_field :public Item_ident,
bool check_table_name_processor(void *arg)
{
Check_table_name_prm &p= *(Check_table_name_prm *) arg;
if (p.table_name.length && table_name)
if (!field && p.table_name.length && table_name)
{
DBUG_ASSERT(p.db.length);
if ((db_name &&
Expand Down Expand Up @@ -5857,7 +5857,10 @@ class Item_direct_view_ref :public Item_direct_ref
table_map used_tables() const;
void update_used_tables();
table_map not_null_tables() const;
bool const_item() const { return used_tables() == 0; }
bool const_item() const
{
return (*ref)->const_item() && (null_ref_table == NO_NULL_TABLE);
}
TABLE *get_null_ref_table() const { return null_ref_table; }
bool walk(Item_processor processor, bool walk_subquery, void *arg)
{
Expand Down
2 changes: 2 additions & 0 deletions sql/item_subselect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref)
res= TRUE;
goto end;
}
if (sl == unit->first_select() && !sl->next_select())
unit->fake_select_lex= 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion sql/sql_select.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27159,7 +27159,7 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
sl->options|= SELECT_DESCRIBE;
}

if (unit->is_unit_op())
if (unit->is_unit_op() || unit->fake_select_lex)
{
if (unit->union_needs_tmp_table() && unit->fake_select_lex)
{
Expand Down
4 changes: 4 additions & 0 deletions storage/connect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA

IF(WITHOUT_DYNAMIC_PLUGINS OR WITH_NONE OR ("${PLUGIN_CONNECT}" STREQUAL "NO"))
RETURN()
ENDIF()

SET(CONNECT_PLUGIN_STATIC "connect")
SET(CONNECT_PLUGIN_DYNAMIC "connect")

Expand Down
2 changes: 1 addition & 1 deletion storage/heap/ha_heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ int ha_heap::reset_auto_increment(ulonglong value)

int ha_heap::external_lock(THD *thd, int lock_type)
{
#ifndef DBUG_OFF
#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG)
if (lock_type == F_UNLCK && file->s->changed && heap_check_heap(file, 0))
return HA_ERR_CRASHED;
#endif
Expand Down
11 changes: 8 additions & 3 deletions storage/innobase/buf/buf0rea.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2020, MariaDB Corporation.
Copyright (c) 2015, 2021, MariaDB Corporation.
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
Expand Down Expand Up @@ -772,13 +772,18 @@ buf_read_ibuf_merge_pages(
continue;
}

if (UNIV_UNLIKELY(page_nos[i] >= space->size)) {
ulint size = space->size;
if (!size) {
size = fil_space_get_size(space->id);
}

if (UNIV_UNLIKELY(page_nos[i] >= size)) {
do {
ibuf_delete_recs(page_id_t(space_ids[i],
page_nos[i]));
} while (++i < n_stored
&& space_ids[i - 1] == space_ids[i]
&& page_nos[i] >= space->size);
&& page_nos[i] >= size);
i--;
next:
space->release();
Expand Down
2 changes: 1 addition & 1 deletion win/packaging/heidisql.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SET(HEIDISQL_BASE_NAME "HeidiSQL_11.2_32_Portable")
SET(HEIDISQL_BASE_NAME "HeidiSQL_11.3_32_Portable")
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
Expand Down
5 changes: 4 additions & 1 deletion win/upgrade_wizard/upgradeDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,10 @@ void CUpgradeDlg::UpgradeOneService(const string& servicename)
ErrorExit("Stdout SetHandleInformation");

string commandline("mysql_upgrade_service.exe --service=");
commandline += "\"";
commandline += servicename;
commandline += "\"";

si.cb = sizeof(si);
si.hStdInput= GetStdHandle(STD_INPUT_HANDLE);
si.hStdOutput= hPipeWrite;
Expand Down Expand Up @@ -397,7 +400,7 @@ void CUpgradeDlg::UpgradeOneService(const string& servicename)
else
{
/*
Creating a process with CREATE_BREAKAWAY_FROM_JOB, reset this flag
Creating a process with CREATE_BREAKAWAY_FROM_JOB failed, reset this flag
and retry.
*/
if (!CreateProcess(NULL, (LPSTR)commandline.c_str(), NULL, NULL, TRUE,
Expand Down

0 comments on commit 72b2489

Please sign in to comment.