Skip to content

Commit

Permalink
Merge 10.5 into 10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Sep 17, 2021
2 parents 1e9c922 + 699de65 commit ae8c8d8
Show file tree
Hide file tree
Showing 12 changed files with 137 additions and 32 deletions.
9 changes: 0 additions & 9 deletions include/wsrep.h
Expand Up @@ -26,10 +26,6 @@

#define WSREP_MYSQL_DB (char *)"mysql"

#define WSREP_TO_ISOLATION_BEGIN_IF(db_, table_, table_list_) \
if (WSREP_ON && WSREP(thd) && \
wsrep_to_isolation_begin(thd, db_, table_, table_list_))

#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \
if (WSREP_ON && WSREP(thd) && \
wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \
Expand Down Expand Up @@ -57,10 +53,6 @@
wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \
goto wsrep_error_label;

#define WSREP_TO_ISOLATION_BEGIN_FK_TABLES(db_, table_, table_list_, fk_tables) \
if (WSREP(thd) && !thd->lex->no_write_to_binlog \
&& wsrep_to_isolation_begin(thd, db_, table_, table_list_, NULL, fk_tables))

#define WSREP_SYNC_WAIT(thd_, before_) \
{ if (WSREP_CLIENT(thd_) && \
wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; }
Expand All @@ -75,7 +67,6 @@
#define WSREP_ERROR(...)
#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) do { } while(0)
#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_, fk_tables_, create_info_)
#define WSREP_TO_ISOLATION_BEGIN_FK_TABLES(db_, table_, table_list_, fk_tables_)
#define WSREP_TO_ISOLATION_BEGIN_CREATE(db_, table_, table_list_, create_info_)
#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_)
#define WSREP_SYNC_WAIT(thd_, before_)
Expand Down
12 changes: 6 additions & 6 deletions mysql-test/main/alias.result
Expand Up @@ -223,16 +223,16 @@ disconnect c1;
#
create or replace table t1 (a int);
create or replace table t2 (b int);
insert into t1 values(1),(2);
insert into t1 values(1<<30),(1<<29);
insert into t2 values(1),(2);
select t1.a as a1 from t1 as t1,t2 order by t2.b,t1.a;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 a a1 3 11 1 Y 32768 0 63
def test t1 t1 a a1 3 11 10 Y 32768 0 63
a1
1
2
1
2
536870912
1073741824
536870912
1073741824
drop table t1,t2;
#
# End of 10.4 tests
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/alias.test
Expand Up @@ -231,7 +231,7 @@ disconnect c1;
--echo #
create or replace table t1 (a int);
create or replace table t2 (b int);
insert into t1 values(1),(2);
insert into t1 values(1<<30),(1<<29);
insert into t2 values(1),(2);
--enable_metadata
select t1.a as a1 from t1 as t1,t2 order by t2.b,t1.a;
Expand Down
1 change: 0 additions & 1 deletion mysql-test/suite/galera/disabled.def
Expand Up @@ -33,7 +33,6 @@ galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails
galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb
galera_pc_recovery : MDEV-25199 cluster fails to start up
galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim
galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade
galera_sst_mysqldump : MDEV-26501 : galera.galera_sst_mysqldump MTR failed: galera SST with mysqldump failed
galera_toi_ddl_nonconflicting : MDEV-21518 galera.galera_toi_ddl_nonconflicting
galera_toi_truncate : MDEV-22996 Hang on galera_toi_truncate test case
Expand Down
47 changes: 47 additions & 0 deletions mysql-test/suite/galera/r/galera_fk_truncate.result
@@ -0,0 +1,47 @@
connection node_2;
connection node_1;
CREATE TABLE author (
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL
) ENGINE = InnoDB;
CREATE TABLE book (
id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(200) NOT NULL,
author_id SMALLINT UNSIGNED NOT NULL,
CONSTRAINT `fk_book_author`
FOREIGN KEY (author_id) REFERENCES author (id)
ON DELETE CASCADE
ON UPDATE RESTRICT
) ENGINE = InnoDB;
INSERT INTO author (name) VALUES ('Abdul Alhazred');
INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID());
TRUNCATE TABLE book;
SELECT * FROM author;
id name
1 Abdul Alhazred
SELECT * FROM book;
id title author_id
connection node_2;
SELECT * FROM author;
id name
1 Abdul Alhazred
SELECT * FROM book;
id title author_id
INSERT INTO author (name) VALUES ('Abdul Alhazred');
INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID());
TRUNCATE TABLE book;
SELECT * FROM author;
id name
1 Abdul Alhazred
2 Abdul Alhazred
SELECT * FROM book;
id title author_id
connection node_1;
TRUNCATE TABLE book;
SELECT * FROM author;
id name
1 Abdul Alhazred
2 Abdul Alhazred
SELECT * FROM book;
id title author_id
DROP TABLE book, author;
3 changes: 3 additions & 0 deletions mysql-test/suite/galera/r/galera_ssl_upgrade.result
@@ -1,3 +1,5 @@
connection node_2;
connection node_1;
connection node_1;
call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
connection node_2;
Expand All @@ -24,5 +26,6 @@ connection node_1;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
connection node_2;
disconnect node_2;
disconnect node_1;
39 changes: 39 additions & 0 deletions mysql-test/suite/galera/t/galera_fk_truncate.test
@@ -0,0 +1,39 @@
--source include/galera_cluster.inc

