Skip to content

Commit

Permalink
System Versioning pre1.0
Browse files Browse the repository at this point in the history
Merge branch '10.3' into trunk
  • Loading branch information
midenok committed Nov 13, 2017
2 parents d8d7251 + a48aa0c commit 497c6ad
Show file tree
Hide file tree
Showing 433 changed files with 15,996 additions and 12,457 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -11,7 +11,7 @@ language: cpp
os:
- linux
- osx
osx_image: xcode8.3
osx_image: xcode9.1
compiler:
- gcc
- clang
Expand Down
2 changes: 1 addition & 1 deletion client/mysql.cc
Expand Up @@ -1092,7 +1092,7 @@ inline bool is_delimiter_command(char *name, ulong len)
only name(first DELIMITER_NAME_LEN bytes) is checked.
*/
return (len >= DELIMITER_NAME_LEN &&
!my_strnncoll(charset_info, (uchar*) name, DELIMITER_NAME_LEN,
!my_strnncoll(&my_charset_latin1, (uchar*) name, DELIMITER_NAME_LEN,
(uchar *) DELIMITER_NAME, DELIMITER_NAME_LEN));
}

Expand Down
5 changes: 3 additions & 2 deletions client/mysql_upgrade.c
Expand Up @@ -965,8 +965,9 @@ static int install_used_engines(void)
{
char buf[512];
DYNAMIC_STRING ds_result;
const char *query = "SELECT DISTINCT LOWER(engine) FROM information_schema.tables"
" WHERE table_comment LIKE 'Unknown storage engine%'";
const char *query = "SELECT DISTINCT LOWER(engine) AS c1 FROM information_schema.tables"
" WHERE table_comment LIKE 'Unknown storage engine%'"
" ORDER BY c1";

if (opt_systables_only || !from_before_10_1())
{
Expand Down
35 changes: 20 additions & 15 deletions extra/mariabackup/backup_copy.cc
Expand Up @@ -46,6 +46,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <ut0mem.h>
#include <srv0start.h>
#include <fil0fil.h>
#include <trx0sys.h>
#include <set>
#include <string>
#include <mysqld.h>
Expand Down Expand Up @@ -1680,26 +1681,30 @@ copy_back()
ut_crc32_init();

/* copy undo tablespaces */
if (srv_undo_tablespaces > 0) {

dst_dir = (srv_undo_dir && *srv_undo_dir)
? srv_undo_dir : mysql_data_home;

ds_data = ds_create(dst_dir, DS_TYPE_LOCAL);
dst_dir = (srv_undo_dir && *srv_undo_dir)
? srv_undo_dir : mysql_data_home;

for (ulong i = 1; i <= srv_undo_tablespaces; i++) {
char filename[20];
sprintf(filename, "undo%03lu", i);
if (!(ret = copy_or_move_file(filename, filename,
dst_dir, 1))) {
goto cleanup;
}
}
ds_data = ds_create(dst_dir, DS_TYPE_LOCAL);

ds_destroy(ds_data);
ds_data = NULL;
for (uint i = 1; i <= TRX_SYS_MAX_UNDO_SPACES; i++) {
char filename[20];
sprintf(filename, "undo%03u", i);
if (!file_exists(filename)) {
break;
}
if (!(ret = copy_or_move_file(filename, filename,
dst_dir, 1))) {
goto cleanup;
}
}

ds_destroy(ds_data);
ds_data = NULL;

/* copy redo logs */

dst_dir = (srv_log_group_home_dir && *srv_log_group_home_dir)
? srv_log_group_home_dir : mysql_data_home;

Expand Down Expand Up @@ -1825,7 +1830,7 @@ copy_back()
}
}

/* copy buufer pool dump */
/* copy buffer pool dump */

if (innobase_buffer_pool_filename) {
const char *src_name;
Expand Down
2 changes: 1 addition & 1 deletion extra/mariabackup/xtrabackup.cc
Expand Up @@ -2836,7 +2836,7 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
/* We found a symlink or a file */
if (strlen(fileinfo.name) > 4) {
bool is_isl= false;
if (ends_with(fileinfo.name, ".ibd") || ((is_isl = ends_with(fileinfo.name, ".ibd"))))
if (ends_with(fileinfo.name, ".ibd") || ((is_isl = ends_with(fileinfo.name, ".isl"))))
(*callback)(dbinfo.name, fileinfo.name, is_isl);
}
}
Expand Down
1 change: 1 addition & 0 deletions include/my_alloc.h
Expand Up @@ -43,6 +43,7 @@ typedef struct st_mem_root
/* if block have less memory it will be put in 'used' list */
size_t min_malloc;
size_t block_size; /* initial block size */
size_t total_alloc;
unsigned int block_num; /* allocated blocks counter */
/*
first free block in queue test counter (if it exceed
Expand Down
1 change: 1 addition & 0 deletions include/mysql.h.pp
Expand Up @@ -238,6 +238,7 @@
USED_MEM *pre_alloc;
size_t min_malloc;
size_t block_size;
size_t total_alloc;
unsigned int block_num;
unsigned int first_block_usage;
void (*error_handler)(void);
Expand Down
2 changes: 1 addition & 1 deletion include/source_revision.h.in
@@ -1 +1 @@
#cmakedefine SOURCE_REVISION "@SOURCE_REVISION@"
#define SOURCE_REVISION "@SOURCE_REVISION@"
1 change: 1 addition & 0 deletions libmysqld/CMakeLists.txt
Expand Up @@ -118,6 +118,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/temporary_tables.cc
../sql/session_tracker.cc
../sql/proxy_protocol.cc
../sql/sql_tvc.cc ../sql/sql_tvc.h
../sql/item_vers.cc
../sql/vtmd.cc
${GEN_SOURCES}
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/extra/binlog_tests/binlog_index.inc
Expand Up @@ -18,7 +18,7 @@ call mtr.add_suppression('Attempting backtrace');
call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to process registered files that would be purged.');
call mtr.add_suppression('MYSQL_BIN_LOG::open failed to sync the index file');
call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.');
call mtr.add_suppression('Could not open .*');
call mtr.add_suppression('Could not use .*');
call mtr.add_suppression('MYSQL_BIN_LOG::purge_logs failed to clean registers before purging logs.');
flush tables;

Expand Down
4 changes: 2 additions & 2 deletions mysql-test/extra/rpl_tests/rpl_binlog_errors.inc
Expand Up @@ -286,7 +286,7 @@ SET GLOBAL debug_dbug=@old_debug;
### file or failure to write the rotate event.

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

RESET MASTER;
SHOW WARNINGS;
Expand Down Expand Up @@ -392,7 +392,7 @@ RESET MASTER;

call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*");
call mtr.add_suppression("Error writing file .*");
call mtr.add_suppression("Could not open .*");
call mtr.add_suppression("Could not use .*");
call mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file.");
call mtr.add_suppression("Can't generate a unique log-filename .*");
-- echo ###################### TEST #13
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/include/check-testcase.test
Expand Up @@ -82,6 +82,8 @@ call mtr.check_testcase();

let $datadir=`select @@datadir`;
list_files $datadir mysql_upgrade_info;
list_files $datadir/test #sql*;
list_files $datadir/mysql #sql*;

--enable_query_log

6 changes: 4 additions & 2 deletions mysql-test/include/mtr_check.sql
Expand Up @@ -39,12 +39,14 @@ BEGIN

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

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

-- The test database should not contain any tables
SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES
Expand Down
12 changes: 6 additions & 6 deletions mysql-test/mysql-test-run.pl
Expand Up @@ -1917,10 +1917,10 @@ ()
#print "Major: $1 Minor: $2 Build: $3\n";
$mysql_version_id= $1*10000 + $2*100 + $3;
#print "mysql_version_id: $mysql_version_id\n";
mtr_report("MySQL Version $1.$2.$3");
mtr_report("MariaDB Version $1.$2.$3");
$mysql_version_extra= $4;
}
mtr_error("Could not find version of MySQL") unless $mysql_version_id;
mtr_error("Could not find version of MariaDBL") unless $mysql_version_id;
}

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

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

# copy all files from std_data into var/std_data
Expand Down Expand Up @@ -4397,12 +4397,12 @@ ($$)
qr/Slave I\/O: error reconnecting to master '.*' - retry-time: [1-3] retries/,
qr/Slave I\/0: Master command COM_BINLOG_DUMP failed/,
qr/Error reading packet/,
qr/Lost connection to MySQL server at 'reading initial communication packet'/,
qr/Lost connection to MariaDB server at 'reading initial communication packet'/,
qr/Failed on request_dump/,
qr/Slave: Can't drop database.* database doesn't exist/,
qr/Slave: Operation DROP USER failed for 'create_rout_db'/,
qr|Checking table: '\..mtr.test_suppressions'|,
qr|Table \./test/bug53592 has a primary key in InnoDB data dictionary, but not in MySQL|,
qr|Table \./test/bug53592 has a primary key in InnoDB data dictionary, but not in|,
qr|Table '\..mtr.test_suppressions' is marked as crashed and should be repaired|,
qr|Table 'test_suppressions' is marked as crashed and should be repaired|,
qr|Can't open shared library|,
Expand Down
3 changes: 2 additions & 1 deletion mysql-test/r/compound.result
Expand Up @@ -112,7 +112,8 @@ select @a|
/**/ while (select count(*) from information_schema.tables where table_schema='test')
do
select concat('drop table ', table_name) into @a
from information_schema.tables where table_schema='test' limit 1;
from information_schema.tables where table_schema='test'
order by table_name limit 1;
select @a as 'executing:';
prepare dt from @a;
execute dt;
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/r/create.result
Expand Up @@ -1173,6 +1173,7 @@ t1 CREATE TABLE `t1` (
`MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0,
`PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000,
`MEMORY_USED` bigint(7) NOT NULL DEFAULT 0,
`MAX_MEMORY_USED` bigint(7) NOT NULL DEFAULT 0,
`EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0,
`QUERY_ID` bigint(4) NOT NULL DEFAULT 0,
`INFO_BINARY` blob DEFAULT NULL,
Expand All @@ -1196,6 +1197,7 @@ t1 CREATE TEMPORARY TABLE `t1` (
`MAX_STAGE` tinyint(2) NOT NULL DEFAULT 0,
`PROGRESS` decimal(7,3) NOT NULL DEFAULT 0.000,
`MEMORY_USED` bigint(7) NOT NULL DEFAULT 0,
`MAX_MEMORY_USED` bigint(7) NOT NULL DEFAULT 0,
`EXAMINED_ROWS` int(7) NOT NULL DEFAULT 0,
`QUERY_ID` bigint(4) NOT NULL DEFAULT 0,
`INFO_BINARY` blob DEFAULT NULL,
Expand Down
68 changes: 68 additions & 0 deletions mysql-test/r/cte_nonrecursive.result
Expand Up @@ -1079,3 +1079,71 @@ id select_type table type possible_keys key key_len ref rows Extra
3 DERIVED t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
NULL UNION RESULT <union1,4> ALL NULL NULL NULL NULL NULL
DROP TABLE t1,t2;
#
# MDEV-13780: tower of embedding CTEs with multiple usage of them
#
create table t1 (a int);
insert into t1 values (3), (2), (4), (7), (1), (2), (5);
with cte_e as
(
with cte_o as
(
with cte_i as (select * from t1 where a < 7)
select * from cte_i where a > 1
)
select * from cte_o as cto_o1 where a < 3
union
select * from cte_o as cto_o2 where a > 4
)
select * from cte_e as cte_e1 where a > 1
union
select * from cte_e as cte_e2;
a
2
5
explain extended with cte_e as
(
with cte_o as
(
with cte_i as (select * from t1 where a < 7)
select * from cte_i where a > 1
)
select * from cte_o as cto_o1 where a < 3
union
select * from cte_o as cto_o2 where a > 4
)
select * from cte_e as cte_e1 where a > 1
union
select * from cte_e as cte_e2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 14 100.00 Using where
2 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where
5 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
NULL UNION RESULT <union2,5> ALL NULL NULL NULL NULL NULL NULL
6 UNION <derived9> ALL NULL NULL NULL NULL 14 100.00
9 DERIVED t1 ALL NULL NULL NULL NULL 7 100.00 Using where
12 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
NULL UNION RESULT <union9,12> ALL NULL NULL NULL NULL NULL NULL
NULL UNION RESULT <union1,6> ALL NULL NULL NULL NULL NULL NULL
Warnings:
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`
drop table t1;
#
# MDEV-13753: embedded CTE in a VIEW created in prepared statement
#
SET @sql_query = "
CREATE OR REPLACE VIEW cte_test AS
WITH cte1 AS ( SELECT 1 as a from dual )
, cte2 AS ( SELECT * FROM cte1 )
SELECT * FROM cte2;
";
PREPARE stmt FROM @sql_query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SHOW CREATE VIEW cte_test;
View Create View character_set_client collation_connection
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
SELECT * FROM cte_test;
a
1
DROP VIEW cte_test;
45 changes: 45 additions & 0 deletions mysql-test/r/cte_recursive.result
Expand Up @@ -2881,3 +2881,48 @@ f
2
set standard_compliant_cte=default;
DROP TABLE t;
#
# mdev-14184: recursive CTE embedded into CTE with multiple references
#
WITH
cte1 AS (
SELECT n FROM (
WITH RECURSIVE rec_cte(n) AS (
SELECT 1 as n1
UNION ALL
SELECT n+1 as n2 FROM rec_cte WHERE n < 3
) SELECT n FROM rec_cte
) AS X
),
cte2 as (
SELECT 2 FROM cte1
)
SELECT *
FROM cte1;
n
1
2
3
#
# MDEV-14217 [db crash] Recursive CTE when SELECT includes new field
#
CREATE TEMPORARY TABLE a_tbl (
a VARCHAR(33) PRIMARY KEY,
b VARCHAR(33)
);
INSERT INTO a_tbl VALUES ('block0', 'block0'), ('block1', NULL);
WITH RECURSIVE Q0 AS (
SELECT T0.a, T0.b, 5
FROM a_tbl T0
WHERE b IS NULL
UNION ALL
SELECT T1.a, T1.b
FROM Q0
JOIN a_tbl T1
ON T1.a=Q0.a
) SELECT distinct(Q0.a), Q0.b
FROM Q0;
ERROR 21000: The used SELECT statements have a different number of columns
DROP TABLE a_tbl;
WITH RECURSIVE x AS (SELECT 1,2 UNION ALL SELECT 1 FROM x) SELECT * FROM x;
ERROR 21000: The used SELECT statements have a different number of columns
6 changes: 3 additions & 3 deletions mysql-test/r/default.result
Expand Up @@ -232,7 +232,7 @@ CREATE TABLE t1 (a INT DEFAULT 10);
INSERT INTO t1 VALUES (11);
CREATE VIEW v1 AS SELECT a AS a FROM t1;
CREATE VIEW v2 AS SELECT DEFAULT(a) AS a FROM t1;
CREATE VIEW v3 AS SELECT VALUES(a) AS a FROM t1;
CREATE VIEW v3 AS SELECT VALUE(a) AS a FROM t1;
SELECT * FROM v1;
a
11
Expand Down Expand Up @@ -546,8 +546,8 @@ CREATE PROCEDURE p1() CREATE TABLE t1 (a INT DEFAULT par);
CALL p1;
ERROR 42S22: Unknown column 'par' in 'DEFAULT'
DROP PROCEDURE p1;
CREATE TABLE t1 (a INT DEFAULT VALUES(a));
ERROR HY000: Function or expression 'values()' cannot be used in the DEFAULT clause of `a`
CREATE TABLE t1 (a INT DEFAULT VALUE(a));
ERROR HY000: Function or expression 'value()' cannot be used in the DEFAULT clause of `a`
CREATE TABLE t1 (a INT);
CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CREATE TABLE t2 (a INT DEFAULT NEW.a);
ERROR HY000: Function or expression 'NEW.a' cannot be used in the DEFAULT clause of `a`
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/r/delimiter_command_case_sensitivity.result
@@ -0,0 +1,2 @@
1
1

0 comments on commit 497c6ad

Please sign in to comment.