Merge 10.4 into 10.5
This commit is contained in:
commit
a8ded39557
@ -25,6 +25,6 @@ test_script:
|
||||
- set PATH=C:\Strawberry\perl\bin;%PATH%;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64
|
||||
- cd %APPVEYOR_BUILD_FOLDER%\_build\mysql-test
|
||||
- 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=unstable-tests --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=unstable-tests --mysqld=--loose-innodb-flush-log-at-trx-commit=2
|
||||
|
||||
image: Visual Studio 2019
|
||||
|
@ -298,16 +298,18 @@ void my_pthread_attr_getstacksize(pthread_attr_t *attrib, size_t *size);
|
||||
int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
|
||||
/* no pthread_yield() available */
|
||||
#ifdef HAVE_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()
|
||||
#elif defined(HAVE_THR_YIELD)
|
||||
#define pthread_yield() thr_yield()
|
||||
#endif
|
||||
#endif
|
||||
#endif //defined(HAVE_PTHREAD_YIELD_NP)
|
||||
#endif //!defined(HAVE_PTHREAD_YIELD_ZERO_ARG)
|
||||
#endif //HAVE_SCHED_YIELD
|
||||
|
||||
size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize);
|
||||
|
||||
|
@ -340,6 +340,27 @@ unlock tables;
|
||||
drop table t1;
|
||||
create table test.t1 (i int);
|
||||
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
|
||||
#
|
||||
@ -545,3 +566,4 @@ SELECT * FROM t3;
|
||||
ERROR HY000: Table 't3' was not locked with LOCK TABLES
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t3;
|
||||
# End of 10.4 tests
|
||||
|
@ -270,6 +270,26 @@ drop table t1;
|
||||
|
||||
create table test.t1 (i int);
|
||||
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 # Testing CREATE .. LIKE
|
||||
@ -486,3 +506,5 @@ CREATE OR REPLACE TEMPORARY TABLE t2(c INT DEFAULT '');
|
||||
SELECT * FROM t3;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t3;
|
||||
|
||||
--echo # End of 10.4 tests
|
||||
|
@ -7919,6 +7919,28 @@ a b
|
||||
DROP TABLE t1;
|
||||
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
|
||||
#
|
||||
#
|
||||
|
@ -265,6 +265,32 @@ SET NAMES utf8, collation_connection=utf32_unicode_520_nopad_ci;
|
||||
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 # End of 10.2 tests
|
||||
--echo #
|
||||
|
@ -1,3 +1,4 @@
|
||||
--source include/have_partition.inc
|
||||
#
|
||||
# Basic stored PROCEDURE tests
|
||||
#
|
||||
|
@ -826,3 +826,203 @@ DROP TABLE email_stats;
|
||||
DROP TABLE emails_metadata;
|
||||
DROP TABLE emails;
|
||||
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;
|
||||
|
@ -693,3 +693,187 @@ DROP TABLE email_stats;
|
||||
DROP TABLE emails_metadata;
|
||||
DROP TABLE emails;
|
||||
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;
|
||||
|
@ -1,4 +1,5 @@
|
||||
#--source include/innodb_page_size.inc
|
||||
--source include/have_partition.inc
|
||||
|
||||
# import partitioned table from table from partial backup
|
||||
|
||||
|
@ -265,6 +265,9 @@ A B C D
|
||||
A B C D
|
||||
set global server_audit_query_log_limit= 1024;
|
||||
drop database sa_db;
|
||||
select length('01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789');
|
||||
length('0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456
|
||||
2750
|
||||
set global server_audit_file_path='.';
|
||||
show status like 'server_audit_current_log';
|
||||
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,event,
|
||||
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,'show status like \'server_audit_current_log\'',0
|
||||
|
@ -216,6 +216,8 @@ select 'A', 'B', 'C', 'D';
|
||||
set global server_audit_query_log_limit= 1024;
|
||||
drop database sa_db;
|
||||
|
||||
select length('01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789');
|
||||
|
||||
set global server_audit_file_path='.';
|
||||
--replace_regex /\.[\\\/]/HOME_DIR\//
|
||||
show status like 'server_audit_current_log';
|
||||
|
@ -69,3 +69,28 @@ id name
|
||||
drop table t1;
|
||||
disconnect test_con1;
|
||||
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;
|
||||
|
@ -103,3 +103,23 @@ drop table t1;
|
||||
|
||||
disconnect test_con1;
|
||||
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;
|
||||
|
||||
|
@ -355,9 +355,9 @@ int sf_sanity()
|
||||
if (count || irem)
|
||||
{
|
||||
warn("Error: Safemalloc link list destroyed");
|
||||
return 1;
|
||||
flag= 1;
|
||||
}
|
||||
return 0;
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -301,8 +301,6 @@ static char logging;
|
||||
static volatile int internal_stop_logging= 0;
|
||||
static char incl_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 char servhost[256];
|
||||
@ -561,18 +559,10 @@ static PSI_mutex_info mutex_key_list[]=
|
||||
{
|
||||
{ &key_LOCK_operations, "SERVER_AUDIT_plugin::lock_operations",
|
||||
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*/
|
||||
static mysql_prlock_t lock_operations;
|
||||
static mysql_mutex_t lock_atomic;
|
||||
static mysql_mutex_t lock_bigbuffer;
|
||||
|
||||
/* The Percona server and partly MySQL don't support */
|
||||
/* launching client errors in the 'update_variable' methods. */
|
||||
@ -1727,7 +1717,7 @@ static int log_statement_ex(const struct connection_info *cn,
|
||||
int error_code, const char *type, int take_lock)
|
||||
{
|
||||
size_t csize;
|
||||
char message_loc[1024];
|
||||
char message_loc[2048];
|
||||
char *message= message_loc;
|
||||
size_t message_size= sizeof(message_loc);
|
||||
char *uh_buffer;
|
||||
@ -1736,6 +1726,7 @@ static int log_statement_ex(const struct connection_info *cn,
|
||||
unsigned int db_length;
|
||||
long long query_id;
|
||||
int result;
|
||||
char *big_buffer= NULL;
|
||||
|
||||
if ((db= cn->db))
|
||||
db_length= cn->db_length;
|
||||
@ -1818,17 +1809,9 @@ do_log_query:
|
||||
|
||||
if (query_len > (message_size - csize)/2)
|
||||
{
|
||||
flogger_mutex_lock(&lock_bigbuffer);
|
||||
if (big_buffer_alloced < (query_len * 2 + csize))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
size_t big_buffer_alloced= (query_len * 2 + csize + 4095) & ~4095L;
|
||||
if(!(big_buffer= malloc(big_buffer_alloced)))
|
||||
return 0;
|
||||
|
||||
memcpy(big_buffer, message, csize);
|
||||
message= big_buffer;
|
||||
@ -1874,8 +1857,8 @@ do_log_query:
|
||||
"\',%d", error_code);
|
||||
message[csize]= '\n';
|
||||
result= write_log(message, csize + 1, take_lock);
|
||||
if (message == big_buffer)
|
||||
flogger_mutex_unlock(&lock_bigbuffer);
|
||||
if (big_buffer)
|
||||
free(big_buffer);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -2529,7 +2512,6 @@ static int server_audit_init(void *p __attribute__((unused)))
|
||||
#endif
|
||||
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_bigbuffer, MY_MUTEX_INIT_FAST);
|
||||
|
||||
coll_init(&incl_user_coll);
|
||||
coll_init(&excl_user_coll);
|
||||
@ -2614,10 +2596,8 @@ static int server_audit_deinit(void *p __attribute__((unused)))
|
||||
else if (output_type == OUTPUT_SYSLOG)
|
||||
closelog();
|
||||
|
||||
(void) free(big_buffer);
|
||||
mysql_prlock_destroy(&lock_operations);
|
||||
flogger_mutex_destroy(&lock_atomic);
|
||||
flogger_mutex_destroy(&lock_bigbuffer);
|
||||
|
||||
error_header();
|
||||
fprintf(stderr, "STOPPED\n");
|
||||
|
@ -2691,7 +2691,6 @@ bool Item_func_timediff::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzy
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
int l_sign= 1;
|
||||
MYSQL_TIME l_time1,l_time2,l_time3;
|
||||
ErrConvTime str(&l_time3);
|
||||
|
||||
/* the following may be true in, for example, date_add(timediff(...), ... */
|
||||
if (fuzzydate & TIME_NO_ZERO_IN_DATE)
|
||||
|
@ -217,8 +217,6 @@ Protocol::net_send_ok(THD *thd,
|
||||
NET *net= &thd->net;
|
||||
StringBuffer<MYSQL_ERRMSG_SIZE + 10> store;
|
||||
|
||||
bool state_changed= false;
|
||||
|
||||
bool error= FALSE;
|
||||
DBUG_ENTER("Protocol::net_send_ok");
|
||||
|
||||
@ -245,6 +243,11 @@ Protocol::net_send_ok(THD *thd,
|
||||
/* last insert 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)
|
||||
{
|
||||
DBUG_PRINT("info",
|
||||
@ -265,21 +268,17 @@ Protocol::net_send_ok(THD *thd,
|
||||
}
|
||||
thd->get_stmt_da()->set_overwrite_status(true);
|
||||
|
||||
state_changed=
|
||||
(thd->client_capabilities & CLIENT_SESSION_TRACK) &&
|
||||
(server_status & SERVER_SESSION_STATE_CHANGED);
|
||||
|
||||
if (state_changed || (message && message[0]))
|
||||
if ((server_status & SERVER_SESSION_STATE_CHANGED) || (message && message[0]))
|
||||
{
|
||||
DBUG_ASSERT(safe_strlen(message) <= MYSQL_ERRMSG_SIZE);
|
||||
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);
|
||||
|
||||
thd->session_tracker.store(thd, &store);
|
||||
thd->server_status&= ~SERVER_SESSION_STATE_CHANGED;
|
||||
}
|
||||
|
||||
DBUG_ASSERT(store.length() <= MAX_PACKET_LENGTH);
|
||||
@ -288,8 +287,6 @@ Protocol::net_send_ok(THD *thd,
|
||||
if (likely(!error) && (!skip_flush || is_eof))
|
||||
error= net_flush(net);
|
||||
|
||||
thd->server_status&= ~SERVER_SESSION_STATE_CHANGED;
|
||||
|
||||
thd->get_stmt_da()->set_overwrite_status(false);
|
||||
DBUG_PRINT("info", ("OK sent, so no more error sending allowed"));
|
||||
|
||||
|
@ -4168,6 +4168,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
|
||||
#ifdef WITH_WSREP
|
||||
if (wsrep_before_statement(thd))
|
||||
{
|
||||
mysql_mutex_unlock(&rli->data_lock);
|
||||
delete ev;
|
||||
WSREP_INFO("Wsrep before statement error");
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
@ -1922,7 +1922,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
|
||||
*/
|
||||
|
||||
|
@ -5105,12 +5105,6 @@ void select_create::abort_result_set()
|
||||
/* possible error of writing binary log is ignored deliberately */
|
||||
(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)
|
||||
{
|
||||
bool tmp_table= table->s->tmp_table;
|
||||
@ -5149,5 +5143,13 @@ void select_create::abort_result_set()
|
||||
tmp_table);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* 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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -438,8 +438,8 @@ bool String::copy(const char *str, size_t arg_length,
|
||||
{
|
||||
uint32 offset;
|
||||
|
||||
DBUG_ASSERT(!str || str != Ptr);
|
||||
|
||||
DBUG_ASSERT(!str || str != Ptr || !is_alloced());
|
||||
|
||||
if (!needs_conversion(arg_length, from_cs, to_cs, &offset))
|
||||
{
|
||||
*errors= 0;
|
||||
|
@ -4696,12 +4696,16 @@ static Sys_var_session_special Sys_identity(
|
||||
*/
|
||||
static bool update_insert_id(THD *thd, set_var *var)
|
||||
{
|
||||
if (!var->value)
|
||||
{
|
||||
my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
|
||||
return true;
|
||||
}
|
||||
thd->force_one_auto_inc_interval(var->save_result.ulonglong_value);
|
||||
/*
|
||||
If we set the insert_id to the DEFAULT or 0
|
||||
it means we 'reset' it so it's value doesn't
|
||||
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);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -4709,6 +4713,8 @@ static ulonglong read_insert_id(THD *thd)
|
||||
{
|
||||
return thd->auto_inc_intervals_forced.minimum();
|
||||
}
|
||||
|
||||
|
||||
static Sys_var_session_special Sys_insert_id(
|
||||
"insert_id", "The value to be used by the following INSERT "
|
||||
"or ALTER TABLE statement when inserting an AUTO_INCREMENT value",
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2016, 2020, MariaDB Corporation.
|
||||
Copyright (c) 2016, 2021, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -679,13 +679,18 @@ SysTablespace::file_not_found(
|
||||
{
|
||||
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()
|
||||
<< "' when --innodb-read-only is set";
|
||||
|
||||
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. */
|
||||
ut_a(!*create_new_db);
|
||||
|
@ -20464,48 +20464,6 @@ innobase_rename_vc_templ(
|
||||
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
|
||||
@ -20588,9 +20546,10 @@ void innobase_report_computed_value_failed(dtuple_t *row)
|
||||
@param[in] ifield index field
|
||||
@param[in] thd MySQL thread handle
|
||||
@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
|
||||
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
|
||||
@return the field filled with computed value, or NULL if just want
|
||||
to store the value in passed in "my_rec" */
|
||||
@ -20606,8 +20565,7 @@ innobase_get_computed_value(
|
||||
TABLE* mysql_table,
|
||||
byte* mysql_rec,
|
||||
const dict_table_t* old_table,
|
||||
upd_t* parent_update,
|
||||
dict_foreign_t* foreign)
|
||||
const upd_t* update)
|
||||
{
|
||||
byte rec_buf2[REC_VERSION_56_MAX_INDEX_COL_LEN];
|
||||
byte* buf;
|
||||
@ -20620,6 +20578,8 @@ innobase_get_computed_value(
|
||||
|
||||
ulint ret = 0;
|
||||
|
||||
dict_index_t *clust_index= dict_table_get_first_index(index->table);
|
||||
|
||||
ut_ad(index->table->vc_templ);
|
||||
ut_ad(thd != NULL);
|
||||
ut_ad(mysql_table);
|
||||
@ -20649,14 +20609,17 @@ innobase_get_computed_value(
|
||||
= index->table->vc_templ->vtempl[col_no];
|
||||
const byte* data;
|
||||
|
||||
if (parent_update != NULL) {
|
||||
/** Get the updated field from update vector
|
||||
of the parent table. */
|
||||
row_field = innobase_get_field_from_update_vector(
|
||||
foreign, parent_update, col_no);
|
||||
if (update) {
|
||||
ulint clust_no = dict_col_get_clust_pos(base_col,
|
||||
clust_index);
|
||||
ut_ad(clust_no != ULINT_UNDEFINED);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -21646,21 +21609,13 @@ void ins_node_t::vers_update_end(row_prebuilt_t *prebuilt, bool history_row)
|
||||
mem_heap_t *local_heap= NULL;
|
||||
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);
|
||||
for (ulint i= 0; i < unsigned(v_col->num_base); i++)
|
||||
{
|
||||
dict_col_t *base_col= v_col->base_col[i];
|
||||
if (base_col->ind == table->vers_end)
|
||||
{
|
||||
if (v_col->base_col[i]->ind == table->vers_end)
|
||||
innobase_get_computed_value(row, v_col, clust_index, &local_heap,
|
||||
table->heap, NULL, thd, mysql_table,
|
||||
mysql_table->record[0], NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
mysql_table->record[0], NULL, NULL);
|
||||
}
|
||||
if (local_heap)
|
||||
{
|
||||
if (UNIV_LIKELY_NULL(local_heap))
|
||||
mem_heap_free(local_heap);
|
||||
}
|
||||
}
|
||||
|
@ -915,11 +915,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] heap memory heap that copies the actual index row
|
||||
@param[in] ifield index field
|
||||
@param[in] thd MySQL thread handle
|
||||
@param[in,out] mysql_table mysql table object
|
||||
@param[in] thd connection handle
|
||||
@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
|
||||
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
|
||||
@return the field filled with computed value */
|
||||
dfield_t*
|
||||
@ -934,8 +935,7 @@ innobase_get_computed_value(
|
||||
TABLE* mysql_table,
|
||||
byte* mysql_rec,
|
||||
const dict_table_t* old_table,
|
||||
upd_t* parent_update,
|
||||
dict_foreign_t* foreign);
|
||||
const upd_t* update);
|
||||
|
||||
/** Get the computed value by supplying the base column values.
|
||||
@param[in,out] table the table whose virtual column
|
||||
|
@ -227,6 +227,12 @@ easy way to get it to work. See http://bugs.mysql.com/bug.php?id=52263. */
|
||||
# define UNIV_INTERN
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 11)
|
||||
# define ATTRIBUTE_ACCESS(X) __attribute__((access X))
|
||||
#else
|
||||
# define ATTRIBUTE_ACCESS(X)
|
||||
#endif
|
||||
|
||||
#ifndef MY_ATTRIBUTE
|
||||
#if defined(__GNUC__)
|
||||
# define MY_ATTRIBUTE(A) __attribute__(A)
|
||||
|
@ -79,6 +79,10 @@ que_node_t */
|
||||
#include "que0que.h"
|
||||
#include "row0sel.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wfree-nonheap-object"
|
||||
#endif
|
||||
|
||||
#define YYSTYPE que_node_t*
|
||||
|
||||
/* #define __STDC__ */
|
||||
|
@ -38,6 +38,10 @@ que_node_t */
|
||||
#include "que0que.h"
|
||||
#include "row0sel.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wfree-nonheap-object"
|
||||
#endif
|
||||
|
||||
#define YYSTYPE que_node_t*
|
||||
|
||||
/* #define __STDC__ */
|
||||
|
@ -1759,8 +1759,6 @@ row_fts_merge_insert(
|
||||
}
|
||||
|
||||
exit:
|
||||
dict_table_close(aux_table, FALSE, FALSE);
|
||||
|
||||
fts_sql_commit(trx);
|
||||
|
||||
trx->op_info = "";
|
||||
@ -1770,6 +1768,8 @@ exit:
|
||||
error = ins_ctx.btr_bulk->finish(error);
|
||||
UT_DELETE(ins_ctx.btr_bulk);
|
||||
|
||||
dict_table_close(aux_table, FALSE, FALSE);
|
||||
|
||||
trx->free();
|
||||
|
||||
mem_heap_free(heap);
|
||||
|
@ -859,7 +859,6 @@ row_ins_invalidate_query_cache(
|
||||
innobase_invalidate_query_cache(thr_get_trx(thr), name);
|
||||
}
|
||||
|
||||
|
||||
/** Fill virtual column information in cascade node for the child table.
|
||||
@param[out] cascade child update node
|
||||
@param[in] rec clustered rec of child table
|
||||
@ -906,6 +905,11 @@ row_ins_foreign_fill_virtual(
|
||||
if (!record) {
|
||||
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++) {
|
||||
|
||||
@ -921,7 +925,7 @@ row_ins_foreign_fill_virtual(
|
||||
dfield_t* vfield = innobase_get_computed_value(
|
||||
update->old_vrow, col, index,
|
||||
&vc.heap, update->heap, NULL, thd, mysql_table,
|
||||
record, NULL, NULL, NULL);
|
||||
record, NULL, NULL);
|
||||
|
||||
if (vfield == NULL) {
|
||||
return DB_COMPUTE_VALUE_FAILED;
|
||||
@ -937,16 +941,11 @@ row_ins_foreign_fill_virtual(
|
||||
|
||||
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(
|
||||
update->old_vrow, col, index,
|
||||
&vc.heap, update->heap, NULL, thd,
|
||||
mysql_table, record, NULL,
|
||||
set_null ? update : node->update, foreign);
|
||||
update);
|
||||
|
||||
if (new_vfield == NULL) {
|
||||
return DB_COMPUTE_VALUE_FAILED;
|
||||
|
@ -593,8 +593,8 @@ error:
|
||||
row_field = innobase_get_computed_value(
|
||||
row, v_col, clust_index,
|
||||
v_heap, NULL, ifield, trx->mysql_thd,
|
||||
my_table, vcol_storage.innobase_record,
|
||||
old_table, NULL, NULL);
|
||||
my_table, vcol_storage.innobase_record,
|
||||
old_table, NULL);
|
||||
|
||||
if (row_field == NULL) {
|
||||
*err = DB_COMPUTE_VALUE_FAILED;
|
||||
|
@ -332,7 +332,7 @@ row_sel_sec_rec_is_for_clust_rec(
|
||||
&heap, NULL, NULL,
|
||||
thr_get_trx(thr)->mysql_thd,
|
||||
thr->prebuilt->m_mysql_table,
|
||||
record, NULL, NULL, NULL);
|
||||
record, NULL, NULL);
|
||||
|
||||
if (vfield == NULL) {
|
||||
innobase_report_computed_value_failed(row);
|
||||
|
@ -773,7 +773,7 @@ row_upd_build_difference_binary(
|
||||
dfield_t* vfield = innobase_get_computed_value(
|
||||
update->old_vrow, col, index,
|
||||
&vc.heap, heap, NULL, thd, mysql_table, record,
|
||||
NULL, NULL, NULL);
|
||||
NULL, NULL);
|
||||
if (vfield == NULL) {
|
||||
*error = DB_COMPUTE_VALUE_FAILED;
|
||||
return(NULL);
|
||||
@ -1855,8 +1855,7 @@ row_upd_store_v_row(
|
||||
node->row, col, index,
|
||||
&vc.heap, node->heap,
|
||||
NULL, thd, mysql_table,
|
||||
record, NULL, NULL,
|
||||
NULL);
|
||||
record, NULL, NULL);
|
||||
if (vfield == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ row_vers_build_clust_v_col(
|
||||
dfield_t *vfield = innobase_get_computed_value(
|
||||
row, col, clust_index, &vc.heap,
|
||||
heap, NULL, thd, maria_table, record, NULL,
|
||||
NULL, NULL);
|
||||
NULL);
|
||||
if (!vfield) {
|
||||
innobase_report_computed_value_failed(row);
|
||||
ut_ad(0);
|
||||
|
@ -3399,10 +3399,9 @@ static uint16 translog_get_chunk_header_length(uchar *chunk)
|
||||
DBUG_PRINT("info", ("TRANSLOG_CHUNK_LNGTH = 3"));
|
||||
DBUG_RETURN(3);
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
DBUG_RETURN(0); /* Keep compiler happy */
|
||||
}
|
||||
DBUG_ASSERT(0);
|
||||
DBUG_RETURN(0); /* Keep compiler happy */
|
||||
}
|
||||
|
||||
|
||||
|
@ -453,15 +453,13 @@ class ha_rocksdb : public my_core::handler {
|
||||
}
|
||||
}
|
||||
|
||||
/** @brief
|
||||
The name that will be used for display purposes.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
/*
|
||||
MariaDB: this function:
|
||||
|
||||
const char *table_type() const
|
||||
|
||||
is non-virtual in class handler, so there's no point to override it.
|
||||
*/
|
||||
|
||||
/* The following is only used by SHOW KEYS: */
|
||||
const char *index_type(uint inx) override {
|
||||
|
@ -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';
|
||||
--error ER_SQL_DISCOVER_ERROR
|
||||
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;
|
||||
|
||||
set @@test_sql_discovery_statement='t1:create table t1 (a int) union=(t3,t4)';
|
||||
|
Loading…
x
Reference in New Issue
Block a user