1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

Merge 11.4 into 11.8

This commit is contained in:
Marko Mäkelä
2026-04-01 15:03:59 +03:00
136 changed files with 2791 additions and 1472 deletions

View File

@@ -2812,7 +2812,7 @@ static uint dump_events_for_db(char *db)
C_STRING_WITH_LEN(" EVENT"));
fprintf(sql_file,
"/*!50106 %s */ %s\n",
"/*!50106 %s \n*/ %s\n",
(const char *) (query_str != NULL ? query_str : row[3]),
(const char *) delimiter);
@@ -3038,7 +3038,8 @@ static uint dump_routines_for_db(char *db)
fprintf(sql_file,
"DELIMITER ;;\n"
"%s ;;\n"
"%s\n"
";;\n"
"DELIMITER ;\n",
(const char *) row[2]);
@@ -3415,13 +3416,13 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
The actual column value doesn't matter anyway, since the view will
be dropped at run time.
*/
fprintf(sql_file, " 1 AS %s",
fprintf(sql_file, " NULL AS %s",
quote_name(row[0], name_buff, 0));
while((row= mysql_fetch_row(result)))
{
/* col name, col type */
fprintf(sql_file, ",\n 1 AS %s",
fprintf(sql_file, ",\n NULL AS %s",
quote_name(row[0], name_buff, 0));
}
@@ -3976,7 +3977,7 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs,
C_STRING_WITH_LEN(" TRIGGER"));
fprintf(sql_file,
"DELIMITER ;;\n"
"/*!50003 %s */;;\n"
"/*!50003 %s \n*/;;\n"
"DELIMITER ;\n",
(const char *) (query_str != NULL ? query_str : row[2]));

View File

@@ -6244,7 +6244,7 @@ void func_abs(Expression_value args[], int count, Expression_value *result)
if (!args[0].is_numeric)
die("abs() requires numeric argument");
result->set_int(abs(args[0].to_int()));
result->set_int(llabs(args[0].to_int()));
}

0
debian/mariadb-server.links vendored Normal file → Executable file
View File

View File

@@ -281,7 +281,9 @@ local_close(ds_file_t *file)
ret = set_eof(fd);
}
my_close(fd, MYF(MY_WME));
if (my_close(fd, MYF(MY_WME)) != 0)
ret= 1;
my_free(file);
return ret;
}

View File

@@ -1889,3 +1889,74 @@ ANALYZE
}
}
drop table t1, t2;
#
# MDEV#37904: Valgrind warning - uninitialized value in tag_to_json()
#
CREATE TABLE t1 (a VARCHAR(8)) DEFAULT CHARSET latin7;
INSERT INTO t1 VALUES ('x'),('xx');
CREATE TABLE t2 (b varchar(8)) DEFAULT CHARSET latin7;
INSERT INTO t2 VALUES ('foo'),('bar');
ANALYZE FORMAT=JSON
SELECT b FROM t2 WHERE 'x' IN (SELECT a FROM t1);
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 2,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 50,
"r_total_filtered": 100,
"attached_condition": "t1.a = 'x'",
"r_filtered": 100,
"first_match": ""
}
},
{
"block-nl-join": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": REPLACED,
"filtered": 100,
"r_total_filtered": 100,
"r_filtered": 100
},
"buffer_type": "flat",
"buffer_size": "120",
"join_type": "BNL",
"r_loops": 1,
"r_filtered": 100,
"r_unpack_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_effective_rows": 2
}
}
]
}
}
DROP TABLE t1, t2;
End of 10.11 tests

View File

@@ -369,3 +369,19 @@ delete from t1
where t1.pk > (select max(a) from t2 where t2.pk+1 = t1.pk+1 ) - 10;
drop table t1, t2;
--echo #
--echo # MDEV#37904: Valgrind warning - uninitialized value in tag_to_json()
--echo #
CREATE TABLE t1 (a VARCHAR(8)) DEFAULT CHARSET latin7;
INSERT INTO t1 VALUES ('x'),('xx');
CREATE TABLE t2 (b varchar(8)) DEFAULT CHARSET latin7;
INSERT INTO t2 VALUES ('foo'),('bar');
--source include/analyze-format.inc
ANALYZE FORMAT=JSON
SELECT b FROM t2 WHERE 'x' IN (SELECT a FROM t1);
DROP TABLE t1, t2;
--echo End of 10.11 tests

View File

