Skip to content

Commit 497c6ad

Browse files
committed
System Versioning pre1.0
Merge branch '10.3' into trunk
2 parents d8d7251 + a48aa0c commit 497c6ad

File tree

433 files changed

+15996
-12457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

433 files changed

+15996
-12457
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ language: cpp
1111
os:
1212
- linux
1313
- osx
14-
osx_image: xcode8.3
14+
osx_image: xcode9.1
1515
compiler:
1616
- gcc
1717
- clang

client/mysql.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ inline bool is_delimiter_command(char *name, ulong len)
10921092
only name(first DELIMITER_NAME_LEN bytes) is checked.
10931093
*/
10941094
return (len >= DELIMITER_NAME_LEN &&
1095-
!my_strnncoll(charset_info, (uchar*) name, DELIMITER_NAME_LEN,
1095+
!my_strnncoll(&my_charset_latin1, (uchar*) name, DELIMITER_NAME_LEN,
10961096
(uchar *) DELIMITER_NAME, DELIMITER_NAME_LEN));
10971097
}
10981098

client/mysql_upgrade.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -965,8 +965,9 @@ static int install_used_engines(void)
965965
{
966966
char buf[512];
967967
DYNAMIC_STRING ds_result;
968-
const char *query = "SELECT DISTINCT LOWER(engine) FROM information_schema.tables"
969-
" WHERE table_comment LIKE 'Unknown storage engine%'";
968+
const char *query = "SELECT DISTINCT LOWER(engine) AS c1 FROM information_schema.tables"
969+
" WHERE table_comment LIKE 'Unknown storage engine%'"
970+
" ORDER BY c1";
970971

971972
if (opt_systables_only || !from_before_10_1())
972973
{

extra/mariabackup/backup_copy.cc

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
4646
#include <ut0mem.h>
4747
#include <srv0start.h>
4848
#include <fil0fil.h>
49+
#include <trx0sys.h>
4950
#include <set>
5051
#include <string>
5152
#include <mysqld.h>
@@ -1680,26 +1681,30 @@ copy_back()
16801681
ut_crc32_init();
16811682

16821683
/* copy undo tablespaces */
1683-
if (srv_undo_tablespaces > 0) {
16841684

1685-
dst_dir = (srv_undo_dir && *srv_undo_dir)
1686-
? srv_undo_dir : mysql_data_home;
16871685

1688-
ds_data = ds_create(dst_dir, DS_TYPE_LOCAL);
1686+
dst_dir = (srv_undo_dir && *srv_undo_dir)
1687+
? srv_undo_dir : mysql_data_home;
16891688

1690-
for (ulong i = 1; i <= srv_undo_tablespaces; i++) {
1691-
char filename[20];
1692-
sprintf(filename, "undo%03lu", i);
1693-
if (!(ret = copy_or_move_file(filename, filename,
1694-
dst_dir, 1))) {
1695-
goto cleanup;
1696-
}
1697-
}
1689+
ds_data = ds_create(dst_dir, DS_TYPE_LOCAL);
16981690

1699-
ds_destroy(ds_data);
1700-
ds_data = NULL;
1691+
for (uint i = 1; i <= TRX_SYS_MAX_UNDO_SPACES; i++) {
1692+
char filename[20];
1693+
sprintf(filename, "undo%03u", i);
1694+
if (!file_exists(filename)) {
1695+
break;
1696+
}
1697+
if (!(ret = copy_or_move_file(filename, filename,
1698+
dst_dir, 1))) {
1699+
goto cleanup;
1700+
}
17011701
}
17021702

1703+
ds_destroy(ds_data);
1704+
ds_data = NULL;
1705+
1706+
/* copy redo logs */
1707+
17031708
dst_dir = (srv_log_group_home_dir && *srv_log_group_home_dir)
17041709
? srv_log_group_home_dir : mysql_data_home;
17051710

@@ -1825,7 +1830,7 @@ copy_back()
18251830
}
18261831
}
18271832

1828-
/* copy buufer pool dump */
1833+
/* copy buffer pool dump */
18291834

18301835
if (innobase_buffer_pool_filename) {
18311836
const char *src_name;

extra/mariabackup/xtrabackup.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2836,7 +2836,7 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
28362836
/* We found a symlink or a file */
28372837
if (strlen(fileinfo.name) > 4) {
28382838
bool is_isl= false;
2839-
if (ends_with(fileinfo.name, ".ibd") || ((is_isl = ends_with(fileinfo.name, ".ibd"))))
2839+
if (ends_with(fileinfo.name, ".ibd") || ((is_isl = ends_with(fileinfo.name, ".isl"))))
28402840
(*callback)(dbinfo.name, fileinfo.name, is_isl);
28412841
}
28422842
}

include/my_alloc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ typedef struct st_mem_root
4343
/* if block have less memory it will be put in 'used' list */
4444
size_t min_malloc;
4545
size_t block_size; /* initial block size */
46+
size_t total_alloc;
4647
unsigned int block_num; /* allocated blocks counter */
4748
/*
4849
first free block in queue test counter (if it exceed

include/mysql.h.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@
238238
USED_MEM *pre_alloc;
239239
size_t min_malloc;
240240
size_t block_size;
241+
size_t total_alloc;
241242
unsigned int block_num;
242243
unsigned int first_block_usage;
243244
void (*error_handler)(void);

include/source_revision.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#cmakedefine SOURCE_REVISION "@SOURCE_REVISION@"
1+
#define SOURCE_REVISION "@SOURCE_REVISION@"

libmysqld/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
118118
../sql/temporary_tables.cc
119119
../sql/session_tracker.cc
120120
../sql/proxy_protocol.cc
121+
../sql/sql_tvc.cc ../sql/sql_tvc.h
121122
../sql/item_vers.cc
122123
../sql/vtmd.cc
123124
${GEN_SOURCES}

mysql-test/extra/binlog_tests/binlog_index.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ call mtr.add_suppression('Attempting backtrace');
1818
call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to process registered files that would be purged.');
1919
call mtr.add_suppression('MYSQL_BIN_LOG::open failed to sync the index file');
2020
call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.');
21-
call mtr.add_suppression('Could not open .*');
21+
call mtr.add_suppression('Could not use .*');
2222
call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
2323
flush tables;
2424

mysql-test/extra/rpl_tests/rpl_binlog_errors.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ SET GLOBAL debug_dbug=@old_debug;
286286
### file or failure to write the rotate event.
287287

288288
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
289-
call mtr.add_suppression("Could not open .*");
289+
call mtr.add_suppression("Could not use .*");
290290

291291
RESET MASTER;
292292
SHOW WARNINGS;
@@ -392,7 +392,7 @@ RESET MASTER;
392392

393393
call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*");
394394
call mtr.add_suppression("Error writing file .*");
395-
call mtr.add_suppression("Could not open .*");
395+
call mtr.add_suppression("Could not use .*");
396396
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
397397
call mtr.add_suppression("Can't generate a unique log-filename .*");
398398
-- echo ###################### TEST #13

mysql-test/include/check-testcase.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ call mtr.check_testcase();
8282

8383
let $datadir=`select @@datadir`;
8484
list_files $datadir mysql_upgrade_info;
85+
list_files $datadir/test #sql*;
86+
list_files $datadir/mysql #sql*;
8587

8688
--enable_query_log
8789

mysql-test/include/mtr_check.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ BEGIN
3939

4040
-- Dump all databases, there should be none
4141
-- except those that was created during bootstrap
42-
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA;
42+
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME;
4343

4444
-- and the mtr_wsrep_notify schema which is populated by the std_data/wsrep_notify.sh script
4545
-- and the suite/galera/t/galera_var_notify_cmd.test
4646
-- and the wsrep_schema schema that may be created by Galera
47-
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema');
47+
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA
48+
WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema')
49+
ORDER BY BINARY SCHEMA_NAME;
4850

4951
-- The test database should not contain any tables
5052
SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES

mysql-test/mysql-test-run.pl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,10 +1917,10 @@ ()
19171917
#print "Major: $1 Minor: $2 Build: $3\n";
19181918
$mysql_version_id= $1*10000 + $2*100 + $3;
19191919
#print "mysql_version_id: $mysql_version_id\n";
1920-
mtr_report("MySQL Version $1.$2.$3");
1920+
mtr_report("MariaDB Version $1.$2.$3");
19211921
$mysql_version_extra= $4;
19221922
}
1923-
mtr_error("Could not find version of MySQL") unless $mysql_version_id;
1923+
mtr_error("Could not find version of MariaDBL") unless $mysql_version_id;
19241924
}
19251925

19261926
sub find_mysqld {
@@ -2210,7 +2210,7 @@ sub environment_setup {
22102210
$ENV{'UMASK_DIR'}= "0770"; # The octal *string*
22112211

22122212
#
2213-
# MySQL tests can produce output in various character sets
2213+
# MariaDB tests can produce output in various character sets
22142214
# (especially, ctype_xxx.test). To avoid confusing Perl
22152215
# with output which is incompatible with the current locale
22162216
# settings, we reset the current values of LC_ALL and LC_CTYPE to "C".
@@ -2541,7 +2541,7 @@ ()
25412541
if (check_socket_path_length("$opt_tmpdir/testsocket.sock")){
25422542
mtr_error("Socket path '$opt_tmpdir' too long, it would be ",
25432543
"truncated and thus not possible to use for connection to ",
2544-
"MySQL Server. Set a shorter with --tmpdir=<path> option");
2544+
"MariaDB Server. Set a shorter with --tmpdir=<path> option");
25452545
}
25462546

25472547
# copy all files from std_data into var/std_data
@@ -4397,12 +4397,12 @@ ($$)
43974397
qr/Slave I\/O: error reconnecting to master '.*' - retry-time: [1-3] retries/,
43984398
qr/Slave I\/0: Master command COM_BINLOG_DUMP failed/,
43994399
qr/Error reading packet/,
4400-
qr/Lost connection to MySQL server at 'reading initial communication packet'/,
4400+
qr/Lost connection to MariaDB server at 'reading initial communication packet'/,
44014401
qr/Failed on request_dump/,
44024402
qr/Slave: Can't drop database.* database doesn't exist/,
44034403
qr/Slave: Operation DROP USER failed for 'create_rout_db'/,
44044404
qr|Checking table: '\..mtr.test_suppressions'|,
4405-
qr|Table \./test/bug53592 has a primary key in InnoDB data dictionary, but not in MySQL|,
4405+
qr|Table \./test/bug53592 has a primary key in InnoDB data dictionary, but not in|,
44064406
qr|Table '\..mtr.test_suppressions' is marked as crashed and should be repaired|,
44074407
qr|Table 'test_suppressions' is marked as crashed and should be repaired|,
44084408
qr|Can't open shared library|,

mysql-test/r/compound.result

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ select @a|
112112
/**/ while (select count(*) from information_schema.tables where table_schema='test')
113113
do
114114
select concat('drop table ', table_name) into @a
115-
from information_schema.tables where table_schema='test' limit 1;
115+
from information_schema.tables where table_schema='test'
116+
order by table_name limit 1;
116117
select @a as 'executing:';
117118
prepare dt from @a;
118119
execute dt;

mysql-test/r/create.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,7 @@ t1 CREATE TABLE `t1` (
11731173
`MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0,
11741174
`PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000,
11751175
`MEMORY_USED` bigint(7) NOT NULL DEFAULT 0,
1176+
`MAX_MEMORY_USED` bigint(7) NOT NULL DEFAULT 0,
11761177
`EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0,
11771178
`QUERY_ID` bigint(4) NOT NULL DEFAULT 0,
11781179
`INFO_BINARY` blob DEFAULT NULL,
@@ -1196,6 +1197,7 @@ t1 CREATE TEMPORARY TABLE `t1` (
11961197
`MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0,
11971198
`PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000,
11981199
`MEMORY_USED` bigint(7) NOT NULL DEFAULT 0,
1200+
`MAX_MEMORY_USED` bigint(7) NOT NULL DEFAULT 0,
11991201
`EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0,
12001202
`QUERY_ID` bigint(4) NOT NULL DEFAULT 0,
12011203
`INFO_BINARY` blob DEFAULT NULL,

mysql-test/r/cte_nonrecursive.result

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,3 +1079,71 @@ id select_type table type possible_keys key key_len ref rows Extra
10791079
3 DERIVED t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
10801080
NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL
10811081
DROP TABLE t1,t2;
1082+
#
1083+
# MDEV-13780: tower of embedding CTEs with multiple usage of them
1084+
#
1085+
create table t1 (a int);
1086+
insert into t1 values (3), (2), (4), (7), (1), (2), (5);
1087+
with cte_e as
1088+
(
1089+
with cte_o as
1090+
(
1091+
with cte_i as (select * from t1 where a < 7)
1092+
select * from cte_i where a > 1
1093+
)
1094+
select * from cte_o as cto_o1 where a < 3
1095+
union
1096+
select * from cte_o as cto_o2 where a > 4
1097+
)
1098+
select * from cte_e as cte_e1 where a > 1
1099+
union
1100+
select * from cte_e as cte_e2;
1101+
a
1102+
2
1103+
5
1104+
explain extended with cte_e as
1105+
(
1106+
with cte_o as
1107+
(
1108+
with cte_i as (select * from t1 where a < 7)
1109+
select * from cte_i where a > 1
1110+
)
1111+
select * from cte_o as cto_o1 where a < 3
1112+
union
1113+
select * from cte_o as cto_o2 where a > 4
1114+
)
1115+
select * from cte_e as cte_e1 where a > 1
1116+
union
1117+
select * from cte_e as cte_e2;
1118+
id select_type table type possible_keys key key_len ref rows filtered Extra
1119+
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 14 100.00 Using where
1120+
2 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where
1121+
5 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
1122+
NULL UNION RESULT <union2,5> ALL NULL NULL NULL NULL NULL NULL
1123+
6 UNION <derived9> ALL NULL NULL NULL NULL 14 100.00
1124+
9 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where
1125+
12 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
1126+
NULL UNION RESULT <union9,12> ALL NULL NULL NULL NULL NULL NULL
1127+
NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL
1128+
Warnings:
1129+
Note 1003 with cte_e as (with cte_o as (with cte_i as (/* select#4 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)/* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union /* select#5 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)/* select#1 */ select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union /* select#6 */ select `cte_e2`.`a` AS `a` from `cte_e` `cte_e2`
1130+
drop table t1;
1131+
#
1132+
# MDEV-13753: embedded CTE in a VIEW created in prepared statement
1133+
#
1134+
SET @sql_query = "
1135+
CREATE OR REPLACE VIEW cte_test AS
1136+
WITH cte1 AS ( SELECT 1 as a from dual )
1137+
, cte2 AS ( SELECT * FROM cte1 )
1138+
SELECT * FROM cte2;
1139+
";
1140+
PREPARE stmt FROM @sql_query;
1141+
EXECUTE stmt;
1142+
DEALLOCATE PREPARE stmt;
1143+
SHOW CREATE VIEW cte_test;
1144+
View Create View character_set_client collation_connection
1145+
cte_test CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `cte_test` AS with cte1 as (select 1 AS `a`), cte2 as (select `cte1`.`a` AS `a` from `cte1`)select `cte2`.`a` AS `a` from `cte2` latin1 latin1_swedish_ci
1146+
SELECT * FROM cte_test;
1147+
a
1148+
1
1149+
DROP VIEW cte_test;

mysql-test/r/cte_recursive.result

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2881,3 +2881,48 @@ f
28812881
2
28822882
set standard_compliant_cte=default;
28832883
DROP TABLE t;
2884+
#
2885+
# mdev-14184: recursive CTE embedded into CTE with multiple references
2886+
#
2887+
WITH
2888+
cte1 AS (
2889+
SELECT n FROM (
2890+
WITH RECURSIVE rec_cte(n) AS (
2891+
SELECT 1 as n1
2892+
UNION ALL
2893+
SELECT n+1 as n2 FROM rec_cte WHERE n < 3
2894+
) SELECT n FROM rec_cte
2895+
) AS X
2896+
),
2897+
cte2 as (
2898+
SELECT 2 FROM cte1
2899+
)
2900+
SELECT *
2901+
FROM cte1;
2902+
n
2903+
1
2904+
2
2905+
3
2906+
#
2907+
# MDEV-14217 [db crash] Recursive CTE when SELECT includes new field
2908+
#
2909+
CREATE TEMPORARY TABLE a_tbl (
2910+
a VARCHAR(33) PRIMARY KEY,
2911+
b VARCHAR(33)
2912+
);
2913+
INSERT INTO a_tbl VALUES ('block0', 'block0'), ('block1', NULL);
2914+
WITH RECURSIVE Q0 AS (
2915+
SELECT T0.a, T0.b, 5
2916+
FROM a_tbl T0
2917+
WHERE b IS NULL
2918+
UNION ALL
2919+
SELECT T1.a, T1.b
2920+
FROM Q0
2921+
JOIN a_tbl T1
2922+
ON T1.a=Q0.a
2923+
) SELECT distinct(Q0.a), Q0.b
2924+
FROM Q0;
2925+
ERROR 21000: The used SELECT statements have a different number of columns
2926+
DROP TABLE a_tbl;
2927+
WITH RECURSIVE x AS (SELECT 1,2 UNION ALL SELECT 1 FROM x) SELECT * FROM x;
2928+
ERROR 21000: The used SELECT statements have a different number of columns

mysql-test/r/default.result

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ CREATE TABLE t1 (a INT DEFAULT 10);
232232
INSERT INTO t1 VALUES (11);
233233
CREATE VIEW v1 AS SELECT a AS a FROM t1;
234234
CREATE VIEW v2 AS SELECT DEFAULT(a) AS a FROM t1;
235-
CREATE VIEW v3 AS SELECT VALUES(a) AS a FROM t1;
235+
CREATE VIEW v3 AS SELECT VALUE(a) AS a FROM t1;
236236
SELECT * FROM v1;
237237
a
238238
11
@@ -546,8 +546,8 @@ CREATE PROCEDURE p1() CREATE TABLE t1 (a INT DEFAULT par);
546546
CALL p1;
547547
ERROR 42S22: Unknown column 'par' in 'DEFAULT'
548548
DROP PROCEDURE p1;
549-
CREATE TABLE t1 (a INT DEFAULT VALUES(a));
550-
ERROR HY000: Function or expression 'values()' cannot be used in the DEFAULT clause of `a`
549+
CREATE TABLE t1 (a INT DEFAULT VALUE(a));
550+
ERROR HY000: Function or expression 'value()' cannot be used in the DEFAULT clause of `a`
551551
CREATE TABLE t1 (a INT);
552552
CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CREATE TABLE t2 (a INT DEFAULT NEW.a);
553553
ERROR HY000: Function or expression 'NEW.a' cannot be used in the DEFAULT clause of `a`
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1
2+
1

0 commit comments

Comments
 (0)