Skip to content
Permalink
Browse files

Merge 10.3 into 10.4

  • Loading branch information...
dr-m committed Jul 1, 2019
2 parents 747dccf + 0e1ba36 commit 9c16460e63a5002d5949f67f57dce71e666547ec
@@ -687,7 +687,23 @@ DROP TABLE t1,t2;
# End of 10.0 tests
#
#
# Start of 10.4 tests
# MDEV-17551
# Assertion `(&(&share->intern_lock)->m_mutex)->count > 0 &&
# pthread_equal(pthread_self(), (&(&share->intern_lock)->m_mutex)->
# thread)' failed in _ma_state_info_write or ER_CRASHED_ON_USAGE
# upon SELECT with UNION
#
CREATE TABLE t1 (b BLOB, vb BLOB AS (b) VIRTUAL);
INSERT INTO t1 (b) VALUES ('foobar');
SELECT 'foo' AS f1, CONVERT( 'bar' USING latin1 ) AS f2 FROM t1
UNION
SELECT b AS f1, CONVERT( vb USING latin1 ) AS f2 FROM t1;
f1 f2
foo bar
foobar foobar
DROP TABLE t1;
#
# End of 10.3 tests
#
SET sql_mode='';
CREATE TABLE t1 (c VARCHAR(1) DEFAULT 'foo');
@@ -329,9 +329,23 @@ DROP TABLE t1,t2;
--echo # End of 10.0 tests
--echo #

--echo #
--echo # MDEV-17551
--echo # Assertion `(&(&share->intern_lock)->m_mutex)->count > 0 &&
--echo # pthread_equal(pthread_self(), (&(&share->intern_lock)->m_mutex)->
--echo # thread)' failed in _ma_state_info_write or ER_CRASHED_ON_USAGE
--echo # upon SELECT with UNION
--echo #

CREATE TABLE t1 (b BLOB, vb BLOB AS (b) VIRTUAL);
INSERT INTO t1 (b) VALUES ('foobar');
SELECT 'foo' AS f1, CONVERT( 'bar' USING latin1 ) AS f2 FROM t1
UNION
SELECT b AS f1, CONVERT( vb USING latin1 ) AS f2 FROM t1;
DROP TABLE t1;

--echo #
--echo # Start of 10.4 tests
--echo # End of 10.3 tests
--echo #

SET sql_mode='';
@@ -110,7 +110,7 @@ SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go'
ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;
connect con1, localhost, root;
SET debug_sync='now WAIT_FOR ready';
SET lock_wait_timeout=1;
SET lock_wait_timeout=0;
UPDATE t2 SET pk=10 WHERE pk=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
@@ -264,6 +264,33 @@ a b c d
2 3 4 1
DROP TABLE t1;
#
# MDEV-19916 Corruption after instant ADD/DROP and shrinking the tree
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
SET @old_limit = @@innodb_limit_optimistic_insert_debug;
SET GLOBAL innodb_limit_optimistic_insert_debug = 2;
INSERT INTO t1 VALUES (1),(5),(4),(3),(2);
SET GLOBAL innodb_limit_optimistic_insert_debug = @old_limit;
ALTER TABLE t1 ADD COLUMN b INT, ALGORITHM=INSTANT;
SET @old_defragment = @@innodb_defragment;
SET GLOBAL innodb_defragment = 1;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SET GLOBAL innodb_defragment = @old_defragment;
ALTER TABLE t1 ADD vb INT AS (b) VIRTUAL;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT * FROM t1;
a b vb
1 NULL NULL
2 NULL NULL
3 NULL NULL
4 NULL NULL
5 NULL NULL
DROP TABLE t1;
#
# MDEV-17899 Assertion failures on rollback of instant ADD/DROP
# MDEV-18098 Crash after rollback of instant DROP COLUMN
#
@@ -299,5 +326,5 @@ SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
21
22
SET GLOBAL innodb_purge_rseg_truncate_frequency = @save_frequency;
@@ -140,7 +140,7 @@ send ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;

