diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-01-24 16:14:12 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-01-24 16:14:12 +0200 |
commit | 947b6b849d907dc0793f076aec7e553869db744f (patch) | |
tree | 50e7d87866ed50b8510336ce33d515ed32386754 | |
parent | 55be043c13d45581a0cecbae85d1f7de2708d891 (diff) | |
parent | fab531a150ec588f87e8a636d2ba1ecbfffdb08e (diff) | |
download | mariadb-git-947b6b849d907dc0793f076aec7e553869db744f.tar.gz |
Merge 10.2 into 10.3
53 files changed, 694 insertions, 156 deletions
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index e2329f505ab..ff6422d15da 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -46,7 +46,7 @@ ENDIF(UNIX) MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test) SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS") -TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcre pcreposix) +TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcreposix pcre) SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE) diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index 9e9fdb2e1f4..f40304c07d7 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -321,7 +321,7 @@ static bool page_is_corrupted(const byte *page, ulint page_no, page_no first. */ if (page_no && mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) - && (opt_backup_encrypted + && (opt_encrypted_backup || (space->crypt_data && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED))) { diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 5e1fb20fbb7..05b9be0652f 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -201,7 +201,7 @@ static char* log_ignored_opt; extern my_bool opt_use_ssl; my_bool opt_ssl_verify_server_cert; my_bool opt_extended_validation; -my_bool opt_backup_encrypted; +my_bool opt_encrypted_backup; /* === metadata of backup === */ #define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints" @@ -761,7 +761,7 @@ enum options_xtrabackup OPT_XTRA_DATABASES_FILE, OPT_XTRA_PARALLEL, OPT_XTRA_EXTENDED_VALIDATION, - OPT_XTRA_BACKUP_ENCRYPTED, + OPT_XTRA_ENCRYPTED_BACKUP, OPT_XTRA_STREAM, OPT_XTRA_COMPRESS, OPT_XTRA_COMPRESS_THREADS, @@ -1227,12 +1227,12 @@ struct my_option xb_server_options[] = (G_PTR*)&opt_extended_validation, 0, GET_BOOL, NO_ARG, FALSE, 0, 0, 0, 0, 0}, - {"backup_encrypted", OPT_XTRA_BACKUP_ENCRYPTED, + {"encrypted_backup", OPT_XTRA_ENCRYPTED_BACKUP, "In --backup, assume that nonzero key_version implies that the page" - " is encrypted. Use --backup --skip-backup-encrypted to allow" + " is encrypted. Use --backup --skip-encrypted-backup to allow" " copying unencrypted that were originally created before MySQL 5.1.48.", - (G_PTR*)&opt_backup_encrypted, - (G_PTR*)&opt_backup_encrypted, + (G_PTR*)&opt_encrypted_backup, + (G_PTR*)&opt_encrypted_backup, 0, GET_BOOL, NO_ARG, TRUE, 0, 0, 0, 0, 0}, {"log", OPT_LOG, "Ignored option for MySQL option compatibility", diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h index 8e0e09f6f07..90f5e28e2c7 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -108,7 +108,7 @@ extern my_bool opt_no_backup_locks; extern my_bool opt_decompress; extern my_bool opt_remove_original; extern my_bool opt_extended_validation; -extern my_bool opt_backup_encrypted; +extern my_bool opt_encrypted_backup; extern my_bool opt_lock_ddl_per_table; extern char *opt_incremental_history_name; diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt index d47638ad2f9..1eb07a2adf8 100644 --- a/libmysqld/examples/CMakeLists.txt +++ b/libmysqld/examples/CMakeLists.txt @@ -34,7 +34,7 @@ ENDIF(UNIX) MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc COMPONENT Test) -TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcre pcreposix) +TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcreposix pcre) IF(CMAKE_GENERATOR MATCHES "Xcode") # It does not seem possible to tell Xcode the resulting target might need diff --git a/mysql-test/main/connect.result b/mysql-test/main/connect.result index b05d0ea9fea..92584d5d11d 100644 --- a/mysql-test/main/connect.result +++ b/mysql-test/main/connect.result @@ -100,8 +100,20 @@ ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET); connect fail_con,localhost,test,zorro,; ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) +select user,host,password,plugin,authentication_string from mysql.user where user='test'; +user host password plugin authentication_string +test localhost *5FDFF3268A50F41C5D18D2CA2F754D7BDB9B3E59 +test 127.0.0.1 *5FDFF3268A50F41C5D18D2CA2F754D7BDB9B3E59 update mysql.user set password=old_password("gambling2") where user=_binary"test"; flush privileges; +show grants for test@localhost; +Grants for test@localhost +GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost' IDENTIFIED BY PASSWORD '2f27438961437573' +update mysql.user set plugin='mysql_old_password' where user='test'; +flush privileges; +show grants for test@localhost; +Grants for test@localhost +GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost' IDENTIFIED BY PASSWORD '2f27438961437573' connect con10,localhost,test,gambling2,; connect con5,localhost,test,gambling2,mysql; connection con5; diff --git a/mysql-test/main/connect.test b/mysql-test/main/connect.test index 3a38ad88462..560f29e840d 100644 --- a/mysql-test/main/connect.test +++ b/mysql-test/main/connect.test @@ -66,8 +66,13 @@ connect (fail_con,localhost,test,zorro,test2); connect (fail_con,localhost,test,zorro,); # check if old password version also works +select user,host,password,plugin,authentication_string from mysql.user where user='test'; update mysql.user set password=old_password("gambling2") where user=_binary"test"; flush privileges; +show grants for test@localhost; +update mysql.user set plugin='mysql_old_password' where user='test'; +flush privileges; +show grants for test@localhost; connect (con10,localhost,test,gambling2,); connect (con5,localhost,test,gambling2,mysql); diff --git a/mysql-test/main/huge_frm-6224.result b/mysql-test/main/huge_frm-6224.result index 3772317c04d..bbb650bc5b4 100644 --- a/mysql-test/main/huge_frm-6224.result +++ b/mysql-test/main/huge_frm-6224.result @@ -1 +1,6 @@ +set global max_allowed_packet=1024*1024*10; +connect con1,localhost,root; ERROR HY000: The definition for table `t1` is too big +connection default; +disconnect con1; +set global max_allowed_packet=default; diff --git a/mysql-test/main/huge_frm-6224.test b/mysql-test/main/huge_frm-6224.test index 418722a7b51..322abd01738 100644 --- a/mysql-test/main/huge_frm-6224.test +++ b/mysql-test/main/huge_frm-6224.test @@ -4,17 +4,24 @@ # verify that huge frms are rejected during creation, not on opening # --source include/have_partition.inc +set global max_allowed_packet=1024*1024*10; +connect con1,localhost,root; -let $n=5646; +let $n=8164; let $a=create table t1 (a int) engine=myisam partition by hash(a) partitions $n (; dec $n; while ($n) { - let $a=$a partition p01234567890123456789012345678901234567890123456789012345678$n,; + let $a=$a partition p01234567890123456789012345678901234567890123456789012345678$n COMMENT 'partition p01234567890123456789012345678901234567890123456789012345678$n',; dec $n; } --disable_query_log --error ER_TABLE_DEFINITION_TOO_BIG eval $a partition foo); +--enable_query_log + +connection default; +disconnect con1; +set global max_allowed_packet=default; diff --git a/mysql-test/main/mysqlbinlog_row_compressed.result b/mysql-test/main/mysqlbinlog_row_compressed.result index cbea1cf9def..8cf52f5b826 100644 --- a/mysql-test/main/mysqlbinlog_row_compressed.result +++ b/mysql-test/main/mysqlbinlog_row_compressed.result @@ -61,7 +61,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") #<date> server id 1 end_log_pos 899 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 899 -#<date> server id 1 end_log_pos 967 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 967 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -90,7 +90,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) #<date> server id 1 end_log_pos 1214 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1214 -#<date> server id 1 end_log_pos 1281 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 1281 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=11 /* INT meta=0 nullable=0 is_null=0 */ @@ -119,7 +119,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") #<date> server id 1 end_log_pos 1530 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1530 -#<date> server id 1 end_log_pos 1596 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 1596 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=12 /* INT meta=0 nullable=0 is_null=0 */ @@ -148,7 +148,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") #<date> server id 1 end_log_pos 1842 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1842 -#<date> server id 1 end_log_pos 1909 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 1909 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ @@ -177,7 +177,7 @@ BEGIN #Q> INSERT INTO t2 SELECT * FROM t1 #<date> server id 1 end_log_pos 2134 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 2134 -#<date> server id 1 end_log_pos 2225 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +#<date> server id 1 end_log_pos 2225 CRC32 XXX Write_compressed_rows: table id 33 flags: STMT_END_F ### INSERT INTO `test`.`t2` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -239,7 +239,7 @@ BEGIN #Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL #<date> server id 1 end_log_pos 2462 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 2462 -#<date> server id 1 end_log_pos 2561 CRC32 XXX Update_compressed_rows: table id 32 flags: STMT_END_F +#<date> server id 1 end_log_pos 2561 CRC32 XXX Update_compressed_rows: table id 33 flags: STMT_END_F ### UPDATE `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -320,7 +320,7 @@ BEGIN #Q> DELETE FROM t1 #<date> server id 1 end_log_pos 2769 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 2769 -#<date> server id 1 end_log_pos 2861 CRC32 XXX Delete_compressed_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 2861 CRC32 XXX Delete_compressed_rows: table id 32 flags: STMT_END_F ### DELETE FROM `test`.`t1` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -382,7 +382,7 @@ BEGIN #Q> DELETE FROM t2 #<date> server id 1 end_log_pos 3069 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 3069 -#<date> server id 1 end_log_pos 3154 CRC32 XXX Delete_compressed_rows: table id 32 flags: STMT_END_F +#<date> server id 1 end_log_pos 3154 CRC32 XXX Delete_compressed_rows: table id 33 flags: STMT_END_F ### DELETE FROM `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ diff --git a/mysql-test/main/mysqlbinlog_row_minimal.result b/mysql-test/main/mysqlbinlog_row_minimal.result index 6417a528638..680fd8196a8 100644 --- a/mysql-test/main/mysqlbinlog_row_minimal.result +++ b/mysql-test/main/mysqlbinlog_row_minimal.result @@ -59,7 +59,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") #<date> server id 1 end_log_pos 946 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 946 -#<date> server id 1 end_log_pos 1015 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 1015 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -88,7 +88,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) #<date> server id 1 end_log_pos 1262 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1262 -#<date> server id 1 end_log_pos 1330 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 1330 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=11 /* INT meta=0 nullable=0 is_null=0 */ @@ -117,7 +117,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") #<date> server id 1 end_log_pos 1579 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1579 -#<date> server id 1 end_log_pos 1646 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 1646 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=12 /* INT meta=0 nullable=0 is_null=0 */ @@ -146,7 +146,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") #<date> server id 1 end_log_pos 1892 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1892 -#<date> server id 1 end_log_pos 1962 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 1962 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ @@ -175,7 +175,7 @@ BEGIN #Q> INSERT INTO t2 SELECT * FROM t1 #<date> server id 1 end_log_pos 2187 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 2187 -#<date> server id 1 end_log_pos 2354 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F +#<date> server id 1 end_log_pos 2354 CRC32 XXX Write_rows: table id 33 flags: STMT_END_F ### INSERT INTO `test`.`t2` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -237,7 +237,7 @@ BEGIN #Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL #<date> server id 1 end_log_pos 2591 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 2591 -#<date> server id 1 end_log_pos 2665 CRC32 XXX Update_rows: table id 32 flags: STMT_END_F +#<date> server id 1 end_log_pos 2665 CRC32 XXX Update_rows: table id 33 flags: STMT_END_F ### UPDATE `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -273,7 +273,7 @@ BEGIN #Q> DELETE FROM t1 #<date> server id 1 end_log_pos 2873 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 2873 -#<date> server id 1 end_log_pos 2927 CRC32 XXX Delete_rows: table id 31 flags: STMT_END_F +#<date> server id 1 end_log_pos 2927 CRC32 XXX Delete_rows: table id 32 flags: STMT_END_F ### DELETE FROM `test`.`t1` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -303,7 +303,7 @@ BEGIN #Q> DELETE FROM t2 #<date> server id 1 end_log_pos 3135 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 3135 -#<date> server id 1 end_log_pos 3189 CRC32 XXX Delete_rows: table id 32 flags: STMT_END_F +#<date> server id 1 end_log_pos 3189 CRC32 XXX Delete_rows: table id 33 flags: STMT_END_F ### DELETE FROM `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ diff --git a/mysql-test/main/mysqld_option_err.test b/mysql-test/main/mysqld_option_err.test index 0c38eba7ca9..e9655fd4bfe 100644 --- a/mysql-test/main/mysqld_option_err.test +++ b/mysql-test/main/mysqld_option_err.test @@ -56,4 +56,6 @@ mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; --error 2 --exec $MYSQLD_BOOTSTRAP_CMD --not-known-option --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 +rmdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; + --echo Done. diff --git a/mysql-test/main/range_innodb.result b/mysql-test/main/range_innodb.result index 8bb1c833a56..6572b248911 100644 --- a/mysql-test/main/range_innodb.result +++ b/mysql-test/main/range_innodb.result @@ -55,3 +55,27 @@ pk f1 f2 f3 pk f1 f2 f3 f4 f5 2 6 v NULL 14 1 q NULL 4 q 3 7 c NULL 14 1 q NULL 4 q drop table t1,t2; +# +# MDEV-14440: Server crash in in handler::ha_external_lock or Assertion `inited==RND' +# failed in handler::ha_rnd_end upon SELECT from partitioned table +# +set @optimizer_switch_save= @@optimizer_switch; +set optimizer_switch='index_merge_sort_intersection=off'; +create table t0 (a int)engine=innodb; +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( +a int, b int, c int, +key(a),key(b),key(c) +)engine=innodb; +insert into t1 +select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a +from t0 A, t0 B, t0 C, t0 D where D.a<5; +set @@global.debug_dbug="+d,ha_index_init_fail"; +explain select * from t1 where a=10 and b=10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where +select * from t1 where a=10 and b=10; +ERROR HY000: Table definition has changed, please retry transaction +DROP TABLE t0,t1; +set @@global.debug_dbug="-d"; +set @@optimizer_switch= @optimizer_switch_save; diff --git a/mysql-test/main/range_innodb.test b/mysql-test/main/range_innodb.test index 605006587cc..a17ef3f1146 100644 --- a/mysql-test/main/range_innodb.test +++ b/mysql-test/main/range_innodb.test @@ -3,6 +3,7 @@ --echo # --source include/have_innodb.inc +--source include/have_debug.inc --disable_warnings drop table if exists t0, t1, t2; @@ -62,3 +63,27 @@ INSERT INTO t2 VALUES (4,'q'),(NULL,'j'); SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2 WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 ); drop table t1,t2; + +--echo # +--echo # MDEV-14440: Server crash in in handler::ha_external_lock or Assertion `inited==RND' +--echo # failed in handler::ha_rnd_end upon SELECT from partitioned table +--echo # + +set @optimizer_switch_save= @@optimizer_switch; +set optimizer_switch='index_merge_sort_intersection=off'; +create table t0 (a int)engine=innodb; +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( + a int, b int, c int, + key(a),key(b),key(c) +)engine=innodb; +insert into t1 +select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a +from t0 A, t0 B, t0 C, t0 D where D.a<5; +set @@global.debug_dbug="+d,ha_index_init_fail"; +explain select * from t1 where a=10 and b=10; +--error ER_TABLE_DEF_CHANGED +select * from t1 where a=10 and b=10; +DROP TABLE t0,t1; +set @@global.debug_dbug="-d"; +set @@optimizer_switch= @optimizer_switch_save; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 349cba26b75..9e394cebfff 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -5289,6 +5289,7 @@ sub server_need_restart { { delete $server->{'restart_opts'}; my $use_dynamic_option_switch= 0; + delete $server->{'restart_opts'}; if (!$use_dynamic_option_switch) { mtr_verbose_restart($server, "running with different options '" . diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 180f28401ee..64ab02cd946 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -26,7 +26,6 @@ MW-416 : MDEV-13549 Galera test failures MW-388 : MDEV-13549 Galera test failures MW-44 : MDEV-15809 Test failure on galera.MW-44 galera_pc_ignore_sb : MDEV-15811 Test failure on galera_pc_ignore_sb -galera_drop_database : MDEV-17421 mtr does not restart the server whose parameters were changed galera_kill_applier : race condition at the start of the test galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read transfer status pxc-421: Lock timeout exceeded diff --git a/mysql-test/suite/galera/r/galera_drop_database.result b/mysql-test/suite/galera/r/galera_drop_database.result index 79789da5a11..86135625a71 100644 --- a/mysql-test/suite/galera/r/galera_drop_database.result +++ b/mysql-test/suite/galera/r/galera_drop_database.result @@ -1,3 +1,5 @@ +connection node_1; +connection node_2; CREATE DATABASE fts; USE fts; CREATE TABLE fts_t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB; @@ -9,6 +11,10 @@ INSERT INTO fts_t2 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3; DROP TABLE ten; UPDATE fts_t1 SET f2 = 'abcd'; UPDATE fts_t2 SET f2 = 'efjh'; +connection node_2; +connection node_1; +connection node_2; +connection node_1; USE fts; DROP TABLE fts_t1; DROP TABLE fts_t2; diff --git a/mysql-test/suite/galera/t/galera_drop_database.test b/mysql-test/suite/galera/t/galera_drop_database.test index 47fe8315198..12d9efea2f9 100644 --- a/mysql-test/suite/galera/t/galera_drop_database.test +++ b/mysql-test/suite/galera/t/galera_drop_database.test @@ -9,6 +9,7 @@ --let $node_2=node_2 --source include/auto_increment_offset_save.inc +# Create test database with two sets of the FTS indexes: CREATE DATABASE fts; USE fts; CREATE TABLE fts_t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB; @@ -23,34 +24,19 @@ DROP TABLE ten; UPDATE fts_t1 SET f2 = 'abcd'; UPDATE fts_t2 SET f2 = 'efjh'; +# Restart the second node: --connection node_2 -let $wsrep_cluster_address = `SELECT @@global.wsrep_node_incoming_address`; --source include/restart_mysqld.inc --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --source include/wait_condition.inc ---let $galera_connection_name = node_2a ---let $galera_server_number = 2 ---source include/galera_connect.inc ---connection node_2a +--connection node_2 --source include/wait_until_ready.inc +# Drop the tables and database after nodes restarted: --connection node_1 ---let $restart_parameters = --wsrep-cluster-address=gcomm://$wsrep_cluster_address ---source include/restart_mysqld.inc - ---connection node_2a ---let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; ---source include/wait_condition.inc - ---let $galera_connection_name = node_1a ---let $galera_server_number = 1 ---source include/galera_connect.inc ---connection node_1a ---source include/wait_until_ready.inc - USE fts; DROP TABLE fts_t1; DROP TABLE fts_t2; @@ -58,8 +44,4 @@ SHOW TABLES; DROP DATABASE fts; # Restore original auto_increment_offset values. ---let $node_1=node_1a ---let $node_2=node_2a --source include/auto_increment_offset_restore.inc - ---source include/galera_end.inc diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result b/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result index 25faeaf4e84..1d4766eab19 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_fk_restart.result @@ -7,9 +7,18 @@ CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY) engine=innodb; CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, fld3 INT AS (fld2) VIRTUAL, KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE) engine=innodb; +CREATE TABLE u1(a INT, KEY(a)) ENGINE=InnoDB; +CREATE TABLE u2(b INT, vb INT GENERATED ALWAYS AS(b) VIRTUAL, KEY(vb), +FOREIGN KEY(b) REFERENCES u1(a)ON DELETE CASCADE)ENGINE=InnoDB; +INSERT INTO u1 SET a=1; +INSERT INTO u2 SET b=1; INSERT INTO t1(fld1) VALUES(1); INSERT INTO t2(fld1, fld2) VALUES(1, 2); UPDATE t1 SET fld1= 2; +DELETE FROM u1; +SELECT * FROM u2; +b vb +DROP TABLE u2,u1; SELECT fld3, fld1 FROM t2; fld3 fld1 2 2 diff --git a/mysql-test/suite/gcol/r/innodb_virtual_index.result b/mysql-test/suite/gcol/r/innodb_virtual_index.result index bde9f086eac..6913ec698b4 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_index.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_index.result @@ -239,3 +239,23 @@ KEY (a(1)) INSERT INTO t1(b) VALUES(REPEAT('b',1000)); DELETE FROM t1; DROP TABLE t1; +# +# Bug #22990029 GCOLS: INCORRECT BEHAVIOR +# AFTER DATA INSERTED WITH IGNORE KEYWORD +# +CREATE TABLE t1(a INT PRIMARY KEY, b INT, vb DATE AS(b) VIRTUAL, KEY(vb)) +ENGINE=InnoDB; +INSERT IGNORE INTO t1 (a,b) VALUES(1,20190132); +Warnings: +Warning 1265 Data truncated for column 'vb' at row 1 +BEGIN; +DELETE FROM t1; +INSERT INTO t1 (a,b) VALUES(1,20190123); +ERROR 22007: Incorrect date value: '20190132' for column `test`.`t1`.`vb` at row 1 +SELECT * FROM t1; +a b vb +ROLLBACK; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test b/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test index 61d330036ea..45d1c1295a5 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_fk_restart.test @@ -11,10 +11,19 @@ CREATE TABLE t1(fld1 INT NOT NULL PRIMARY KEY) engine=innodb; CREATE TABLE t2(fld1 INT NOT NULL, fld2 INT NOT NULL, fld3 INT AS (fld2) VIRTUAL, KEY(fld1), FOREIGN KEY(fld1) REFERENCES t1(fld1) ON UPDATE CASCADE) engine=innodb; +CREATE TABLE u1(a INT, KEY(a)) ENGINE=InnoDB; +CREATE TABLE u2(b INT, vb INT GENERATED ALWAYS AS(b) VIRTUAL, KEY(vb), + FOREIGN KEY(b) REFERENCES u1(a)ON DELETE CASCADE)ENGINE=InnoDB; + +INSERT INTO u1 SET a=1; +INSERT INTO u2 SET b=1; INSERT INTO t1(fld1) VALUES(1); INSERT INTO t2(fld1, fld2) VALUES(1, 2); --source include/restart_mysqld.inc UPDATE t1 SET fld1= 2; +DELETE FROM u1; +SELECT * FROM u2; +DROP TABLE u2,u1; SELECT fld3, fld1 FROM t2; alter TABLE t2 ADD INDEX vk(fld3, fld1), ALGORITHM=INPLACE; UPDATE t1 SET fld1=3; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_index.test b/mysql-test/suite/gcol/t/innodb_virtual_index.test index 8f4e09fdf31..a89ae813b05 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_index.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_index.test @@ -263,3 +263,22 @@ CREATE TABLE t1( INSERT INTO t1(b) VALUES(REPEAT('b',1000)); DELETE FROM t1; DROP TABLE t1; + +--echo # +--echo # Bug #22990029 GCOLS: INCORRECT BEHAVIOR +--echo # AFTER DATA INSERTED WITH IGNORE KEYWORD +--echo # + +CREATE TABLE t1(a INT PRIMARY KEY, b INT, vb DATE AS(b) VIRTUAL, KEY(vb)) +ENGINE=InnoDB; +INSERT IGNORE INTO t1 (a,b) VALUES(1,20190132); +BEGIN; +DELETE FROM t1; +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 (a,b) VALUES(1,20190123); +SELECT * FROM t1; +ROLLBACK; +# MDEV-18366 FIXME: fix the crash and enable this +# SELECT * FROM t1; +CHECK TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_candidate_key.result b/mysql-test/suite/innodb/r/alter_candidate_key.result new file mode 100644 index 00000000000..23989e0da5f --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_candidate_key.result @@ -0,0 +1,114 @@ +CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL, +UNIQUE KEY uidx2(f1,f2), +UNIQUE KEY uidx1(f2)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `uidx2` (`f1`,`f2`), + UNIQUE KEY `uidx1` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter + SIGNAL conc_dml WAIT_FOR go_ahead'; +ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE; +connect con1,localhost,root,,; +SET DEBUG_SYNC = 'now WAIT_FOR conc_dml'; +DELETE FROM t1; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f11` int(11) DEFAULT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `uidx1` (`f2`), + UNIQUE KEY `uidx2` (`f11`,`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CREATE TABLE t1(f1 INT, f2 INT, +PRIMARY KEY(f1, f2), +UNIQUE INDEX uidx2 (f1, f2), +UNIQUE INDEX uidx1 (f2))ENGINE=InnoDB; +ALTER TABLE t1 DROP PRIMARY KEY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `uidx2` (`f1`,`f2`), + UNIQUE KEY `uidx1` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter + SIGNAL conc_dml WAIT_FOR go_ahead'; +ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE; +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR conc_dml'; +INSERT INTO t1 VALUES(1, 1), (1, 1); +ERROR 23000: Duplicate entry '1-1' for key 'uidx2' +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f11` int(11) DEFAULT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `uidx1` (`f2`), + UNIQUE KEY `uidx2` (`f11`,`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +SET SQL_MODE= strict_trans_tables; +CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done'; +ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL; +connection con1; +SET DEBUG_SYNC='now WAIT_FOR dml'; +BEGIN; +INSERT INTO t1 SET a=NULL; +ROLLBACK; +set DEBUG_SYNC='now SIGNAL dml_done'; +connection default; +ERROR 22004: Invalid use of NULL value +DROP TABLE t1; +disconnect con1; +SET DEBUG_SYNC="RESET"; +SET SQL_MODE=DEFAULT; +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY(f1, f2), +UNIQUE KEY(f2))ENGINE=InnoDB; +ALTER TABLE t1 DROP PRIMARY KEY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `f2` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +UNIQUE KEY(f2), UNIQUE KEY(f2))ENGINE=InnoDB; +Warnings: +Note 1831 Duplicate index `f2_2`. This is deprecated and will be disallowed in a future release +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `f2` (`f2`), + UNIQUE KEY `f2_2` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + `f2` int(11) NOT NULL, + UNIQUE KEY `f2_2` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result index 734cc41a8ea..5f4efbfe6f5 100644 --- a/mysql-test/suite/innodb/r/innodb-index.result +++ b/mysql-test/suite/innodb/r/innodb-index.result @@ -1567,6 +1567,7 @@ create table t1(f1 int not null, f2 int not null, primary key (f1), unique key(f1, f2))engine=innodb; insert into t1 values(1,3), (2,2); alter table t1 drop primary key, lock=none; +alter table t1 drop index f1, lock=none; ERROR 0A000: LOCK=NONE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try LOCK=SHARED drop table t1; # diff --git a/mysql-test/suite/innodb/r/innodb-table-online.result b/mysql-test/suite/innodb/r/innodb-table-online.result index 5b5c4d6b9e1..ce2b81242db 100644 --- a/mysql-test/suite/innodb/r/innodb-table-online.result +++ b/mysql-test/suite/innodb/r/innodb-table-online.result @@ -99,17 +99,6 @@ t1 CREATE TABLE `t1` ( UNIQUE KEY `c2` (`c2`), UNIQUE KEY `c2_2` (`c2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT -ALTER TABLE t1 DROP INDEX c2, ALGORITHM = INPLACE; -ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try ALGORITHM=COPY -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) NOT NULL, - `c2` int(11) NOT NULL, - `c3` char(255) NOT NULL, - UNIQUE KEY `c2` (`c2`), - UNIQUE KEY `c2_2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1); # session default connection default; diff --git a/mysql-test/suite/innodb/r/innodb_28867993.result b/mysql-test/suite/innodb/r/innodb_28867993.result new file mode 100644 index 00000000000..acc6734eaee --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_28867993.result @@ -0,0 +1,9 @@ +create table t1 (a int) engine=innodb; +insert t1 values (1),(2); +create database ib_logfile2; +select * from t1; +a +1 +2 +drop table t1; +drop database ib_logfile2; diff --git a/mysql-test/suite/innodb/t/alter_candidate_key.test b/mysql-test/suite/innodb/t/alter_candidate_key.test new file mode 100644 index 00000000000..7429cd89a1a --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_candidate_key.test @@ -0,0 +1,72 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL, + UNIQUE KEY uidx2(f1,f2), + UNIQUE KEY uidx1(f2)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1); +SHOW CREATE TABLE t1; +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter + SIGNAL conc_dml WAIT_FOR go_ahead'; +--send ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE +connect (con1,localhost,root,,); +SET DEBUG_SYNC = 'now WAIT_FOR conc_dml'; +DELETE FROM t1; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +reap; +SHOW CREATE TABLE t1; +CHECK TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1(f1 INT, f2 INT, + PRIMARY KEY(f1, f2), + UNIQUE INDEX uidx2 (f1, f2), + UNIQUE INDEX uidx1 (f2))ENGINE=InnoDB; +ALTER TABLE t1 DROP PRIMARY KEY; +SHOW CREATE TABLE t1; +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter + SIGNAL conc_dml WAIT_FOR go_ahead'; +--send ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR conc_dml'; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES(1, 1), (1, 1); +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +reap; +SHOW CREATE TABLE t1; +CHECK TABLE t1; +DROP TABLE t1; + +SET SQL_MODE= strict_trans_tables; +CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB; +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done'; +--send ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL +connection con1; +SET DEBUG_SYNC='now WAIT_FOR dml'; +BEGIN; +INSERT INTO t1 SET a=NULL; +ROLLBACK; +set DEBUG_SYNC='now SIGNAL dml_done'; +connection default; +--error ER_INVALID_USE_OF_NULL +reap; +DROP TABLE t1; +disconnect con1; +SET DEBUG_SYNC="RESET"; +SET SQL_MODE=DEFAULT; + +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY(f1, f2), + UNIQUE KEY(f2))ENGINE=InnoDB; +ALTER TABLE t1 DROP PRIMARY KEY; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, + UNIQUE KEY(f2), UNIQUE KEY(f2))ENGINE=InnoDB; +SHOW CREATE TABLE t1; +ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE; +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test index 53f87cb78d5..bfbe62699fd 100644 --- a/mysql-test/suite/innodb/t/innodb-index.test +++ b/mysql-test/suite/innodb/t/innodb-index.test @@ -905,8 +905,9 @@ drop table t1; create table t1(f1 int not null, f2 int not null, primary key (f1), unique key(f1, f2))engine=innodb; insert into t1 values(1,3), (2,2); ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON alter table t1 drop primary key, lock=none; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +alter table t1 drop index f1, lock=none; drop table t1; --echo # diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test index edf83247142..2b3879bc707 100644 --- a/mysql-test/suite/innodb/t/innodb-table-online.test +++ b/mysql-test/suite/innodb/t/innodb-table-online.test @@ -102,10 +102,6 @@ ALTER TABLE t1 ADD UNIQUE INDEX(c2), LOCK = EXCLUSIVE, ALGORITHM = INPLACE; SHOW CREATE TABLE t1; -# We do not support plain DROP_PK_INDEX without ADD_PK_INDEX. ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -ALTER TABLE t1 DROP INDEX c2, ALGORITHM = INPLACE; -SHOW CREATE TABLE t1; # Now the previous DEBUG_SYNC should kick in. --send ALTER TABLE t1 DROP INDEX c2, ADD PRIMARY KEY(c1); diff --git a/mysql-test/suite/innodb/t/innodb_28867993.test b/mysql-test/suite/innodb/t/innodb_28867993.test new file mode 100644 index 00000000000..61e9578df7b --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_28867993.test @@ -0,0 +1,12 @@ +# +# Bug#28867993: POSSIBLE ISSUE WITH MYSQL SERVER RESTART +# + +source include/have_innodb.inc; +create table t1 (a int) engine=innodb; +insert t1 values (1),(2); +create database ib_logfile2; +source include/restart_mysqld.inc; +select * from t1; +drop table t1; +drop database ib_logfile2; diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff b/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff new file mode 100644 index 00000000000..0849c5dcf64 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff @@ -0,0 +1,31 @@ +--- r/rpl_row_big_table_id.result 2019-01-23 19:58:07.204914873 +0200 ++++ r/rpl_row_big_table_id_32bit.result 2019-01-23 19:43:54.590640934 +0200 +@@ -22,22 +22,22 @@ + master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' + master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# + master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 1 +-master-bin.000002 # Table_map 1 # table_id: 4294967295 (test.t) +-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F ++master-bin.000002 # Table_map 1 # table_id: 1 (test.t) ++master-bin.000002 # Write_rows_v1 1 # table_id: 1 flags: STMT_END_F + master-bin.000002 # Query 1 # COMMIT + master-bin.000002 # Gtid 1 # GTID #-#-# + master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' + master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# + master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 2 +-master-bin.000002 # Table_map 1 # table_id: 4294967296 (test.t) +-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F ++master-bin.000002 # Table_map 1 # table_id: 2 (test.t) ++master-bin.000002 # Write_rows_v1 1 # table_id: 2 flags: STMT_END_F + master-bin.000002 # Query 1 # COMMIT + master-bin.000002 # Gtid 1 # GTID #-#-# + master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' + master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# + master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 3 +-master-bin.000002 # Table_map 1 # table_id: 4294967297 (test.t) +-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F ++master-bin.000002 # Table_map 1 # table_id: 3 (test.t) ++master-bin.000002 # Write_rows_v1 1 # table_id: 3 flags: STMT_END_F + master-bin.000002 # Query 1 # COMMIT + connection slave; + connection master; diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id.result b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result new file mode 100644 index 00000000000..6fece52dda3 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id.result @@ -0,0 +1,46 @@ +include/master-slave.inc +[connection master] +connection master; +include/rpl_restart_server.inc [server_number=1] +SET @@debug_dbug="d,simulate_big_table_id"; +CREATE TABLE t (a int); +INSERT INTO t SET a= 0; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 1; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 2; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 3; +show binlog events in <file> from <pos>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 0 +master-bin.000002 # Table_map 1 # table_id: 4294967294 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Gtid 1 # GTID #-#-# +master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 1 +master-bin.000002 # Table_map 1 # table_id: 4294967295 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Gtid 1 # GTID #-#-# +master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 2 +master-bin.000002 # Table_map 1 # table_id: 4294967296 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +master-bin.000002 # Gtid 1 # GTID #-#-# +master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment '' +master-bin.000002 # Gtid 1 # BEGIN GTID #-#-# +master-bin.000002 # Annotate_rows 1 # INSERT INTO t SET a= 3 +master-bin.000002 # Table_map 1 # table_id: 4294967297 (test.t) +master-bin.000002 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F +master-bin.000002 # Query 1 # COMMIT +connection slave; +connection master; +DROP TABLE t; +connection slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_big_table_id.test b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test new file mode 100644 index 00000000000..0c6f9d5e862 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_big_table_id.test @@ -0,0 +1,57 @@ +################################################################## +# rpl_row_big_table_id +# +# MDEV-17803 Row-based event is not applied when +# table map id is greater 32 bit int +# +# Verify row-based events applying when table map id value is about and greater +# than 1 << 32. +################################################################## +--source include/word_size.inc +--source include/have_debug.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--connection master +# To reset last table id +--let $rpl_server_number= 1 +--source include/rpl_restart_server.inc + +SET @@debug_dbug="d,simulate_big_table_id"; +CREATE TABLE t (a int); + +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--let $binlog_pos= query_get_value(SHOW MASTER STATUS, Position, 1) +INSERT INTO t SET a= 0; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 1; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 2; +ALTER TABLE t comment ''; +INSERT INTO t SET a= 3; + +# display simulated big table_id +--let $_in_from=in '$binlog_file' from $binlog_pos +--replace_result "$_in_from" "in <file> from <pos>" +--replace_column 2 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /file_id=[0-9]+/file_id=#/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ +--eval show binlog events in '$binlog_file' from $binlog_pos + + +--sync_slave_with_master + +if (`SELECT sum(a) != 6 FROM t`) +{ + --echo *** unexpected result; check slave applier *** + --die +} + + +# Cleanup + +--connection master +DROP TABLE t; + +--sync_slave_with_master + +--source include/rpl_end.inc diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index bc632b46bfc..2253bb8763d 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -91,6 +91,9 @@ DATA="${WSREP_SST_OPT_DATA}" INFO_FILE="xtrabackup_galera_info" IST_FILE="xtrabackup_ist" MAGIC_FILE="${DATA}/${INFO_FILE}" +INNOAPPLYLOG="${DATA}/mariabackup.prepare.log" +INNOMOVELOG="${DATA}/mariabackup.move.log" +INNOBACKUPLOG="${DATA}/mariabackup.backup.log" # Setting the path for ss and ip export PATH="/usr/sbin:/sbin:$PATH" @@ -352,6 +355,8 @@ read_cnf() ssyslog=$(parse_cnf sst sst-syslog 0) ssystag=$(parse_cnf mysqld_safe syslog-tag "${SST_SYSLOG_TAG:-}") ssystag+="-" + sstlogarchive=$(parse_cnf sst sst-log-archive 1) + sstlogarchivedir=$(parse_cnf sst sst-log-archive-dir "/tmp/sst_log_archive") if [[ $speciald -eq 0 ]];then wsrep_log_error "sst-special-dirs equal to 0 is not supported, falling back to 1" @@ -744,10 +749,71 @@ if [[ $ssyslog -eq 1 ]];then INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)" fi -else - INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts \$INNOEXTRA --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log" +else + +if [[ "$sstlogarchive" -eq 1 ]] +then + ARCHIVETIMESTAMP=$(date "+%Y.%m.%d-%H.%M.%S") + newfile="" + + if [[ ! -z "$sstlogarchivedir" ]] + then + if [[ ! -d "$sstlogarchivedir" ]] + then + mkdir -p "$sstlogarchivedir" + fi + fi + + if [ -e "${INNOAPPLYLOG}" ] + then + if [[ ! -z "$sstlogarchivedir" ]] + then + newfile=$sstlogarchivedir/$(basename "${INNOAPPLYLOG}").${ARCHIVETIMESTAMP} + else + newfile=${INNOAPPLYLOG}.${ARCHIVETIMESTAMP} + fi + + wsrep_log_info "Moving ${INNOAPPLYLOG} to ${newfile}" + mv "${INNOAPPLYLOG}" "${newfile}" + gzip "${newfile}" + fi + + if [ -e "${INNOMOVELOG}" ] + then + if [[ ! -z "$sstlogarchivedir" ]] + then + newfile=$sstlogarchivedir/$(basename "${INNOMOVELOG}").${ARCHIVETIMESTAMP} + else + newfile=${INNOMOVELOG}.${ARCHIVETIMESTAMP} + fi + + wsrep_log_info "Moving ${INNOMOVELOG} to ${newfile}" + mv "${INNOMOVELOG}" "${newfile}" + gzip "${newfile}" + fi + + if [ -e "${INNOBACKUPLOG}" ] + then + if [[ ! -z "$sstlogarchivedir" ]] + then + newfile=$sstlogarchivedir/$(basename "${INNOBACKUPLOG}").${ARCHIVETIMESTAMP} + else + newfile=${INNOBACKUPLOG}.${ARCHIVETIMESTAMP} + fi + + wsrep_log_info "Moving ${INNOBACKUPLOG} to ${newfile}" + mv "${INNOBACKUPLOG}" "${newfile}" + gzip "${newfile}" + fi + +fi + INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log" INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log" + + INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts \$INNOEXTRA --apply-log \$rebuildcmd \${DATA} &> ${INNOAPPLYLOG}" + INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &> ${INNOMOVELOG}" + INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> ${INNOBACKUPLOG}" fi get_stream @@ -844,7 +910,7 @@ then if [ ${RC[0]} -ne 0 ]; then wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \ - "Check ${DATA}/innobackup.backup.log" + "Check syslog or ${INNOBACKUPLOG} for details" exit 22 elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then wsrep_log_error "$tcmd finished with error: ${RC[1]}" @@ -1073,13 +1139,12 @@ then if [ $? -ne 0 ]; then - wsrep_log_error "${INNOBACKUPEX_BIN} apply finished with errors. Check ${DATA}/innobackup.prepare.log" + wsrep_log_error "${INNOBACKUPEX_BIN} apply finished with errors. Check syslog or ${INNOAPPLYLOG} for details" exit 22 fi MAGIC_FILE="${TDATA}/${INFO_FILE}" set +e - rm $TDATA/innobackup.prepare.log $TDATA/innobackup.move.log set -e wsrep_log_info "Moving the backup to ${TDATA}" timeit "Xtrabackup move stage" "$INNOMOVE" @@ -1089,7 +1154,7 @@ then DATA=${TDATA} else wsrep_log_error "Move failed, keeping ${DATA} for further diagnosis" - wsrep_log_error "Check ${DATA}/innobackup.move.log for details" + wsrep_log_error "Check syslog or ${INNOMOVELOG} for details" exit 22 fi diff --git a/sql/log_event.cc b/sql/log_event.cc index 72db2717680..f16abb13003 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2009, 2018, MariaDB + Copyright (c) 2009, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12634,7 +12634,7 @@ int Table_map_log_event::do_apply_event(rpl_group_info *rgi) table_list->updating= 1; table_list->required_type= TABLE_TYPE_NORMAL; - DBUG_PRINT("debug", ("table: %s is mapped to %u", + DBUG_PRINT("debug", ("table: %s is mapped to %lu", table_list->table_name.str, table_list->table_id)); table_list->master_had_triggers= ((m_flags & TM_BIT_HAS_TRIGGERS_F) ? 1 : 0); diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 26cda75913a..2ea632675a3 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1562,6 +1562,7 @@ failure: head->column_bitmaps_set(save_read_set, save_write_set, save_vcol_set); delete file; file= save_file; + free_file= false; DBUG_RETURN(1); } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 126b1f2304c..b36db5040ac 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1492,8 +1492,7 @@ static bool fix_user_plugin_ptr(ACL_USER *user) else return true; - if (user->auth_string.length) - set_user_salt(user, user->auth_string.str, user->auth_string.length); + set_user_salt(user, user->auth_string.str, user->auth_string.length); return false; } @@ -1968,6 +1967,11 @@ static bool acl_load(THD *thd, const Grant_tables& tables) safe_str(user.user.str), safe_str(user.host.hostname)); } + else if (password_len) + { + user.auth_string.str= password; + user.auth_string.length= password_len; + } fix_user_plugin_ptr(&user); } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 490c95277f1..018d9d3021a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -6801,6 +6801,12 @@ static bool fill_alter_inplace_info(THD *thd, KEY *new_key; KEY *new_key_end= ha_alter_info->key_info_buffer + ha_alter_info->key_count; + /* + Primary key index for the new table + */ + const KEY* const new_pk= (ha_alter_info->key_count > 0 && + is_candidate_key(ha_alter_info->key_info_buffer)) ? + ha_alter_info->key_info_buffer : NULL; DBUG_PRINT("info", ("index count old: %d new: %d", table->s->keys, ha_alter_info->key_count)); @@ -6877,6 +6883,16 @@ static bool fill_alter_inplace_info(THD *thd, goto index_changed; } + /* + Rebuild the index if following condition get satisfied: + + (i) Old table doesn't have primary key, new table has it and vice-versa + (ii) Primary key changed to another existing index + */ + if ((new_key == new_pk) != + ((uint) (table_key - table->key_info) == table->s->primary_key)) + goto index_changed; + /* Check that key comment is not changed. */ if (table_key->comment.length != new_key->comment.length || (table_key->comment.length && diff --git a/sql/table.cc b/sql/table.cc index 096711f851c..a44e0fcc0a5 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -338,6 +338,9 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name, mysql_mutex_init(key_TABLE_SHARE_LOCK_ha_data, &share->LOCK_ha_data, MY_MUTEX_INIT_FAST); + DBUG_EXECUTE_IF("simulate_big_table_id", + if (last_table_id < UINT_MAX32) + last_table_id= UINT_MAX32 - 1;); /* There is one reserved number that cannot be used. Remember to change this when 6-byte global table id's are introduced. @@ -346,7 +349,8 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name, { share->table_map_id=(ulong) my_atomic_add64_explicit(&last_table_id, 1, MY_MEMORY_ORDER_RELAXED); - } while (unlikely(share->table_map_id == ~0UL)); + } while (unlikely(share->table_map_id == ~0UL || + share->table_map_id == 0)); } DBUG_RETURN(share); } diff --git a/sql/table.h b/sql/table.h index 7236fb91b0f..f33f5e048c2 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, 2018, MariaDB + Copyright (c) 2009, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2082,7 +2082,7 @@ struct TABLE_LIST /* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */ List<Index_hint> *index_hints; TABLE *table; /* opened table */ - uint table_id; /* table id (from binlog) for opened table */ + ulong table_id; /* table id (from binlog) for opened table */ /* select_result for derived table to pass it from table creation to table filling procedure diff --git a/sql/unireg.h b/sql/unireg.h index 88d0c882824..8d07e5940a3 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -198,7 +198,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table, #define FRM_HEADER_SIZE 64 #define FRM_FORMINFO_SIZE 288 -#define FRM_MAX_SIZE (512*1024) +#define FRM_MAX_SIZE (1024*1024) static inline bool is_binary_frm_header(uchar *head) { diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index c6f6455be73..d123ed8db03 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, 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 @@ -7020,32 +7020,16 @@ UNIV_INTERN ulint dict_sys_get_size() { - ulint size = 0; - - ut_ad(dict_sys); - - mutex_enter(&dict_sys->mutex); - - for(ulint i = 0; i < hash_get_n_cells(dict_sys->table_hash); i++) { - dict_table_t* table; - - for (table = static_cast<dict_table_t*>(HASH_GET_FIRST(dict_sys->table_hash,i)); - table != NULL; - table = static_cast<dict_table_t*>(HASH_GET_NEXT(name_hash, table))) { - dict_index_t* index; - size += mem_heap_get_size(table->heap) + strlen(table->name.m_name) +1; - - for(index = dict_table_get_first_index(table); - index != NULL; - index = dict_table_get_next_index(index)) { - size += mem_heap_get_size(index->heap); - } - } - } - - mutex_exit(&dict_sys->mutex); - - return (size); + /* No mutex; this is a very crude approximation anyway */ + ulint size = UT_LIST_GET_LEN(dict_sys->table_LRU) + + UT_LIST_GET_LEN(dict_sys->table_non_LRU); + size *= sizeof(dict_table_t) + + sizeof(dict_index_t) * 2 + + (sizeof(dict_col_t) + sizeof(dict_field_t)) * 10 + + sizeof(dict_field_t) * 5 /* total number of key fields */ + + 200; /* arbitrary, covering names and overhead */ + + return size; } /** Look for any dictionary objects that are found in the given tablespace. diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 0c2ee5203cf..a0630a74bd4 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2018, MariaDB Corporation. +Copyright (c) 2014, 2019, 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 @@ -778,10 +778,9 @@ fil_try_to_close_file_in_LRU( } /** Flush any writes cached by the file system. -@param[in,out] space tablespace */ -static -void -fil_flush_low(fil_space_t* space) +@param[in,out] space tablespace +@param[in] metadata whether to update file system metadata */ +static void fil_flush_low(fil_space_t* space, bool metadata = false) { ut_ad(mutex_own(&fil_system.mutex)); ut_ad(space); @@ -805,7 +804,7 @@ fil_flush_low(fil_space_t* space) } #endif /* UNIV_DEBUG */ - return; + if (!metadata) return; } /* Prevent dropping of the space while we are flushing */ @@ -982,6 +981,7 @@ fil_space_extend_must_retry( os_has_said_disk_full = *success; if (*success) { + os_file_flush(node->handle); last_page_no = size; } else { /* Let us measure the size of the file @@ -1013,14 +1013,14 @@ fil_space_extend_must_retry( switch (space->id) { case TRX_SYS_SPACE: srv_sys_space.set_last_file_size(pages_in_MiB); - fil_flush_low(space); + fil_flush_low(space, true); return(false); default: ut_ad(space->purpose == FIL_TYPE_TABLESPACE || space->purpose == FIL_TYPE_IMPORT); if (space->purpose == FIL_TYPE_TABLESPACE && !space->is_being_truncated) { - fil_flush_low(space); + fil_flush_low(space, true); } return(false); case SRV_TMP_SPACE_ID: diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index caaffa201e9..0311b0400e6 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4338,17 +4338,19 @@ innobase_end(handlerton*, ha_panic_function) } } - st_my_thread_var* running = reinterpret_cast<st_my_thread_var*>( + st_my_thread_var* r = reinterpret_cast<st_my_thread_var*>( my_atomic_loadptr_explicit( reinterpret_cast<void**>(&srv_running), MY_MEMORY_ORDER_RELAXED)); - if (!abort_loop && running) { - // may be UNINSTALL PLUGIN statement - running->abort = 1; - mysql_cond_broadcast(running->current_cond); - } - - if (!srv_read_only_mode) { + if (r) { + ut_ad(!srv_read_only_mode); + if (!abort_loop) { + // may be UNINSTALL PLUGIN statement + mysql_mutex_lock(r->current_mutex); + r->abort = 1; + mysql_cond_broadcast(r->current_cond); + mysql_mutex_unlock(r->current_mutex); + } pthread_join(thd_destructor_thread, NULL); } diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 8a7074573c2..ef2a505085b 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -680,8 +680,7 @@ struct dict_v_col_t{ ulint v_pos; /** Virtual index list, and column position in the index, - the allocated memory is not from table->heap, nor it is - tracked by dict_sys->size */ + the allocated memory is not from table->heap */ dict_v_idx_list* v_indexes; }; @@ -1577,15 +1576,7 @@ struct dict_table_t { /** Hash chain node. */ hash_node_t name_hash; - /** Memory heap. If you allocate from this heap after the table has - been created then be sure to account the allocation into - dict_sys->size. When closing the table we do something like - dict_sys->size -= mem_heap_get_size(table->heap) and if that is going - to become negative then we would assert. Something like this should do: - old_size = mem_heap_get_size() - mem_heap_alloc() - new_size = mem_heap_get_size() - dict_sys->size += new_size - old_size. */ + /** Memory heap */ mem_heap_t* heap; /** NULL or the directory path specified by DATA DIRECTORY. */ diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h index 742f897f3ec..12ea3e0f69a 100644 --- a/storage/innobase/include/row0upd.h +++ b/storage/innobase/include/row0upd.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2017, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -219,6 +219,7 @@ the equal ordering fields. NOTE: we compare the fields as binary strings! @param[in] heap memory heap from which allocated @param[in,out] mysql_table NULL, or mysql table object when user thread invokes dml +@param[out] error error number in case of failure @return own: update vector of differing fields, excluding roll ptr and trx id */ upd_t* @@ -230,8 +231,9 @@ row_upd_build_difference_binary( bool no_sys, trx_t* trx, mem_heap_t* heap, - TABLE* mysql_table) - MY_ATTRIBUTE((nonnull(1,2,3,7), warn_unused_result)); + TABLE* mysql_table, + dberr_t* error) + MY_ATTRIBUTE((nonnull(1,2,3,7,9), warn_unused_result)); /** Apply an update vector to an index entry. @param[in,out] entry index entry to be updated; the clustered index record must be covered by a lock or a page latch to prevent diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index f878387e17f..549394c80de 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -39,10 +39,6 @@ Created 1/20/1994 Heikki Tuuri #define _IB_TO_STR(s) #s #define IB_TO_STR(s) _IB_TO_STR(s) -#define INNODB_VERSION_MAJOR 5 -#define INNODB_VERSION_MINOR 7 -#define INNODB_VERSION_BUGFIX 24 - /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; calculated in make_version_string() in sql/sql_show.cc like this: diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 523475d56c8..82f792ad0fa 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Percona Inc.. Those modifications are @@ -1762,6 +1762,8 @@ LinuxAIOHandler::resubmit(Slot* slot) slot->n_bytes = 0; slot->io_already_done = false; + compile_time_assert(sizeof(off_t) >= sizeof(os_offset_t)); + struct iocb* iocb = &slot->control; if (slot->type.is_read()) { @@ -1771,7 +1773,7 @@ LinuxAIOHandler::resubmit(Slot* slot) slot->file, slot->ptr, slot->len, - static_cast<off_t>(slot->offset)); + slot->offset); } else { ut_a(slot->type.is_write()); @@ -1781,7 +1783,7 @@ LinuxAIOHandler::resubmit(Slot* slot) slot->file, slot->ptr, slot->len, - static_cast<off_t>(slot->offset)); + slot->offset); } iocb->data = slot; @@ -6260,7 +6262,7 @@ AIO::reserve_slot( #ifdef _WIN32 slot->len = static_cast<DWORD>(len); #else - slot->len = static_cast<ulint>(len); + slot->len = len; #endif /* _WIN32 */ slot->type = type; slot->buf = static_cast<byte*>(buf); diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index bf454fbb505..406cf7fa689 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -328,7 +328,7 @@ row_ins_clust_index_entry_by_modify( { const rec_t* rec; upd_t* update; - dberr_t err; + dberr_t err = DB_SUCCESS; btr_cur_t* cursor = btr_pcur_get_btr_cur(pcur); TABLE* mysql_table = NULL; ut_ad(dict_index_is_clust(cursor->index)); @@ -351,7 +351,11 @@ row_ins_clust_index_entry_by_modify( update = row_upd_build_difference_binary( cursor->index, entry, rec, NULL, true, - thr_get_trx(thr), heap, mysql_table); + thr_get_trx(thr), heap, mysql_table, &err); + if (err != DB_SUCCESS) { + return(err); + } + if (mode != BTR_MODIFY_TREE) { ut_ad((mode & ulint(~BTR_ALREADY_S_LATCHED)) == BTR_MODIFY_LEAF); @@ -962,11 +966,11 @@ row_ins_foreign_fill_virtual( if (innobase_allocate_row_for_vcol(thd, index, &v_heap, &mysql_table, - &record, &vcol_storage)) - { + &record, &vcol_storage)) { + if (v_heap) mem_heap_free(v_heap); *err = DB_OUT_OF_MEMORY; - goto func_exit; - } + goto func_exit; + } for (ulint i = 0; i < n_v_fld; i++) { diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 3ad4aff8b24..6594340a529 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -2232,7 +2232,10 @@ func_exit_committed: row, NULL, index, heap, ROW_BUILD_NORMAL); upd_t* update = row_upd_build_difference_binary( index, entry, btr_pcur_get_rec(&pcur), cur_offsets, - false, NULL, heap, dup->table); + false, NULL, heap, dup->table, &error); + if (error != DB_SUCCESS) { + goto func_exit; + } if (!update->n_fields) { /* Nothing to do. */ diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index a60694c6613..93a5d80035a 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -1034,8 +1034,9 @@ the equal ordering fields. NOTE: we compare the fields as binary strings! @param[in] heap memory heap from which allocated @param[in] mysql_table NULL, or mysql table object when user thread invokes dml +@param[out] error error number in case of failure @return own: update vector of differing fields, excluding roll ptr and -trx id */ +trx id,if error is not equal to DB_SUCCESS, return NULL */ upd_t* row_upd_build_difference_binary( dict_index_t* index, @@ -1045,7 +1046,8 @@ row_upd_build_difference_binary( bool no_sys, trx_t* trx, mem_heap_t* heap, - TABLE* mysql_table) + TABLE* mysql_table, + dberr_t* error) { upd_field_t* upd_field; dfield_t* dfield; @@ -1156,6 +1158,11 @@ row_upd_build_difference_binary( update->old_vrow, col, index, &v_heap, heap, NULL, thd, mysql_table, record, NULL, NULL, NULL); + if (vfield == NULL) { + if (v_heap) mem_heap_free(v_heap); + *error = DB_COMPUTE_VALUE_FAILED; + return(NULL); + } if (!dfield_data_is_binary_equal( dfield, vfield->len, diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 312bf9abb84..8f60a2999c1 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -3,7 +3,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index a2c9828bfee..9faf1509c10 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1730,6 +1730,10 @@ dberr_t srv_start(bool create_new_db) break; } + if (stat_info.type != OS_FILE_TYPE_FILE) { + break; + } + if (!srv_file_check_mode(logfilename)) { return(srv_init_abort(DB_ERROR)); } |