1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2021-10-28 09:08:58 +03:00
37 changed files with 644 additions and 162 deletions

View File

@@ -25,6 +25,6 @@ test_script:
- set PATH=C:\Strawberry\perl\bin;%PATH%;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64 - set PATH=C:\Strawberry\perl\bin;%PATH%;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64
- cd %APPVEYOR_BUILD_FOLDER%\_build\mysql-test - cd %APPVEYOR_BUILD_FOLDER%\_build\mysql-test
- set /A parallel=4*%NUMBER_OF_PROCESSORS% - set /A parallel=4*%NUMBER_OF_PROCESSORS%
- perl mysql-test-run.pl --force --max-test-fail=10 --retry=2 -parallel=%parallel% --testcase-timeout=3 --suite=main --skip-test-list=%APPVEYOR_BUILD_FOLDER%\win\appveyor_skip_tests.txt --mysqld=--loose-innodb-flush-log-at-trx-commit=2 - perl mysql-test-run.pl --force --max-test-fail=10 --retry=2 -parallel=%parallel% --testcase-timeout=4 --suite=main --skip-test-list=%APPVEYOR_BUILD_FOLDER%\win\appveyor_skip_tests.txt --mysqld=--loose-innodb-flush-log-at-trx-commit=2
image: Visual Studio 2019 image: Visual Studio 2019

View File

@@ -297,16 +297,18 @@ void my_pthread_attr_getstacksize(pthread_attr_t *attrib, size_t *size);
int my_pthread_mutex_trylock(pthread_mutex_t *mutex); int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
#endif #endif
#if !defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
/* no pthread_yield() available */
#ifdef HAVE_SCHED_YIELD #ifdef HAVE_SCHED_YIELD
#define pthread_yield() sched_yield() #define pthread_yield() sched_yield()
#elif defined(HAVE_PTHREAD_YIELD_NP) /* can be Mac OS X */ #else
#if !defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
/* no pthread_yield() available */
#if defined(HAVE_PTHREAD_YIELD_NP) /* can be Mac OS X */
#define pthread_yield() pthread_yield_np() #define pthread_yield() pthread_yield_np()
#elif defined(HAVE_THR_YIELD) #elif defined(HAVE_THR_YIELD)
#define pthread_yield() thr_yield() #define pthread_yield() thr_yield()
#endif #endif //defined(HAVE_PTHREAD_YIELD_NP)
#endif #endif //!defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
#endif //HAVE_SCHED_YIELD
size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize); size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize);

View File

@@ -347,6 +347,27 @@ unlock tables;
drop table t1; drop table t1;
create table test.t1 (i int); create table test.t1 (i int);
drop database mysqltest2; drop database mysqltest2;
drop table test.t1;
#
# MDEV-23391 Server crash in close_thread_table or assertion, upon CREATE OR REPLACE TABLE under lock
#
create table t1 (i int);
lock table t1 write;
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock
# MDL_BACKUP_DML NULL Backup lock
# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test
# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1
create or replace table t1 (a char(1)) engine=Innodb select 'foo' as a;
ERROR 22001: Data too long for column 'a' at row 1
show tables;
Tables_in_test
t2
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
create table t1 (i int);
drop table t1;
# #
# Testing CREATE .. LIKE # Testing CREATE .. LIKE
# #
@@ -556,3 +577,4 @@ SELECT * FROM t3;
ERROR HY000: Table 't3' was not locked with LOCK TABLES ERROR HY000: Table 't3' was not locked with LOCK TABLES
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t3; DROP TABLE t3;
# End of 10.4 tests

View File

@@ -275,6 +275,26 @@ drop table t1;
create table test.t1 (i int); create table test.t1 (i int);
drop database mysqltest2; drop database mysqltest2;
drop table test.t1;
--echo #
--echo # MDEV-23391 Server crash in close_thread_table or assertion, upon CREATE OR REPLACE TABLE under lock
--echo #
create table t1 (i int);
lock table t1 write;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info;
--error ER_DATA_TOO_LONG
create or replace table t1 (a char(1)) engine=Innodb select 'foo' as a;
show tables;
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info;
create table t1 (i int);
drop table t1;
--echo # --echo #
--echo # Testing CREATE .. LIKE --echo # Testing CREATE .. LIKE
@@ -496,3 +516,5 @@ CREATE OR REPLACE TEMPORARY TABLE t2(c INT DEFAULT '');
SELECT * FROM t3; SELECT * FROM t3;
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t3; DROP TABLE t3;
--echo # End of 10.4 tests

View File

@@ -7919,6 +7919,28 @@ a b
DROP TABLE t1; DROP TABLE t1;
SET NAMES utf8; SET NAMES utf8;
# #
# MDEV-25402 Assertion `!str || str != Ptr' failed in String::copy
#
SET @c:="SET SESSION collation_connection=utf32_spanish_ci";
PREPARE s FROM @c;
EXECUTE s;
CREATE PROCEDURE p (IN i INT) EXECUTE s;
SET SESSION character_set_connection=latin1;
SET @c:="SET @b=get_format(DATE,'EUR')";
PREPARE s FROM @c;
EXECUTE s;
CALL p (@a);
DEALLOCATE PREPARE s;
DROP PROCEDURE p;
SET NAMES utf8;
SET @c:="SET @b=get_format(DATE,'EUR')";
PREPARE s FROM @c;
EXECUTE s;
SET collation_connection=utf32_spanish_ci;
EXECUTE s;
DEALLOCATE PREPARE s;
SET NAMES utf8;
#
# End of 10.2 tests # End of 10.2 tests
# #
# #

View File

@@ -265,6 +265,32 @@ SET NAMES utf8, collation_connection=utf32_unicode_520_nopad_ci;
SET NAMES utf8; SET NAMES utf8;
--echo #
--echo # MDEV-25402 Assertion `!str || str != Ptr' failed in String::copy
--echo #
SET @c:="SET SESSION collation_connection=utf32_spanish_ci";
PREPARE s FROM @c;
EXECUTE s;
CREATE PROCEDURE p (IN i INT) EXECUTE s;
SET SESSION character_set_connection=latin1;
SET @c:="SET @b=get_format(DATE,'EUR')";
PREPARE s FROM @c;
EXECUTE s;
CALL p (@a);
DEALLOCATE PREPARE s;
DROP PROCEDURE p;
SET NAMES utf8;
SET @c:="SET @b=get_format(DATE,'EUR')";
PREPARE s FROM @c;
EXECUTE s;
SET collation_connection=utf32_spanish_ci;
EXECUTE s;
DEALLOCATE PREPARE s;
SET NAMES utf8;
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #

View File

@@ -1,3 +1,4 @@
--source include/have_partition.inc
# #
# Basic stored PROCEDURE tests # Basic stored PROCEDURE tests
# #

View File

