diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-06-02 17:39:13 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-06-02 17:39:13 +0300 |
commit | 2f8d0af8837392e7116f624729860615a33d2484 (patch) | |
tree | afbf86fc085ff20bfb6426b655bce8a75ad1658a | |
parent | a61603562e09f230e5ab6540b16e1c623520f9b2 (diff) | |
parent | 22f935d6daa70a21a3f640261fcf8c9dfb259250 (diff) | |
download | mariadb-git-2f8d0af8837392e7116f624729860615a33d2484.tar.gz |
Merge 10.5 into 10.6
57 files changed, 1464 insertions, 1885 deletions
diff --git a/client/client_priv.h b/client/client_priv.h index 9423f9e26db..56e81ebb94f 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -1,6 +1,6 @@ /* Copyright (c) 2001, 2012, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB + Copyright (c) 2009, 2022, 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 @@ -102,6 +102,7 @@ enum options_client OPT_IGNORE_DATA, OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS, OPT_CHECK_IF_UPGRADE_NEEDED, + OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, OPT_SHUTDOWN_WAIT_FOR_SLAVES, OPT_COPY_S3_TABLES, OPT_PRINT_TABLE_METADATA, diff --git a/client/mysql.cc b/client/mysql.cc index 37f506a99cd..db0780cba74 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1527,6 +1527,8 @@ static struct my_option my_long_options[] = &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"execute", 'e', "Execute command and quit. (Disables --force and history file.)", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"enable-cleartext-plugin", OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, "Obsolete option. Exists only for MySQL compatibility.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"vertical", 'E', "Print the output of a query (rows) vertically.", &vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1836,6 +1838,14 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi printf("WARNING: --server-arg option not supported in this configuration.\n"); #endif break; + case OPT_COMPATIBILTY_CLEARTEXT_PLUGIN: + /* + This option exists in MySQL client but not in MariaDB. Users switching from + MySQL might still have this option in their commands, and it will not work + in MariaDB unless it is handled. Therefore output a warning and continue. + */ + printf("WARNING: option '--enable-cleartext-plugin' is obsolete.\n"); + break; case 'A': opt_rehash= 0; break; diff --git a/extra/mariabackup/ds_compress.cc b/extra/mariabackup/ds_compress.cc index 40566a1a8b1..eed3467b7f4 100644 --- a/extra/mariabackup/ds_compress.cc +++ b/extra/mariabackup/ds_compress.cc @@ -1,5 +1,6 @@ /****************************************************** Copyright (c) 2011-2013 Percona LLC and/or its affiliates. +Copyright (c) 2022, MariaDB Corporation. Compressing datasink implementation for XtraBackup. @@ -32,11 +33,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA typedef struct { pthread_t id; uint num; - pthread_mutex_t ctrl_mutex; - pthread_cond_t ctrl_cond; pthread_mutex_t data_mutex; pthread_cond_t data_cond; - my_bool started; my_bool data_avail; my_bool cancelled; const char *from; @@ -206,14 +204,13 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len) thd = threads + i; - pthread_mutex_lock(&thd->ctrl_mutex); + pthread_mutex_lock(&thd->data_mutex); chunk_len = (len > COMPRESS_CHUNK_SIZE) ? COMPRESS_CHUNK_SIZE : len; thd->from = ptr; thd->from_len = chunk_len; - pthread_mutex_lock(&thd->data_mutex); thd->data_avail = TRUE; pthread_cond_signal(&thd->data_cond); pthread_mutex_unlock(&thd->data_mutex); @@ -239,26 +236,24 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len) xb_a(threads[i].to_len > 0); - if (ds_write(dest_file, "NEWBNEWB", 8) || - write_uint64_le(dest_file, - comp_file->bytes_processed)) { - msg("compress: write to the destination stream " - "failed."); - return 1; + bool fail = ds_write(dest_file, "NEWBNEWB", 8) || + write_uint64_le(dest_file, + comp_file->bytes_processed); + comp_file->bytes_processed += threads[i].from_len; + + if (!fail) { + fail = write_uint32_le(dest_file, threads[i].adler) || + ds_write(dest_file, threads[i].to, + threads[i].to_len); } - comp_file->bytes_processed += threads[i].from_len; + pthread_mutex_unlock(&threads[i].data_mutex); - if (write_uint32_le(dest_file, threads[i].adler) || - ds_write(dest_file, threads[i].to, - threads[i].to_len)) { + if (fail) { msg("compress: write to the destination stream " "failed."); return 1; } - - pthread_mutex_unlock(&threads[i].data_mutex); - pthread_mutex_unlock(&threads[i].ctrl_mutex); } } @@ -329,6 +324,23 @@ write_uint64_le(ds_file_t *file, ulonglong n) } static +void +destroy_worker_thread(comp_thread_ctxt_t *thd) +{ + pthread_mutex_lock(&thd->data_mutex); + thd->cancelled = TRUE; + pthread_cond_signal(&thd->data_cond); + pthread_mutex_unlock(&thd->data_mutex); + + pthread_join(thd->id, NULL); + + pthread_cond_destroy(&thd->data_cond); + pthread_mutex_destroy(&thd->data_mutex); + + my_free(thd->to); +} + +static comp_thread_ctxt_t * create_worker_threads(uint n) { @@ -342,53 +354,31 @@ create_worker_threads(uint n) comp_thread_ctxt_t *thd = threads + i; thd->num = i + 1; - thd->started = FALSE; thd->cancelled = FALSE; thd->data_avail = FALSE; thd->to = (char *) my_malloc(PSI_NOT_INSTRUMENTED, COMPRESS_CHUNK_SIZE + MY_QLZ_COMPRESS_OVERHEAD, MYF(MY_FAE)); - /* Initialize the control mutex and condition var */ - if (pthread_mutex_init(&thd->ctrl_mutex, NULL) || - pthread_cond_init(&thd->ctrl_cond, NULL)) { - goto err; - } - /* Initialize and data mutex and condition var */ if (pthread_mutex_init(&thd->data_mutex, NULL) || pthread_cond_init(&thd->data_cond, NULL)) { goto err; } - pthread_mutex_lock(&thd->ctrl_mutex); - if (pthread_create(&thd->id, NULL, compress_worker_thread_func, thd)) { msg("compress: pthread_create() failed: " "errno = %d", errno); - pthread_mutex_unlock(&thd->ctrl_mutex); goto err; } } - /* Wait for the threads to start */ - for (i = 0; i < n; i++) { - comp_thread_ctxt_t *thd = threads + i; - - while (thd->started == FALSE) - pthread_cond_wait(&thd->ctrl_cond, &thd->ctrl_mutex); - pthread_mutex_unlock(&thd->ctrl_mutex); - } - return threads; err: - while (i > 0) { - comp_thread_ctxt_t *thd; - i--; - thd = threads + i; - pthread_mutex_unlock(&thd->ctrl_mutex); + for (; i; i--) { + destroy_worker_thread(threads + i); } my_free(threads); @@ -402,21 +392,7 @@ destroy_worker_threads(comp_thread_ctxt_t *threads, uint n) uint i; for (i = 0; i < n; i++) { - comp_thread_ctxt_t *thd = threads + i; - - pthread_mutex_lock(&thd->data_mutex); - threads[i].cancelled = TRUE; - pthread_cond_signal(&thd->data_cond); - pthread_mutex_unlock(&thd->data_mutex); - - pthread_join(thd->id, NULL); - - pthread_cond_destroy(&thd->data_cond); - pthread_mutex_destroy(&thd->data_mutex); - pthread_cond_destroy(&thd->ctrl_cond); - pthread_mutex_destroy(&thd->ctrl_mutex); - - my_free(thd->to); + destroy_worker_thread(threads + i); } my_free(threads); @@ -428,19 +404,9 @@ compress_worker_thread_func(void *arg) { comp_thread_ctxt_t *thd = (comp_thread_ctxt_t *) arg; - pthread_mutex_lock(&thd->ctrl_mutex); - pthread_mutex_lock(&thd->data_mutex); - thd->started = TRUE; - pthread_cond_signal(&thd->ctrl_cond); - - pthread_mutex_unlock(&thd->ctrl_mutex); - while (1) { - thd->data_avail = FALSE; - pthread_cond_signal(&thd->data_cond); - while (!thd->data_avail && !thd->cancelled) { pthread_cond_wait(&thd->data_cond, &thd->data_mutex); } diff --git a/man/mysql.1 b/man/mysql.1 index ebc889b8745..e58f4c8365b 100644 --- a/man/mysql.1 +++ b/man/mysql.1 @@ -507,6 +507,21 @@ the section called \(lqMYSQL COMMANDS\(rq\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysql: enable cleartext plugin option +.\" enable cleartext plugin option: mysql +\fB\-\-enable\-cleartext\-plugin\fR +.sp +Obsolete option\&. Exists only for MySQL compatibility\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql: execute option .\" execute option: mysql \fB\-\-execute=\fR\fB\fIstatement\fR\fR, diff --git a/mysql-test/include/not_valgrind.inc b/mysql-test/include/not_valgrind.inc index 8bda3497878..a2372db4c4f 100644 --- a/mysql-test/include/not_valgrind.inc +++ b/mysql-test/include/not_valgrind.inc @@ -1,4 +1,4 @@ --require include/not_valgrind.require --disable_query_log -eval select $VALGRIND_TEST as using_valgrind; +eval select $VALGRIND_TEST+0 as using_valgrind; --enable_query_log diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result index 1cad2f14a41..385fd4526a1 100644 --- a/mysql-test/main/alter_table.result +++ b/mysql-test/main/alter_table.result @@ -1,5 +1,3 @@ -drop table if exists t1,t2; -drop database if exists mysqltest; set @save_max_allowed_packet=@@global.max_allowed_packet; create table t1 ( col1 int not null auto_increment primary key, @@ -2588,22 +2586,6 @@ set max_statement_time= 0; drop table t1; drop view v1; # -# MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed -# -set @save_default_engine= @@default_storage_engine; -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; -alter table t1 change x xx int, algorithm=inplace; -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); -alter table t1 change x xx int, algorithm=inplace; -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -drop table t1; -set @@default_storage_engine= @save_default_engine; -# # End of 10.3 tests # # @@ -2650,296 +2632,6 @@ DROP TABLE t1; # End of 10.4 tests # # -# MDEV-16290 ALTER TABLE ... RENAME COLUMN syntax -# -SET @save_default_engine= @@DEFAULT_STORAGE_ENGINE; -CREATE TABLE t1(a INT, b VARCHAR(30), c FLOAT); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL, - `b` varchar(30) DEFAULT NULL, - `c` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -INSERT INTO t1 VALUES(1,'abcd',1.234); -CREATE TABLE t2(a INT, b VARCHAR(30), c FLOAT) ENGINE=MyIsam; -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `a` int(11) DEFAULT NULL, - `b` varchar(30) DEFAULT NULL, - `c` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -INSERT INTO t2 VALUES(1,'abcd',1.234); -ALTER TABLE t1 RENAME COLUMN a TO a; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL, - `b` varchar(30) DEFAULT NULL, - `c` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 RENAME COLUMN a TO m; -ALTER TABLE t1 RENAME COLUMN a TO m; -ERROR 42S22: Unknown column 'a' in 't1' -ALTER TABLE t1 RENAME COLUMN IF EXISTS a TO m; -Warnings: -Note 1054 Unknown column 'a' in 't1' -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `m` int(11) DEFAULT NULL, - `b` varchar(30) DEFAULT NULL, - `c` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -SELECT * FROM t1; -m b c -1 abcd 1.234 -ALTER TABLE t1 RENAME COLUMN m TO x, -RENAME COLUMN b TO y, -RENAME COLUMN c TO z; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `x` int(11) DEFAULT NULL, - `y` varchar(30) DEFAULT NULL, - `z` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -SELECT * FROM t1; -x y z -1 abcd 1.234 -ALTER TABLE t2 RENAME COLUMN a TO d, RENAME COLUMN b TO e, RENAME COLUMN c to f; -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `d` int(11) DEFAULT NULL, - `e` varchar(30) DEFAULT NULL, - `f` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SELECT * FROM t2; -d e f -1 abcd 1.234 -ALTER TABLE t1 CHANGE COLUMN x a INT, RENAME COLUMN y TO b; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL, - `b` varchar(30) DEFAULT NULL, - `z` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 CHANGE COLUMN z c DOUBLE, RENAME COLUMN b to b; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL, - `b` varchar(30) DEFAULT NULL, - `c` double DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 CHANGE COLUMN a b int, RENAME COLUMN b TO c, CHANGE COLUMN c d FLOAT; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `b` int(11) DEFAULT NULL, - `c` varchar(30) DEFAULT NULL, - `d` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 ADD COLUMN zz INT, RENAME COLUMN d TO f; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `b` int(11) DEFAULT NULL, - `c` varchar(30) DEFAULT NULL, - `f` float DEFAULT NULL, - `zz` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 DROP COLUMN zz, RENAME COLUMN c TO zz; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `b` int(11) DEFAULT NULL, - `zz` varchar(30) DEFAULT NULL, - `f` float DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 RENAME COLUMN zz to c, DROP COLUMN f; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `b` int(11) DEFAULT NULL, - `c` varchar(30) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 ADD COLUMN d INT DEFAULT 5, RENAME COLUMN c TO b, DROP COLUMN b; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `b` varchar(30) DEFAULT NULL, - `d` int(11) DEFAULT 5 -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 RENAME COLUMN b TO d, RENAME COLUMN d TO b; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT 5 -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 ADD KEY(b); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT 5, - KEY `b` (`b`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 RENAME COLUMN b TO bb; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d` varchar(30) DEFAULT NULL, - `bb` int(11) DEFAULT 5, - KEY `b` (`bb`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -SELECT * FROM t1; -d bb -abcd 5 -CREATE TABLE t3(a int, b int, KEY(b)); -ALTER TABLE t3 ADD CONSTRAINT FOREIGN KEY(b) REFERENCES t1(bb); -SHOW CREATE TABLE t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT NULL, - KEY `b` (`b`), - CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`bb`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 RENAME COLUMN bb TO b; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT 5, - KEY `b` (`b`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t3 RENAME COLUMN b TO c; -SHOW CREATE TABLE t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `a` int(11) DEFAULT NULL, - `c` int(11) DEFAULT NULL, - KEY `b` (`c`), - CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`b`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -CREATE TABLE t4(a int); -ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; -SHOW CREATE TABLE t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `aa` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t4 RENAME COLUMN aa TO a, ALGORITHM = COPY; -SHOW CREATE TABLE t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `a` int(11) DEFAULT NULL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -DROP TABLE t4; -CREATE VIEW v1 AS SELECT d,e,f FROM t2; -CREATE TRIGGER trg1 BEFORE UPDATE on t2 FOR EACH ROW SET NEW.d=OLD.d + 10; -CREATE PROCEDURE sp1() INSERT INTO t2(d) VALUES(10); -ALTER TABLE t2 RENAME COLUMN d TO g; -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `g` int(11) DEFAULT NULL, - `e` varchar(30) DEFAULT NULL, - `f` float DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SHOW CREATE VIEW v1; -View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t2`.`d` AS `d`,`test`.`t2`.`e` AS `e`,`test`.`t2`.`f` AS `f` from `t2` koi8r koi8r_general_ci -Warnings: -Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them -SELECT * FROM v1; -ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them -UPDATE t2 SET f = f + 10; -ERROR 42S22: Unknown column 'd' in 'OLD' -CALL sp1(); -ERROR 42S22: Unknown column 'd' in 'field list' -DROP TRIGGER trg1; -DROP PROCEDURE sp1; -CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a))); -INSERT INTO t_gen(a) VALUES(4); -SELECT * FROM t_gen; -a b -4 2 -SHOW CREATE TABLE t_gen; -Table Create Table -t_gen CREATE TABLE `t_gen` ( - `a` int(11) DEFAULT NULL, - `b` double GENERATED ALWAYS AS (sqrt(`a`)) VIRTUAL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t_gen RENAME COLUMN a TO c, CHANGE COLUMN b b DOUBLE GENERATED ALWAYS AS (SQRT(c)); -SELECT * FROM t_gen; -c b -4 2 -SHOW CREATE TABLE t_gen; -Table Create Table -t_gen CREATE TABLE `t_gen` ( - `c` int(11) DEFAULT NULL, - `b` double GENERATED ALWAYS AS (sqrt(`c`)) VIRTUAL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t_gen CHANGE COLUMN c x INT; -show create table t_gen; -Table Create Table -t_gen CREATE TABLE `t_gen` ( - `x` int(11) DEFAULT NULL, - `b` double GENERATED ALWAYS AS (sqrt(`x`)) VIRTUAL -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t_gen RENAME COLUMN x TO a; -DROP TABLE t_gen; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT 5, - KEY `b` (`b`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -ALTER TABLE t1 RENAME COLUMN b z; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'z' at line 1 -ALTER TABLE t1 RENAME COLUMN FROM b TO z; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM b TO z' at line 1 -ALTER TABLE t1 RENAME COLUMN b TO 1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1' at line 1 -ALTER TABLE t1 RENAME COLUMN b TO e, RENAME COLUMN c TO e; -ERROR 42S22: Unknown column 'c' in 't1' -ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN b TO z; -ERROR 42S21: Duplicate column name 'z' -ALTER TABLE t1 DROP COLUMN b, RENAME COLUMN b TO z; -ERROR 42S22: Unknown column 'b' in 't1' -ALTER TABLE t1 RENAME COLUMN b TO b, RENAME COLUMN b TO b; -ERROR 42S22: Unknown column 'b' in 't1' -ALTER TABLE t1 RENAME COLUMN b TO c3, DROP COLUMN c3; -ERROR 42000: Can't DROP COLUMN `c3`; check that it exists -ALTER TABLE t1 ADD COLUMN z INT, CHANGE COLUMN z y INT, DROP COLUMN y; -ERROR 42S22: Unknown column 'z' in 't1' -ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN z TO y, DROP COLUMN y; -ERROR 42S22: Unknown column 'z' in 't1' -ALTER TABLE t1 RENAME COLUMN b TO `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn`; -ERROR 42000: Incorrect column name 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn' -ALTER TABLE t1 CHANGE b `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn` int; -ERROR 42000: Identifier name 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn' is too long -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `d` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT 5, - KEY `b` (`b`) -) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 -SELECT * FROM t1; -d b -abcd 5 -DROP VIEW v1; -DROP TABLE t3,t1,t2; -SET DEFAULT_STORAGE_ENGINE= @save_default_engine; -# # MDEV-7318 RENAME INDEX # # @@ -3389,22 +3081,6 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # -# MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed -# -set @save_default_engine= @@default_storage_engine; -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; -alter table t1 change x xx int, algorithm=inplace; -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); -alter table t1 change x xx int, algorithm=inplace; -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -drop table t1; -set @@default_storage_engine= @save_default_engine; -# # MDEV-25555 Server crashes in tree_record_pos after INPLACE-recreating index on HEAP table # create table t1 (a int, key idx1(a), key idx2 using btree(a)) engine=memory; diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test index 1bff20a7bd7..b339da5edb2 100644 --- a/mysql-test/main/alter_table.test +++ b/mysql-test/main/alter_table.test @@ -2,10 +2,6 @@ # # Test of alter table # ---disable_warnings -drop table if exists t1,t2; -drop database if exists mysqltest; ---enable_warnings set @save_max_allowed_packet=@@global.max_allowed_packet; create table t1 ( @@ -2100,47 +2096,6 @@ drop table t1; drop view v1; --echo # ---echo # MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed ---echo # -set @save_default_engine= @@default_storage_engine; ---disable_query_log -if ($MTR_COMBINATION_INNODB) -{ - set default_storage_engine= innodb; -} -if ($MTR_COMBINATION_ARIA) -{ - set default_storage_engine= aria; -} ---enable_query_log - -if (!$MTR_COMBINATION_INNODB) -{ - --disable_query_log - --disable_result_log - # There is no inplace ADD INDEX for MyISAM/Aria: - create or replace table t1 (x int); - --error ER_ALTER_OPERATION_NOT_SUPPORTED - alter table t1 add unique (x), algorithm=inplace; - --error ER_ALTER_OPERATION_NOT_SUPPORTED - alter table t1 add primary key(x), algorithm=inplace; - --error ER_ALTER_OPERATION_NOT_SUPPORTED - alter table t1 add index(x), algorithm=inplace; - --enable_query_log - --enable_result_log -} - -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; -alter table t1 change x xx int, algorithm=inplace; -check table t1; -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); -alter table t1 change x xx int, algorithm=inplace; -check table t1; -# cleanup -drop table t1; -set @@default_storage_engine= @save_default_engine; - ---echo # --echo # End of 10.3 tests --echo # @@ -2193,205 +2148,6 @@ DROP TABLE t1; --echo # --echo # ---echo # MDEV-16290 ALTER TABLE ... RENAME COLUMN syntax ---echo # -SET @save_default_engine= @@DEFAULT_STORAGE_ENGINE; ---disable_query_log -if ($MTR_COMBINATION_INNODB) -{ -SET DEFAULT_STORAGE_ENGINE= INNODB; -} -if ($MTR_COMBINATION_ARIA) -{ -SET DEFAULT_STORAGE_ENGINE= ARIA; -} -if ($MTR_COMBINATION_HEAP) -{ -SET DEFAULT_STORAGE_ENGINE= MEMORY; -} ---enable_query_log -let $default_engine= `select @@default_storage_engine`; - -CREATE TABLE t1(a INT, b VARCHAR(30), c FLOAT); ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES(1,'abcd',1.234); -CREATE TABLE t2(a INT, b VARCHAR(30), c FLOAT) ENGINE=MyIsam; -SHOW CREATE TABLE t2; -INSERT INTO t2 VALUES(1,'abcd',1.234); - -# Rename one column -ALTER TABLE t1 RENAME COLUMN a TO a; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 RENAME COLUMN a TO m; ---error ER_BAD_FIELD_ERROR -ALTER TABLE t1 RENAME COLUMN a TO m; -ALTER TABLE t1 RENAME COLUMN IF EXISTS a TO m; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -SELECT * FROM t1; - -# Rename multiple column -ALTER TABLE t1 RENAME COLUMN m TO x, - RENAME COLUMN b TO y, - RENAME COLUMN c TO z; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -SELECT * FROM t1; - -# Rename multiple columns with MyIsam Engine -ALTER TABLE t2 RENAME COLUMN a TO d, RENAME COLUMN b TO e, RENAME COLUMN c to f; -SHOW CREATE TABLE t2; -SELECT * FROM t2; - -# Mix different ALTER operations with RENAME COLUMN -ALTER TABLE t1 CHANGE COLUMN x a INT, RENAME COLUMN y TO b; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 CHANGE COLUMN z c DOUBLE, RENAME COLUMN b to b; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 CHANGE COLUMN a b int, RENAME COLUMN b TO c, CHANGE COLUMN c d FLOAT; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 ADD COLUMN zz INT, RENAME COLUMN d TO f; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 DROP COLUMN zz, RENAME COLUMN c TO zz; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 RENAME COLUMN zz to c, DROP COLUMN f; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 ADD COLUMN d INT DEFAULT 5, RENAME COLUMN c TO b, DROP COLUMN b; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; - -#Cyclic Rename -ALTER TABLE t1 RENAME COLUMN b TO d, RENAME COLUMN d TO b; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; - -# Rename with Indexes -ALTER TABLE t1 ADD KEY(b); ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t1 RENAME COLUMN b TO bb; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -SELECT * FROM t1; - -# Rename with Foreign keys. -CREATE TABLE t3(a int, b int, KEY(b)); -ALTER TABLE t3 ADD CONSTRAINT FOREIGN KEY(b) REFERENCES t1(bb); ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t3; -ALTER TABLE t1 RENAME COLUMN bb TO b; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -ALTER TABLE t3 RENAME COLUMN b TO c; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t3; - -# Different Algorithm -CREATE TABLE t4(a int); -ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t4; -ALTER TABLE t4 RENAME COLUMN aa TO a, ALGORITHM = COPY; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t4; -DROP TABLE t4; - -# View, Trigger and SP -CREATE VIEW v1 AS SELECT d,e,f FROM t2; -CREATE TRIGGER trg1 BEFORE UPDATE on t2 FOR EACH ROW SET NEW.d=OLD.d + 10; -CREATE PROCEDURE sp1() INSERT INTO t2(d) VALUES(10); -ALTER TABLE t2 RENAME COLUMN d TO g; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t2; -SHOW CREATE VIEW v1; ---error ER_VIEW_INVALID -SELECT * FROM v1; ---error ER_BAD_FIELD_ERROR -UPDATE t2 SET f = f + 10; ---error ER_BAD_FIELD_ERROR -CALL sp1(); -DROP TRIGGER trg1; -DROP PROCEDURE sp1; - -# Generated Columns -if (!$MTR_COMBINATION_HEAP) -{ -CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a))); -INSERT INTO t_gen(a) VALUES(4); -SELECT * FROM t_gen; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t_gen; -ALTER TABLE t_gen RENAME COLUMN a TO c, CHANGE COLUMN b b DOUBLE GENERATED ALWAYS AS (SQRT(c)); -SELECT * FROM t_gen; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t_gen; -#--error ER_DEPENDENT_BY_GENERATED_COLUMN -ALTER TABLE t_gen CHANGE COLUMN c x INT; ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -show create table t_gen; -#--error ER_DEPENDENT_BY_GENERATED_COLUMN -ALTER TABLE t_gen RENAME COLUMN x TO a; -DROP TABLE t_gen; -} - - -# -# Negative tests -# ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; - -# Invalid Syntax ---error ER_PARSE_ERROR -ALTER TABLE t1 RENAME COLUMN b z; ---error ER_PARSE_ERROR -ALTER TABLE t1 RENAME COLUMN FROM b TO z; ---error ER_PARSE_ERROR -ALTER TABLE t1 RENAME COLUMN b TO 1; - -# Duplicate column name ---error ER_BAD_FIELD_ERROR -ALTER TABLE t1 RENAME COLUMN b TO e, RENAME COLUMN c TO e; ---error ER_DUP_FIELDNAME -ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN b TO z; - -# Multiple operation on same column ---error ER_BAD_FIELD_ERROR -ALTER TABLE t1 DROP COLUMN b, RENAME COLUMN b TO z; ---error ER_BAD_FIELD_ERROR -ALTER TABLE t1 RENAME COLUMN b TO b, RENAME COLUMN b TO b; ---error ER_CANT_DROP_FIELD_OR_KEY -ALTER TABLE t1 RENAME COLUMN b TO c3, DROP COLUMN c3; ---error ER_BAD_FIELD_ERROR -ALTER TABLE t1 ADD COLUMN z INT, CHANGE COLUMN z y INT, DROP COLUMN y; ---error ER_BAD_FIELD_ERROR -ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN z TO y, DROP COLUMN y; - -# Invalid column name while renaming ---error ER_WRONG_COLUMN_NAME -ALTER TABLE t1 RENAME COLUMN b TO `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn`; -# This error is different compared to ALTER TABLE ... CHANGE command ---error ER_TOO_LONG_IDENT -ALTER TABLE t1 CHANGE b `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn` int; - ---replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" -SHOW CREATE TABLE t1; -SELECT * FROM t1; - -# Cleanup -DROP VIEW v1; -DROP TABLE t3,t1,t2; -SET DEFAULT_STORAGE_ENGINE= @save_default_engine; - ---echo # --echo # MDEV-7318 RENAME INDEX --echo # @@ -2609,47 +2365,6 @@ show create table t1; drop table t1; --echo # ---echo # MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed ---echo # -set @save_default_engine= @@default_storage_engine; ---disable_query_log -if ($MTR_COMBINATION_INNODB) -{ - set default_storage_engine= innodb; -} -if ($MTR_COMBINATION_ARIA) -{ - set default_storage_engine= aria; -} ---enable_query_log - -if (!$MTR_COMBINATION_INNODB) -{ - --disable_query_log - --disable_result_log - # There is no inplace ADD INDEX for MyISAM/Aria: - create or replace table t1 (x int); - --error ER_ALTER_OPERATION_NOT_SUPPORTED - alter table t1 add unique (x), algorithm=inplace; - --error ER_ALTER_OPERATION_NOT_SUPPORTED - alter table t1 add primary key(x), algorithm=inplace; - --error ER_ALTER_OPERATION_NOT_SUPPORTED - alter table t1 add index(x), algorithm=inplace; - --enable_query_log - --enable_result_log -} - -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; -alter table t1 change x xx int, algorithm=inplace; -check table t1; -create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); -alter table t1 change x xx int, algorithm=inplace; -check table t1; -# cleanup -drop table t1; -set @@default_storage_engine= @save_default_engine; - ---echo # --echo # MDEV-25555 Server crashes in tree_record_pos after INPLACE-recreating index on HEAP table --echo # create table t1 (a int, key idx1(a), key idx2 using btree(a)) engine=memory; diff --git a/mysql-test/main/alter_table,aria.rdiff b/mysql-test/main/alter_table_combinations,aria.rdiff index 40bbf95494c..c549f307d1f 100644 --- a/mysql-test/main/alter_table,aria.rdiff +++ b/mysql-test/main/alter_table_combinations,aria.rdiff @@ -1,6 +1,6 @@ ---- ./mysql-test/main/alter_table.result 2020-02-27 19:35:41.279992329 +0300 -+++ ./mysql-test/main/alter_table,aria.reject 2020-02-27 19:37:13.251994491 +0300 -@@ -2716,8 +2716,7 @@ +--- main/alter_table_combinations.result 2022-05-24 17:16:56.769146869 +0200 ++++ main/alter_table_combinations.reject 2022-05-24 17:25:20.847126357 +0200 +@@ -173,8 +173,7 @@ t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, @@ -10,7 +10,7 @@ ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 RENAME COLUMN bb TO b; SHOW CREATE TABLE t1; -@@ -2733,8 +2732,7 @@ +@@ -190,8 +189,7 @@ t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, diff --git a/mysql-test/main/alter_table,heap.rdiff b/mysql-test/main/alter_table_combinations,heap.rdiff index ad6fd194cc9..ed84bbe73c1 100644 --- a/mysql-test/main/alter_table,heap.rdiff +++ b/mysql-test/main/alter_table_combinations,heap.rdiff @@ -1,6 +1,15 @@ ---- ./mysql-test/main/alter_table.result 2020-02-27 19:35:41.279992329 +0300 -+++ ./mysql-test/main/alter_table,heap.reject 2020-02-27 19:39:44.175998039 +0300 -@@ -2716,8 +2716,7 @@ +--- main/alter_table_combinations.result 2022-05-24 17:16:56.769146869 +0200 ++++ main/alter_table_combinations.reject 2022-05-24 17:25:01.216127156 +0200 +@@ -11,7 +11,7 @@ + alter table t1 change x xx int, algorithm=inplace; + check table t1; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check note The storage engine for the table doesn't support check + drop table t1; + # + # End of 10.3 tests +@@ -173,8 +173,7 @@ t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, @@ -10,7 +19,7 @@ ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 ALTER TABLE t1 RENAME COLUMN bb TO b; SHOW CREATE TABLE t1; -@@ -2733,8 +2732,7 @@ +@@ -190,8 +189,7 @@ t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, @@ -20,7 +29,7 @@ ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 CREATE TABLE t4(a int); ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; -@@ -2774,36 +2772,6 @@ +@@ -231,36 +229,6 @@ ERROR 42S22: Unknown column 'd' in 'field list' DROP TRIGGER trg1; DROP PROCEDURE sp1; @@ -57,3 +66,12 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( +@@ -316,7 +284,7 @@ + alter table t1 change x xx int, algorithm=inplace; + check table t1; + Table Op Msg_type Msg_text +-test.t1 check status OK ++test.t1 check note The storage engine for the table doesn't support check + drop table t1; + # + # End of 10.5 tests diff --git a/mysql-test/main/alter_table.combinations b/mysql-test/main/alter_table_combinations.combinations index 824e0a3be04..01c0e4b31b2 100644 --- a/mysql-test/main/alter_table.combinations +++ b/mysql-test/main/alter_table_combinations.combinations @@ -1,4 +1,5 @@ [innodb] +innodb [aria] diff --git a/mysql-test/main/alter_table_combinations.result b/mysql-test/main/alter_table_combinations.result new file mode 100644 index 00000000000..459447f343e --- /dev/null +++ b/mysql-test/main/alter_table_combinations.result @@ -0,0 +1,324 @@ +set @save_default_engine= @@default_storage_engine; +# +# MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed +# +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; +alter table t1 change x xx int, algorithm=inplace; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); +alter table t1 change x xx int, algorithm=inplace; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +# +# End of 10.3 tests +# +# +# MDEV-16290 ALTER TABLE ... RENAME COLUMN syntax +# +CREATE TABLE t1(a INT, b VARCHAR(30), c FLOAT); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `c` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES(1,'abcd',1.234); +CREATE TABLE t2(a INT, b VARCHAR(30), c FLOAT) ENGINE=MyIsam; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `c` float DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t2 VALUES(1,'abcd',1.234); +ALTER TABLE t1 RENAME COLUMN a TO a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `c` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t1 RENAME COLUMN a TO m; +ALTER TABLE t1 RENAME COLUMN a TO m; +ERROR 42S22: Unknown column 'a' in 't1' +ALTER TABLE t1 RENAME COLUMN IF EXISTS a TO m; +Warnings: +Note 1054 Unknown column 'a' in 't1' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `m` int(11) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `c` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +SELECT * FROM t1; +m b c +1 abcd 1.234 +ALTER TABLE t1 RENAME COLUMN m TO x, +RENAME COLUMN b TO y, +RENAME COLUMN c TO z; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL, + `y` varchar(30) DEFAULT NULL, + `z` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +SELECT * FROM t1; +x y z +1 abcd 1.234 +ALTER TABLE t2 RENAME COLUMN a TO d, RENAME COLUMN b TO e, RENAME COLUMN c to f; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d` int(11) DEFAULT NULL, + `e` varchar(30) DEFAULT NULL, + `f` float DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t2; +d e f +1 abcd 1.234 +ALTER TABLE t1 CHANGE COLUMN x a INT, RENAME COLUMN y TO b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `z` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t1 CHANGE COLUMN z c DOUBLE, RENAME COLUMN b to b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `c` double DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t1 CHANGE COLUMN a b int, RENAME COLUMN b TO c, CHANGE COLUMN c d FLOAT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `c` varchar(30) DEFAULT NULL, + `d` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t1 ADD COLUMN zz INT, RENAME COLUMN d TO f; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `c` varchar(30) DEFAULT NULL, + `f` float DEFAULT NULL, + `zz` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t1 DROP COLUMN zz, RENAME COLUMN c TO zz; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `zz` varchar(30) DEFAULT NULL, + `f` float DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t1 RENAME COLUMN zz to c, DROP COLUMN f; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` int(11) DEFAULT NULL, + `c` varchar(30) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t1 ADD COLUMN d INT DEFAULT 5, RENAME COLUMN c TO b, DROP COLUMN b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `b` varchar(30) DEFAULT NULL, + `d` int(11) DEFAULT 5 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t1 RENAME COLUMN b TO d, RENAME COLUMN d TO b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` varchar(30) DEFAULT NULL, + `b` int(11) DEFAULT 5 +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t1 ADD KEY(b); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` varchar(30) DEFAULT NULL, + `b` int(11) DEFAULT 5, + KEY `b` (`b`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t1 RENAME COLUMN b TO bb; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` varchar(30) DEFAULT NULL, + `bb` int(11) DEFAULT 5, + KEY `b` (`bb`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +SELECT * FROM t1; +d bb +abcd 5 +CREATE TABLE t3(a int, b int, KEY(b)); +ALTER TABLE t3 ADD CONSTRAINT FOREIGN KEY(b) REFERENCES t1(bb); +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY `b` (`b`), + CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`bb`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t1 RENAME COLUMN bb TO b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` varchar(30) DEFAULT NULL, + `b` int(11) DEFAULT 5, + KEY `b` (`b`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t3 RENAME COLUMN b TO c; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + KEY `b` (`c`), + CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`c`) REFERENCES `t1` (`b`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +CREATE TABLE t4(a int); +ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `aa` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t4 RENAME COLUMN aa TO a, ALGORITHM = COPY; +SHOW CREATE TABLE t4; +Table Create Table +t4 CREATE TABLE `t4` ( + `a` int(11) DEFAULT NULL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +DROP TABLE t4; +CREATE VIEW v1 AS SELECT d,e,f FROM t2; +CREATE TRIGGER trg1 BEFORE UPDATE on t2 FOR EACH ROW SET NEW.d=OLD.d + 10; +CREATE PROCEDURE sp1() INSERT INTO t2(d) VALUES(10); +ALTER TABLE t2 RENAME COLUMN d TO g; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `g` int(11) DEFAULT NULL, + `e` varchar(30) DEFAULT NULL, + `f` float DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t2`.`d` AS `d`,`test`.`t2`.`e` AS `e`,`test`.`t2`.`f` AS `f` from `t2` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SELECT * FROM v1; +ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +UPDATE t2 SET f = f + 10; +ERROR 42S22: Unknown column 'd' in 'OLD' +CALL sp1(); +ERROR 42S22: Unknown column 'd' in 'field list' +DROP TRIGGER trg1; +DROP PROCEDURE sp1; +CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a))); +INSERT INTO t_gen(a) VALUES(4); +SELECT * FROM t_gen; +a b +4 2 +SHOW CREATE TABLE t_gen; +Table Create Table +t_gen CREATE TABLE `t_gen` ( + `a` int(11) DEFAULT NULL, + `b` double GENERATED ALWAYS AS (sqrt(`a`)) VIRTUAL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t_gen RENAME COLUMN a TO c, CHANGE COLUMN b b DOUBLE GENERATED ALWAYS AS (SQRT(c)); +SELECT * FROM t_gen; +c b +4 2 +SHOW CREATE TABLE t_gen; +Table Create Table +t_gen CREATE TABLE `t_gen` ( + `c` int(11) DEFAULT NULL, + `b` double GENERATED ALWAYS AS (sqrt(`c`)) VIRTUAL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t_gen CHANGE COLUMN c x INT; +show create table t_gen; +Table Create Table +t_gen CREATE TABLE `t_gen` ( + `x` int(11) DEFAULT NULL, + `b` double GENERATED ALWAYS AS (sqrt(`x`)) VIRTUAL +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t_gen RENAME COLUMN x TO a; +DROP TABLE t_gen; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` varchar(30) DEFAULT NULL, + `b` int(11) DEFAULT 5, + KEY `b` (`b`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +ALTER TABLE t1 RENAME COLUMN b z; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'z' at line 1 +ALTER TABLE t1 RENAME COLUMN FROM b TO z; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM b TO z' at line 1 +ALTER TABLE t1 RENAME COLUMN b TO 1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1' at line 1 +ALTER TABLE t1 RENAME COLUMN b TO e, RENAME COLUMN c TO e; +ERROR 42S22: Unknown column 'c' in 't1' +ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN b TO z; +ERROR 42S21: Duplicate column name 'z' +ALTER TABLE t1 DROP COLUMN b, RENAME COLUMN b TO z; +ERROR 42S22: Unknown column 'b' in 't1' +ALTER TABLE t1 RENAME COLUMN b TO b, RENAME COLUMN b TO b; +ERROR 42S22: Unknown column 'b' in 't1' +ALTER TABLE t1 RENAME COLUMN b TO c3, DROP COLUMN c3; +ERROR 42000: Can't DROP COLUMN `c3`; check that it exists +ALTER TABLE t1 ADD COLUMN z INT, CHANGE COLUMN z y INT, DROP COLUMN y; +ERROR 42S22: Unknown column 'z' in 't1' +ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN z TO y, DROP COLUMN y; +ERROR 42S22: Unknown column 'z' in 't1' +ALTER TABLE t1 RENAME COLUMN b TO `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn`; +ERROR 42000: Incorrect column name 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn' +ALTER TABLE t1 CHANGE b `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn` int; +ERROR 42000: Identifier name 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn' is too long +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` varchar(30) DEFAULT NULL, + `b` int(11) DEFAULT 5, + KEY `b` (`b`) +) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 +SELECT * FROM t1; +d b +abcd 5 +DROP VIEW v1; +DROP TABLE t3,t1,t2; +# +# MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed +# +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; +alter table t1 change x xx int, algorithm=inplace; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); +alter table t1 change x xx int, algorithm=inplace; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +# +# End of 10.5 tests +# +set @@default_storage_engine= @save_default_engine; diff --git a/mysql-test/main/alter_table_combinations.test b/mysql-test/main/alter_table_combinations.test new file mode 100644 index 00000000000..7c8d7f42096 --- /dev/null +++ b/mysql-test/main/alter_table_combinations.test @@ -0,0 +1,263 @@ +set @save_default_engine= @@default_storage_engine; +--disable_query_log +if ($MTR_COMBINATION_INNODB) +{ +set default_storage_engine= innodb; +} +if ($MTR_COMBINATION_ARIA) +{ +set default_storage_engine= aria; +} +if ($MTR_COMBINATION_HEAP) +{ +set default_storage_engine= memory; +} +--enable_query_log +let $default_engine= `select @@default_storage_engine`; + +--echo # +--echo # MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed +--echo # + +if (!$MTR_COMBINATION_INNODB) +{ + --disable_query_log + --disable_result_log + # There is no inplace ADD INDEX for MyISAM/Aria: + create or replace table t1 (x int); + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add unique (x), algorithm=inplace; + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add primary key(x), algorithm=inplace; + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add index(x), algorithm=inplace; + --enable_query_log + --enable_result_log +} + +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; +alter table t1 change x xx int, algorithm=inplace; +check table t1; +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); +alter table t1 change x xx int, algorithm=inplace; +check table t1; +drop table t1; + +--echo # +--echo # End of 10.3 tests +--echo # + +--echo # +--echo # MDEV-16290 ALTER TABLE ... RENAME COLUMN syntax +--echo # + +CREATE TABLE t1(a INT, b VARCHAR(30), c FLOAT); +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES(1,'abcd',1.234); +CREATE TABLE t2(a INT, b VARCHAR(30), c FLOAT) ENGINE=MyIsam; +SHOW CREATE TABLE t2; +INSERT INTO t2 VALUES(1,'abcd',1.234); + +# Rename one column +ALTER TABLE t1 RENAME COLUMN a TO a; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 RENAME COLUMN a TO m; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 RENAME COLUMN a TO m; +ALTER TABLE t1 RENAME COLUMN IF EXISTS a TO m; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +# Rename multiple column +ALTER TABLE t1 RENAME COLUMN m TO x, + RENAME COLUMN b TO y, + RENAME COLUMN c TO z; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +# Rename multiple columns with MyIsam Engine +ALTER TABLE t2 RENAME COLUMN a TO d, RENAME COLUMN b TO e, RENAME COLUMN c to f; +SHOW CREATE TABLE t2; +SELECT * FROM t2; + +# Mix different ALTER operations with RENAME COLUMN +ALTER TABLE t1 CHANGE COLUMN x a INT, RENAME COLUMN y TO b; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 CHANGE COLUMN z c DOUBLE, RENAME COLUMN b to b; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 CHANGE COLUMN a b int, RENAME COLUMN b TO c, CHANGE COLUMN c d FLOAT; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 ADD COLUMN zz INT, RENAME COLUMN d TO f; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 DROP COLUMN zz, RENAME COLUMN c TO zz; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 RENAME COLUMN zz to c, DROP COLUMN f; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 ADD COLUMN d INT DEFAULT 5, RENAME COLUMN c TO b, DROP COLUMN b; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; + +#Cyclic Rename +ALTER TABLE t1 RENAME COLUMN b TO d, RENAME COLUMN d TO b; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; + +# Rename with Indexes +ALTER TABLE t1 ADD KEY(b); +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t1 RENAME COLUMN b TO bb; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +# Rename with Foreign keys. +CREATE TABLE t3(a int, b int, KEY(b)); +ALTER TABLE t3 ADD CONSTRAINT FOREIGN KEY(b) REFERENCES t1(bb); +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t3; +ALTER TABLE t1 RENAME COLUMN bb TO b; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +ALTER TABLE t3 RENAME COLUMN b TO c; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t3; + +# Different Algorithm +CREATE TABLE t4(a int); +ALTER TABLE t4 RENAME COLUMN a TO aa, ALGORITHM = INPLACE; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t4; +ALTER TABLE t4 RENAME COLUMN aa TO a, ALGORITHM = COPY; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t4; +DROP TABLE t4; + +# View, Trigger and SP +CREATE VIEW v1 AS SELECT d,e,f FROM t2; +CREATE TRIGGER trg1 BEFORE UPDATE on t2 FOR EACH ROW SET NEW.d=OLD.d + 10; +CREATE PROCEDURE sp1() INSERT INTO t2(d) VALUES(10); +ALTER TABLE t2 RENAME COLUMN d TO g; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t2; +SHOW CREATE VIEW v1; +--error ER_VIEW_INVALID +SELECT * FROM v1; +--error ER_BAD_FIELD_ERROR +UPDATE t2 SET f = f + 10; +--error ER_BAD_FIELD_ERROR +CALL sp1(); +DROP TRIGGER trg1; +DROP PROCEDURE sp1; + +# Generated Columns +if (!$MTR_COMBINATION_HEAP) +{ +CREATE TABLE t_gen(a INT, b DOUBLE GENERATED ALWAYS AS (SQRT(a))); +INSERT INTO t_gen(a) VALUES(4); +SELECT * FROM t_gen; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t_gen; +ALTER TABLE t_gen RENAME COLUMN a TO c, CHANGE COLUMN b b DOUBLE GENERATED ALWAYS AS (SQRT(c)); +SELECT * FROM t_gen; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t_gen; +#--error ER_DEPENDENT_BY_GENERATED_COLUMN +ALTER TABLE t_gen CHANGE COLUMN c x INT; +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +show create table t_gen; +#--error ER_DEPENDENT_BY_GENERATED_COLUMN +ALTER TABLE t_gen RENAME COLUMN x TO a; +DROP TABLE t_gen; +} + +# +# Negative tests +# +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; + +# Invalid Syntax +--error ER_PARSE_ERROR +ALTER TABLE t1 RENAME COLUMN b z; +--error ER_PARSE_ERROR +ALTER TABLE t1 RENAME COLUMN FROM b TO z; +--error ER_PARSE_ERROR +ALTER TABLE t1 RENAME COLUMN b TO 1; + +# Duplicate column name +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 RENAME COLUMN b TO e, RENAME COLUMN c TO e; +--error ER_DUP_FIELDNAME +ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN b TO z; + +# Multiple operation on same column +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 DROP COLUMN b, RENAME COLUMN b TO z; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 RENAME COLUMN b TO b, RENAME COLUMN b TO b; +--error ER_CANT_DROP_FIELD_OR_KEY +ALTER TABLE t1 RENAME COLUMN b TO c3, DROP COLUMN c3; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 ADD COLUMN z INT, CHANGE COLUMN z y INT, DROP COLUMN y; +--error ER_BAD_FIELD_ERROR +ALTER TABLE t1 ADD COLUMN z INT, RENAME COLUMN z TO y, DROP COLUMN y; + +# Invalid column name while renaming +--error ER_WRONG_COLUMN_NAME +ALTER TABLE t1 RENAME COLUMN b TO `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn`; +# This error is different compared to ALTER TABLE ... CHANGE command +--error ER_TOO_LONG_IDENT +ALTER TABLE t1 CHANGE b `nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn` int; + +--replace_result $default_engine DEFAULT_ENGINE " PAGE_CHECKSUM=1" "" +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +# Cleanup +DROP VIEW v1; +DROP TABLE t3,t1,t2; + +--echo # +--echo # MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed +--echo # + +if (!$MTR_COMBINATION_INNODB) +{ + --disable_query_log + --disable_result_log + # There is no inplace ADD INDEX for MyISAM/Aria: + create or replace table t1 (x int); + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add unique (x), algorithm=inplace; + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add primary key(x), algorithm=inplace; + --error ER_ALTER_OPERATION_NOT_SUPPORTED + alter table t1 add index(x), algorithm=inplace; + --enable_query_log + --enable_result_log +} + +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam; +alter table t1 change x xx int, algorithm=inplace; +check table t1; +create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)); +alter table t1 change x xx int, algorithm=inplace; +check table t1; +drop table t1; + +--echo # +--echo # End of 10.5 tests +--echo # + +set @@default_storage_engine= @save_default_engine; diff --git a/mysql-test/main/mysql.result b/mysql-test/main/mysql.result index 75b1a01ee4e..f2dec7fe1a4 100644 --- a/mysql-test/main/mysql.result +++ b/mysql-test/main/mysql.result @@ -629,4 +629,7 @@ drop table t1; # # MDEV-15538 '-N' Produce html output wrong # -<TABLE BORDER=1><TR><TD>1</TD></TR></TABLE>
\ No newline at end of file +<TABLE BORDER=1><TR><TD>1</TD></TR></TABLE> +WARNING: option '--enable-cleartext-plugin' is obsolete. +1 +1 diff --git a/mysql-test/main/mysql.test b/mysql-test/main/mysql.test index 1cb4977a32d..0f41add821a 100644 --- a/mysql-test/main/mysql.test +++ b/mysql-test/main/mysql.test @@ -708,3 +708,11 @@ drop table t1; --echo # MDEV-15538 '-N' Produce html output wrong --echo # --exec $MYSQL -NHe "select 1 as a" + + +# +# Test obsolete option --enable-cleartext-plugin +# This should proceed with a warning +# +--echo +--exec $MYSQL test --enable-cleartext-plugin -e "select 1" diff --git a/mysql-test/main/partition_error.result b/mysql-test/main/partition_error.result index 25c29938f91..b6cd903ccca 100644 --- a/mysql-test/main/partition_error.result +++ b/mysql-test/main/partition_error.result @@ -6,7 +6,18 @@ drop table if exists t1, t2; CREATE TABLE t1 (a int); CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1; -ERROR 42000: Can't open table +ERROR HY000: 'test.v1' is not of type 'BASE TABLE' +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-28599 EXCHANGE PARTITION on view causes ER_CHECK_NO_SUCH_TABLE instead of ER_WRONG_OBJECT +# +CREATE TABLE t1 (a int) +PARTITION BY HASH (a) +PARTITIONS 2; +CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1; +ERROR HY000: 'test.v1' is not of type 'BASE TABLE' DROP VIEW v1; DROP TABLE t1; # diff --git a/mysql-test/main/partition_error.test b/mysql-test/main/partition_error.test index 7436bb060d2..edfe7c827be 100644 --- a/mysql-test/main/partition_error.test +++ b/mysql-test/main/partition_error.test @@ -16,7 +16,19 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`; --echo # CREATE TABLE t1 (a int); CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; ---error ER_CHECK_NO_SUCH_TABLE +--error ER_WRONG_OBJECT +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1; +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-28599 EXCHANGE PARTITION on view causes ER_CHECK_NO_SUCH_TABLE instead of ER_WRONG_OBJECT +--echo # +CREATE TABLE t1 (a int) +PARTITION BY HASH (a) +PARTITIONS 2; +CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; +--error ER_WRONG_OBJECT ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1; DROP VIEW v1; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/MDEV-18832.result b/mysql-test/suite/galera/r/MDEV-18832.result index 700a0bbefb1..2e0872b9f2e 100644 --- a/mysql-test/suite/galera/r/MDEV-18832.result +++ b/mysql-test/suite/galera/r/MDEV-18832.result @@ -12,3 +12,6 @@ INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' DROP SEQUENCE Seq1_1; DROP TABLE t1; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_2; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); diff --git a/mysql-test/suite/galera/r/MDEV-27862.result b/mysql-test/suite/galera/r/MDEV-27862.result new file mode 100644 index 00000000000..25b7bc6cfd2 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-27862.result @@ -0,0 +1,54 @@ +connection node_2; +connection node_1; +CREATE SEQUENCE seq_nocache ENGINE=InnoDB; +DROP SEQUENCE seq_nocache; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_2; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_1; +CREATE SEQUENCE seq NOCACHE ENGINE=InnoDB; +SELECT NEXTVAL(seq) = 1; +NEXTVAL(seq) = 1 +1 +connection node_2; +SELECT NEXTVAL(seq) = 2; +NEXTVAL(seq) = 2 +1 +connection node_1; +SELECT NEXTVAL(seq) = 3; +NEXTVAL(seq) = 3 +1 +SELECT SETVAL(seq, 100); +SETVAL(seq, 100) +100 +connection node_2; +SELECT NEXTVAL(seq) = 101; +NEXTVAL(seq) = 101 +1 +connection node_1; +SELECT NEXTVAL(seq) = 102; +NEXTVAL(seq) = 102 +1 +DROP SEQUENCE seq; +CREATE TABLE t1(f1 INT); +CREATE SEQUENCE seq_transaction NOCACHE ENGINE=InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES (0); +SELECT NEXTVAL(seq_transaction); +NEXTVAL(seq_transaction) +1 +INSERT INTO t1 VALUES (NEXTVAL(seq_transaction)); +COMMIT; +connection node_2; +SELECT COUNT(*) = 2 FROM t1; +COUNT(*) = 2 +1 +SELECT NEXTVAL(seq_transaction) = 3; +NEXTVAL(seq_transaction) = 3 +1 +connection node_1; +SELECT NEXTVAL(seq_transaction) = 4; +NEXTVAL(seq_transaction) = 4 +1 +DROP SEQUENCE seq_transaction; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff index 8c84321e774..f9f81ea3b40 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff @@ -1,27 +1,27 @@ --- r/galera_ist_MDEV-28423.result -+++ r/galera_ist_MDEV-28423,debug.reject -@@ -517,3 +517,187 @@ - 1 ++++ r/galera_ist_MDEV-28423.reject +@@ -286,3 +286,111 @@ DROP TABLE t1; COMMIT; + SET AUTOCOMMIT=ON; +Performing State Transfer on a server that has been killed and restarted +while a DDL was in progress on it +connection node_1; -+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 VALUES (1,'node1_committed_before'); -+INSERT INTO t1 VALUES (2,'node1_committed_before'); -+INSERT INTO t1 VALUES (3,'node1_committed_before'); -+INSERT INTO t1 VALUES (4,'node1_committed_before'); -+INSERT INTO t1 VALUES (5,'node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); +connection node_2; +START TRANSACTION; -+INSERT INTO t1 VALUES (6,'node2_committed_before'); -+INSERT INTO t1 VALUES (7,'node2_committed_before'); -+INSERT INTO t1 VALUES (8,'node2_committed_before'); -+INSERT INTO t1 VALUES (9,'node2_committed_before'); -+INSERT INTO t1 VALUES (10,'node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); +COMMIT; +SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; +connection node_1; @@ -32,26 +32,26 @@ +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); +COMMIT; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +connection node_2; @@ -59,132 +59,56 @@ +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); +COMMIT; +connection node_1; -+INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave_ddl; -+INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +ROLLBACK; -+SET AUTOCOMMIT=ON; -+SET SESSION wsrep_sync_wait=15; -+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -+EXPECT_3 -+3 -+SELECT COUNT(*) AS EXPECT_35 FROM t1; -+EXPECT_35 -+35 -+SELECT * FROM t1; -+id f1 f2 -+1 node1_committed_before NULL -+2 node1_committed_before NULL -+3 node1_committed_before NULL -+4 node1_committed_before NULL -+5 node1_committed_before NULL -+6 node2_committed_before NULL -+7 node2_committed_before NULL -+8 node2_committed_before NULL -+9 node2_committed_before NULL -+10 node2_committed_before NULL -+11 node1_committed_during NULL -+12 node1_committed_during NULL -+13 node1_committed_during NULL -+14 node1_committed_during NULL -+15 node1_committed_during NULL -+16 node1_to_be_committed_after NULL -+17 node1_to_be_committed_after NULL -+18 node1_to_be_committed_after NULL -+19 node1_to_be_committed_after NULL -+20 node1_to_be_committed_after NULL -+26 node2_committed_after NULL -+27 node2_committed_after NULL -+28 node2_committed_after NULL -+29 node2_committed_after NULL -+30 node2_committed_after NULL -+31 node1_to_be_committed_after NULL -+32 node1_to_be_committed_after NULL -+33 node1_to_be_committed_after NULL -+34 node1_to_be_committed_after NULL -+35 node1_to_be_committed_after NULL -+36 node1_committed_after NULL -+37 node1_committed_after NULL -+38 node1_committed_after NULL -+39 node1_committed_after NULL -+40 node1_committed_after NULL ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; -+connection node_1; +SET AUTOCOMMIT=ON; -+SET SESSION wsrep_sync_wait=15; -+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -+EXPECT_3 -+3 -+SELECT COUNT(*) AS EXPECT_35 FROM t1; -+EXPECT_35 -+35 -+SELECT * FROM t1; -+id f1 f2 -+1 node1_committed_before NULL -+2 node1_committed_before NULL -+3 node1_committed_before NULL -+4 node1_committed_before NULL -+5 node1_committed_before NULL -+6 node2_committed_before NULL -+7 node2_committed_before NULL -+8 node2_committed_before NULL -+9 node2_committed_before NULL -+10 node2_committed_before NULL -+11 node1_committed_during NULL -+12 node1_committed_during NULL -+13 node1_committed_during NULL -+14 node1_committed_during NULL -+15 node1_committed_during NULL -+16 node1_to_be_committed_after NULL -+17 node1_to_be_committed_after NULL -+18 node1_to_be_committed_after NULL -+19 node1_to_be_committed_after NULL -+20 node1_to_be_committed_after NULL -+26 node2_committed_after NULL -+27 node2_committed_after NULL -+28 node2_committed_after NULL -+29 node2_committed_after NULL -+30 node2_committed_after NULL -+31 node1_to_be_committed_after NULL -+32 node1_to_be_committed_after NULL -+33 node1_to_be_committed_after NULL -+34 node1_to_be_committed_after NULL -+35 node1_to_be_committed_after NULL -+36 node1_committed_after NULL -+37 node1_committed_after NULL -+38 node1_committed_after NULL -+39 node1_committed_after NULL -+40 node1_committed_after NULL ++connection node_1; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; ++SET AUTOCOMMIT=ON; +SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result b/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result index 5a71b490a80..80a28d349ba 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result @@ -1,519 +1,287 @@ -connection node_2; -connection node_1; connection node_1; connection node_2; Performing State Transfer on a server that has been temporarily disconnected connection node_1; -CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (1,'node1_committed_before'); -INSERT INTO t1 VALUES (2,'node1_committed_before'); -INSERT INTO t1 VALUES (3,'node1_committed_before'); -INSERT INTO t1 VALUES (4,'node1_committed_before'); -INSERT INTO t1 VALUES (5,'node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (6,'node2_committed_before'); -INSERT INTO t1 VALUES (7,'node2_committed_before'); -INSERT INTO t1 VALUES (8,'node2_committed_before'); -INSERT INTO t1 VALUES (9,'node2_committed_before'); -INSERT INTO t1 VALUES (10,'node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (11,'node1_committed_during'); -INSERT INTO t1 VALUES (12,'node1_committed_during'); -INSERT INTO t1 VALUES (13,'node1_committed_during'); -INSERT INTO t1 VALUES (14,'node1_committed_during'); -INSERT INTO t1 VALUES (15,'node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); connection node_2; Loading wsrep provider ... -disconnect node_2; -connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2; -connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (26,'node2_committed_after'); -INSERT INTO t1 VALUES (27,'node2_committed_after'); -INSERT INTO t1 VALUES (28,'node2_committed_after'); -INSERT INTO t1 VALUES (29,'node2_committed_after'); -INSERT INTO t1 VALUES (30,'node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (36,'node1_committed_after'); -INSERT INTO t1 VALUES (37,'node1_committed_after'); -INSERT INTO t1 VALUES (38,'node1_committed_after'); -INSERT INTO t1 VALUES (39,'node1_committed_after'); -INSERT INTO t1 VALUES (40,'node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; connection node_1a_galera_st_disconnect_slave; -INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ROLLBACK; -SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 -connection node_1; +COMMIT; SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been shut down cleanly and restarted connection node_1; -CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (1,'node1_committed_before'); -INSERT INTO t1 VALUES (2,'node1_committed_before'); -INSERT INTO t1 VALUES (3,'node1_committed_before'); -INSERT INTO t1 VALUES (4,'node1_committed_before'); -INSERT INTO t1 VALUES (5,'node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (6,'node2_committed_before'); -INSERT INTO t1 VALUES (7,'node2_committed_before'); -INSERT INTO t1 VALUES (8,'node2_committed_before'); -INSERT INTO t1 VALUES (9,'node2_committed_before'); -INSERT INTO t1 VALUES (10,'node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Shutting down server ... connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (11,'node1_committed_during'); -INSERT INTO t1 VALUES (12,'node1_committed_during'); -INSERT INTO t1 VALUES (13,'node1_committed_during'); -INSERT INTO t1 VALUES (14,'node1_committed_during'); -INSERT INTO t1 VALUES (15,'node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); connection node_2; Starting server ... SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (26,'node2_committed_after'); -INSERT INTO t1 VALUES (27,'node2_committed_after'); -INSERT INTO t1 VALUES (28,'node2_committed_after'); -INSERT INTO t1 VALUES (29,'node2_committed_after'); -INSERT INTO t1 VALUES (30,'node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (36,'node1_committed_after'); -INSERT INTO t1 VALUES (37,'node1_committed_after'); -INSERT INTO t1 VALUES (38,'node1_committed_after'); -INSERT INTO t1 VALUES (39,'node1_committed_after'); -INSERT INTO t1 VALUES (40,'node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; connection node_1a_galera_st_shutdown_slave; -INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ROLLBACK; -SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_15 FROM t1; -EXPECT_15 -35 -SELECT * from t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 COMMIT; -connection node_1; SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_15 FROM t1; -EXPECT_15 -35 -SELECT * from t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been killed and restarted connection node_1; -CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (1,'node1_committed_before'); -INSERT INTO t1 VALUES (2,'node1_committed_before'); -INSERT INTO t1 VALUES (3,'node1_committed_before'); -INSERT INTO t1 VALUES (4,'node1_committed_before'); -INSERT INTO t1 VALUES (5,'node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (6,'node2_committed_before'); -INSERT INTO t1 VALUES (7,'node2_committed_before'); -INSERT INTO t1 VALUES (8,'node2_committed_before'); -INSERT INTO t1 VALUES (9,'node2_committed_before'); -INSERT INTO t1 VALUES (10,'node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Killing server ... connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (11,'node1_committed_during'); -INSERT INTO t1 VALUES (12,'node1_committed_during'); -INSERT INTO t1 VALUES (13,'node1_committed_during'); -INSERT INTO t1 VALUES (14,'node1_committed_during'); -INSERT INTO t1 VALUES (15,'node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); connection node_2; Performing --wsrep-recover ... Starting server ... Using --wsrep-start-position when starting mysqld ... SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (26,'node2_committed_after'); -INSERT INTO t1 VALUES (27,'node2_committed_after'); -INSERT INTO t1 VALUES (28,'node2_committed_after'); -INSERT INTO t1 VALUES (29,'node2_committed_after'); -INSERT INTO t1 VALUES (30,'node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (36,'node1_committed_after'); -INSERT INTO t1 VALUES (37,'node1_committed_after'); -INSERT INTO t1 VALUES (38,'node1_committed_after'); -INSERT INTO t1 VALUES (39,'node1_committed_after'); -INSERT INTO t1 VALUES (40,'node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; connection node_1a_galera_st_kill_slave; -INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ROLLBACK; -SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 COMMIT; -connection node_1; SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +SET AUTOCOMMIT=ON; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff index 51d2a6bf157..ce78050538d 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff @@ -1,27 +1,27 @@ --- r/galera_ist_MDEV-28583.result -+++ r/galera_ist_MDEV-28583,debug.reject -@@ -517,3 +517,187 @@ - 1 ++++ r/galera_ist_MDEV-28583.reject +@@ -285,3 +285,111 @@ DROP TABLE t1; COMMIT; + SET AUTOCOMMIT=ON; +Performing State Transfer on a server that has been killed and restarted +while a DDL was in progress on it +connection node_1; -+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 VALUES (1,'node1_committed_before'); -+INSERT INTO t1 VALUES (2,'node1_committed_before'); -+INSERT INTO t1 VALUES (3,'node1_committed_before'); -+INSERT INTO t1 VALUES (4,'node1_committed_before'); -+INSERT INTO t1 VALUES (5,'node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); +connection node_2; +START TRANSACTION; -+INSERT INTO t1 VALUES (6,'node2_committed_before'); -+INSERT INTO t1 VALUES (7,'node2_committed_before'); -+INSERT INTO t1 VALUES (8,'node2_committed_before'); -+INSERT INTO t1 VALUES (9,'node2_committed_before'); -+INSERT INTO t1 VALUES (10,'node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); +COMMIT; +SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; +connection node_1; @@ -32,26 +32,26 @@ +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); +COMMIT; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +connection node_2; @@ -59,132 +59,56 @@ +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); +COMMIT; +connection node_1; -+INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave_ddl; -+INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +ROLLBACK; -+SET AUTOCOMMIT=ON; -+SET SESSION wsrep_sync_wait=15; -+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -+EXPECT_3 -+3 -+SELECT COUNT(*) AS EXPECT_35 FROM t1; -+EXPECT_35 -+35 -+SELECT * FROM t1; -+id f1 f2 -+1 node1_committed_before NULL -+2 node1_committed_before NULL -+3 node1_committed_before NULL -+4 node1_committed_before NULL -+5 node1_committed_before NULL -+6 node2_committed_before NULL -+7 node2_committed_before NULL -+8 node2_committed_before NULL -+9 node2_committed_before NULL -+10 node2_committed_before NULL -+11 node1_committed_during NULL -+12 node1_committed_during NULL -+13 node1_committed_during NULL -+14 node1_committed_during NULL -+15 node1_committed_during NULL -+16 node1_to_be_committed_after NULL -+17 node1_to_be_committed_after NULL -+18 node1_to_be_committed_after NULL -+19 node1_to_be_committed_after NULL -+20 node1_to_be_committed_after NULL -+26 node2_committed_after NULL -+27 node2_committed_after NULL -+28 node2_committed_after NULL -+29 node2_committed_after NULL -+30 node2_committed_after NULL -+31 node1_to_be_committed_after NULL -+32 node1_to_be_committed_after NULL -+33 node1_to_be_committed_after NULL -+34 node1_to_be_committed_after NULL -+35 node1_to_be_committed_after NULL -+36 node1_committed_after NULL -+37 node1_committed_after NULL -+38 node1_committed_after NULL -+39 node1_committed_after NULL -+40 node1_committed_after NULL ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; -+connection node_1; +SET AUTOCOMMIT=ON; -+SET SESSION wsrep_sync_wait=15; -+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -+EXPECT_3 -+3 -+SELECT COUNT(*) AS EXPECT_35 FROM t1; -+EXPECT_35 -+35 -+SELECT * FROM t1; -+id f1 f2 -+1 node1_committed_before NULL -+2 node1_committed_before NULL -+3 node1_committed_before NULL -+4 node1_committed_before NULL -+5 node1_committed_before NULL -+6 node2_committed_before NULL -+7 node2_committed_before NULL -+8 node2_committed_before NULL -+9 node2_committed_before NULL -+10 node2_committed_before NULL -+11 node1_committed_during NULL -+12 node1_committed_during NULL -+13 node1_committed_during NULL -+14 node1_committed_during NULL -+15 node1_committed_during NULL -+16 node1_to_be_committed_after NULL -+17 node1_to_be_committed_after NULL -+18 node1_to_be_committed_after NULL -+19 node1_to_be_committed_after NULL -+20 node1_to_be_committed_after NULL -+26 node2_committed_after NULL -+27 node2_committed_after NULL -+28 node2_committed_after NULL -+29 node2_committed_after NULL -+30 node2_committed_after NULL -+31 node1_to_be_committed_after NULL -+32 node1_to_be_committed_after NULL -+33 node1_to_be_committed_after NULL -+34 node1_to_be_committed_after NULL -+35 node1_to_be_committed_after NULL -+36 node1_committed_after NULL -+37 node1_committed_after NULL -+38 node1_committed_after NULL -+39 node1_committed_after NULL -+40 node1_committed_after NULL ++connection node_1; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; ++SET AUTOCOMMIT=ON; +SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result b/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result index 5a71b490a80..80a28d349ba 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result @@ -1,519 +1,287 @@ -connection node_2; -connection node_1; connection node_1; connection node_2; Performing State Transfer on a server that has been temporarily disconnected connection node_1; -CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (1,'node1_committed_before'); -INSERT INTO t1 VALUES (2,'node1_committed_before'); -INSERT INTO t1 VALUES (3,'node1_committed_before'); -INSERT INTO t1 VALUES (4,'node1_committed_before'); -INSERT INTO t1 VALUES (5,'node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (6,'node2_committed_before'); -INSERT INTO t1 VALUES (7,'node2_committed_before'); -INSERT INTO t1 VALUES (8,'node2_committed_before'); -INSERT INTO t1 VALUES (9,'node2_committed_before'); -INSERT INTO t1 VALUES (10,'node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (11,'node1_committed_during'); -INSERT INTO t1 VALUES (12,'node1_committed_during'); -INSERT INTO t1 VALUES (13,'node1_committed_during'); -INSERT INTO t1 VALUES (14,'node1_committed_during'); -INSERT INTO t1 VALUES (15,'node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); connection node_2; Loading wsrep provider ... -disconnect node_2; -connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2; -connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (26,'node2_committed_after'); -INSERT INTO t1 VALUES (27,'node2_committed_after'); -INSERT INTO t1 VALUES (28,'node2_committed_after'); -INSERT INTO t1 VALUES (29,'node2_committed_after'); -INSERT INTO t1 VALUES (30,'node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (36,'node1_committed_after'); -INSERT INTO t1 VALUES (37,'node1_committed_after'); -INSERT INTO t1 VALUES (38,'node1_committed_after'); -INSERT INTO t1 VALUES (39,'node1_committed_after'); -INSERT INTO t1 VALUES (40,'node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; connection node_1a_galera_st_disconnect_slave; -INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ROLLBACK; -SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 -connection node_1; +COMMIT; SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been shut down cleanly and restarted connection node_1; -CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (1,'node1_committed_before'); -INSERT INTO t1 VALUES (2,'node1_committed_before'); -INSERT INTO t1 VALUES (3,'node1_committed_before'); -INSERT INTO t1 VALUES (4,'node1_committed_before'); -INSERT INTO t1 VALUES (5,'node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (6,'node2_committed_before'); -INSERT INTO t1 VALUES (7,'node2_committed_before'); -INSERT INTO t1 VALUES (8,'node2_committed_before'); -INSERT INTO t1 VALUES (9,'node2_committed_before'); -INSERT INTO t1 VALUES (10,'node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Shutting down server ... connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (11,'node1_committed_during'); -INSERT INTO t1 VALUES (12,'node1_committed_during'); -INSERT INTO t1 VALUES (13,'node1_committed_during'); -INSERT INTO t1 VALUES (14,'node1_committed_during'); -INSERT INTO t1 VALUES (15,'node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); connection node_2; Starting server ... SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (26,'node2_committed_after'); -INSERT INTO t1 VALUES (27,'node2_committed_after'); -INSERT INTO t1 VALUES (28,'node2_committed_after'); -INSERT INTO t1 VALUES (29,'node2_committed_after'); -INSERT INTO t1 VALUES (30,'node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (36,'node1_committed_after'); -INSERT INTO t1 VALUES (37,'node1_committed_after'); -INSERT INTO t1 VALUES (38,'node1_committed_after'); -INSERT INTO t1 VALUES (39,'node1_committed_after'); -INSERT INTO t1 VALUES (40,'node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; connection node_1a_galera_st_shutdown_slave; -INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ROLLBACK; -SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_15 FROM t1; -EXPECT_15 -35 -SELECT * from t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 COMMIT; -connection node_1; SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_15 FROM t1; -EXPECT_15 -35 -SELECT * from t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been killed and restarted connection node_1; -CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (1,'node1_committed_before'); -INSERT INTO t1 VALUES (2,'node1_committed_before'); -INSERT INTO t1 VALUES (3,'node1_committed_before'); -INSERT INTO t1 VALUES (4,'node1_committed_before'); -INSERT INTO t1 VALUES (5,'node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (6,'node2_committed_before'); -INSERT INTO t1 VALUES (7,'node2_committed_before'); -INSERT INTO t1 VALUES (8,'node2_committed_before'); -INSERT INTO t1 VALUES (9,'node2_committed_before'); -INSERT INTO t1 VALUES (10,'node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Killing server ... connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (11,'node1_committed_during'); -INSERT INTO t1 VALUES (12,'node1_committed_during'); -INSERT INTO t1 VALUES (13,'node1_committed_during'); -INSERT INTO t1 VALUES (14,'node1_committed_during'); -INSERT INTO t1 VALUES (15,'node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); connection node_2; Performing --wsrep-recover ... Starting server ... Using --wsrep-start-position when starting mysqld ... SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (26,'node2_committed_after'); -INSERT INTO t1 VALUES (27,'node2_committed_after'); -INSERT INTO t1 VALUES (28,'node2_committed_after'); -INSERT INTO t1 VALUES (29,'node2_committed_after'); -INSERT INTO t1 VALUES (30,'node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (36,'node1_committed_after'); -INSERT INTO t1 VALUES (37,'node1_committed_after'); -INSERT INTO t1 VALUES (38,'node1_committed_after'); -INSERT INTO t1 VALUES (39,'node1_committed_after'); -INSERT INTO t1 VALUES (40,'node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; connection node_1a_galera_st_kill_slave; -INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ROLLBACK; -SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 COMMIT; -connection node_1; SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +SET AUTOCOMMIT=ON; diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result index 48593d2a258..7276cb8dbde 100644 --- a/mysql-test/suite/galera/r/galera_sequences.result +++ b/mysql-test/suite/galera/r/galera_sequences.result @@ -44,6 +44,9 @@ Table Create Table Seq1_1 CREATE SEQUENCE `Seq1_1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB select NEXT VALUE FOR Seq1_1; NEXT VALUE FOR Seq1_1 -1 +3001 connection node_1; DROP SEQUENCE Seq1_1; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_2; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); diff --git a/mysql-test/suite/galera/t/MDEV-18832.test b/mysql-test/suite/galera/t/MDEV-18832.test index e2f1b2afd45..ba93761435a 100644 --- a/mysql-test/suite/galera/t/MDEV-18832.test +++ b/mysql-test/suite/galera/t/MDEV-18832.test @@ -13,3 +13,11 @@ CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1; INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); DROP SEQUENCE Seq1_1; DROP TABLE t1; + +# Supress warning for SEQUENCES that are declared without `NOCACHE` introduced with MDEV-27862 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +--connection node_2 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); diff --git a/mysql-test/suite/galera/t/MDEV-27862.combinations b/mysql-test/suite/galera/t/MDEV-27862.combinations new file mode 100644 index 00000000000..1eeb8fb4614 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-27862.combinations @@ -0,0 +1,4 @@ +[binlogoff] + +[binlogon] +log-bin diff --git a/mysql-test/suite/galera/t/MDEV-27862.test b/mysql-test/suite/galera/t/MDEV-27862.test new file mode 100644 index 00000000000..89d3465b91f --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-27862.test @@ -0,0 +1,67 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# Report WARNING when SEQUENCE is created without `NOCACHE` + +CREATE SEQUENCE seq_nocache ENGINE=InnoDB; +DROP SEQUENCE seq_nocache; + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +--connection node_2 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +# NEXTVAL + +--connection node_1 + +CREATE SEQUENCE seq NOCACHE ENGINE=InnoDB; + +SELECT NEXTVAL(seq) = 1; + +--connection node_2 + +SELECT NEXTVAL(seq) = 2; + +--connection node_1 + +SELECT NEXTVAL(seq) = 3; + + +# SETVAL + +SELECT SETVAL(seq, 100); + +--connection node_2 + +SELECT NEXTVAL(seq) = 101; + +--connection node_1 + +SELECT NEXTVAL(seq) = 102; + +DROP SEQUENCE seq; + +# TRANSACTIONS + +CREATE TABLE t1(f1 INT); +CREATE SEQUENCE seq_transaction NOCACHE ENGINE=InnoDB; + +START TRANSACTION; +INSERT INTO t1 VALUES (0); +SELECT NEXTVAL(seq_transaction); +INSERT INTO t1 VALUES (NEXTVAL(seq_transaction)); +COMMIT; + +--connection node_2 + +SELECT COUNT(*) = 2 FROM t1; +SELECT NEXTVAL(seq_transaction) = 3; + +--connection node_1 +SELECT NEXTVAL(seq_transaction) = 4; + +DROP SEQUENCE seq_transaction; +DROP TABLE t1; + diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test index 480366f6a6f..d469cc73516 100644 --- a/mysql-test/suite/galera/t/galera_sequences.test +++ b/mysql-test/suite/galera/t/galera_sequences.test @@ -44,3 +44,9 @@ select NEXT VALUE FOR Seq1_1; --connection node_1 DROP SEQUENCE Seq1_1; + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +--connection node_2 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); diff --git a/mysql-test/suite/innodb_fts/r/fulltext.result b/mysql-test/suite/innodb_fts/r/fulltext.result index ce72d797ac1..38df74f6939 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext.result +++ b/mysql-test/suite/innodb_fts/r/fulltext.result @@ -716,4 +716,18 @@ t1 CREATE TABLE `t1` ( FULLTEXT KEY `a_2` (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; +# +# MDEV-25257 SEGV in fts_get_next_doc_id upon some INSERT +# +SET @save = @@global.innodb_file_per_table; +SET @@global.innodb_file_per_table = 0; +CREATE TABLE t1 ( +col_int INTEGER, col_text TEXT, +col_int_g INTEGER GENERATED ALWAYS AS (col_int) +) ENGINE = InnoDB ROW_FORMAT = Redundant ; +ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ; +ALTER TABLE t1 DROP KEY `ftidx` ; +INSERT INTO t1 (col_int, col_text) VALUES ( 1255, NULL); +DROP TABLE t1; +SET @@global.innodb_file_per_table = @save; # End of 10.3 tests diff --git a/mysql-test/suite/innodb_fts/t/fulltext.test b/mysql-test/suite/innodb_fts/t/fulltext.test index 18baf56281f..4b73e2ea15b 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext.test +++ b/mysql-test/suite/innodb_fts/t/fulltext.test @@ -743,4 +743,20 @@ SHOW CREATE TABLE t1; DROP TABLE t1; --enable_warnings +--echo # +--echo # MDEV-25257 SEGV in fts_get_next_doc_id upon some INSERT +--echo # +SET @save = @@global.innodb_file_per_table; +SET @@global.innodb_file_per_table = 0; + +CREATE TABLE t1 ( + col_int INTEGER, col_text TEXT, + col_int_g INTEGER GENERATED ALWAYS AS (col_int) +) ENGINE = InnoDB ROW_FORMAT = Redundant ; +ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ; +ALTER TABLE t1 DROP KEY `ftidx` ; +INSERT INTO t1 (col_int, col_text) VALUES ( 1255, NULL); +DROP TABLE t1; +SET @@global.innodb_file_per_table = @save; + --echo # End of 10.3 tests diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index a3fc4b78718..a66a792b5ea 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -86,7 +86,6 @@ encrypt_threads="" encrypt_chunk="" readonly SECRET_TAG='secret' -readonly TOTAL_TAG='secret /total' # Required for backup locks # For backup locks it is 1 sent by joiner @@ -419,7 +418,7 @@ get_transfer() get_footprint() { - pushd "$WSREP_SST_OPT_DATA" 1>/dev/null + cd "$DATA_DIR" payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \ -type f -print0 | du --files0-from=- --block-size=1 -c -s | \ awk 'END { print $1 }') @@ -428,7 +427,7 @@ get_footprint() # When compression/compaction used, the progress is only an approximate. payload=$(( payload*1/2 )) fi - popd 1>/dev/null + cd "$OLD_PWD" pcmd="$pcmd -s $payload" adjust_progress } diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc index 2447242593c..b348e6e7025 100644 --- a/sql/ha_sequence.cc +++ b/sql/ha_sequence.cc @@ -452,6 +452,9 @@ static int sequence_initialize(void *p) HTON_HIDDEN | HTON_TEMPORARY_NOT_SUPPORTED | HTON_ALTER_NOT_SUPPORTED | +#ifdef WITH_WSREP + HTON_WSREP_REPLICATION | +#endif HTON_NO_PARTITION); DBUG_RETURN(0); } diff --git a/sql/log.cc b/sql/log.cc index 1b0122253c7..81fe4b1e97d 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2139,7 +2139,13 @@ int binlog_commit(THD *thd, bool all, bool ro_1pc) thd->backup_stage(&org_stage); THD_STAGE_INFO(thd, stage_binlog_write); +#ifdef WITH_WSREP + // DON'T clear stmt cache in case we are in transaction + if (!cache_mngr->stmt_cache.empty() && + (!wsrep_on(thd) || ending_trans(thd, all))) +#else if (!cache_mngr->stmt_cache.empty()) +#endif { error= binlog_commit_flush_stmt_cache(thd, all, cache_mngr); } @@ -11758,13 +11764,13 @@ maria_declare_plugin_end; #ifdef WITH_WSREP #include "wsrep_mysqld.h" -IO_CACHE *wsrep_get_trans_cache(THD * thd) +IO_CACHE *wsrep_get_cache(THD * thd, bool is_transactional) { DBUG_ASSERT(binlog_hton->slot != HA_SLOT_UNDEF); binlog_cache_mngr *cache_mngr = (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); if (cache_mngr) - return cache_mngr->get_binlog_cache_log(true); + return cache_mngr->get_binlog_cache_log(is_transactional); WSREP_DEBUG("binlog cache not initialized, conn: %llu", thd->thread_id); diff --git a/sql/log.h b/sql/log.h index 964b0dcfef7..516fb36adb9 100644 --- a/sql/log.h +++ b/sql/log.h @@ -1253,7 +1253,7 @@ static inline TC_LOG *get_tc_log_implementation() } #ifdef WITH_WSREP -IO_CACHE* wsrep_get_trans_cache(THD *); +IO_CACHE* wsrep_get_cache(THD *, bool); void wsrep_thd_binlog_trx_reset(THD * thd); void wsrep_thd_binlog_stmt_rollback(THD * thd); #endif /* WITH_WSREP */ diff --git a/sql/partition_info.cc b/sql/partition_info.cc index ba24d36ad17..d45c8592bfe 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -887,10 +887,12 @@ void partition_info::vers_check_limit(THD *thd) bitmap_set_all(), but this is not optimal since there can be quite a number of partitions. */ +#ifndef DBUG_OFF const uint32 sub_factor= num_subparts ? num_subparts : 1; uint32 part_id= vers_info->hist_part->id * sub_factor; const uint32 part_id_end= part_id + sub_factor; DBUG_ASSERT(part_id_end <= num_parts * sub_factor); +#endif ha_partition *hp= (ha_partition*)(table->file); ha_rows hist_rows= hp->part_records(vers_info->hist_part); diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc index 6ac5c64da7f..fc7b6460b2b 100644 --- a/sql/sql_partition_admin.cc +++ b/sql/sql_partition_admin.cc @@ -580,6 +580,14 @@ bool Sql_cmd_alter_table_exchange_partition:: part_table= table_list->table; swap_table= swap_table_list->table; + /* Don't allow to exchange with a VIEW */ + if (unlikely(swap_table_list->view)) + { + my_error(ER_WRONG_OBJECT, MYF(0), table_list->db.str, + swap_table_list->table_name.str, "BASE TABLE"); + DBUG_RETURN(TRUE); + } + if (unlikely(check_exchange_partition(swap_table, part_table))) DBUG_RETURN(TRUE); diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index 7ef30641888..07571c3bbac 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -309,6 +309,11 @@ bool sequence_insert(THD *thd, LEX *lex, TABLE_LIST *org_table_list) DBUG_RETURN(TRUE); } +#ifdef WITH_WSREP + if (WSREP_ON && seq->cache != 0) + WSREP_WARN("CREATE SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +#endif + /* If not temporary table */ if (!temporary_table) { @@ -901,12 +906,18 @@ bool Sql_cmd_alter_sequence::execute(THD *thd) No_such_table_error_handler no_such_table_handler; DBUG_ENTER("Sql_cmd_alter_sequence::execute"); + if (check_access(thd, ALTER_ACL, first_table->db.str, &first_table->grant.privilege, &first_table->grant.m_internal, 0, 0)) DBUG_RETURN(TRUE); /* purecov: inspected */ +#ifdef WITH_WSREP + if (WSREP_ON && new_seq->cache != 0) + WSREP_WARN("ALTER SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +#endif + if (check_grant(thd, ALTER_ACL, first_table, FALSE, 1, FALSE)) DBUG_RETURN(TRUE); /* purecov: inspected */ diff --git a/sql/table.h b/sql/table.h index 8d609fbf1bb..1c09f463d9e 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1,7 +1,7 @@ #ifndef TABLE_INCLUDED #define TABLE_INCLUDED /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB + Copyright (c) 2009, 2022, 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 @@ -3183,9 +3183,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, bool is_create_table, List<String> *partitions_to_open= NULL); bool copy_keys_from_share(TABLE *outparam, MEM_ROOT *root); -bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol); -bool fix_session_vcol_expr_for_read(THD *thd, Field *field, - Virtual_column_info *vcol); bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, bool *error_reported, vcol_init_mode expr); TABLE_SHARE *alloc_table_share(const char *db, const char *table_name, diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc index 3fe0792d83e..bcc5d2fe46d 100644 --- a/sql/wsrep_binlog.cc +++ b/sql/wsrep_binlog.cc @@ -155,10 +155,10 @@ static int wsrep_write_cache_inc(THD* const thd, goto cleanup; cache->read_pos= cache->read_end; } while ((cache->file >= 0) && (length= my_b_fill(cache))); - } - if (ret == 0) - { - assert(total_length + thd->wsrep_sr().log_position() == saved_pos); + if (ret == 0) + { + assert(total_length + thd->wsrep_sr().log_position() == saved_pos); + } } cleanup: diff --git a/sql/wsrep_client_service.cc b/sql/wsrep_client_service.cc index ab746dfa1fb..fee9fefdd44 100644 --- a/sql/wsrep_client_service.cc +++ b/sql/wsrep_client_service.cc @@ -83,18 +83,37 @@ int Wsrep_client_service::prepare_data_for_replication() DBUG_ASSERT(m_thd == current_thd); DBUG_ENTER("Wsrep_client_service::prepare_data_for_replication"); size_t data_len= 0; - IO_CACHE* cache= wsrep_get_trans_cache(m_thd); + IO_CACHE* transactional_cache= wsrep_get_cache(m_thd, true); + IO_CACHE* stmt_cache= wsrep_get_cache(m_thd, false); - if (cache) + if (transactional_cache || stmt_cache) { m_thd->binlog_flush_pending_rows_event(true); - if (wsrep_write_cache(m_thd, cache, &data_len)) + + size_t transactional_data_len= 0; + size_t stmt_data_len= 0; + + // Write transactional cache + if (transactional_cache && + wsrep_write_cache(m_thd, transactional_cache, &transactional_data_len)) { WSREP_ERROR("rbr write fail, data_len: %zu", data_len); // wsrep_override_error(m_thd, ER_ERROR_DURING_COMMIT); DBUG_RETURN(1); } + + // Write stmt cache + if (stmt_cache && wsrep_write_cache(m_thd, stmt_cache, &stmt_data_len)) + { + WSREP_ERROR("rbr write fail, data_len: %zu", + data_len); + // wsrep_override_error(m_thd, ER_ERROR_DURING_COMMIT); + DBUG_RETURN(1); + } + + // Complete data written from both caches + data_len = transactional_data_len + stmt_data_len; } if (data_len == 0) @@ -136,7 +155,7 @@ int Wsrep_client_service::prepare_fragment_for_replication( DBUG_ASSERT(m_thd == current_thd); THD* thd= m_thd; DBUG_ENTER("Wsrep_client_service::prepare_fragment_for_replication"); - IO_CACHE* cache= wsrep_get_trans_cache(thd); + IO_CACHE* cache= wsrep_get_cache(thd, true); thd->binlog_flush_pending_rows_event(true); if (!cache) @@ -218,7 +237,7 @@ bool Wsrep_client_service::statement_allowed_for_streaming() const size_t Wsrep_client_service::bytes_generated() const { - IO_CACHE* cache= wsrep_get_trans_cache(m_thd); + IO_CACHE* cache= wsrep_get_cache(m_thd, true); if (cache) { size_t pending_rows_event_length= 0; diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 69016906799..b3d6176f8b2 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -652,7 +652,7 @@ static std::string wsrep_server_incoming_address() bool is_ipv6= false; unsigned int my_bind_ip= INADDR_ANY; // default if not set - if (my_bind_addr_str && strlen(my_bind_addr_str) && + if (my_bind_addr_str && strlen(my_bind_addr_str) && strcmp(my_bind_addr_str, "*") != 0) { my_bind_ip= wsrep_check_ip(my_bind_addr_str, &is_ipv6); @@ -717,9 +717,13 @@ static std::string wsrep_server_incoming_address() snprintf(inc_addr, inc_addr_max, fmt, addr.get_address(), port); } - + done: - ret= wsrep_node_incoming_address; + if (!strlen(inc_addr)) + ret= wsrep_node_incoming_address; + else + ret= inc_addr; + WSREP_DEBUG("wsrep_incoming_address = %s", ret.c_str()); return ret; } diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index fb5d1b35bc2..464b94a7cbd 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -946,15 +946,6 @@ bool TDBMYSQL::OpenDB(PGLOBAL g) } // endif MakeInsert - if (m_Rc != RC_FX) { - char cmd[64]; - int w; - - sprintf(cmd, "ALTER TABLE `%s` DISABLE KEYS", TableName); - - m_Rc = Myc.ExecSQL(g, cmd, &w); // may fail for some engines - } // endif m_Rc - } else // m_Rc = (Mode == MODE_DELETE) ? MakeDelete(g) : MakeUpdate(g); m_Rc = (MakeCommand(g)) ? RC_FX : RC_OK; @@ -1216,16 +1207,6 @@ int TDBMYSQL::DeleteDB(PGLOBAL g, int irc) void TDBMYSQL::CloseDB(PGLOBAL g) { if (Myc.Connected()) { - if (Mode == MODE_INSERT) { - char cmd[64]; - int w; - PDBUSER dup = PlgGetUser(g); - - dup->Step = "Enabling indexes"; - sprintf(cmd, "ALTER TABLE `%s` ENABLE KEYS", TableName); - Myc.m_Rows = -1; // To execute the query - m_Rc = Myc.ExecSQL(g, cmd, &w); // May fail for some engines - } // endif m_Rc Myc.Close(); } // endif Myc diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc index 263a2f92003..c05f91e7e5e 100644 --- a/storage/innobase/btr/btr0bulk.cc +++ b/storage/innobase/btr/btr0bulk.cc @@ -820,14 +820,6 @@ PageBulk::storeExt( dberr_t err = btr_store_big_rec_extern_fields( &btr_pcur, offsets, big_rec, &m_mtr, BTR_STORE_INSERT_BULK); - /* Reset m_block and m_cur_rec from page cursor, because - block may be changed during blob insert. (FIXME: Can it really?) */ - ut_ad(m_block == btr_pcur.btr_cur.page_cur.block); - - m_block = btr_pcur.btr_cur.page_cur.block; - m_cur_rec = btr_pcur.btr_cur.page_cur.rec; - m_page = buf_block_get_frame(m_block); - return(err); } diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index c55fc560de0..2f033d1736b 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -6862,9 +6862,7 @@ the file, in case the file was somehow truncated in the crash. dberr_t btr_store_big_rec_extern_fields( /*============================*/ - btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if - btr_mtr is restarted, then this can - be repositioned. */ + btr_pcur_t* pcur, /*!< in: a persistent cursor */ rec_offs* offsets, /*!< in/out: rec_get_offsets() on pcur. the "external storage" flags in offsets will correctly correspond diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index 20916c2c96e..2c3d48b9573 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -1383,6 +1383,7 @@ dict_load_columns( the flag is set before the table is created. */ if (table->fts == NULL) { table->fts = fts_create(table); + table->fts->cache = fts_cache_create(table); } ut_a(table->fts->doc_col == ULINT_UNDEFINED); diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index f16b66256dd..cd0c98d6fe2 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1871,8 +1871,7 @@ fil_crypt_rotate_page( /* If block read failed mtr memo and log should be empty. */ ut_ad(!mtr.has_modifications()); ut_ad(!mtr.is_dirty()); - ut_ad(mtr.get_memo()->size() == 0); - ut_ad(mtr.get_log()->size() == 0); + ut_ad(mtr.is_empty()); mtr.commit(); } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 4c9bd056d4e..fa35f219d2c 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -3186,7 +3186,7 @@ fil_names_clear( for (auto it = fil_system.named_spaces.begin(); it != fil_system.named_spaces.end(); ) { - if (mtr.get_log()->size() + if (mtr.get_log_size() + strlen(it->chain.start->name) >= RECV_SCAN_SIZE - (3 + 5 + 1)) { /* Prevent log parse buffer overflow */ diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 6bcc71702d3..49fa5df6390 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -596,9 +596,7 @@ file segment of the index tree. dberr_t btr_store_big_rec_extern_fields( /*============================*/ - btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if - btr_mtr is restarted, then this can - be repositioned. */ + btr_pcur_t* pcur, /*!< in: a persistent cursor */ rec_offs* offsets, /*!< in/out: rec_get_offsets() on pcur. the "external storage" flags in offsets will correctly correspond @@ -609,7 +607,7 @@ btr_store_big_rec_extern_fields( latches to the clustered index. can be committed and restarted. */ enum blob_op op) /*! in: operation code */ - MY_ATTRIBUTE((warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Frees the space in an externally stored field to the file space diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 9d0f48a36b7..1fb5b7707e9 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -54,13 +54,6 @@ savepoint. */ #define mtr_memo_release(m, o, t) \ (m)->memo_release((o), (t)) -/** Print info of an mtr handle. */ -#define mtr_print(m) (m)->print() - -/** Return the log object of a mini-transaction buffer. -@return log */ -#define mtr_get_log(m) (m)->get_log() - /** Push an object to an mtr memo stack. */ #define mtr_memo_push(m, o, t) (m)->memo_push(o, t) @@ -360,30 +353,13 @@ public: const byte* ptr, ulint flags) const; - /** Print info of an mtr handle. */ - void print() const; - /** @return true if mini-transaction contains modifications. */ bool has_modifications() const { return m_modifications; } - - /** @return the memo stack */ - const mtr_buf_t* get_memo() const { return &m_memo; } - - /** @return the memo stack */ - mtr_buf_t* get_memo() { return &m_memo; } #endif /* UNIV_DEBUG */ /** @return true if a record was added to the mini-transaction */ bool is_dirty() const { return m_made_dirty; } - /** Get the buffered redo log of this mini-transaction. - @return redo log */ - const mtr_buf_t* get_log() const { return &m_log; } - - /** Get the buffered redo log of this mini-transaction. - @return redo log */ - mtr_buf_t* get_log() { return &m_log; } - /** Push an object to an mtr memo stack. @param object object @param type object type: MTR_MEMO_S_LOCK, ... */ @@ -395,6 +371,11 @@ public: static inline bool is_block_dirtied(const buf_block_t* block) MY_ATTRIBUTE((warn_unused_result)); + /** @return the size of the log is empty */ + size_t get_log_size() const { return m_log.size(); } + /** @return whether the log and memo are empty */ + bool is_empty() const { return m_memo.size() == 0 && m_log.size() == 0; } + /** Write request types */ enum write_type { diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index 74d7a9a3376..7260b74723f 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -359,22 +359,10 @@ struct DebugCheck { struct ReleaseBlocks { const lsn_t start, end; -#ifdef UNIV_DEBUG - const mtr_buf_t &memo; - - ReleaseBlocks(lsn_t start, lsn_t end, const mtr_buf_t &memo) : - start(start), end(end), memo(memo) -#else /* UNIV_DEBUG */ - ReleaseBlocks(lsn_t start, lsn_t end, const mtr_buf_t&) : - start(start), end(end) -#endif /* UNIV_DEBUG */ - { - ut_ad(start); - ut_ad(end); - } + ReleaseBlocks(lsn_t start, lsn_t end) : start(start), end(end) {} /** @return true always */ - bool operator()(mtr_memo_slot_t* slot) const + bool operator()(mtr_memo_slot_t *slot) const { if (!slot->object) return true; @@ -492,9 +480,8 @@ void mtr_t::commit() else ut_ad(!m_freed_space); - m_memo.for_each_block_in_reverse(CIterate<const ReleaseBlocks> - (ReleaseBlocks(lsns.first, m_commit_lsn, - m_memo))); + m_memo.for_each_block_in_reverse + (CIterate<const ReleaseBlocks>(ReleaseBlocks(lsns.first, m_commit_lsn))); if (m_made_dirty) mysql_mutex_unlock(&log_sys.flush_order_mutex); @@ -622,8 +609,7 @@ void mtr_t::commit_shrink(fil_space_t &space) m_memo.for_each_block_in_reverse(CIterate<Shrink>{space}); m_memo.for_each_block_in_reverse(CIterate<const ReleaseBlocks> - (ReleaseBlocks(start_lsn, m_commit_lsn, - m_memo))); + (ReleaseBlocks(start_lsn, m_commit_lsn))); mysql_mutex_unlock(&log_sys.flush_order_mutex); mysql_mutex_lock(&fil_system.mutex); @@ -1394,16 +1380,6 @@ mtr_t::memo_contains_page_flagged( return m_memo.for_each_block_in_reverse(iteration) ? NULL : iteration.functor.get_block(); } - -/** Print info of an mtr handle. */ -void -mtr_t::print() const -{ - ib::info() << "Mini-transaction handle: memo size " - << m_memo.size() << " bytes log size " - << get_log()->size() << " bytes"; -} - #endif /* UNIV_DEBUG */ @@ -1443,4 +1419,6 @@ void mtr_t::modify(const buf_block_t &block) } iteration.functor.found->type= static_cast<mtr_memo_type_t> (iteration.functor.found->type | MTR_MEMO_MODIFY); + if (is_block_dirtied(&block)) + m_made_dirty= true; } diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index d8160473bf5..ff174bf69b9 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -851,6 +851,7 @@ os_file_get_last_error_low( case EXDEV: case ENOTDIR: case EISDIR: + case EPERM: return(OS_FILE_PATH_ERROR); case EAGAIN: if (srv_use_native_aio) { diff --git a/storage/maria/ha_s3.cc b/storage/maria/ha_s3.cc index 0fd5811e2b6..c00f42d74c1 100644 --- a/storage/maria/ha_s3.cc +++ b/storage/maria/ha_s3.cc @@ -640,6 +640,7 @@ int ha_s3::open(const char *name, int mode, uint open_flags) file->dfile.big_block_size= file->s->kfile.big_block_size= file->s->bitmap.file.big_block_size= file->s->base.s3_block_size; file->s->kfile.head_blocks= file->s->base.keystart / file->s->block_size; + file->s->no_status_updates= in_alter_table == S3_NO_ALTER; } } open_args= 0; diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 8cc2a1829a9..f66b6ae6186 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -6351,6 +6351,9 @@ int maria_update_state_info(HA_CHECK *param, MARIA_HA *info,uint update) MARIA_SHARE *share= info->s; DBUG_ENTER("maria_update_state_info"); + if (info->s->no_status_updates) + DBUG_RETURN(0); /* S3 readonly table */ + if (update & UPDATE_OPEN_COUNT) { share->state.open_count=0; diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index 9f18cea1d75..bac820f3501 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -1461,6 +1461,7 @@ int _ma_update_state_lsns_sub(MARIA_SHARE *share, LSN lsn, TrID create_trid, File file= share->kfile.file; DBUG_ENTER("_ma_update_state_lsns_sub"); DBUG_ASSERT(file >= 0); + CRASH_IF_S3_TABLE(share); if (lsn == LSN_IMPOSSIBLE) { diff --git a/storage/maria/ma_locking.c b/storage/maria/ma_locking.c index d8f815b2a50..d5985a68c13 100644 --- a/storage/maria/ma_locking.c +++ b/storage/maria/ma_locking.c @@ -303,6 +303,8 @@ int _ma_writeinfo(register MARIA_HA *info, uint operation) /* transactional tables flush their state at Checkpoint */ if (operation) { /* Two threads can't be here */ + CRASH_IF_S3_TABLE(info->s); /* S3 readonly doesn't come here */ + olderror= my_errno; /* Remember last error */ #ifdef MARIA_EXTERNAL_LOCKING @@ -446,6 +448,7 @@ int _ma_mark_file_changed_now(register MARIA_SHARE *share) */ if (!share->temporary) { + CRASH_IF_S3_TABLE(share); mi_int2store(buff,share->state.open_count); buff[2]=1; /* Mark that it's changed */ if (my_pwrite(share->kfile.file, buff, sizeof(buff), @@ -458,6 +461,7 @@ int _ma_mark_file_changed_now(register MARIA_SHARE *share) if (share->base.born_transactional && !(share->state.org_changed & STATE_NOT_MOVABLE)) { + CRASH_IF_S3_TABLE(share); /* Lock table to current installation */ if (_ma_set_uuid(share, 0) || (share->state.create_rename_lsn == LSN_NEEDS_NEW_STATE_LSNS && @@ -518,6 +522,7 @@ int _ma_decrement_open_count(MARIA_HA *info, my_bool lock_tables) /* Its not fatal even if we couldn't get the lock ! */ if (share->state.open_count > 0) { + CRASH_IF_S3_TABLE(share); share->state.open_count--; share->changed= 1; /* We have to update state */ /* @@ -548,9 +553,15 @@ void _ma_mark_file_crashed(MARIA_SHARE *share) { uchar buff[2]; DBUG_ENTER("_ma_mark_file_crashed"); + CRASH_IF_S3_TABLE(share); share->state.changed|= STATE_CRASHED; + if (share->no_status_updates) + DBUG_VOID_RETURN; /* Safety */ + mi_int2store(buff, share->state.changed); + + /* We can ignore the errors, as if the mark failed, there isn't anything else we can do; The user should already have got an error that the @@ -606,6 +617,7 @@ my_bool _ma_set_uuid(MARIA_SHARE *share, my_bool reset_uuid) bzero(buff, sizeof(buff)); uuid= buff; } + CRASH_IF_S3_TABLE(share); return (my_bool) my_pwrite(share->kfile.file, uuid, MY_UUID_SIZE, mi_uint2korr(share->state.header.base_pos), MYF(MY_NABP)); diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index d2921ddf34a..86e7fa93eaa 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -7996,22 +7996,14 @@ void translog_flush_buffers(TRANSLOG_ADDRESS *lsn, } else { - if (log_descriptor.bc.buffer->last_lsn == LSN_IMPOSSIBLE) + if (log_descriptor.bc.buffer->last_lsn == LSN_IMPOSSIBLE && + log_descriptor.bc.buffer->prev_last_lsn == LSN_IMPOSSIBLE) { - /* - In this case both last_lsn & prev_last_lsn are LSN_IMPOSSIBLE - otherwise it will go in the first IF because LSN_IMPOSSIBLE less - then any real LSN and cmp_translog_addr(*lsn, - log_descriptor.bc.buffer->prev_last_lsn) will be TRUE - */ - DBUG_ASSERT(log_descriptor.bc.buffer->prev_last_lsn == - LSN_IMPOSSIBLE); DBUG_PRINT("info", ("There is no LSNs yet generated => do nothing")); translog_unlock(); DBUG_VOID_RETURN; } - DBUG_ASSERT(log_descriptor.bc.buffer->prev_last_lsn != LSN_IMPOSSIBLE); /* fix lsn if it was horizon */ *lsn= log_descriptor.bc.buffer->prev_last_lsn; DBUG_PRINT("info", ("LSN to flush fixed to prev last lsn: " LSN_FMT, diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index cab3fc35ded..6efc8173915 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -2824,8 +2824,14 @@ static void read_big_block(PAGECACHE *pagecache, have read our block for us */ struct st_my_thread_var *thread; - DBUG_ASSERT(page_st == PAGE_WAIT_TO_BE_READ); - DBUG_ASSERT(page_st != PAGE_TO_BE_READ); + /* + Either the page was not yet read and there is another thread + doing the read (page_st == PAGE_WAIT_TO_BE_READ) or the page + was just read and there are other threads waiting for the page + but they have not yet unmarked the PCLBOCK_BIG_READ flag + (page_st == PAGE_READ) + */ + DBUG_ASSERT(page_st == PAGE_READ || page_st == PAGE_WAIT_TO_BE_READ); block->status|= PCBLOCK_BIG_READ; // will be read by other thread /* Block read failed because somebody else is reading the first block @@ -2844,12 +2850,12 @@ static void read_big_block(PAGECACHE *pagecache, &pagecache->cache_lock); } while (thread->next); - // page should be read by other thread + // page should be read by other thread DBUG_ASSERT(block->status & PCBLOCK_READ || block->status & PCBLOCK_ERROR); /* It is possible that other thread already removed the flag (in - case of two threads waiting) but it will not make harm to try to + case of two threads waiting) but it will not harm to try to remove it even in that case. */ block->status&= ~PCBLOCK_BIG_READ; @@ -2883,6 +2889,7 @@ static void read_big_block(PAGECACHE *pagecache, args.pageno= page_to_read; args.data= block->hash_link->file.callback_data; + pagecache->global_cache_read++; if (pagecache->big_block_read(pagecache, &args, &block->hash_link->file, &data)) { diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 1ad13ca042b..722ab150160 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -787,6 +787,7 @@ typedef struct st_maria_share my_bool changed, /* If changed since lock */ global_changed, /* If changed since open */ not_flushed; + my_bool no_status_updates; /* Set to 1 if S3 readonly table */ my_bool internal_table; /* Internal tmp table */ my_bool lock_key_trees; /* If we have to lock trees on read */ my_bool non_transactional_concurrent_insert; @@ -1769,3 +1770,5 @@ static inline void decrement_share_in_trans(MARIA_SHARE *share) } C_MODE_END #endif + +#define CRASH_IF_S3_TABLE(share) DBUG_ASSERT(!share->no_status_updates) |