@@ -751,7 +751,8 @@ COLLATION(_utf8 'текст') AS c6,
@@character_set_client AS c8;
SET ÐÁÒÁÍ1 = 'a';
SET ÐÁÒÁÍ2 = 'b';
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -785,7 +786,8 @@ COLLATION(_utf8 'текст') AS c6,
@@character_set_client AS c8;
SET ÐÁÒÁÍ1 = 'a';
SET ÐÁÒÁÍ2 = 'b';
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -828,7 +830,8 @@ COLLATION(_utf8 'текст') AS c6,
@@character_set_client AS c8;
SET ÐÁÒÁÍ1 = 'a';
SET ÐÁÒÁÍ2 = 'b';
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -862,7 +865,8 @@ COLLATION(_utf8 'текст') AS c6,
@@character_set_client AS c8;
SET ÐÁÒÁÍ1 = 'a';
SET ÐÁÒÁÍ2 = 'b';
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -1768,7 +1772,8 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = _koi8r 'ÔÅËÓÔ';
SET @a2 = _utf8 'текÑ<C2BA>Ñ‚';
END */;;
END
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -1797,7 +1802,8 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = _koi8r 'ÔÅËÓÔ';
SET @b2 = _utf8 'текÑ<C2BA>Ñ‚';
END */;;
END
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -1851,7 +1857,8 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'ÔÅËÓÔ';
SET @a1 = _koi8r 'ÔÅËÓÔ';
SET @a2 = _utf8 'текÑ<C2BA>Ñ‚';
END */;;
END
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -1880,7 +1887,8 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'ÔÅËÓÔ';
SET @b1 = _koi8r 'ÔÅËÓÔ';
SET @b2 = _utf8 'текÑ<C2BA>Ñ‚';
END */;;
END
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -2522,7 +2530,8 @@ COLLATION(_koi8r '
COLLATION(_utf8 'текÑ<C2BA>Ñ‚') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END */ ;;
END
*/ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -2550,7 +2559,8 @@ COLLATION(_koi8r '
COLLATION(_utf8 'текÑ<C2BA>Ñ‚') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END */ ;;
END
*/ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -2590,7 +2600,8 @@ COLLATION(_koi8r '
COLLATION(_utf8 'текÑ<C2BA>Ñ‚') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END */ ;;
END
*/ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -2618,7 +2629,8 @@ COLLATION(_koi8r '
COLLATION(_utf8 'текÑ<C2BA>Ñ‚') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END */ ;;
END
*/ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;

View File

@@ -751,7 +751,8 @@ COLLATION(_koi8r '
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -785,7 +786,8 @@ COLLATION(_koi8r '
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -828,7 +830,8 @@ COLLATION(_koi8r '
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -862,7 +865,8 @@ COLLATION(_koi8r '
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -1768,7 +1772,8 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑ<C2BA>Ñ‚';
SET @a2 = _utf8 'текÑ<C2BA>Ñ‚';
SET @a3 = _koi8r 'ÔÅËÓÔ';
END */;;
END
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -1797,7 +1802,8 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑ<C2BA>Ñ‚';
SET @b2 = _utf8 'текÑ<C2BA>Ñ‚';
SET @b3 = _koi8r 'ÔÅËÓÔ';
END */;;
END
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -1851,7 +1857,8 @@ INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текÑ<C2BA>Ñ‚';
SET @a2 = _utf8 'текÑ<C2BA>Ñ‚';
SET @a3 = _koi8r 'ÔÅËÓÔ';
END */;;
END
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -1880,7 +1887,8 @@ INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текÑ<C2BA>Ñ‚';
SET @b2 = _utf8 'текÑ<C2BA>Ñ‚';
SET @b3 = _koi8r 'ÔÅËÓÔ';
END */;;
END
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -2522,7 +2530,8 @@ COLLATION(_utf8 'текст') AS c3,
COLLATION(_koi8r 'ÔÅËÓÔ') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END */ ;;
END
*/ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -2550,7 +2559,8 @@ COLLATION(_utf8 'текст') AS c3,
COLLATION(_koi8r 'ÔÅËÓÔ') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END */ ;;
END
*/ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -2590,7 +2600,8 @@ COLLATION(_utf8 'текст') AS c3,
COLLATION(_koi8r 'ÔÅËÓÔ') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END */ ;;
END
*/ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -2618,7 +2629,8 @@ COLLATION(_utf8 'текст') AS c3,
COLLATION(_koi8r 'ÔÅËÓÔ') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END */ ;;
END
*/ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;

View File

@@ -0,0 +1,21 @@
#
# MDEV-34482 visibility of event worker threads to non-privileded user
#
call mtr.add_suppression("Event Scheduler: .*Query execution was interrupted");
CREATE USER u@localhost;
GRANT EVENT ON *.* TO u@localhost;
SET GLOBAL event_scheduler = ON;
connect c1,localhost,u,,;
CREATE EVENT e
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 0.1 SECOND
DO SELECT SLEEP(10000);
show processlist;
Id User Host db Command Time State Info Progress
# u localhost test Query 0 starting show processlist 0.000
# u localhost test Connect 0 User sleep SELECT SLEEP(10000) 0.000
KILL QUERY id;
disconnect c1;
connection default;
SET GLOBAL event_scheduler = OFF;
DROP EVENT e;
DROP USER u@localhost;

View File

@@ -0,0 +1,52 @@
--source include/not_embedded.inc
--echo #
--echo # MDEV-34482 visibility of event worker threads to non-privileded user
--echo #
call mtr.add_suppression("Event Scheduler: .*Query execution was interrupted");
# Verify that a user without PROCESS privilege can see their own events
# run by event scheduler.
CREATE USER u@localhost;
GRANT EVENT ON *.* TO u@localhost;
# Ensure event scheduler running
SET GLOBAL event_scheduler = ON;
--source include/running_event_scheduler.inc
# Connect as the unprivileged user and create an event that runs a long sleep
connect c1,localhost,u,,;
CREATE EVENT e
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 0.1 SECOND
DO SELECT SLEEP(10000);
# Wait until the event worker appears in PROCESSLIST for the current user
let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE INFO LIKE '%SLEEP(10000)%' AND ID <> CONNECTION_ID();
--source include/wait_condition.inc
# Check that show processlist works
--replace_column 1 #
--replace_regex /:[0-9]+// /Execute/Query/
show processlist;
# Stop event execution
let $id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%SLEEP(10000)%' AND ID <> CONNECTION_ID()`;
--replace_result $id id
eval KILL QUERY $id;
# Cleanup
--disconnect c1
--connection default
SET GLOBAL event_scheduler = OFF;
--error 0,ER_EVENT_DOES_NOT_EXIST
DROP EVENT e;
--source include/check_events_off.inc
let $count_sessions= 1;
--source include/wait_until_count_sessions.inc
DROP USER u@localhost;

View File

@@ -2835,6 +2835,54 @@ SELECT ( WITH x AS ( WITH x AS ( SELECT 1.000000 ) SELECT ( REPEAT ( ( json_norm
#
SELECT JSON_SET('{"c":4}', '$.a', 5) AS x HAVING (x IN (JSON_KEYS(x), ','));
x
#
# MDEV-38264 Assertion in json_find_path() fails after computing
# array size of invalid json structure
#
SELECT JSON_QUERY('{ "A": [0,] }', '$.A[-1]');
JSON_QUERY('{ "A": [0,] }', '$.A[-1]')
NULL
SELECT JSON_VALUE('{ "A": [0,] }', '$.A[-1]');
JSON_VALUE('{ "A": [0,] }', '$.A[-1]')
NULL
SELECT JSON_VALUE('{ "A": [5,] }', '$.A[-2]');
JSON_VALUE('{ "A": [5,] }', '$.A[-2]')
NULL
SELECT JSON_VALUE('{ "A": [5] }', '$.A[-2]');
JSON_VALUE('{ "A": [5] }', '$.A[-2]')
NULL
SELECT JSON_LENGTH('{ "A": [0,] }', '$.A');
JSON_LENGTH('{ "A": [0,] }', '$.A')
NULL
Warnings:
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_length' at position 11
SELECT JSON_VALID('{ "A": [0,] }');
JSON_VALID('{ "A": [0,] }')
0
#
# MDEV-38264 Assertion in json_find_path() fails after computing
# array size of invalid json structure
#
SELECT JSON_QUERY('{ "A": [0,] }', '$.A[-1]');
JSON_QUERY('{ "A": [0,] }', '$.A[-1]')
NULL
SELECT JSON_VALUE('{ "A": [0,] }', '$.A[-1]');
JSON_VALUE('{ "A": [0,] }', '$.A[-1]')
NULL
SELECT JSON_VALUE('{ "A": [5,] }', '$.A[-2]');
JSON_VALUE('{ "A": [5,] }', '$.A[-2]')
NULL
SELECT JSON_VALUE('{ "A": [5] }', '$.A[-2]');
JSON_VALUE('{ "A": [5] }', '$.A[-2]')
NULL
SELECT JSON_LENGTH('{ "A": [0,] }', '$.A');
JSON_LENGTH('{ "A": [0,] }', '$.A')
NULL
Warnings:
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_length' at position 11
SELECT JSON_VALID('{ "A": [0,] }');
JSON_VALID('{ "A": [0,] }')
0
# End of 10.11 Test
#
# MDEV-32007: JSON_VALUE and JSON_EXTRACT doesn't handle dash (-)

View File

@@ -2045,6 +2045,30 @@ SELECT ( WITH x AS ( WITH x AS ( SELECT 1.000000 ) SELECT ( REPEAT ( ( json_norm
SELECT JSON_SET('{"c":4}', '$.a', 5) AS x HAVING (x IN (JSON_KEYS(x), ','));
--echo #
--echo # MDEV-38264 Assertion in json_find_path() fails after computing
--echo # array size of invalid json structure
--echo #
SELECT JSON_QUERY('{ "A": [0,] }', '$.A[-1]');
SELECT JSON_VALUE('{ "A": [0,] }', '$.A[-1]');
SELECT JSON_VALUE('{ "A": [5,] }', '$.A[-2]');
SELECT JSON_VALUE('{ "A": [5] }', '$.A[-2]');
SELECT JSON_LENGTH('{ "A": [0,] }', '$.A');
SELECT JSON_VALID('{ "A": [0,] }');
--echo #
--echo # MDEV-38264 Assertion in json_find_path() fails after computing
--echo # array size of invalid json structure
--echo #
SELECT JSON_QUERY('{ "A": [0,] }', '$.A[-1]');
SELECT JSON_VALUE('{ "A": [0,] }', '$.A[-1]');
SELECT JSON_VALUE('{ "A": [5,] }', '$.A[-2]');
SELECT JSON_VALUE('{ "A": [5] }', '$.A[-2]');
SELECT JSON_LENGTH('{ "A": [0,] }', '$.A');
SELECT JSON_VALID('{ "A": [0,] }');
--echo # End of 10.11 Test
--echo #

View File

@@ -475,3 +475,25 @@ DROP USER foo@localhost;
CREATE USER foo@localhost IDENTIFIED VIA not_installed_plugin;
ERROR HY000: Plugin 'not_installed_plugin' is not loaded
# End of 10.5 tests
#
# MDEV-37256: The permission check of LOAD INDEX INTO CACHE and CACHE INDEX is broken
#
create table t1 (c int primary key);
insert t1 values (1),(2);
create user foo@localhost;
connect foo,localhost,foo;
use test;
ERROR 42000: Access denied for user 'foo'@'localhost' to database 'test'
cache index test.t1 in default;
ERROR 42000: CACHE INDEX command denied to user 'foo'@'localhost' for table `test`.`t1`
load index into cache test.t1 key (primary);
ERROR 42000: LOAD INDEX INTO CACHE command denied to user 'foo'@'localhost' for table `test`.`t1`
cache index test.t2 in default;
ERROR 42000: CACHE INDEX command denied to user 'foo'@'localhost' for table `test`.`t2`
load index into cache test.t2 key (i2);
ERROR 42000: LOAD INDEX INTO CACHE command denied to user 'foo'@'localhost' for table `test`.`t2`
disconnect foo;
connection default;
drop table t1;
drop user foo@localhost;
# End of 10.11 tests

View File

@@ -437,3 +437,29 @@ DROP USER foo@localhost;
CREATE USER foo@localhost IDENTIFIED VIA not_installed_plugin;
--echo # End of 10.5 tests
--echo #
--echo # MDEV-37256: The permission check of LOAD INDEX INTO CACHE and CACHE INDEX is broken
--echo #
create table t1 (c int primary key);
insert t1 values (1),(2);
create user foo@localhost;
--connect foo,localhost,foo
--error ER_DBACCESS_DENIED_ERROR
use test;
--error ER_TABLEACCESS_DENIED_ERROR
cache index test.t1 in default;
--error ER_TABLEACCESS_DENIED_ERROR
load index into cache test.t1 key (primary);
--error ER_TABLEACCESS_DENIED_ERROR
# Check that the error for non-existing and existing tables are the same
cache index test.t2 in default;
--error ER_TABLEACCESS_DENIED_ERROR
load index into cache test.t2 key (i2);
--disconnect foo
--connection default
# Cleanup
drop table t1;
drop user foo@localhost;
--echo # End of 10.11 tests

View File

@@ -34,7 +34,7 @@ USE `mysqltest2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v2` AS SELECT
1 AS `a` */;
NULL AS `a` */;
SET character_set_client = @saved_cs_client;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest3` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci */;
@@ -43,27 +43,27 @@ USE `mysqltest3`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v3` AS SELECT
1 AS `a` */;
NULL AS `a` */;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v3i` AS SELECT
1 AS `a` */;
NULL AS `a` */;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v3is` AS SELECT
1 AS `schema_name` */;
NULL AS `schema_name` */;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v3nt` AS SELECT
1 AS `1` */;
NULL AS `1` */;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v3ps` AS SELECT
1 AS `user` */;
NULL AS `user` */;
SET character_set_client = @saved_cs_client;
USE `mysqltest1`;
@@ -239,7 +239,7 @@ connection default;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v1` AS SELECT
1 AS `id` */;
NULL AS `id` */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;

View File

@@ -92,7 +92,8 @@ DELIMITER ;;
CREATE DEFINER="root"@"localhost" PROCEDURE "p1"(a INT)
AS BEGIN
NULL;
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;

View File

@@ -56,7 +56,7 @@ SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v1
1v` AS SELECT
1 AS `foobar
NULL AS `foobar
raboof` */;
SET character_set_client = @saved_cs_client;
@@ -75,7 +75,8 @@ SET character_set_client = @saved_cs_client;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp`()
select * from `v1
1v` ;;
1v`
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;

View File

@@ -2284,7 +2284,7 @@ DROP TABLE IF EXISTS `v2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v2` AS SELECT
1 AS `a` */;
NULL AS `a` */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
@@ -2380,7 +2380,7 @@ DROP TABLE IF EXISTS `v1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v1` AS SELECT
1 AS `a` */;
NULL AS `a` */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
@@ -2461,7 +2461,7 @@ DROP TABLE IF EXISTS `v2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v2` AS SELECT
1 AS `a` */;
NULL AS `a` */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
@@ -2585,25 +2585,25 @@ DROP TABLE IF EXISTS `v1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v1` AS SELECT
1 AS `a`,
1 AS `b`,
1 AS `c` */;
NULL AS `a`,
NULL AS `b`,
NULL AS `c` */;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v2` AS SELECT
1 AS `a` */;
NULL AS `a` */;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `v3`;
/*!50001 DROP VIEW IF EXISTS `v3`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v3` AS SELECT
1 AS `a`,
1 AS `b`,
1 AS `c` */;
NULL AS `a`,
NULL AS `b`,
NULL AS `c` */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
@@ -2755,7 +2755,8 @@ if new.a > 10 then
set new.a := 10;
set new.a := 11;
end if;
end */;;
end
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -2772,7 +2773,8 @@ DELIMITER ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg2 before update on t1 for each row begin
if old.a % 2 = 0 then set new.b := 12; end if;
end */;;
end
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -2792,7 +2794,8 @@ begin
if new.a = -1 then
set @fired:= "Yes";
end if;
end */;;
end
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -2827,7 +2830,8 @@ begin
if new.a > 10 then
set @fired:= "No";
end if;
end */;;
end
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -3047,7 +3051,8 @@ SET AUTOCOMMIT=@OLD_AUTOCOMMIT;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11)
RETURN a+b ;;
RETURN a+b
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -3067,7 +3072,8 @@ CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func2`(f1 char binary) RETUR
begin
set f1= concat( 'hello', f1 );
return f1;
end ;;
end
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -3084,7 +3090,8 @@ DELIMITER ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
DELIMITER ;;
CREATE DEFINER="root"@"localhost" PROCEDURE "a'b"()
select 1 ;;
select 1
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -3101,7 +3108,8 @@ DELIMITER ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
BEGIN SELECT a+b INTO c; end ;;
BEGIN SELECT a+b INTO c; end
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -3120,7 +3128,8 @@ DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc2`(OUT a INT)
BEGIN
select sum(id) from t1 into a;
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -3306,7 +3315,8 @@ SET AUTOCOMMIT=@OLD_AUTOCOMMIT;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
INSERT INTO `t2 test` SET a2 = NEW.a1; END */;;
INSERT INTO `t2 test` SET a2 = NEW.a1; END
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -3399,27 +3409,27 @@ DROP TABLE IF EXISTS `v0`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v0` AS SELECT
1 AS `a`,
1 AS `b`,
1 AS `c` */;
NULL AS `a`,
NULL AS `b`,
NULL AS `c` */;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `v1`;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v1` AS SELECT
1 AS `a`,
1 AS `b`,
1 AS `c` */;
NULL AS `a`,
NULL AS `b`,
NULL AS `c` */;
SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v2` AS SELECT
1 AS `a`,
1 AS `b`,
1 AS `c` */;
NULL AS `a`,
NULL AS `b`,
NULL AS `c` */;
SET character_set_client = @saved_cs_client;
USE `test`;
@@ -3533,7 +3543,8 @@ DELIMITER ;;
FOR EACH ROW
BEGIN
SET new.a = 0;
END */;;
END
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -3821,7 +3832,7 @@ DROP TABLE IF EXISTS `v1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v1` AS SELECT
1 AS `id` */;
NULL AS `id` */;
SET character_set_client = @saved_cs_client;
USE `mysqldump_test_db`;
@@ -3883,7 +3894,7 @@ USE `mysqldump_views`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `nasishnasifu` AS SELECT
1 AS `id` */;
NULL AS `id` */;
SET character_set_client = @saved_cs_client;
USE `mysqldump_tables`;
@@ -4195,7 +4206,8 @@ mariadb-dump: user2 has insufficient privileges to SHOW CREATE PROCEDURE `sp1`!
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
DELIMITER ;;
CREATE DEFINER=`user1`@`%` PROCEDURE `sp1`()
select 'hello' ;;
select 'hello'
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -4330,7 +4342,7 @@ DROP TABLE IF EXISTS `v2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v2` AS SELECT
1 AS `c` */;
NULL AS `c` */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
@@ -4782,7 +4794,7 @@ DROP TABLE IF EXISTS `v1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v1` AS SELECT
1 AS `id` */;
NULL AS `id` */;
SET character_set_client = @saved_cs_client;
USE `mysqldump_test_db`;
@@ -5122,7 +5134,8 @@ ALTER DATABASE `test-database` CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `trig` BEFORE INSERT ON `test` FOR EACH ROW BEGIN
END */;;
END
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -5840,7 +5853,8 @@ ALTER DATABASE `a\"'``b` CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
/*!50003 SET collation_connection = utf8mb3_uca1400_ai_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
BEGIN END ;;
BEGIN END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -5903,7 +5917,7 @@ CREATE TABLE `nonunique_table_name` (
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `nonunique_table_view_name` AS SELECT
1 AS `1` */;
NULL AS `1` */;
SET character_set_client = @saved_cs_client;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db2` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci */;
@@ -6045,7 +6059,7 @@ SET AUTOCOMMIT=@OLD_AUTOCOMMIT;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `nonunique_table_view_name` AS SELECT
1 AS `1` */;
NULL AS `1` */;
SET character_set_client = @saved_cs_client;
USE `db2`;
@@ -6158,7 +6172,8 @@ USE `test`;
/*!50032 DROP TRIGGER IF EXISTS tt1_t1 */;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW
SET NEW.b=NEW.a + 10 */;;
SET NEW.b=NEW.a + 10
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -6969,7 +6984,8 @@ DELIMITER ;;
/*!50003 SET sql_mode = '' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO select not_a_value */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `e1` ON SCHEDULE EVERY 1 YEAR STARTS '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO select not_a_value
*/ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -6987,7 +7003,8 @@ DELIMITER ;
/*!50003 SET collation_connection = utf8mb3_uca1400_ai_ci */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `f2`() RETURNS int(11)
return 2 ;;
return 2
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -7033,7 +7050,7 @@ SET AUTOCOMMIT=@OLD_AUTOCOMMIT;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v'1"2` AS SELECT
1 AS `a` */;
NULL AS `a` */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP VIEW IF EXISTS `v'1"2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
@@ -7097,6 +7114,64 @@ drop table `con_schöne_grüße`;
drop table `con`;
drop table `con/bar`;
drop table `con@fame`;
#
# MDEV-36183 mariadb-dump backup corrupt if stored procedure ends with comment
#
CREATE TABLE t1 (f1 INT);
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @f1 = 1 #comment;
CREATE PROCEDURE pr1()
BEGIN
SELECT 1;
END
-- comment-end
$
CREATE TRIGGER tr2 BEFORE UPDATE ON t1 FOR EACH ROW
BEGIN
SET @f1 = 2;
END
-- comment-end
$
CREATE FUNCTION f1() RETURNS TINYINT DETERMINISTIC
BEGIN
RETURN 1;
END
-- comment-end
$
CREATE PROCEDURE pr2 () SELECT "a" #comment;
CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT "a" #comment;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
DROP PROCEDURE pr1;
DROP PROCEDURE pr2;
DROP TRIGGER tr1;
DROP TRIGGER tr2;
DROP TABLE t1;
DROP EVENT ev1;
DROP FUNCTION f1;
DROP PROCEDURE pr1;
DROP PROCEDURE pr2;
DROP TRIGGER tr1;
DROP TRIGGER tr2;
DROP TABLE t1;
DROP EVENT ev1;
DROP FUNCTION f1;
#
# MDEV-32770 mariadb-dump produces not loadable dump due to temporary view structure
#
create table t1 (f geometry);
create view v2 AS select f from t1;
create view v1 AS select st_contains(f,ST_GEOMFROMTEXT('POINT(1 1)')) from v2;
create database db;
create or replace table t1 (id varchar(20) not null, ip inet6 not null);
create or replace view v2 as select id, min(ip) as ip from t1 group by id;
create or replace view v1 as select coalesce(v2.ip, t1.ip) as ip from t1 left join v2 using(id);
create or replace view v4 as select cast(id as time) d1 from t1;
create or replace view v3 as select to_char(d1,'MM') c1 FROM v4;
create or replace database db;
drop view v3,v4;
drop database db;
drop view v1,v2;
drop table t1;
# End of 10.6 tests
#
# MDEV-16733 mysqldump --tab and --xml options are conflicting

View File

@@ -3077,6 +3077,87 @@ drop table `con`;
drop table `con/bar`;
drop table `con@fame`;
--echo #
--echo # MDEV-36183 mariadb-dump backup corrupt if stored procedure ends with comment
--echo #
CREATE TABLE t1 (f1 INT);
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @f1 = 1 #comment;
--delimiter $
CREATE PROCEDURE pr1()
BEGIN
SELECT 1;
END
-- comment-end
$
CREATE TRIGGER tr2 BEFORE UPDATE ON t1 FOR EACH ROW
BEGIN
SET @f1 = 2;
END
-- comment-end
$
CREATE FUNCTION f1() RETURNS TINYINT DETERMINISTIC
BEGIN
RETURN 1;
END
-- comment-end
$
--delimiter ;
CREATE PROCEDURE pr2 () SELECT "a" #comment;
CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT "a" #comment;
--exec $MYSQL_DUMP test --compact --routines --triggers --events > $MYSQL_TMP_DIR/1.dump
DROP PROCEDURE pr1;
DROP PROCEDURE pr2;
DROP TRIGGER tr1;
DROP TRIGGER tr2;
DROP TABLE t1;
DROP EVENT ev1;
DROP FUNCTION f1;
--exec $MYSQL test < $MYSQL_TMP_DIR/1.dump
DROP PROCEDURE pr1;
DROP PROCEDURE pr2;
DROP TRIGGER tr1;
DROP TRIGGER tr2;
DROP TABLE t1;
DROP EVENT ev1;
DROP FUNCTION f1;
--echo #
--echo # MDEV-32770 mariadb-dump produces not loadable dump due to temporary view structure
--echo #
create table t1 (f geometry);
create view v2 AS select f from t1;
create view v1 AS select st_contains(f,ST_GEOMFROMTEXT('POINT(1 1)')) from v2;
create database db;
--exec $MYSQL_DUMP test | $MYSQL db
create or replace table t1 (id varchar(20) not null, ip inet6 not null);
create or replace view v2 as select id, min(ip) as ip from t1 group by id;
create or replace view v1 as select coalesce(v2.ip, t1.ip) as ip from t1 left join v2 using(id);
create or replace view v4 as select cast(id as time) d1 from t1;
create or replace view v3 as select to_char(d1,'MM') c1 FROM v4;
create or replace database db;
--exec $MYSQL_DUMP test | $MYSQL db
drop view v3,v4;
# Cleanup
drop database db;
drop view v1,v2;
drop table t1;
--echo # End of 10.6 tests
--echo #

View File

@@ -198,3 +198,12 @@ SET SESSION transaction_isolation='REPEATABLE-READ';
-- tx_isolation: REPEATABLE-READ
# End of 11.1 tests
# Session tracking with database charset utf16
CREATE DATABASE testdb CHARACTER SET utf16;
# tracking info on once
USE testdb;
-- Tracker : SESSION_TRACK_SCHEMA
-- testdb
DROP DATABASE testdb;
# End of 11.4 tests

View File

@@ -1,4 +1,3 @@
--source include/no_protocol.inc
--source include/not_embedded.inc
@@ -179,3 +178,12 @@ SET SESSION transaction_isolation='REPEATABLE-READ';
--disable_session_track_info
--echo # End of 11.1 tests
--echo # Session tracking with database charset utf16
CREATE DATABASE testdb CHARACTER SET utf16;
--echo # tracking info on once
--enable_session_track_info ONCE
USE testdb;
DROP DATABASE testdb;
--echo # End of 11.4 tests

View File

@@ -11581,7 +11581,7 @@ SELECT 'a\0' LIMIT 0 {
"select_id": 1,
"steps": [
{
"expanded_query": "select 'a\0' AS `a\x00` limit 0"
"expanded_query": "select 'a\\0' AS `a\\x00` limit 0"
}
]
}
@@ -12949,6 +12949,65 @@ json_detailed(json_extract(trace, '$**.join_execution'))
NULL
set optimizer_trace='enabled=off';
drop table t1,t2,t3;
#
# MDEV-30354: Fix JSON escaping in optimizer trace output
#
set @saved_optimizer_trace=@@optimizer_trace;
set optimizer_trace='enabled=on';
# Test 1: Simple double quotes
SELECT LENGTH("a");
LENGTH("a")
1
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) AS expanded_query FROM information_schema.optimizer_trace;
valid_json expanded_query
1 ["select octet_length('a') AS `LENGTH(\"a\")`"]
# Test 2: Nested quotes
SELECT LENGTH("a\"b");
LENGTH("a\"b")
3
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) FROM information_schema.optimizer_trace;
valid_json json_detailed(json_extract(trace,'$**.expanded_query'))
1 ["select octet_length('a\"b') AS `LENGTH(\"a\\\"b\")`"]
# Test 3: Special characters with quotes
SELECT LENGTH("a\n\"b\t\"c");
LENGTH("a\n\"b\t\"c")
7
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) FROM information_schema.optimizer_trace;
valid_json json_detailed(json_extract(trace,'$**.expanded_query'))
1 ["select octet_length('a\\n\"b\\t\"c') AS `LENGTH(\"a\\n\\\"b\\t\\\"c\")`"]
# Test 4: New line
SELECT COLUMN_JSON(COLUMN_CREATE("foo", "New
line" AS CHAR));
COLUMN_JSON(COLUMN_CREATE("foo", "New
line" AS CHAR))
{"foo":"New\u000Aline"}
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) FROM information_schema.optimizer_trace;
valid_json json_detailed(json_extract(trace,'$**.expanded_query'))
1 ["select column_json(column_create('foo','New\\nline' AS char charset latin1 collate latin1_swedish_ci )) AS `COLUMN_JSON(COLUMN_CREATE(\"foo\", \"New\nline\" AS CHAR))`"]
# Test 5: Backslashes
SELECT LENGTH("a\\b");
LENGTH("a\\b")
3
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) FROM information_schema.optimizer_trace;
valid_json json_detailed(json_extract(trace,'$**.expanded_query'))
1 ["select octet_length('a\\\\b') AS `LENGTH(\"a\\\\b\")`"]
# Test 6: JSON functions
SELECT JSON_EXTRACT('{"key":"value"}', "$.key");
JSON_EXTRACT('{"key":"value"}', "$.key")
"value"
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) FROM information_schema.optimizer_trace;
valid_json json_detailed(json_extract(trace,'$**.expanded_query'))
1 ["select json_extract('{\"key\":\"value\"}','$.key') AS `JSON_EXTRACT('{\"key\":\"value\"}', \"$.key\")`"]
# Test 7: Failed escape due to illegal symbol
SET NAMES utf8mb4;
SELECT "𝄞" AS x;
x
𝄞
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) FROM information_schema.optimizer_trace;
valid_json json_detailed(json_extract(trace,'$**.expanded_query'))
1 ["Error: failed to escape query string for JSON output"]
SET NAMES DEFAULT;
set optimizer_trace=@saved_optimizer_trace;
# End of 10.11 tests
#
# Testing of records_out

View File

@@ -1239,6 +1239,47 @@ select json_detailed(json_extract(trace, '$**.join_execution'))
set optimizer_trace='enabled=off';
drop table t1,t2,t3;
--echo #
--echo # MDEV-30354: Fix JSON escaping in optimizer trace output
--echo #
set @saved_optimizer_trace=@@optimizer_trace;
set optimizer_trace='enabled=on';
--echo # Test 1: Simple double quotes
SELECT LENGTH("a");
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) AS expanded_query FROM information_schema.optimizer_trace;
--echo # Test 2: Nested quotes
SELECT LENGTH("a\"b");
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) FROM information_schema.optimizer_trace;
--echo # Test 3: Special characters with quotes
SELECT LENGTH("a\n\"b\t\"c");
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) FROM information_schema.optimizer_trace;
--echo # Test 4: New line
SELECT COLUMN_JSON(COLUMN_CREATE("foo", "New
line" AS CHAR));
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) FROM information_schema.optimizer_trace;
--echo # Test 5: Backslashes
SELECT LENGTH("a\\b");
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) FROM information_schema.optimizer_trace;
--echo # Test 6: JSON functions
SELECT JSON_EXTRACT('{"key":"value"}', "$.key");
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) FROM information_schema.optimizer_trace;
--echo # Test 7: Failed escape due to illegal symbol
SET NAMES utf8mb4;
SELECT "𝄞" AS x;
SELECT json_valid(trace) AS valid_json, json_detailed(json_extract(trace,'$**.expanded_query')) FROM information_schema.optimizer_trace;
SET NAMES DEFAULT;
set optimizer_trace=@saved_optimizer_trace;
--echo # End of 10.11 tests
--echo #

View File

@@ -2299,3 +2299,37 @@ improbable
drop table t1;
set global query_cache_type= @qcache;
# End of 10.10 tests
#
# MDEV-25365 Server hangs or crashes in Query_cache::move_by_type upon FLUSH QUERY CACHE
#
set @qcache= @@global.query_cache_type;
set global query_cache_type= on;
set query_cache_type= on;
create table t1 (a int);
create table t2 (b int);
create table t3 (c int);
create table t4 (d int);
create view v4 as select * from t4;
create table t5 (e int);
create view v5 as select * from t5;
create table t6 (f int);
create view v6 as select * from t6;
create table t7 (g int);
select * from t1, t2;
a b
select * from t2;
b
select t7.* from t3 t3a, t3 t3b, t3 t3c, t3 t3d, t3 t3e, v4 v4a, v4 v4b, v4 v4c, v4 v4d, v5, v6, t6, t7;
g
alter table t1 force;
select * from t5, t6 /* this query needs to be of a certain length, so i am trying to make the comment at least 175 symbols long. now i am out of ideas what to write, so.............................. */;
e f
flush QUERY cache;
reset query cache;
FLUSH query cache;
drop view v4;
drop view v5;
drop view v6;
drop table t1, t2, t3, t4, t5, t6, t7;
set global query_cache_type= @qcache;
# End of 10.11 tests

View File

@@ -1903,4 +1903,55 @@ set global query_cache_type= @qcache;
--echo # End of 10.10 tests
--echo #
--echo # MDEV-25365 Server hangs or crashes in Query_cache::move_by_type upon FLUSH QUERY CACHE
--echo #
set @qcache= @@global.query_cache_type;
set global query_cache_type= on;
set query_cache_type= on;
create table t1 (a int);
create table t2 (b int);
create table t3 (c int);
create table t4 (d int);
create view v4 as select * from t4;
create table t5 (e int);
create view v5 as select * from t5;
create table t6 (f int);
create view v6 as select * from t6;
create table t7 (g int);
# in the next 3 queries the exact tables or views seem to be important
# (but not the length of the query)
select * from t1, t2;
select * from t2;
select t7.* from t3 t3a, t3 t3b, t3 t3c, t3 t3d, t3 t3e, v4 v4a, v4 v4b, v4 v4c, v4 v4d, v5, v6, t6, t7;
# this most likely correlates with the first select,
# to kick it out from the cache but to keep everything else
alter table t1 force;
# here the length of the query and the presence of (at least) two tables
# seems to be important, while the exact tables are not
# the comment compensates for the length
select * from t5, t6 /* this query needs to be of a certain length, so i am trying to make the comment at least 175 symbols long. now i am out of ideas what to write, so.............................. */;
# this is the query cache magic which causes the hang or crash
flush QUERY cache;
reset query cache;
FLUSH query cache;
# cleanup
drop view v4;
drop view v5;
drop view v6;
drop table t1, t2, t3, t4, t5, t6, t7;
set global query_cache_type= @qcache;
--echo # End of 10.11 tests
--enable_ps2_protocol

View File

@@ -0,0 +1,76 @@
#
# Test with triggers that succeed
#
CREATE TABLE t1 (id INT PRIMARY KEY, val INT);
CREATE TABLE log (id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255));
INSERT INTO t1 VALUES (1, 1);
CREATE TRIGGER t1_before_update BEFORE UPDATE ON t1 FOR EACH ROW
INSERT INTO log (msg) VALUES ('before update');
CREATE TRIGGER t1_after_update AFTER UPDATE ON t1 FOR EACH ROW
INSERT INTO log (msg) VALUES ('after update');
#
# Normal UPDATE with no data change
# Expected: Both BEFORE and AFTER triggers fire.
#
TRUNCATE log;
UPDATE t1 SET val = 1 WHERE id = 1;
SELECT * FROM log ORDER BY id;
id msg
1 before update
2 after update
TRUNCATE log;
#
# INSERT ... ON DUPLICATE KEY UPDATE with no data change
# Expected: Both BEFORE and AFTER triggers fire.
#
INSERT INTO t1 (id, val) VALUES (1, 1) ON DUPLICATE KEY UPDATE val = 1;
SELECT * FROM log ORDER BY id;
id msg
1 before update
2 after update
TRUNCATE log;
#
# Part 2: Test with triggers that fail
#
DROP TRIGGER t1_before_update;
DROP TRIGGER t1_after_update;
#
# Failing BEFORE UPDATE trigger
#
CREATE TRIGGER t1_before_update_fail BEFORE UPDATE ON t1 FOR EACH ROW
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Error in BEFORE UPDATE';
#
# Normal UPDATE with no data change (fails due to BEFORE trigger)
#
UPDATE t1 SET val = 1 WHERE id = 1;
ERROR 45000: Error in BEFORE UPDATE
# INSERT ... ON DUPLICATE KEY UPDATE with no data change (fails due to BEFORE trigger)´
TRUNCATE log;
INSERT INTO t1 (id, val) VALUES (1, 1) ON DUPLICATE KEY UPDATE val = 1;
ERROR 45000: Error in BEFORE UPDATE
DROP TRIGGER t1_before_update_fail;
CREATE TRIGGER t1_before_update_log BEFORE UPDATE ON t1 FOR EACH ROW
INSERT INTO log (msg) VALUES ('before update');
CREATE TRIGGER t1_after_update_fail AFTER UPDATE ON t1 FOR EACH ROW
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Error in AFTER UPDATE';
#
# Failing AFTER UPDATE trigger
#
UPDATE t1 SET val = 1 WHERE id = 1;
ERROR 45000: Error in AFTER UPDATE
SELECT * FROM log ORDER BY id;
id msg
1 before update
TRUNCATE log;
#
# Test ON DUPLICATE KEY UPDATE with no data change (failing AFTER UPDATE trigger)
#
INSERT INTO t1 (id, val) VALUES (1, 1) ON DUPLICATE KEY UPDATE val = 1;
ERROR 45000: Error in AFTER UPDATE
SELECT * FROM log ORDER BY id;
id msg
1 before update
#
# Cleanup
#
DROP TABLE t1, log;

View File

@@ -0,0 +1,92 @@
#
# MDEV-33083 "AFTER UPDATE" trigger does not fire if no data change in "ON DUPLICATE KEY UPDATE"
# Verify that INSERT..ON DUPLICATE KEY UPDATE behaves the same as normal UPDATE wrt triggers
# in case of updates that do not change data. We expect both BEFORE and AFTER to be fired,
# and also the same behavior in case of trigger failures.
#
--echo #
--echo # Test with triggers that succeed
--echo #
CREATE TABLE t1 (id INT PRIMARY KEY, val INT);
CREATE TABLE log (id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255));
INSERT INTO t1 VALUES (1, 1);
CREATE TRIGGER t1_before_update BEFORE UPDATE ON t1 FOR EACH ROW
INSERT INTO log (msg) VALUES ('before update');
CREATE TRIGGER t1_after_update AFTER UPDATE ON t1 FOR EACH ROW
INSERT INTO log (msg) VALUES ('after update');
--echo #
--echo # Normal UPDATE with no data change
--echo # Expected: Both BEFORE and AFTER triggers fire.
--echo #
TRUNCATE log;
UPDATE t1 SET val = 1 WHERE id = 1;
SELECT * FROM log ORDER BY id;
TRUNCATE log;
--echo #
--echo # INSERT ... ON DUPLICATE KEY UPDATE with no data change
--echo # Expected: Both BEFORE and AFTER triggers fire.
--echo #
INSERT INTO t1 (id, val) VALUES (1, 1) ON DUPLICATE KEY UPDATE val = 1;
SELECT * FROM log ORDER BY id;
TRUNCATE log;
--echo #
--echo # Part 2: Test with triggers that fail
--echo #
DROP TRIGGER t1_before_update;
DROP TRIGGER t1_after_update;
--echo #
--echo # Failing BEFORE UPDATE trigger
--echo #
CREATE TRIGGER t1_before_update_fail BEFORE UPDATE ON t1 FOR EACH ROW
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Error in BEFORE UPDATE';
--echo #
--echo # Normal UPDATE with no data change (fails due to BEFORE trigger)
--echo #
--error ER_SIGNAL_EXCEPTION
UPDATE t1 SET val = 1 WHERE id = 1;
--echo # INSERT ... ON DUPLICATE KEY UPDATE with no data change (fails due to BEFORE trigger)´
TRUNCATE log;
--error ER_SIGNAL_EXCEPTION
INSERT INTO t1 (id, val) VALUES (1, 1) ON DUPLICATE KEY UPDATE val = 1;
DROP TRIGGER t1_before_update_fail;
CREATE TRIGGER t1_before_update_log BEFORE UPDATE ON t1 FOR EACH ROW
INSERT INTO log (msg) VALUES ('before update');
CREATE TRIGGER t1_after_update_fail AFTER UPDATE ON t1 FOR EACH ROW
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Error in AFTER UPDATE';
--echo #
--echo # Failing AFTER UPDATE trigger
--echo #
--error ER_SIGNAL_EXCEPTION
UPDATE t1 SET val = 1 WHERE id = 1;
SELECT * FROM log ORDER BY id;
TRUNCATE log;
--echo #
--echo # Test ON DUPLICATE KEY UPDATE with no data change (failing AFTER UPDATE trigger)
--echo #
--error ER_SIGNAL_EXCEPTION
INSERT INTO t1 (id, val) VALUES (1, 1) ON DUPLICATE KEY UPDATE val = 1;
SELECT * FROM log ORDER BY id;
--echo #
--echo # Cleanup
--echo #
DROP TABLE t1, log;

View File

@@ -1416,8 +1416,9 @@ SELECT * FROM t2;
id val
1 test1
2 test2
3 test3
4 test4
3 test2
4 test3
5 test4
DROP TRIGGER trg27006_a_insert;
DROP TRIGGER trg27006_a_update;
drop table t1,t2;

View File

@@ -680,7 +680,8 @@ SET AUTOCOMMIT=@OLD_AUTOCOMMIT;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER t1_bu BEFORE UPDATE OF a ON t1 FOR EACH ROW SET @a = NEW.a */;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER t1_bu BEFORE UPDATE OF a ON t1 FOR EACH ROW SET @a = NEW.a
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -695,7 +696,8 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER t1_au AFTER UPDATE OF a ON t1 FOR EACH ROW SET @a = NEW.a */;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER t1_au AFTER UPDATE OF a ON t1 FOR EACH ROW SET @a = NEW.a
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;

View File

@@ -326,7 +326,8 @@ CREATE TABLE `t1` (
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 */;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -341,7 +342,8 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2 */;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -356,7 +358,8 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1_bu BEFORE UPDATE ON t1 FOR EACH ROW SET @a:=3 */;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1_bu BEFORE UPDATE ON t1 FOR EACH ROW SET @a:=3
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -389,7 +392,8 @@ CREATE TABLE `t1` (
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr0_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=0 */;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr0_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=0
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -404,7 +408,8 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 */;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -419,7 +424,8 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1_1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=0 */;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1_1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=0
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -434,7 +440,8 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2 */;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;

View File

@@ -7157,5 +7157,16 @@ DROP TABLE table1;
select * from v1;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1;
#
# MDEV-38798 Assertion `mdl_key->length() == 3' failed in MDL_map::find_or_insert
#
create view v as select * from (select 'foo' as a) sq;
create procedure p() alter table v truncate partition p;
caLL p;
ERROR HY000: Partition management on a not partitioned table is not possible
CAll p;
ERROR HY000: Partition management on a not partitioned table is not possible
drop procedure p;
drop view v;
# End of 10.11 test
ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;

View File

@@ -6923,6 +6923,19 @@ EOF
select * from v1;
drop view v1;
--echo #
--echo # MDEV-38798 Assertion `mdl_key->length() == 3' failed in MDL_map::find_or_insert
--echo #
create view v as select * from (select 'foo' as a) sq;
create procedure p() alter table v truncate partition p;
--error ER_PARTITION_MGMT_ON_NONPARTITIONED
caLL p;
--error ER_PARTITION_MGMT_ON_NONPARTITIONED
CAll p;
drop procedure p;
drop view v;
--echo # End of 10.11 test
--source include/test_db_charset_restore.inc

View File

@@ -176,3 +176,51 @@ select nullif(avg(1) over (partition by -1,1,0,2,3,4,5,6,7,8 order by 1, 1, 1, 1
x
1.0000
# End of 10.6 tests
#
# MDEV-28619 Server crash and UBSAN null-pointer-use in Window_funcs_sort::setup
#
create table t (c int);
select * from t order by c=row_number() over t;
ERROR HY000: Window specification with name 't' is not defined
select * union select * from t;
ERROR HY000: No tables used
explain update t set c=1 where exists (
select * from t order by c=row_number() over t);
ERROR HY000: Window specification with name 't' is not defined
select * union select * from t order by c=row_number() over t;
ERROR HY000: No tables used
explain update t set c=1 where exists (
select * union select * from t order by c=row_number() over t);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
explain update t set c=1 where exists (
select * union select nullif(avg(1) over (order by 1), avg(1) over (order by 1)) x
from t order by x=row_number() over t);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
explain update t set c=1 where exists (
select * union select nullif(avg(1) over (order by 1), avg(1) over (order by 1)) x
from t order by x=avg(row_number() over t));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
explain update t set c=1 where exists (
select * union select nullif(avg(1) over (order by 1), avg(1) over (order by 1)) x
from t order by x=avg(row_number() over t) over (order by 1));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t system NULL NULL NULL NULL 0 Const row not found
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
drop table t;
#
# End of 10.11 tests
#

View File

@@ -148,3 +148,33 @@ select nullif(avg(1) over (partition by -1,1,0,2,3,4,5,6,7,8 order by 1, 1, 1, 1
select nullif(avg(1) over (partition by -1,1,0,2,3,4,5,6,7,8 order by 1, 1, 1, 1, 1, 1, 1), avg(2) over (partition by -1,1,0,2,3,4,5,6,7,8 order by 1, 1, 1, 1, 1, 1, 1)) x order by 1, 1, 1, 1, 1, 1, x between 1 and (( x = x ) / x) or x = x = 1 ;
--echo # End of 10.6 tests
--echo #
--echo # MDEV-28619 Server crash and UBSAN null-pointer-use in Window_funcs_sort::setup
--echo #
create table t (c int);
--error ER_WRONG_WINDOW_SPEC_NAME
select * from t order by c=row_number() over t;
--error ER_NO_TABLES_USED
select * union select * from t;
--error ER_WRONG_WINDOW_SPEC_NAME
explain update t set c=1 where exists (
select * from t order by c=row_number() over t);
--error ER_NO_TABLES_USED
select * union select * from t order by c=row_number() over t;
explain update t set c=1 where exists (
select * union select * from t order by c=row_number() over t);
explain update t set c=1 where exists (
select * union select nullif(avg(1) over (order by 1), avg(1) over (order by 1)) x
from t order by x=row_number() over t);
explain update t set c=1 where exists (
select * union select nullif(avg(1) over (order by 1), avg(1) over (order by 1)) x
from t order by x=avg(row_number() over t));
explain update t set c=1 where exists (
select * union select nullif(avg(1) over (order by 1), avg(1) over (order by 1)) x
from t order by x=avg(row_number() over t) over (order by 1));
drop table t;
--echo #
--echo # End of 10.11 tests
--echo #

View File

@@ -1798,7 +1798,7 @@ sub collect_mysqld_features {
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--datadir=.");
mtr_add_arg($args, "--datadir=%s", $opt_vardir);
mtr_add_arg($args, "--basedir=%s", $basedir);
mtr_add_arg($args, "--lc-messages-dir=%s", $path_language);
mtr_add_arg($args, "--skip-grant-tables");
@@ -2546,6 +2546,7 @@ sub setup_vardir() {
mkpath($plugindir);
if (IS_WINDOWS)
{
$ENV{PATH} .= ";".$plugindir; # to load vcpkg dependencies (libcurl.dll etc)
if (!$opt_embedded_server)
{
for (<$bindir/storage/*$multiconfig/*.dll>,

View File

@@ -355,7 +355,10 @@
<import source="ascii2_non_existing_ci"/>
</rules>
</collation>
<collation name="ascii2_nopad_bin" id="325" flag="binary" flag="nopad"/>
<collation name="ascii2_nopad_bin" id="325">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="latin1">

View File

@@ -46,14 +46,14 @@ CREATE TABLE `t2` (
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v1` AS SELECT
1 AS `a0`,
1 AS `b0` */;
NULL AS `a0`,
NULL AS `b0` */;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v2` AS SELECT
1 AS `a0`,
1 AS `b0` */;
NULL AS `a0`,
NULL AS `b0` */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;

View File

@@ -60,7 +60,8 @@ CREATE DEFINER="root"@"localhost" PROCEDURE "p1"()
AS
BEGIN
SELECT pkg1.f1(); -- a standalone routine calls a package routine
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -79,7 +80,8 @@ DELIMITER ;;
CREATE DEFINER="root"@"localhost" PACKAGE "pkg1" AS
PROCEDURE p1;
FUNCTION f1 RETURN INT;
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -98,7 +100,8 @@ DELIMITER ;;
CREATE DEFINER="root"@"localhost" PACKAGE "pkg2" AS
PROCEDURE p1;
FUNCTION f1 RETURN INT;
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -123,7 +126,8 @@ FUNCTION f1 RETURN INT AS
BEGIN
RETURN 10;
END;
END ;;
END
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;

View File

@@ -1,5 +1,7 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_3;
RESET MASTER;

View File

@@ -0,0 +1,112 @@
connection node_2;
connection node_1;
CREATE TABLE ti (a INT UNSIGNED, b SMALLINT, id BIGINT NOT NULL, KEY(b), PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE tm (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=MyISAM;
SET GLOBAL wsrep_max_ws_rows=2;
START TRANSACTION;
INSERT INTO tm SET b=NULL, a=2;
INSERT INTO ti VALUES (1,2,4);
UPDATE tm AS t1 SET t1.a=t1.a * 2;
UPDATE ti AS t1 SET t1.a=t1.a * 2;
UPDATE tm AS t1 SET t1.a=t1.a * 2;
UPDATE ti AS t1 SET t1.a=t1.a * 2;
ERROR HY000: Some non-transactional changed tables couldn't be rolled back
SHOW WARNINGS;
Level Code Message
Error 1196 Some non-transactional changed tables couldn't be rolled back
Error 1180 wsrep_max_ws_rows exceeded
Error 1030 Got error 1180 "Unknown error 1180" from storage engine InnoDB
COMMIT;
SELECT * FROM ti;
a b id
SELECT * from tm;
a b
8 NULL
DROP TABLE ti,tm;
CREATE TABLE ti (a INT UNSIGNED, b SMALLINT, id BIGINT NOT NULL, KEY(b), PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE tm (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=MyISAM;
SET GLOBAL wsrep_max_ws_rows=2;
START TRANSACTION;
INSERT INTO tm SET b=NULL, a=2;
SET sql_mode=only_full_group_by;
INSERT INTO ti VALUES (1,2,4);
UPDATE tm AS t1, ti AS t2 SET t1.a=t1.a * 2, t2.a=t2.a * 2;
ERROR HY000: Galera replication not supported
UPDATE tm AS t1, ti AS t2 SET t1.a=t1.a * 2, t2.a=t2.a * 2;
ERROR HY000: Galera replication not supported
COMMIT;
SELECT * FROM ti;
a b id
1 2 4
SELECT * from tm;
a b
2 NULL
DROP TABLE ti,tm;
CREATE TABLE ti (a INT UNSIGNED, b SMALLINT, id BIGINT NOT NULL, KEY(b), PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE tm (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=MyISAM;
START TRANSACTION;
INSERT INTO tm SET b=NULL, a=2;
SET sql_mode=only_full_group_by;
INSERT INTO ti VALUES (1,2,4);
SET GLOBAL wsrep_max_ws_rows=2;
ERROR HY000: WSREP transaction is active
set GLOBAL wsrep_max_ws_size=2047;
ERROR HY000: WSREP transaction is active
COMMIT;
SELECT * FROM ti;
a b id
1 2 4
SELECT * from tm;
a b
2 NULL
DROP TABLE ti,tm;
CREATE TABLE ti (a INT UNSIGNED, b SMALLINT, id BIGINT NOT NULL, KEY(b), PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE tm (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=InnoDB;
SET GLOBAL wsrep_max_ws_rows=2;
START TRANSACTION;
INSERT INTO tm SET b=NULL, a=2;
INSERT INTO ti VALUES (1,2,4);
UPDATE tm AS t1, ti AS t2 SET t1.a=t1.a * 2, t2.a=t2.a * 2;
ERROR HY000: wsrep_max_ws_rows exceeded
UPDATE tm AS t1, ti AS t2 SET t1.a=t1.a * 2, t2.a=t2.a * 2;
COMMIT;
SELECT * FROM ti;
a b id
SELECT * from tm;
a b
DROP TABLE ti,tm;
CREATE TABLE ti (a INT UNSIGNED, b SMALLINT, id BIGINT NOT NULL, KEY(b), PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE tm (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=MyISAM;
SET GLOBAL wsrep_max_ws_rows=0;
START TRANSACTION;
INSERT INTO tm SET b=NULL, a=2;
INSERT INTO ti VALUES (1,2,4);
UPDATE tm AS t1, ti AS t2 SET t1.a=t1.a * 2, t2.a=t2.a * 2;
UPDATE tm AS t1, ti AS t2 SET t1.a=t1.a * 2, t2.a=t2.a * 2;
COMMIT;
SELECT * FROM ti;
a b id
4 2 4
SELECT * from tm;
a b
8 NULL
DROP TABLE ti,tm;
CREATE TABLE t1 (col INT);
INSERT INTO t1 VALUES (0xF4AB);
CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=mrg_myisam UNION=(t1) insert_method=FIRST;
SET GLOBAL wsrep_max_ws_rows=1;
DROP TABLES t1;
INSERT INTO t1 VALUES (6373);
CREATE TABLE t2 ENGINE=heap SELECT * FROM t1;
DROP TABLE t1, t2;
SET default_storage_engine="HEAP";
CREATE TABLE t1 (f1 BIGINT);
SET GLOBAL wsrep_max_ws_rows = 1;
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
SELECT COUNT(*) AS EXPECT_3 FROM t1;
EXPECT_3
3
DROP TABLE t1;
CREATE TABLE t1 (i INT) ENGINE=MyISAM DEFAULT CHARSET=utf8 SELECT 1 as i;
DROP TABLE t1;
SET GLOBAL wsrep_max_ws_rows=0;

View File

@@ -1,193 +0,0 @@
--- r/galera_sst_mysqldump.result
+++ r/galera_sst_mysqldump,debug.reject
@@ -698,6 +698,190 @@
1
DROP TABLE t1;
COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+SET wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
+INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
+INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
+INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
+INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+connection node_2;
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
+INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
+INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
+INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
+INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
+INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
+INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
+INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
+INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave_ddl;
+INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+EXPECT_3
+3
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1 f2
+1 node1_committed_before NULL
+2 node1_committed_before NULL
+3 node1_committed_before NULL
+4 node1_committed_before NULL
+5 node1_committed_before NULL
+6 node2_committed_before NULL
+7 node2_committed_before NULL
+8 node2_committed_before NULL
+9 node2_committed_before NULL
+10 node2_committed_before NULL
+11 node1_committed_during NULL
+12 node1_committed_during NULL
+13 node1_committed_during NULL
+14 node1_committed_during NULL
+15 node1_committed_during NULL
+16 node1_to_be_committed_after NULL
+17 node1_to_be_committed_after NULL
+18 node1_to_be_committed_after NULL
+19 node1_to_be_committed_after NULL
+20 node1_to_be_committed_after NULL
+26 node2_committed_after NULL
+27 node2_committed_after NULL
+28 node2_committed_after NULL
+29 node2_committed_after NULL
+30 node2_committed_after NULL
+31 node1_to_be_committed_after NULL
+32 node1_to_be_committed_after NULL
+33 node1_to_be_committed_after NULL
+34 node1_to_be_committed_after NULL
+35 node1_to_be_committed_after NULL
+36 node1_committed_after NULL
+37 node1_committed_after NULL
+38 node1_committed_after NULL
+39 node1_committed_after NULL
+40 node1_committed_after NULL
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+EXPECT_3
+3
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1 f2
+1 node1_committed_before NULL
+2 node1_committed_before NULL
+3 node1_committed_before NULL
+4 node1_committed_before NULL
+5 node1_committed_before NULL
+6 node2_committed_before NULL
+7 node2_committed_before NULL
+8 node2_committed_before NULL
+9 node2_committed_before NULL
+10 node2_committed_before NULL
+11 node1_committed_during NULL
+12 node1_committed_during NULL
+13 node1_committed_during NULL
+14 node1_committed_during NULL
+15 node1_committed_during NULL
+16 node1_to_be_committed_after NULL
+17 node1_to_be_committed_after NULL
+18 node1_to_be_committed_after NULL
+19 node1_to_be_committed_after NULL
+20 node1_to_be_committed_after NULL
+26 node2_committed_after NULL
+27 node2_committed_after NULL
+28 node2_committed_after NULL
+29 node2_committed_after NULL
+30 node2_committed_after NULL
+31 node1_to_be_committed_after NULL
+32 node1_to_be_committed_after NULL
+33 node1_to_be_committed_after NULL
+34 node1_to_be_committed_after NULL
+35 node1_to_be_committed_after NULL
+36 node1_committed_after NULL
+37 node1_committed_after NULL
+38 node1_committed_after NULL
+39 node1_committed_after NULL
+40 node1_committed_after NULL
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET GLOBAL debug_dbug = $debug_orig;
connection node_1;
CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
DROP USER sst;

View File

@@ -0,0 +1,381 @@
connection node_2;
connection node_1;
Setting SST method to mysqldump ...
call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127\\.0\\.0\\.1'");
call mtr.add_suppression("Failed to load slave replication state from table mysql\\.gtid_slave_pos");
connection node_1;
CREATE USER 'sst';
GRANT ALL PRIVILEGES ON *.* TO 'sst';
SET GLOBAL wsrep_sst_auth = 'sst:';
connection node_2;
SET GLOBAL wsrep_sst_method = 'mysqldump';
connection node_1;
connection node_2;
Performing State Transfer on a server that has been temporarily disconnected
connection node_1;
CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (1,'node1_committed_before');
INSERT INTO t1 VALUES (2,'node1_committed_before');
INSERT INTO t1 VALUES (3,'node1_committed_before');
INSERT INTO t1 VALUES (4,'node1_committed_before');
INSERT INTO t1 VALUES (5,'node1_committed_before');
COMMIT;
connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (6,'node2_committed_before');
INSERT INTO t1 VALUES (7,'node2_committed_before');
INSERT INTO t1 VALUES (8,'node2_committed_before');
INSERT INTO t1 VALUES (9,'node2_committed_before');
INSERT INTO t1 VALUES (10,'node2_committed_before');
COMMIT;
Unloading wsrep provider ...
SET GLOBAL wsrep_cluster_address = '';
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (11,'node1_committed_during');
INSERT INTO t1 VALUES (12,'node1_committed_during');
INSERT INTO t1 VALUES (13,'node1_committed_during');
INSERT INTO t1 VALUES (14,'node1_committed_during');
INSERT INTO t1 VALUES (15,'node1_committed_during');
COMMIT;
START TRANSACTION;
INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
connection node_2;
Loading wsrep provider ...
disconnect node_2;
connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (26,'node2_committed_after');
INSERT INTO t1 VALUES (27,'node2_committed_after');
INSERT INTO t1 VALUES (28,'node2_committed_after');
INSERT INTO t1 VALUES (29,'node2_committed_after');
INSERT INTO t1 VALUES (30,'node2_committed_after');
COMMIT;
connection node_1;
INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
COMMIT;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (36,'node1_committed_after');
INSERT INTO t1 VALUES (37,'node1_committed_after');
INSERT INTO t1 VALUES (38,'node1_committed_after');
INSERT INTO t1 VALUES (39,'node1_committed_after');
INSERT INTO t1 VALUES (40,'node1_committed_after');
COMMIT;
connection node_1a_galera_st_disconnect_slave;
INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
ROLLBACK;
SET AUTOCOMMIT=ON;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_35 FROM t1;
EXPECT_35
35
SELECT * FROM t1;
id f1
1 node1_committed_before
2 node1_committed_before
3 node1_committed_before
4 node1_committed_before
5 node1_committed_before
6 node2_committed_before
7 node2_committed_before
8 node2_committed_before
9 node2_committed_before
10 node2_committed_before
11 node1_committed_during
12 node1_committed_during
13 node1_committed_during
14 node1_committed_during
15 node1_committed_during
16 node1_to_be_committed_after
17 node1_to_be_committed_after
18 node1_to_be_committed_after
19 node1_to_be_committed_after
20 node1_to_be_committed_after
26 node2_committed_after
27 node2_committed_after
28 node2_committed_after
29 node2_committed_after
30 node2_committed_after
31 node1_to_be_committed_after
32 node1_to_be_committed_after
33 node1_to_be_committed_after
34 node1_to_be_committed_after
35 node1_to_be_committed_after
36 node1_committed_after
37 node1_committed_after
38 node1_committed_after
39 node1_committed_after
40 node1_committed_after
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
connection node_1;
SET AUTOCOMMIT=ON;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_35 FROM t1;
EXPECT_35
35
SELECT * FROM t1;
id f1
1 node1_committed_before
2 node1_committed_before
3 node1_committed_before
4 node1_committed_before
5 node1_committed_before
6 node2_committed_before
7 node2_committed_before
8 node2_committed_before
9 node2_committed_before
10 node2_committed_before
11 node1_committed_during
12 node1_committed_during
13 node1_committed_during
14 node1_committed_during
15 node1_committed_during
16 node1_to_be_committed_after
17 node1_to_be_committed_after
18 node1_to_be_committed_after
19 node1_to_be_committed_after
20 node1_to_be_committed_after
26 node2_committed_after
27 node2_committed_after
28 node2_committed_after
29 node2_committed_after
30 node2_committed_after
31 node1_to_be_committed_after
32 node1_to_be_committed_after
33 node1_to_be_committed_after
34 node1_to_be_committed_after
35 node1_to_be_committed_after
36 node1_committed_after
37 node1_committed_after
38 node1_committed_after
39 node1_committed_after
40 node1_committed_after
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
DROP TABLE t1;
COMMIT;
Performing State Transfer on a server that has been killed and restarted
while a DDL was in progress on it
connection node_1;
CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (1,'node1_committed_before');
INSERT INTO t1 VALUES (2,'node1_committed_before');
INSERT INTO t1 VALUES (3,'node1_committed_before');
INSERT INTO t1 VALUES (4,'node1_committed_before');
INSERT INTO t1 VALUES (5,'node1_committed_before');
connection node_2;
START TRANSACTION;
INSERT INTO t1 VALUES (6,'node2_committed_before');
INSERT INTO t1 VALUES (7,'node2_committed_before');
INSERT INTO t1 VALUES (8,'node2_committed_before');
INSERT INTO t1 VALUES (9,'node2_committed_before');
INSERT INTO t1 VALUES (10,'node2_committed_before');
COMMIT;
SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
connection node_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
connection node_2;
SET wsrep_sync_wait = 0;
Killing server ...
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
COMMIT;
START TRANSACTION;
INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
connection node_2;
Performing --wsrep-recover ...
connection node_2;
Starting server ...
Using --wsrep-start-position when starting mysqld ...
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
COMMIT;
connection node_1;
INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
COMMIT;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
COMMIT;
connection node_1a_galera_st_kill_slave_ddl;
INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
ROLLBACK;
SET AUTOCOMMIT=ON;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
EXPECT_3
3
SELECT COUNT(*) AS EXPECT_35 FROM t1;
EXPECT_35
35
SELECT * FROM t1;
id f1 f2
1 node1_committed_before NULL
2 node1_committed_before NULL
3 node1_committed_before NULL
4 node1_committed_before NULL
5 node1_committed_before NULL
6 node2_committed_before NULL
7 node2_committed_before NULL
8 node2_committed_before NULL
9 node2_committed_before NULL
10 node2_committed_before NULL
11 node1_committed_during NULL
12 node1_committed_during NULL
13 node1_committed_during NULL
14 node1_committed_during NULL
15 node1_committed_during NULL
16 node1_to_be_committed_after NULL
17 node1_to_be_committed_after NULL
18 node1_to_be_committed_after NULL
19 node1_to_be_committed_after NULL
20 node1_to_be_committed_after NULL
26 node2_committed_after NULL
27 node2_committed_after NULL
28 node2_committed_after NULL
29 node2_committed_after NULL
30 node2_committed_after NULL
31 node1_to_be_committed_after NULL
32 node1_to_be_committed_after NULL
33 node1_to_be_committed_after NULL
34 node1_to_be_committed_after NULL
35 node1_to_be_committed_after NULL
36 node1_committed_after NULL
37 node1_committed_after NULL
38 node1_committed_after NULL
39 node1_committed_after NULL
40 node1_committed_after NULL
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
COMMIT;
connection node_1;
SET AUTOCOMMIT=ON;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
EXPECT_3
3
SELECT COUNT(*) AS EXPECT_35 FROM t1;
EXPECT_35
35
SELECT * FROM t1;
id f1 f2
1 node1_committed_before NULL
2 node1_committed_before NULL
3 node1_committed_before NULL
4 node1_committed_before NULL
5 node1_committed_before NULL
6 node2_committed_before NULL
7 node2_committed_before NULL
8 node2_committed_before NULL
9 node2_committed_before NULL
10 node2_committed_before NULL
11 node1_committed_during NULL
12 node1_committed_during NULL
13 node1_committed_during NULL
14 node1_committed_during NULL
15 node1_committed_during NULL
16 node1_to_be_committed_after NULL
17 node1_to_be_committed_after NULL
18 node1_to_be_committed_after NULL
19 node1_to_be_committed_after NULL
20 node1_to_be_committed_after NULL
26 node2_committed_after NULL
27 node2_committed_after NULL
28 node2_committed_after NULL
29 node2_committed_after NULL
30 node2_committed_after NULL
31 node1_to_be_committed_after NULL
32 node1_to_be_committed_after NULL
33 node1_to_be_committed_after NULL
34 node1_to_be_committed_after NULL
35 node1_to_be_committed_after NULL
36 node1_committed_after NULL
37 node1_committed_after NULL
38 node1_committed_after NULL
39 node1_committed_after NULL
40 node1_committed_after NULL
SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
COUNT(*) = 0
1
DROP TABLE t1;
COMMIT;
SET GLOBAL debug_dbug = $debug_orig;
connection node_1;
CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
DROP USER sst;
connection node_2;
CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
CALL mtr.add_suppression("Can't open and lock time zone table");
CALL mtr.add_suppression("Can't open and lock privilege tables");
CALL mtr.add_suppression("Info table is not ready to be used");
CALL mtr.add_suppression("Native table .* has the wrong structure");
CALL mtr.add_suppression("Table 'mysql\\.gtid_slave_pos' doesn't exist");

View File

@@ -1,193 +0,0 @@
--- r/galera_sst_mysqldump_with_key.result
+++ r/galera_sst_mysqldump_with_key,debug.reject
@@ -358,6 +358,190 @@
1
DROP TABLE t1;
COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+while a DDL was in progress on it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+SET wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
+INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
+INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
+INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
+INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+connection node_2;
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
+INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
+INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
+INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
+INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
+INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
+INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
+INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
+INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave_ddl;
+INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+EXPECT_3
+3
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1 f2
+1 node1_committed_before NULL
+2 node1_committed_before NULL
+3 node1_committed_before NULL
+4 node1_committed_before NULL
+5 node1_committed_before NULL
+6 node2_committed_before NULL
+7 node2_committed_before NULL
+8 node2_committed_before NULL
+9 node2_committed_before NULL
+10 node2_committed_before NULL
+11 node1_committed_during NULL
+12 node1_committed_during NULL
+13 node1_committed_during NULL
+14 node1_committed_during NULL
+15 node1_committed_during NULL
+16 node1_to_be_committed_after NULL
+17 node1_to_be_committed_after NULL
+18 node1_to_be_committed_after NULL
+19 node1_to_be_committed_after NULL
+20 node1_to_be_committed_after NULL
+26 node2_committed_after NULL
+27 node2_committed_after NULL
+28 node2_committed_after NULL
+29 node2_committed_after NULL
+30 node2_committed_after NULL
+31 node1_to_be_committed_after NULL
+32 node1_to_be_committed_after NULL
+33 node1_to_be_committed_after NULL
+34 node1_to_be_committed_after NULL
+35 node1_to_be_committed_after NULL
+36 node1_committed_after NULL
+37 node1_committed_after NULL
+38 node1_committed_after NULL
+39 node1_committed_after NULL
+40 node1_committed_after NULL
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+EXPECT_3
+3
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1 f2
+1 node1_committed_before NULL
+2 node1_committed_before NULL
+3 node1_committed_before NULL
+4 node1_committed_before NULL
+5 node1_committed_before NULL
+6 node2_committed_before NULL
+7 node2_committed_before NULL
+8 node2_committed_before NULL
+9 node2_committed_before NULL
+10 node2_committed_before NULL
+11 node1_committed_during NULL
+12 node1_committed_during NULL
+13 node1_committed_during NULL
+14 node1_committed_during NULL
+15 node1_committed_during NULL
+16 node1_to_be_committed_after NULL
+17 node1_to_be_committed_after NULL
+18 node1_to_be_committed_after NULL
+19 node1_to_be_committed_after NULL
+20 node1_to_be_committed_after NULL
+26 node2_committed_after NULL
+27 node2_committed_after NULL
+28 node2_committed_after NULL
+29 node2_committed_after NULL
+30 node2_committed_after NULL
+31 node1_to_be_committed_after NULL
+32 node1_to_be_committed_after NULL
+33 node1_to_be_committed_after NULL
+34 node1_to_be_committed_after NULL
+35 node1_to_be_committed_after NULL
+36 node1_committed_after NULL
+37 node1_committed_after NULL
+38 node1_committed_after NULL
+39 node1_committed_after NULL
+40 node1_committed_after NULL
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET GLOBAL debug_dbug = $debug_orig;
connection node_1;
CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
DROP USER sst;

View File

@@ -125,6 +125,7 @@ CREATE TABLE t1(c1 INT)ENGINE = INNODB;
SET GLOBAL wsrep_max_ws_rows= DEFAULT;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 SELECT * FROM t1;
COMMIT;
SET GLOBAL wsrep_max_ws_rows= 1;
ALTER TABLE t1 CHANGE COLUMN c1 c1 BIGINT;
connection node_2;

View File

@@ -9,6 +9,10 @@
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
# node 3 is a native MariaDB server operating as async replication master
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
@@ -46,3 +50,5 @@ RESET SLAVE;
--connection node_3
RESET MASTER;
--disconnect node_3
--source include/auto_increment_offset_restore.inc

View File

@@ -0,0 +1,104 @@
--source include/galera_cluster.inc
#
# MDEV-28750 Assertion `trans_safe || !updated || thd->transaction->stmt.modified_non_trans_table' failed in virtual bool multi_update::send_eof()
#
CREATE TABLE ti (a INT UNSIGNED, b SMALLINT, id BIGINT NOT NULL, KEY(b), PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE tm (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=MyISAM;
SET GLOBAL wsrep_max_ws_rows=2;
START TRANSACTION;
INSERT INTO tm SET b=NULL, a=2;
INSERT INTO ti VALUES (1,2,4);
UPDATE tm AS t1 SET t1.a=t1.a * 2;
UPDATE ti AS t1 SET t1.a=t1.a * 2;
UPDATE tm AS t1 SET t1.a=t1.a * 2;
--error ER_WARNING_NOT_COMPLETE_ROLLBACK
UPDATE ti AS t1 SET t1.a=t1.a * 2;
SHOW WARNINGS;
COMMIT;
SELECT * FROM ti;
SELECT * from tm;
DROP TABLE ti,tm;
CREATE TABLE ti (a INT UNSIGNED, b SMALLINT, id BIGINT NOT NULL, KEY(b), PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE tm (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=MyISAM;
SET GLOBAL wsrep_max_ws_rows=2;
START TRANSACTION;
INSERT INTO tm SET b=NULL, a=2;
SET sql_mode=only_full_group_by;
INSERT INTO ti VALUES (1,2,4);
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
UPDATE tm AS t1, ti AS t2 SET t1.a=t1.a * 2, t2.a=t2.a * 2;
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
UPDATE tm AS t1, ti AS t2 SET t1.a=t1.a * 2, t2.a=t2.a * 2;
COMMIT;
SELECT * FROM ti;
SELECT * from tm;
DROP TABLE ti,tm;
CREATE TABLE ti (a INT UNSIGNED, b SMALLINT, id BIGINT NOT NULL, KEY(b), PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE tm (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=MyISAM;
START TRANSACTION;
INSERT INTO tm SET b=NULL, a=2;
SET sql_mode=only_full_group_by;
INSERT INTO ti VALUES (1,2,4);
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_max_ws_rows=2;
--error ER_WRONG_ARGUMENTS
set GLOBAL wsrep_max_ws_size=2047;
COMMIT;
SELECT * FROM ti;
SELECT * from tm;
DROP TABLE ti,tm;
CREATE TABLE ti (a INT UNSIGNED, b SMALLINT, id BIGINT NOT NULL, KEY(b), PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE tm (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=InnoDB;
SET GLOBAL wsrep_max_ws_rows=2;
START TRANSACTION;
INSERT INTO tm SET b=NULL, a=2;
INSERT INTO ti VALUES (1,2,4);
--error ER_ERROR_DURING_COMMIT
UPDATE tm AS t1, ti AS t2 SET t1.a=t1.a * 2, t2.a=t2.a * 2;
UPDATE tm AS t1, ti AS t2 SET t1.a=t1.a * 2, t2.a=t2.a * 2;
COMMIT;
SELECT * FROM ti;
SELECT * from tm;
DROP TABLE ti,tm;
CREATE TABLE ti (a INT UNSIGNED, b SMALLINT, id BIGINT NOT NULL, KEY(b), PRIMARY KEY(id)) ENGINE=InnoDB;
CREATE TABLE tm (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=MyISAM;
SET GLOBAL wsrep_max_ws_rows=0;
START TRANSACTION;
INSERT INTO tm SET b=NULL, a=2;
INSERT INTO ti VALUES (1,2,4);
UPDATE tm AS t1, ti AS t2 SET t1.a=t1.a * 2, t2.a=t2.a * 2;
UPDATE tm AS t1, ti AS t2 SET t1.a=t1.a * 2, t2.a=t2.a * 2;
COMMIT;
SELECT * FROM ti;
SELECT * from tm;
DROP TABLE ti,tm;
#
# MDEV-25548 Assertion `transactional_table || !changed || thd->transaction.stmt.modified_non_trans_table' failed.
#
CREATE TABLE t1 (col INT);
INSERT INTO t1 VALUES (0xF4AB);
CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=mrg_myisam UNION=(t1) insert_method=FIRST;
SET GLOBAL wsrep_max_ws_rows=1;
DROP TABLES t1;
INSERT INTO t1 VALUES (6373);
CREATE TABLE t2 ENGINE=heap SELECT * FROM t1;
DROP TABLE t1, t2;
SET default_storage_engine="HEAP";
CREATE TABLE t1 (f1 BIGINT);
SET GLOBAL wsrep_max_ws_rows = 1;
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
SELECT COUNT(*) AS EXPECT_3 FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (i INT) ENGINE=MyISAM DEFAULT CHARSET=utf8 SELECT 1 as i;
DROP TABLE t1;
SET GLOBAL wsrep_max_ws_rows=0;

View File

@@ -14,7 +14,6 @@
--source suite/galera/include/galera_st_shutdown_slave.inc
--source suite/galera/include/galera_st_clean_slave.inc
--source suite/galera/include/galera_st_kill_slave.inc
--source suite/galera/include/galera_st_kill_slave_ddl.inc
--source include/auto_increment_offset_restore.inc
--source suite/galera/include/galera_sst_restore.inc

View File

@@ -0,0 +1,10 @@
!include ../galera_2nodes.cnf
# We do not set mysqldump-related SST options here because doing so on startup
# causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR
[mysqld.1]
wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M'
[mysqld.2]
wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M'

View File

@@ -0,0 +1,17 @@
--source include/big_test.inc
--source include/galera_cluster.inc
--source suite/galera/include/galera_sst_set_mysqldump.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--source suite/galera/include/galera_st_disconnect_slave.inc
# We set the required mysqldump SST options here so that they are used every time the server is restarted during the test
--let $start_mysqld_params = --wsrep_sst_auth=sst:sst --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=127.0.0.1:$NODE_MYPORT_2 --skip-grant-tables
--source suite/galera/include/galera_st_kill_slave_ddl.inc
--source include/auto_increment_offset_restore.inc
--source suite/galera/include/galera_sst_restore.inc

View File

@@ -25,7 +25,6 @@ SET GLOBAL wsrep_sst_auth = 'sslsst:';
--source suite/galera/include/galera_st_shutdown_slave.inc
--source suite/galera/include/galera_st_kill_slave.inc
--source suite/galera/include/galera_st_kill_slave_ddl.inc
--source include/auto_increment_offset_restore.inc
--source suite/galera/include/galera_sst_restore.inc

View File

@@ -159,6 +159,7 @@ CREATE TABLE t1(c1 INT)ENGINE = INNODB;
SET GLOBAL wsrep_max_ws_rows= DEFAULT;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 SELECT * FROM t1;
COMMIT;
SET GLOBAL wsrep_max_ws_rows= 1;
ALTER TABLE t1 CHANGE COLUMN c1 c1 BIGINT;

View File

@@ -0,0 +1,104 @@
# ------------------------------------------------------------------------------
# Test Summary
# ------------------------------------------------------------------------------
# This test checks whether the mariadbd core dump file is expected to be TRIMMED
# or NOT TRIMMED based on how memory is mapped by the mariadbd process.
#
# What this script does:
#
# 1. It retrieves MariaDB runtime values:
# - pid_file (location of mariadbd PID)
# - innodb_buffer_pool_size
#
# 2. Using the PID file, it finds the running mariadbd process ID.
#
# 3. It reads /proc/<pid>/smaps to inspect the memory regions allocated
# by the mariadbd process.
#
# 4. From the smaps output, it identifies candidate memory regions that:
# - are smaller than 192M
# - contain the "dd" VmFlag (indicating the region is eligible for
# core dump trimming)
#
# 5. It sums the size of these candidate memory regions.
#
# 6. If the candidate memory is large enough to cover the buffer pool,
# the script concludes that the buffer pool will not be part of core dump.
# Otherwise, it reports it to be part of core dump.
#
# Purpose:
# This helps verify whether InnoDB buffer pool will be excluded from the
# core dump, preventing unnecessarily large core files.
# ------------------------------------------------------------------------------
# Get the full path name of the PID file
--let $pid_file= query_get_value(SELECT @@pid_file, @@pid_file, 1)
--let PIDFILE= $pid_file
# Get innodb_buffer_pool_size
--let $innodb_buffer_pool_size= query_get_value(SELECT @@innodb_buffer_pool_size, @@innodb_buffer_pool_size, 1)
--let BUFFER_POOL_SIZE= $innodb_buffer_pool_size
perl;
use strict;
use warnings;
my $pid_file = $ENV{'PIDFILE'} or die "PIDFILE not set";
# Buffer pool size
my $buffer_pool_size = $ENV{'BUFFER_POOL_SIZE'};
# Convert to KB
my $buffer_pool_kb = int($buffer_pool_size / 1024);
# Ignore regions larger than 192M
my $max_region_kb = 192 * 1024;
# Sum of candidate regions
my $candidate_sum_kb = 0;
# Get PID of mariadbd
open(my $fh, '<', $pid_file) || die "Cannot open pid file $pid_file\n";
my $pid = <$fh>;
$pid =~ s/\s//g;
close($fh);
if ($pid eq "") {
die "Couldn't retrieve PID from PID file.\n";
}
# Open smaps
my $smaps_file = "/proc/$pid/smaps";
open(my $sm, '<', $smaps_file) or die "Cannot open $smaps_file\n";
my $current_size_kb = 0;
while (my $line = <$sm>) {
if ($line =~ /^Size:\s+(\d+)\s+kB/) {
$current_size_kb = $1;
}
if ($line =~ /^VmFlags:\s+(.*)/) {
my $flags = $1;
# Candidate region conditions
if ($current_size_kb <= $max_region_kb &&
$flags =~ /\bdd\b/) {
$candidate_sum_kb += $current_size_kb;
}
}
}
close($sm);
if ($candidate_sum_kb >= $buffer_pool_kb) {
print "Buffer pool not part of core dump.\n";
}
else {
print "Buffer pool part of core dump.\n";
}
EOF

View File

@@ -0,0 +1,31 @@
set @old_innodb_buffer_pool_in_core_dump = @@innodb_buffer_pool_in_core_dump;
#
# Confirm innodb_buffer_pool_in_core_dump works
#
SELECT @@global.innodb_buffer_pool_in_core_dump;
@@global.innodb_buffer_pool_in_core_dump
0
Buffer pool not part of core dump.
#
# Confirm dynamicity of innodb_buffer_pool_in_core_dump
#
SET GLOBAL innodb_buffer_pool_in_core_dump = ON;
Buffer pool part of core dump.
SET GLOBAL innodb_buffer_pool_in_core_dump = OFF;
Buffer pool not part of core dump.
SET GLOBAL innodb_buffer_pool_in_core_dump = ON;
Buffer pool part of core dump.
SET GLOBAL innodb_buffer_pool_in_core_dump = OFF;
Buffer pool not part of core dump.
#
# Confirm innodb_pool_in_core_dump works even
# after resizing of buffer pool.
#
set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size;
set global innodb_buffer_pool_size = 64*1024*1024;
Buffer pool not part of core dump.
set global innodb_buffer_pool_size = 96*1024*1024;
Buffer pool not part of core dump.
set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
set global innodb_buffer_pool_in_core_dump = @old_innodb_buffer_pool_in_core_dump;
# End of 10.11 tests

View File

@@ -29,3 +29,14 @@ RENAME TABLE `d255`.u TO u;
DROP TABLE u;
DROP DATABASE `d255`;
# End of 10.3 tests
#
# MDEV-24356 InnoDB: Failing assertion: len < sizeof(tmp_buff)
# in get_foreign_key_info
#
CREATE DATABASE `db_new..............................................end`;
USE `db_new..............................................end`;
SET STATEMENT foreign_key_checks=0 for
CREATE TABLE t1(f1 INT UNSIGNED,f2 INT UNSIGNED,
FOREIGN KEY (f2)REFERENCES t2 (f1))ENGINE=InnoDB;
ALTER TABLE t1 FORCE;
DROP DATABASE `db_new..............................................end`;

View File

@@ -0,0 +1,2 @@
--loose-skip-innodb-buffer-pool-in-core-dump
--innodb-buffer-pool-size=128M

View File

@@ -0,0 +1,56 @@
#
# MDEV-22186 : Add innodb_buffer_pool_in_core_dump option to trim buffer pool from core file
#
--source include/not_windows.inc
--source include/linux.inc
--source include/have_innodb.inc
--source include/not_valgrind.inc
--source include/not_embedded.inc
# Disable test on sanitizer builds (MSAN and ASAN) because sanitizers
# introduce additional VMAs marked with the `dd` (VM_DONTDUMP) flag
# in /proc/<pid>/smaps, which breaks the assumptions in
# include/check_core_dump_trim.inc.
--source include/not_msan.inc
--source include/not_asan.inc
set @old_innodb_buffer_pool_in_core_dump = @@innodb_buffer_pool_in_core_dump;
--echo #
--echo # Confirm innodb_buffer_pool_in_core_dump works
--echo #
SELECT @@global.innodb_buffer_pool_in_core_dump;
--source include/check_core_dump_trim.inc
--echo #
--echo # Confirm dynamicity of innodb_buffer_pool_in_core_dump
--echo #
SET GLOBAL innodb_buffer_pool_in_core_dump = ON;
--source include/check_core_dump_trim.inc
SET GLOBAL innodb_buffer_pool_in_core_dump = OFF;
--source include/check_core_dump_trim.inc
SET GLOBAL innodb_buffer_pool_in_core_dump = ON;
--source include/check_core_dump_trim.inc
SET GLOBAL innodb_buffer_pool_in_core_dump = OFF;
--source include/check_core_dump_trim.inc
--echo #
--echo # Confirm innodb_pool_in_core_dump works even
--echo # after resizing of buffer pool.
--echo #
set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size;
set global innodb_buffer_pool_size = 64*1024*1024;
--source include/check_core_dump_trim.inc
set global innodb_buffer_pool_size = 96*1024*1024;
--source include/check_core_dump_trim.inc
set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
set global innodb_buffer_pool_in_core_dump = @old_innodb_buffer_pool_in_core_dump;
--echo # End of 10.11 tests

View File

@@ -75,3 +75,15 @@ DROP TABLE u;
eval DROP DATABASE `$d255`;
--echo # End of 10.3 tests
--echo #
--echo # MDEV-24356 InnoDB: Failing assertion: len < sizeof(tmp_buff)
--echo # in get_foreign_key_info
--echo #
CREATE DATABASE `db_new..............................................end`;
USE `db_new..............................................end`;
SET STATEMENT foreign_key_checks=0 for
CREATE TABLE t1(f1 INT UNSIGNED,f2 INT UNSIGNED,
FOREIGN KEY (f2)REFERENCES t2 (f1))ENGINE=InnoDB;
ALTER TABLE t1 FORCE;
DROP DATABASE `db_new..............................................end`;

View File

@@ -8,3 +8,12 @@ SELECT * FROM t;
i
1
DROP TABLE t;
#
# MDEV-38562: mariabackup exits with success (0) despite "No space left on device" errors
#
# Simulate close() failure (Disk Full / ENOSPC)
# Verify that "completed OK!" is NOT in the log
NOT FOUND /completed OK!/ in backup.log
# Verify that "FATAL ERROR" is in the log
FOUND 1 /FATAL ERROR/ in backup.log
# End of 10.6 tests

View File

@@ -23,3 +23,27 @@ SELECT * FROM t;
DROP TABLE t;
rmdir $targetdir;
--echo #
--echo # MDEV-38562: mariabackup exits with success (0) despite "No space left on device" errors
--echo #
--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
--echo # Simulate close() failure (Disk Full / ENOSPC)
--error 1
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,my_close_fail >$MYSQLTEST_VARDIR/tmp/backup.log 2>&1
--echo # Verify that "completed OK!" is NOT in the log
--let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/backup.log
--let SEARCH_PATTERN=completed OK!
--source include/search_pattern_in_file.inc
--echo # Verify that "FATAL ERROR" is in the log
--let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/backup.log
--let SEARCH_PATTERN=FATAL ERROR
--source include/search_pattern_in_file.inc
--remove_file $MYSQLTEST_VARDIR/tmp/backup.log
rmdir $targetdir;
--echo # End of 10.6 tests

View File

@@ -288,33 +288,33 @@ USE `test`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v1` AS SELECT
1 AS `a+b`,
1 AS `c` */;
NULL AS `a+b`,
NULL AS `c` */;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v2` AS SELECT
1 AS `a+b`,
1 AS `c`,
1 AS `current_role()` */;
NULL AS `a+b`,
NULL AS `c`,
NULL AS `current_role()` */;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v3` AS SELECT
1 AS `a+b`,
1 AS `c` */;
NULL AS `a+b`,
NULL AS `c` */;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v4` AS SELECT
1 AS `a+b`,
1 AS `c` */;
NULL AS `a+b`,
NULL AS `c` */;
SET character_set_client = @saved_cs_client;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v5` AS SELECT
1 AS `a+b`,
1 AS `c` */;
NULL AS `a+b`,
NULL AS `c` */;
SET character_set_client = @saved_cs_client;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci */;
@@ -351,7 +351,8 @@ INSERT INTO `t2` VALUES
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`role1`*/ /*!50003 trigger tr1 before insert on t2 for each row
insert t1 values (111, 222, 333) */;;
insert t1 values (111, 222, 333)
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -367,7 +368,8 @@ DELIMITER ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`role3`@`%`*/ /*!50003 trigger tr3 before update on t2 for each row
insert t1 values (111, 222, 333) */;;
insert t1 values (111, 222, 333)
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -383,7 +385,8 @@ DELIMITER ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`role2`@``*/ /*!50003 trigger tr2 before delete on t2 for each row
insert t1 values (111, 222, 333) */;;
insert t1 values (111, 222, 333)
*/;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -401,7 +404,8 @@ DELIMITER ;;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`role1`*/ /*!50106 EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 2, 0) */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`role1`*/ /*!50106 EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 2, 0)
*/ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -418,7 +422,8 @@ DELIMITER ;;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`role2`*/ /*!50106 EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 4, 0) */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`role2`*/ /*!50106 EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 4, 0)
*/ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -435,7 +440,8 @@ DELIMITER ;;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;;
/*!50003 SET @saved_time_zone = @@time_zone */ ;;
/*!50003 SET time_zone = 'SYSTEM' */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`role3`@`%`*/ /*!50106 EVENT `e3` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 3, 0) */ ;;
/*!50106 CREATE*/ /*!50117 DEFINER=`role3`@`%`*/ /*!50106 EVENT `e3` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 3, 0)
*/ ;;
/*!50003 SET time_zone = @saved_time_zone */ ;;
/*!50003 SET sql_mode = @saved_sql_mode */ ;;
/*!50003 SET character_set_client = @saved_cs_client */ ;;
@@ -453,7 +459,8 @@ DELIMITER ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
DELIMITER ;;
CREATE DEFINER=`role1` FUNCTION `fn1`() RETURNS int(11)
return (select sum(a+b) from t1) ;;
return (select sum(a+b) from t1)
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -469,7 +476,8 @@ DELIMITER ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
DELIMITER ;;
CREATE DEFINER=`role2` FUNCTION `fn2`() RETURNS int(11)
return (select sum(a+b) from t1) ;;
return (select sum(a+b) from t1)
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -485,7 +493,8 @@ DELIMITER ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
DELIMITER ;;
CREATE DEFINER=`role3`@`%` FUNCTION `fn3`() RETURNS int(11)
return (select sum(a+b) from t1) ;;
return (select sum(a+b) from t1)
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -501,7 +510,8 @@ DELIMITER ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
DELIMITER ;;
CREATE DEFINER=`role1` PROCEDURE `pr1`()
insert t1 values (111, 222, 333) ;;
insert t1 values (111, 222, 333)
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -517,7 +527,8 @@ DELIMITER ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
DELIMITER ;;
CREATE DEFINER=`role2`@`%` PROCEDURE `pr2`()
insert t1 values (111, 222, 333) ;;
insert t1 values (111, 222, 333)
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -533,7 +544,8 @@ DELIMITER ;
/*!50003 SET collation_connection = latin1_swedish_ci */ ;
DELIMITER ;;
CREATE DEFINER=`role3`@`%` PROCEDURE `pr3`()
insert t1 values (111, 222, 333) ;;
insert t1 values (111, 222, 333)
;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;

View File

@@ -0,0 +1,24 @@
set @old_innodb_buffer_pool_in_core_dump = @@innodb_buffer_pool_in_core_dump;
SET GLOBAL innodb_buffer_pool_in_core_dump=OFF;
SELECT @@global.innodb_buffer_pool_in_core_dump;
@@global.innodb_buffer_pool_in_core_dump
0
SELECT @@session.innodb_buffer_pool_in_core_dump;
ERROR HY000: Variable 'innodb_buffer_pool_in_core_dump' is a GLOBAL variable
SHOW GLOBAL VARIABLES LIKE 'innodb_buffer_pool_in_core_dump';
Variable_name Value
innodb_buffer_pool_in_core_dump OFF
SHOW SESSION VARIABLES LIKE 'innodb_buffer_pool_in_core_dump';
Variable_name Value
innodb_buffer_pool_in_core_dump OFF
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name='innodb_buffer_pool_in_core_dump';
VARIABLE_NAME VARIABLE_VALUE
INNODB_BUFFER_POOL_IN_CORE_DUMP OFF
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE variable_name='innodb_buffer_pool_in_core_dump';
VARIABLE_NAME VARIABLE_VALUE
INNODB_BUFFER_POOL_IN_CORE_DUMP OFF
SET SESSION innodb_buffer_pool_in_core_dump=ON;
ERROR HY000: Variable 'innodb_buffer_pool_in_core_dump' is a GLOBAL variable and should be set with SET GLOBAL
SET GLOBAL innodb_buffer_pool_in_core_dump=ON;
SET GLOBAL innodb_buffer_pool_in_core_dump=OFF;
SET GLOBAL innodb_buffer_pool_in_core_dump = @old_innodb_buffer_pool_in_core_dump;

View File

@@ -5,6 +5,7 @@ variable_name not in (
'innodb_evict_tables_on_commit_debug', # one may want to override this
'innodb_use_native_aio', # default value depends on OS
'innodb_buffer_pool_size_max', # default value depends on OS
'innodb_buffer_pool_in_core_dump', # only available on Linux and FreeBSD
'innodb_log_file_buffering', # only available on Linux and Windows
'innodb_linux_aio', # existence depends on OS
'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing

View File

@@ -0,0 +1,31 @@
#
# Basic test for innodb_buffer_pool_in_core_dump
#
--source include/have_innodb.inc
if (`SELECT COUNT(*) = 0 from INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE LOWER(variable_name) ='innodb_buffer_pool_in_core_dump'`)
{
--skip Test requires innodb_buffer_pool_in_core_dump variable.
}
set @old_innodb_buffer_pool_in_core_dump = @@innodb_buffer_pool_in_core_dump;
SET GLOBAL innodb_buffer_pool_in_core_dump=OFF;
SELECT @@global.innodb_buffer_pool_in_core_dump;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.innodb_buffer_pool_in_core_dump;
SHOW GLOBAL VARIABLES LIKE 'innodb_buffer_pool_in_core_dump';
SHOW SESSION VARIABLES LIKE 'innodb_buffer_pool_in_core_dump';
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name='innodb_buffer_pool_in_core_dump';
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE variable_name='innodb_buffer_pool_in_core_dump';
--error ER_GLOBAL_VARIABLE
SET SESSION innodb_buffer_pool_in_core_dump=ON;
SET GLOBAL innodb_buffer_pool_in_core_dump=ON;
SET GLOBAL innodb_buffer_pool_in_core_dump=OFF;
SET GLOBAL innodb_buffer_pool_in_core_dump = @old_innodb_buffer_pool_in_core_dump;

View File

@@ -16,6 +16,7 @@ select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYP
'innodb_evict_tables_on_commit_debug', # one may want to override this
'innodb_use_native_aio', # default value depends on OS
'innodb_buffer_pool_size_max', # default value depends on OS
'innodb_buffer_pool_in_core_dump', # only available on Linux and FreeBSD
'innodb_log_file_buffering', # only available on Linux and Windows
'innodb_linux_aio', # existence depends on OS
'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing

View File

@@ -495,10 +495,7 @@ char *my_large_virtual_alloc(size_t *size)
ptr= mmap(NULL, *size, PROT_NONE, MAP_PRIVATE | OS_MAP_ANON, -1, 0);
# endif
if (ptr == MAP_FAILED)
{
my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_ERROR_LOG), *size);
ptr= NULL;
}
DBUG_RETURN(ptr);
}

View File

@@ -94,6 +94,9 @@ int my_close(File fd, myf MyFlags)
#else
err= my_win_close(fd);
#endif
DBUG_EXECUTE_IF("my_close_fail", { errno=28; err=-1; });
if (err)
{
DBUG_PRINT("error",("Got error %d on close",err));

View File

@@ -5,8 +5,16 @@ use My::Platform;
use strict;
return "Hashicorp Key Management plugin tests are currently not available on Windows"
if IS_WINDOWS;
if (IS_WINDOWS) {
# On Windows, use 'where' to check for vault binary
return "Hashicorp Vault key management utility not found"
unless `where vault 2> NUL`;
} else {
# On Unix, use 'command -v'
return "Hashicorp Vault key management utility not found"
unless `sh -c "command -v vault"`;
}
return "You need to set the value of the VAULT_ADDR variable"
unless $ENV{VAULT_ADDR};
@@ -14,7 +22,4 @@ return "You need to set the value of the VAULT_ADDR variable"
return "You need to set the value of the VAULT_TOKEN variable"
unless $ENV{VAULT_TOKEN};
return "Hashicorp Vault key management utility not found"
unless `sh -c "command -v vault"`;
bless {};

View File

@@ -5,6 +5,8 @@
--source include/have_innodb.inc
--source hashicorp_plugin.inc
# Unixism - exec grep
--source include/not_windows.inc
--exec vault secrets disable bug1 > /dev/null
--exec vault secrets disable good > /dev/null

View File

@@ -1,2 +1 @@
--source include/have_hashicorp_key_management_plugin.inc
--source include/not_windows.inc

View File

@@ -5,6 +5,8 @@
--source include/have_innodb.inc
--source hashicorp_plugin.inc
# Unixism - "exec grep"
--source include/not_windows.inc
--exec vault secrets disable bug > /dev/null
--exec vault secrets enable -path /bug -version=2 kv > /dev/null

View File

@@ -95,12 +95,6 @@ public:
};
#ifdef DBUG_OFF
static inline const char *dbug_print_item(Item *item) { return NULL; }
#else
const char *dbug_print_item(Item *item);
#endif
class Virtual_tmp_table;
class sp_head;
class Protocol;

View File

@@ -140,7 +140,7 @@ bool st_append_json(String *s,
Appends arbitrary String to the JSON string taking charsets in
consideration.
*/
static int st_append_escaped(String *s, const String *a)
int st_append_escaped(String *s, const String *a)
{
/*
In the worst case one character from the 'a' string

View File

@@ -48,6 +48,7 @@ void report_path_error_ex(const char *ps, json_path_t *p,
void report_json_error_ex(const char *js, json_engine_t *je,
const char *fname, int n_param,
Sql_condition::enum_warning_level lv);
int st_append_escaped(String *s, const String *a);
class Json_engine_scan: public json_engine_t
{

View File

@@ -123,7 +123,8 @@ Item_window_func::fix_fields(THD *thd, Item **ref)
const_item_cache= false;
with_flags= (with_flags & ~item_with_t::SUM_FUNC) | item_with_t::WINDOW_FUNC;
DBUG_ASSERT((bool) (with_flags & item_with_t::WINDOW_FUNC));
with_flags&= ~item_with_t::SUM_FUNC;
if (fix_length_and_dec(thd))
return TRUE;

View File

@@ -1086,13 +1086,19 @@ public:
: Item_func_or_sum(thd, (Item *) win_func),
window_name(win_name), window_spec(NULL),
force_return_blank(true),
read_value_from_result_field(false) {}
read_value_from_result_field(false)
{
with_flags|= item_with_t::WINDOW_FUNC;
}
Item_window_func(THD *thd, Item_sum *win_func, Window_spec *win_spec)
: Item_func_or_sum(thd, (Item *) win_func),
window_name(NULL), window_spec(win_spec),
force_return_blank(true),
read_value_from_result_field(false) {}
read_value_from_result_field(false)
{
with_flags|= item_with_t::WINDOW_FUNC;
}
Item_sum *window_func() const { return (Item_sum *) args[0]; }

View File

@@ -126,6 +126,11 @@ public:
enum enum_mdl_type {
/* This means that the MDL_request is not initialized */
/*
TODO (newbie): should be MDL_NOT_INITIALIZED= 0, as it is strange
that not-inited request has MDL_INTENTION_EXCLUSIVE.
Must fix tests, as at least mysql_rm_table_no_locks() depends on this.
*/
MDL_NOT_INITIALIZED= -1,
/*
An intention exclusive metadata lock (IX). Used only for scoped locks.
@@ -382,6 +387,10 @@ public:
Note that although there isn't metadata locking on triggers,
it's necessary to have a separate namespace for them since
MDL_key is also used outside of the MDL subsystem.
TODO (newbie): NOT_INITIALIZED=0 as default bzero() sets wrongly type to
BACKUP. But dozens switch() cases for NOT_INITIALIZED must be added to
pacify the compiler.
*/
enum enum_mdl_namespace { BACKUP=0,
SCHEMA,

View File

@@ -23,6 +23,7 @@
#include "set_var.h"
#include "my_json_writer.h"
#include "sp_head.h"
#include "item_jsonfunc.h"
#include "rowid_filter.h"
@@ -126,7 +127,18 @@ void opt_trace_print_expanded_query(THD *thd, SELECT_LEX *select_lex,
The output is not very pretty lots of back-ticks, the output
is as the one in explain extended , lets try to improved it here.
*/
writer->add("expanded_query", str.c_ptr_safe(), str.length());
StringBuffer<1024> escaped_str(system_charset_info);
if (st_append_escaped(&escaped_str, &str) == 0)
{
writer->add("expanded_query", escaped_str.c_ptr_safe(),
escaped_str.length());
}
else
{
writer->add("expanded_query",
"Error: failed to escape query string for JSON output");
}
}
void opt_trace_disable_if_no_security_context_access(THD *thd)

View File

@@ -271,7 +271,7 @@ Protocol::net_send_ok(THD *thd,
if (unlikely(server_status & SERVER_SESSION_STATE_CHANGED))
{
store.set_charset(thd->variables.collation_database);
store.set_charset(&my_charset_bin);
thd->session_tracker.store(thd, &store);
thd->server_status&= ~SERVER_SESSION_STATE_CHANGED;
}

View File

@@ -1,4 +1,5 @@
/* Copyright 2018-2025 Codership Oy <info@codership.com>
Copyright 2025-2026 MariaDB plc
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
@@ -21,6 +22,7 @@
#include "sql_class.h"
#include "debug_sync.h"
#include "log.h"
#include "wsrep_schema.h" // WSREP_SCHEMA, WSREP_STREAMING_TABLE
extern "C" my_bool wsrep_on(const THD *thd)
{
@@ -117,7 +119,7 @@ extern "C" void wsrep_thd_self_abort(THD *thd)
extern "C" const char* wsrep_get_sr_table_name()
{
return wsrep_sr_table_name_full;
return WSREP_SCHEMA "/" WSREP_STREAMING_TABLE;
}
extern "C" my_bool wsrep_get_debug()

View File

@@ -72,7 +72,10 @@ To make maintaining easier please:
<import source="latin2_general_ci"/>
</rules>
</collation>
<collation name="latin2_nopad_bin" id="1101" flag="binary" flag="nopad"/>
<collation name="latin2_nopad_bin" id="1101">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="dec8">
@@ -94,7 +97,10 @@ To make maintaining easier please:
<import source="dec8_swedish_ci"/>
</rules>
</collation>
<collation name="dec8_nopad_bin" id="1093" flag="binary" flag="nopad"/>
<collation name="dec8_nopad_bin" id="1093">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="cp850">
@@ -119,7 +125,10 @@ To make maintaining easier please:
<import source="cp850_general_ci"/>
</rules>
</collation>
<collation name="cp850_nopad_bin" id="1104" flag="binary" flag="nopad"/>
<collation name="cp850_nopad_bin" id="1104">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="latin1">
@@ -186,7 +195,10 @@ To make maintaining easier please:
<import source="hp8_english_ci"/>
</rules>
</collation>
<collation name="hp8_nopad_bin" id="1096" flag="binary" flag="nopad"/>
<collation name="hp8_nopad_bin" id="1096">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="koi8r">
@@ -201,7 +213,10 @@ To make maintaining easier please:
<import source="koi8r_general_ci"/>
</rules>
</collation>
<collation name="koi8r_nopad_bin" id="1098" flag="binary" flag="nopad"/>
<collation name="koi8r_nopad_bin" id="1098">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="swe7">
@@ -215,7 +230,10 @@ To make maintaining easier please:
<import source="swe7_swedish_ci"/>
</rules>
</collation>
<collation name="swe7_nopad_bin" id="1106" flag="binary" flag="nopad"/>
<collation name="swe7_nopad_bin" id="1106">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="ascii">
@@ -233,7 +251,10 @@ To make maintaining easier please:
<import source="ascii_general_ci"/>
</rules>
</collation>
<collation name="ascii_nopad_bin" id="1089" flag="binary" flag="nopad"/>
<collation name="ascii_nopad_bin" id="1089">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="ujis">
@@ -306,7 +327,10 @@ To make maintaining easier please:
<import source="cp1251_general_ci"/>
</rules>
</collation>
<collation name="cp1251_nopad_bin" id="1074" flag="binary" flag="nopad"/>
<collation name="cp1251_nopad_bin" id="1074">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="hebrew">
@@ -322,7 +346,10 @@ To make maintaining easier please:
<import source="hebrew_general_ci"/>
</rules>
</collation>
<collation name="hebrew_nopad_bin" id="1095" flag="binary" flag="nopad"/>
<collation name="hebrew_nopad_bin" id="1095">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="tis620">
@@ -378,7 +405,10 @@ To make maintaining easier please:
<import source="latin7_general_ci"/>
</rules>
</collation>
<collation name="latin7_nopad_bin" id="1103" flag="binary" flag="nopad"/>
<collation name="latin7_nopad_bin" id="1103">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="koi8u">
@@ -392,7 +422,10 @@ To make maintaining easier please:
<import source="koi8u_general_ci"/>
</rules>
</collation>
<collation name="koi8u_nopad_bin" id="1099" flag="binary" flag="nopad"/>
<collation name="koi8u_nopad_bin" id="1099">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="gb2312">
@@ -425,7 +458,10 @@ To make maintaining easier please:
<import source="greek_general_ci"/>
</rules>
</collation>
<collation name="greek_nopad_bin" id="1094" flag="binary" flag="nopad"/>
<collation name="greek_nopad_bin" id="1094">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="cp1250">
@@ -457,7 +493,10 @@ To make maintaining easier please:
<import source="cp1250_general_ci"/>
</rules>
</collation>
<collation name="cp1250_nopad_bin" id="1090" flag="binary" flag="nopad"/>
<collation name="cp1250_nopad_bin" id="1090">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="gbk">
@@ -490,7 +529,10 @@ To make maintaining easier please:
<import source="cp1257_general_ci"/>
</rules>
</collation>
<collation name="cp1257_nopad_bin" id="1082" flag="binary" flag="nopad"/>
<collation name="cp1257_nopad_bin" id="1082">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
<!--collation name="cp1257_ci" id="60"/-->
<!--collation name="cp1257_cs" id="61"/-->
</charset>
@@ -511,7 +553,10 @@ To make maintaining easier please:
<import source="latin5_turkish_ci"/>
</rules>
</collation>
<collation name="latin5_nopad_bin" id="1102" flag="binary" flag="nopad"/>
<collation name="latin5_nopad_bin" id="1102">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="armscii8">
@@ -525,7 +570,10 @@ To make maintaining easier please:
<import source="armscii8_general_ci"/>
</rules>
</collation>
<collation name="armscii8_nopad_bin" id="1088" flag="binary" flag="nopad"/>
<collation name="armscii8_nopad_bin" id="1088">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="utf8mb3">
@@ -569,7 +617,10 @@ To make maintaining easier please:
<import source="cp866_general_ci"/>
</rules>
</collation>
<collation name="cp866_nopad_bin" id="1092" flag="binary" flag="nopad"/>
<collation name="cp866_nopad_bin" id="1092">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="keybcs2">
@@ -582,7 +633,10 @@ To make maintaining easier please:
<import source="keybcs2_general_ci"/>
</rules>
</collation>
<collation name="keybcs2_nopad_bin" id="1097" flag="binary" flag="nopad"/>
<collation name="keybcs2_nopad_bin" id="1097">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="macce">
@@ -604,7 +658,10 @@ To make maintaining easier please:
<import source="macce_general_ci"/>
</rules>
</collation>
<collation name="macce_nopad_bin" id="1067" flag="binary" flag="nopad"/>
<collation name="macce_nopad_bin" id="1067">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="macroman">
@@ -632,7 +689,10 @@ To make maintaining easier please:
<import source="macroman_general_ci"/>
</rules>
</collation>
<collation name="macroman_nopad_bin" id="1077" flag="binary" flag="nopad"/>
<collation name="macroman_nopad_bin" id="1077">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="cp852">
@@ -656,7 +716,10 @@ To make maintaining easier please:
<import source="cp852_general_ci"/>
</rules>
</collation>
<collation name="cp852_nopad_bin" id="1105" flag="binary" flag="nopad"/>
<collation name="cp852_nopad_bin" id="1105">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="cp1256">
@@ -676,7 +739,10 @@ To make maintaining easier please:
<import source="cp1256_general_ci"/>
</rules>
</collation>
<collation name="cp1256_nopad_bin" id="1091" flag="binary" flag="nopad"/>
<collation name="cp1256_nopad_bin" id="1091">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="geostd8">
@@ -689,7 +755,10 @@ To make maintaining easier please:
<import source="geostd8_general_ci"/>
</rules>
</collation>
<collation name="geostd8_nopad_bin" id="1117" flag="binary" flag="nopad"/>
<collation name="geostd8_nopad_bin" id="1117">
<flag>binary</flag>
<flag>nopad</flag>
</collation>
</charset>
<charset name="binary">

View File

@@ -1552,6 +1552,15 @@ bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables,
KEY_CACHE *key_cache;
DBUG_ENTER("mysql_assign_to_keycache");
if (check_some_access(thd, TABLE_ACLS, tables))
{
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), "CACHE INDEX",
thd->security_ctx->priv_user,
thd->security_ctx->host_or_ip,
tables->db.str, tables->table_name.str);
DBUG_RETURN(TRUE);
}
THD_STAGE_INFO(thd, stage_finding_key_cache);
check_opt.init();
mysql_mutex_lock(&LOCK_global_system_variables);
@@ -1591,6 +1600,16 @@ bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables,
bool mysql_preload_keys(THD* thd, TABLE_LIST* tables)
{
DBUG_ENTER("mysql_preload_keys");
if (check_some_access(thd, TABLE_ACLS, tables))
{
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), "LOAD INDEX INTO CACHE",
thd->security_ctx->priv_user,
thd->security_ctx->host_or_ip,
tables->db.str, tables->table_name.str);
DBUG_RETURN(TRUE);
}
/*
We cannot allow concurrent inserts. The storage engine reads
directly from the index file, bypassing the cache. It could read

View File

@@ -3693,7 +3693,8 @@ Open_table_context::recover_from_failed_open()
on table which was discovered but preserve locks from previous statements
in current transaction.
*/
m_thd->mdl_context.rollback_to_savepoint(start_of_statement_svp());
if (!result)
m_thd->mdl_context.rollback_to_savepoint(start_of_statement_svp());
break;
case OT_NO_ACTION:
DBUG_ASSERT(0);

View File

@@ -4319,7 +4319,8 @@ my_bool Query_cache::move_by_type(uchar **border,
DBUG_PRINT("qcache", ("block %p TABLE", block));
if (*border == 0)
break;
size_t len = block->length, used = block->used;
DBUG_ASSERT(*gap > 0);
const size_t len = block->length, used = block->used;
Query_cache_block_table *list_root = block->table(0);
Query_cache_block_table *tprev = list_root->prev,
*tnext = list_root->next;
@@ -4352,9 +4353,8 @@ my_bool Query_cache::move_by_type(uchar **border,
nlist_root->prev = tprev;
tprev->next = nlist_root;
DBUG_PRINT("qcache",
("list_root: %p tnext %p tprev %p tprev->next %p tnext->prev %p",
list_root, tnext, tprev,
tprev->next,tnext->prev));
("list_root: %p parent %p tnext %p tprev %p tprev->next %p tnext->prev %p",
list_root, tnext->parent, tnext, tprev, tprev->next, tnext->prev));
/*
Go through all queries that uses this table and change them to
point to the new table object
@@ -4362,6 +4362,7 @@ my_bool Query_cache::move_by_type(uchar **border,
Query_cache_table *new_block_table=new_block->table();
for (;tnext != nlist_root; tnext=tnext->next)
tnext->parent= new_block_table;
DBUG_PRINT("qcache", ("nlist_root: %p parent %p", nlist_root, new_block_table));
*border += len;
*before = new_block;
/* Fix pointer to table name */
@@ -4376,11 +4377,12 @@ my_bool Query_cache::move_by_type(uchar **border,
case Query_cache_block::QUERY:
{
HASH_SEARCH_STATE record_idx;
DBUG_PRINT("qcache", ("block %p QUERY", block));
DBUG_PRINT("qcache", ("block %p (%zu bytes) QUERY", block, block->length));
if (*border == 0)
break;
DBUG_ASSERT(*gap > 0);
BLOCK_LOCK_WR(block);
size_t len = block->length, used = block->used;
const size_t len = block->length, used = block->used;
TABLE_COUNTER_TYPE n_tables = block->n_tables;
Query_cache_block *prev = block->prev,
*next = block->next,
@@ -4396,9 +4398,14 @@ my_bool Query_cache::move_by_type(uchar **border,
my_hash_first(&queries, key, key_length, &record_idx);
block->query()->unlock_n_destroy();
block->destroy();
const Query_cache_block_table *table_0= block->table(0),
*table_n= block->table(n_tables),
*ntable_0= new_block->table(0);
Query_cache_block_table *shifted, *table_j, *ntable_j;
const size_t move_size= (uchar *) table_n - (uchar *) table_0;
DBUG_ASSERT(move_size == n_tables * sizeof(Query_cache_block_table));
// Move table of used tables
memmove((char*) new_block->table(0), (char*) block->table(0),
ALIGN_SIZE(n_tables*sizeof(Query_cache_block_table)));
memmove((char*) ntable_0, (char*) table_0, ALIGN_SIZE(move_size));
new_block->init(len);
new_block->type=Query_cache_block::QUERY;
new_block->used=used;
@@ -4407,33 +4414,44 @@ my_bool Query_cache::move_by_type(uchar **border,
relink(block, new_block, next, prev, pnext, pprev);
if (queries_blocks == block)
queries_blocks = new_block;
Query_cache_block_table *beg_of_table_table= block->table(0),
*end_of_table_table= block->table(n_tables);
uchar *beg_of_new_table_table= (uchar*) new_block->table(0);
longlong move_distance= (uchar *) ntable_0 - (uchar *) table_0;
DBUG_PRINT("qcache", ("move_distance: %lld", move_distance));
for (TABLE_COUNTER_TYPE j=0; j < n_tables; j++)
{
Query_cache_block_table *block_table = new_block->table(j);
table_j= block->table(j);
ntable_j= new_block->table(j);
DBUG_PRINT("qcache", ("Updating new_block->table(%u): %p; intra-block range: [%p, %p)",
j, ntable_j, table_j, table_n));
// use aligment from beginning of table if 'next' is in same block
if ((beg_of_table_table <= block_table->next) &&
(block_table->next < end_of_table_table))
((Query_cache_block_table *)(beg_of_new_table_table +
(((uchar*)block_table->next) -
((uchar*)beg_of_table_table))))->prev=
block_table;
else
block_table->next->prev= block_table;
/*
Use aligment from beginning of table if 'next' is in same block:
If ntable_j->next is intra-block (inside old block->table() elements),
then shift it by memmove() distance.
*/
if ((table_j <= ntable_j->next) && (ntable_j->next < table_n))
{
shifted= (Query_cache_block_table *) ((uchar *) ntable_j->next + move_distance);
DBUG_PRINT("qcache", ("Intra-block next:%p = %p", ntable_j->next, shifted));
ntable_j->next= shifted;
}
// use aligment from beginning of table if 'prev' is in same block
if ((beg_of_table_table <= block_table->prev) &&
(block_table->prev < end_of_table_table))
((Query_cache_block_table *)(beg_of_new_table_table +
(((uchar*)block_table->prev) -
((uchar*)beg_of_table_table))))->next=
block_table;
else
block_table->prev->next = block_table;
if ((table_j <= ntable_j->prev) && (ntable_j->prev < table_n))
{
shifted= (Query_cache_block_table *) ((uchar *) ntable_j->prev + move_distance);
DBUG_PRINT("qcache", ("Intra-block prev:%p = %p", ntable_j->prev, shifted));
ntable_j->prev= shifted;
}
DBUG_PRINT("qcache", ("n:%p->p:%p = %p", ntable_j->next,
ntable_j->next->prev, ntable_j));
DBUG_PRINT("qcache", ("p:%p->n:%p = %p", ntable_j->prev,
ntable_j->prev->next, ntable_j));
ntable_j->next->prev= ntable_j;
ntable_j->prev->next= ntable_j;
}
DBUG_PRINT("qcache", ("after circle tt"));
*border += len;
@@ -4475,11 +4493,12 @@ my_bool Query_cache::move_by_type(uchar **border,
(int) block->type));
if (*border == 0)
break;
DBUG_ASSERT(*gap > 0);
Query_cache_block *query_block= block->result()->parent();
BLOCK_LOCK_WR(query_block);
Query_cache_block *next= block->next, *prev= block->prev;
Query_cache_block::block_type type= block->type;
size_t len = block->length, used = block->used;
const size_t len = block->length, used = block->used;
Query_cache_block *pprev = block->pprev,
*pnext = block->pnext,
*new_block =(Query_cache_block*) *border;

View File

@@ -19,6 +19,9 @@
*/
/*
Used in mtr tests to check index flags and key part flags and datatypes.
*/
class Debug_key: public String
{
public:

View File

@@ -1840,13 +1840,13 @@ void Explain_table_access::tag_to_json(Json_writer *writer,
/* Handled in full_scan_on_null_key */
break;
case ET_FIRST_MATCH:
writer->add_member("first_match").add_str(firstmatch_table_name.c_ptr());
writer->add_member("first_match").add_str(firstmatch_table_name);
break;
case ET_LOOSESCAN:
writer->add_member("loose_scan").add_bool(true);
break;
case ET_USING_MRR:
writer->add_member("mrr_type").add_str(mrr_type.c_ptr());
writer->add_member("mrr_type").add_str(mrr_type);
break;
case ET_USING_INDEX_FOR_GROUP_BY:
writer->add_member("using_index_for_group_by");
@@ -2994,7 +2994,7 @@ void Explain_insert::print_explain_json(Explain_query *query,
writer->add_member("query_block").start_object();
writer->add_member("select_id").add_ll(1);
writer->add_member("table").start_object();
writer->add_member("table_name").add_str(table_name.c_ptr());
writer->add_member("table_name").add_str(table_name);
writer->end_object(); // table
print_explain_json_for_children(query, writer, is_analyze);
writer->end_object(); // query_block

View File

@@ -2323,14 +2323,13 @@ int Write_record::insert_on_duplicate_update(ha_rows *inserted,
insert_id_for_cur_row= table->file->insert_id_for_cur_row= 0;
++*inserted; // Conforms the older behavior;
if (use_triggers
&& table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
TRG_ACTION_AFTER, true,
nullptr))
return restore_on_error();
}
if (use_triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
TRG_ACTION_AFTER, true, nullptr))
return restore_on_error();
/*
Only update next_insert_id if the AUTO_INCREMENT value was explicitly
updated, so we don't update next_insert_id with the value from the

View File

@@ -41,6 +41,7 @@
#ifdef WITH_WSREP
#include "mysql/service_wsrep.h"
#endif
#include "item_windowfunc.h"
void LEX::parse_error(uint err_number)
{
@@ -1334,6 +1335,7 @@ void LEX::start(THD *thd_arg)
wild= 0;
exchange= 0;
clause_winfuncs.empty();
table_count_update= 0;
needs_reprepare= false;
@@ -12803,6 +12805,37 @@ bool st_select_lex::is_query_topmost(THD *thd)
}
void st_select_lex::optimize_out_order_list()
{
/* Cleanup first related window funcs */
for (ORDER *ord= order_list.first; ord; ord= ord->next)
{
if (ord->window_funcs.is_empty())
continue;
List_iterator<Item_window_func> it_sl(window_funcs);
List_iterator<Item_window_func> it_ord(ord->window_funcs);
Item_window_func *wf_sl, *wf_ord;
while ((wf_sl= it_sl++))
{
it_ord.rewind();
while ((wf_ord= it_ord++))
{
if (wf_ord == wf_sl)
{
it_sl.remove();
it_ord.remove();
break;
}
}
if (ord->window_funcs.is_empty())
break;
}
}
order_list.empty();
}
/*
Determines whether the derived table was eliminated during
the call of eliminate_tables(JOIN *) made at the optimization stage

View File

@@ -1514,7 +1514,7 @@ public:
SQL_I_List<ORDER> win_order_list,
Window_frame *win_frame);
List<Item_window_func> window_funcs;
bool add_window_func(Item_window_func *win_func);
bool add_window_func(THD *thd, Item_window_func *win_func);
bool have_window_funcs() const { return (window_funcs.elements !=0); }
ORDER *find_common_window_func_partition_fields(THD *thd);
@@ -1579,6 +1579,7 @@ public:
const LEX_CSTRING *db_name,
const LEX_CSTRING *table_name);
bool optimize_constant_subqueries();
void optimize_out_order_list();
};
typedef class st_select_lex SELECT_LEX;
@@ -3567,6 +3568,7 @@ public:
Window_frame_bound *frame_top_bound;
Window_frame_bound *frame_bottom_bound;
Window_spec *win_spec;
List<Item_window_func> clause_winfuncs;
Item *upd_del_where;

View File

@@ -8063,7 +8063,11 @@ bool add_to_list(THD *thd, SQL_I_List<ORDER> &list, Item *item,bool asc)
order->direction= (asc ? ORDER::ORDER_ASC : ORDER::ORDER_DESC);
order->used=0;
order->counter_used= 0;
order->fast_field_copier_setup= 0;
order->fast_field_copier_setup= 0;
if (thd->lex->clause_winfuncs.is_empty())
order->window_funcs.empty();
else if (order->window_funcs.copy(&thd->lex->clause_winfuncs, thd->mem_root))
DBUG_RETURN(1);
list.insert(order, &order->next);
DBUG_RETURN(0);
}
@@ -8257,6 +8261,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
MDL_REQUEST_INIT(&ptr->mdl_request, MDL_key::TABLE, ptr->db.str,
ptr->table_name.str, mdl_type, MDL_TRANSACTION);
}
else
ptr->mdl_request.type= MDL_NOT_INITIALIZED;
DBUG_RETURN(ptr);
}

View File

@@ -2906,6 +2906,39 @@ static const char *thread_state_info(THD *tmp)
}
/*
Check if user can see a THD in "show processlist" or in I_S.processlist.
Non-privileged users can see own foreground THDs and also event worker
threads that run in user's security context.
Privileged users can see all THDs.
@param user - user name or NULL for privileged users.
@param thd - THD
@retval true - THD visible in processlist
@retval false - THD not visible in processlist
*/
static bool thd_visible_in_processlist(const char *user, THD *thd)
{
if (!thd->vio_ok() && !thd->system_thread)
return false; // "something bad happened" thread, don't show it
if (!user)
return true; // privileged user can see all threads
const char *thd_user= thd->security_ctx->user;
if (!thd_user)
return false; // dunno if this ever happens, safety first
bool user_or_event_worker_thread=
!thd->system_thread || thd->system_thread & SYSTEM_THREAD_EVENT_WORKER;
return user_or_event_worker_thread && !strcmp(thd_user, user);
}
struct list_callback_arg
{
list_callback_arg(const char *u, THD *t, ulong m):
@@ -2922,9 +2955,7 @@ static my_bool list_callback(THD *tmp, list_callback_arg *arg)
Security_context *tmp_sctx= tmp->security_ctx;
bool got_thd_data;
if ((tmp->vio_ok() || tmp->system_thread) &&
(!arg->user || (!tmp->system_thread &&
tmp_sctx->user && !strcmp(tmp_sctx->user, arg->user))))
if (thd_visible_in_processlist(arg->user, tmp))
{
thread_info *thd_info= new (arg->thd->mem_root) thread_info;
@@ -3431,9 +3462,7 @@ static my_bool processlist_callback(THD *tmp, processlist_callback_arg *arg)
arg->thd->security_ctx->master_access & PRIV_STMT_SHOW_PROCESSLIST ?
NullS : arg->thd->security_ctx->priv_user;
if ((!tmp->vio_ok() && !tmp->system_thread) ||
(user && (tmp->system_thread || !tmp_sctx->user ||
strcmp(tmp_sctx->user, user))))
if (!thd_visible_in_processlist(user, tmp))
return 0;
restore_record(arg->table, s->default_values);

View File

@@ -707,3 +707,47 @@ void print_keyuse_array_for_trace(THD *thd, DYNAMIC_ARRAY *keyuse_array)
add("null_rejecting",keyuse->null_rejecting);
}
}
#ifndef DBUG_OFF
/* Check if ptr points to memory on the mem_root */
bool dbug_is_mem_on_mem_root(const MEM_ROOT *mem_root, void *ptr)
{
const USED_MEM *ptrs[]= {mem_root->free, mem_root->used};
for (const USED_MEM **p= ptrs; p!=ptrs + 2; p++)
{
for (const USED_MEM *block= *p; block; block= block->next)
{
const char *start= (const char*)block;
const char *end= start + block->size - block->left;
DBUG_ASSERT(end >= start);
if (ptr >= start && ptr < end)
return true;
}
}
return false;
}
/*
Check whether ptr has been allocated on a statement mem_root
or transient mem_root or somewhere else.
*/
const char *dbug_which_mem_root(THD *thd, void *ptr)
{
if (dbug_is_mem_on_mem_root(thd->mem_root, ptr))
{
if (thd->mem_root == thd->stmt_arena->mem_root)
return "thd->mem_root, same as stmt_arena->mem_root";
return "thd->mem_root";
}
if (dbug_is_mem_on_mem_root(thd->stmt_arena->mem_root, ptr))
return "thd->stmt_arena->mem_root";
return "Unknown";
}
#endif

View File

@@ -23,9 +23,42 @@ class JOIN;
struct TABLE_LIST;
typedef class Item COND;
typedef class st_select_lex SELECT_LEX;
typedef class st_select_lex_unit SELECT_LEX_UNIT;
struct SORT_FIELD;
class SEL_ARG;
#ifndef DBUG_OFF
/*
Functions intended for manual use in debugger. NOT thread-safe.
*/
/* Print various data structures */
const char *dbug_print_item(Item *item);
const char *dbug_print_select(SELECT_LEX *sl);
const char *dbug_print_unit(SELECT_LEX_UNIT *un);
const char *dbug_print_sel_arg(SEL_ARG *sel_arg);
/* A single overloaded function (not inline so debugger sees them): */
const char *dbug_print(Item *x);
const char *dbug_print(SELECT_LEX *x);
const char *dbug_print(SELECT_LEX_UNIT *x);
/* Print current table row */
const char* dbug_print_table_row(TABLE *table);
const char *dbug_print_row(TABLE *table, const uchar *rec);
/* Check which MEM_ROOT the data is on */
bool dbug_is_mem_on_mem_root(const MEM_ROOT *mem_root, void *ptr);
const char *dbug_which_mem_root(THD *thd, void *ptr);
#else
// A dummy implementation is used in release builds
inline const char *dbug_print_item(Item *item) { return NULL; }
#endif
#ifndef DBUG_OFF
/* Functions that print into DBUG_FILE (/tmp/mariadb.trace by default) */
void print_where(COND *cond,const char *info, enum_query_type query_type);
void TEST_filesort(SORT_FIELD *sortorder,uint s_length);
void TEST_join(JOIN *join);

View File

@@ -662,7 +662,7 @@ Year::Year(longlong value, bool unsigned_flag, uint length)
}
uint Year::year_precision(const Item *item) const
uint Year::year_precision(const Item *item)
{
return item->type_handler() == &type_handler_year2 ? 2 : 4;
}

View File

@@ -862,7 +862,7 @@ class Year
protected:
uint m_year;
bool m_truncated;
uint year_precision(const Item *item) const;
static uint year_precision(const Item *item);
public:
Year(): m_year(0), m_truncated(false) { }
Year(longlong value, bool unsigned_flag, uint length);

View File

@@ -1512,8 +1512,7 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
if (item && is_unit_op() &&
(item->is_in_predicate() || item->is_exists_predicate()))
{
global_parameters()->order_list.first= NULL;
global_parameters()->order_list.elements= 0;
global_parameters()->optimize_out_order_list();
}
/* will only optimize once */

View File

@@ -49,6 +49,11 @@
#include "wsrep_mysqld.h"
#endif
#ifdef WITH_WSREP
#include "wsrep_mysqld.h" // wsrep_max_ws_rows, wsrep_max_ws_size
#include "wsrep_binlog.h" // WSREP_MAX_WS_SIZE
#endif
/**
True if the table's input and output record buffers are comparable using
compare_record(TABLE*).
@@ -1896,6 +1901,30 @@ int multi_update::prepare(List<Item> &not_used_values,
thd->cuted_fields=0L;
THD_STAGE_INFO(thd, stage_updating_main_table);
#ifdef WITH_WSREP
if (WSREP(thd) &&
(wsrep_max_ws_rows || wsrep_max_ws_size != WSREP_MAX_WS_SIZE))
{
int trans{0};
while (TABLE_LIST *tablel= update_targets_iter++)
trans|= 1 << tablel->table->file->has_transactions_and_rollback();
update_targets_iter.rewind();
/* In multi-table update Galera does not support update to both
transactional and non-transactional engines if write-set
size is limited. */
if (trans == 3)
{
my_error(ER_GALERA_REPLICATION_NOT_SUPPORTED, MYF(0));
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_GALERA_REPLICATION_NOT_SUPPORTED,
"Galera does not support multi-table update"
" to both transactional and non-transactional engines"
" if write-set size is limited.");
DBUG_RETURN(1);
}
}
#endif /* WITH_WSREP */
/*
We gather the set of columns read during evaluation of SET expression in
TABLE::tmp_set by pointing TABLE::read_set to it and then restore it after

View File

@@ -1690,8 +1690,12 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
/* We have to keep the lock type for sequence tables */
if (!tbl->sequence)
tbl->lock_type= table->lock_type;
tbl->mdl_request.set_type(table->mdl_request.type);
tbl->updating= table->updating;
/* VIEWs with derived are non-writable */
if (!tbl->is_pure_alias())
{
tbl->mdl_request.set_type(table->mdl_request.type);
tbl->updating= table->updating;
}
}
/*
If the view is mergeable, we might want to
@@ -1828,7 +1832,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
{
table->select_lex->order_list.
push_back(&lex->first_select_lex()->order_list);
lex->first_select_lex()->order_list.empty();
lex->first_select_lex()->optimize_out_order_list();
}
else
{

View File

@@ -2994,7 +2994,7 @@ static ORDER* concat_order_lists(MEM_ROOT *mem_root, ORDER *list1, ORDER *list2)
for (ORDER *cur= cur_list; cur; cur= cur->next)
{
ORDER *copy= (ORDER*)alloc_root(mem_root, sizeof(ORDER));
memcpy(copy, cur, sizeof(ORDER));
memcpy((void *) copy, (void *) cur, sizeof(ORDER));
if (prev)
prev->next= copy;
prev= copy;
@@ -3169,7 +3169,7 @@ bool Window_funcs_sort::setup(THD *thd, SQL_SELECT *sel,
field. We don't care of the particular sorting result in this case.
*/
ORDER *order= (ORDER *)alloc_root(thd->mem_root, sizeof(ORDER));
memset(order, 0, sizeof(*order));
memset((void *) order, 0, sizeof(*order));
Item_field *item=
new (thd->mem_root) Item_field(thd, join_tab->table->field[0]);
if (item)
@@ -3274,10 +3274,13 @@ Window_funcs_computation::save_explain_plan(MEM_ROOT *mem_root,
}
bool st_select_lex::add_window_func(Item_window_func *win_func)
bool st_select_lex::add_window_func(THD *thd, Item_window_func *win_func)
{
if (parsing_place != SELECT_LIST)
fields_in_window_functions+= win_func->window_func()->argument_count();
/* We may use it later for other clauses, now just ORDER_CLAUSE */
if (thd->where == THD_WHERE::ORDER_CLAUSE)
parent_lex->clause_winfuncs.push_back(win_func, thd->mem_root);
return window_funcs.push_back(win_func);
}

View File

@@ -11333,7 +11333,7 @@ window_func_expr:
$$= new (thd->mem_root) Item_window_func(thd, (Item_sum *) $1, $3);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
if (unlikely(Select->add_window_func((Item_window_func *) $$)))
if (unlikely(Select->add_window_func(thd, (Item_window_func *) $$)))
MYSQL_YYABORT;
}
|
@@ -11349,7 +11349,7 @@ window_func_expr:
thd->lex->win_spec);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
if (unlikely(Select->add_window_func((Item_window_func *) $$)))
if (unlikely(Select->add_window_func(thd, (Item_window_func *) $$)))
MYSQL_YYABORT;
}
;
@@ -11490,7 +11490,7 @@ inverse_distribution_function:
thd->lex->win_spec);
if (unlikely($$ == NULL))
MYSQL_YYABORT;
if (unlikely(Select->add_window_func((Item_window_func *) $$)))
if (unlikely(Select->add_window_func(thd, (Item_window_func *) $$)))
MYSQL_YYABORT;
}
;
@@ -12612,7 +12612,7 @@ opt_window_partition_clause:
opt_window_order_clause:
/* empty */ { }
| ORDER_SYM BY order_list { Select->order_list= *($3); }
| ORDER_SYM BY order_list { Select->order_list= *($3); }
;
opt_window_frame_clause:
@@ -12747,6 +12747,7 @@ order_clause:
ORDER_SYM BY
{
thd->where= THD_WHERE::ORDER_CLAUSE;
thd->lex->clause_winfuncs.empty();
}
order_list
{

View File

@@ -6431,7 +6431,7 @@ static Sys_var_charptr Sys_wsrep_start_position (
CMD_LINE(REQUIRED_ARG),
DEFAULT(WSREP_START_POSITION_ZERO),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_start_position_check),
ON_CHECK(wsrep_start_position_check),
ON_UPDATE(wsrep_start_position_update));
static Sys_var_ulong Sys_wsrep_max_ws_size (
@@ -6444,7 +6444,9 @@ static Sys_var_ulong Sys_wsrep_max_ws_size (
static Sys_var_ulong Sys_wsrep_max_ws_rows (
"wsrep_max_ws_rows", "Max number of rows in write set",
GLOBAL_VAR(wsrep_max_ws_rows), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 1048576), DEFAULT(0), BLOCK_SIZE(1));
VALID_RANGE(0, 1048576), DEFAULT(0),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_max_ws_rows_check), ON_UPDATE(0));
static Sys_var_charptr Sys_wsrep_notify_cmd(
"wsrep_notify_cmd", "",

Some files were not shown because too many files have changed in this diff Show More