@@ -826,3 +826,203 @@ DROP TABLE email_stats;
DROP TABLE emails_metadata; DROP TABLE emails_metadata;
DROP TABLE emails; DROP TABLE emails;
DROP DATABASE `a-b`; DROP DATABASE `a-b`;
USE test;
#
# Bug#33053297 VIRTUAL INDEX CORRUPTED DURING CASCADE UPDATE ON CHILD TABLE
#
# Test-Case 1
CREATE TABLE emails (
id int unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE email_stats (
id bigint unsigned NOT NULL AUTO_INCREMENT,
email_id int unsigned DEFAULT NULL,
date_sent datetime NOT NULL,
generated_sent_date date GENERATED ALWAYS AS
(concat(year(date_sent), '-', lpad(month(date_sent), 2, '0'),
'-', lpad(dayofmonth(date_sent), 2, '0'))),
PRIMARY KEY (id),
KEY IDX_ES1 (email_id),
KEY mautic_generated_sent_date_email_id(generated_sent_date, email_id),
FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE SET NULL
) ENGINE = InnoDB;
INSERT INTO emails VALUES (1);
INSERT INTO email_stats (id, email_id, date_sent)
VALUES (1, 1, '2020-10-22 13:32:41');
SELECT * FROM email_stats;
id email_id date_sent generated_sent_date
1 1 2020-10-22 13:32:41 2020-10-22
DELETE FROM emails;
DELETE FROM email_stats;
# Clean up.
DROP TABLE email_stats;
DROP TABLE emails;
# Test-Case 2
CREATE TABLE emails (
id int unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC;
CREATE TABLE email_stats (
id bigint unsigned NOT NULL AUTO_INCREMENT,
email_id int unsigned DEFAULT NULL,
date_sent datetime NOT NULL,
generated_sent_date date GENERATED ALWAYS AS
(concat(year(date_sent), '-', lpad(month(date_sent), 2, '0'),
'-', lpad(dayofmonth(date_sent), 2, '0'))),
PRIMARY KEY (id),
KEY IDX_ES1 (email_id),
KEY mautic_generated_sent_date_email_id(generated_sent_date, email_id),
FOREIGN KEY (email_id) REFERENCES emails (id)
ON DELETE SET NULL
ON UPDATE SET NULL
) ENGINE = InnoDB;
INSERT INTO emails VALUES (1);
INSERT INTO email_stats (id, email_id, date_sent)
VALUES (1, 1, '2020-10-22 13:32:41');
UPDATE emails SET id = 2 where id = 1;
SELECT id FROM email_stats WHERE generated_sent_date IS NULL;
id
SELECT * FROM email_stats;
id email_id date_sent generated_sent_date
1 NULL 2020-10-22 13:32:41 2020-10-22
UPDATE email_stats
SET email_id=2
WHERE DATE(generated_sent_date) = '2020-10-22';
SELECT * FROM email_stats;
id email_id date_sent generated_sent_date
1 2 2020-10-22 13:32:41 2020-10-22
# Clean up.
DROP TABLE email_stats;
DROP TABLE emails;
# Test-case 3
CREATE TABLE emails (
id int unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE = INNODB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC;
CREATE TABLE email_stats (
id bigint unsigned NOT NULL AUTO_INCREMENT,
email_id int unsigned DEFAULT NULL,
date_sent datetime NOT NULL,
generated_sent_email varchar(20) GENERATED ALWAYS AS
(CONCAT(YEAR(date_sent), '-', COALESCE(email_id, '$'))),
PRIMARY KEY (id),
KEY idx_es1 (email_id),
KEY mautic_generated_sent_date_email(generated_sent_email, email_id),
FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE SET NULL
) ENGINE = INNODB;
INSERT INTO emails VALUES (1);
INSERT INTO email_stats (id, email_id, date_sent)
VALUES (1, 1, '2020-10-22 13:32:41');
SELECT * FROM email_stats;
id email_id date_sent generated_sent_email
1 1 2020-10-22 13:32:41 2020-1
SELECT date_sent FROM email_stats WHERE generated_sent_email = '2020-1';
date_sent
2020-10-22 13:32:41
DELETE FROM emails;
SELECT * FROM email_stats;
id email_id date_sent generated_sent_email
1 NULL 2020-10-22 13:32:41 2020-$
SELECT date_sent FROM email_stats WHERE generated_sent_email = '2020-$';
date_sent
2020-10-22 13:32:41
# Clean up.
DROP TABLE email_stats;
DROP TABLE emails;
# Test-case 4
CREATE TABLE emails (
id int unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE = INNODB;
CREATE TABLE email_stats (
id bigint unsigned NOT NULL AUTO_INCREMENT,
email_id int unsigned DEFAULT NULL,
date_sent datetime NOT NULL,
generated_sent_email varchar(20) GENERATED ALWAYS AS
(CONCAT(YEAR(date_sent), '-', COALESCE(email_id, '$'))),
PRIMARY KEY (id),
KEY idx_es1 (email_id),
KEY mautic_generated_sent_date_email(generated_sent_email, email_id),
FOREIGN KEY (email_id) REFERENCES emails (id) ON UPDATE SET NULL
) ENGINE = INNODB;
INSERT INTO emails VALUES (1);
INSERT INTO email_stats (id, email_id, date_sent)
VALUES (1, 1, '2020-10-22 13:32:41');
SELECT * FROM email_stats;
id email_id date_sent generated_sent_email
1 1 2020-10-22 13:32:41 2020-1
SELECT date_sent FROM email_stats WHERE generated_sent_email = '2020-1';
date_sent
2020-10-22 13:32:41
UPDATE emails SET id = 2 WHERE id = 1;
SELECT * FROM email_stats;
id email_id date_sent generated_sent_email
1 NULL 2020-10-22 13:32:41 2020-$
SELECT date_sent FROM email_stats WHERE generated_sent_email = '2020-$';
date_sent
2020-10-22 13:32:41
DROP TABLE email_stats;
DROP TABLE emails;
CREATE TABLE emails (breaker int unsigned,
KEY (breaker),
id int unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE=INNODB;
CREATE TABLE email_stats (
id bigint unsigned NOT NULL AUTO_INCREMENT,
email_id int unsigned DEFAULT NULL,
date_sent datetime NOT NULL,
generated_sent_email varchar(20) GENERATED ALWAYS AS
(CONCAT(YEAR(date_sent),
'-',
COALESCE(email_id, '$'))),
PRIMARY KEY (id),
KEY idx_es1 (email_id),
KEY mautic_generated_sent_date_email (generated_sent_email, email_id),
FOREIGN KEY fk_ea1 (email_id) REFERENCES emails (breaker)
ON DELETE SET NULL
) ENGINE=INNODB;
show create table email_stats;
Table Create Table
email_stats CREATE TABLE `email_stats` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`email_id` int(10) unsigned DEFAULT NULL,
`date_sent` datetime NOT NULL,
`generated_sent_email` varchar(20) GENERATED ALWAYS AS (concat(year(`date_sent`),'-',coalesce(`email_id`,'$'))) VIRTUAL,
PRIMARY KEY (`id`),
KEY `idx_es1` (`email_id`),
KEY `mautic_generated_sent_date_email` (`generated_sent_email`,`email_id`),
CONSTRAINT `fk_ea1` FOREIGN KEY (`email_id`) REFERENCES `emails` (`breaker`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
INSERT INTO emails VALUES (1,1);
INSERT INTO email_stats(id, email_id, date_sent)
VALUES (1, 1, '2020-10-22 13:32:41');
SELECT * FROM email_stats;
id email_id date_sent generated_sent_email
1 1 2020-10-22 13:32:41 2020-1
SELECT date_sent FROM email_stats WHERE generated_sent_email = '2020-1';
date_sent
2020-10-22 13:32:41
DELETE FROM emails;
SELECT * FROM email_stats;
id email_id date_sent generated_sent_email
1 NULL 2020-10-22 13:32:41 2020-$
SELECT date_sent
FROM email_stats force index (mautic_generated_sent_date_email)
WHERE generated_sent_email = '2020-$';
date_sent
2020-10-22 13:32:41
SELECT date_sent
FROM email_stats force index (idx_es1)
WHERE generated_sent_email = '2020-$';
date_sent
2020-10-22 13:32:41
DROP TABLE email_stats;
DROP TABLE emails;

View File

@@ -693,3 +693,187 @@ DROP TABLE email_stats;
DROP TABLE emails_metadata; DROP TABLE emails_metadata;
DROP TABLE emails; DROP TABLE emails;
DROP DATABASE `a-b`; DROP DATABASE `a-b`;
USE test;
--echo #
--echo # Bug#33053297 VIRTUAL INDEX CORRUPTED DURING CASCADE UPDATE ON CHILD TABLE
--echo #
--echo # Test-Case 1
CREATE TABLE emails (
id int unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE email_stats (
id bigint unsigned NOT NULL AUTO_INCREMENT,
email_id int unsigned DEFAULT NULL,
date_sent datetime NOT NULL,
generated_sent_date date GENERATED ALWAYS AS
(concat(year(date_sent), '-', lpad(month(date_sent), 2, '0'),
'-', lpad(dayofmonth(date_sent), 2, '0'))),
PRIMARY KEY (id),
KEY IDX_ES1 (email_id),
KEY mautic_generated_sent_date_email_id(generated_sent_date, email_id),
FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE SET NULL
) ENGINE = InnoDB;
INSERT INTO emails VALUES (1);
INSERT INTO email_stats (id, email_id, date_sent)
VALUES (1, 1, '2020-10-22 13:32:41');
SELECT * FROM email_stats;
DELETE FROM emails;
DELETE FROM email_stats;
--echo # Clean up.
DROP TABLE email_stats;
DROP TABLE emails;
--echo # Test-Case 2
CREATE TABLE emails (
id int unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC;
CREATE TABLE email_stats (
id bigint unsigned NOT NULL AUTO_INCREMENT,
email_id int unsigned DEFAULT NULL,
date_sent datetime NOT NULL,
generated_sent_date date GENERATED ALWAYS AS
(concat(year(date_sent), '-', lpad(month(date_sent), 2, '0'),
'-', lpad(dayofmonth(date_sent), 2, '0'))),
PRIMARY KEY (id),
KEY IDX_ES1 (email_id),
KEY mautic_generated_sent_date_email_id(generated_sent_date, email_id),
FOREIGN KEY (email_id) REFERENCES emails (id)
ON DELETE SET NULL
ON UPDATE SET NULL
) ENGINE = InnoDB;
INSERT INTO emails VALUES (1);
INSERT INTO email_stats (id, email_id, date_sent)
VALUES (1, 1, '2020-10-22 13:32:41');
UPDATE emails SET id = 2 where id = 1;
SELECT id FROM email_stats WHERE generated_sent_date IS NULL;
SELECT * FROM email_stats;
UPDATE email_stats
SET email_id=2
WHERE DATE(generated_sent_date) = '2020-10-22';
SELECT * FROM email_stats;
--echo # Clean up.
DROP TABLE email_stats;
DROP TABLE emails;
--echo # Test-case 3
CREATE TABLE emails (
id int unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE = INNODB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC;
CREATE TABLE email_stats (
id bigint unsigned NOT NULL AUTO_INCREMENT,
email_id int unsigned DEFAULT NULL,
date_sent datetime NOT NULL,
generated_sent_email varchar(20) GENERATED ALWAYS AS
(CONCAT(YEAR(date_sent), '-', COALESCE(email_id, '$'))),
PRIMARY KEY (id),
KEY idx_es1 (email_id),
KEY mautic_generated_sent_date_email(generated_sent_email, email_id),
FOREIGN KEY (email_id) REFERENCES emails (id) ON DELETE SET NULL
) ENGINE = INNODB;
INSERT INTO emails VALUES (1);
INSERT INTO email_stats (id, email_id, date_sent)
VALUES (1, 1, '2020-10-22 13:32:41');
SELECT * FROM email_stats;
SELECT date_sent FROM email_stats WHERE generated_sent_email = '2020-1';
DELETE FROM emails;
SELECT * FROM email_stats;
SELECT date_sent FROM email_stats WHERE generated_sent_email = '2020-$';
--echo # Clean up.
DROP TABLE email_stats;
DROP TABLE emails;
--echo # Test-case 4
CREATE TABLE emails (
id int unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE = INNODB;
CREATE TABLE email_stats (
id bigint unsigned NOT NULL AUTO_INCREMENT,
email_id int unsigned DEFAULT NULL,
date_sent datetime NOT NULL,
generated_sent_email varchar(20) GENERATED ALWAYS AS
(CONCAT(YEAR(date_sent), '-', COALESCE(email_id, '$'))),
PRIMARY KEY (id),
KEY idx_es1 (email_id),
KEY mautic_generated_sent_date_email(generated_sent_email, email_id),
FOREIGN KEY (email_id) REFERENCES emails (id) ON UPDATE SET NULL
) ENGINE = INNODB;
INSERT INTO emails VALUES (1);
INSERT INTO email_stats (id, email_id, date_sent)
VALUES (1, 1, '2020-10-22 13:32:41');
SELECT * FROM email_stats;
SELECT date_sent FROM email_stats WHERE generated_sent_email = '2020-1';
UPDATE emails SET id = 2 WHERE id = 1;
SELECT * FROM email_stats;
SELECT date_sent FROM email_stats WHERE generated_sent_email = '2020-$';
#clean up.
DROP TABLE email_stats;
DROP TABLE emails;
CREATE TABLE emails (breaker int unsigned,
KEY (breaker),
id int unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) ENGINE=INNODB;
CREATE TABLE email_stats (
id bigint unsigned NOT NULL AUTO_INCREMENT,
email_id int unsigned DEFAULT NULL,
date_sent datetime NOT NULL,
generated_sent_email varchar(20) GENERATED ALWAYS AS
(CONCAT(YEAR(date_sent),
'-',
COALESCE(email_id, '$'))),
PRIMARY KEY (id),
KEY idx_es1 (email_id),
KEY mautic_generated_sent_date_email (generated_sent_email, email_id),
FOREIGN KEY fk_ea1 (email_id) REFERENCES emails (breaker)
ON DELETE SET NULL
) ENGINE=INNODB;
show create table email_stats;
INSERT INTO emails VALUES (1,1);
INSERT INTO email_stats(id, email_id, date_sent)
VALUES (1, 1, '2020-10-22 13:32:41');
SELECT * FROM email_stats;
SELECT date_sent FROM email_stats WHERE generated_sent_email = '2020-1';
DELETE FROM emails;
SELECT * FROM email_stats;
SELECT date_sent
FROM email_stats force index (mautic_generated_sent_date_email)
WHERE generated_sent_email = '2020-$';
SELECT date_sent
FROM email_stats force index (idx_es1)
WHERE generated_sent_email = '2020-$';
DROP TABLE email_stats;
DROP TABLE emails;

View File

@@ -1,4 +1,5 @@
#--source include/innodb_page_size.inc #--source include/innodb_page_size.inc
--source include/have_partition.inc
# import partitioned table from table from partial backup # import partitioned table from table from partial backup

View File

@@ -265,6 +265,9 @@ A B C D
A B C D A B C D
set global server_audit_query_log_limit= 1024; set global server_audit_query_log_limit= 1024;
drop database sa_db; drop database sa_db;
select length('01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789');
length('0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456
2750
set global server_audit_file_path='.'; set global server_audit_file_path='.';
show status like 'server_audit_current_log'; show status like 'server_audit_current_log';
Variable_name Value Variable_name Value
@@ -501,6 +504,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,proc,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc,
TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select length(\'012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0

View File

@@ -216,6 +216,8 @@ select 'A', 'B', 'C', 'D';
set global server_audit_query_log_limit= 1024; set global server_audit_query_log_limit= 1024;
drop database sa_db; drop database sa_db;
select length('01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789');
set global server_audit_file_path='.'; set global server_audit_file_path='.';
--replace_regex /\.[\\\/]/HOME_DIR\// --replace_regex /\.[\\\/]/HOME_DIR\//
show status like 'server_audit_current_log'; show status like 'server_audit_current_log';

View File

@@ -69,3 +69,28 @@ id name
drop table t1; drop table t1;
disconnect test_con1; disconnect test_con1;
disconnect test_con2; disconnect test_con2;
connection default;
CREATE TABLE t1(id int primary key auto_increment);
SET SESSION insert_id=123;
SET SESSION insert_id=0;
INSERT INTO t1 VALUES ();
SET SESSION insert_id=123;
SET SESSION insert_id=default;
INSERT INTO t1 VALUES ();
SET SESSION insert_id=123;
SET SESSION insert_id=-1;
Warnings:
Warning 1292 Truncated incorrect insert_id value: '-1'
INSERT INTO t1 VALUES ();
SET SESSION insert_id=123;
SET SESSION insert_id=-10;
Warnings:
Warning 1292 Truncated incorrect insert_id value: '-10'
INSERT INTO t1 VALUES ();
SELECT * FROM t1;
id
1
2
3
4
DROP TABLE t1;

View File

@@ -103,3 +103,23 @@ drop table t1;
disconnect test_con1; disconnect test_con1;
disconnect test_con2; disconnect test_con2;
# MDEV-22711 Assertion `nr != 0' failed in handler::update_auto_increment.
#
connection default;
CREATE TABLE t1(id int primary key auto_increment);
SET SESSION insert_id=123;
SET SESSION insert_id=0;
INSERT INTO t1 VALUES ();
SET SESSION insert_id=123;
SET SESSION insert_id=default;
INSERT INTO t1 VALUES ();
SET SESSION insert_id=123;
SET SESSION insert_id=-1;
INSERT INTO t1 VALUES ();
SET SESSION insert_id=123;
SET SESSION insert_id=-10;
INSERT INTO t1 VALUES ();
SELECT * FROM t1;
DROP TABLE t1;

View File

@@ -372,9 +372,9 @@ int sf_sanity()
if (count || irem) if (count || irem)
{ {
warn("Error: Safemalloc link list destroyed"); warn("Error: Safemalloc link list destroyed");
return 1; flag= 1;
} }
return 0; return flag;
} }
/** /**

View File

@@ -309,8 +309,6 @@ static char logging;
static volatile int internal_stop_logging= 0; static volatile int internal_stop_logging= 0;
static char incl_user_buffer[1024]; static char incl_user_buffer[1024];
static char excl_user_buffer[1024]; static char excl_user_buffer[1024];
static char *big_buffer= NULL;
static size_t big_buffer_alloced= 0;
static unsigned int query_log_limit= 0; static unsigned int query_log_limit= 0;
static char servhost[HOSTNAME_LENGTH+1]; static char servhost[HOSTNAME_LENGTH+1];
@@ -569,18 +567,10 @@ static PSI_mutex_info mutex_key_list[]=
{ {
{ &key_LOCK_operations, "SERVER_AUDIT_plugin::lock_operations", { &key_LOCK_operations, "SERVER_AUDIT_plugin::lock_operations",
PSI_FLAG_GLOBAL} PSI_FLAG_GLOBAL}
#ifndef FLOGGER_NO_PSI
,
{ &key_LOCK_atomic, "SERVER_AUDIT_plugin::lock_atomic",
PSI_FLAG_GLOBAL},
{ &key_LOCK_bigbuffer, "SERVER_AUDIT_plugin::lock_bigbuffer",
PSI_FLAG_GLOBAL}
#endif /*FLOGGER_NO_PSI*/
}; };
#endif /*HAVE_PSI_INTERFACE*/ #endif /*HAVE_PSI_INTERFACE*/
static mysql_prlock_t lock_operations; static mysql_prlock_t lock_operations;
static mysql_mutex_t lock_atomic; static mysql_mutex_t lock_atomic;
static mysql_mutex_t lock_bigbuffer;
/* The Percona server and partly MySQL don't support */ /* The Percona server and partly MySQL don't support */
/* launching client errors in the 'update_variable' methods. */ /* launching client errors in the 'update_variable' methods. */
@@ -1744,7 +1734,7 @@ static int log_statement_ex(const struct connection_info *cn,
int error_code, const char *type, int take_lock) int error_code, const char *type, int take_lock)
{ {
size_t csize; size_t csize;
char message_loc[1024]; char message_loc[2048];
char *message= message_loc; char *message= message_loc;
size_t message_size= sizeof(message_loc); size_t message_size= sizeof(message_loc);
char *uh_buffer; char *uh_buffer;
@@ -1753,6 +1743,7 @@ static int log_statement_ex(const struct connection_info *cn,
unsigned int db_length; unsigned int db_length;
long long query_id; long long query_id;
int result; int result;
char *big_buffer= NULL;
if ((db= cn->db)) if ((db= cn->db))
db_length= cn->db_length; db_length= cn->db_length;
@@ -1835,17 +1826,9 @@ do_log_query:
if (query_len > (message_size - csize)/2) if (query_len > (message_size - csize)/2)
{ {
flogger_mutex_lock(&lock_bigbuffer); size_t big_buffer_alloced= (query_len * 2 + csize + 4095) & ~4095L;
if (big_buffer_alloced < (query_len * 2 + csize)) if(!(big_buffer= malloc(big_buffer_alloced)))
{
big_buffer_alloced= (query_len * 2 + csize + 4095) & ~4095L;
big_buffer= realloc(big_buffer, big_buffer_alloced);
if (big_buffer == NULL)
{
big_buffer_alloced= 0;
return 0; return 0;
}
}
memcpy(big_buffer, message, csize); memcpy(big_buffer, message, csize);
message= big_buffer; message= big_buffer;
@@ -1891,8 +1874,8 @@ do_log_query:
"\',%d", error_code); "\',%d", error_code);
message[csize]= '\n'; message[csize]= '\n';
result= write_log(message, csize + 1, take_lock); result= write_log(message, csize + 1, take_lock);
if (message == big_buffer) if (big_buffer)
flogger_mutex_unlock(&lock_bigbuffer); free(big_buffer);
return result; return result;
} }
@@ -2548,7 +2531,6 @@ static int server_audit_init(void *p __attribute__((unused)))
#endif #endif
mysql_prlock_init(key_LOCK_operations, &lock_operations); mysql_prlock_init(key_LOCK_operations, &lock_operations);
flogger_mutex_init(key_LOCK_operations, &lock_atomic, MY_MUTEX_INIT_FAST); flogger_mutex_init(key_LOCK_operations, &lock_atomic, MY_MUTEX_INIT_FAST);
flogger_mutex_init(key_LOCK_operations, &lock_bigbuffer, MY_MUTEX_INIT_FAST);
coll_init(&incl_user_coll); coll_init(&incl_user_coll);
coll_init(&excl_user_coll); coll_init(&excl_user_coll);
@@ -2633,10 +2615,8 @@ static int server_audit_deinit(void *p __attribute__((unused)))
else if (output_type == OUTPUT_SYSLOG) else if (output_type == OUTPUT_SYSLOG)
closelog(); closelog();
(void) free(big_buffer);
mysql_prlock_destroy(&lock_operations); mysql_prlock_destroy(&lock_operations);
flogger_mutex_destroy(&lock_atomic); flogger_mutex_destroy(&lock_atomic);
flogger_mutex_destroy(&lock_bigbuffer);
error_header(); error_header();
fprintf(stderr, "STOPPED\n"); fprintf(stderr, "STOPPED\n");

View File

@@ -3500,7 +3500,6 @@ bool Item_func_timediff::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzy
DBUG_ASSERT(fixed()); DBUG_ASSERT(fixed());
int l_sign= 1; int l_sign= 1;
MYSQL_TIME l_time1,l_time2,l_time3; MYSQL_TIME l_time1,l_time2,l_time3;
ErrConvTime str(&l_time3);
/* the following may be true in, for example, date_add(timediff(...), ... */ /* the following may be true in, for example, date_add(timediff(...), ... */
if (fuzzydate & TIME_NO_ZERO_IN_DATE) if (fuzzydate & TIME_NO_ZERO_IN_DATE)

View File

@@ -216,8 +216,6 @@ Protocol::net_send_ok(THD *thd,
NET *net= &thd->net; NET *net= &thd->net;
StringBuffer<MYSQL_ERRMSG_SIZE + 10> store; StringBuffer<MYSQL_ERRMSG_SIZE + 10> store;
bool state_changed= false;
bool error= FALSE; bool error= FALSE;
DBUG_ENTER("Protocol::net_send_ok"); DBUG_ENTER("Protocol::net_send_ok");
@@ -244,6 +242,11 @@ Protocol::net_send_ok(THD *thd,
/* last insert id */ /* last insert id */
store.q_net_store_length(id); store.q_net_store_length(id);
/* if client has not session tracking capability, don't send state change flag*/
if (!(thd->client_capabilities & CLIENT_SESSION_TRACK)) {
server_status &= ~SERVER_SESSION_STATE_CHANGED;
}
if (thd->client_capabilities & CLIENT_PROTOCOL_41) if (thd->client_capabilities & CLIENT_PROTOCOL_41)
{ {
DBUG_PRINT("info", DBUG_PRINT("info",
@@ -264,21 +267,17 @@ Protocol::net_send_ok(THD *thd,
} }
thd->get_stmt_da()->set_overwrite_status(true); thd->get_stmt_da()->set_overwrite_status(true);
state_changed= if ((server_status & SERVER_SESSION_STATE_CHANGED) || (message && message[0]))
(thd->client_capabilities & CLIENT_SESSION_TRACK) &&
(server_status & SERVER_SESSION_STATE_CHANGED);
if (state_changed || (message && message[0]))
{ {
DBUG_ASSERT(safe_strlen(message) <= MYSQL_ERRMSG_SIZE); DBUG_ASSERT(safe_strlen(message) <= MYSQL_ERRMSG_SIZE);
store.q_net_store_data((uchar*) safe_str(message), safe_strlen(message)); store.q_net_store_data((uchar*) safe_str(message), safe_strlen(message));
} }
if (unlikely(state_changed)) if (unlikely(server_status & SERVER_SESSION_STATE_CHANGED))
{ {
store.set_charset(thd->variables.collation_database); store.set_charset(thd->variables.collation_database);
thd->session_tracker.store(thd, &store); thd->session_tracker.store(thd, &store);
thd->server_status&= ~SERVER_SESSION_STATE_CHANGED;
} }
DBUG_ASSERT(store.length() <= MAX_PACKET_LENGTH); DBUG_ASSERT(store.length() <= MAX_PACKET_LENGTH);
@@ -287,8 +286,6 @@ Protocol::net_send_ok(THD *thd,
if (likely(!error)) if (likely(!error))
error= net_flush(net); error= net_flush(net);
thd->server_status&= ~SERVER_SESSION_STATE_CHANGED;
thd->get_stmt_da()->set_overwrite_status(false); thd->get_stmt_da()->set_overwrite_status(false);
DBUG_PRINT("info", ("OK sent, so no more error sending allowed")); DBUG_PRINT("info", ("OK sent, so no more error sending allowed"));

View File

@@ -4198,6 +4198,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (wsrep_before_statement(thd)) if (wsrep_before_statement(thd))
{ {
mysql_mutex_unlock(&rli->data_lock);
delete ev;
WSREP_INFO("Wsrep before statement error"); WSREP_INFO("Wsrep before statement error");
DBUG_RETURN(1); DBUG_RETURN(1);
} }

View File

@@ -1929,7 +1929,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
/* /*
Elements in this array match members of enum Extra_tag, defined in Elements in this array match members of enum explain_extra_tag, defined in
sql_explain.h sql_explain.h
*/ */

View File

@@ -5178,12 +5178,6 @@ void select_create::abort_result_set()
/* possible error of writing binary log is ignored deliberately */ /* possible error of writing binary log is ignored deliberately */
(void) thd->binlog_flush_pending_rows_event(TRUE, TRUE); (void) thd->binlog_flush_pending_rows_event(TRUE, TRUE);
if (create_info->table_was_deleted)
{
/* Unlock locked table that was dropped by CREATE */
thd->locked_tables_list.unlock_locked_table(thd,
create_info->mdl_ticket);
}
if (table) if (table)
{ {
bool tmp_table= table->s->tmp_table; bool tmp_table= table->s->tmp_table;
@@ -5248,7 +5242,16 @@ void select_create::abort_result_set()
} }
} }
} }
ddl_log_complete(&ddl_log_state_rm); ddl_log_complete(&ddl_log_state_rm);
ddl_log_complete(&ddl_log_state_create); ddl_log_complete(&ddl_log_state_create);
if (create_info->table_was_deleted)
{
/* Unlock locked table that was dropped by CREATE. */
(void) trans_rollback_stmt(thd);
thd->locked_tables_list.unlock_locked_table(thd, create_info->mdl_ticket);
}
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. /* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2016, 2020, MariaDB Copyright (c) 2016, 2021, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@@ -447,7 +447,7 @@ bool String::copy(const char *str, size_t arg_length,
{ {
uint32 offset; uint32 offset;
DBUG_ASSERT(!str || str != Ptr); DBUG_ASSERT(!str || str != Ptr || !is_alloced());
if (!needs_conversion(arg_length, from_cs, to_cs, &offset)) if (!needs_conversion(arg_length, from_cs, to_cs, &offset))
{ {

View File

@@ -4730,11 +4730,15 @@ static Sys_var_session_special Sys_identity(
*/ */
static bool update_insert_id(THD *thd, set_var *var) static bool update_insert_id(THD *thd, set_var *var)
{ {
if (!var->value) /*
{ If we set the insert_id to the DEFAULT or 0
my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str); it means we 'reset' it so it's value doesn't
return true; affect the INSERT.
} */
if (!var->value ||
var->save_result.ulonglong_value == 0)
thd->auto_inc_intervals_forced.empty();
else
thd->force_one_auto_inc_interval(var->save_result.ulonglong_value); thd->force_one_auto_inc_interval(var->save_result.ulonglong_value);
return false; return false;
} }
@@ -4743,6 +4747,8 @@ static ulonglong read_insert_id(THD *thd)
{ {
return thd->auto_inc_intervals_forced.minimum(); return thd->auto_inc_intervals_forced.minimum();
} }
static Sys_var_session_special Sys_insert_id( static Sys_var_session_special Sys_insert_id(
"insert_id", "The value to be used by the following INSERT " "insert_id", "The value to be used by the following INSERT "
"or ALTER TABLE statement when inserting an AUTO_INCREMENT value", "or ALTER TABLE statement when inserting an AUTO_INCREMENT value",

View File

@@ -673,13 +673,18 @@ SysTablespace::file_not_found(
{ {
file.m_exists = false; file.m_exists = false;
if (srv_read_only_mode && !m_ignore_read_only) { if (m_ignore_read_only) {
} else if (srv_read_only_mode) {
ib::error() << "Can't create file '" << file.filepath() ib::error() << "Can't create file '" << file.filepath()
<< "' when --innodb-read-only is set"; << "' when --innodb-read-only is set";
return(DB_ERROR); return(DB_ERROR);
} else if (srv_force_recovery && space_id() == TRX_SYS_SPACE) {
ib::error() << "Can't create file '" << file.filepath()
<< "' when --innodb-force-recovery is set";
return DB_ERROR;
}
} else if (&file == &m_files.front()) { if (&file == &m_files.front()) {
/* First data file. */ /* First data file. */
ut_a(!*create_new_db); ut_a(!*create_new_db);

View File

@@ -20150,48 +20150,6 @@ innobase_rename_vc_templ(
table->vc_templ->tb_name = t_tbname; table->vc_templ->tb_name = t_tbname;
} }
/** Get the updated parent field value from the update vector for the
given col_no.
@param[in] foreign foreign key information
@param[in] update updated parent vector.
@param[in] col_no base column position of the child table to check
@return updated field from the parent update vector, else NULL */
static
dfield_t*
innobase_get_field_from_update_vector(
dict_foreign_t* foreign,
upd_t* update,
ulint col_no)
{
dict_table_t* parent_table = foreign->referenced_table;
dict_index_t* parent_index = foreign->referenced_index;
ulint parent_field_no;
ulint parent_col_no;
ulint prefix_col_no;
for (ulint i = 0; i < foreign->n_fields; i++) {
if (dict_index_get_nth_col_no(foreign->foreign_index, i)
!= col_no) {
continue;
}
parent_col_no = dict_index_get_nth_col_no(parent_index, i);
parent_field_no = dict_table_get_nth_col_pos(
parent_table, parent_col_no, &prefix_col_no);
for (ulint j = 0; j < update->n_fields; j++) {
upd_field_t* parent_ufield
= &update->fields[j];
if (parent_ufield->field_no == parent_field_no) {
return(&parent_ufield->new_val);
}
}
}
return (NULL);
}
/** /**
Allocate a heap and record for calculating virtual fields Allocate a heap and record for calculating virtual fields
@@ -20274,9 +20232,10 @@ void innobase_report_computed_value_failed(dtuple_t *row)
@param[in] ifield index field @param[in] ifield index field
@param[in] thd MySQL thread handle @param[in] thd MySQL thread handle
@param[in,out] mysql_table mysql table object @param[in,out] mysql_table mysql table object
@param[in,out] mysql_rec MariaDB record buffer
@param[in] old_table during ALTER TABLE, this is the old table @param[in] old_table during ALTER TABLE, this is the old table
or NULL. or NULL.
@param[in] parent_update update vector for the parent row @param[in] update update vector for the row, if any
@param[in] foreign foreign key information @param[in] foreign foreign key information
@return the field filled with computed value, or NULL if just want @return the field filled with computed value, or NULL if just want
to store the value in passed in "my_rec" */ to store the value in passed in "my_rec" */
@@ -20292,8 +20251,7 @@ innobase_get_computed_value(
TABLE* mysql_table, TABLE* mysql_table,
byte* mysql_rec, byte* mysql_rec,
const dict_table_t* old_table, const dict_table_t* old_table,
upd_t* parent_update, const upd_t* update)
dict_foreign_t* foreign)
{ {
byte rec_buf2[REC_VERSION_56_MAX_INDEX_COL_LEN]; byte rec_buf2[REC_VERSION_56_MAX_INDEX_COL_LEN];
byte* buf; byte* buf;
@@ -20306,6 +20264,8 @@ innobase_get_computed_value(
ulint ret = 0; ulint ret = 0;
dict_index_t *clust_index= dict_table_get_first_index(index->table);
ut_ad(index->table->vc_templ); ut_ad(index->table->vc_templ);
ut_ad(thd != NULL); ut_ad(thd != NULL);
ut_ad(mysql_table); ut_ad(mysql_table);
@@ -20335,14 +20295,17 @@ innobase_get_computed_value(
= index->table->vc_templ->vtempl[col_no]; = index->table->vc_templ->vtempl[col_no];
const byte* data; const byte* data;
if (parent_update != NULL) { if (update) {
/** Get the updated field from update vector ulint clust_no = dict_col_get_clust_pos(base_col,
of the parent table. */ clust_index);
row_field = innobase_get_field_from_update_vector( ut_ad(clust_no != ULINT_UNDEFINED);
foreign, parent_update, col_no); if (const upd_field_t *uf = upd_get_field_by_field_no(
update, uint16_t(clust_no), false)) {
row_field = &uf->new_val;
}
} }
if (row_field == NULL) { if (!row_field) {
row_field = dtuple_get_nth_field(row, col_no); row_field = dtuple_get_nth_field(row, col_no);
} }
@@ -21324,21 +21287,13 @@ void ins_node_t::vers_update_end(row_prebuilt_t *prebuilt, bool history_row)
mem_heap_t *local_heap= NULL; mem_heap_t *local_heap= NULL;
for (ulint col_no= 0; col_no < dict_table_get_n_v_cols(table); col_no++) for (ulint col_no= 0; col_no < dict_table_get_n_v_cols(table); col_no++)
{ {
const dict_v_col_t *v_col= dict_table_get_nth_v_col(table, col_no); const dict_v_col_t *v_col= dict_table_get_nth_v_col(table, col_no);
for (ulint i= 0; i < unsigned(v_col->num_base); i++) for (ulint i= 0; i < unsigned(v_col->num_base); i++)
{ if (v_col->base_col[i]->ind == table->vers_end)
dict_col_t *base_col= v_col->base_col[i];
if (base_col->ind == table->vers_end)
{
innobase_get_computed_value(row, v_col, clust_index, &local_heap, innobase_get_computed_value(row, v_col, clust_index, &local_heap,
table->heap, NULL, thd, mysql_table, table->heap, NULL, thd, mysql_table,
mysql_table->record[0], NULL, NULL, NULL); mysql_table->record[0], NULL, NULL);
} }
} if (UNIV_LIKELY_NULL(local_heap))
}
if (local_heap)
{
mem_heap_free(local_heap); mem_heap_free(local_heap);
}
} }

View File

@@ -809,11 +809,12 @@ void innobase_report_computed_value_failed(dtuple_t *row);
@param[in,out] local_heap heap memory for processing large data etc. @param[in,out] local_heap heap memory for processing large data etc.
@param[in,out] heap memory heap that copies the actual index row @param[in,out] heap memory heap that copies the actual index row
@param[in] ifield index field @param[in] ifield index field
@param[in] thd MySQL thread handle @param[in] thd connection handle
@param[in,out] mysql_table mysql table object @param[in,out] mysql_table MariaDB table handle
@param[in,out] mysql_rec MariaDB record buffer
@param[in] old_table during ALTER TABLE, this is the old table @param[in] old_table during ALTER TABLE, this is the old table
or NULL. or NULL.
@param[in] parent_update update vector for the parent row @param[in] update update vector for the parent row
@param[in] foreign foreign key information @param[in] foreign foreign key information
@return the field filled with computed value */ @return the field filled with computed value */
dfield_t* dfield_t*
@@ -828,8 +829,7 @@ innobase_get_computed_value(
TABLE* mysql_table, TABLE* mysql_table,
byte* mysql_rec, byte* mysql_rec,
const dict_table_t* old_table, const dict_table_t* old_table,
upd_t* parent_update, const upd_t* update);
dict_foreign_t* foreign);
/** Get the computed value by supplying the base column values. /** Get the computed value by supplying the base column values.
@param[in,out] table the table whose virtual column @param[in,out] table the table whose virtual column

View File

@@ -80,6 +80,10 @@ que_node_t */
#include "que0que.h" #include "que0que.h"
#include "row0sel.h" #include "row0sel.h"
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wfree-nonheap-object"
#endif
#define YYSTYPE que_node_t* #define YYSTYPE que_node_t*
/* #define __STDC__ */ /* #define __STDC__ */

View File

@@ -38,6 +38,10 @@ que_node_t */
#include "que0que.h" #include "que0que.h"
#include "row0sel.h" #include "row0sel.h"
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wfree-nonheap-object"
#endif
#define YYSTYPE que_node_t* #define YYSTYPE que_node_t*
/* #define __STDC__ */ /* #define __STDC__ */

View File

@@ -1761,8 +1761,6 @@ row_fts_merge_insert(
} }
exit: exit:
aux_table->release();
fts_sql_commit(trx); fts_sql_commit(trx);
trx->op_info = ""; trx->op_info = "";
@@ -1772,6 +1770,8 @@ exit:
error = ins_ctx.btr_bulk->finish(error); error = ins_ctx.btr_bulk->finish(error);
UT_DELETE(ins_ctx.btr_bulk); UT_DELETE(ins_ctx.btr_bulk);
aux_table->release();
trx->free(); trx->free();
mem_heap_free(heap); mem_heap_free(heap);

View File

@@ -864,7 +864,6 @@ row_ins_invalidate_query_cache(
innobase_invalidate_query_cache(thr_get_trx(thr), name); innobase_invalidate_query_cache(thr_get_trx(thr), name);
} }
/** Fill virtual column information in cascade node for the child table. /** Fill virtual column information in cascade node for the child table.
@param[out] cascade child update node @param[out] cascade child update node
@param[in] rec clustered rec of child table @param[in] rec clustered rec of child table
@@ -911,6 +910,11 @@ row_ins_foreign_fill_virtual(
if (!record) { if (!record) {
return DB_OUT_OF_MEMORY; return DB_OUT_OF_MEMORY;
} }
ut_ad(!node->is_delete
|| (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL));
ut_ad(foreign->type & (DICT_FOREIGN_ON_DELETE_SET_NULL
| DICT_FOREIGN_ON_UPDATE_SET_NULL
| DICT_FOREIGN_ON_UPDATE_CASCADE));
for (uint16_t i = 0; i < n_v_fld; i++) { for (uint16_t i = 0; i < n_v_fld; i++) {
@@ -926,7 +930,7 @@ row_ins_foreign_fill_virtual(
dfield_t* vfield = innobase_get_computed_value( dfield_t* vfield = innobase_get_computed_value(
update->old_vrow, col, index, update->old_vrow, col, index,
&vc.heap, update->heap, NULL, thd, mysql_table, &vc.heap, update->heap, NULL, thd, mysql_table,
record, NULL, NULL, NULL); record, NULL, NULL);
if (vfield == NULL) { if (vfield == NULL) {
return DB_COMPUTE_VALUE_FAILED; return DB_COMPUTE_VALUE_FAILED;
@@ -942,16 +946,11 @@ row_ins_foreign_fill_virtual(
upd_field_set_v_field_no(upd_field, i, index); upd_field_set_v_field_no(upd_field, i, index);
bool set_null =
node->is_delete
? (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)
: (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL);
dfield_t* new_vfield = innobase_get_computed_value( dfield_t* new_vfield = innobase_get_computed_value(
update->old_vrow, col, index, update->old_vrow, col, index,
&vc.heap, update->heap, NULL, thd, &vc.heap, update->heap, NULL, thd,
mysql_table, record, NULL, mysql_table, record, NULL,
set_null ? update : node->update, foreign); update);
if (new_vfield == NULL) { if (new_vfield == NULL) {
return DB_COMPUTE_VALUE_FAILED; return DB_COMPUTE_VALUE_FAILED;

View File

@@ -592,7 +592,7 @@ error:
row, v_col, clust_index, row, v_col, clust_index,
v_heap, NULL, ifield, trx->mysql_thd, v_heap, NULL, ifield, trx->mysql_thd,
my_table, vcol_storage.innobase_record, my_table, vcol_storage.innobase_record,
old_table, NULL, NULL); old_table, NULL);
if (row_field == NULL) { if (row_field == NULL) {
*err = DB_COMPUTE_VALUE_FAILED; *err = DB_COMPUTE_VALUE_FAILED;

View File

@@ -332,7 +332,7 @@ row_sel_sec_rec_is_for_clust_rec(
&heap, NULL, NULL, &heap, NULL, NULL,
thr_get_trx(thr)->mysql_thd, thr_get_trx(thr)->mysql_thd,
thr->prebuilt->m_mysql_table, thr->prebuilt->m_mysql_table,
record, NULL, NULL, NULL); record, NULL, NULL);
if (vfield == NULL) { if (vfield == NULL) {
innobase_report_computed_value_failed(row); innobase_report_computed_value_failed(row);

View File

@@ -709,7 +709,7 @@ row_upd_build_difference_binary(
dfield_t* vfield = innobase_get_computed_value( dfield_t* vfield = innobase_get_computed_value(
update->old_vrow, col, index, update->old_vrow, col, index,
&vc.heap, heap, NULL, thd, mysql_table, record, &vc.heap, heap, NULL, thd, mysql_table, record,
NULL, NULL, NULL); NULL, NULL);
if (vfield == NULL) { if (vfield == NULL) {
*error = DB_COMPUTE_VALUE_FAILED; *error = DB_COMPUTE_VALUE_FAILED;
return(NULL); return(NULL);
@@ -1791,8 +1791,7 @@ row_upd_store_v_row(
node->row, col, index, node->row, col, index,
&vc.heap, node->heap, &vc.heap, node->heap,
NULL, thd, mysql_table, NULL, thd, mysql_table,
record, NULL, NULL, record, NULL, NULL);
NULL);
if (vfield == NULL) { if (vfield == NULL) {
return false; return false;
} }

View File

@@ -474,7 +474,7 @@ row_vers_build_clust_v_col(
dfield_t *vfield = innobase_get_computed_value( dfield_t *vfield = innobase_get_computed_value(
row, col, clust_index, &vc.heap, row, col, clust_index, &vc.heap,
heap, NULL, thd, maria_table, record, NULL, heap, NULL, thd, maria_table, record, NULL,
NULL, NULL); NULL);
if (!vfield) { if (!vfield) {
innobase_report_computed_value_failed(row); innobase_report_computed_value_failed(row);
ut_ad(0); ut_ad(0);

View File

@@ -3399,10 +3399,9 @@ static uint16 translog_get_chunk_header_length(uchar *chunk)
DBUG_PRINT("info", ("TRANSLOG_CHUNK_LNGTH = 3")); DBUG_PRINT("info", ("TRANSLOG_CHUNK_LNGTH = 3"));
DBUG_RETURN(3); DBUG_RETURN(3);
break; break;
default: }
DBUG_ASSERT(0); DBUG_ASSERT(0);
DBUG_RETURN(0); /* Keep compiler happy */ DBUG_RETURN(0); /* Keep compiler happy */
}
} }

View File

@@ -453,15 +453,13 @@ class ha_rocksdb : public my_core::handler {
} }
} }
/** @brief /*
The name that will be used for display purposes. MariaDB: this function:
const char *table_type() const
is non-virtual in class handler, so there's no point to override it.
*/ */
const char *table_type() const /*override*/ {
DBUG_ENTER_FUNC();
// MariaDB: this function is not virtual, however ha_innodb
// declares it (and then never uses!) psergey-merge-todo:.
DBUG_RETURN(rocksdb_hton_name);
}
/* The following is only used by SHOW KEYS: */ /* The following is only used by SHOW KEYS: */
const char *index_type(uint inx) override { const char *index_type(uint inx) override {

View File

@@ -29,6 +29,7 @@ show warnings;
set @@test_sql_discovery_statement='t1:create table t1 (a int primary key) partition by hash(id) partitions 2'; set @@test_sql_discovery_statement='t1:create table t1 (a int primary key) partition by hash(id) partitions 2';
--error ER_SQL_DISCOVER_ERROR --error ER_SQL_DISCOVER_ERROR
select * from t1; select * from t1;
--replace_result 1289 1290 "The 'partitioning' feature is disabled; you need MariaDB built with '--with-plugin-partition' to have it working" "The MariaDB server is running with the --skip-partition option so it cannot execute this statement"
show warnings; show warnings;
set @@test_sql_discovery_statement='t1:create table t1 (a int) union=(t3,t4)'; set @@test_sql_discovery_statement='t1:create table t1 (a int) union=(t3,t4)';