1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge branch '10.11' into 11.2

This commit is contained in:
Oleksandr Byelkin
2024-10-29 16:39:47 +01:00
660 changed files with 8148 additions and 3604 deletions

View File

@ -50,4 +50,20 @@ ALTER TABLE t2 ALGORITHM=COPY, FORCE;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
DROP TABLE t2, t1;
#
# MDEV-35237 Bulk insert fails to apply buffered
# operation during copy alter
#
CREATE TABLE t1 (f1 int NOT NULL, f2 tinyint(1) NOT NULL,
f3 varchar(80) NOT NULL, PRIMARY KEY(f1),
KEY(f2), KEY(f3))ENGINE=InnoDB;
INSERT INTO t1 VALUES(1,1,''),(2,0,''), (4,1,'e');
CREATE TABLE t2 (f1 int NOT NULL, f2 int NOT NULL,KEY(f1))ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,0),(1,0);
CREATE TABLE t engine=innodb
SELECT t2.f2 FROM t2 JOIN t1 ON t1.f1 = t2.f1 AND t1.f3 = '' AND t1.f2=1 ;
SELECT COUNT(*) FROM t;
COUNT(*)
2
DROP TABLE t1, t2, t;
SET GLOBAL innodb_stats_persistent=@default_stats_persistent;

View File

@ -0,0 +1,21 @@
#
# MDEV-35144 CREATE TABLE ... LIKE uses current innodb_compression_default instead of the create value
#
set innodb_compression_default= off;
create table t1 (a int, b blob) engine=innodb;
set innodb_compression_default= on;
create table s_import like t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` blob DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
show create table s_import;
Table Create Table
s_import CREATE TABLE `s_import` (
`a` int(11) DEFAULT NULL,
`b` blob DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1,s_import;
# End of 10.5 tests

View File

@ -8,3 +8,13 @@ connection default;
ERROR 70100: Query execution was interrupted
CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB;
DROP TABLE t1;
# End of 10.2 tests
#
# MDEV-35236 Assertion `(mem_root->flags & 4) == 0' failed in safe_lexcstrdup_root
#
prepare stmt from 'create or replace table t engine=innodb select 1 as f';
set innodb_compression_default=on;
execute stmt;
execute stmt;
drop table t;
# End of 10.5 tests

View File

@ -1305,7 +1305,7 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 42S22: Unknown column 't1.id' in 'where clause'
ERROR 42S22: Unknown column 't1.id' in 'WHERE'
drop table t3,t2,t1;
CREATE TABLE t1 (
c1 VARCHAR(8), c2 VARCHAR(8),

View File

@ -2556,7 +2556,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4);
INSERT INTO t3 SELECT * FROM t1;
** An error in a trigger causes rollback of the statement.
DELETE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
ERROR 42S22: Unknown column 'error_happens_here' in 'field list'
ERROR 42S22: Unknown column 'error_happens_here' in 'SET'
SELECT @a,@b;
@a @b
EXECUTED TRIGGER
@ -2570,7 +2570,7 @@ i i
4 4
** Same happens with the IGNORE option
DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
ERROR 42S22: Unknown column 'error_happens_here' in 'field list'
ERROR 42S22: Unknown column 'error_happens_here' in 'SET'
SELECT * FROM t2;
a
SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;

View File

@ -552,18 +552,18 @@ ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
@ -1486,18 +1486,18 @@ ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
@ -2420,18 +2420,18 @@ ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0

View File

@ -526,6 +526,15 @@ c INT as (b) VIRTUAL)ENGINE=InnoDB CHARACTER SET utf32;
ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 DROP COLUMN c;
DROP TABLE t1;
#
# MDEV-35122 Incorrect NULL value handling for instantly
# dropped BLOB columns
#
CREATE TABLE t1 (c1 INT, c2 BLOB, c3 BLOB NOT NULL) ROW_FORMAT=REDUNDANT,ENGINE=InnoDB;
ALTER TABLE t1 DROP c2;
ALTER TABLE t1 DROP c3;
INSERT INTO t1 VALUES(1);
DROP TABLE t1;
# End of 10.5 tests
# End of 10.6 tests
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;