CREATE TABLE author (
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL
) ENGINE = InnoDB;

CREATE TABLE book (
id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(200) NOT NULL,
author_id SMALLINT UNSIGNED NOT NULL,
CONSTRAINT `fk_book_author`
FOREIGN KEY (author_id) REFERENCES author (id)
ON DELETE CASCADE
ON UPDATE RESTRICT
) ENGINE = InnoDB;

INSERT INTO author (name) VALUES ('Abdul Alhazred');
INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID());

TRUNCATE TABLE book;
SELECT * FROM author;
SELECT * FROM book;

--connection node_2
SELECT * FROM author;
SELECT * FROM book;
INSERT INTO author (name) VALUES ('Abdul Alhazred');
INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID());
TRUNCATE TABLE book;
SELECT * FROM author;
SELECT * FROM book;

--connection node_1
TRUNCATE TABLE book;
SELECT * FROM author;
SELECT * FROM book;

DROP TABLE book, author;
8 changes: 8 additions & 0 deletions mysql-test/suite/innodb/r/instant_alter_import.result
Expand Up @@ -70,3 +70,11 @@ select * from t1;
ERROR HY000: Tablespace has been discarded for table `t1`
drop table t2;
drop table t1;
CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, i1 INT) ENGINE=INNODB;
CREATE TABLE t2 (id INT PRIMARY KEY AUTO_INCREMENT, i1 INT, i2 INT) ENGINE=INNODB;
ALTER TABLE t2 DROP COLUMN i2, ALGORITHM=INSTANT;
ALTER TABLE t2 DISCARD TABLESPACE;
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
ALTER TABLE t2 IMPORT TABLESPACE;
DROP TABLE t2, t1;
19 changes: 19 additions & 0 deletions mysql-test/suite/innodb/t/instant_alter_import.test
Expand Up @@ -83,3 +83,22 @@ select * from t1;

drop table t2;
drop table t1;


--let $MYSQLD_DATADIR= `SELECT @@datadir`

CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, i1 INT) ENGINE=INNODB;

CREATE TABLE t2 (id INT PRIMARY KEY AUTO_INCREMENT, i1 INT, i2 INT) ENGINE=INNODB;
ALTER TABLE t2 DROP COLUMN i2, ALGORITHM=INSTANT;
ALTER TABLE t2 DISCARD TABLESPACE;

FLUSH TABLE t1 FOR EXPORT;

--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t2.ibd
--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t2.cfg

UNLOCK TABLES;
ALTER TABLE t2 IMPORT TABLESPACE;

DROP TABLE t2, t1;
15 changes: 8 additions & 7 deletions sql/sql_admin.cc
Expand Up @@ -477,16 +477,17 @@ static bool wsrep_toi_replication(THD *thd, TABLE_LIST *tables)
/* now TOI replication, with no locks held */
if (keys.empty())
{
WSREP_TO_ISOLATION_BEGIN_WRTCHK(NULL, NULL, tables);
} else {
WSREP_TO_ISOLATION_BEGIN_FK_TABLES(NULL, NULL, tables, &keys) {
if (!thd->lex->no_write_to_binlog &&
wsrep_to_isolation_begin(thd, NULL, NULL, tables))
return true;
}
else
{
if (!thd->lex->no_write_to_binlog &&
wsrep_to_isolation_begin(thd, NULL, NULL, tables, NULL, &keys))
return true;
}
}
return false;

wsrep_error_label:
return true;
}
#endif /* WITH_WSREP */

Expand Down
12 changes: 5 additions & 7 deletions sql/sql_truncate.cc
Expand Up @@ -467,15 +467,13 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
{
if (keys.empty())
{
WSREP_TO_ISOLATION_BEGIN_IF(table_ref->db.str, table_ref->table_name.str, NULL)
{
if (wsrep_to_isolation_begin(thd, table_ref->db.str, table_ref->table_name.str, NULL))
DBUG_RETURN(TRUE);
}
} else {
WSREP_TO_ISOLATION_BEGIN_FK_TABLES(NULL, NULL, table_ref, &keys)
{
}
else
{
if (wsrep_to_isolation_begin(thd, NULL, NULL, table_ref, NULL, &keys))
DBUG_RETURN(TRUE);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/include/dict0mem.h
Expand Up @@ -2462,7 +2462,7 @@ inline void dict_index_t::clear_instant_alter()
{ return a.col->ind < b.col->ind; });
table->instant = NULL;
if (ai_col) {
auto a = std::find_if(begin, end,
auto a = std::find_if(fields, end,
[ai_col](const dict_field_t& f)
{ return f.col == ai_col; });
table->persistent_autoinc = (a == end)
Expand Down

0 comments on commit ae8c8d8

Please sign in to comment.