diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-20 12:52:44 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-20 12:52:44 +0300 |
commit | d5d8756de3fa640b69793068937c0293587b16ee (patch) | |
tree | 6fa32a78ae8bed380cee057f1f098633fde47df5 | |
parent | b205e478a3ba7dfce69bba9e6187d412823b4949 (diff) | |
parent | 2fa9f8c53a80e8b52c14d8c3260b18e7e77cc154 (diff) | |
download | mariadb-git-d5d8756de3fa640b69793068937c0293587b16ee.tar.gz |
Merge 10.4 into 10.5
46 files changed, 519 insertions, 224 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 79ca4ed60e7..bc174226281 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -9088,10 +9088,6 @@ static void init_signal_handling(void) struct sigaction sa; DBUG_ENTER("init_signal_handling"); -#ifdef HAVE_STACKTRACE - my_init_stacktrace(0); -#endif - sa.sa_flags = SA_RESETHAND | SA_NODEFER; sigemptyset(&sa.sa_mask); sigprocmask(SIG_SETMASK, &sa.sa_mask, NULL); diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h index 63e97dbc4f2..27dcd9ff130 100644 --- a/include/my_stacktrace.h +++ b/include/my_stacktrace.h @@ -1,5 +1,6 @@ /* Copyright (c) 2001, 2011, Oracle and/or its affiliates. + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +42,7 @@ C_MODE_START #if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE) -void my_init_stacktrace(int setup_handlers); +void my_setup_stacktrace(void); void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack, my_bool silent); int my_safe_print_str(const char* val, size_t max_len); @@ -53,7 +54,7 @@ char *my_demangle(const char *mangled_name, int *status); void my_set_exception_pointers(EXCEPTION_POINTERS *ep); #endif /* __WIN__ */ #else -#define my_init_stacktrace(A) do { } while(0) +#define my_setup_stacktrace() #endif /* ! (defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)) */ #ifndef _WIN32 diff --git a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result index 9de067b0e3f..a7426327ecf 100644 --- a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result +++ b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result @@ -15,6 +15,7 @@ TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition_type; +START TRANSACTION; INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); SET @time_zone_id= LAST_INSERT_ID(); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); @@ -32,6 +33,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it. Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. +COMMIT; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; \d | @@ -57,6 +59,7 @@ TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition_type; +START TRANSACTION; INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); SET @time_zone_id= LAST_INSERT_ID(); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); @@ -71,6 +74,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, (@time_zone_id, 0, 0, 0, 'GMT') ; Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. +COMMIT; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; \d | @@ -160,6 +164,8 @@ TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition_type; +START TRANSACTION; +COMMIT; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; \d | diff --git a/mysql-test/suite/galera_3nodes/r/GCF-354.result b/mysql-test/suite/galera_3nodes/r/GCF-354.result index b7ab3014ff5..dad57fe15ec 100644 --- a/mysql-test/suite/galera_3nodes/r/GCF-354.result +++ b/mysql-test/suite/galera_3nodes/r/GCF-354.result @@ -5,6 +5,9 @@ SET wsrep_on=OFF; DROP SCHEMA test; connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_3; +connection node_1; +connection node_2; +connection node_3; SET wsrep_on=OFF; CREATE TABLE test.t1 (f1 INTEGER); connection node_1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result index 0461f1f1feb..a60e2bbb6cc 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result +++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result @@ -1,40 +1,81 @@ +connection node_2; +connection node_1; +connection node_1; CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; INSERT INTO t1 VALUES (1, 1); +connection node_2; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; INSERT INTO t1 VALUES (2, 3); +connection node_2; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET wsrep_sync_wait = 0; SET wsrep_on = OFF; SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining'; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; INSERT INTO t1 VALUES (3, 2); +connection node_1a; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; +connection node_3; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; INSERT INTO t1 VALUES (4, 3); +connection node_2; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; INSERT INTO t1 VALUES (5, 2); +connection node_3; +connection node_1a; SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request'; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; INSERT INTO t1 VALUES (6, 3); +connection node_2; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; INSERT INTO t1 VALUES (7, 2); +connection node_3; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; INSERT INTO t1 VALUES (8, 3); +connection node_2; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +connection node_1a; SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request'; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; +connection node_2; INSERT INTO t1 VALUES (9, 2); +connection node_3; +connection node_1a; SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_1; DROP TABLE t1; call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); +connection node_2; call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); +connection node_3; call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result index d878f60ca6b..7e75bc4b08a 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result +++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result @@ -1,18 +1,39 @@ +connection node_2; +connection node_1; +connection node_1; CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; INSERT INTO t1 VALUES (1, 1); +connection node_2; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; INSERT INTO t1 VALUES (2, 3); +connection node_2; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET wsrep_sync_wait = 0; SET wsrep_on = OFF; SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining'; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; INSERT INTO t1 VALUES (3, 2); +connection node_1a; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; +connection node_3; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; INSERT INTO t1 VALUES (4, 3); +connection node_2; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; INSERT INTO t1 VALUES (5, 2); +connection node_3; +connection node_1a; SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request'; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; SET SESSION wsrep_on = 0; @@ -24,18 +45,35 @@ SET SESSION wsrep_on = 0; SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'; VARIABLE_NAME VARIABLE_VALUE WSREP_DEBUG_SYNC_WAITERS after_shift_to_joining +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; INSERT INTO t1 VALUES (6, 3); +connection node_2; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; INSERT INTO t1 VALUES (7, 2); +connection node_3; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; INSERT INTO t1 VALUES (8, 3); +connection node_2; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +connection node_1a; SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; +connection node_2; INSERT INTO t1 VALUES (9, 2); +connection node_3; +connection node_1a; SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; @@ -44,7 +82,10 @@ VARIABLE_NAME VARIABLE_VALUE WSREP_DEBUG_SYNC_WAITERS process_primary_configuration SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_1; DROP TABLE t1; call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); +connection node_2; call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); +connection node_3; call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result index df0a924029c..ea10edfc62c 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result +++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result @@ -1,44 +1,85 @@ +connection node_2; +connection node_1; +connection node_1; CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; INSERT INTO t1 VALUES (1, 1); +connection node_2; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; INSERT INTO t1 VALUES (2, 3); +connection node_2; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET wsrep_sync_wait = 0; SET wsrep_on = OFF; SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining'; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; INSERT INTO t1 VALUES (3, 2); +connection node_1a; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; +connection node_3; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; INSERT INTO t1 VALUES (4, 3); +connection node_2; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; INSERT INTO t1 VALUES (5, 2); +connection node_3; +connection node_1a; SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request'; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; +connection node_1a; SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining'; SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request'; 4 SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'; VARIABLE_NAME VARIABLE_VALUE WSREP_DEBUG_SYNC_WAITERS +connection node_3; INSERT INTO t1 VALUES (6, 3); +connection node_2; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; INSERT INTO t1 VALUES (7, 2); +connection node_3; +connection node_1a; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; SET GLOBAL wsrep_provider_options = 'dbug='; SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connection node_3; INSERT INTO t1 VALUES (8, 3); +connection node_2; +connection node_1; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +connection node_1a; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; +connection node_2; INSERT INTO t1 VALUES (9, 2); +connection node_3; +connection node_1a; SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; @@ -48,8 +89,11 @@ SET SESSION wsrep_on = 0; SET SESSION wsrep_on = 0; SET GLOBAL wsrep_provider_options = 'dbug='; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; +connection node_1; DROP TABLE t1; call mtr.add_suppression("WSREP: Send action {\(.*\), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)"); call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); +connection node_2; call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); +connection node_3; call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required."); diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result index 00563d397f3..854b53b3083 100644 --- a/mysql-test/suite/innodb/r/foreign_key.result +++ b/mysql-test/suite/innodb/r/foreign_key.result @@ -655,6 +655,7 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; # MDEV-17187 table doesn't exist in engine after ALTER other tables # with CONSTRAINTs # +call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`\\.`t2` has or is referenced in foreign key constraints which are not compatible with the new table definition."); set foreign_key_checks=on; create table t1 (id int not null primary key) engine=innodb; create table t2 (id int not null primary key, fid int not null, @@ -710,6 +711,32 @@ drop table t1,t2; ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails drop table t1,t2; ERROR 42S02: Unknown table 'test.t2' +# +# MDEV-22934 Table disappear after two alter table command +# +CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT, +f2 INT NOT NULL, +PRIMARY KEY (f1), INDEX (f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, +f2 INT NOT NULL, f3 INT NOT NULL, +PRIMARY KEY(f1, f2), UNIQUE KEY(f2), +CONSTRAINT `t2_ibfk_1` FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE CASCADE, +CONSTRAINT `t2_ibfk_2` FOREIGN KEY (f1) REFERENCES t1(f1) ON DELETE CASCADE +) ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE t2 DROP PRIMARY KEY, ADD PRIMARY KEY(f3), ALGORITHM=INPLACE; +ALTER TABLE t2 DROP INDEX `f2`, ALGORITHM=COPY; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + `f3` int(11) NOT NULL, + PRIMARY KEY (`f3`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CREATE TABLE t2 (f1 INT NOT NULL)ENGINE=InnoDB; +ERROR 42S01: Table 't2' already exists +DROP TABLE t2, t1; # End of 10.2 tests CREATE TABLE t1 (a GEOMETRY, INDEX(a(8)), FOREIGN KEY (a) REFERENCES x (xx)) ENGINE=InnoDB; @@ -761,11 +788,12 @@ set default_storage_engine= default; # # MDEV-21690 LeakSanitizer: detected memory leaks in mem_heap_create_block_func # +SET FOREIGN_KEY_CHECKS=1; CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB; ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (b); ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") +SET FOREIGN_KEY_CHECKS=DEFAULT; DROP TABLE t1; -# End of 10.5 tests # # MDEV-22602 Disable UPDATE CASCADE for SQL constraints # @@ -784,3 +812,4 @@ create or replace table t1 (a varchar(4096) unique) engine=innodb; create or replace table t2 (pk int primary key, a varchar(4096) unique, foreign key(a) references t1(a) on update cascade) engine=innodb; ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") drop table t1; +# End of 10.5 tests diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index 1cd62911e81..2313c415496 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -2544,7 +2544,6 @@ set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb; create table t1(a varchar(10) primary key) engine = innodb; alter table t1 modify column a int; -Got one of the listed errors set foreign_key_checks=1; drop table t2,t1; set foreign_key_checks=0; @@ -2553,6 +2552,7 @@ create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin alter table t1 convert to character set utf8; set foreign_key_checks=1; drop table t2,t1; +call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`.`t1` has or is referenced in foreign key constraints which are not compatible with the new table definition."); set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result index d5acc872b49..1dfc709a775 100644 --- a/mysql-test/suite/innodb/r/instant_alter_bugs.result +++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result @@ -410,4 +410,10 @@ CREATE TABLE t (i INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t SET i=1; ALTER TABLE t ADD e CHAR(255) CHARACTER SET UTF32 FIRST, ALGORITHM=INSTANT; DROP TABLE t; +# +# MDEV-23499 Assertion c.same_type(*o) failed +# +CREATE TABLE t (pk SERIAL, b TEXT CHARACTER SET utf8) ENGINE=InnoDB; +ALTER TABLE t MODIFY b TEXT CHARACTER SET utf8mb4 FIRST; +DROP TABLE t; SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test index 4719384cd65..c595cf92690 100644 --- a/mysql-test/suite/innodb/t/foreign_key.test +++ b/mysql-test/suite/innodb/t/foreign_key.test @@ -657,6 +657,8 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; --echo # with CONSTRAINTs --echo # +call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`\\.`t2` has or is referenced in foreign key constraints which are not compatible with the new table definition."); + set foreign_key_checks=on; create table t1 (id int not null primary key) engine=innodb; create table t2 (id int not null primary key, fid int not null, @@ -698,6 +700,27 @@ drop table t1,t2; --error ER_BAD_TABLE_ERROR drop table t1,t2; +--echo # +--echo # MDEV-22934 Table disappear after two alter table command +--echo # +CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT, + f2 INT NOT NULL, + PRIMARY KEY (f1), INDEX (f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, + f2 INT NOT NULL, f3 INT NOT NULL, + PRIMARY KEY(f1, f2), UNIQUE KEY(f2), +CONSTRAINT `t2_ibfk_1` FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE CASCADE, +CONSTRAINT `t2_ibfk_2` FOREIGN KEY (f1) REFERENCES t1(f1) ON DELETE CASCADE +) ENGINE=InnoDB; + +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE t2 DROP PRIMARY KEY, ADD PRIMARY KEY(f3), ALGORITHM=INPLACE; +ALTER TABLE t2 DROP INDEX `f2`, ALGORITHM=COPY; +SHOW CREATE TABLE t2; +--error ER_TABLE_EXISTS_ERROR +CREATE TABLE t2 (f1 INT NOT NULL)ENGINE=InnoDB; +DROP TABLE t2, t1; + --echo # End of 10.2 tests # MDEV-21792 Server aborts upon attempt to create foreign key on spatial field @@ -732,15 +755,15 @@ set default_storage_engine= default; --echo # --echo # MDEV-21690 LeakSanitizer: detected memory leaks in mem_heap_create_block_func --echo # +SET FOREIGN_KEY_CHECKS=1; CREATE TABLE t1 (a TEXT, b TEXT) ENGINE=InnoDB; --error ER_CANT_CREATE_TABLE ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (b); +SET FOREIGN_KEY_CHECKS=DEFAULT; # Cleanup DROP TABLE t1; ---echo # End of 10.5 tests - --echo # --echo # MDEV-22602 Disable UPDATE CASCADE for SQL constraints --echo # @@ -764,4 +787,6 @@ create or replace table t2 (pk int primary key, a varchar(4096) unique, foreign drop table t1; +--echo # End of 10.5 tests + --source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index dfb4da3a63d..5a718265624 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -1622,7 +1622,6 @@ drop table t1; set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb; create table t1(a varchar(10) primary key) engine = innodb; --- error 1025,1025 alter table t1 modify column a int; set foreign_key_checks=1; drop table t2,t1; @@ -1638,6 +1637,7 @@ drop table t2,t1; # test that RENAME does not allow invalid charsets when f_k_c is 0 +call mtr.add_suppression("\\[Warning\\] InnoDB: In ALTER TABLE `test`.`t1` has or is referenced in foreign key constraints which are not compatible with the new table definition."); set foreign_key_checks=0; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test index 3dd0bedbbb6..4548e978f86 100644 --- a/mysql-test/suite/innodb/t/instant_alter_bugs.test +++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test @@ -430,4 +430,11 @@ INSERT INTO t SET i=1; ALTER TABLE t ADD e CHAR(255) CHARACTER SET UTF32 FIRST, ALGORITHM=INSTANT; DROP TABLE t; +--echo # +--echo # MDEV-23499 Assertion c.same_type(*o) failed +--echo # +CREATE TABLE t (pk SERIAL, b TEXT CHARACTER SET utf8) ENGINE=InnoDB; +ALTER TABLE t MODIFY b TEXT CHARACTER SET utf8mb4 FIRST; +DROP TABLE t; + SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency; diff --git a/mysql-test/suite/wsrep/r/MDEV-22443.result b/mysql-test/suite/wsrep/r/MDEV-22443.result new file mode 100644 index 00000000000..ea07cbec5a0 --- /dev/null +++ b/mysql-test/suite/wsrep/r/MDEV-22443.result @@ -0,0 +1,3 @@ +SET SESSION wsrep_sync_wait=15; +SET SESSION wsrep_on=1; +START TRANSACTION READ WRITE; diff --git a/mysql-test/suite/wsrep/r/MDEV-23092.result b/mysql-test/suite/wsrep/r/MDEV-23092.result new file mode 100644 index 00000000000..d88aacf7d5c --- /dev/null +++ b/mysql-test/suite/wsrep/r/MDEV-23092.result @@ -0,0 +1,13 @@ +SET COLLATION_CONNECTION='utf16le_bin'; +SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so'; +ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/' +SET GLOBAL wsrep_cluster_address='OFF'; +SET GLOBAL wsrep_slave_threads=10; +SELECT 1; +1 +1 +SET GLOBAL wsrep_cluster_address='gcomm://'; +SET GLOBAL wsrep_slave_threads=DEFAULT; +CALL mtr.add_suppression("wsrep_load()"); +CALL mtr.add_suppression("Failed to create a new provider"); +CALL mtr.add_suppression("Failed to load provider"); diff --git a/mysql-test/suite/wsrep/r/MDEV-23466.result b/mysql-test/suite/wsrep/r/MDEV-23466.result new file mode 100644 index 00000000000..6d167c9c95e --- /dev/null +++ b/mysql-test/suite/wsrep/r/MDEV-23466.result @@ -0,0 +1,3 @@ +SELECT WSREP_LAST_SEEN_GTID(); +WSREP_LAST_SEEN_GTID() +00000000-0000-0000-0000-000000000000:-1 diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result index f219625b490..d5bbecfa7c2 100644 --- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result +++ b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result @@ -15,6 +15,7 @@ TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition_type; +START TRANSACTION; INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); SET @time_zone_id= LAST_INSERT_ID(); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); @@ -32,6 +33,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it. Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. +COMMIT; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; \d | @@ -57,6 +59,7 @@ TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition_type; +START TRANSACTION; INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); SET @time_zone_id= LAST_INSERT_ID(); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); @@ -71,6 +74,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, (@time_zone_id, 0, 0, 0, 'GMT') ; Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. +COMMIT; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; \d | diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result index 85c4d858be2..aff02cb413e 100644 --- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result +++ b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result @@ -9,6 +9,7 @@ TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition_type; +START TRANSACTION; INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); SET @time_zone_id= LAST_INSERT_ID(); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); @@ -26,6 +27,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it. Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion. +COMMIT; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; # Silent run @@ -36,6 +38,7 @@ TRUNCATE TABLE time_zone; TRUNCATE TABLE time_zone_name; TRUNCATE TABLE time_zone_transition; TRUNCATE TABLE time_zone_transition_type; +START TRANSACTION; INSERT INTO time_zone (Use_leap_seconds) VALUES ('N'); SET @time_zone_id= LAST_INSERT_ID(); INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id); @@ -50,6 +53,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, (@time_zone_id, 0, 0, 0, 'GMT') ; Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it. +COMMIT; ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time; ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id; # diff --git a/mysql-test/suite/wsrep/t/MDEV-22443.cnf b/mysql-test/suite/wsrep/t/MDEV-22443.cnf new file mode 100644 index 00000000000..851f2999a83 --- /dev/null +++ b/mysql-test/suite/wsrep/t/MDEV-22443.cnf @@ -0,0 +1,8 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=OFF +binlog-format=ROW +wsrep-provider=none +wsrep-cluster-address='gcomm://' +innodb_autoinc_lock_mode=2 diff --git a/mysql-test/suite/wsrep/t/MDEV-22443.test b/mysql-test/suite/wsrep/t/MDEV-22443.test new file mode 100644 index 00000000000..674cb5ae2d8 --- /dev/null +++ b/mysql-test/suite/wsrep/t/MDEV-22443.test @@ -0,0 +1,12 @@ +# +# MDEV-22443: terminate called after throwing an instance of +# 'wsrep::runtime_error' in std::terminate on START TRANSACTION +# + +--source include/have_innodb.inc +--source include/have_wsrep.inc +--source include/have_binlog_format_row.inc + +SET SESSION wsrep_sync_wait=15; +SET SESSION wsrep_on=1; +START TRANSACTION READ WRITE; diff --git a/mysql-test/suite/wsrep/t/MDEV-23092.cnf b/mysql-test/suite/wsrep/t/MDEV-23092.cnf new file mode 100644 index 00000000000..851f2999a83 --- /dev/null +++ b/mysql-test/suite/wsrep/t/MDEV-23092.cnf @@ -0,0 +1,8 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=OFF +binlog-format=ROW +wsrep-provider=none +wsrep-cluster-address='gcomm://' +innodb_autoinc_lock_mode=2 diff --git a/mysql-test/suite/wsrep/t/MDEV-23092.test b/mysql-test/suite/wsrep/t/MDEV-23092.test new file mode 100644 index 00000000000..92a6e392013 --- /dev/null +++ b/mysql-test/suite/wsrep/t/MDEV-23092.test @@ -0,0 +1,22 @@ +# +# MDEV-23092: SIGABRT in wsrep::server_state::provider when setting +# invalid wsrep_provider (on optimized builds) +# + +--source include/have_innodb.inc +--source include/have_wsrep.inc +--source include/have_binlog_format_row.inc + +SET COLLATION_CONNECTION='utf16le_bin'; +--error 1231 +SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so'; +SET GLOBAL wsrep_cluster_address='OFF'; +SET GLOBAL wsrep_slave_threads=10; +SELECT 1; + +SET GLOBAL wsrep_cluster_address='gcomm://'; +SET GLOBAL wsrep_slave_threads=DEFAULT; + +CALL mtr.add_suppression("wsrep_load()"); +CALL mtr.add_suppression("Failed to create a new provider"); +CALL mtr.add_suppression("Failed to load provider"); diff --git a/mysql-test/suite/wsrep/t/MDEV-23466.cnf b/mysql-test/suite/wsrep/t/MDEV-23466.cnf new file mode 100644 index 00000000000..851f2999a83 --- /dev/null +++ b/mysql-test/suite/wsrep/t/MDEV-23466.cnf @@ -0,0 +1,8 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=OFF +binlog-format=ROW +wsrep-provider=none +wsrep-cluster-address='gcomm://' +innodb_autoinc_lock_mode=2 diff --git a/mysql-test/suite/wsrep/t/MDEV-23466.test b/mysql-test/suite/wsrep/t/MDEV-23466.test new file mode 100644 index 00000000000..2615298226e --- /dev/null +++ b/mysql-test/suite/wsrep/t/MDEV-23466.test @@ -0,0 +1,10 @@ +# +# MDEV-23466: SIGABRT in wsrep::server_state::provider on +# SELECT WSREP_LAST_SEEN_GTID() on optimized builds +# + +--source include/have_innodb.inc +--source include/have_wsrep.inc +--source include/have_binlog_format_row.inc + +SELECT WSREP_LAST_SEEN_GTID(); diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 36731e14a58..5718b2e762d 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -1,5 +1,6 @@ /* Copyright (c) 2001, 2011, Oracle and/or its affiliates + Copyright (c) 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,15 +34,6 @@ #include <execinfo.h> #endif -#ifdef __linux__ -#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end) -static char *heap_start; -char *__bss_start; -#else -#define PTR_SANE(p) (p) -#endif /* __linux */ - - /** Default handler for printing stacktrace */ @@ -61,111 +53,23 @@ static sig_handler default_handle_fatal_signal(int sig) /** Initialize priting off stacktrace at signal - - @param setup_handlers 0 only initialize variables - 1 setup signal handlers for stacktrace printing */ -void my_init_stacktrace(int setup_handlers) +void my_setup_stacktrace(void) { -#ifdef __linux__ - heap_start = (char*) &__bss_start; -#endif /* __linux */ - if (setup_handlers) - { - struct sigaction sa; - sa.sa_flags = SA_RESETHAND | SA_NODEFER; - sigemptyset(&sa.sa_mask); - sa.sa_handler= default_handle_fatal_signal; - sigaction(SIGSEGV, &sa, NULL); - sigaction(SIGABRT, &sa, NULL); + struct sigaction sa; + sa.sa_flags = SA_RESETHAND | SA_NODEFER; + sigemptyset(&sa.sa_mask); + sa.sa_handler= default_handle_fatal_signal; + sigaction(SIGSEGV, &sa, NULL); + sigaction(SIGABRT, &sa, NULL); #ifdef SIGBUS - sigaction(SIGBUS, &sa, NULL); + sigaction(SIGBUS, &sa, NULL); #endif - sigaction(SIGILL, &sa, NULL); - sigaction(SIGFPE, &sa, NULL); - } -} - -#ifdef __linux__ - -static void print_buffer(char *buffer, size_t count) -{ - const char s[]= " "; - for (; count && *buffer; --count) - { - my_write_stderr(isprint(*buffer) ? buffer : s, 1); - ++buffer; - } -} - -/** - Access the pages of this process through /proc/self/task/<tid>/mem - in order to safely print the contents of a memory address range. - - @param addr The address at the start of the memory region. - @param max_len The length of the memory region. - - @return Zero on success. -*/ -static int safe_print_str(const char *addr, size_t max_len) -{ - int fd; - pid_t tid; - off_t offset; - ssize_t nbytes= 0; - size_t total, count; - char buf[256]; - - tid= (pid_t) syscall(SYS_gettid); - - sprintf(buf, "/proc/self/task/%d/mem", tid); - - if ((fd= open(buf, O_RDONLY)) < 0) - return -1; - - /* Ensure that off_t can hold a pointer. */ - compile_time_assert(sizeof(off_t) >= sizeof(intptr)); - - total= max_len; - offset= (intptr) addr; - - /* Read up to the maximum number of bytes. */ - while (total) - { - count= MY_MIN(sizeof(buf), total); - - if ((nbytes= pread(fd, buf, count, offset)) < 0) - { - /* Just in case... */ - if (errno == EINTR) - continue; - else - break; - } - - /* Advance offset into memory. */ - total-= nbytes; - offset+= nbytes; - addr+= nbytes; - - /* Output the printable characters. */ - print_buffer(buf, nbytes); - - /* Break if less than requested... */ - if ((count - nbytes)) - break; - } - - if (nbytes == -1) - my_safe_printf_stderr("Can't read from address %p", addr); - - close(fd); - - return 0; + sigaction(SIGILL, &sa, NULL); + sigaction(SIGFPE, &sa, NULL); } -#endif /* Attempt to print a char * pointer as a string. @@ -187,24 +91,25 @@ static int safe_print_str(const char *addr, size_t max_len) int my_safe_print_str(const char* val, size_t max_len) { -#ifdef __linux__ - char *heap_end; - - // Try and make use of /proc filesystem to safely print memory contents. - if (!safe_print_str(val, max_len)) - return 0; - - heap_end= (char*) sbrk(0); -#endif - - if (!PTR_SANE(val)) + const char *orig_val= val; + if (!val) { - my_safe_printf_stderr("%s", "is an invalid pointer"); + my_safe_printf_stderr("%s", "(null)"); return 1; } - for (; max_len && PTR_SANE(val) && *val; --max_len) - my_write_stderr((val++), 1); + for (; max_len; --max_len) + { + if (my_write_stderr((val++), 1) != 1) + { + if ((errno == EFAULT) &&(val == orig_val + 1)) + { + // We can not read the address from very beginning + my_safe_printf_stderr("Can't access address %p", orig_val); + } + break; + } + } my_safe_printf_stderr("%s", "\n"); return 0; @@ -548,11 +453,6 @@ static EXCEPTION_POINTERS *exception_ptrs; #define MODULE64_SIZE_WINXP 576 #define STACKWALK_MAX_FRAMES 64 -void my_init_stacktrace(int setup_handlers __attribute__((unused))) -{ -} - - void my_set_exception_pointers(EXCEPTION_POINTERS *ep) { exception_ptrs = ep; diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 0da86726bfb..2b8035c2e5e 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -23,6 +23,7 @@ numa_interleave=0 wsrep_on=0 dry_run=0 defaults_group_suffix= +ignore_unknown=1 # Initial logging status: error log is not open, and not using syslog logging=init @@ -370,11 +371,22 @@ parse_arguments() { --help) usage ;; + --ignore-unknown) ignore_unknown=1 ;; + --no-ignore-unknown|--not-ignore-unknown) ignore_unknown=0 ;; + *) - case "$unrecognized_handling" in - collect) append_arg_to_args "$arg" ;; - complain) log_error "unknown option '$arg'" ;; - esac + if test $ignore_unknown -eq 0 + then + case "$unrecognized_handling" in + collect) append_arg_to_args "$arg" ;; + complain) log_error "unknown option '$arg'" + esac + else + case "$arg" in + "--loose-"*) append_arg_to_args "$arg" ;; + *) append_arg_to_args "--loose-$arg" + esac + fi esac done } diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index d2180297907..7f6945c728a 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2006, 2014, Oracle and/or its affiliates. -# Copyright (c) 2010, 2018, MariaDB Corporation +# Copyright (c) 2010, 2020, MariaDB Corporation. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5a4ef3d3ad2..c8fb9b45a2d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2830,7 +2830,6 @@ void init_signals(void) sigemptyset(&sa.sa_mask); sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL); - my_init_stacktrace(0); #if defined(__amiga__) sa.sa_handler=(void(*)())handle_fatal_signal; #else diff --git a/sql/tztime.cc b/sql/tztime.cc index 4546f2291cd..8e08a201e88 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -2753,9 +2753,11 @@ main(int argc, char **argv) printf("TRUNCATE TABLE time_zone_name;\n"); printf("TRUNCATE TABLE time_zone_transition;\n"); printf("TRUNCATE TABLE time_zone_transition_type;\n"); + printf("START TRANSACTION;\n"); if (scan_tz_dir(root_name_end, 0, opt_verbose)) { + printf("ROLLBACK;\n"); fflush(stdout); fprintf(stderr, "There were fatal errors during processing " @@ -2763,6 +2765,7 @@ main(int argc, char **argv) return 1; } + printf("COMMIT;\n"); printf("ALTER TABLE time_zone_transition " "ORDER BY Time_zone_id, Transition_time;\n"); printf("ALTER TABLE time_zone_transition_type " diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 9a2d5e635a5..d0155f27d6d 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1171,7 +1171,7 @@ bool wsrep_must_sync_wait (THD* thd, uint mask) mysql_mutex_lock(&thd->LOCK_thd_data); ret= (thd->variables.wsrep_sync_wait & mask) && thd->wsrep_client_thread && - thd->variables.wsrep_on && + WSREP_ON && !(thd->variables.wsrep_dirty_reads && !is_update_query(thd->lex->sql_command)) && !thd->in_active_multi_stmt_transaction() && diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 4fffc3ddc8a..70a4bc8c470 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -360,6 +360,12 @@ static int wsrep_provider_verify (const char* provider_str) { return 1; } + + if (MY_S_ISDIR(f_stat.st_mode)) + { + return 1; + } + return 0; } diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 126f873569f..40684e95615 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -5072,7 +5072,6 @@ btr_validate_index( if (!btr_validate_level(index, trx, n - i, lockout)) { err = DB_CORRUPTION; - break; } } diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 472a2460f17..9c627ecd145 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3442,7 +3442,7 @@ fail: /* prefetch siblings of the leaf for the pessimistic operation, if the page is leaf. */ - if (page_is_leaf(page)) { + if (page_is_leaf(page) && !index->is_ibuf()) { btr_cur_prefetch_siblings(block); } fail_err: @@ -4575,6 +4575,7 @@ btr_cur_optimistic_update( if (rec_offs_any_extern(*offsets)) { any_extern: + ut_ad(!index->is_ibuf()); /* Externally stored fields are treated in pessimistic update */ @@ -4771,7 +4772,7 @@ func_exit: } } - if (err != DB_SUCCESS) { + if (err != DB_SUCCESS && !index->is_ibuf()) { /* prefetch siblings of the leaf for the pessimistic operation. */ btr_cur_prefetch_siblings(block); diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 6a8c4869659..5977271dc20 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3840,7 +3840,7 @@ buf_page_create(fil_space_t *space, uint32_t offset, const bool drop_hash_entry= block->page.state() == BUF_BLOCK_FILE_PAGE && UNIV_LIKELY_NULL(block->index); if (UNIV_UNLIKELY(drop_hash_entry)) - block->page.set_io_fix(BUF_IO_PIN); + rw_lock_x_lock(&block->lock); #endif /* BTR_CUR_HASH_ADAPT */ /* Page can be found in buf_pool */ @@ -3851,7 +3851,7 @@ buf_page_create(fil_space_t *space, uint32_t offset, if (UNIV_UNLIKELY(drop_hash_entry)) { btr_search_drop_page_hash_index(block); - block->page.io_unfix(); + rw_lock_x_unlock(&block->lock); } #endif /* BTR_CUR_HASH_ADAPT */ diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 1e8c9ec2131..5b79406fb18 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -120,7 +120,7 @@ bool dict_col_t::same_encoding(uint16_t a, uint16_t b) { if (const CHARSET_INFO *acs= get_charset(a, MYF(MY_WME))) if (const CHARSET_INFO *bcs= get_charset(b, MYF(MY_WME))) - return Charset(acs).same_encoding(bcs); + return Charset(bcs).encoding_allows_reinterpret_as(acs); return false; } diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 2b153186ba0..9dd680aa188 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -10796,11 +10796,11 @@ ha_innobase::commit_inplace_alter_table( /* Exclusively lock the table, to ensure that no other transaction is holding locks on the table while we - change the table definition. The MySQL meta-data lock + change the table definition. The meta-data lock (MDL) should normally guarantee that no conflicting locks exist. However, FOREIGN KEY constraints checks and any transactions collected during crash recovery could be - holding InnoDB locks only, not MySQL locks. */ + holding InnoDB locks only, not MDL. */ dberr_t error = row_merge_lock_table( m_prebuilt->trx, ctx->old_table, LOCK_X); diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 81a76ac8bab..0c42c5ffe6f 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -728,7 +728,7 @@ public: bool same_format(const dict_col_t &other) const { return same_type(other) && len >= other.len && - mbminlen == other.mbminlen && mbmaxlen == other.mbmaxlen && + mbminlen == other.mbminlen && mbmaxlen >= other.mbmaxlen && !((prtype ^ other.prtype) & ~(DATA_NOT_NULL | DATA_VERSIONED | CHAR_COLL_MASK << 16 | DATA_LONG_TRUE_VARCHAR)); diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index a04537ea6c3..5fe029d5b4d 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -2098,6 +2098,7 @@ wrong_page_type: /* Validate the record list in a loop checking also that it is consistent with the directory. */ ulint count = 0, data_size = 0, own_count = 1, slot_no = 0; + ulint info_bits; slot_no = 0; slot = page_dir_get_nth_slot(page, slot_no); @@ -2121,9 +2122,16 @@ wrong_page_type: goto next_rec; } + info_bits = rec_get_info_bits(rec, page_is_comp(page)); + if (info_bits + & ~(REC_INFO_MIN_REC_FLAG | REC_INFO_DELETED_FLAG)) { + ib::error() << "info_bits has an incorrect value " + << info_bits; + ret = false; + } + if (rec == first_rec) { - if ((rec_get_info_bits(rec, page_is_comp(page)) - & REC_INFO_MIN_REC_FLAG)) { + if (info_bits & REC_INFO_MIN_REC_FLAG) { if (page_has_prev(page)) { ib::error() << "REC_INFO_MIN_REC_FLAG " "is set on non-left page"; @@ -2134,8 +2142,7 @@ wrong_page_type: ib::error() << "REC_INFO_MIN_REC_FLAG " "is set in a leaf-page record"; ret = false; - } else if (!rec_get_deleted_flag( - rec, page_is_comp(page)) + } else if (!(info_bits & REC_INFO_DELETED_FLAG) != !index->table->instant) { ib::error() << (index->table->instant ? "Metadata record " @@ -2149,13 +2156,51 @@ wrong_page_type: ib::error() << "Metadata record is missing"; ret = false; } - } else if (rec_get_info_bits(rec, page_is_comp(page)) - & REC_INFO_MIN_REC_FLAG) { + } else if (info_bits & REC_INFO_MIN_REC_FLAG) { ib::error() << "REC_INFO_MIN_REC_FLAG record is not " "first in page"; ret = false; } + if (page_is_comp(page)) { + const rec_comp_status_t status = rec_get_status(rec); + if (status != REC_STATUS_ORDINARY + && status != REC_STATUS_NODE_PTR + && status != REC_STATUS_INFIMUM + && status != REC_STATUS_SUPREMUM + && status != REC_STATUS_INSTANT) { + ib::error() << "impossible record status " + << status; + ret = false; + } else if (page_rec_is_infimum(rec)) { + if (status != REC_STATUS_INFIMUM) { + ib::error() + << "infimum record has status " + << status; + ret = false; + } + } else if (page_rec_is_supremum(rec)) { + if (status != REC_STATUS_SUPREMUM) { + ib::error() << "supremum record has " + "status " + << status; + ret = false; + } + } else if (!page_is_leaf(page)) { + if (status != REC_STATUS_NODE_PTR) { + ib::error() << "node ptr record has " + "status " + << status; + ret = false; + } + } else if (!index->is_instant() + && status == REC_STATUS_INSTANT) { + ib::error() << "instantly added record in a " + "non-instant index"; + ret = false; + } + } + /* Check that the records are in the ascending order */ if (count >= PAGE_HEAP_NO_USER_LOW && !page_rec_is_supremum(rec)) { diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index f7868135a94..ee98c327055 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -3807,8 +3807,6 @@ funct_exit_all_freed: trx->op_info = ""; - srv_inc_activity_count(); - DBUG_RETURN(err); } @@ -4521,12 +4519,20 @@ end: if (err != DB_SUCCESS) { if (old_is_tmp) { - ib::error() << "In ALTER TABLE " + /* In case of copy alter, ignore the + loading of foreign key constraint + when foreign_key_check is disabled */ + ib::error_or_warn(trx->check_foreigns) + << "In ALTER TABLE " << ut_get_name(trx, new_name) << " has or is referenced in foreign" " key constraints which are not" " compatible with the new table" " definition."; + if (!trx->check_foreigns) { + err = DB_SUCCESS; + goto funct_exit; + } } else { ib::error() << "In RENAME TABLE table " << ut_get_name(trx, new_name) diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc index 63edbd9b86d..68856d47b5e 100644 --- a/storage/innobase/row/row0uins.cc +++ b/storage/innobase/row/row0uins.cc @@ -84,11 +84,11 @@ row_undo_ins_remove_clust_rec( online = false; } else { index->set_modified(mtr); + ut_ad(lock_table_has_locks(index->table)); online = dict_index_is_online_ddl(index); if (online) { ut_ad(node->rec_type == TRX_UNDO_INSERT_REC); - ut_ad(node->trx->dict_operation_lock_mode - != RW_X_LATCH); + ut_ad(!node->trx->dict_operation_lock_mode); ut_ad(node->table->id != DICT_INDEXES_ID); ut_ad(node->table->id != DICT_COLUMNS_ID); mtr_s_lock_index(index, &mtr); @@ -529,6 +529,9 @@ row_undo_ins( return DB_SUCCESS; } + ut_ad(node->table->is_temporary() + || lock_table_has_locks(node->table)); + /* Iterate over all the indexes and undo the insert.*/ node->index = dict_table_get_first_index(node->table); diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc index 39f7ddbd79a..d32c6cd2510 100644 --- a/storage/innobase/row/row0umod.cc +++ b/storage/innobase/row/row0umod.cc @@ -244,10 +244,7 @@ row_undo_mod_clust( bool online; ut_ad(thr_get_trx(thr) == node->trx); - ut_ad(node->trx->dict_operation_lock_mode); ut_ad(node->trx->in_rollback); - ut_ad(rw_lock_own_flagged(&dict_sys.latch, - RW_LOCK_FLAG_X | RW_LOCK_FLAG_S)); log_free_check(); pcur = &node->pcur; @@ -259,11 +256,12 @@ row_undo_mod_clust( mtr.set_log_mode(MTR_LOG_NO_REDO); } else { index->set_modified(mtr); + ut_ad(lock_table_has_locks(index->table)); } online = dict_index_is_online_ddl(index); if (online) { - ut_ad(node->trx->dict_operation_lock_mode != RW_X_LATCH); + ut_ad(!node->trx->dict_operation_lock_mode); mtr_s_lock_index(index, &mtr); } @@ -302,17 +300,7 @@ row_undo_mod_clust( ut_ad(err == DB_SUCCESS || err == DB_OUT_OF_FILE_SPACE); } - /* Online rebuild cannot be initiated while we are holding - dict_sys.latch and index->lock. (It can be aborted.) */ - ut_ad(online || !dict_index_is_online_ddl(index)); - - if (err == DB_SUCCESS && online) { - - ut_ad(rw_lock_own_flagged( - &index->lock, - RW_LOCK_FLAG_S | RW_LOCK_FLAG_X - | RW_LOCK_FLAG_SX)); - + if (err == DB_SUCCESS && online && dict_index_is_online_ddl(index)) { switch (node->rec_type) { case TRX_UNDO_DEL_MARK_REC: row_log_table_insert( @@ -887,37 +875,6 @@ func_exit_no_pcur: } /***********************************************************//** -Flags a secondary index corrupted. */ -static MY_ATTRIBUTE((nonnull)) -void -row_undo_mod_sec_flag_corrupted( -/*============================*/ - trx_t* trx, /*!< in/out: transaction */ - dict_index_t* index) /*!< in: secondary index */ -{ - ut_ad(!dict_index_is_clust(index)); - - switch (trx->dict_operation_lock_mode) { - case RW_S_LATCH: - /* Because row_undo() is holding an S-latch - on the data dictionary during normal rollback, - we can only mark the index corrupted in the - data dictionary cache. TODO: fix this somehow.*/ - mutex_enter(&dict_sys.mutex); - dict_set_corrupted_index_cache_only(index); - mutex_exit(&dict_sys.mutex); - break; - default: - ut_ad(0); - /* fall through */ - case RW_X_LATCH: - /* This should be the rollback of a data dictionary - transaction. */ - dict_set_corrupted(index, trx, "rollback"); - } -} - -/***********************************************************//** Undoes a modify in secondary indexes when undo record type is UPD_DEL. @return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ static MY_ATTRIBUTE((nonnull, warn_unused_result)) @@ -1030,8 +987,7 @@ row_undo_mod_del_mark_sec( } if (err == DB_DUPLICATE_KEY) { - row_undo_mod_sec_flag_corrupted( - thr_get_trx(thr), index); + index->type |= DICT_CORRUPT; err = DB_SUCCESS; /* Do not return any error to the caller. The duplicate will be reported by ALTER TABLE or @@ -1176,8 +1132,7 @@ row_undo_mod_upd_exist_sec( } if (err == DB_DUPLICATE_KEY) { - row_undo_mod_sec_flag_corrupted( - thr_get_trx(thr), index); + index->type |= DICT_CORRUPT; err = DB_SUCCESS; } else if (err != DB_SUCCESS) { break; @@ -1340,6 +1295,8 @@ row_undo_mod( return DB_SUCCESS; } + ut_ad(node->table->is_temporary() + || lock_table_has_locks(node->table)); node->index = dict_table_get_first_index(node->table); ut_ad(dict_index_is_clust(node->index)); diff --git a/storage/innobase/row/row0undo.cc b/storage/innobase/row/row0undo.cc index 20bf53e3f91..2fe1135b894 100644 --- a/storage/innobase/row/row0undo.cc +++ b/storage/innobase/row/row0undo.cc @@ -411,15 +411,17 @@ row_undo( return DB_SUCCESS; } - /* Prevent DROP TABLE etc. while we are rolling back this row. - If we are doing a TABLE CREATE or some other dictionary operation, - then we already have dict_sys.latch locked in x-mode. Do not - try to lock again, because that would cause a hang. */ - + /* Prevent prepare_inplace_alter_table_dict() from adding + dict_table_t::indexes while we are processing the record. + Recovered transactions are not protected by MDL, and the + secondary index creation is not protected by table locks + for online operation. (A table lock would only be acquired + when committing the ALTER TABLE operation.) */ trx_t* trx = node->trx; - const bool locked_data_dict = (trx->dict_operation_lock_mode == 0); + const bool locked_data_dict = UNIV_UNLIKELY(trx->is_recovered) + && !trx->dict_operation_lock_mode; - if (locked_data_dict) { + if (UNIV_UNLIKELY(locked_data_dict)) { row_mysql_freeze_data_dictionary(trx); } @@ -439,7 +441,7 @@ row_undo( err = DB_CORRUPTION; } - if (locked_data_dict) { + if (UNIV_UNLIKELY(locked_data_dict)) { row_mysql_unfreeze_data_dictionary(trx); } diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index a9ba8cd7786..812e4861a4e 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1188,6 +1188,7 @@ trx_flush_log_if_needed_low( case 1: /* Write the log and optionally flush it to disk */ log_write_up_to(lsn, flush); + srv_inc_activity_count(); return; case 0: /* Do nothing */ diff --git a/storage/maria/aria_chk.c b/storage/maria/aria_chk.c index f46fe7490d8..4f8438fb9d0 100644 --- a/storage/maria/aria_chk.c +++ b/storage/maria/aria_chk.c @@ -127,7 +127,7 @@ int main(int argc, char **argv) int error; MY_INIT(argv[0]); - my_init_stacktrace(1); + my_setup_stacktrace(); default_log_dir= opt_log_dir= maria_data_root= (char *)"."; maria_chk_init(&check_param); check_param.opt_lock_memory= 1; /* Lock memory if possible */ diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt index ec4e0b91626..984b033e7aa 100644 --- a/unittest/mysys/CMakeLists.txt +++ b/unittest/mysys/CMakeLists.txt @@ -15,7 +15,7 @@ MY_ADD_TESTS(bitmap base64 my_atomic my_rdtsc lf my_malloc my_getopt dynstring byte_order - queues LINK_LIBRARIES mysys) + queues stacktrace LINK_LIBRARIES mysys) MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys) MY_ADD_TESTS(aes LINK_LIBRARIES mysys mysys_ssl) ADD_DEFINITIONS(${SSL_DEFINES}) diff --git a/unittest/mysys/stacktrace-t.c b/unittest/mysys/stacktrace-t.c new file mode 100644 index 00000000000..8fa0db15b36 --- /dev/null +++ b/unittest/mysys/stacktrace-t.c @@ -0,0 +1,67 @@ + +/* Copyright (c) 2020, MariaDB Corporation. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ + +#include <my_global.h> +#include <my_sys.h> +#include <stdio.h> +#include <my_stacktrace.h> +#include <tap.h> + +char b_bss[10]; + +void test_my_safe_print_str() +{ + char b_stack[10]; + char *b_heap= strdup("LEGAL"); + memcpy(b_stack, "LEGAL", 6); + memcpy(b_bss, "LEGAL", 6); + +#ifndef __SANITIZE_ADDRESS__ + fprintf(stderr, "\n===== stack =====\n"); + my_safe_print_str(b_stack, 65535); + fprintf(stderr, "\n===== heap =====\n"); + my_safe_print_str(b_heap, 65535); + fprintf(stderr, "\n===== BSS =====\n"); + my_safe_print_str(b_bss, 65535); + fprintf(stderr, "\n===== data =====\n"); + my_safe_print_str("LEGAL", 65535); + fprintf(stderr, "\n===== Above is a junk, but it is expected. =====\n"); +#endif /*__SANITIZE_ADDRESS__*/ + fprintf(stderr, "\n===== Nornal length test =====\n"); + my_safe_print_str("LEGAL", 5); + fprintf(stderr, "\n===== NULL =====\n"); + my_safe_print_str(0, 5); +#ifndef __SANITIZE_ADDRESS__ + fprintf(stderr, "\n===== (const char*) 1 =====\n"); + my_safe_print_str((const char*)1, 5); +#endif /*__SANITIZE_ADDRESS__*/ + + free(b_heap); + + ok(1, "test_my_safe_print_str"); +} + + +int main(int argc __attribute__((unused)), char **argv) +{ + MY_INIT(argv[0]); + plan(1); + + test_my_safe_print_str(); + + my_end(0); + return exit_status(); +} |