View File

@ -134,8 +134,10 @@ BEGIN;
INSERT INTO t SET a=2;
connection consistent;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SAVEPOINT sp1;
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
ERROR HY000: Record has changed since last read in table 't'
SAVEPOINT sp1;
connection con_weird;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
@ -155,3 +157,4 @@ a b
disconnect consistent;
connection default;
DROP TABLE t;
# End of 10.6 tests

View File

@ -49,6 +49,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\.ibd'/ in mysqld.1.err
# restart
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'

View File

@ -15,6 +15,7 @@ FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
set debug_dbug="d,trigger_garbage_collection";
SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size;
FOUND 1 /[Mm]emory pressure.*/ in mysqld.1.err
SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';

View File

@ -0,0 +1,6 @@
create table t_compressed(b longblob) engine=InnoDB page_compressed=1;
insert into t_compressed values(repeat(1,1000000));
select allocated_size < file_size from information_schema.innodb_sys_tablespaces where name='test/t_compressed';
allocated_size < file_size
1
drop table t_compressed;

View File

@ -151,7 +151,7 @@ t1 CREATE TEMPORARY TABLE `t1` (
UNIQUE KEY `pri_index` (`t1_i`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
select * from t1 where t1_f >= 2.5;
ERROR 42S22: Unknown column 't1_f' in 'where clause'
ERROR 42S22: Unknown column 't1_f' in 'WHERE'
alter table t1 add index sec_index2(t1_c), algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
drop table t1;

View File

@ -0,0 +1,66 @@
SET @old_innodb_enable_xap_unlock_unmodified_for_primary_debug=
@@GLOBAL.innodb_enable_xap_unlock_unmodified_for_primary_debug;
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug= 1;
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(
SELECT CONCAT(
'CREATE TABLE t1(pk',
GROUP_CONCAT(seq SEPARATOR ' INT, pk'), ' INT, a',
GROUP_CONCAT(seq SEPARATOR ' INT, a'), ' INT, b',
GROUP_CONCAT(seq SEPARATOR ' INT, b'), ' INT, c INT, PRIMARY KEY(pk',
GROUP_CONCAT(seq SEPARATOR ', pk'), '), INDEX i1(a',
GROUP_CONCAT(seq SEPARATOR ', a'), '), INDEX i2(b',
GROUP_CONCAT(seq SEPARATOR ', b'), ')) ENGINE=InnoDB;')
FROM seq_1_to_32);
EXECUTE IMMEDIATE c;
END;
$$
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(
SELECT CONCAT(
'INSERT INTO t1 VALUES (',
GROUP_CONCAT('1' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',0), (',
GROUP_CONCAT('2' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',0), (',
GROUP_CONCAT('3' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',0), (',
GROUP_CONCAT('4' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',0);')
FROM seq_1_to_32);
EXECUTE IMMEDIATE c;
END;
$$
SET @old_timeout= @@GLOBAL.innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout= 1;
XA START "t1";
UPDATE t1 FORCE INDEX (i2) SET c=c+1 WHERE a1=1 AND b1=1;
XA END "t1";
XA PREPARE "t1";
connect con1,localhost,root,,;
SELECT a1, b1, c FROM t1 FORCE INDEX (i1) WHERE a1=2 AND b1=1 FOR UPDATE;
a1 b1 c
2 1 0
disconnect con1;
connection default;
XA COMMIT "t1";
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug=
@old_innodb_enable_xap_unlock_unmodified_for_primary_debug;
SET GLOBAL innodb_lock_wait_timeout= @old_timeout;
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(
SELECT CONCAT(
'ALTER TABLE t1 ADD COLUMN d',
GROUP_CONCAT(seq SEPARATOR ' INT, ADD COLUMN d'),
' INT, ADD INDEX i3(d',
GROUP_CONCAT(seq SEPARATOR ', d'), ');')
FROM seq_1_to_33);
EXECUTE IMMEDIATE c;
END;
$$
ERROR 42000: Too many key parts specified; max 32 parts allowed
DROP TABLE t1;

View File

@ -0,0 +1,68 @@
SET @old_innodb_enable_xap_unlock_unmodified_for_primary_debug=
@@GLOBAL.innodb_enable_xap_unlock_unmodified_for_primary_debug;
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug= 1;
SET @saved_dbug = @@GLOBAL.debug_dbug;
CREATE TABLE t(id INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
InnoDB 0 transactions not purged
INSERT INTO t VALUES (10), (20), (30);
connect prevent_purge,localhost,root,,;
start transaction with consistent snapshot;
connection default;
DELETE FROM t WHERE id = 20;
SET @@GLOBAL.debug_dbug=
"+d,enable_row_purge_remove_clust_if_poss_low_sync_point";
XA START '1';
UPDATE t SET id=40 WHERE id=30;
XA END '1';
connection prevent_purge;
COMMIT;
SET DEBUG_SYNC=
'now WAIT_FOR row_purge_remove_clust_if_poss_low_before_delete';
SET @@GLOBAL.debug_dbug=
"-d,enable_row_purge_remove_clust_if_poss_low_sync_point";
connection default;
SET DEBUG_SYNC=
"lock_rec_unlock_unmodified_start SIGNAL lock_sys_latched WAIT_FOR cont";
XA PREPARE '1';
connection prevent_purge;
SET DEBUG_SYNC= 'now SIGNAL row_purge_remove_clust_if_poss_low_cont';
SET DEBUG_SYNC= 'now SIGNAL cont';
disconnect prevent_purge;
connection default;
XA COMMIT '1';
SET DEBUG_SYNC="RESET";
TRUNCATE TABLE t;
InnoDB 0 transactions not purged
INSERT INTO t VALUES (10), (20), (30);
connect prevent_purge,localhost,root,,;
start transaction with consistent snapshot;
connection default;
DELETE FROM t WHERE id = 20;
SET @@GLOBAL.debug_dbug=
"+d,enable_row_purge_remove_clust_if_poss_low_sync_point";
SET @@GLOBAL.debug_dbug="+d,skip_lock_release_on_prepare_try";
XA START '1';
UPDATE t SET id=40 WHERE id=30;
XA END '1';
connection prevent_purge;
COMMIT;
SET DEBUG_SYNC=
'now WAIT_FOR row_purge_remove_clust_if_poss_low_before_delete';
SET @@GLOBAL.debug_dbug=
"-d,enable_row_purge_remove_clust_if_poss_low_sync_point";
connection default;
SET DEBUG_SYNC=
"lock_rec_unlock_unmodified_start SIGNAL lock_sys_latched WAIT_FOR cont";
XA PREPARE '1';
connection prevent_purge;
SET DEBUG_SYNC= 'now SIGNAL row_purge_remove_clust_if_poss_low_cont';
SET DEBUG_SYNC= 'now SIGNAL cont';
disconnect prevent_purge;
connection default;
XA COMMIT '1';
SET DEBUG_SYNC="RESET";
TRUNCATE TABLE t;
SET @@GLOBAL.debug_dbug = @saved_dbug;
DROP TABLE t;
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug=
@old_innodb_enable_xap_unlock_unmodified_for_primary_debug;

View File

@ -68,4 +68,19 @@ ALTER TABLE t1 ALGORITHM=COPY, FORCE;
ALTER TABLE t2 ALGORITHM=COPY, FORCE;
--disable_info
DROP TABLE t2, t1;
--echo #
--echo # MDEV-35237 Bulk insert fails to apply buffered
--echo # operation during copy alter
--echo #
CREATE TABLE t1 (f1 int NOT NULL, f2 tinyint(1) NOT NULL,
f3 varchar(80) NOT NULL, PRIMARY KEY(f1),
KEY(f2), KEY(f3))ENGINE=InnoDB;
INSERT INTO t1 VALUES(1,1,''),(2,0,''), (4,1,'e');
CREATE TABLE t2 (f1 int NOT NULL, f2 int NOT NULL,KEY(f1))ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,0),(1,0);
CREATE TABLE t engine=innodb
SELECT t2.f2 FROM t2 JOIN t1 ON t1.f1 = t2.f1 AND t1.f3 = '' AND t1.f2=1 ;
SELECT COUNT(*) FROM t;
DROP TABLE t1, t2, t;
SET GLOBAL innodb_stats_persistent=@default_stats_persistent;

View File

@ -0,0 +1,16 @@
--source include/have_innodb.inc
--echo #
--echo # MDEV-35144 CREATE TABLE ... LIKE uses current innodb_compression_default instead of the create value
--echo #
set innodb_compression_default= off;
create table t1 (a int, b blob) engine=innodb;
set innodb_compression_default= on;
create table s_import like t1;
show create table t1;
show create table s_import;
DROP TABLE t1,s_import;
--echo # End of 10.5 tests

View File

@ -26,3 +26,16 @@ reap;
CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB;
DROP TABLE t1;
--source include/wait_until_count_sessions.inc
--echo # End of 10.2 tests
--echo #
--echo # MDEV-35236 Assertion `(mem_root->flags & 4) == 0' failed in safe_lexcstrdup_root
--echo #
prepare stmt from 'create or replace table t engine=innodb select 1 as f';
set innodb_compression_default=on;
execute stmt;
execute stmt;
drop table t;
--echo # End of 10.5 tests

View File

@ -567,6 +567,16 @@ ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 DROP COLUMN c;
DROP TABLE t1;
--echo #
--echo # MDEV-35122 Incorrect NULL value handling for instantly
--echo # dropped BLOB columns
--echo #
CREATE TABLE t1 (c1 INT, c2 BLOB, c3 BLOB NOT NULL) ROW_FORMAT=REDUNDANT,ENGINE=InnoDB;
ALTER TABLE t1 DROP c2;
ALTER TABLE t1 DROP c3;
INSERT INTO t1 VALUES(1);
DROP TABLE t1;
--echo # End of 10.5 tests
--echo # End of 10.6 tests

View File

@ -152,10 +152,12 @@ BEGIN; INSERT INTO t SET a=2;
--connection consistent
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SAVEPOINT sp1;
--disable_ps2_protocol
--error ER_CHECKREAD
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
--enable_ps2_protocol
SAVEPOINT sp1;
--connection con_weird
START TRANSACTION WITH CONSISTENT SNAPSHOT;
@ -181,3 +183,5 @@ SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
--connection default
DROP TABLE t;
--echo # End of 10.6 tests

View File

@ -92,6 +92,7 @@ let SEARCH_PATTERN= InnoDB: Set innodb_force_recovery=1 to ignore this and to pe
--source include/start_mysqld.inc
eval $check_no_innodb;
--let $on_linux= `select @@version_compile_os LIKE 'Linux%'`
--source include/shutdown_mysqld.inc
let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
@ -105,9 +106,18 @@ let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
--source include/start_mysqld.inc
eval $check_no_innodb;
--source include/shutdown_mysqld.inc
# On Windows, this error message is not output when t2.ibd is a directory!
#let SEARCH_PATTERN= \[Note\] InnoDB: Cannot read first page of .*t2.ibd;
#--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\\.ibd'
if (!$on_linux)
{
# os_file_get_size() would succeed on a directory.
--echo FOUND 1 /$SEARCH_PATTERN/ in mysqld.1.err
}
if ($on_linux)
{
# lseek() reports EINVAL when invoked on a directory.
--source include/search_pattern_in_file.inc
}
--rmdir $MYSQLD_DATADIR/test/t2.ibd
@ -150,6 +160,7 @@ call mtr.add_suppression("InnoDB: Error number \\d+ means");
call mtr.add_suppression("InnoDB: Cannot create file '.*t0.ibd'");
call mtr.add_suppression("InnoDB: The file '.*t0\.ibd' already exists");
call mtr.add_suppression("InnoDB: Cannot open datafile for read-write: '.*t2\.ibd'");
call mtr.add_suppression("InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\\.ibd'");
# The following are for aborted startup without --innodb-force-recovery:
call mtr.add_suppression("InnoDB: Tablespace .* was not found at .*test");
call mtr.add_suppression("InnoDB: Cannot read first page of '.*test.[tu]2.ibd': I/O error");

View File

@ -1,5 +1,5 @@
--source include/have_debug.inc
--source include/linux.inc
--source include/have_cgroupv2.inc
--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/have_sequence.inc
@ -33,12 +33,21 @@ WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
set debug_dbug="d,trigger_garbage_collection";
SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size;
SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
# either a fail or the pressure event
let SEARCH_PATTERN= [Mm]emory pressure.*;
--source include/search_pattern_in_file.inc
# The garbage collection happens asynchronously after trigger, in a background
# thread. So wait for it to happen to avoid sporadic failure.
let $wait_condition=
SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
--source include/wait_condition.inc
eval $wait_condition;
let SEARCH_PATTERN= InnoDB: Memory pressure event freed.*;
let SEARCH_WAIT= FOUND;
--source include/search_pattern_in_file.inc
set debug_dbug=@save_dbug;

View File

@ -0,0 +1 @@
--innodb-sys-tablespaces

View File

@ -0,0 +1,7 @@
--source include/have_innodb.inc
--source include/windows.inc
create table t_compressed(b longblob) engine=InnoDB page_compressed=1;
insert into t_compressed values(repeat(1,1000000));
# Check that compression worked, i.e allocated size (physical file size) < logical file size
select allocated_size < file_size from information_schema.innodb_sys_tablespaces where name='test/t_compressed';
drop table t_compressed;

View File

@ -0,0 +1,98 @@
--source include/have_innodb.inc
--source include/count_sessions.inc
--source include/have_debug.inc
--source include/have_sequence.inc
SET @old_innodb_enable_xap_unlock_unmodified_for_primary_debug=
@@GLOBAL.innodb_enable_xap_unlock_unmodified_for_primary_debug;
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug= 1;
# Make sure there is no dynamic memory allocation during getting offsets for
# 32 columns of secondary index with 32 columns of primary index in
# lock_rec_unlock_unmodified().
DELIMITER $$;
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(
SELECT CONCAT(
'CREATE TABLE t1(pk',
GROUP_CONCAT(seq SEPARATOR ' INT, pk'), ' INT, a',
GROUP_CONCAT(seq SEPARATOR ' INT, a'), ' INT, b',
GROUP_CONCAT(seq SEPARATOR ' INT, b'), ' INT, c INT, PRIMARY KEY(pk',
GROUP_CONCAT(seq SEPARATOR ', pk'), '), INDEX i1(a',
GROUP_CONCAT(seq SEPARATOR ', a'), '), INDEX i2(b',
GROUP_CONCAT(seq SEPARATOR ', b'), ')) ENGINE=InnoDB;')
FROM seq_1_to_32);
EXECUTE IMMEDIATE c;
END;
$$
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(
SELECT CONCAT(
'INSERT INTO t1 VALUES (',
GROUP_CONCAT('1' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',0), (',
GROUP_CONCAT('2' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',0), (',
GROUP_CONCAT('3' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',0), (',
GROUP_CONCAT('4' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',0);')
FROM seq_1_to_32);
EXECUTE IMMEDIATE c;
END;
$$
DELIMITER ;$$
SET @old_timeout= @@GLOBAL.innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout= 1;
XA START "t1";
UPDATE t1 FORCE INDEX (i2) SET c=c+1 WHERE a1=1 AND b1=1;
XA END "t1";
# If there is dynamic memory allocation during getting offsets for
# 32 columns of secondary index with 32 columns of primary index in
# lock_rec_unlock_unmodified(), the following statement will cause assertion
# failure in debug build.
XA PREPARE "t1";
--connect(con1,localhost,root,,)
# (pk, 2, 1, 0) record is X-locked but not modified in clustered index with the
# above XA transaction, if the bug is not fixed, the following SELECT will be
# blocked by the XA transaction if XA PREPARE does not release the unmodified
# record.
SELECT a1, b1, c FROM t1 FORCE INDEX (i1) WHERE a1=2 AND b1=1 FOR UPDATE;
--disconnect con1
--connection default
XA COMMIT "t1";
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug=
@old_innodb_enable_xap_unlock_unmodified_for_primary_debug;
SET GLOBAL innodb_lock_wait_timeout= @old_timeout;
# Check that we can't create secondary index with more than 32 columns.
DELIMITER $$;
--error ER_TOO_MANY_KEY_PARTS
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(
SELECT CONCAT(
'ALTER TABLE t1 ADD COLUMN d',
GROUP_CONCAT(seq SEPARATOR ' INT, ADD COLUMN d'),
' INT, ADD INDEX i3(d',
GROUP_CONCAT(seq SEPARATOR ', d'), ');')
FROM seq_1_to_33);
EXECUTE IMMEDIATE c;
END;
$$
DELIMITER ;$$
DROP TABLE t1;
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1 @@
--innodb_purge_threads=1

View File

@ -0,0 +1,86 @@
--source include/have_innodb.inc
--source include/count_sessions.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
SET @old_innodb_enable_xap_unlock_unmodified_for_primary_debug=
@@GLOBAL.innodb_enable_xap_unlock_unmodified_for_primary_debug;
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug= 1;
SET @saved_dbug = @@GLOBAL.debug_dbug;
CREATE TABLE t(id INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
--let $i = 2
while ($i) {
--source include/wait_all_purged.inc
INSERT INTO t VALUES (10), (20), (30);
--connect(prevent_purge,localhost,root,,)
start transaction with consistent snapshot;
--connection default
DELETE FROM t WHERE id = 20;
SET @@GLOBAL.debug_dbug=
"+d,enable_row_purge_remove_clust_if_poss_low_sync_point";
# Cover both lock_release_on_prepare() and lock_release_on_prepare_try()
# functions
if ($i == 1) {
SET @@GLOBAL.debug_dbug="+d,skip_lock_release_on_prepare_try";
}
XA START '1';
UPDATE t SET id=40 WHERE id=30;
XA END '1';
--connection prevent_purge
COMMIT;
# stop purge worker after it requested page X-latch, but before
# lock_update_delete() call
SET DEBUG_SYNC=
'now WAIT_FOR row_purge_remove_clust_if_poss_low_before_delete';
SET @@GLOBAL.debug_dbug=
"-d,enable_row_purge_remove_clust_if_poss_low_sync_point";
--connection default
# lock_rec_unlock_unmodified() is executed either under lock_sys.wr_lock() or
# under a combination of lock_sys.rd_lock() + record locks hash table cell
# latch. Stop it before page latch request.
SET DEBUG_SYNC=
"lock_rec_unlock_unmodified_start SIGNAL lock_sys_latched WAIT_FOR cont";
--send XA PREPARE '1'
--connection prevent_purge
# let purge thread to continue execution and invoke lock_update_delete(),
# which, in turns, requests locks_sys related latches.
SET DEBUG_SYNC= 'now SIGNAL row_purge_remove_clust_if_poss_low_cont';
SET DEBUG_SYNC= 'now SIGNAL cont';
--disconnect prevent_purge
--connection default
# deadlock if the bug is not fixed, as lock_rec_unlock_unmodified() requests
# page latch acquired by purge worker, and the purge worker requests lock_sys
# related latches in lock_update_delete() call, acquired by the current XA
# in lock_rec_unlock_unmodified() caller.
--reap
XA COMMIT '1';
SET DEBUG_SYNC="RESET";
TRUNCATE TABLE t;
--dec $i
}
SET @@GLOBAL.debug_dbug = @saved_dbug;
DROP TABLE t;
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug=
@old_innodb_enable_xap_unlock_unmodified_for_primary_debug;
--source include/wait_until_count_sessions.inc