connect con1, localhost, root;
SET debug_sync='now WAIT_FOR ready';
SET lock_wait_timeout=1; # change to 0 in 10.3
SET lock_wait_timeout=0;
--error ER_LOCK_WAIT_TIMEOUT
UPDATE t2 SET pk=10 WHERE pk=1;
PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
@@ -300,6 +300,31 @@ SET DEBUG_SYNC = RESET;
SELECT * FROM t1;
DROP TABLE t1;

--echo #
--echo # MDEV-19916 Corruption after instant ADD/DROP and shrinking the tree
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;

# Create an index tree with 2 levels of node pointer pages.

SET @old_limit = @@innodb_limit_optimistic_insert_debug;
SET GLOBAL innodb_limit_optimistic_insert_debug = 2;
INSERT INTO t1 VALUES (1),(5),(4),(3),(2);
SET GLOBAL innodb_limit_optimistic_insert_debug = @old_limit;

ALTER TABLE t1 ADD COLUMN b INT, ALGORITHM=INSTANT;

SET @old_defragment = @@innodb_defragment;
SET GLOBAL innodb_defragment = 1;
OPTIMIZE TABLE t1;
SET GLOBAL innodb_defragment = @old_defragment;

# Exploit MDEV-17468 to force the table definition to be reloaded
ALTER TABLE t1 ADD vb INT AS (b) VIRTUAL;
CHECK TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;

--echo #
--echo # MDEV-17899 Assertion failures on rollback of instant ADD/DROP
--echo # MDEV-18098 Crash after rollback of instant DROP COLUMN
@@ -64,7 +64,7 @@
CREATE TABLE t1 (c VARBINARY(65534));
CREATE TABLE t1 (c VARBINARY(65535));
Like VARCHAR(65536), they will be converted to BLOB automatically
in non-sctict mode.
in non-strict mode.
*/
#define MAX_FIELD_VARCHARLENGTH (65535-2-1)
#define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */
@@ -1,5 +1,5 @@
/*
Copyright (c) 2015 MariaDB Foundation.
Copyright (c) 2015,2019 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
@@ -1173,6 +1173,8 @@ Type_handler::string_type_handler(uint max_octet_length)
return &type_handler_long_blob;
else if (max_octet_length >= 65536)
return &type_handler_medium_blob;
else if (max_octet_length >= MAX_FIELD_VARCHARLENGTH)
return &type_handler_blob;
return &type_handler_varchar;
}

@@ -2256,6 +2258,7 @@ Field *Type_handler_varchar::make_conversion_table_field(TABLE *table,
const Field *target)
const
{
DBUG_ASSERT(HA_VARCHAR_PACKLENGTH(metadata) <= MAX_FIELD_VARCHARLENGTH);
return new(table->in_use->mem_root)
Field_varstring(NULL, metadata, HA_VARCHAR_PACKLENGTH(metadata),
(uchar *) "", 1, Field::NONE, &empty_clex_str,
@@ -3326,6 +3329,8 @@ Field *Type_handler_varchar::make_table_field(const LEX_CSTRING *name,
TABLE *table) const

{
DBUG_ASSERT(HA_VARCHAR_PACKLENGTH(attr.max_length) <=
MAX_FIELD_VARCHARLENGTH);
return new (table->in_use->mem_root)
Field_varstring(addr.ptr(), attr.max_length,
HA_VARCHAR_PACKLENGTH(attr.max_length),
@@ -3494,7 +3494,8 @@ btr_lift_page_up(
/* btr_page_empty() is supposed to zero-initialize the field. */
ut_ad(!page_get_instant(father_block->frame));

if (page_level == 0 && index->is_instant()) {
if (index->is_instant()
&& father_block->page.id.page_no() == root_page_no) {
ut_ad(!father_page_zip);
btr_set_instant(father_block, *index, mtr);
}

0 comments on commit 9c16460

Please sign in to comment.
You can’t perform that action at this time.