summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/os/Windows.cmake2
-rw-r--r--dbug/dbug.c3
-rw-r--r--debian/additions/my.cnf2
m---------libmariadb0
-rw-r--r--mysql-test/collections/10.0-compatible.list1
-rw-r--r--mysql-test/main/ctype_many.result1
-rw-r--r--mysql-test/main/ctype_many.test2
-rw-r--r--mysql-test/main/ctype_utf32.result2
-rw-r--r--mysql-test/main/func_math.result1300
-rw-r--r--mysql-test/main/func_math.test735
-rw-r--r--mysql-test/main/func_str.result6
-rw-r--r--mysql-test/main/information_schema_db.result79
-rw-r--r--mysql-test/main/information_schema_db.test44
-rw-r--r--mysql-test/main/partition_innodb.result24
-rw-r--r--mysql-test/main/partition_innodb.test20
-rw-r--r--mysql-test/main/partition_ucs2.result13
-rw-r--r--mysql-test/main/partition_ucs2.test19
-rw-r--r--mysql-test/main/partition_utf8.result16
-rw-r--r--mysql-test/main/partition_utf8.test22
-rw-r--r--mysql-test/main/processlist.result3
-rw-r--r--mysql-test/main/processlist.test4
-rw-r--r--mysql-test/main/processlist_notembedded.result12
-rw-r--r--mysql-test/main/processlist_notembedded.test34
-rw-r--r--mysql-test/main/subselect_sj.result26
-rw-r--r--mysql-test/main/subselect_sj.test26
-rw-r--r--mysql-test/main/subselect_sj_jcl6.result26
-rw-r--r--mysql-test/suite/binlog/r/backup.result21
-rw-r--r--mysql-test/suite/binlog/r/read_only.result129
-rw-r--r--mysql-test/suite/binlog/r/read_only_statement.result129
-rw-r--r--mysql-test/suite/binlog/t/backup.test19
-rw-r--r--mysql-test/suite/binlog/t/read_only.inc79
-rw-r--r--mysql-test/suite/binlog/t/read_only.test2
-rw-r--r--mysql-test/suite/binlog/t/read_only_statement.test2
-rw-r--r--mysql-test/suite/funcs_1/r/is_basics_mixed.result2
-rw-r--r--mysql-test/suite/funcs_1/t/is_basics_mixed.test5
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff14
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff13
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff13
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm.result4
-rw-r--r--mysql-test/suite/innodb/r/ibuf_not_empty.result2
-rw-r--r--mysql-test/suite/innodb/r/information_schema_grants.result304
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-nullable.result19
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc.result24
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_persistent.result29
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_bugs.result15
-rw-r--r--mysql-test/suite/innodb/r/stat_tables.result15
-rw-r--r--mysql-test/suite/innodb/t/alter_algorithm.test4
-rw-r--r--mysql-test/suite/innodb/t/ibuf_not_empty.test2
-rw-r--r--mysql-test/suite/innodb/t/information_schema_grants.opt33
-rw-r--r--mysql-test/suite/innodb/t/information_schema_grants.test311
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-nullable.test3
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_persistent.test30
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_bugs.test19
-rw-r--r--mysql-test/suite/innodb/t/stat_tables.test17
-rw-r--r--mysql-test/suite/innodb_fts/r/crash_recovery.result44
-rw-r--r--mysql-test/suite/innodb_fts/t/crash_recovery.test55
-rw-r--r--mysql-test/suite/maria/lock.result33
-rw-r--r--mysql-test/suite/maria/lock.test46
-rw-r--r--mysql-test/suite/rpl/r/rpl_read_only2.result54
-rw-r--r--mysql-test/suite/rpl/t/rpl_read_only2.test30
-rw-r--r--mysql-test/suite/sql_sequence/other.result91
-rw-r--r--mysql-test/suite/sql_sequence/other.test136
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result12
-rw-r--r--mysql-test/suite/vcol/r/vcol_keys_innodb.result15
-rw-r--r--mysql-test/suite/vcol/t/vcol_keys_innodb.opt1
-rw-r--r--mysql-test/suite/vcol/t/vcol_keys_innodb.test18
-rw-r--r--mysql-test/suite/versioning/r/foreign.result29
-rw-r--r--mysql-test/suite/versioning/t/foreign.test32
-rw-r--r--mysql-test/suite/wsrep/r/variables.result25
-rw-r--r--mysql-test/suite/wsrep/t/variables.test15
-rw-r--r--mysql-test/unstable-tests400
-rw-r--r--scripts/mysql_secure_installation.sh2
-rw-r--r--scripts/mysqlaccess.sh2
-rw-r--r--sql/backup.cc8
-rw-r--r--sql/ha_partition.cc24
-rw-r--r--sql/ha_partition.h13
-rw-r--r--sql/item_strfunc.cc13
-rw-r--r--sql/keycaches.cc15
-rw-r--r--sql/keycaches.h7
-rw-r--r--sql/log.cc9
-rw-r--r--sql/mysqld.cc5
-rw-r--r--sql/opt_subselect.cc12
-rw-r--r--sql/rpl_rli.cc2
-rw-r--r--sql/semisync_master.cc2
-rw-r--r--sql/service_wsrep.cc21
-rw-r--r--sql/sp.cc2
-rw-r--r--sql/sp_head.cc6
-rw-r--r--sql/sql_acl.cc4
-rw-r--r--sql/sql_admin.cc6
-rw-r--r--sql/sql_base.cc28
-rw-r--r--sql/sql_class.cc104
-rw-r--r--sql/sql_class.h25
-rw-r--r--sql/sql_delete.cc4
-rw-r--r--sql/sql_insert.cc56
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_lex.h12
-rw-r--r--sql/sql_load.cc2
-rw-r--r--sql/sql_parse.cc51
-rw-r--r--sql/sql_prepare.cc4
-rw-r--r--sql/sql_show.cc12
-rw-r--r--sql/sql_statistics.cc10
-rw-r--r--sql/sql_table.cc54
-rw-r--r--sql/sql_type.cc45
-rw-r--r--sql/sql_type.h16
-rw-r--r--sql/sql_update.cc4
-rw-r--r--sql/sql_view.cc15
-rw-r--r--sql/sql_yacc.yy16
-rw-r--r--sql/sql_yacc_ora.yy16
-rw-r--r--sql/table.cc11
-rw-r--r--sql/table.h11
-rw-r--r--sql/wsrep_binlog.cc4
-rw-r--r--sql/wsrep_client_service.cc6
-rw-r--r--sql/wsrep_client_service.h2
-rw-r--r--sql/wsrep_dummy.cc2
-rw-r--r--sql/wsrep_high_priority_service.cc9
-rw-r--r--sql/wsrep_high_priority_service.h4
-rw-r--r--sql/wsrep_mysqld.cc26
-rw-r--r--sql/wsrep_storage_service.cc3
-rw-r--r--sql/wsrep_storage_service.h3
-rw-r--r--storage/connect/CMakeLists.txt7
-rw-r--r--storage/connect/connect.cc5
-rw-r--r--storage/connect/ha_connect.cc35
-rw-r--r--storage/connect/inihandl.cpp2
-rw-r--r--storage/connect/jdbconn.cpp11
-rw-r--r--storage/connect/mysql-test/connect/r/grant.result174
-rw-r--r--storage/connect/mysql-test/connect/r/grant2.result258
-rw-r--r--storage/connect/mysql-test/connect/r/ini_grant.result26
-rw-r--r--storage/connect/mysql-test/connect/r/mysql_grant.result24
-rw-r--r--storage/connect/mysql-test/connect/r/xml2_grant.result30
-rw-r--r--storage/connect/mysql-test/connect/r/xml_grant.result30
-rw-r--r--storage/connect/mysql-test/connect/t/grant.inc30
-rw-r--r--storage/connect/mysql-test/connect/t/grant.test24
-rw-r--r--storage/connect/mysql-test/connect/t/grant2.test260
-rw-r--r--storage/connect/mysql-test/connect/t/ini_grant.test26
-rw-r--r--storage/connect/mysql-test/connect/t/mysql_grant.test24
-rw-r--r--storage/connect/rest.h33
-rw-r--r--storage/connect/tabodbc.cpp6
-rw-r--r--storage/connect/valblk.cpp4
-rw-r--r--storage/connect/value.cpp583
-rw-r--r--storage/heap/ha_heap.cc4
-rw-r--r--storage/heap/hp_close.c6
-rw-r--r--storage/innobase/.clang-format11
-rw-r--r--storage/innobase/btr/btr0bulk.cc30
-rw-r--r--storage/innobase/btr/btr0cur.cc24
-rw-r--r--storage/innobase/dict/dict0load.cc9
-rw-r--r--storage/innobase/fil/fil0crypt.cc25
-rw-r--r--storage/innobase/fts/fts0fts.cc8
-rw-r--r--storage/innobase/fts/fts0opt.cc170
-rw-r--r--storage/innobase/handler/ha_innodb.cc34
-rw-r--r--storage/innobase/handler/handler0alter.cc51
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc21
-rw-r--r--storage/innobase/include/data0data.h2
-rw-r--r--storage/innobase/include/data0data.ic2
-rw-r--r--storage/innobase/include/dict0types.h2
-rw-r--r--storage/innobase/include/fts0fts.h7
-rw-r--r--storage/innobase/include/fts0opt.h3
-rw-r--r--storage/innobase/include/mem0mem.h5
-rw-r--r--storage/innobase/include/rem0rec.h2
-rw-r--r--storage/innobase/include/row0ins.h5
-rw-r--r--storage/innobase/include/ut0mem.h23
-rw-r--r--storage/innobase/include/ut0wqueue.h29
-rw-r--r--storage/innobase/mem/mem0mem.cc13
-rw-r--r--storage/innobase/os/os0file.cc38
-rw-r--r--storage/innobase/row/row0ins.cc19
-rw-r--r--storage/innobase/row/row0merge.cc2
-rw-r--r--storage/innobase/row/row0uins.cc50
-rw-r--r--storage/innobase/row/row0upd.cc17
-rw-r--r--storage/innobase/trx/trx0rec.cc26
-rw-r--r--storage/innobase/trx/trx0trx.cc3
-rw-r--r--storage/innobase/ut/ut0mem.cc50
-rw-r--r--storage/innobase/ut/ut0wqueue.cc31
-rw-r--r--storage/maria/ma_blockrec.c6
-rw-r--r--storage/maria/ma_key_recover.c5
-rw-r--r--storage/maria/ma_loghandler.c31
-rw-r--r--storage/maria/ma_loghandler.h2
-rw-r--r--storage/maria/ma_recovery.c4
-rw-r--r--storage/maria/ma_recovery.h2
-rw-r--r--storage/maria/ma_recovery_util.c11
-rw-r--r--storage/maria/ma_state.c6
-rw-r--r--storage/maria/maria_def.h1
-rw-r--r--storage/rocksdb/ha_rocksdb.cc9
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/show_table_status.result76
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test77
-rw-r--r--storage/rocksdb/rdb_datadic.cc87
-rw-r--r--storage/rocksdb/rdb_datadic.h35
-rw-r--r--storage/rocksdb/rdb_global.h2
-rw-r--r--storage/tokudb/CMakeLists.txt1
-rw-r--r--storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake34
-rw-r--r--storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash2
-rw-r--r--storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash2
-rw-r--r--storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash2
-rw-r--r--storage/tokudb/ha_tokudb.cc3
-rw-r--r--storage/tokudb/ha_tokudb.h3
-rw-r--r--storage/tokudb/hatoku_cmp.cc8
-rw-r--r--storage/tokudb/tests/math_test_int.cc162
-rw-r--r--storage/tokudb/tests/math_test_uint.cc84
-rw-r--r--storage/tokudb/tests/sint_test.cc1
-rw-r--r--storage/tokudb/tests/tokudb_buffer_test.cc11
-rw-r--r--storage/tokudb/tests/uint_test.cc1
-rw-r--r--storage/tokudb/tests/vlq_test.cc9
-rw-r--r--storage/tokudb/tests/vlq_test_uint32.cc15
-rw-r--r--storage/tokudb/tests/vlq_test_uint64.cc15
-rw-r--r--storage/tokudb/tokudb_buffer.h4
-rw-r--r--storage/tokudb/tokudb_math.h6
-rw-r--r--strings/ctype-simple.c18
-rw-r--r--support-files/rpm/server-postin.sh3
m---------wsrep-lib0
208 files changed, 6501 insertions, 1980 deletions
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index c48e3eb07f2..08d231068de 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -198,7 +198,7 @@ IF(MSVC)
# Noisy warning C4800: 'type': forcing value to bool 'true' or 'false' (performance warning),
# removed in VS2017
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800")
- ELSE()
+ ELSEIF (NOT (CMAKE_CXX_COMPILER_ID MATCHES Clang))
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /d2OptimizeHugeFunctions")
ENDIF()
ENDIF()
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 356dc319b1f..b99a8c79d0c 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -225,11 +225,8 @@ typedef struct _db_code_state_ {
const char *file; /* Name of current user file */
struct _db_stack_frame_ *framep; /* Pointer to current frame */
struct settings *stack; /* debugging settings */
- const char *jmpfunc; /* Remember current function for setjmp */
- const char *jmpfile; /* Remember current file for setjmp */
int lineno; /* Current debugger output line number */
uint level; /* Current function nesting level */
- int jmplevel; /* Remember nesting level at setjmp() */
/*
* The following variables are used to hold the state information
diff --git a/debian/additions/my.cnf b/debian/additions/my.cnf
index 91a159e4669..77596bc308b 100644
--- a/debian/additions/my.cnf
+++ b/debian/additions/my.cnf
@@ -131,8 +131,6 @@ max_binlog_size = 100M
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
default_storage_engine = InnoDB
-# you can't just change log file size, requires special procedure
-#innodb_log_file_size = 50M
innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_file_per_table = 1
diff --git a/libmariadb b/libmariadb
-Subproject 261a5c435581c8d6c6341afac95bcc5c96d1435
+Subproject 980f2dbea6586091333057bb2994b1874746694
diff --git a/mysql-test/collections/10.0-compatible.list b/mysql-test/collections/10.0-compatible.list
index 4778bde3b78..cccf5b7c0e8 100644
--- a/mysql-test/collections/10.0-compatible.list
+++ b/mysql-test/collections/10.0-compatible.list
@@ -202,7 +202,6 @@ main.function_defaults_innodb
main.gcc296
main.get_diagnostics
main.gis
-main.gis2
main.gis-alter_table_online
main.gis-precise
main.gis-rt-precise
diff --git a/mysql-test/main/ctype_many.result b/mysql-test/main/ctype_many.result
index 25802af4b5d..9def4fea80b 100644
--- a/mysql-test/main/ctype_many.result
+++ b/mysql-test/main/ctype_many.result
@@ -1695,6 +1695,7 @@ DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1)
AS BINARY(0)) USING utf8);
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'Zpq'
+Warning 1292 Truncated incorrect INTEGER value: 'Zpq'
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect BINARY(0) value: '1.'
#
diff --git a/mysql-test/main/ctype_many.test b/mysql-test/main/ctype_many.test
index a619b16416c..ba99c2e925a 100644
--- a/mysql-test/main/ctype_many.test
+++ b/mysql-test/main/ctype_many.test
@@ -225,9 +225,11 @@ DROP TABLE t1;
--echo # Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function
--echo #
+--disable_ps_protocol
SET NAMES latin1;
DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1)
AS BINARY(0)) USING utf8);
+--enable_ps_protocol
--echo #
--echo # End of 5.1 tests
--echo #
diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result
index cae8ba4ebaa..501732848b1 100644
--- a/mysql-test/main/ctype_utf32.result
+++ b/mysql-test/main/ctype_utf32.result
@@ -1588,7 +1588,7 @@ CREATE TABLE t1 AS SELECT format(123,2,'no_NO');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `format(123,2,'no_NO')` varchar(45) CHARACTER SET utf32 DEFAULT NULL
+ `format(123,2,'no_NO')` varchar(17) CHARACTER SET utf32 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t1;
format(123,2,'no_NO')
diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result
index 968d394117a..d50abe00e72 100644
--- a/mysql-test/main/func_math.result
+++ b/mysql-test/main/func_math.result
@@ -875,6 +875,49 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
+# Bug #29723340: MYSQL SERVER CRASH AFTER SQL QUERY WITH DATA ?AST
+#
+create table t1(a int);
+insert ignore t1 values("1e-214748364");
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+insert ignore t1 values("1e-2147483648");
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+insert ignore t1 values("1e-21474836480");
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+insert ignore t1 values("1e+214748364");
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+insert ignore t1 values("1e+2147483647");
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+insert ignore t1 values("1e+21474836470");
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+set global max_allowed_packet= cast(2*1024*1024*1024+1024 as unsigned);
+Warnings:
+Warning 1292 Truncated incorrect max_allowed_packet value: '2147484672'
+connect foo,localhost,root;
+set @a=2147483647;
+insert ignore t1 values (concat('1', repeat('0', @a+18), 'e-', @a-1, '0'));
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (1073741824) - truncated
+disconnect foo;
+connection default;
+set global max_allowed_packet=default;
+select * from t1;
+a
+0
+0
+0
+2147483647
+2147483647
+2147483647
+NULL
+drop table t1;
+#
# End of 5.5 tests
#
#
@@ -1426,3 +1469,1260 @@ DROP TABLE t1;
#
# End of 10.3 tests
#
+#
+# Start of 10.4 tests
+#
+#
+# MDEV-20732 max_char_length() doesn't account for FORMAT() with doubles in scientific notation
+#
+CREATE OR REPLACE TABLE t1 AS SELECT FORMAT(-1e308,2);
+SELECT * FROM t1;
+FORMAT(-1e308,2)
+-100,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `FORMAT(-1e308,2)` varchar(416) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 AS SELECT FORMAT('-1e308',2);
+SELECT * FROM t1;
+FORMAT('-1e308',2)
+-100,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `FORMAT('-1e308',2)` varchar(416) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 AS SELECT FORMAT(DATE'20191231',0),FORMAT(TIME'99:05:00',0),FORMAT(TIMESTAMP'2019-12-31 23:59:59.123456',0);
+SELECT * FROM t1;
+FORMAT(DATE'20191231',0) FORMAT(TIME'99:05:00',0) FORMAT(TIMESTAMP'2019-12-31 23:59:59.123456',0)
+20,191,231 990,500 20,191,231,235,959
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `FORMAT(DATE'20191231',0)` varchar(11) DEFAULT NULL,
+ `FORMAT(TIME'99:05:00',0)` varchar(10) DEFAULT NULL,
+ `FORMAT(TIMESTAMP'2019-12-31 23:59:59.123456',0)` varchar(19) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (y YEAR);
+INSERT INTO t1 VALUES ('2099'),('99');
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(y,0) FROM t1;
+SELECT * FROM t2;
+FORMAT(y,0)
+2,099
+1,999
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `FORMAT(y,0)` varchar(6) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
+CREATE OR REPLACE TABLE t1 (bi BIGINT UNSIGNED, bis BIGINT);
+INSERT INTO t1 VALUES (18446744073709551615,-9223372036854775808),(0,0);
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(bi,0),FORMAT(bis,0) FROM t1;
+SELECT * FROM t2;
+FORMAT(bi,0) FORMAT(bis,0)
+18,446,744,073,709,551,615 -9,223,372,036,854,775,808
+0 0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `FORMAT(bi,0)` varchar(27) DEFAULT NULL,
+ `FORMAT(bis,0)` varchar(26) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (d DECIMAL(65,0));
+INSERT INTO t1 VALUES (99999999999999999999999999999999999999999999999999999999999999999),(-99999999999999999999999999999999999999999999999999999999999999999),(0);
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(d,0) FROM t1;
+SELECT * FROM t2;
+FORMAT(d,0)
+99,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999
+-99,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999,999
+0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `FORMAT(d,0)` varchar(87) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 AS SELECT -99999999999999999999999999999999999999999999999999999999999999999 as c1;
+SELECT * FROM t1;
+c1
+-99999999999999999999999999999999999999999999999999999999999999999
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` decimal(65,0) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (b1 BIT(1),
+b2 BIT(2),
+b3 BIT(3),
+b4 BIT(4),
+b5 BIT(5),
+b6 BIT(6),
+b7 BIT(7),
+b8 BIT(8),
+b9 BIT(9),
+b10 BIT(10),
+b11 BIT(11),
+b12 BIT(12),
+b13 BIT(13),
+b14 BIT(14),
+b15 BIT(15),
+b16 BIT(16),
+b17 BIT(17),
+b18 BIT(18),
+b19 BIT(19),
+b20 BIT(20),
+b21 BIT(21),
+b22 BIT(22),
+b23 BIT(23),
+b24 BIT(24),
+b25 BIT(25),
+b26 BIT(26),
+b27 BIT(27),
+b28 BIT(28),
+b29 BIT(29),
+b30 BIT(30),
+b31 BIT(31),
+b32 BIT(32),
+b33 BIT(33),
+b34 BIT(34),
+b35 BIT(35),
+b36 BIT(36),
+b37 BIT(37),
+b38 BIT(38),
+b39 BIT(39),
+b40 BIT(40),
+b41 BIT(41),
+b42 BIT(42),
+b43 BIT(43),
+b44 BIT(44),
+b45 BIT(45),
+b46 BIT(46),
+b47 BIT(47),
+b48 BIT(48),
+b49 BIT(49),
+b50 BIT(50),
+b51 BIT(51),
+b52 BIT(52),
+b53 BIT(53),
+b54 BIT(54),
+b55 BIT(55),
+b56 BIT(56),
+b57 BIT(57),
+b58 BIT(58),
+b59 BIT(59),
+b60 BIT(60),
+b61 BIT(61),
+b62 BIT(62),
+b63 BIT(63),
+b64 BIT(64));
+INSERT INTO t1 VALUES(1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,
+32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,
+33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,
+4294967295,8589934591,17179869183,34359738367,68719476735,137438953471,
+274877906943,549755813887,1099511627775,2199023255551,4398046511103,
+8796093022207,17592186044415,35184372088831,70368744177663,140737488355327,
+281474976710655,562949953421311,1125899906842623,2251799813685247,
+4503599627370495,9007199254740991,18014398509481983,36028797018963967,
+72057594037927935,144115188075855871,288230376151711743,576460752303423487,
+1152921504606846975,2305843009213693951,4611686018427387903,
+9223372036854775807,18446744073709551615);
+SELECT FORMAT(b1,0),
+FORMAT(b2,0),
+FORMAT(b3,0),
+FORMAT(b4,0),
+FORMAT(b5,0),
+FORMAT(b6,0),
+FORMAT(b7,0),
+FORMAT(b8,0),
+FORMAT(b9,0),
+FORMAT(b10,0),
+FORMAT(b11,0),
+FORMAT(b12,0),
+FORMAT(b13,0),
+FORMAT(b14,0),
+FORMAT(b15,0),
+FORMAT(b16,0),
+FORMAT(b17,0),
+FORMAT(b18,0),
+FORMAT(b19,0),
+FORMAT(b20,0),
+FORMAT(b21,0),
+FORMAT(b22,0),
+FORMAT(b23,0),
+FORMAT(b24,0),
+FORMAT(b25,0),
+FORMAT(b26,0),
+FORMAT(b27,0),
+FORMAT(b28,0),
+FORMAT(b29,0),
+FORMAT(b30,0),
+FORMAT(b31,0),
+FORMAT(b32,0),
+FORMAT(b33,0),
+FORMAT(b34,0),
+FORMAT(b35,0),
+FORMAT(b36,0),
+FORMAT(b37,0),
+FORMAT(b38,0),
+FORMAT(b39,0),
+FORMAT(b40,0),
+FORMAT(b41,0),
+FORMAT(b42,0),
+FORMAT(b43,0),
+FORMAT(b44,0),
+FORMAT(b45,0),
+FORMAT(b46,0),
+FORMAT(b47,0),
+FORMAT(b48,0),
+FORMAT(b49,0),
+FORMAT(b50,0),
+FORMAT(b51,0),
+FORMAT(b52,0),
+FORMAT(b53,0),
+FORMAT(b54,0),
+FORMAT(b55,0),
+FORMAT(b56,0),
+FORMAT(b57,0),
+FORMAT(b58,0),
+FORMAT(b59,0),
+FORMAT(b60,0),
+FORMAT(b61,0),
+FORMAT(b62,0),
+FORMAT(b63,0),
+FORMAT(b64,0)
+FROM t1;
+FORMAT(b1,0) 1
+FORMAT(b2,0) 3
+FORMAT(b3,0) 7
+FORMAT(b4,0) 15
+FORMAT(b5,0) 31
+FORMAT(b6,0) 63
+FORMAT(b7,0) 127
+FORMAT(b8,0) 255
+FORMAT(b9,0) 511
+FORMAT(b10,0) 1,023
+FORMAT(b11,0) 2,047
+FORMAT(b12,0) 4,095
+FORMAT(b13,0) 8,191
+FORMAT(b14,0) 16,383
+FORMAT(b15,0) 32,767
+FORMAT(b16,0) 65,535
+FORMAT(b17,0) 131,071
+FORMAT(b18,0) 262,143
+FORMAT(b19,0) 524,287
+FORMAT(b20,0) 1,048,575
+FORMAT(b21,0) 2,097,151
+FORMAT(b22,0) 4,194,303
+FORMAT(b23,0) 8,388,607
+FORMAT(b24,0) 16,777,215
+FORMAT(b25,0) 33,554,431
+FORMAT(b26,0) 67,108,863
+FORMAT(b27,0) 134,217,727
+FORMAT(b28,0) 268,435,455
+FORMAT(b29,0) 536,870,911
+FORMAT(b30,0) 1,073,741,823
+FORMAT(b31,0) 2,147,483,647
+FORMAT(b32,0) 4,294,967,295
+FORMAT(b33,0) 8,589,934,591
+FORMAT(b34,0) 17,179,869,183
+FORMAT(b35,0) 34,359,738,367
+FORMAT(b36,0) 68,719,476,735
+FORMAT(b37,0) 137,438,953,471
+FORMAT(b38,0) 274,877,906,943
+FORMAT(b39,0) 549,755,813,887
+FORMAT(b40,0) 1,099,511,627,775
+FORMAT(b41,0) 2,199,023,255,551
+FORMAT(b42,0) 4,398,046,511,103
+FORMAT(b43,0) 8,796,093,022,207
+FORMAT(b44,0) 17,592,186,044,415
+FORMAT(b45,0) 35,184,372,088,831
+FORMAT(b46,0) 70,368,744,177,663
+FORMAT(b47,0) 140,737,488,355,327
+FORMAT(b48,0) 281,474,976,710,655
+FORMAT(b49,0) 562,949,953,421,311
+FORMAT(b50,0) 1,125,899,906,842,623
+FORMAT(b51,0) 2,251,799,813,685,247
+FORMAT(b52,0) 4,503,599,627,370,495
+FORMAT(b53,0) 9,007,199,254,740,991
+FORMAT(b54,0) 18,014,398,509,481,983
+FORMAT(b55,0) 36,028,797,018,963,967
+FORMAT(b56,0) 72,057,594,037,927,935
+FORMAT(b57,0) 144,115,188,075,855,871
+FORMAT(b58,0) 288,230,376,151,711,743
+FORMAT(b59,0) 576,460,752,303,423,487
+FORMAT(b60,0) 1,152,921,504,606,846,975
+FORMAT(b61,0) 2,305,843,009,213,693,951
+FORMAT(b62,0) 4,611,686,018,427,387,903
+FORMAT(b63,0) 9,223,372,036,854,775,807
+FORMAT(b64,0) 18,446,744,073,709,551,615
+DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 (c1 BIT(1));
+INSERT INTO t1 VALUES (b'1');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+31
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(2));
+INSERT INTO t1 VALUES (b'11');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+33
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(3));
+INSERT INTO t1 VALUES (b'111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+37
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(3) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(4));
+INSERT INTO t1 VALUES (b'1111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+F
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3135
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(3) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(5));
+INSERT INTO t1 VALUES (b'11111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1F
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3331
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(3) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(6));
+INSERT INTO t1 VALUES (b'111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3F
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3633
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(5) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(7));
+INSERT INTO t1 VALUES (b'1111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7F
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+313237
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(5) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(8));
+INSERT INTO t1 VALUES (b'11111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+323535
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(5) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(9));
+INSERT INTO t1 VALUES (b'111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+353131
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(6) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(10));
+INSERT INTO t1 VALUES (b'1111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+312C303233
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(6) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(11));
+INSERT INTO t1 VALUES (b'11111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+322C303437
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(6) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(12));
+INSERT INTO t1 VALUES (b'111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+342C303935
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(7) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(13));
+INSERT INTO t1 VALUES (b'1111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+382C313931
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(7) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(14));
+INSERT INTO t1 VALUES (b'11111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+31362C333833
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(7) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(15));
+INSERT INTO t1 VALUES (b'111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+33322C373637
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(16));
+INSERT INTO t1 VALUES (b'1111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+36352C353335
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(17));
+INSERT INTO t1 VALUES (b'11111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3133312C303731
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(18));
+INSERT INTO t1 VALUES (b'111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3236322C313433
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(19));
+INSERT INTO t1 VALUES (b'1111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3532342C323837
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(20));
+INSERT INTO t1 VALUES (b'11111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+312C3034382C353735
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(21));
+INSERT INTO t1 VALUES (b'111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+322C3039372C313531
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(22));
+INSERT INTO t1 VALUES (b'1111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+342C3139342C333033
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(23));
+INSERT INTO t1 VALUES (b'11111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+382C3338382C363037
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(24));
+INSERT INTO t1 VALUES (b'111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+31362C3737372C323135
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(13) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(25));
+INSERT INTO t1 VALUES (b'1111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+33332C3535342C343331
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(13) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(26));
+INSERT INTO t1 VALUES (b'11111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+36372C3130382C383633
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(13) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(27));
+INSERT INTO t1 VALUES (b'111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3133342C3231372C373237
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(14) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(28));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3236382C3433352C343535
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(14) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(29));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3533362C3837302C393131
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(14) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(30));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+312C3037332C3734312C383233
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(15) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(31));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+322C3134372C3438332C363437
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(15) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(32));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+342C3239342C3936372C323935
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(15) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(33));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+382C3538392C3933342C353931
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(17) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(34));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+31372C3137392C3836392C313833
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(17) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(35));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+33342C3335392C3733382C333637
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(17) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(36));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+36382C3731392C3437362C373335
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(18) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(37));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3133372C3433382C3935332C343731
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(18) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(38));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3237342C3837372C3930362C393433
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(18) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(39));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3534392C3735352C3831332C383837
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(19) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(40));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+312C3039392C3531312C3632372C373735
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(19) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(41));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+322C3139392C3032332C3235352C353531
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(19) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(42));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+342C3339382C3034362C3531312C313033
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(21) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(43));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+382C3739362C3039332C3032322C323037
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(21) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(44));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+31372C3539322C3138362C3034342C343135
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(21) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(45));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+33352C3138342C3337322C3038382C383331
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(22) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(46));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+37302C3336382C3734342C3137372C363633
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(22) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(47));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3134302C3733372C3438382C3335352C333237
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(22) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(48));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3238312C3437342C3937362C3731302C363535
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(49));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3536322C3934392C3935332C3432312C333131
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(50));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+312C3132352C3839392C3930362C3834322C363233
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(23) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(51));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+322C3235312C3739392C3831332C3638352C323437
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(25) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(52));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+342C3530332C3539392C3632372C3337302C343935
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(25) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(53));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+392C3030372C3139392C3235342C3734302C393931
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(25) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(54));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+31382C3031342C3339382C3530392C3438312C393833
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(26) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(55));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+33362C3032382C3739372C3031382C3936332C393637
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(26) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(56));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+37322C3035372C3539342C3033372C3932372C393335
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(26) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(57));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3134342C3131352C3138382C3037352C3835352C383731
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(27) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(58));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3238382C3233302C3337362C3135312C3731312C373433
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(27) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(59));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+3537362C3436302C3735322C3330332C3432332C343837
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(27) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(60));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+312C3135322C3932312C3530342C3630362C3834362C393735
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(29) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(61));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+1FFFFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+322C3330352C3834332C3030392C3231332C3639332C393531
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(29) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(62));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+3FFFFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+342C3631312C3638362C3031382C3432372C3338372C393033
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(29) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(63));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+7FFFFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+392C3232332C3337322C3033362C3835342C3737352C383037
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE OR REPLACE TABLE t1 (c1 BIT(64));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+HEX(c1)
+FFFFFFFFFFFFFFFF
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+HEX(c1)
+31382C3434362C3734342C3037332C3730392C3535312C363135
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c1` varchar(30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test
index 4d65f5e00b0..5f333c06b78 100644
--- a/mysql-test/main/func_math.test
+++ b/mysql-test/main/func_math.test
@@ -628,6 +628,31 @@ DROP TABLE t1;
--echo #
+--echo # Bug #29723340: MYSQL SERVER CRASH AFTER SQL QUERY WITH DATA ?AST
+--echo #
+
+create table t1(a int);
+insert ignore t1 values("1e-214748364");
+insert ignore t1 values("1e-2147483648");
+insert ignore t1 values("1e-21474836480");
+insert ignore t1 values("1e+214748364");
+insert ignore t1 values("1e+2147483647");
+insert ignore t1 values("1e+21474836470");
+
+# if max max_allowed_packet will ever be increased beyond 2GB, this could
+# break again:
+set global max_allowed_packet= cast(2*1024*1024*1024+1024 as unsigned);
+connect foo,localhost,root;
+set @a=2147483647;
+insert ignore t1 values (concat('1', repeat('0', @a+18), 'e-', @a-1, '0'));
+disconnect foo;
+connection default;
+set global max_allowed_packet=default;
+
+select * from t1;
+drop table t1;
+
+--echo #
--echo # End of 5.5 tests
--echo #
@@ -1001,3 +1026,713 @@ DROP TABLE t1;
--echo #
--echo # End of 10.3 tests
--echo #
+
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+--echo #
+--echo # MDEV-20732 max_char_length() doesn't account for FORMAT() with doubles in scientific notation
+--echo #
+
+CREATE OR REPLACE TABLE t1 AS SELECT FORMAT(-1e308,2);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 AS SELECT FORMAT('-1e308',2);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 AS SELECT FORMAT(DATE'20191231',0),FORMAT(TIME'99:05:00',0),FORMAT(TIMESTAMP'2019-12-31 23:59:59.123456',0);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (y YEAR);
+INSERT INTO t1 VALUES ('2099'),('99');
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(y,0) FROM t1;
+SELECT * FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+CREATE OR REPLACE TABLE t1 (bi BIGINT UNSIGNED, bis BIGINT);
+INSERT INTO t1 VALUES (18446744073709551615,-9223372036854775808),(0,0);
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(bi,0),FORMAT(bis,0) FROM t1;
+SELECT * FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (d DECIMAL(65,0));
+INSERT INTO t1 VALUES (99999999999999999999999999999999999999999999999999999999999999999),(-99999999999999999999999999999999999999999999999999999999999999999),(0);
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(d,0) FROM t1;
+SELECT * FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 AS SELECT -99999999999999999999999999999999999999999999999999999999999999999 as c1;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (b1 BIT(1),
+b2 BIT(2),
+b3 BIT(3),
+b4 BIT(4),
+b5 BIT(5),
+b6 BIT(6),
+b7 BIT(7),
+b8 BIT(8),
+b9 BIT(9),
+b10 BIT(10),
+b11 BIT(11),
+b12 BIT(12),
+b13 BIT(13),
+b14 BIT(14),
+b15 BIT(15),
+b16 BIT(16),
+b17 BIT(17),
+b18 BIT(18),
+b19 BIT(19),
+b20 BIT(20),
+b21 BIT(21),
+b22 BIT(22),
+b23 BIT(23),
+b24 BIT(24),
+b25 BIT(25),
+b26 BIT(26),
+b27 BIT(27),
+b28 BIT(28),
+b29 BIT(29),
+b30 BIT(30),
+b31 BIT(31),
+b32 BIT(32),
+b33 BIT(33),
+b34 BIT(34),
+b35 BIT(35),
+b36 BIT(36),
+b37 BIT(37),
+b38 BIT(38),
+b39 BIT(39),
+b40 BIT(40),
+b41 BIT(41),
+b42 BIT(42),
+b43 BIT(43),
+b44 BIT(44),
+b45 BIT(45),
+b46 BIT(46),
+b47 BIT(47),
+b48 BIT(48),
+b49 BIT(49),
+b50 BIT(50),
+b51 BIT(51),
+b52 BIT(52),
+b53 BIT(53),
+b54 BIT(54),
+b55 BIT(55),
+b56 BIT(56),
+b57 BIT(57),
+b58 BIT(58),
+b59 BIT(59),
+b60 BIT(60),
+b61 BIT(61),
+b62 BIT(62),
+b63 BIT(63),
+b64 BIT(64));
+INSERT INTO t1 VALUES(1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,
+ 32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,
+ 33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,
+ 4294967295,8589934591,17179869183,34359738367,68719476735,137438953471,
+ 274877906943,549755813887,1099511627775,2199023255551,4398046511103,
+ 8796093022207,17592186044415,35184372088831,70368744177663,140737488355327,
+ 281474976710655,562949953421311,1125899906842623,2251799813685247,
+ 4503599627370495,9007199254740991,18014398509481983,36028797018963967,
+ 72057594037927935,144115188075855871,288230376151711743,576460752303423487,
+ 1152921504606846975,2305843009213693951,4611686018427387903,
+ 9223372036854775807,18446744073709551615);
+--vertical_results
+SELECT FORMAT(b1,0),
+FORMAT(b2,0),
+FORMAT(b3,0),
+FORMAT(b4,0),
+FORMAT(b5,0),
+FORMAT(b6,0),
+FORMAT(b7,0),
+FORMAT(b8,0),
+FORMAT(b9,0),
+FORMAT(b10,0),
+FORMAT(b11,0),
+FORMAT(b12,0),
+FORMAT(b13,0),
+FORMAT(b14,0),
+FORMAT(b15,0),
+FORMAT(b16,0),
+FORMAT(b17,0),
+FORMAT(b18,0),
+FORMAT(b19,0),
+FORMAT(b20,0),
+FORMAT(b21,0),
+FORMAT(b22,0),
+FORMAT(b23,0),
+FORMAT(b24,0),
+FORMAT(b25,0),
+FORMAT(b26,0),
+FORMAT(b27,0),
+FORMAT(b28,0),
+FORMAT(b29,0),
+FORMAT(b30,0),
+FORMAT(b31,0),
+FORMAT(b32,0),
+FORMAT(b33,0),
+FORMAT(b34,0),
+FORMAT(b35,0),
+FORMAT(b36,0),
+FORMAT(b37,0),
+FORMAT(b38,0),
+FORMAT(b39,0),
+FORMAT(b40,0),
+FORMAT(b41,0),
+FORMAT(b42,0),
+FORMAT(b43,0),
+FORMAT(b44,0),
+FORMAT(b45,0),
+FORMAT(b46,0),
+FORMAT(b47,0),
+FORMAT(b48,0),
+FORMAT(b49,0),
+FORMAT(b50,0),
+FORMAT(b51,0),
+FORMAT(b52,0),
+FORMAT(b53,0),
+FORMAT(b54,0),
+FORMAT(b55,0),
+FORMAT(b56,0),
+FORMAT(b57,0),
+FORMAT(b58,0),
+FORMAT(b59,0),
+FORMAT(b60,0),
+FORMAT(b61,0),
+FORMAT(b62,0),
+FORMAT(b63,0),
+FORMAT(b64,0)
+FROM t1;
+--horizontal_results
+
+DROP TABLE t1;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(1));
+INSERT INTO t1 VALUES (b'1');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(2));
+INSERT INTO t1 VALUES (b'11');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(3));
+INSERT INTO t1 VALUES (b'111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(4));
+INSERT INTO t1 VALUES (b'1111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(5));
+INSERT INTO t1 VALUES (b'11111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(6));
+INSERT INTO t1 VALUES (b'111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(7));
+INSERT INTO t1 VALUES (b'1111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(8));
+INSERT INTO t1 VALUES (b'11111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(9));
+INSERT INTO t1 VALUES (b'111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(10));
+INSERT INTO t1 VALUES (b'1111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(11));
+INSERT INTO t1 VALUES (b'11111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(12));
+INSERT INTO t1 VALUES (b'111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(13));
+INSERT INTO t1 VALUES (b'1111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(14));
+INSERT INTO t1 VALUES (b'11111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(15));
+INSERT INTO t1 VALUES (b'111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(16));
+INSERT INTO t1 VALUES (b'1111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(17));
+INSERT INTO t1 VALUES (b'11111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(18));
+INSERT INTO t1 VALUES (b'111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(19));
+INSERT INTO t1 VALUES (b'1111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(20));
+INSERT INTO t1 VALUES (b'11111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(21));
+INSERT INTO t1 VALUES (b'111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(22));
+INSERT INTO t1 VALUES (b'1111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(23));
+INSERT INTO t1 VALUES (b'11111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(24));
+INSERT INTO t1 VALUES (b'111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(25));
+INSERT INTO t1 VALUES (b'1111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(26));
+INSERT INTO t1 VALUES (b'11111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(27));
+INSERT INTO t1 VALUES (b'111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(28));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(29));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(30));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(31));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(32));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(33));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(34));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(35));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(36));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(37));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(38));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(39));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(40));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(41));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(42));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(43));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(44));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(45));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(46));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(47));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(48));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(49));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(50));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(51));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(52));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(53));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(54));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(55));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(56));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(57));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(58));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(59));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(60));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(61));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(62));
+INSERT INTO t1 VALUES (b'11111111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(63));
+INSERT INTO t1 VALUES (b'111111111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+CREATE OR REPLACE TABLE t1 (c1 BIT(64));
+INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111');
+SELECT HEX(c1) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT FORMAT(c1,0) as c1 FROM t1;
+SELECT HEX(c1) FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t1,t2;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result
index 5fca53def04..5de77f18a24 100644
--- a/mysql-test/main/func_str.result
+++ b/mysql-test/main/func_str.result
@@ -745,7 +745,7 @@ t1 CREATE TABLE `t1` (
`conv(130,16,10)` varchar(64) DEFAULT NULL,
`hex(130)` varchar(6) DEFAULT NULL,
`char(130)` varbinary(4) DEFAULT NULL,
- `format(130,10)` varchar(45) DEFAULT NULL,
+ `format(130,10)` varchar(25) DEFAULT NULL,
`left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 DEFAULT NULL,
`right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 DEFAULT NULL,
`lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 DEFAULT NULL,
@@ -2708,7 +2708,7 @@ create table t1(a float);
insert into t1 values (1.33);
select format(a, 2) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def format(a, 2) 253 57 4 Y 0 39 8
+def format(a, 2) 253 4 4 Y 0 39 8
format(a, 2)
1.33
drop table t1;
@@ -3042,7 +3042,7 @@ CREATE TABLE t1 AS SELECT format(123,2,'no_NO');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `format(123,2,'no_NO')` varchar(45) DEFAULT NULL
+ `format(123,2,'no_NO')` varchar(17) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT * FROM t1;
format(123,2,'no_NO')
diff --git a/mysql-test/main/information_schema_db.result b/mysql-test/main/information_schema_db.result
index 0d98a10050d..bf665da4542 100644
--- a/mysql-test/main/information_schema_db.result
+++ b/mysql-test/main/information_schema_db.result
@@ -246,3 +246,82 @@ connection user1;
disconnect user1;
connection default;
set global sql_mode=default;
+create user foo@localhost;
+grant select on test.* to foo@localhost;
+create procedure rootonly() select 1;
+create sql security definer view v1d as select current_user(),user from information_schema.processlist;
+create sql security invoker view v1i as select current_user(),user from information_schema.processlist;
+create sql security definer view v2d as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
+create sql security invoker view v2i as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
+create sql security definer view v3d as select schema_name from information_schema.schemata where schema_name like '%mysql%';
+create sql security invoker view v3i as select schema_name from information_schema.schemata where schema_name like '%mysql%';
+create sql security definer view v4d as select routine_name from information_schema.routines where routine_schema='test';
+create sql security invoker view v4i as select routine_name from information_schema.routines where routine_schema='test';
+create sql security definer view v5d as select view_definition > '' from information_schema.views where table_name='v1d';
+create sql security invoker view v5i as select view_definition > '' from information_schema.views where table_name='v1d';
+connect foo,localhost,foo;
+select * from v1d;
+current_user() user
+root@localhost root
+root@localhost root
+select * from v1i;
+current_user() user
+foo@localhost foo
+select * from v2d;
+table_name
+user
+select * from v2i;
+table_name
+select * from v3d;
+schema_name
+mysql
+select * from v3i;
+schema_name
+select * from v4d;
+routine_name
+rootonly
+select * from v4i;
+routine_name
+select * from v5d;
+view_definition > ''
+1
+select * from v5i;
+view_definition > ''
+0
+connection default;
+select * from v1d;
+current_user() user
+root@localhost foo
+root@localhost root
+select * from v1i;
+current_user() user
+root@localhost foo
+root@localhost root
+select * from v2d;
+table_name
+user
+select * from v2i;
+table_name
+user
+select * from v3d;
+schema_name
+mysql
+select * from v3i;
+schema_name
+mysql
+select * from v4d;
+routine_name
+rootonly
+select * from v4i;
+routine_name
+rootonly
+select * from v5d;
+view_definition > ''
+1
+select * from v5i;
+view_definition > ''
+1
+disconnect foo;
+drop view v1d, v1i, v2d, v2i, v3d, v3i, v4d, v4i, v5d, v5i;
+drop user foo@localhost;
+drop procedure rootonly;
diff --git a/mysql-test/main/information_schema_db.test b/mysql-test/main/information_schema_db.test
index 94908570969..b244662a28c 100644
--- a/mysql-test/main/information_schema_db.test
+++ b/mysql-test/main/information_schema_db.test
@@ -255,3 +255,47 @@ disconnect user1;
connection default;
set global sql_mode=default;
+
+#
+# MDEV-20549 SQL SECURITY DEFINER does not work for INFORMATION_SCHEMA tables
+#
+
+create user foo@localhost;
+grant select on test.* to foo@localhost;
+create procedure rootonly() select 1;
+create sql security definer view v1d as select current_user(),user from information_schema.processlist;
+create sql security invoker view v1i as select current_user(),user from information_schema.processlist;
+create sql security definer view v2d as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
+create sql security invoker view v2i as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
+create sql security definer view v3d as select schema_name from information_schema.schemata where schema_name like '%mysql%';
+create sql security invoker view v3i as select schema_name from information_schema.schemata where schema_name like '%mysql%';
+create sql security definer view v4d as select routine_name from information_schema.routines where routine_schema='test';
+create sql security invoker view v4i as select routine_name from information_schema.routines where routine_schema='test';
+create sql security definer view v5d as select view_definition > '' from information_schema.views where table_name='v1d';
+create sql security invoker view v5i as select view_definition > '' from information_schema.views where table_name='v1d';
+connect foo,localhost,foo;
+select * from v1d;
+select * from v1i;
+select * from v2d;
+select * from v2i;
+select * from v3d;
+select * from v3i;
+select * from v4d;
+select * from v4i;
+select * from v5d;
+select * from v5i;
+connection default;
+select * from v1d;
+select * from v1i;
+select * from v2d;
+select * from v2i;
+select * from v3d;
+select * from v3i;
+select * from v4d;
+select * from v4i;
+select * from v5d;
+select * from v5i;
+disconnect foo;
+drop view v1d, v1i, v2d, v2i, v3d, v3i, v4d, v4i, v5d, v5i;
+drop user foo@localhost;
+drop procedure rootonly;
diff --git a/mysql-test/main/partition_innodb.result b/mysql-test/main/partition_innodb.result
index c0f36a284fd..090e74b6079 100644
--- a/mysql-test/main/partition_innodb.result
+++ b/mysql-test/main/partition_innodb.result
@@ -1069,5 +1069,29 @@ COUNT(*)
2
DROP TABLE t1;
#
+# MDEV-18244 Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val
+#
+CREATE TABLE t1 (a INT)
+ENGINE=InnoDB
+PARTITION BY RANGE (a) (
+PARTITION p0 VALUES LESS THAN (6),
+PARTITION pn VALUES LESS THAN MAXVALUE
+);
+INSERT INTO t1 VALUES (4),(5),(6);
+ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY;
+UPDATE t1 PARTITION (p0) SET a = 3 WHERE a = 5;
+INSERT INTO t1 PARTITION(p0) VALUES ();
+ERROR HY000: Found a row not matching the given partition set
+INSERT INTO t1 PARTITION(p0) VALUES (-1);
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+a
+-1
+1
+3
+4
+6
+DROP TABLE t1;
+#
# End of 10.3 tests
#
diff --git a/mysql-test/main/partition_innodb.test b/mysql-test/main/partition_innodb.test
index 3b44cf4db85..1a05ce6e20d 100644
--- a/mysql-test/main/partition_innodb.test
+++ b/mysql-test/main/partition_innodb.test
@@ -1140,5 +1140,25 @@ SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL;
DROP TABLE t1;
--echo #
+--echo # MDEV-18244 Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val
+--echo #
+
+CREATE TABLE t1 (a INT)
+ ENGINE=InnoDB
+ PARTITION BY RANGE (a) (
+ PARTITION p0 VALUES LESS THAN (6),
+ PARTITION pn VALUES LESS THAN MAXVALUE
+ );
+INSERT INTO t1 VALUES (4),(5),(6);
+ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY;
+UPDATE t1 PARTITION (p0) SET a = 3 WHERE a = 5;
+--error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
+INSERT INTO t1 PARTITION(p0) VALUES ();
+INSERT INTO t1 PARTITION(p0) VALUES (-1);
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.3 tests
--echo #
diff --git a/mysql-test/main/partition_ucs2.result b/mysql-test/main/partition_ucs2.result
new file mode 100644
index 00000000000..ae2f3f15fa3
--- /dev/null
+++ b/mysql-test/main/partition_ucs2.result
@@ -0,0 +1,13 @@
+#
+# Start of 10.3 tests
+#
+#
+# MDEV-20855 Crash with PARTITION BY LIST and extended characters
+#
+SET NAMES utf8;
+CREATE OR REPLACE TABLE t1 (a TIME)
+PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN (_ucs2 0x0411));
+ERROR HY000: This partition function is not allowed
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/partition_ucs2.test b/mysql-test/main/partition_ucs2.test
new file mode 100644
index 00000000000..8af2b6196c6
--- /dev/null
+++ b/mysql-test/main/partition_ucs2.test
@@ -0,0 +1,19 @@
+--source include/have_partition.inc
+--source include/have_ucs2.inc
+
+--echo #
+--echo # Start of 10.3 tests
+--echo #
+
+--echo #
+--echo # MDEV-20855 Crash with PARTITION BY LIST and extended characters
+--echo #
+
+SET NAMES utf8;
+--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+CREATE OR REPLACE TABLE t1 (a TIME)
+ PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN (_ucs2 0x0411));
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/main/partition_utf8.result b/mysql-test/main/partition_utf8.result
index c9c376787a3..185d081b1c9 100644
--- a/mysql-test/main/partition_utf8.result
+++ b/mysql-test/main/partition_utf8.result
@@ -52,6 +52,22 @@ insert into t1 values ('');
insert into t1 values (_ucs2 0x2020);
drop table t1;
#
+# Start of 10.3 tests
+#
+#
+# MDEV-20855 Crash with PARTITION BY LIST and extended characters
+#
+SET NAMES utf8;
+CREATE OR REPLACE TABLE t1 (a CHAR(10)) CHARACTER SET latin1
+PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN ('Б'));
+ERROR HY000: This partition function is not allowed
+CREATE OR REPLACE TABLE t1 (a TIME)
+PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN ('Б'));
+ERROR HY000: This partition function is not allowed
+#
+# End of 10.3 tests
+#
+#
# Start of 10.5 tests
#
#
diff --git a/mysql-test/main/partition_utf8.test b/mysql-test/main/partition_utf8.test
index 8adbb6b30c3..9bfa352ab25 100644
--- a/mysql-test/main/partition_utf8.test
+++ b/mysql-test/main/partition_utf8.test
@@ -42,6 +42,28 @@ insert into t1 values (_ucs2 0x2020);
drop table t1;
--echo #
+--echo # Start of 10.3 tests
+--echo #
+
+--echo #
+--echo # MDEV-20855 Crash with PARTITION BY LIST and extended characters
+--echo #
+
+SET NAMES utf8;
+
+--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+CREATE OR REPLACE TABLE t1 (a CHAR(10)) CHARACTER SET latin1
+ PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN ('Б'));
+
+--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
+CREATE OR REPLACE TABLE t1 (a TIME)
+ PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN ('Б'));
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
+
+--echo #
--echo # Start of 10.5 tests
--echo #
diff --git a/mysql-test/main/processlist.result b/mysql-test/main/processlist.result
index 4be643c1790..2d3228a6d91 100644
--- a/mysql-test/main/processlist.result
+++ b/mysql-test/main/processlist.result
@@ -23,8 +23,9 @@ select command, time < 5 from information_schema.processlist where id != connect
command time < 5
Sleep 1
disconnect con1;
-set debug_sync='reset';
connection default;
+set debug_sync='reset';
+End of 5.5 tests
#
# 10.1 tests
#
diff --git a/mysql-test/main/processlist.test b/mysql-test/main/processlist.test
index 4734c75c8d3..8e98701459a 100644
--- a/mysql-test/main/processlist.test
+++ b/mysql-test/main/processlist.test
@@ -49,10 +49,10 @@ SET DEBUG_SYNC = 'now WAIT_FOR query_done';
select command, time < 5 from information_schema.processlist where id != connection_id();
disconnect con1;
-set debug_sync='reset';
-
connection default;
+set debug_sync='reset';
+--echo End of 5.5 tests
--echo #
--echo # 10.1 tests
diff --git a/mysql-test/main/processlist_notembedded.result b/mysql-test/main/processlist_notembedded.result
new file mode 100644
index 00000000000..67eeb5ae2ff
--- /dev/null
+++ b/mysql-test/main/processlist_notembedded.result
@@ -0,0 +1,12 @@
+#
+# MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
+#
+connect con1,localhost,root,,;
+connection con1;
+SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+FOUND 1 /sleep \(30\)/ in MDEV-20466.text
+disconnect con1;
+SET DEBUG_SYNC = 'RESET';
+End of 5.5 tests
diff --git a/mysql-test/main/processlist_notembedded.test b/mysql-test/main/processlist_notembedded.test
new file mode 100644
index 00000000000..2dc6a0539ab
--- /dev/null
+++ b/mysql-test/main/processlist_notembedded.test
@@ -0,0 +1,34 @@
+source include/have_debug.inc;
+source include/have_debug_sync.inc;
+source include/not_embedded.inc;
+
+--echo #
+--echo # MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
+--echo #
+
+connect (con1,localhost,root,,);
+
+connection con1;
+
+let $q= `select CONCAT("SELECT user FROM mysql.user WHERE user ='some", CHAR(0), "' or sleep (30)")`;
+
+SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
+--disable_query_log
+--send_eval $q;
+--enable_query_log
+connection default;
+
+SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
+
+exec $MYSQL test -e "SHOW PROCESSLIST" > $MYSQLTEST_VARDIR/tmp/MDEV-20466.text;
+
+let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/MDEV-20466.text;
+let SEARCH_PATTERN=sleep \(30\);
+source include/search_pattern_in_file.inc;
+remove_file $MYSQLTEST_VARDIR/tmp/MDEV-20466.text;
+
+disconnect con1;
+
+SET DEBUG_SYNC = 'RESET';
+
+--echo End of 5.5 tests
diff --git a/mysql-test/main/subselect_sj.result b/mysql-test/main/subselect_sj.result
index 3b12ced431e..f3519e1d846 100644
--- a/mysql-test/main/subselect_sj.result
+++ b/mysql-test/main/subselect_sj.result
@@ -3268,6 +3268,32 @@ create table t1 (a1 varchar(25));
create table t2 (a2 varchar(25)) ;
insert into t1 select 'xxx' from dual where 'xxx' in (select a2 from t2);
drop table t1,t2;
+#
+# MDEV-13172: Wrong result / SELECT ... WHERE EXISTS ... (with UNIQUE Key)
+#
+CREATE TABLE `t1` (
+`Id` int(11) NOT NULL,
+PRIMARY KEY (`Id`)
+);
+INSERT INTO `t1` (`Id`) VALUES (1);
+CREATE TABLE `t2` (
+`t1_Id` int(11) NOT NULL DEFAULT 0,
+`col1` int(11) DEFAULT NULL,
+UNIQUE KEY `col1` (`col1`)
+);
+INSERT INTO `t2` (`t1_Id`, `col1`) VALUES (1, NULL), (1, NULL);
+SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
+Id
+1
+explain extended
+SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 100.00
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
+2 MATERIALIZED t2 ref col1 col1 5 const 2 100.00 Using index condition; Using where
+Warnings:
+Note 1003 select 1 AS `Id` from (`test`.`t2`) where `test`.`t2`.`t1_Id` = 1 and `test`.`t2`.`col1` is null
+DROP TABLE t1, t2;
# End of 5.5 test
#
# MDEV-20109: Optimizer ignores distinct key created for materialized
diff --git a/mysql-test/main/subselect_sj.test b/mysql-test/main/subselect_sj.test
index 334d16e9c03..c5c3354bc32 100644
--- a/mysql-test/main/subselect_sj.test
+++ b/mysql-test/main/subselect_sj.test
@@ -2942,6 +2942,32 @@ insert into t1 select 'xxx' from dual where 'xxx' in (select a2 from t2);
drop table t1,t2;
+
+--echo #
+--echo # MDEV-13172: Wrong result / SELECT ... WHERE EXISTS ... (with UNIQUE Key)
+--echo #
+
+CREATE TABLE `t1` (
+ `Id` int(11) NOT NULL,
+ PRIMARY KEY (`Id`)
+);
+
+INSERT INTO `t1` (`Id`) VALUES (1);
+
+CREATE TABLE `t2` (
+ `t1_Id` int(11) NOT NULL DEFAULT 0,
+ `col1` int(11) DEFAULT NULL,
+ UNIQUE KEY `col1` (`col1`)
+);
+
+INSERT INTO `t2` (`t1_Id`, `col1`) VALUES (1, NULL), (1, NULL);
+
+SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
+explain extended
+SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
+
+DROP TABLE t1, t2;
+
--echo # End of 5.5 test
--echo #
diff --git a/mysql-test/main/subselect_sj_jcl6.result b/mysql-test/main/subselect_sj_jcl6.result
index 4f451411c2b..7ba13e5b59f 100644
--- a/mysql-test/main/subselect_sj_jcl6.result
+++ b/mysql-test/main/subselect_sj_jcl6.result
@@ -3279,6 +3279,32 @@ create table t1 (a1 varchar(25));
create table t2 (a2 varchar(25)) ;
insert into t1 select 'xxx' from dual where 'xxx' in (select a2 from t2);
drop table t1,t2;
+#
+# MDEV-13172: Wrong result / SELECT ... WHERE EXISTS ... (with UNIQUE Key)
+#
+CREATE TABLE `t1` (
+`Id` int(11) NOT NULL,
+PRIMARY KEY (`Id`)
+);
+INSERT INTO `t1` (`Id`) VALUES (1);
+CREATE TABLE `t2` (
+`t1_Id` int(11) NOT NULL DEFAULT 0,
+`col1` int(11) DEFAULT NULL,
+UNIQUE KEY `col1` (`col1`)
+);
+INSERT INTO `t2` (`t1_Id`, `col1`) VALUES (1, NULL), (1, NULL);
+SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
+Id
+1
+explain extended
+SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 100.00
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
+2 MATERIALIZED t2 ref col1 col1 5 const 2 100.00 Using index condition; Using where
+Warnings:
+Note 1003 select 1 AS `Id` from (`test`.`t2`) where `test`.`t2`.`t1_Id` = 1 and `test`.`t2`.`col1` is null
+DROP TABLE t1, t2;
# End of 5.5 test
#
# MDEV-20109: Optimizer ignores distinct key created for materialized
diff --git a/mysql-test/suite/binlog/r/backup.result b/mysql-test/suite/binlog/r/backup.result
new file mode 100644
index 00000000000..5c6f8b0b515
--- /dev/null
+++ b/mysql-test/suite/binlog/r/backup.result
@@ -0,0 +1,21 @@
+#
+# Test BACKUP STAGES BLOCK_COMMIT with binary logging on
+#
+SET BINLOG_FORMAT=MIXED;
+RESET MASTER;
+create table t1 (a int) engine=aria;
+insert into t1 values (1);
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_COMMIT;
+SELECT @@gtid_binlog_pos;
+@@gtid_binlog_pos
+0-1-2
+BACKUP STAGE END;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=aria
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; insert into t1 values (1)
+master-bin.000001 # Query # # COMMIT
+drop table t1;
diff --git a/mysql-test/suite/binlog/r/read_only.result b/mysql-test/suite/binlog/r/read_only.result
new file mode 100644
index 00000000000..9a173d9a96e
--- /dev/null
+++ b/mysql-test/suite/binlog/r/read_only.result
@@ -0,0 +1,129 @@
+#
+# MDEV-17863 DROP TEMPORARY TABLE creates a transaction in
+# binary log on read only server
+# MDEV-19074 Improved read_only mode for slaves with
+# gtid_strict_mode enabled
+#
+create user test@localhost;
+grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost;
+create table t1 (a int) engine=myisam;
+insert into t1 values (1),(2);
+reset master;
+set global read_only=1;
+# Ensure that optimize and analyze doesn't log to binary log
+connect con1,localhost,test,,test;
+insert into t1 values(3);
+ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+repair table t1;
+Table Op Msg_type Msg_text
+test.t1 repair Error The MariaDB server is running with the --read-only option so it cannot execute this statement
+test.t1 repair error Corrupt
+optimize table t1;
+ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
+# Ensure that using temporary tables is not logged
+create temporary table tmp1 (a int) engine=myisam;
+insert into tmp1 values (1),(2);
+update tmp1 set a=10 where a=2;
+delete from tmp1 where a=1;
+create temporary table tmp2 select * from t1;
+select * from tmp1;
+a
+10
+select * from tmp2;
+a
+1
+2
+create temporary table tmp3 like t1;
+create or replace temporary table tmp3 like t1;
+alter table tmp2 add column (b int);
+select * from tmp2;
+a b
+1 NULL
+2 NULL
+insert into t1 select a+100 from tmp2;
+ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
+drop table tmp1,tmp2,tmp3;
+# Clean up test connection
+disconnect con1;
+connection default;
+# Execute some commands as root that should not be logged
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
+repair table t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+# Changes to temporary tables created under readonly should not
+# be logged
+create temporary table tmp4 (a int) engine=myisam;
+insert into tmp4 values (1),(2);
+create temporary table tmp5 (a int) engine=myisam;
+insert into tmp5 select * from tmp4;
+alter table tmp5 add column (b int);
+set global read_only=0;
+insert into tmp4 values (3),(4);
+insert into tmp5 values (10,3),(11,4);
+select * from tmp4;
+a
+1
+2
+3
+4
+select * from tmp5;
+a b
+1 NULL
+2 NULL
+10 3
+11 4
+update tmp4 set a=10 where a=2;
+delete from tmp4 where a=1;
+create table t2 select * from tmp4;
+alter table tmp5 add column (c int);
+insert into tmp5 values (20,5,1),(21,5,2);
+select * from tmp5;
+a b c
+1 NULL NULL
+2 NULL NULL
+10 3 NULL
+11 4 NULL
+20 5 1
+21 5 2
+insert into t1 select a+200 from tmp5;
+select * from t1;
+a
+1
+2
+201
+202
+210
+211
+220
+221
+drop table tmp4,tmp5;
+# Check what is logged. Only last create select and the insert...select's should be
+# row-logged
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+)
+master-bin.000001 # Annotate_rows # # create table t2 select * from tmp4
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows # # insert into t1 select a+200 from tmp5
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+# Clean up
+drop user test@localhost;
+drop table t1,t2;
diff --git a/mysql-test/suite/binlog/r/read_only_statement.result b/mysql-test/suite/binlog/r/read_only_statement.result
new file mode 100644
index 00000000000..9a173d9a96e
--- /dev/null
+++ b/mysql-test/suite/binlog/r/read_only_statement.result
@@ -0,0 +1,129 @@
+#
+# MDEV-17863 DROP TEMPORARY TABLE creates a transaction in
+# binary log on read only server
+# MDEV-19074 Improved read_only mode for slaves with
+# gtid_strict_mode enabled
+#
+create user test@localhost;
+grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost;
+create table t1 (a int) engine=myisam;
+insert into t1 values (1),(2);
+reset master;
+set global read_only=1;
+# Ensure that optimize and analyze doesn't log to binary log
+connect con1,localhost,test,,test;
+insert into t1 values(3);
+ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+repair table t1;
+Table Op Msg_type Msg_text
+test.t1 repair Error The MariaDB server is running with the --read-only option so it cannot execute this statement
+test.t1 repair error Corrupt
+optimize table t1;
+ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
+# Ensure that using temporary tables is not logged
+create temporary table tmp1 (a int) engine=myisam;
+insert into tmp1 values (1),(2);
+update tmp1 set a=10 where a=2;
+delete from tmp1 where a=1;
+create temporary table tmp2 select * from t1;
+select * from tmp1;
+a
+10
+select * from tmp2;
+a
+1
+2
+create temporary table tmp3 like t1;
+create or replace temporary table tmp3 like t1;
+alter table tmp2 add column (b int);
+select * from tmp2;
+a b
+1 NULL
+2 NULL
+insert into t1 select a+100 from tmp2;
+ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
+drop table tmp1,tmp2,tmp3;
+# Clean up test connection
+disconnect con1;
+connection default;
+# Execute some commands as root that should not be logged
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status Table is already up to date
+repair table t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+# Changes to temporary tables created under readonly should not
+# be logged
+create temporary table tmp4 (a int) engine=myisam;
+insert into tmp4 values (1),(2);
+create temporary table tmp5 (a int) engine=myisam;
+insert into tmp5 select * from tmp4;
+alter table tmp5 add column (b int);
+set global read_only=0;
+insert into tmp4 values (3),(4);
+insert into tmp5 values (10,3),(11,4);
+select * from tmp4;
+a
+1
+2
+3
+4
+select * from tmp5;
+a b
+1 NULL
+2 NULL
+10 3
+11 4
+update tmp4 set a=10 where a=2;
+delete from tmp4 where a=1;
+create table t2 select * from tmp4;
+alter table tmp5 add column (c int);
+insert into tmp5 values (20,5,1),(21,5,2);
+select * from tmp5;
+a b c
+1 NULL NULL
+2 NULL NULL
+10 3 NULL
+11 4 NULL
+20 5 1
+21 5 2
+insert into t1 select a+200 from tmp5;
+select * from t1;
+a
+1
+2
+201
+202
+210
+211
+220
+221
+drop table tmp4,tmp5;
+# Check what is logged. Only last create select and the insert...select's should be
+# row-logged
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+)
+master-bin.000001 # Annotate_rows # # create table t2 select * from tmp4
+master-bin.000001 # Table_map # # table_id: # (test.t2)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Annotate_rows # # insert into t1 select a+200 from tmp5
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+# Clean up
+drop user test@localhost;
+drop table t1,t2;
diff --git a/mysql-test/suite/binlog/t/backup.test b/mysql-test/suite/binlog/t/backup.test
new file mode 100644
index 00000000000..e1d921c787e
--- /dev/null
+++ b/mysql-test/suite/binlog/t/backup.test
@@ -0,0 +1,19 @@
+--source include/have_log_bin.inc
+--source include/have_binlog_format_mixed.inc
+
+--echo #
+--echo # Test BACKUP STAGES BLOCK_COMMIT with binary logging on
+--echo #
+
+SET BINLOG_FORMAT=MIXED;
+RESET MASTER;
+
+create table t1 (a int) engine=aria;
+insert into t1 values (1);
+
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_COMMIT;
+SELECT @@gtid_binlog_pos;
+BACKUP STAGE END;
+source include/show_binlog_events.inc;
+drop table t1;
diff --git a/mysql-test/suite/binlog/t/read_only.inc b/mysql-test/suite/binlog/t/read_only.inc
new file mode 100644
index 00000000000..37f1cb3b2b8
--- /dev/null
+++ b/mysql-test/suite/binlog/t/read_only.inc
@@ -0,0 +1,79 @@
+--echo #
+--echo # MDEV-17863 DROP TEMPORARY TABLE creates a transaction in
+--echo # binary log on read only server
+--echo # MDEV-19074 Improved read_only mode for slaves with
+--echo # gtid_strict_mode enabled
+--echo #
+
+create user test@localhost;
+grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost;
+create table t1 (a int) engine=myisam;
+insert into t1 values (1),(2);
+reset master;
+
+set global read_only=1;
+--echo # Ensure that optimize and analyze doesn't log to binary log
+connect (con1,localhost,test,,test);
+--error ER_OPTION_PREVENTS_STATEMENT
+insert into t1 values(3);
+analyze table t1;
+check table t1;
+repair table t1;
+--error ER_OPTION_PREVENTS_STATEMENT
+optimize table t1;
+
+--echo # Ensure that using temporary tables is not logged
+create temporary table tmp1 (a int) engine=myisam;
+insert into tmp1 values (1),(2);
+update tmp1 set a=10 where a=2;
+delete from tmp1 where a=1;
+create temporary table tmp2 select * from t1;
+select * from tmp1;
+select * from tmp2;
+create temporary table tmp3 like t1;
+create or replace temporary table tmp3 like t1;
+alter table tmp2 add column (b int);
+select * from tmp2;
+--error ER_OPTION_PREVENTS_STATEMENT
+insert into t1 select a+100 from tmp2;
+drop table tmp1,tmp2,tmp3;
+
+--echo # Clean up test connection
+disconnect con1;
+connection default;
+
+--echo # Execute some commands as root that should not be logged
+optimize table t1;
+repair table t1;
+
+--echo # Changes to temporary tables created under readonly should not
+--echo # be logged
+create temporary table tmp4 (a int) engine=myisam;
+insert into tmp4 values (1),(2);
+create temporary table tmp5 (a int) engine=myisam;
+insert into tmp5 select * from tmp4;
+alter table tmp5 add column (b int);
+
+set global read_only=0;
+
+insert into tmp4 values (3),(4);
+insert into tmp5 values (10,3),(11,4);
+select * from tmp4;
+select * from tmp5;
+update tmp4 set a=10 where a=2;
+delete from tmp4 where a=1;
+create table t2 select * from tmp4;
+alter table tmp5 add column (c int);
+insert into tmp5 values (20,5,1),(21,5,2);
+select * from tmp5;
+insert into t1 select a+200 from tmp5;
+select * from t1;
+drop table tmp4,tmp5;
+
+--echo # Check what is logged. Only last create select and the insert...select's should be
+--echo # row-logged
+source include/show_binlog_events.inc;
+
+--echo # Clean up
+drop user test@localhost;
+drop table t1,t2;
diff --git a/mysql-test/suite/binlog/t/read_only.test b/mysql-test/suite/binlog/t/read_only.test
new file mode 100644
index 00000000000..14a4650b36f
--- /dev/null
+++ b/mysql-test/suite/binlog/t/read_only.test
@@ -0,0 +1,2 @@
+--source include/have_binlog_format_mixed_or_row.inc
+--source read_only.inc
diff --git a/mysql-test/suite/binlog/t/read_only_statement.test b/mysql-test/suite/binlog/t/read_only_statement.test
new file mode 100644
index 00000000000..a976854fbb2
--- /dev/null
+++ b/mysql-test/suite/binlog/t/read_only_statement.test
@@ -0,0 +1,2 @@
+--source include/have_binlog_format_statement.inc
+--source read_only.inc
diff --git a/mysql-test/suite/funcs_1/r/is_basics_mixed.result b/mysql-test/suite/funcs_1/r/is_basics_mixed.result
index f9468648c61..235022e3f43 100644
--- a/mysql-test/suite/funcs_1/r/is_basics_mixed.result
+++ b/mysql-test/suite/funcs_1/r/is_basics_mixed.result
@@ -337,7 +337,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'information_schema';
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
-CREATE VIEW db_datadict.v2 AS
+CREATE SQL SECURITY INVOKER VIEW db_datadict.v2 AS
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
FROM information_schema.tables WHERE table_schema = 'db_datadict';
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
diff --git a/mysql-test/suite/funcs_1/t/is_basics_mixed.test b/mysql-test/suite/funcs_1/t/is_basics_mixed.test
index 901441a3557..bed3f633212 100644
--- a/mysql-test/suite/funcs_1/t/is_basics_mixed.test
+++ b/mysql-test/suite/funcs_1/t/is_basics_mixed.test
@@ -281,8 +281,9 @@ WHERE table_schema = 'information_schema';
# 2. This user (testuser1) is also able to GRANT the SELECT privilege
# on this VIEW to another user (testuser2).
# 3. The other user (testuser2) must be able to SELECT on this VIEW
-# but gets a different result set than testuser1.
-CREATE VIEW db_datadict.v2 AS
+# but gets a different result set than testuser1, if the view
+# has SQL SECURITY INVOKER.
+CREATE SQL SECURITY INVOKER VIEW db_datadict.v2 AS
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
FROM information_schema.tables WHERE table_schema = 'db_datadict';
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff
index a1fa20c2ba1..805ccdb563c 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff
+++ b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff
@@ -1,6 +1,6 @@
--- alter_algorithm.result
+++ alter_algorithm.reject
-@@ -7,44 +7,44 @@
+@@ -7,40 +7,40 @@
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
SELECT @@alter_algorithm;
@@alter_algorithm
@@ -19,12 +19,6 @@
-info: Records: 1 Duplicates: 0 Warnings: 0
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
- # Make existing column NON-NULLABLE
- ALTER TABLE t1 MODIFY f3 INT NOT NULL;
--affected rows: 1
--info: Records: 1 Duplicates: 0 Warnings: 0
-+affected rows: 0
-+info: Records: 0 Duplicates: 0 Warnings: 0
# Drop Stored Column
ALTER TABLE t1 DROP COLUMN f5;
-affected rows: 1
@@ -64,7 +58,7 @@
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
-@@ -57,22 +57,22 @@
+@@ -53,22 +53,22 @@
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
@@ -97,7 +91,7 @@
DROP TABLE t2, t1;
affected rows: 0
CREATE TABLE t1(f1 INT NOT NULL,
-@@ -85,27 +85,27 @@
+@@ -81,27 +81,27 @@
INSERT INTO t1(f1, f2) VALUES(1, 1);
# Add column at the end of the table
ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
@@ -135,7 +129,7 @@
# Column length varies
ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
affected rows: 0
-@@ -113,12 +113,12 @@
+@@ -109,12 +109,12 @@
SET foreign_key_checks = 0;
affected rows: 0
ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff
index 879bba43932..6d2ee160e46 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff
+++ b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff
@@ -1,6 +1,6 @@
--- alter_algorithm.result
+++ alter_algorithm.reject
-@@ -7,44 +7,35 @@
+@@ -7,40 +7,32 @@
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
SELECT @@alter_algorithm;
@@alter_algorithm
@@ -17,11 +17,6 @@
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+Got one of the listed errors
- # Make existing column NON-NULLABLE
- ALTER TABLE t1 MODIFY f3 INT NOT NULL;
--affected rows: 1
--info: Records: 1 Duplicates: 0 Warnings: 0
-+Got one of the listed errors
# Drop Stored Column
ALTER TABLE t1 DROP COLUMN f5;
-affected rows: 1
@@ -55,7 +50,7 @@
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
-@@ -57,22 +48,17 @@
+@@ -53,22 +45,17 @@
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
@@ -83,7 +78,7 @@
DROP TABLE t2, t1;
affected rows: 0
CREATE TABLE t1(f1 INT NOT NULL,
-@@ -85,27 +71,27 @@
+@@ -81,27 +68,27 @@
INSERT INTO t1(f1, f2) VALUES(1, 1);
# Add column at the end of the table
ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
@@ -121,7 +116,7 @@
# Column length varies
ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
affected rows: 0
-@@ -113,12 +99,12 @@
+@@ -109,12 +96,12 @@
SET foreign_key_checks = 0;
affected rows: 0
ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
diff --git a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff
index 6db0f2af347..c6ce83b5d9f 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff
+++ b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff
@@ -1,6 +1,6 @@
--- alter_algorithm.result
+++ alter_algorithm.reject
-@@ -7,44 +7,35 @@
+@@ -7,40 +7,32 @@
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
SELECT @@alter_algorithm;
@@alter_algorithm
@@ -17,11 +17,6 @@
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+Got one of the listed errors
- # Make existing column NON-NULLABLE
- ALTER TABLE t1 MODIFY f3 INT NOT NULL;
--affected rows: 1
--info: Records: 1 Duplicates: 0 Warnings: 0
-+Got one of the listed errors
# Drop Stored Column
ALTER TABLE t1 DROP COLUMN f5;
-affected rows: 1
@@ -55,7 +50,7 @@
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
-@@ -57,22 +48,22 @@
+@@ -53,22 +45,22 @@
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
@@ -88,7 +83,7 @@
DROP TABLE t2, t1;
affected rows: 0
CREATE TABLE t1(f1 INT NOT NULL,
-@@ -85,27 +76,27 @@
+@@ -81,27 +73,27 @@
INSERT INTO t1(f1, f2) VALUES(1, 1);
# Add column at the end of the table
ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
@@ -126,7 +121,7 @@
# Column length varies
ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
affected rows: 0
-@@ -113,12 +104,12 @@
+@@ -109,12 +101,12 @@
SET foreign_key_checks = 0;
affected rows: 0
ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
diff --git a/mysql-test/suite/innodb/r/alter_algorithm.result b/mysql-test/suite/innodb/r/alter_algorithm.result
index 3d3a7e85444..bcfbe3355f9 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm.result
+++ b/mysql-test/suite/innodb/r/alter_algorithm.result
@@ -17,10 +17,6 @@ info: Records: 1 Duplicates: 0 Warnings: 0
ALTER TABLE t1 MODIFY f2 INT;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
-# Make existing column NON-NULLABLE
-ALTER TABLE t1 MODIFY f3 INT NOT NULL;
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
# Drop Stored Column
ALTER TABLE t1 DROP COLUMN f5;
affected rows: 1
diff --git a/mysql-test/suite/innodb/r/ibuf_not_empty.result b/mysql-test/suite/innodb/r/ibuf_not_empty.result
index 7e6099e7fea..5147521b19f 100644
--- a/mysql-test/suite/innodb/r/ibuf_not_empty.result
+++ b/mysql-test/suite/innodb/r/ibuf_not_empty.result
@@ -18,7 +18,7 @@ INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
-# restart: --innodb-force-recovery=6
+# restart: --innodb-force-recovery=6 --innodb-change-buffer-dump
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
diff --git a/mysql-test/suite/innodb/r/information_schema_grants.result b/mysql-test/suite/innodb/r/information_schema_grants.result
new file mode 100644
index 00000000000..6ef1ce170cd
--- /dev/null
+++ b/mysql-test/suite/innodb/r/information_schema_grants.result
@@ -0,0 +1,304 @@
+select plugin_name,plugin_status as 'Must be ACTIVE' from information_schema.plugins where plugin_name like 'inno%' and plugin_status!='ACTIVE';
+plugin_name Must be ACTIVE
+create user select_only@localhost;
+grant select on *.* to select_only@localhost;
+connect select_only,localhost,select_only;
+connection default;
+create sql security invoker view i_buffer_page as select * from information_schema.innodb_buffer_page;
+create sql security definer view d_buffer_page as select * from information_schema.innodb_buffer_page;
+create sql security invoker view i_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru;
+create sql security definer view d_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru;
+create sql security invoker view i_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats;
+create sql security definer view d_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats;
+create sql security invoker view i_cmp as select * from information_schema.innodb_cmp;
+create sql security definer view d_cmp as select * from information_schema.innodb_cmp;
+create sql security invoker view i_cmp_per_index as select * from information_schema.innodb_cmp_per_index;
+create sql security definer view d_cmp_per_index as select * from information_schema.innodb_cmp_per_index;
+create sql security invoker view i_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset;
+create sql security definer view d_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset;
+create sql security invoker view i_cmp_reset as select * from information_schema.innodb_cmp_reset;
+create sql security definer view d_cmp_reset as select * from information_schema.innodb_cmp_reset;
+create sql security invoker view i_cmpmem as select * from information_schema.innodb_cmpmem;
+create sql security definer view d_cmpmem as select * from information_schema.innodb_cmpmem;
+create sql security invoker view i_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset;
+create sql security definer view d_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset;
+create sql security invoker view i_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted;
+create sql security definer view d_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted;
+create sql security invoker view i_ft_config as select * from information_schema.innodb_ft_config;
+create sql security definer view d_ft_config as select * from information_schema.innodb_ft_config;
+create sql security invoker view i_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword;
+create sql security definer view d_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword;
+create sql security invoker view i_ft_deleted as select * from information_schema.innodb_ft_deleted;
+create sql security definer view d_ft_deleted as select * from information_schema.innodb_ft_deleted;
+create sql security invoker view i_ft_index_cache as select * from information_schema.innodb_ft_index_cache;
+create sql security definer view d_ft_index_cache as select * from information_schema.innodb_ft_index_cache;
+create sql security invoker view i_ft_index_table as select * from information_schema.innodb_ft_index_table;
+create sql security definer view d_ft_index_table as select * from information_schema.innodb_ft_index_table;
+create sql security invoker view i_lock_waits as select * from information_schema.innodb_lock_waits;
+create sql security definer view d_lock_waits as select * from information_schema.innodb_lock_waits;
+create sql security invoker view i_locks as select * from information_schema.innodb_locks;
+create sql security definer view d_locks as select * from information_schema.innodb_locks;
+create sql security invoker view i_metrics as select * from information_schema.innodb_metrics;
+create sql security definer view d_metrics as select * from information_schema.innodb_metrics;
+create sql security invoker view i_mutexes as select * from information_schema.innodb_mutexes;
+create sql security definer view d_mutexes as select * from information_schema.innodb_mutexes;
+create sql security invoker view i_sys_columns as select * from information_schema.innodb_sys_columns;
+create sql security definer view d_sys_columns as select * from information_schema.innodb_sys_columns;
+create sql security invoker view i_sys_datafiles as select * from information_schema.innodb_sys_datafiles;
+create sql security definer view d_sys_datafiles as select * from information_schema.innodb_sys_datafiles;
+create sql security invoker view i_sys_fields as select * from information_schema.innodb_sys_fields;
+create sql security definer view d_sys_fields as select * from information_schema.innodb_sys_fields;
+create sql security invoker view i_sys_foreign as select * from information_schema.innodb_sys_foreign;
+create sql security definer view d_sys_foreign as select * from information_schema.innodb_sys_foreign;
+create sql security invoker view i_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols;
+create sql security definer view d_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols;
+create sql security invoker view i_sys_indexes as select * from information_schema.innodb_sys_indexes;
+create sql security definer view d_sys_indexes as select * from information_schema.innodb_sys_indexes;
+create sql security invoker view i_sys_semaphore_waits as select * from information_schema.innodb_sys_semaphore_waits;
+create sql security definer view d_sys_semaphore_waits as select * from information_schema.innodb_sys_semaphore_waits;
+create sql security invoker view i_sys_tables as select * from information_schema.innodb_sys_tables;
+create sql security definer view d_sys_tables as select * from information_schema.innodb_sys_tables;
+create sql security invoker view i_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces;
+create sql security definer view d_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces;
+create sql security invoker view i_sys_tablestats as select * from information_schema.innodb_sys_tablestats;
+create sql security definer view d_sys_tablestats as select * from information_schema.innodb_sys_tablestats;
+create sql security invoker view i_sys_virtual as select * from information_schema.innodb_sys_virtual;
+create sql security definer view d_sys_virtual as select * from information_schema.innodb_sys_virtual;
+create sql security invoker view i_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption;
+create sql security definer view d_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption;
+create sql security invoker view i_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing;
+create sql security definer view d_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing;
+create sql security invoker view i_trx as select * from information_schema.innodb_trx;
+create sql security definer view d_trx as select * from information_schema.innodb_trx;
+connection select_only;
+select count(*) > -1 from information_schema.innodb_buffer_page;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_buffer_page;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_buffer_page;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_buffer_page_lru;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_buffer_page_lru;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_buffer_page_lru;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_buffer_pool_stats;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_buffer_pool_stats;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_buffer_pool_stats;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_cmp;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_cmp;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_cmp;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_cmp_per_index;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_cmp_per_index;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_cmp_per_index;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_cmp_per_index_reset;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_cmp_per_index_reset;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_cmp_per_index_reset;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_cmp_reset;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_cmp_reset;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_cmp_reset;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_cmpmem;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_cmpmem;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_cmpmem;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_cmpmem_reset;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_cmpmem_reset;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_cmpmem_reset;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_ft_being_deleted;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_ft_being_deleted;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_ft_being_deleted;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_ft_config;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_ft_config;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_ft_config;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_ft_default_stopword;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_ft_deleted;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_ft_deleted;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_ft_deleted;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_ft_index_cache;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_ft_index_cache;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_ft_index_cache;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_ft_index_table;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_ft_index_table;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_ft_index_table;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_lock_waits;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_lock_waits;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_lock_waits;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_locks;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_locks;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_locks;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_metrics;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_metrics;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_metrics;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_mutexes;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_mutexes;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_mutexes;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_sys_columns;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_sys_columns;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_sys_columns;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_sys_datafiles;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_sys_datafiles;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_sys_datafiles;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_sys_fields;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_sys_fields;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_sys_fields;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_sys_foreign;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_sys_foreign;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_sys_foreign;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_sys_foreign_cols;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_sys_foreign_cols;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_sys_foreign_cols;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_sys_indexes;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_sys_indexes;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_sys_indexes;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_sys_semaphore_waits;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_sys_semaphore_waits;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_sys_semaphore_waits;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_sys_tables;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_sys_tables;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_sys_tables;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_sys_tablespaces;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_sys_tablespaces;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_sys_tablespaces;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_sys_tablestats;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_sys_tablestats;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_sys_tablestats;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_sys_virtual;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_sys_virtual;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_sys_virtual;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_tablespaces_encryption;
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+select count(*) > -1 from i_tablespaces_encryption;
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+select count(*) > -1 from d_tablespaces_encryption;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_tablespaces_scrubbing;
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+select count(*) > -1 from i_tablespaces_scrubbing;
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+select count(*) > -1 from d_tablespaces_scrubbing;
+count(*) > -1
+1
+select count(*) > -1 from information_schema.innodb_trx;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from i_trx;
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
+select count(*) > -1 from d_trx;
+count(*) > -1
+1
+connection default;
+drop database test;
+create database test;
+drop user select_only@localhost;
diff --git a/mysql-test/suite/innodb/r/innodb-alter-nullable.result b/mysql-test/suite/innodb/r/innodb-alter-nullable.result
index 68ad6762335..1d481cf2bfe 100644
--- a/mysql-test/suite/innodb/r/innodb-alter-nullable.result
+++ b/mysql-test/suite/innodb/r/innodb-alter-nullable.result
@@ -96,8 +96,8 @@ INSERT INTO t3 SET c=NULL;
SET @old_sql_mode = @@sql_mode;
SET sql_mode = '';
ALTER TABLE t1 MODIFY c INT NOT NULL;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 1
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 1
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
ALTER TABLE t2 MODIFY c INT NOT NULL;
@@ -111,10 +111,9 @@ info: Records: 1 Duplicates: 0 Warnings: 1
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
SET sql_mode = @old_sql_mode;
-# MDEV-18819 FIXME: Wrong result g=NULL
SELECT * FROM t1;
c g
-0 NULL
+0 0
SELECT * FROM t2;
c v
0 0
@@ -137,8 +136,8 @@ INSERT INTO t1 SET c=NULL;
INSERT INTO t2 SET c=NULL;
INSERT INTO t3 SET c=NULL;
ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 1
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 1
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
ALTER IGNORE TABLE t2 MODIFY c INT NOT NULL;
@@ -151,10 +150,9 @@ affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 1
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
-# MDEV-18819 FIXME: Wrong result g=NULL
SELECT * FROM t1;
c g
-0 NULL
+0 0
SELECT * FROM t2;
c v
0 0
@@ -186,12 +184,11 @@ UPDATE t1 SET c=0;
UPDATE t2 SET c=0;
UPDATE t3 SET c=0;
ALTER TABLE t1 MODIFY c INT NOT NULL;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
ALTER TABLE t2 MODIFY c INT NOT NULL;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
-# MDEV-18819 FIXME: This should not require ALGORITHM=COPY.
ALTER TABLE t3 MODIFY c INT NOT NULL;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index ebc5391dbea..273da66073e 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -567,7 +567,7 @@ Variable_name Value
auto_increment_increment 65535
auto_increment_offset 65535
INSERT INTO t1 VALUES (NULL),(NULL);
-ERROR HY000: Failed to read auto-increment value from storage engine
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1
1
@@ -677,7 +677,7 @@ SELECT a,b FROM t;
a b
1 S1
3 S2
-4 S2
+5 S2
disconnect con1;
connection default;
# Client 1: Insert a record with auto_increment_increment=1
@@ -688,14 +688,14 @@ t CREATE TABLE `t` (
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`b` varchar(200) DEFAULT NULL,
PRIMARY KEY (`a`)
-) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
INSERT INTO t(b) VALUES('S1');
SELECT a,b FROM t;
a b
1 S1
3 S2
-4 S2
-5 S1
+5 S2
+6 S1
DROP TABLE t;
# Autoincrement behaviour with mixed insert.
CREATE TABLE t(
@@ -733,22 +733,22 @@ t CREATE TABLE `t` (
`a` tinyint(4) NOT NULL AUTO_INCREMENT,
`b` varchar(200) DEFAULT NULL,
PRIMARY KEY (`a`)
-) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1
INSERT INTO t(b) VALUES('S4');
SELECT * FROM t;
a b
1 S0
11 S1
-22 S3
-23 S4
28 S2
+31 S3
+32 S4
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` tinyint(4) NOT NULL AUTO_INCREMENT,
`b` varchar(200) DEFAULT NULL,
PRIMARY KEY (`a`)
-) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1
DROP TABLE t;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
DROP TABLE IF EXISTS t1;
@@ -789,7 +789,7 @@ t2 CREATE TABLE `t2` (
`n` int(10) unsigned NOT NULL,
`o` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`m`)
-) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SHOW CREATE TABLE t1;
Table Create Table
@@ -1475,13 +1475,13 @@ SELECT * FROM t;
i
1
301
-351
+601
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`i` int(11) NOT NULL AUTO_INCREMENT,
KEY `i` (`i`)
-) ENGINE=InnoDB AUTO_INCREMENT=401 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=651 DEFAULT CHARSET=latin1
DROP TABLE t;
SET auto_increment_increment = DEFAULT;
#
diff --git a/mysql-test/suite/innodb/r/innodb_stats_persistent.result b/mysql-test/suite/innodb/r/innodb_stats_persistent.result
index 11a352e625d..e25ab2a8a24 100644
--- a/mysql-test/suite/innodb/r/innodb_stats_persistent.result
+++ b/mysql-test/suite/innodb/r/innodb_stats_persistent.result
@@ -1,22 +1,15 @@
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
SET @saved_include_delete_marked = @@GLOBAL.innodb_stats_include_delete_marked;
SET GLOBAL innodb_stats_include_delete_marked = ON;
SET @saved_traditional = @@GLOBAL.innodb_stats_traditional;
SET GLOBAL innodb_stats_traditional=false;
SET @saved_modified_counter = @@GLOBAL.innodb_stats_modified_counter;
SET GLOBAL innodb_stats_modified_counter=1;
-CREATE TABLE t0 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val))
+CREATE TABLE t1 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val))
ENGINE=INNODB STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
-CREATE TABLE t1 LIKE t0;
-CREATE TABLE t2 LIKE t0;
-INSERT INTO t0 (val) VALUES (4);
-INSERT INTO t0 (val) SELECT 4 FROM t0;
-INSERT INTO t0 (val) SELECT 4 FROM t0;
-INSERT INTO t0 (val) SELECT 4 FROM t0;
-INSERT INTO t0 (val) SELECT 4 FROM t0;
-INSERT INTO t1 SELECT * FROM t0;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-16
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
@@ -49,7 +42,7 @@ COUNT(*)
0
connection default;
BEGIN;
-INSERT INTO t2 SELECT * FROM t0;
+INSERT INTO t2 (val) SELECT 4 FROM seq_1_to_16;
# The INSERT will show up before COMMIT.
EXPLAIN SELECT * FROM t2 WHERE val=4;
id select_type table type possible_keys key key_len ref rows Extra
@@ -66,17 +59,14 @@ connection con1;
EXPLAIN SELECT * FROM t2 WHERE val=4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref val val 4 const 1 Using index
-SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
-SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
InnoDB 0 transactions not purged
-SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
# After COMMIT and purge, the DELETE must show up.
EXPLAIN SELECT * FROM t1 WHERE val=4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref val val 4 const 1 Using index
SET GLOBAL innodb_stats_include_delete_marked = OFF;
BEGIN;
-INSERT INTO t1 SELECT * FROM t0;
+INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
EXPLAIN SELECT * FROM t1 WHERE val=4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref val val 4 const 16 Using index
@@ -85,7 +75,7 @@ EXPLAIN SELECT * FROM t1 WHERE val=4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref val val 4 const 1 Using index
BEGIN;
-INSERT INTO t1 SELECT * FROM t0;
+INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
COMMIT;
EXPLAIN SELECT * FROM t1 WHERE val=4;
id select_type table type possible_keys key key_len ref rows Extra
@@ -111,7 +101,8 @@ COUNT(*)
16
disconnect con1;
connection default;
-DROP TABLE t0,t1,t2;
+DROP TABLE t1,t2;
SET GLOBAL innodb_stats_include_delete_marked = @saved_include_delete_marked;
SET GLOBAL innodb_stats_traditional = @saved_traditional;
SET GLOBAL innodb_stats_modified_counter = @saved_modified_counter;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result
index 661db48099d..19262246c9b 100644
--- a/mysql-test/suite/innodb/r/instant_alter_bugs.result
+++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result
@@ -130,6 +130,10 @@ HANDLER h READ `PRIMARY` PREV WHERE 0;
pk f1 f2 f3 f4 f5 f6 f7 f8 filler
HANDLER h CLOSE;
DROP TABLE t1;
+#
+# MDEV-19630 ALTER TABLE ... ADD COLUMN damages foreign keys
+# which are pointed to the table being altered
+#
CREATE TABLE t1(f1 int not null, primary key(f1))engine=innodb;
CREATE TABLE t2(f1 INT AUTO_INCREMENT NOT NULL, f2 INT NOT NULL,
status ENUM ('a', 'b', 'c'), INDEX idx1(f2),
@@ -156,6 +160,17 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t2 CHANGE status status VARCHAR(20) DEFAULT NULL;
DROP TABLE t2, t1;
+#
+# MDEV-20938 Double free of dict_foreign_t during instant ALTER TABLE
+#
+CREATE TABLE t1 (id INT UNSIGNED PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT UNSIGNED PRIMARY KEY, b INT UNSIGNED UNIQUE,
+FOREIGN KEY fk1 (b) REFERENCES t1 (id)) ENGINE=InnoDB;
+ALTER TABLE t2
+DROP FOREIGN KEY fk1,
+CHANGE b d INT UNSIGNED,
+ADD c INT;
+DROP TABLE t2, t1;
create table t (
a varchar(9),
b int,
diff --git a/mysql-test/suite/innodb/r/stat_tables.result b/mysql-test/suite/innodb/r/stat_tables.result
new file mode 100644
index 00000000000..bb449570479
--- /dev/null
+++ b/mysql-test/suite/innodb/r/stat_tables.result
@@ -0,0 +1,15 @@
+rename table mysql.table_stats to mysql.table_stats_save;
+flush tables;
+set use_stat_tables= PREFERABLY;
+create table t1 (a int) engine=InnoDB;
+start transaction;
+insert t1 values (1);
+insert t1 values (2);
+commit;
+select * from t1;
+a
+1
+2
+drop table t1;
+rename table mysql.table_stats_save to mysql.table_stats;
+flush tables;
diff --git a/mysql-test/suite/innodb/t/alter_algorithm.test b/mysql-test/suite/innodb/t/alter_algorithm.test
index 7cb706e865a..d410a15154d 100644
--- a/mysql-test/suite/innodb/t/alter_algorithm.test
+++ b/mysql-test/suite/innodb/t/alter_algorithm.test
@@ -31,10 +31,6 @@ ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col
--error $error_code
ALTER TABLE t1 MODIFY f2 INT;
---echo # Make existing column NON-NULLABLE
---error $error_code
-ALTER TABLE t1 MODIFY f3 INT NOT NULL;
-
--echo # Drop Stored Column
--error $error_code
ALTER TABLE t1 DROP COLUMN f5;
diff --git a/mysql-test/suite/innodb/t/ibuf_not_empty.test b/mysql-test/suite/innodb/t/ibuf_not_empty.test
index 5adbfb72550..470d375c661 100644
--- a/mysql-test/suite/innodb/t/ibuf_not_empty.test
+++ b/mysql-test/suite/innodb/t/ibuf_not_empty.test
@@ -43,7 +43,7 @@ INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
---let $restart_parameters= --innodb-force-recovery=6
+--let $restart_parameters= --innodb-force-recovery=6 --innodb-change-buffer-dump
--source include/restart_mysqld.inc
--replace_regex /contains \d+ entries/contains #### entries/
diff --git a/mysql-test/suite/innodb/t/information_schema_grants.opt b/mysql-test/suite/innodb/t/information_schema_grants.opt
new file mode 100644
index 00000000000..ce08c46f047
--- /dev/null
+++ b/mysql-test/suite/innodb/t/information_schema_grants.opt
@@ -0,0 +1,33 @@
+--enable-plugin-innodb-trx
+--enable-plugin-innodb-locks
+--enable-plugin-innodb-lock-waits
+--enable-plugin-innodb-cmp
+--enable-plugin-innodb-cmp-reset
+--enable-plugin-innodb-cmpmem
+--enable-plugin-innodb-cmpmem-reset
+--enable-plugin-innodb-cmp-per-index
+--enable-plugin-innodb-cmp-per-index-reset
+--enable-plugin-innodb-buffer-page
+--enable-plugin-innodb-buffer-page-lru
+--enable-plugin-innodb-buffer-pool-stats
+--enable-plugin-innodb-metrics
+--enable-plugin-innodb-ft-default-stopword
+--enable-plugin-innodb-ft-deleted
+--enable-plugin-innodb-ft-being-deleted
+--enable-plugin-innodb-ft-config
+--enable-plugin-innodb-ft-index-cache
+--enable-plugin-innodb-ft-index-table
+--enable-plugin-innodb-sys-tables
+--enable-plugin-innodb-sys-tablestats
+--enable-plugin-innodb-sys-indexes
+--enable-plugin-innodb-sys-columns
+--enable-plugin-innodb-sys-fields
+--enable-plugin-innodb-sys-foreign
+--enable-plugin-innodb-sys-foreign-cols
+--enable-plugin-innodb-sys-tablespaces
+--enable-plugin-innodb-sys-datafiles
+--enable-plugin-innodb-sys-virtual
+--enable-plugin-innodb-mutexes
+--enable-plugin-innodb-sys-semaphore-waits
+--enable-plugin-innodb-tablespaces-encryption
+--enable-plugin-innodb-tablespaces-scrubbing
diff --git a/mysql-test/suite/innodb/t/information_schema_grants.test b/mysql-test/suite/innodb/t/information_schema_grants.test
new file mode 100644
index 00000000000..34565f76352
--- /dev/null
+++ b/mysql-test/suite/innodb/t/information_schema_grants.test
@@ -0,0 +1,311 @@
+source include/have_innodb.inc;
+source include/not_embedded.inc;
+
+# make sure we've enabled everything:
+select plugin_name,plugin_status as 'Must be ACTIVE' from information_schema.plugins where plugin_name like 'inno%' and plugin_status!='ACTIVE';
+
+create user select_only@localhost;
+grant select on *.* to select_only@localhost;
+
+connect select_only,localhost,select_only;
+connection default;
+
+create sql security invoker view i_buffer_page as select * from information_schema.innodb_buffer_page;
+create sql security definer view d_buffer_page as select * from information_schema.innodb_buffer_page;
+
+create sql security invoker view i_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru;
+create sql security definer view d_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru;
+
+create sql security invoker view i_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats;
+create sql security definer view d_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats;
+
+create sql security invoker view i_cmp as select * from information_schema.innodb_cmp;
+create sql security definer view d_cmp as select * from information_schema.innodb_cmp;
+
+create sql security invoker view i_cmp_per_index as select * from information_schema.innodb_cmp_per_index;
+create sql security definer view d_cmp_per_index as select * from information_schema.innodb_cmp_per_index;
+
+create sql security invoker view i_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset;
+create sql security definer view d_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset;
+
+create sql security invoker view i_cmp_reset as select * from information_schema.innodb_cmp_reset;
+create sql security definer view d_cmp_reset as select * from information_schema.innodb_cmp_reset;
+
+create sql security invoker view i_cmpmem as select * from information_schema.innodb_cmpmem;
+create sql security definer view d_cmpmem as select * from information_schema.innodb_cmpmem;
+
+create sql security invoker view i_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset;
+create sql security definer view d_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset;
+
+create sql security invoker view i_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted;
+create sql security definer view d_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted;
+
+create sql security invoker view i_ft_config as select * from information_schema.innodb_ft_config;
+create sql security definer view d_ft_config as select * from information_schema.innodb_ft_config;
+
+create sql security invoker view i_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword;
+create sql security definer view d_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword;
+
+create sql security invoker view i_ft_deleted as select * from information_schema.innodb_ft_deleted;
+create sql security definer view d_ft_deleted as select * from information_schema.innodb_ft_deleted;
+
+create sql security invoker view i_ft_index_cache as select * from information_schema.innodb_ft_index_cache;
+create sql security definer view d_ft_index_cache as select * from information_schema.innodb_ft_index_cache;
+
+create sql security invoker view i_ft_index_table as select * from information_schema.innodb_ft_index_table;
+create sql security definer view d_ft_index_table as select * from information_schema.innodb_ft_index_table;
+
+create sql security invoker view i_lock_waits as select * from information_schema.innodb_lock_waits;
+create sql security definer view d_lock_waits as select * from information_schema.innodb_lock_waits;
+
+create sql security invoker view i_locks as select * from information_schema.innodb_locks;
+create sql security definer view d_locks as select * from information_schema.innodb_locks;
+
+create sql security invoker view i_metrics as select * from information_schema.innodb_metrics;
+create sql security definer view d_metrics as select * from information_schema.innodb_metrics;
+
+create sql security invoker view i_mutexes as select * from information_schema.innodb_mutexes;
+create sql security definer view d_mutexes as select * from information_schema.innodb_mutexes;
+
+create sql security invoker view i_sys_columns as select * from information_schema.innodb_sys_columns;
+create sql security definer view d_sys_columns as select * from information_schema.innodb_sys_columns;
+
+create sql security invoker view i_sys_datafiles as select * from information_schema.innodb_sys_datafiles;
+create sql security definer view d_sys_datafiles as select * from information_schema.innodb_sys_datafiles;
+
+create sql security invoker view i_sys_fields as select * from information_schema.innodb_sys_fields;
+create sql security definer view d_sys_fields as select * from information_schema.innodb_sys_fields;
+
+create sql security invoker view i_sys_foreign as select * from information_schema.innodb_sys_foreign;
+create sql security definer view d_sys_foreign as select * from information_schema.innodb_sys_foreign;
+
+create sql security invoker view i_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols;
+create sql security definer view d_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols;
+
+create sql security invoker view i_sys_indexes as select * from information_schema.innodb_sys_indexes;
+create sql security definer view d_sys_indexes as select * from information_schema.innodb_sys_indexes;
+
+create sql security invoker view i_sys_semaphore_waits as select * from information_schema.innodb_sys_semaphore_waits;
+create sql security definer view d_sys_semaphore_waits as select * from information_schema.innodb_sys_semaphore_waits;
+
+create sql security invoker view i_sys_tables as select * from information_schema.innodb_sys_tables;
+create sql security definer view d_sys_tables as select * from information_schema.innodb_sys_tables;
+
+create sql security invoker view i_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces;
+create sql security definer view d_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces;
+
+create sql security invoker view i_sys_tablestats as select * from information_schema.innodb_sys_tablestats;
+create sql security definer view d_sys_tablestats as select * from information_schema.innodb_sys_tablestats;
+
+create sql security invoker view i_sys_virtual as select * from information_schema.innodb_sys_virtual;
+create sql security definer view d_sys_virtual as select * from information_schema.innodb_sys_virtual;
+
+create sql security invoker view i_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption;
+create sql security definer view d_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption;
+
+create sql security invoker view i_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing;
+create sql security definer view d_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing;
+
+create sql security invoker view i_trx as select * from information_schema.innodb_trx;
+create sql security definer view d_trx as select * from information_schema.innodb_trx;
+
+connection select_only;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_buffer_page;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_buffer_page;
+select count(*) > -1 from d_buffer_page;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_buffer_page_lru;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_buffer_page_lru;
+select count(*) > -1 from d_buffer_page_lru;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_buffer_pool_stats;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_buffer_pool_stats;
+select count(*) > -1 from d_buffer_pool_stats;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_cmp;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_cmp;
+select count(*) > -1 from d_cmp;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_cmp_per_index;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_cmp_per_index;
+select count(*) > -1 from d_cmp_per_index;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_cmp_per_index_reset;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_cmp_per_index_reset;
+select count(*) > -1 from d_cmp_per_index_reset;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_cmp_reset;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_cmp_reset;
+select count(*) > -1 from d_cmp_reset;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_cmpmem;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_cmpmem;
+select count(*) > -1 from d_cmpmem;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_cmpmem_reset;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_cmpmem_reset;
+select count(*) > -1 from d_cmpmem_reset;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_ft_being_deleted;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_ft_being_deleted;
+select count(*) > -1 from d_ft_being_deleted;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_ft_config;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_ft_config;
+select count(*) > -1 from d_ft_config;
+
+# non-privileged table
+select count(*) > -1 from information_schema.innodb_ft_default_stopword;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_ft_deleted;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_ft_deleted;
+select count(*) > -1 from d_ft_deleted;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_ft_index_cache;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_ft_index_cache;
+select count(*) > -1 from d_ft_index_cache;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_ft_index_table;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_ft_index_table;
+select count(*) > -1 from d_ft_index_table;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_lock_waits;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_lock_waits;
+select count(*) > -1 from d_lock_waits;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_locks;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_locks;
+select count(*) > -1 from d_locks;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_metrics;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_metrics;
+select count(*) > -1 from d_metrics;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_mutexes;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_mutexes;
+select count(*) > -1 from d_mutexes;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_sys_columns;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_sys_columns;
+select count(*) > -1 from d_sys_columns;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_sys_datafiles;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_sys_datafiles;
+select count(*) > -1 from d_sys_datafiles;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_sys_fields;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_sys_fields;
+select count(*) > -1 from d_sys_fields;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_sys_foreign;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_sys_foreign;
+select count(*) > -1 from d_sys_foreign;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_sys_foreign_cols;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_sys_foreign_cols;
+select count(*) > -1 from d_sys_foreign_cols;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_sys_indexes;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_sys_indexes;
+select count(*) > -1 from d_sys_indexes;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_sys_semaphore_waits;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_sys_semaphore_waits;
+select count(*) > -1 from d_sys_semaphore_waits;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_sys_tables;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_sys_tables;
+select count(*) > -1 from d_sys_tables;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_sys_tablespaces;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_sys_tablespaces;
+select count(*) > -1 from d_sys_tablespaces;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_sys_tablestats;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_sys_tablestats;
+select count(*) > -1 from d_sys_tablestats;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_sys_virtual;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_sys_virtual;
+select count(*) > -1 from d_sys_virtual;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_tablespaces_encryption;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_tablespaces_encryption;
+select count(*) > -1 from d_tablespaces_encryption;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_tablespaces_scrubbing;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_tablespaces_scrubbing;
+select count(*) > -1 from d_tablespaces_scrubbing;
+
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from information_schema.innodb_trx;
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
+select count(*) > -1 from i_trx;
+select count(*) > -1 from d_trx;
+
+connection default;
+drop database test;
+create database test;
+drop user select_only@localhost;
diff --git a/mysql-test/suite/innodb/t/innodb-alter-nullable.test b/mysql-test/suite/innodb/t/innodb-alter-nullable.test
index 9e6f5df2bc9..af13a12ab41 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-nullable.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-nullable.test
@@ -104,7 +104,6 @@ ALTER TABLE t2 MODIFY c INT NOT NULL;
ALTER TABLE t3 MODIFY c INT NOT NULL;
--disable_info
SET sql_mode = @old_sql_mode;
---echo # MDEV-18819 FIXME: Wrong result g=NULL
SELECT * FROM t1;
SELECT * FROM t2;
SELECT * FROM t3;
@@ -123,7 +122,6 @@ ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL;
ALTER IGNORE TABLE t2 MODIFY c INT NOT NULL;
ALTER IGNORE TABLE t3 MODIFY c INT NOT NULL;
--disable_info
---echo # MDEV-18819 FIXME: Wrong result g=NULL
SELECT * FROM t1;
SELECT * FROM t2;
SELECT * FROM t3;
@@ -151,7 +149,6 @@ UPDATE t3 SET c=0;
--enable_info
ALTER TABLE t1 MODIFY c INT NOT NULL;
ALTER TABLE t2 MODIFY c INT NOT NULL;
---echo # MDEV-18819 FIXME: This should not require ALGORITHM=COPY.
ALTER TABLE t3 MODIFY c INT NOT NULL;
--disable_info
SELECT * FROM t1;
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test
index 74a52caba12..ca7727d4cef 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.test
@@ -349,7 +349,7 @@ INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
SHOW VARIABLES LIKE "auto_inc%";
---error 1467
+--error HA_ERR_AUTOINC_ERANGE
INSERT INTO t1 VALUES (NULL),(NULL);
SELECT * FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_persistent.test b/mysql-test/suite/innodb/t/innodb_stats_persistent.test
index 652b201c4b4..f79ae37e8de 100644
--- a/mysql-test/suite/innodb/t/innodb_stats_persistent.test
+++ b/mysql-test/suite/innodb/t/innodb_stats_persistent.test
@@ -1,6 +1,8 @@
--source include/have_innodb.inc
---source include/big_test.inc
+--source include/have_sequence.inc
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
SET @saved_include_delete_marked = @@GLOBAL.innodb_stats_include_delete_marked;
SET GLOBAL innodb_stats_include_delete_marked = ON;
SET @saved_traditional = @@GLOBAL.innodb_stats_traditional;
@@ -8,19 +10,11 @@ SET GLOBAL innodb_stats_traditional=false;
SET @saved_modified_counter = @@GLOBAL.innodb_stats_modified_counter;
SET GLOBAL innodb_stats_modified_counter=1;
-CREATE TABLE t0 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val))
+CREATE TABLE t1 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val))
ENGINE=INNODB STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
-CREATE TABLE t1 LIKE t0;
-CREATE TABLE t2 LIKE t0;
+CREATE TABLE t2 LIKE t1;
-INSERT INTO t0 (val) VALUES (4);
-INSERT INTO t0 (val) SELECT 4 FROM t0;
-INSERT INTO t0 (val) SELECT 4 FROM t0;
-INSERT INTO t0 (val) SELECT 4 FROM t0;
-INSERT INTO t0 (val) SELECT 4 FROM t0;
-
-INSERT INTO t1 SELECT * FROM t0;
-SELECT COUNT(*) FROM t1;
+INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
ANALYZE TABLE t1;
connect(con1, localhost, root,,);
@@ -46,7 +40,7 @@ SELECT COUNT(*) FROM t1;
connection default;
BEGIN;
-INSERT INTO t2 SELECT * FROM t0;
+INSERT INTO t2 (val) SELECT 4 FROM seq_1_to_16;
--echo # The INSERT will show up before COMMIT.
EXPLAIN SELECT * FROM t2 WHERE val=4;
@@ -57,21 +51,18 @@ SELECT COUNT(*) FROM t2;
connection con1;
EXPLAIN SELECT * FROM t2 WHERE val=4;
-SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
-SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
--source include/wait_all_purged.inc
-SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
--echo # After COMMIT and purge, the DELETE must show up.
EXPLAIN SELECT * FROM t1 WHERE val=4;
SET GLOBAL innodb_stats_include_delete_marked = OFF;
BEGIN;
-INSERT INTO t1 SELECT * FROM t0;
+INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
EXPLAIN SELECT * FROM t1 WHERE val=4;
ROLLBACK;
EXPLAIN SELECT * FROM t1 WHERE val=4;
BEGIN;
-INSERT INTO t1 SELECT * FROM t0;
+INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
COMMIT;
EXPLAIN SELECT * FROM t1 WHERE val=4;
BEGIN;
@@ -89,7 +80,8 @@ disconnect con1;
connection default;
-DROP TABLE t0,t1,t2;
+DROP TABLE t1,t2;
SET GLOBAL innodb_stats_include_delete_marked = @saved_include_delete_marked;
SET GLOBAL innodb_stats_traditional = @saved_traditional;
SET GLOBAL innodb_stats_modified_counter = @saved_modified_counter;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test
index 9f49d1d4682..090a4aef787 100644
--- a/mysql-test/suite/innodb/t/instant_alter_bugs.test
+++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test
@@ -138,8 +138,10 @@ HANDLER h READ `PRIMARY` PREV WHERE 0;
HANDLER h CLOSE;
DROP TABLE t1;
-# MDEV-19630 ALTER TABLE ... ADD COLUMN damages foreign keys which are pointed
-# to the table being altered
+--echo #
+--echo # MDEV-19630 ALTER TABLE ... ADD COLUMN damages foreign keys
+--echo # which are pointed to the table being altered
+--echo #
CREATE TABLE t1(f1 int not null, primary key(f1))engine=innodb;
CREATE TABLE t2(f1 INT AUTO_INCREMENT NOT NULL, f2 INT NOT NULL,
status ENUM ('a', 'b', 'c'), INDEX idx1(f2),
@@ -158,6 +160,19 @@ DROP TABLE t2, t1;
--let $datadir= `select @@datadir`
--remove_file $datadir/test/load.data
+--echo #
+--echo # MDEV-20938 Double free of dict_foreign_t during instant ALTER TABLE
+--echo #
+
+CREATE TABLE t1 (id INT UNSIGNED PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT UNSIGNED PRIMARY KEY, b INT UNSIGNED UNIQUE,
+ FOREIGN KEY fk1 (b) REFERENCES t1 (id)) ENGINE=InnoDB;
+ALTER TABLE t2
+ DROP FOREIGN KEY fk1,
+ CHANGE b d INT UNSIGNED,
+ ADD c INT;
+DROP TABLE t2, t1;
+
create table t (
a varchar(9),
diff --git a/mysql-test/suite/innodb/t/stat_tables.test b/mysql-test/suite/innodb/t/stat_tables.test
new file mode 100644
index 00000000000..68344b3f425
--- /dev/null
+++ b/mysql-test/suite/innodb/t/stat_tables.test
@@ -0,0 +1,17 @@
+source include/have_innodb.inc;
+
+#
+# MDEV-20354 All but last insert ignored in InnoDB tables when table locked
+#
+rename table mysql.table_stats to mysql.table_stats_save;
+flush tables;
+set use_stat_tables= PREFERABLY;
+create table t1 (a int) engine=InnoDB;
+start transaction;
+insert t1 values (1);
+insert t1 values (2);
+commit;
+select * from t1;
+drop table t1;
+rename table mysql.table_stats_save to mysql.table_stats;
+flush tables;
diff --git a/mysql-test/suite/innodb_fts/r/crash_recovery.result b/mysql-test/suite/innodb_fts/r/crash_recovery.result
index cb6a441f905..37c0ff27046 100644
--- a/mysql-test/suite/innodb_fts/r/crash_recovery.result
+++ b/mysql-test/suite/innodb_fts/r/crash_recovery.result
@@ -42,9 +42,11 @@ INSERT INTO articles (title,body) VALUES
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...');
+connect dml, localhost, root,,;
BEGIN;
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...');
+connection default;
# Make durable the AUTO_INCREMENT in the above incomplete transaction.
connect flush_redo_log,localhost,root,,;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
@@ -54,6 +56,7 @@ ROLLBACK;
disconnect flush_redo_log;
connection default;
# restart
+disconnect dml;
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...');
SELECT * FROM articles
@@ -81,10 +84,40 @@ INSERT INTO articles VALUES
(4, 11, '1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
(5, 6, 'MySQL vs. YourSQL','In the following database comparison ...'),
(7, 4, 'MySQL Security','When configured properly, MySQL ...');
+connect dml, localhost, root,,;
BEGIN;
INSERT INTO articles VALUES
(100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');
+connect dml2, localhost, root,,;
+#
+# MDEV-19073 FTS row mismatch after crash recovery
+#
+CREATE TABLE mdev19073(id SERIAL, title VARCHAR(200), body TEXT,
+FULLTEXT(title,body)) ENGINE=InnoDB;
+INSERT INTO mdev19073 (title, body) VALUES
+('MySQL Tutorial', 'DBMS stands for Database...');
+CREATE FULLTEXT INDEX idx ON mdev19073(title, body);
+CREATE TABLE mdev19073_2 LIKE mdev19073;
+INSERT INTO mdev19073_2 (title, body) VALUES
+('MySQL Tutorial', 'DBMS stands for Database...');
+INSERT INTO mdev19073 (title, body) VALUES
+('MariaDB Tutorial', 'DB means Database ...');
+INSERT INTO mdev19073_2 (title, body) VALUES
+('MariaDB Tutorial', 'DB means Database ...');
+SELECT * FROM mdev19073 WHERE MATCH (title, body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for Database...
+2 MariaDB Tutorial DB means Database ...
+SELECT * FROM mdev19073_2 WHERE MATCH (title, body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for Database...
+2 MariaDB Tutorial DB means Database ...
+connection default;
# restart
+disconnect dml;
+disconnect dml2;
INSERT INTO articles VALUES (8, 12, 'MySQL Tutorial','DBMS stands for DataBase ...');
SELECT * FROM articles WHERE MATCH (title, body)
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
@@ -93,3 +126,14 @@ id FTS_DOC_ID title body
1 10 MySQL Tutorial DBMS stands for DataBase ...
8 12 MySQL Tutorial DBMS stands for DataBase ...
DROP TABLE articles;
+SELECT * FROM mdev19073 WHERE MATCH (title, body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for Database...
+2 MariaDB Tutorial DB means Database ...
+SELECT * FROM mdev19073_2 WHERE MATCH (title, body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for Database...
+2 MariaDB Tutorial DB means Database ...
+DROP TABLE mdev19073, mdev19073_2;
diff --git a/mysql-test/suite/innodb_fts/t/crash_recovery.test b/mysql-test/suite/innodb_fts/t/crash_recovery.test
index f39d6680dfb..1b321af236a 100644
--- a/mysql-test/suite/innodb_fts/t/crash_recovery.test
+++ b/mysql-test/suite/innodb_fts/t/crash_recovery.test
@@ -6,6 +6,7 @@
--source include/have_innodb.inc
# The embedded server tests do not support restarting.
--source include/not_embedded.inc
+--source include/maybe_debug.inc
FLUSH TABLES;
# Following are test for crash recovery on FTS index, the first scenario
@@ -73,10 +74,12 @@ INSERT INTO articles (title,body) VALUES
('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...');
+connect(dml, localhost, root,,);
BEGIN;
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...');
+connection default;
--echo # Make durable the AUTO_INCREMENT in the above incomplete transaction.
--connect (flush_redo_log,localhost,root,,)
@@ -89,6 +92,8 @@ ROLLBACK;
--source include/restart_mysqld.inc
+disconnect dml;
+
# This insert will re-initialize the Doc ID counter, it should not crash
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...');
@@ -121,6 +126,7 @@ INSERT INTO articles VALUES
(5, 6, 'MySQL vs. YourSQL','In the following database comparison ...'),
(7, 4, 'MySQL Security','When configured properly, MySQL ...');
+connect(dml, localhost, root,,);
BEGIN;
# Below we do not depend on the durability of the AUTO_INCREMENT sequence,
@@ -128,7 +134,49 @@ BEGIN;
INSERT INTO articles VALUES
(100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');
+connect(dml2, localhost, root,,);
+
+--echo #
+--echo # MDEV-19073 FTS row mismatch after crash recovery
+--echo #
+
+CREATE TABLE mdev19073(id SERIAL, title VARCHAR(200), body TEXT,
+ FULLTEXT(title,body)) ENGINE=InnoDB;
+INSERT INTO mdev19073 (title, body) VALUES
+ ('MySQL Tutorial', 'DBMS stands for Database...');
+CREATE FULLTEXT INDEX idx ON mdev19073(title, body);
+CREATE TABLE mdev19073_2 LIKE mdev19073;
+if ($have_debug)
+{
+--disable_query_log
+SET @saved_dbug = @@debug_dbug;
+SET DEBUG_DBUG = '+d,fts_instrument_sync_debug';
+--enable_query_log
+}
+INSERT INTO mdev19073_2 (title, body) VALUES
+ ('MySQL Tutorial', 'DBMS stands for Database...');
+if ($have_debug)
+{
+--disable_query_log
+SET DEBUG_DBUG = @saved_dbug;
+--enable_query_log
+}
+
+INSERT INTO mdev19073 (title, body) VALUES
+ ('MariaDB Tutorial', 'DB means Database ...');
+INSERT INTO mdev19073_2 (title, body) VALUES
+ ('MariaDB Tutorial', 'DB means Database ...');
+
+# Should return 2 rows
+SELECT * FROM mdev19073 WHERE MATCH (title, body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+SELECT * FROM mdev19073_2 WHERE MATCH (title, body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+connection default;
--source include/restart_mysqld.inc
+disconnect dml;
+disconnect dml2;
# This would re-initialize the FTS index and do the re-tokenization
# of above records
@@ -138,3 +186,10 @@ SELECT * FROM articles WHERE MATCH (title, body)
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
DROP TABLE articles;
+
+# Should return 2 rows
+SELECT * FROM mdev19073 WHERE MATCH (title, body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+SELECT * FROM mdev19073_2 WHERE MATCH (title, body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+DROP TABLE mdev19073, mdev19073_2;
diff --git a/mysql-test/suite/maria/lock.result b/mysql-test/suite/maria/lock.result
index 660f64070ca..de24b987524 100644
--- a/mysql-test/suite/maria/lock.result
+++ b/mysql-test/suite/maria/lock.result
@@ -109,6 +109,39 @@ ALTER TABLE t1 ADD UNIQUE KEY (f1);
ERROR 23000: Duplicate entry 'foo' for key 'f1'
ALTER TABLE t1 ADD KEY (f2);
DROP TABLE t1;
+#
+# MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE
+#
+CREATE TABLE t1 (a INT, b INT) ENGINE=Aria;
+SELECT * FROM t1;
+a b
+CREATE TABLE t2 (c INT) ENGINE=Aria;
+LOCK TABLE t2 READ, t1 WRITE;
+ALTER TABLE t1 CHANGE b a INT;
+ERROR 42S21: Duplicate column name 'a'
+UNLOCK TABLES;
+DROP TABLE t1, t2;
+#
+# MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE
+#
+CREATE TABLE t1 (a INT) ENGINE=Aria;
+CREATE TABLE t2 (b INT) ENGINE=Aria;
+LOCK TABLES t1 WRITE, t2 AS t2a WRITE, t2 WRITE;
+ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY;
+UNLOCK TABLES;
+DROP TABLE t1, t2;
+# More complex test, from RQG
+CREATE TABLE t1 (a INT) ENGINE=Aria;
+CREATE TABLE t2 (b INT) ENGINE=Aria;
+CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2 ;
+LOCK TABLES t1 WRITE, t2 AS t2a WRITE, v2 WRITE CONCURRENT, t2 WRITE;
+ALTER TABLE t1 FORCE;
+ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=INPLACE;
+ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
+ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY;
+UNLOCK TABLES;
+DROP VIEW v2;
+DROP TABLE t1, t2;
# End of 10.2 tests
#
# MDEV-14669 Assertion `file->trn == trn' failed in ha_maria::start_stmt
diff --git a/mysql-test/suite/maria/lock.test b/mysql-test/suite/maria/lock.test
index 37356a359d8..bb709f8a69c 100644
--- a/mysql-test/suite/maria/lock.test
+++ b/mysql-test/suite/maria/lock.test
@@ -118,6 +118,52 @@ ALTER TABLE t1 ADD UNIQUE KEY (f1);
ALTER TABLE t1 ADD KEY (f2);
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE
+--echo #
+
+CREATE TABLE t1 (a INT, b INT) ENGINE=Aria;
+SELECT * FROM t1;
+CREATE TABLE t2 (c INT) ENGINE=Aria;
+
+LOCK TABLE t2 READ, t1 WRITE;
+--error ER_DUP_FIELDNAME
+ALTER TABLE t1 CHANGE b a INT;
+
+# Cleanup
+UNLOCK TABLES;
+DROP TABLE t1, t2;
+
+--echo #
+--echo # MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=Aria;
+CREATE TABLE t2 (b INT) ENGINE=Aria;
+
+LOCK TABLES t1 WRITE, t2 AS t2a WRITE, t2 WRITE;
+ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY;
+UNLOCK TABLES;
+DROP TABLE t1, t2;
+
+--echo # More complex test, from RQG
+
+CREATE TABLE t1 (a INT) ENGINE=Aria;
+CREATE TABLE t2 (b INT) ENGINE=Aria;
+CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2 ;
+
+LOCK TABLES t1 WRITE, t2 AS t2a WRITE, v2 WRITE CONCURRENT, t2 WRITE;
+
+ALTER TABLE t1 FORCE;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED
+ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=INPLACE;
+ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY;
+
+UNLOCK TABLES;
+DROP VIEW v2;
+DROP TABLE t1, t2;
+
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/suite/rpl/r/rpl_read_only2.result b/mysql-test/suite/rpl/r/rpl_read_only2.result
new file mode 100644
index 00000000000..db0f1c1f742
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_read_only2.result
@@ -0,0 +1,54 @@
+include/master-slave.inc
+[connection master]
+#
+# Ensure that read-only slave logs temporary table statements under statement based
+# replication. This is related to MDEV-17863.
+#
+connection slave;
+set global read_only=1;
+connection master;
+create table t1(a int) engine=MyISAM;
+create temporary table tmp1 (a int) engine=MyISAM;
+insert into t1 values(1);
+insert into tmp1 values (2);
+insert into t1 select * from tmp1;
+insert into t1 values(3);
+select * from t1;
+a
+1
+2
+3
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+drop table t1;
+drop temporary table tmp1;
+connection slave;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; create table t1(a int) engine=MyISAM
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; create temporary table tmp1 (a int) engine=MyISAM
+slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
+slave-bin.000001 # Query # # use `test`; insert into t1 values(1)
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
+slave-bin.000001 # Query # # use `test`; insert into tmp1 values (2)
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
+slave-bin.000001 # Query # # use `test`; insert into t1 select * from tmp1
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
+slave-bin.000001 # Query # # use `test`; insert into t1 values(3)
+slave-bin.000001 # Query # # COMMIT
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; analyze table t1
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tmp1` /* generated by server */
+set global read_only=0;
+connection master;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_read_only2.test b/mysql-test/suite/rpl/t/rpl_read_only2.test
new file mode 100644
index 00000000000..da825c8fc7f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_read_only2.test
@@ -0,0 +1,30 @@
+--source include/have_binlog_format_statement.inc
+--source include/master-slave.inc
+
+--echo #
+--echo # Ensure that read-only slave logs temporary table statements under statement based
+--echo # replication. This is related to MDEV-17863.
+--echo #
+
+connection slave;
+set global read_only=1;
+
+connection master;
+
+create table t1(a int) engine=MyISAM;
+create temporary table tmp1 (a int) engine=MyISAM;
+insert into t1 values(1);
+insert into tmp1 values (2);
+insert into t1 select * from tmp1;
+insert into t1 values(3);
+select * from t1;
+analyze table t1;
+drop table t1;
+drop temporary table tmp1;
+
+sync_slave_with_master;
+--source include/show_binlog_events.inc
+set global read_only=0;
+connection master;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/sql_sequence/other.result b/mysql-test/suite/sql_sequence/other.result
index ff58e35772b..abc101b3c00 100644
--- a/mysql-test/suite/sql_sequence/other.result
+++ b/mysql-test/suite/sql_sequence/other.result
@@ -209,4 +209,95 @@ delete s,t1 from t1,s;
ERROR HY000: Storage engine SEQUENCE of the table `test`.`s` doesn't have this option
DROP SEQUENCE s;
DROP TABLE t1;
+#
+# MDEV-20074: Lost connection on update trigger
+#
+# INSERT & table
+create sequence s1 increment by 1 start with 1;
+create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
+create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
+insert into t1 values
+(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
+CREATE TRIGGER tr_upd
+BEFORE UPDATE on t1
+FOR EACH ROW
+BEGIN
+INSERT INTO t2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name);
+END;
+$$
+update t1 set p_first_name='Yunxi' where p_id=1;
+drop sequence s1;
+drop table t1,t2;
+# INSERT & view
+create sequence s1 increment by 1 start with 1;
+create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
+create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
+create view v2 as select * from t2;
+insert into t1 values
+(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
+CREATE TRIGGER tr_upd
+BEFORE UPDATE on t1
+FOR EACH ROW
+BEGIN
+INSERT INTO v2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name);
+END;
+$$
+update t1 set p_first_name='Yunxi' where p_id=1;
+drop view v2;
+drop table t1,t2;
+drop sequence s1;
+# INSERT SELECT & view
+create sequence s1 increment by 1 start with 1;
+create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
+create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
+create view v2 as select * from t2;
+insert into t1 values
+(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
+CREATE TRIGGER tr_upd
+BEFORE UPDATE on t1
+FOR EACH ROW
+BEGIN
+INSERT INTO v2(a_p_name, a_p_first_name) SELECT old.p_name, old.p_first_name;
+END;
+$$
+update t1 set p_first_name='Yunxi' where p_id=1;
+drop view v2;
+drop table t1,t2;
+drop sequence s1;
+# REPLACE & view
+create sequence s1 increment by 1 start with 1;
+create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
+create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
+create view v2 as select * from t2;
+insert into t1 values
+(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
+CREATE TRIGGER tr_upd
+BEFORE UPDATE on t1
+FOR EACH ROW
+BEGIN
+REPLACE INTO v2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name);
+END;
+$$
+update t1 set p_first_name='Yunxi' where p_id=1;
+drop view v2;
+drop table t1,t2;
+drop sequence s1;
+# REPLACE SELECT & view
+create sequence s1 increment by 1 start with 1;
+create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
+create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
+create view v2 as select * from t2;
+insert into t1 values
+(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
+CREATE TRIGGER tr_upd
+BEFORE UPDATE on t1
+FOR EACH ROW
+BEGIN
+REPLACE INTO v2(a_p_name, a_p_first_name) SELECT old.p_name, old.p_first_name;
+END;
+$$
+update t1 set p_first_name='Yunxi' where p_id=1;
+drop view v2;
+drop table t1,t2;
+drop sequence s1;
# End of 10.3 tests
diff --git a/mysql-test/suite/sql_sequence/other.test b/mysql-test/suite/sql_sequence/other.test
index 5759b195950..70c4efa40e5 100644
--- a/mysql-test/suite/sql_sequence/other.test
+++ b/mysql-test/suite/sql_sequence/other.test
@@ -179,4 +179,140 @@ DROP SEQUENCE s;
DROP TABLE t1;
+--echo #
+--echo # MDEV-20074: Lost connection on update trigger
+--echo #
+
+--echo # INSERT & table
+create sequence s1 increment by 1 start with 1;
+create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
+create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
+
+insert into t1 values
+(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
+
+DELIMITER $$;
+
+CREATE TRIGGER tr_upd
+BEFORE UPDATE on t1
+FOR EACH ROW
+BEGIN
+INSERT INTO t2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name);
+END;
+$$
+DELIMITER ;$$
+
+update t1 set p_first_name='Yunxi' where p_id=1;
+
+drop sequence s1;
+drop table t1,t2;
+
+
+--echo # INSERT & view
+create sequence s1 increment by 1 start with 1;
+create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
+create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
+create view v2 as select * from t2;
+
+insert into t1 values
+(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
+
+DELIMITER $$;
+
+CREATE TRIGGER tr_upd
+BEFORE UPDATE on t1
+FOR EACH ROW
+BEGIN
+INSERT INTO v2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name);
+END;
+$$
+DELIMITER ;$$
+
+update t1 set p_first_name='Yunxi' where p_id=1;
+
+drop view v2;
+drop table t1,t2;
+drop sequence s1;
+
+
+--echo # INSERT SELECT & view
+create sequence s1 increment by 1 start with 1;
+create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
+create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
+create view v2 as select * from t2;
+
+insert into t1 values
+(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
+
+DELIMITER $$;
+
+CREATE TRIGGER tr_upd
+BEFORE UPDATE on t1
+FOR EACH ROW
+BEGIN
+INSERT INTO v2(a_p_name, a_p_first_name) SELECT old.p_name, old.p_first_name;
+END;
+$$
+DELIMITER ;$$
+
+update t1 set p_first_name='Yunxi' where p_id=1;
+
+drop view v2;
+drop table t1,t2;
+drop sequence s1;
+
+
+--echo # REPLACE & view
+create sequence s1 increment by 1 start with 1;
+create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
+create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
+create view v2 as select * from t2;
+
+insert into t1 values
+(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
+
+DELIMITER $$;
+
+CREATE TRIGGER tr_upd
+BEFORE UPDATE on t1
+FOR EACH ROW
+BEGIN
+REPLACE INTO v2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name);
+END;
+$$
+DELIMITER ;$$
+
+update t1 set p_first_name='Yunxi' where p_id=1;
+
+drop view v2;
+drop table t1,t2;
+drop sequence s1;
+
+
+--echo # REPLACE SELECT & view
+create sequence s1 increment by 1 start with 1;
+create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
+create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
+create view v2 as select * from t2;
+
+insert into t1 values
+(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
+
+DELIMITER $$;
+
+CREATE TRIGGER tr_upd
+BEFORE UPDATE on t1
+FOR EACH ROW
+BEGIN
+REPLACE INTO v2(a_p_name, a_p_first_name) SELECT old.p_name, old.p_first_name;
+END;
+$$
+DELIMITER ;$$
+
+update t1 set p_first_name='Yunxi' where p_id=1;
+
+drop view v2;
+drop table t1,t2;
+drop sequence s1;
+
--echo # End of 10.3 tests
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index ccdda52ead0..f4c072431c6 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -333,6 +333,18 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_CHANGE_BUFFER_DUMP
+SESSION_VALUE NULL
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Dump the change buffer at startup.
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT NONE
VARIABLE_NAME INNODB_CHANGE_BUFFER_MAX_SIZE
SESSION_VALUE NULL
DEFAULT_VALUE 25
diff --git a/mysql-test/suite/vcol/r/vcol_keys_innodb.result b/mysql-test/suite/vcol/r/vcol_keys_innodb.result
index ae202637cb6..23f9cfa0a0b 100644
--- a/mysql-test/suite/vcol/r/vcol_keys_innodb.result
+++ b/mysql-test/suite/vcol/r/vcol_keys_innodb.result
@@ -269,3 +269,18 @@ index(col_char,vcol_blob(64))
insert ignore into t1 (pk) values (1),(2);
update t1 set col_char = 'foo' where pk = 1;
drop table t1;
+create table t1 (
+id int not null primary key,
+a varchar(200),
+b varchar(200),
+c int,
+va char(200) generated always as (ucase(a)) virtual,
+vb char(200) generated always as (ucase(b)) virtual,
+key (c,va,vb)
+) engine=innodb;
+insert t1 (id,a,c) select seq,seq,seq from seq_1_to_330;
+select IF(@@innodb_sort_buffer_size < count(*)*200, 'GOOD', 'WRONG SIZE') from t1;
+IF(@@innodb_sort_buffer_size < count(*)*200, 'GOOD', 'WRONG SIZE')
+GOOD
+alter table t1 drop column va;
+drop table t1;
diff --git a/mysql-test/suite/vcol/t/vcol_keys_innodb.opt b/mysql-test/suite/vcol/t/vcol_keys_innodb.opt
new file mode 100644
index 00000000000..778b4443d4f
--- /dev/null
+++ b/mysql-test/suite/vcol/t/vcol_keys_innodb.opt
@@ -0,0 +1 @@
+--innodb-sort-buffer-size=64k
diff --git a/mysql-test/suite/vcol/t/vcol_keys_innodb.test b/mysql-test/suite/vcol/t/vcol_keys_innodb.test
index 15206cde328..b6ec73064c5 100644
--- a/mysql-test/suite/vcol/t/vcol_keys_innodb.test
+++ b/mysql-test/suite/vcol/t/vcol_keys_innodb.test
@@ -117,3 +117,21 @@ create table t1 (
insert ignore into t1 (pk) values (1),(2);
update t1 set col_char = 'foo' where pk = 1;
drop table t1;
+
+#
+# MDEV-20799 DROP Virtual Column crashes MariaDB
+#
+--source include/have_sequence.inc
+create table t1 (
+ id int not null primary key,
+ a varchar(200),
+ b varchar(200),
+ c int,
+ va char(200) generated always as (ucase(a)) virtual,
+ vb char(200) generated always as (ucase(b)) virtual,
+ key (c,va,vb)
+) engine=innodb;
+insert t1 (id,a,c) select seq,seq,seq from seq_1_to_330;
+select IF(@@innodb_sort_buffer_size < count(*)*200, 'GOOD', 'WRONG SIZE') from t1;
+alter table t1 drop column va;
+drop table t1;
diff --git a/mysql-test/suite/versioning/r/foreign.result b/mysql-test/suite/versioning/r/foreign.result
index 67d80584a90..1b9925b1e62 100644
--- a/mysql-test/suite/versioning/r/foreign.result
+++ b/mysql-test/suite/versioning/r/foreign.result
@@ -400,3 +400,32 @@ Warning 1265 Data truncated for column 'f12' at row 7
SET timestamp = 9;
REPLACE INTO t2 SELECT * FROM t2;
DROP TABLE t1, t2;
+#
+# MDEV-16210 FK constraints on versioned tables use historical rows, which may cause constraint violation
+#
+create or replace table t1 (a int, key(a)) engine innodb with system versioning;
+create or replace table t2 (b int, foreign key (b) references t1(a)) engine innodb;
+insert into t1 values (1),(2);
+insert into t2 values (1);
+# DELETE from referenced table is not allowed
+delete from t1 where a = 1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`))
+drop tables t2, t1;
+#
+# MDEV-20812 Unexpected ER_ROW_IS_REFERENCED_2 or server crash in row_ins_foreign_report_err upon DELETE from versioned table with FK
+#
+create or replace table t1 (x int primary key) engine innodb;
+create or replace table t2 (x int, foreign key (x) references t1(x)) engine innodb with system versioning;
+set foreign_key_checks= off;
+insert into t2 values (1), (1);
+set foreign_key_checks= on;
+# DELETE from foreign table is allowed
+delete from t2;
+drop tables t2, t1;
+create or replace table t1 (a int, key(a)) engine innodb;
+insert into t1 values (1);
+create or replace table t2 (b int, foreign key (b) references t1(a)) engine innodb with system versioning;
+insert into t2 values (1), (1);
+# DELETE from foreign table is allowed
+delete from t2;
+drop tables t2, t1;
diff --git a/mysql-test/suite/versioning/t/foreign.test b/mysql-test/suite/versioning/t/foreign.test
index 9d754cb05fe..453ddd34034 100644
--- a/mysql-test/suite/versioning/t/foreign.test
+++ b/mysql-test/suite/versioning/t/foreign.test
@@ -426,4 +426,36 @@ DROP TABLE t1, t2;
--remove_file $datadir/test/t1.data.2
--remove_file $datadir/test/t2.data
+--echo #
+--echo # MDEV-16210 FK constraints on versioned tables use historical rows, which may cause constraint violation
+--echo #
+create or replace table t1 (a int, key(a)) engine innodb with system versioning;
+create or replace table t2 (b int, foreign key (b) references t1(a)) engine innodb;
+insert into t1 values (1),(2);
+insert into t2 values (1);
+--echo # DELETE from referenced table is not allowed
+--error ER_ROW_IS_REFERENCED_2
+delete from t1 where a = 1;
+drop tables t2, t1;
+
+--echo #
+--echo # MDEV-20812 Unexpected ER_ROW_IS_REFERENCED_2 or server crash in row_ins_foreign_report_err upon DELETE from versioned table with FK
+--echo #
+create or replace table t1 (x int primary key) engine innodb;
+create or replace table t2 (x int, foreign key (x) references t1(x)) engine innodb with system versioning;
+set foreign_key_checks= off;
+insert into t2 values (1), (1);
+set foreign_key_checks= on;
+--echo # DELETE from foreign table is allowed
+delete from t2;
+drop tables t2, t1;
+
+create or replace table t1 (a int, key(a)) engine innodb;
+insert into t1 values (1);
+create or replace table t2 (b int, foreign key (b) references t1(a)) engine innodb with system versioning;
+insert into t2 values (1), (1);
+--echo # DELETE from foreign table is allowed
+delete from t2;
+drop tables t2, t1;
+
--source suite/versioning/common_finish.inc
diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result
index 6314132ca6c..ebd6c41d9bc 100644
--- a/mysql-test/suite/wsrep/r/variables.result
+++ b/mysql-test/suite/wsrep/r/variables.result
@@ -190,14 +190,15 @@ wsrep_thread_count 0
# applier/rollbacker threads.
SET GLOBAL wsrep_cluster_address= 'gcomm://';
# Wait for applier thread to get created 1.
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
-VARIABLE_VALUE
+# Wait for applier thread to get created 2.
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_1
1
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
-VARIABLE_VALUE
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
+EXPECT_1
1
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
-VARIABLE_VALUE
+SELECT VARIABLE_VALUE AS EXPECT_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+EXPECT_2
2
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
@@ -215,14 +216,14 @@ wsrep_thread_count 2
SET @wsrep_slave_threads_saved= @@global.wsrep_slave_threads;
SET GLOBAL wsrep_slave_threads= 10;
# Wait for 9 applier threads to get created.
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
-VARIABLE_VALUE
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_10
10
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
-VARIABLE_VALUE
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
+EXPECT_1
1
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
-VARIABLE_VALUE
+SELECT VARIABLE_VALUE AS EXPECT_11 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+EXPECT_11
11
SHOW STATUS LIKE 'threads_connected';
Variable_name Value
diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test
index 5032398fc42..6caa5cff500 100644
--- a/mysql-test/suite/wsrep/t/variables.test
+++ b/mysql-test/suite/wsrep/t/variables.test
@@ -102,10 +102,13 @@ SET GLOBAL wsrep_cluster_address= 'gcomm://';
--echo # Wait for applier thread to get created 1.
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
--source include/wait_condition.inc
+--echo # Wait for applier thread to get created 2.
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
+--source include/wait_condition.inc
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
+SELECT VARIABLE_VALUE AS EXPECT_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
@@ -121,9 +124,9 @@ SET GLOBAL wsrep_slave_threads= 10;
--let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
--source include/wait_condition.inc
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
+SELECT VARIABLE_VALUE AS EXPECT_11 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
SHOW STATUS LIKE 'threads_connected';
diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests
index 516c704b3f5..44a4626766c 100644
--- a/mysql-test/unstable-tests
+++ b/mysql-test/unstable-tests
@@ -23,7 +23,7 @@
#
##############################################################################
#
-# Based on bb-10.4-release 8885e7ba7814b5721bcf1a6c5241aea815a80eb9
+# Based on 10.4 903f5fea30cb236c5980a07b7fa63450b0f8067d
main.alter_table : Modified in 10.4.8
main.alter_table_mdev539_maria : Include file modified in 10.4.8
@@ -36,34 +36,39 @@ main.analyze_stmt_orderby : Modified in 10.4.8
main.analyze_stmt_privileges2 : Modified in 10.4.8
main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result
main.auth_named_pipe : MDEV-14724 - System error 2
+main.auto_increment_ranges_innodb : Include file modified in 10.4.9
+main.auto_increment_ranges_myisam : Include file modified in 10.4.9
+main.backup_interaction : Modified in 10.4.9
main.binary_to_hex : MDEV-20211 - Wrong result
main.bootstrap : Modified in 10.3.18
+main.brackets : Modified in 10.4.9
main.bug13633383 : Modified in 10.4.8
main.cast : Modified in 10.2.27
-main.charset_client_win : Added in 10.4.7
-main.column_compression : Modified in 10.4.7
+main.compare : Modified in 10.4.9
main.compound : Modified in 10.4.8
main.compress : Include file modified in 10.4.8
main.connect : MDEV-17282 - Wrong result; include file modified in 10.4.8
main.connect-abstract : MDEV-20162 - Could not execute 'check-testcase'
main.connect2 : MDEV-13885 - Server crash
-main.connect_debug : Modified in 10.4.7
main.constraints : Modified in 10.4.8
main.count_distinct2 : MDEV-11768 - timeout
main.create : Modified in 10.4.8
main.create_delayed : MDEV-10605 - failed with timeout
main.create_drop_event : MDEV-16271 - Wrong result
-main.cte_nonrecursive : Modified in 10.4.8
+main.cte_nonrecursive : Modified in 10.4.9
main.cte_recursive : Modified in 10.4.8
main.ctype_cp932_binlog_stm : MDEV-20534 - Wrong result
main.ctype_create : Modified in 10.2.27
main.ctype_latin1_de : Modified in 10.2.27
+main.ctype_many : Modified in 10.4.9
+main.ctype_uca : Include file modified in 10.4.9
+main.ctype_uca_innodb : Include file modified in 10.4.9
main.ctype_ucs : MDEV-17681 - Data too long for column
main.ctype_upgrade : MDEV-16945 - Error upon mysql_upgrade
main.ctype_utf16 : MDEV-10675: timeout or extra warnings
main.ctype_utf16_def : Configuration modified in 10.4.8
main.ctype_utf16le : MDEV-10675: timeout or extra warnings
-main.ctype_utf8 : Modified in 10.4.8
+main.ctype_utf8 : Include file modified in 10.4.9
main.ctype_utf8mb4 : Modified in 10.4.8
main.ctype_utf8mb4_heap : Include file modified in 10.4.8
main.ctype_utf8mb4_innodb : MDEV-17744 - Timeout; MDEV-18567 - ASAN use-after-poison; include file modified in 10.4.8
@@ -71,6 +76,7 @@ main.ctype_utf8mb4_myisam : Include file modified in 10.4.8
main.custom_aggregates_i_s : Modified in 10.4.8
main.debug_sync : MDEV-10607 - internal error
main.default : Modified in 10.4.8
+main.delayed : MDEV-20961 - Assertion failure
main.derived : Modified in 10.4.8
main.derived_cond_pushdown : Modified in 10.4.8
main.derived_opt : MDEV-11768 - timeout
@@ -78,7 +84,8 @@ main.derived_split_innodb : Modified in 10.4.8
main.derived_view : Modified in 10.4.8
main.dirty_close : MDEV-19368 - mysqltest failed but provided no output
main.distinct : MDEV-14194 - Crash; modified in 10.4.8
-main.drop_bad_db_type : MDEV-15676 - Wrong result
+main.drop_bad_db_type : MDEV-15676 - Wrong result; modified in 10.4.9
+main.drop_debug : Modified in 10.1.42
main.dyncol : MDEV-19455 - Extra warning; modified in 10.4.8
main.empty_user_table : Include file modified in 10.4.8
main.events_1 : Modified in 10.4.8
@@ -93,12 +100,12 @@ main.flush : MDEV-19368 - mysqltest failed but provid
main.flush2 : Modified in 10.2.27
main.func_hybrid_type : Modified in 10.4.8
main.func_isnull : Modified in 10.4.8
-main.func_math : Modified in 10.4.8
-main.func_misc : Modified in 10.4.8
+main.func_json : Modified in 10.4.9
+main.func_math : MDEV-20966 - Wrong error code; modified in 10.4.9
+main.func_misc : Modified in 10.4.9
main.func_str : Modified in 10.4.8
-main.func_time : Modified in 10.4.7
main.function_defaults : Modified in 10.4.8
-main.gis : MDEV-13411 - wrong result on P8; modified in 10.4.7
+main.gis : MDEV-13411 - wrong result on P8
main.grant : Configuration added in 10.4.8
main.grant2 : Configuration added in 10.4.8
main.grant4 : Configuration added in 10.4.8
@@ -110,13 +117,14 @@ main.greedy_optimizer : Modified in 10.4.8
main.group_by : Modified in 10.4.8
main.group_min_max : Modified in 10.4.8
main.handlersocket : Configuration added in 10.4.8
-main.having : Modified in 10.4.7
main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown
main.index_intersect : Modified in 10.4.8
main.index_intersect_innodb : MDEV-10643 - failed with timeout
-main.index_merge_innodb : MDEV-7142 - Plan mismatch
+main.index_merge_innodb : MDEV-7142 - Plan mismatch; modified in 10.4.9
+main.index_merge_myisam : Modified in 10.4.9
main.information_schema : Modified in 10.4.8
main.information_schema-big : Modified in 10.4.8
+main.information_schema_db : Modified in 10.4.9
main.information_schema_parameters : Modified in 10.4.8
main.information_schema_routines : Modified in 10.4.8
main.innodb_ext_key : Modified in 10.4.8
@@ -124,13 +132,14 @@ main.innodb_icp : MDEV-20168 - Wrong execution plans; modi
main.innodb_mysql_lock : MDEV-7861 - Wrong result
main.intersect : Modified in 10.4.8
main.invisible_field_debug : Modified in 10.4.8
+main.ipv4_and_ipv6 : MDEV-20964 - Wrong result
+main.ipv6 : MDEV-20964 - Wrong result
main.join : Modified in 10.4.8
main.join_cache : MDEV-17743 - Bad address from storage engine MyISAM; modified in 10.4.8
main.join_nested_jcl6 : Modified in 10.4.8
-main.join_outer : Modified in 10.4.7
+main.join_outer : Modified in 10.2.27
main.join_outer_innodb : Modified in 10.4.8
main.join_outer_jcl6 : Modified in 10.4.8
-main.keywords : Modified in 10.4.7
main.kill : Modified in 10.4.8
main.kill-2 : MDEV-13257 - Wrong result
main.kill_processlist-6619 : MDEV-10793 - Wrong result
@@ -138,7 +147,9 @@ main.limit_rows_examined : Modified in 10.4.8
main.loaddata : MDEV-19368 - mysqltest failed but provided no output
main.locale : MDEV-20521 - Missing warning
main.log_slow : MDEV-13263 - Wrong result; modified in 10.4.8
+main.log_slow_debug : Modified in 10.4.9
main.log_tables-big : MDEV-13408 - wrong result
+main.log_tables_upgrade : MDEV-20962 - Wrong result
main.long_unique : Modified in 10.4.8
main.mdev-504 : MDEV-15171 - warning
main.mdev13607 : Modified in 10.4.8
@@ -147,7 +158,7 @@ main.merge : MDEV-10607 - sporadic "can't connect"; m
main.mrr_icp_extra : Modified in 10.4.8
main.multi_update : Modified in 10.4.8
main.multi_update_debug : MDEV-20136 - Debug sync point wait timed out
-main.myisam : Modified in 10.4.8
+main.myisam : Modified in 10.4.9
main.myisam_explain_non_select_all : Modified in 10.4.8
main.myisam_icp : Modified in 10.4.8
main.myisam_mrr : Modified in 10.4.8
@@ -157,20 +168,20 @@ main.mysql_client_test_comp : MDEV-16641 - Error in exec
main.mysql_client_test_nonblock : CONC-208 - Error on Power; MDEV-15096 - exec failed
main.mysql_comments : Modified in 10.4.8
main.mysql_upgrade : MDEV-20161 - Wrong result; MDEV-20166 - FATAL ERROR: Upgrade failed; include file modified in 10.4.8
+main.mysql_upgrade-20228 : Added in 10.4.9
main.mysql_upgrade_no_innodb : MDEV-20537 - Wrong result
main.mysql_upgrade_noengine : MDEV-14355 - Wrong result; include file modified in 10.4.8
main.mysql_upgrade_ssl : MDEV-13492 - Unknown SSL error
main.mysql_upgrade_view : MDEV-20161 - Wrong result
main.mysqladmin : MDEV-20535 - Wrong result
main.mysqlcheck : MDEV-20164 - Wrong result; modified in 10.4.8
-main.mysqld--help : Modified in 10.4.7
main.mysqldump : MDEV-14800 - Stack smashing detected; modified in 10.4.8
main.mysqldump-compat-102 : Modified in 10.4.8
main.mysqldump-max : Modified in 10.2.27
main.mysqldump-nl : Modified in 10.4.8
main.mysqldump-utf8mb4 : Modified in 10.4.8
-main.mysqldump_restore : Modified in 10.4.7
main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug
+main.mysqlshow : MDEV-20965 - Wrong result
main.mysqlslap : MDEV-11801 - timeout
main.mysqltest : MDEV-13887 - Wrong result
main.named_pipe : Include file modified in 10.4.8
@@ -179,27 +190,31 @@ main.openssl_1 : MDEV-13492 - Unknown SSL error; modified
main.openssl_6975 : MDEV-17184 - Failures with OpenSSL 1.1.1
main.opt_trace : Modified in 10.4.8
main.opt_tvc : Modified in 10.4.8
+main.order_by_innodb : Modified in 10.4.9
main.order_by_optimizer_innodb : MDEV-10683 - Wrong result
-main.parser : Modified in 10.4.7
-main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock
+main.parser : Modified in 10.4.9
+main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock; modified in 10.4.9
main.partition_example : Configuration added in 10.4.8
-main.partition_innodb : MDEV-20169 - Wrong result; modified in 10.4.8
+main.partition_innodb : MDEV-20169 - Wrong result; modified in 10.4.9
main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings
main.partition_innodb_semi_consistent : MDEV-19411 - Failed to start mysqld.1
main.partition_key_cache : Modified in 10.2.27
main.partition_pruning : Modified in 10.4.8
main.partition_range : Modified in 10.4.8
+main.partition_ucs2 : Added in 10.4.9
+main.partition_utf8 : Modified in 10.4.9
main.password_expiration : Include file modified in 10.4.8
-main.plugin : Configuration added in 10.4.8
-main.plugin_auth : Include file modified in 10.4.8
+main.plugin : Include file modified in 10.4.9
+main.plugin_auth : MDEV-20957 - Upgrade file was not properly created; include file modified in 10.4.8
main.plugin_auth_qa_2 : MDEV-20165 - Wrong result
main.plugin_innodb : Configuration added in 10.4.8
main.plugin_load : Configuration modified in 10.4.8
main.plugin_load_option : Configuration modified in 10.4.8
main.plugin_not_embedded : Configuration added in 10.4.8
main.pool_of_threads : MDEV-18135 - SSL error: key too small; modified in 10.4.8
-main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; configuration modified in 10.4.8
-main.ps_innodb : Added in 10.4.7
+main.processlist : Modified in 10.4.9
+main.processlist_notembedded : Added in 10.4.9
+main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.4.9
main.query_cache : MDEV-16180 - Wrong result
main.query_cache_debug : MDEV-15281 - Query cache is disabled; modified in 10.4.8
main.query_cache_notembedded : Modified in 10.4.8
@@ -210,13 +225,12 @@ main.range_mrr_icp : Modified in 10.4.8
main.range_vs_index_merge : Modified in 10.4.8
main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away
main.repair : Modified in 10.4.8
-main.repair_symlink-5543 : Modified in 10.4.7
-main.rowid_filter_innodb : MDEV-20538 - Wrong result; modified in 10.4.7
+main.rowid_filter_innodb : MDEV-20538 - Wrong result
main.schema : Modified in 10.4.8
main.select : Modified in 10.4.8
main.select_jcl6 : MDEV-20532 - Floating point differences
main.select_pkeycache : MDEV-20532 - Floating point differences
-main.selectivity : Modified in 10.4.8
+main.selectivity : Modified in 10.4.9
main.selectivity_innodb : Modified in 10.4.8
main.selectivity_no_engine : Modified in 10.4.8
main.set_password : Include file modified in 10.4.8
@@ -226,26 +240,29 @@ main.shm : MDEV-12727 - Mismatch, ERROR 2013
main.show_bad_definer-5553 : Modified in 10.4.8
main.show_check : Modified in 10.4.8
main.show_explain : MDEV-10674 - Wrong result code
-main.sp : MDEV-7866 - Mismatch; modified in 10.4.8
+main.sp : MDEV-7866 - Mismatch; modified in 10.4.9
main.sp-anchor-type : Modified in 10.4.8
+main.sp-code : Modified in 10.4.9
main.sp-error : Modified in 10.4.8
main.sp-security : MDEV-10607 - sporadic "can't connect"; modified in 10.4.8
main.sp_notembedded : MDEV-10607 - internal error; include file modified in 10.4.8
main.ssl : MDEV-17184 - Failures with OpenSSL 1.1.1; modified in 10.4.8
main.ssl-big : Modified in 10.4.8
+main.ssl_7937 : MDEV-20958 - Wrong result
main.ssl_ca : MDEV-10895 - SSL connection error on Power
main.ssl_cipher : MDEV-17184 - Failures with OpenSSL 1.1.1
main.ssl_compress : Modified in 10.4.8
main.ssl_connect : MDEV-13492 - Unknown SSL error
main.ssl_crl : MDEV-19119 - Wrong error code
main.ssl_timeout : MDEV-11244 - Crash
-main.stat_tables : Modified in 10.4.8
+main.stat_tables : Modified in 10.4.9
main.stat_tables-enospc : Modified in 10.4.8
main.stat_tables_par : MDEV-13266 - Wrong result
main.stat_tables_par_innodb : MDEV-14155 - Wrong rounding
+main.statement-expr : Modified in 10.4.9
main.statistics : Modified in 10.4.8
main.status : MDEV-13255 - Wrong result
-main.subselect : Modified in 10.4.8
+main.subselect : MDEV-20551 - Valgrind failure; modified in 10.4.9
main.subselect2 : Modified in 10.4.8
main.subselect3 : Modified in 10.4.8
main.subselect3_jcl6 : Modified in 10.4.8
@@ -255,21 +272,24 @@ main.subselect_extra : Modified in 10.4.8
main.subselect_innodb : MDEV-10614 - Wrong result
main.subselect_mat_cost : Modified in 10.4.8
main.subselect_mat_cost_bugs : Modified in 10.4.8
-main.subselect_sj : Modified in 10.4.8
+main.subselect_notembedded : Modified in 10.4.9
+main.subselect_sj : Modified in 10.4.9
main.subselect_sj2 : Modified in 10.4.8
main.subselect_sj2_jcl6 : Modified in 10.3.18
main.subselect_sj2_mat : Modified in 10.4.8
main.subselect_sj_jcl6 : Modified in 10.4.8
main.subselect_sj_mat : Modified in 10.4.8
main.subselect_sj_nonmerged : Modified in 10.4.8
+main.sum_distinct-big : Modified in 10.4.9
main.system_mysql_db_507 : Include file modified in 10.4.8
main.system_mysql_db_fix50117 : Modified in 10.4.8
main.system_time_debug : Added in 10.4.8
main.table_options-5867 : Configuration added in 10.4.8
+main.table_value_constr : Modified in 10.4.9
main.tc_heuristic_recover : MDEV-14189 - Wrong result
main.timezone2 : Modified in 10.4.8
main.tls_version : MDEV-20170 - Unknown SSL error
-main.tls_version1 : MDEV-20170 - Unknown SSL error; added in 10.4.7
+main.tls_version1 : MDEV-20170 - Unknown SSL error
main.trigger : Modified in 10.4.8
main.trigger-compat : Modified in 10.4.8
main.trigger_notembedded : Modified in 10.4.8
@@ -280,7 +300,7 @@ main.type_datetime : Modified in 10.4.8
main.type_datetime_hires : MDEV-10687 - Timeout; modified in 10.4.8
main.type_float : MDEV-20532 - Floating point differences
main.type_int : Modified in 10.4.8
-main.type_newdecimal : MDEV-20532 - Floating point differences
+main.type_newdecimal : MDEV-20532 - Floating point differences; modified in 10.4.9
main.type_ranges : MDEV-20532 - Floating point differences
main.type_temporal_innodb : Modified in 10.4.8
main.type_time_6065 : Modified in 10.4.8
@@ -315,45 +335,52 @@ archive-test_sql_discovery.discover : MDEV-16817 - Table marked as crashed
#-----------------------------------------------------------------------
-binlog.binlog_commit_wait : MDEV-10150 - Mismatch
-binlog.binlog_innodb : Configuration added in 10.4.8
-binlog.binlog_killed : MDEV-12925 - Wrong result
-binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown; modified in 10.4.8
-binlog.binlog_mixed_cache_stat : Configuration added in 10.4.8
-binlog.binlog_mysqlbinlog2 : Modified in 10.2.27
-binlog.binlog_mysqlbinlog_row_innodb : MDEV-20530 - Binary files differ
-binlog.binlog_mysqlbinlog_row_myisam : MDEV-20530 - Binary files differ
-binlog.binlog_mysqlbinlog_stop_never : Added in 10.4.7
-binlog.binlog_parallel_replication_marks_row : Include file modified in 10.4.7
-binlog.binlog_parallel_replication_marks_stm_mix : Include file modified in 10.4.7
-binlog.binlog_row_cache_stat : Include file modified in 10.4.8
-binlog.binlog_row_drop_tmp_tbl : Include file modified in 10.4.8
-binlog.binlog_stm_binlog : MDEV-20412 - Wrong result
-binlog.binlog_stm_cache_stat : Include file modified in 10.4.8
-binlog.binlog_stm_drop_tmp_tbl : Include file modified in 10.4.8
-binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint
-binlog.flashback-largebinlog : MDEV-19764 - Out of memory; modified in 10.4.8
-binlog.load_data_stm_view : MDEV-16948 - Wrong result
-binlog.show_concurrent_rotate : MDEV-20215 - Wrong result
+binlog.backup : Added in 10.4.9
+binlog.binlog_commit_wait : MDEV-10150 - Mismatch
+binlog.binlog_innodb : Configuration added in 10.4.8
+binlog.binlog_killed : MDEV-12925 - Wrong result
+binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown; modified in 10.4.8
+binlog.binlog_mixed_cache_stat : Configuration added in 10.4.8
+binlog.binlog_mysqlbinlog2 : Modified in 10.2.27
+binlog.binlog_mysqlbinlog_row : Modified in 10.4.9
+binlog.binlog_mysqlbinlog_row_innodb : MDEV-20530 - Binary files differ
+binlog.binlog_mysqlbinlog_row_myisam : MDEV-20530 - Binary files differ
+binlog.binlog_parallel_replication_marks_row : MDEV-20959 - Wrong result
+binlog.binlog_row_cache_stat : Include file modified in 10.4.8
+binlog.binlog_row_drop_tmp_tbl : Include file modified in 10.4.8
+binlog.binlog_stm_binlog : MDEV-20412 - Wrong result
+binlog.binlog_stm_cache_stat : Include file modified in 10.4.8
+binlog.binlog_stm_drop_tmp_tbl : Include file modified in 10.4.8
+binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint
+binlog.flashback-largebinlog : MDEV-19764 - Out of memory; modified in 10.4.8
+binlog.load_data_stm_view : MDEV-16948 - Wrong result
+binlog.read_only : Added in 10.4.9
+binlog.read_only_statement : Added in 10.4.9
+binlog.show_concurrent_rotate : MDEV-20215 - Wrong result
#-----------------------------------------------------------------------
binlog_encryption.binlog_incident : MDEV-20213 - Server crash
+binlog_encryption.binlog_mdev_20574_old_binlog : Added in 10.4.9
binlog_encryption.binlog_xa_recover : MDEV-12908 - Extra checkpoint
binlog_encryption.encrypted_master : MDEV-14201 - Extra warnings
binlog_encryption.encrypted_master_switch_to_unencrypted : MDEV-14190 - Can't init tc log
binlog_encryption.encrypted_slave : MDEV-18135 - SSL error: key too small
binlog_encryption.encryption_combo : MDEV-14199 - Table is marked as crashed
binlog_encryption.multisource : MDEV-20213 - Server crash
-binlog_encryption.rpl_binlog_errors : MDEV-12742 - Crash
+binlog_encryption.mysqlbinlog : Modified in 10.4.9
+binlog_encryption.rpl_binlog_errors : MDEV-12742 - Crash; include file modified in 10.4.9
binlog_encryption.rpl_checksum : MDEV-16951 - Wrong result
-binlog_encryption.rpl_corruption : MDEV-20159 - Assertion failure
+binlog_encryption.rpl_corruption : MDEV-20159 - Assertion failure; MDEV-20953 - Wrong error code
binlog_encryption.rpl_gtid_basic : MDEV-16947 - Server failed to start
+binlog_encryption.rpl_init_slave_errors : MDEV-20213 - Server crash
binlog_encryption.rpl_loadfile : MDEV-16645 - Timeout in include
+binlog_encryption.rpl_mixed_binlog_max_cache_size : MDEV-20956 - Incorrect checksum for freed object
binlog_encryption.rpl_parallel : MDEV-10653 - Timeout in include
+binlog_encryption.rpl_parallel_ignored_errors : Added in 10.4.9
binlog_encryption.rpl_relayrotate : MDEV-15194 - Timeout
binlog_encryption.rpl_semi_sync : MDEV-11673 - Valgrind
-binlog_encryption.rpl_skip_replication : MDEV-13571 - Unexpected warning
+binlog_encryption.rpl_skip_replication : MDEV-13571 - Unexpected warning; MDEV-20573 - Wrong result
binlog_encryption.rpl_ssl : MDEV-14507 - Timeouts
binlog_encryption.rpl_stm_relay_ign_space : MDEV-19375 - Test assertion failed
binlog_encryption.rpl_sync : MDEV-13830 - Assertion failure
@@ -362,58 +389,63 @@ binlog_encryption.rpl_typeconv : MDEV-14362 - Lost c
#-----------------------------------------------------------------------
-compat/oracle.column_compression : Modified in 10.4.7
-compat/oracle.keywords : Added in 10.4.7
-compat/oracle.mysqldump_restore : Added in 10.4.7
+compat/oracle.plugin : Include file modified in 10.4.9
+compat/oracle.ps : Modified in 10.4.9
compat/oracle.sp : Modified in 10.4.8
compat/oracle.sp-package : Modified in 10.4.8
compat/oracle.sp-package-mysqldump : Modified in 10.4.8
compat/oracle.sp-package-security : Modified in 10.4.8
+compat/oracle.statement-expr : Modified in 10.4.9
compat/oracle.type_blob : Modified in 10.4.8
#-----------------------------------------------------------------------
connect.alter : MDEV-18135 - SSL error: key too small
connect.drop-open-error : MDEV-18135 - SSL error: key too small
+connect.grant : Modified in 10.4.9
+connect.grant2 : Modified in 10.4.9
+connect.ini_grant : Modified in 10.4.9
connect.json : MDEV-18135 - SSL error: key too small
+connect.mysql_grant : Modified in 10.4.9
connect.part_file : MDEV-18135 - SSL error: key too small
connect.part_table : MDEV-18135 - SSL error: key too small
connect.pivot : MDEV-14803 - Failed to discover table
connect.secure_file_priv : MDEV-18135 - SSL error: key too small
connect.vcol : MDEV-12374 - Fails on Windows
+connect.xml2_grant : Include file modified in 10.4.9
+connect.xml_grant : Include file modified in 10.4.9
connect.zip : MDEV-13884 - Wrong result
#-----------------------------------------------------------------------
-disks.disks_notembedded : Added in 10.4.7
-
-#-----------------------------------------------------------------------
-
encryption.corrupted_during_recovery : MDEV-20159 - Assertion failure
-encryption.create_or_replace : MDEV-12694 - Timeout; MDEV-16115 - Trying to access tablespace; include file modified in 10.4.7
+encryption.create_or_replace : MDEV-12694 - Timeout; MDEV-16115 - Trying to access tablespace
encryption.debug_key_management : MDEV-13841 - Timeout
encryption.encrypt_and_grep : MDEV-13765 - Wrong result
encryption.file_creation : Added in 10.4.8
-encryption.innochecksum : MDEV-13644 - Assertion failure; modified in 10.4.7
-encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect to local MySQL server through socket
-encryption.innodb-checksum-algorithm : MDEV-12898 - Deadlock of threads; MDEV-16896 - Server crash
+encryption.innochecksum : MDEV-13644 - Assertion failure
+encryption.innodb-bad-key-change : Combinations added in 10.4.9
+encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect to local MySQL server through socket; combinations added in 10.4.9
+encryption.innodb-bad-key-change3 : Combinations added in 10.4.9
+encryption.innodb-bad-key-change4 : Modified in 10.4.9
+encryption.innodb-checksum-algorithm : MDEV-16896 - Server crash
encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate
encryption.innodb-discard-import : MDEV-19113 - Timeout
-encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout; modified in 10.4.7
+encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout
encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition
encryption.innodb-force-corrupt : MDEV-17286 - SSL error
encryption.innodb-missing-key : MDEV-14728 - SSL error
encryption.innodb-page_encryption : MDEV-10641 - mutex problem
encryption.innodb-page_encryption_log_encryption : MDEV-17339 - Crash on restart
encryption.innodb-read-only : MDEV-16563 - Crash on startup
-encryption.innodb-redo-badkey : MDEV-12898 - Server hang on startup
+encryption.innodb-redo-badkey : MDEV-20839 - Extra warnings; re-enabled in 10.4.9; modified in 10.4.9
encryption.innodb-redo-nokeys : MDEV-20159 - Assertion failure
encryption.innodb-remove-encryption : MDEV-16493 - Timeout in wait condition
encryption.innodb-spatial-index : MDEV-13746 - Wrong result
encryption.innodb_encrypt_key_rotation_age : MDEV-19763 - Timeout
encryption.innodb_encrypt_log : MDEV-13725 - Wrong result
encryption.innodb_encrypt_log_corruption : Configuration modified in 10.4.8
-encryption.innodb_encrypt_temporary_tables : Combinations added in 10.4.8
+encryption.innodb_encrypt_temporary_tables : MDEV-20142 - Wrong result; combinations added in 10.4.8
encryption.innodb_encryption : MDEV-15675 - Timeout
encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure
encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result
@@ -447,13 +479,14 @@ federated.federated_innodb : MDEV-10617 - Wrong checksum
federated.federated_partition : MDEV-10417 - Fails on Mips
federated.federated_transactions : MDEV-10617 - Wrong checksum
federated.federatedx : MDEV-10617 - Wrong checksum
-federated.federatedx_versioning : Modified in 10.4.8
+federated.federatedx_versioning : Modified in 10.4.9
#-----------------------------------------------------------------------
funcs_1.innodb_storedproc_07 : Include file modified in 10.4.8
funcs_1.innodb_storedproc_08 : Include file modified in 10.4.8
funcs_1.innodb_trig_03e : Modified in 10.4.8
+funcs_1.is_basics_mixed : Modified in 10.4.9
funcs_1.is_columns : Modified in 10.4.8
funcs_1.is_columns_innodb : Modified in 10.4.8
funcs_1.is_columns_memory : Modified in 10.4.8
@@ -507,42 +540,39 @@ gcol.gcol_select_innodb : Include file modified in 10.4.8
gcol.gcol_select_myisam : Include file modified in 10.4.8
gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion; modified in 10.4.8
gcol.innodb_virtual_debug : MDEV-19114 - Assertion failure
-gcol.innodb_virtual_debug_purge : MDEV-16952 - Wrong result
+gcol.innodb_virtual_debug_purge : MDEV-16952 - Wrong result; modified in 10.4.9
gcol.innodb_virtual_fk_restart : MDEV-17466 - Assertion failure
gcol.innodb_virtual_index : Modified in 10.4.8
-gcol.innodb_virtual_purge : Modified in 10.2.25
#-----------------------------------------------------------------------
innodb.101_compatibility : MDEV-13891 - Wrong result
+innodb.alter_algorithm : Modified in 10.4.9
innodb.alter_copy : MDEV-16181 - Assertion failure; modified in 10.4.8
innodb.alter_crash : MDEV-16944 - The process cannot access the file
-innodb.alter_large_dml : MDEV-20148 - Debug sync point wait timed out; added in 10.4.7
-innodb.alter_missing_tablespace : Modified in 10.4.7
+innodb.alter_large_dml : MDEV-20148 - Debug sync point wait timed out
innodb.auto_increment_dup : Modified in 10.4.8
innodb.autoinc_persist : MDEV-15282 - Assertion failure
innodb.binlog_consistent : MDEV-10618 - Server fails to start
-innodb.blob-crash : MDEV-19298 - Assertion failure; added in 10.4.7
-innodb.check_ibd_filesize : Added in 10.4.7
-innodb.create_select : Added in 10.4.7
+innodb.blob-crash : MDEV-19298 - Assertion failure
innodb.doublewrite : MDEV-12905 - Server crash
innodb.foreign-keys : Modified in 10.4.8
innodb.foreign_key : Modified in 10.4.8
+innodb.full_crc32_import : Modified in 10.4.9
innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed
innodb.group_commit_crash_no_optimize_thread : MDEV-13830 - Assertion failure
-innodb.ibuf_not_empty : MDEV-19021 - Wrong result
-innodb.innodb-16k : Modified in 10.4.7
-innodb.innodb-32k : Modified in 10.4.7
-innodb.innodb-32k-crash : MDEV-16953 - Corrupt log record found; modified in 10.4.7
-innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup; modified in 10.4.7
+innodb.ibuf_not_empty : MDEV-19021 - Wrong result; modified in 10.4.9
+innodb.information_schema_grants : Added in 10.4.9
+innodb.innodb-32k-crash : MDEV-20194 - Extra warnings
+innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup
innodb.innodb-alter : Modified in 10.4.8
innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS
+innodb.innodb-alter-nullable : Modified in 10.4.9
innodb.innodb-alter-table : MDEV-10619 - Testcase timeout
-innodb.innodb-alter-tempfile : MDEV-15285 - Table already exists
-innodb.innodb-autoinc : Modified in 10.4.7
+innodb.innodb-autoinc : Modified in 10.4.9
innodb.innodb-bigblob : MDEV-18655 - ASAN unknown crash
innodb.innodb-blob : MDEV-12053 - Client crash
-innodb.innodb-change-buffer-recovery : MDEV-19115 - Lost connection to MySQL server during query
+innodb.innodb-change-buffer-recovery : MDEV-19115 - Lost connection to MySQL server during query; modified in 10.4.9
innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown
innodb.innodb-fkcheck : Modified in 10.4.8
innodb.innodb-get-fk : MDEV-13276 - Server crash; modified in 10.4.8
@@ -556,11 +586,10 @@ innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem
innodb.innodb-read-view : Added in 10.4.8
innodb.innodb-system-table-view : Modified in 10.4.8
innodb.innodb-table-online : MDEV-13894 - Wrong result
-innodb.innodb-virtual-columns-debug : MDEV-20143 - Wrong result; added in 10.4.7
+innodb.innodb-virtual-columns-debug : Modified in 10.4.9
innodb.innodb-wl5522 : MDEV-13644 - Assertion failure
innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno; modified in 10.4.8
-innodb.innodb-wl5980-debug : Added in 10.4.7
-innodb.innodb_buffer_pool_dump_pct : MDEV-20139 - Timeout in wait_condition.inc; added in 10.4.7
+innodb.innodb_buffer_pool_dump_pct : MDEV-20139 - Timeout in wait_condition.inc
innodb.innodb_buffer_pool_resize : MDEV-16964 - Assertion failure
innodb.innodb_buffer_pool_resize_with_chunks : MDEV-16964 - Assertion failure
innodb.innodb_bug14147491 : MDEV-11808 - Index is corrupt
@@ -574,56 +603,55 @@ innodb.innodb_bulk_create_index_debug : Include file modified in 10.4.8
innodb.innodb_bulk_create_index_flush : Configuration added in 10.4.8
innodb.innodb_bulk_create_index_replication : MDEV-15273 - Slave failed to start
innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full
+innodb.innodb_force_recovery : Modified in 10.4.9
innodb.innodb_information_schema : MDEV-8851 - Wrong result
-innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed; modified in 10.4.7
-innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result; modified in 10.4.7
+innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed
+innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result
innodb.innodb_monitor : MDEV-10939 - Testcase timeout
innodb.innodb_mysql : Include file modified in 10.4.8
+innodb.innodb_prefix_index_restart_server : MDEV-20213 - Server crash
innodb.innodb_simulate_comp_failures_small : MDEV-20526 - ASAN use-after-poison
innodb.innodb_stats : MDEV-10682 - wrong result
-innodb.innodb_stats_persistent : MDEV-17745 - Wrong result
+innodb.innodb_stats_persistent : MDEV-17745 - Wrong result; modified in 10.4.9
innodb.innodb_stats_persistent_debug : MDEV-14801 - Operation failed
innodb.innodb_sys_semaphore_waits : MDEV-10331 - Semaphore wait
innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks
innodb.instant_alter : Modified in 10.4.8
-innodb.instant_alter_bugs : Modified in 10.4.8
+innodb.instant_alter_bugs : Modified in 10.4.9
innodb.instant_alter_charset : Modified in 10.4.8
-innodb.instant_alter_debug : Modified in 10.4.7
+innodb.instant_alter_extend : MDEV-20963 - Binary files differ
+innodb.instant_alter_index_rename : Modified in 10.4.9
innodb.log_alter_table : Configuration added in 10.4.8
innodb.log_corruption : MDEV-13251 - Wrong result
-innodb.log_data_file_size : MDEV-14204 - Server failed to start
+innodb.log_data_file_size : MDEV-14204 - Server failed to start; MDEV-20648 - Assertion failure
innodb.log_file : MDEV-20159 - Assertion failure
innodb.log_file_name : MDEV-14193 - Exception
innodb.log_file_size : MDEV-15668 - Not found pattern
-innodb.max_record_size : Added in 10.4.7
-innodb.missing_tablespaces : Added in 10.4.7
innodb.monitor : MDEV-16179 - Wrong result
innodb.page_id_innochecksum : Modified in 10.4.8
-innodb.purge : Added in 10.4.7
innodb.purge_secondary : MDEV-15681 - Wrong result
-innodb.purge_secondary_mdev-16222 : MDEV-20528 - Debug sync point wait timed out; added in 10.4.7
+innodb.purge_secondary_mdev-16222 : MDEV-20528 - Debug sync point wait timed out
innodb.purge_thread_shutdown : MDEV-13792 - Wrong result
innodb.read_only_recovery : MDEV-13886 - Server crash
innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile; modified in 10.4.8
innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace
-innodb.strict_mode : Modified in 10.4.7
+innodb.stat_tables : Added in 10.4.9
innodb.table_definition_cache_debug : MDEV-14206 - Extra warning
innodb.table_flags : MDEV-13572 - Wrong result; MDEV-19374 - Server failed to start
-innodb.temp_table_savepoint : MDEV-16182 - Wrong result
innodb.temporary_table : MDEV-13265 - Wrong result
-innodb.temporary_table_optimization : MDEV-20531 - Wrong result
-innodb.truncate_missing : Modified in 10.4.7
+innodb.temporary_table_optimization : Modified in 10.4.9
innodb.trx_id_future : Modified in 10.4.8
-innodb.undo_log : Modified in 10.4.7
-innodb.undo_truncate : MDEV-17340 - Server hung
+innodb.undo_truncate : MDEV-17340 - Server hung; MDEV-20840 - Sporadic timeout
innodb.undo_truncate_recover : MDEV-17679 - Server has gone away; MDEV-19200 - Shutdown fails; modified in 10.4.8
innodb.update_time : MDEV-14804 - Wrong result
innodb.xa_recovery : MDEV-15279 - mysqld got exception
#-----------------------------------------------------------------------
-innodb_fts.fulltext2 : Modified in 10.4.7
-innodb_fts.innodb_fts_misc : Modified in 10.4.8
+innodb_fts.concurrent_insert : Modified in 10.4.9
+innodb_fts.crash_recovery : Modified in 10.4.9
+innodb_fts.fulltext_table_evict : Modified in 10.4.8
+innodb_fts.innodb_fts_misc : Modified in 10.4.9
innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning
innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log
innodb_fts.innodb_fts_stopword_charset : MDEV-13259 - Table crashed
@@ -632,8 +660,8 @@ innodb_fts.sync_ddl : MDEV-18654 - Assertion failure
#-----------------------------------------------------------------------
-innodb_gis.alter_spatial_index : MDEV-13745 - Server crash; modified in 10.4.7
-innodb_gis.kill_server : MDEV-16941 - Checksum mismatch
+innodb_gis.alter_spatial_index : MDEV-13745 - Server crash
+innodb_gis.innodb_gis_rtree : MDEV-20213 - Server crash
innodb_gis.rtree_compress2 : MDEV-16269 - Wrong result; modified in 10.4.8
innodb_gis.rtree_concurrent_srch : MDEV-15284 - Wrong result with embedded
innodb_gis.rtree_purge : MDEV-15275 - Timeout
@@ -646,10 +674,9 @@ innodb_gis.update_root : Modified in 10.4.8
#-----------------------------------------------------------------------
innodb_zip.cmp_per_index : MDEV-14490 - Table is marked as crashed
-innodb_zip.innochecksum : MDEV-20158 - Server failed to shut down
+innodb_zip.innochecksum : MDEV-14486 - Server failed to shut down
innodb_zip.innochecksum_3 : MDEV-13279 - Extra warnings
-innodb_zip.page_size : Include file modified in 10.4.7
-innodb_zip.restart : Include file modified in 10.4.7
+innodb_zip.restart : MDEV-20213 - Server crash
innodb_zip.wl5522_debug_zip : MDEV-11600 - Operating system error number 2; modified in 10.4.8
innodb_zip.wl6470_1 : MDEV-14240 - Assertion failure
innodb_zip.wl6501_1 : MDEV-10891 - Can't create UNIX socket
@@ -657,11 +684,10 @@ innodb_zip.wl6501_scale_1 : MDEV-13254 - Timeout, MDEV-14104 - Error 192
#-----------------------------------------------------------------------
-maria.alter : Modified in 10.4.7
maria.icp : Modified in 10.4.8
maria.insert_select : MDEV-12757 - Timeout
maria.insert_select-7314 : MDEV-16492 - Timeout
-maria.kill : Added in 10.4.7
+maria.lock : Modified in 10.4.9
maria.maria : MDEV-14430 - Extra warning
maria.maria-big : Modified in 10.4.8
maria.maria-gis-recovery : Modified in 10.4.8
@@ -670,7 +696,6 @@ maria.maria-recover : Modified in 10.4.8
maria.maria-recovery : Modified in 10.4.8
maria.maria3 : Modified in 10.4.8
maria.partition : Added in 10.4.8
-maria.temporary : Added in 10.4.7
#-----------------------------------------------------------------------
@@ -678,13 +703,16 @@ mariabackup.absolute_ibdata_paths : MDEV-16571 - Wrong result
mariabackup.apply-log-only : MDEV-20135 - Timeout
mariabackup.big_innodb_log : Added in 10.4.8
mariabackup.data_directory : MDEV-15270 - Error on exec
+mariabackup.encrypted_page_corruption : Modified in 10.4.9
+mariabackup.extra_lsndir_stream : Added in 10.4.9
mariabackup.full_backup : MDEV-16571 - Wrong result
mariabackup.huge_lsn : MDEV-15662 - Sequence number is in the future; MDEV-18569 - Table doesn't exist
mariabackup.incremental_encrypted : MDEV-15667 - timeout
+mariabackup.incremental_rocksdb : MDEV-20954 - Cannot access the file
mariabackup.log_checksum_mismatch : MDEV-16571 - Wrong result
mariabackup.mdev-14447 : MDEV-15201 - Timeout
-mariabackup.missing_ibd : Modified in 10.4.7
-mariabackup.partial : MDEV-19298 - Assertion failure
+mariabackup.mdev-18438 : Added in 10.4.9
+mariabackup.partial : MDEV-19298 - Assertion failure; modified in 10.4.9
mariabackup.partial_exclude : MDEV-15270 - Error on exec
mariabackup.unencrypted_page_compressed : MDEV-18653 - Wrong error
mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault
@@ -721,7 +749,6 @@ multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_h
#-----------------------------------------------------------------------
-parts.fulltext : Added in 10.4.7
parts.partition_alter1_1_2_innodb : MDEV-18655 - ASAN unknown crash
parts.partition_alter1_1_innodb : MDEV-18655 - ASAN unknown crash
parts.partition_alter1_2_innodb : MDEV-18655 - ASAN unknown crash
@@ -729,7 +756,9 @@ parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL s
parts.partition_auto_increment_archive : MDEV-16491 - Marked as crashed and should be repaired
parts.partition_auto_increment_maria : MDEV-14430 - Extra warning
parts.partition_basic_innodb : MDEV-20214 - ASAN error
-parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket; MDEV-15095 - Table doesn't exist
+parts.partition_debug : Modified in 10.4.9
+parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket; MDEV-15095 - Table doesn't exist; modified in 10.4.9
+parts.partition_debug_myisam : Modified in 10.4.9
parts.partition_exch_qa_10 : MDEV-11765 - wrong result
parts.partition_exch_qa_4_innodb : Include file modified in 10.4.8
parts.partition_exch_qa_4_myisam : Include file modified in 10.4.8
@@ -749,6 +778,7 @@ parts.partition_mgm_lc2_innodb : Include file modified in 10.4.8
parts.partition_mgm_lc2_memory : Include file modified in 10.4.8
parts.partition_mgm_lc2_myisam : Include file modified in 10.4.8
parts.partition_special_innodb : MDEV-16942 - Timeout
+parts.reorganize_partition_innodb : Added in 10.4.9
#-----------------------------------------------------------------------
@@ -779,6 +809,7 @@ perfschema.hostcache_ipv6_nameinfo_noname_allow : Configuration modified in 10.4
perfschema.hostcache_ipv6_nameinfo_noname_deny : Configuration modified in 10.4.8
perfschema.hostcache_ipv6_passwd : Configuration modified in 10.4.8
perfschema.hostcache_ipv6_ssl : MDEV-10696 - Crash; configuration modified in 10.4.8
+perfschema.pfs_upgrade_func : MDEV-20957 - Upgrade file was not properly created
perfschema.pfs_upgrade_proc : MDEV-20533 - Upgrade file was not properly created
perfschema.pfs_upgrade_view : MDEV-20533 - Upgrade file was not properly created
perfschema.privilege_table_io : MDEV-13184 - Extra lines
@@ -799,16 +830,13 @@ perfschema_stress.* : MDEV-10996 - Not maintained
#-----------------------------------------------------------------------
-period.versioning : MDEV-20159 - Assertion failure; modified in 10.4.8
+period.versioning : MDEV-20159 - Assertion failure; include file modified in 10.4.9
#-----------------------------------------------------------------------
-plugins.feedback_plugin_load : Modified in 10.4.8
+plugins.feedback_plugin_load : Modified in 10.4.9
plugins.feedback_plugin_send : MDEV-7932, MDEV-11118 - Connection problems and such
plugins.multiauth : MDEV-20163 - Plugin could not be loaded; include file modified in 10.4.8
-plugins.pam : Modified in 10.4.7
-plugins.pam_cleartext : Modified in 10.4.7
-plugins.pam_v1 : Modified in 10.4.7
plugins.processlist : MDEV-16574 - Wrong result
plugins.qc_info : Modified in 10.4.8
plugins.server_audit : MDEV-14295 - Wrong result
@@ -827,6 +855,7 @@ rocksdb.drop_index_inplace : MDEV-14162 - Crash on shutdown
rocksdb.drop_table : MDEV-14308 - Timeout
rocksdb.drop_table3 : MDEV-16949 - Server crash
rocksdb.dup_key_update : MDEV-17284 - Wrong result
+rocksdb.index_merge_rocksdb2 : Include file modified in 10.4.9
rocksdb.locking_issues : MDEV-14464 - Wrong result
rocksdb.mariadb_ignore_dirs : MDEV-16639 - Server crash
rocksdb.mariadb_port_fixes : MDEV-16387 - Wrong plan
@@ -835,9 +864,7 @@ rocksdb.perf_context : MDEV-17285 - Wrong results
rocksdb.rocksdb_cf_options : MDEV-16639 - Server crash
rocksdb.rocksdb_cf_per_partition : MDEV-16636 - Wrong result
rocksdb.rocksdb_parts : MDEV-13843 - Wrong result
-rocksdb.ttl_primary_read_filtering : MDEV-16560 - Wrong result
rocksdb.ttl_secondary : MDEV-16943 - Timeout
-rocksdb.ttl_secondary_read_filtering : MDEV-16560 - Wrong result
rocksdb.unique_check : MDEV-16576 - Wrong errno
rocksdb.use_direct_reads_writes : MDEV-16646 - Server crash
rocksdb.write_sync : MDEV-16965 - WRong result
@@ -863,18 +890,18 @@ roles.show_create_database-10463 : Modified in 10.4.8
rpl.circular_serverid0 : MDEV-19372 - ASAN heap-use-after-free
rpl.create_or_replace2 : MDEV-19412 - Lost connection to MySQL server
-rpl.create_or_replace_mix : MDEV-20523 - Wrong result; include file modified in 10.4.7
-rpl.create_or_replace_row : Include file modified in 10.4.7
-rpl.create_or_replace_statement : MDEV-20523 - Wrong result; include file modified in 10.4.7
+rpl.create_or_replace_mix : MDEV-20523 - Wrong result
+rpl.create_or_replace_statement : MDEV-20523 - Wrong result
rpl.create_select : MDEV-14121 - Assertion failure
-rpl.kill_race_condition : Modified in 10.4.7
rpl.last_insert_id : MDEV-10625 - warnings in error log
rpl.mdev_17588 : Modified in 10.4.8
+rpl.rpl_000011 : Modified in 10.4.9
rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips
rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips
rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log
rpl.rpl_binlog_errors : MDEV-12742 - Crash
rpl.rpl_binlog_index : MDEV-9501 - Failed registering on master
+rpl.rpl_cant_read_event_incident : MDEV-20960 - Abort on shutdown
rpl.rpl_circular_for_4_hosts : MDEV-20536 - Server crash
rpl.rpl_colSize : MDEV-16112 - Server crash
rpl.rpl_corruption : MDEV-20527 - Slave stopped with wrong error code
@@ -886,7 +913,7 @@ rpl.rpl_domain_id_filter_io_crash : MDEV-12729 - Timeout in include file,
rpl.rpl_domain_id_filter_master_crash : MDEV-19043 - Table marked as crashed
rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result; MDEV-19043 - Table marked as crashed
rpl.rpl_drop_db_fail : MDEV-16898 - Slave fails to start
-rpl.rpl_drop_temp_table_invaid_lex : Added in 10.4.7
+rpl.rpl_dual_pos_advance : MDEV-20213 - Server crash
rpl.rpl_extra_col_master_innodb : MDEV-16570 - Extra warning
rpl.rpl_extra_col_master_myisam : MDEV-14203 - Extra warning
rpl.rpl_failed_drop_tbl_binlog : Added in 10.4.8
@@ -909,6 +936,8 @@ rpl.rpl_insert_id : MDEV-15197 - Wrong result
rpl.rpl_insert_id_pk : MDEV-16567 - Assertion failure
rpl.rpl_insert_ignore : MDEV-14365 - Lost connection to MySQL server during query
rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips
+rpl.rpl_ip_mix : Modified in 10.4.9
+rpl.rpl_ip_mix2 : Modified in 10.4.9
rpl.rpl_ipv4_as_ipv6 : MDEV-20147 - Incorrect checksum for freed object
rpl.rpl_known_bugs_detection : Modified in 10.2.27
rpl.rpl_lcase_tblnames_rewrite_db : MDEV-20213 - Server crash
@@ -923,6 +952,7 @@ rpl.rpl_non_direct_stm_mixing_engines : MDEV-14489 - Failed sync_slave_with_ma
rpl.rpl_parallel : MDEV-10653 - Timeouts
rpl.rpl_parallel2 : MDEV-17390 - Operation cannot be performed
rpl.rpl_parallel_conflicts : MDEV-15272 - Server crash
+rpl.rpl_parallel_ignored_errors : Added in 10.4.9
rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure
rpl.rpl_parallel_multilevel : MDEV-20160 - Server crash
rpl.rpl_parallel_multilevel2 : MDEV-14723 - Timeout
@@ -933,11 +963,14 @@ rpl.rpl_parallel_temptable : MDEV-10356 - Crash; MDEV-19076 - Wrong
rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips
rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings
rpl.rpl_read_only : MDEV-20159 - Assertion failure
+rpl.rpl_read_only2 : Added in 10.4.9
+rpl.rpl_relayrotate : MDEV-20213 - Server crash
+rpl.rpl_rotate_logs : Modified in 10.4.9
rpl.rpl_row_001 : MDEV-16653 - MTR's internal check fails
rpl.rpl_row_basic_11bugs : MDEV-12171 - Server failed to start
rpl.rpl_row_basic_2myisam : MDEV-13875 - command "diff_files" failed
rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result
-rpl.rpl_row_drop_temp_table : Added in 10.4.7
+rpl.rpl_row_find_row_debug : Modified in 10.4.9
rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed
rpl.rpl_row_img_eng_min : MDEV-13875 - diff_files failed
rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed
@@ -949,12 +982,15 @@ rpl.rpl_semi_sync : MDEV-11220 - Wrong result
rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result
rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result
rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings
+rpl.rpl_semi_sync_slave_reply_fail : Added in 10.4.9
rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Assorted failures
rpl.rpl_semi_sync_wait_no_slave : MDEV-20159 - Assertion failure
rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition
rpl.rpl_semisync_ali_issues : MDEV-16272 - Wrong result
rpl.rpl_set_statement_default_master : MDEV-13258 - Extra warning
rpl.rpl_show_slave_hosts : MDEV-10681 - Crash
+rpl.rpl_shutdown_wait_semisync_slaves : MDEV-20213 - Server crash
+rpl.rpl_skip_error : Modified in 10.4.9
rpl.rpl_skip_replication : MDEV-13258 - Extra warning
rpl.rpl_slave_grp_exec : MDEV-10514 - Deadlock
rpl.rpl_slave_load_in : MDEV-20159 - Assertion failure
@@ -973,6 +1009,7 @@ rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries
rpl.rpl_test_framework : MDEV-19368 - mysqltest failed but provided no output
rpl.rpl_trigger : MDEV-18055 - Wrong result
rpl.rpl_truncate_3innodb : MDEV-19454 - Syntax error
+rpl.rpl_unsafe_statements : Modified in 10.1.42
rpl.rpl_user_variables : MDEV-20522 - Wrong result
rpl.rpl_variables : MDEV-20150 - Server crash
rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result
@@ -980,10 +1017,10 @@ rpl.show_status_stop_slave_race-7126 : MDEV-17438 - Timeout
#-----------------------------------------------------------------------
-rpl-tokudb.* : MDEV-14354 - Tests fail with tcmalloc
-rpl-tokudb.rpl_deadlock_tokudb : MDEV-20529 - mysqltest failed but provided no output
-rpl-tokudb.rpl_extra_col_master_tokudb : MDEV-13258 - Extra warning
-rpl-tokudb.rpl_tokudb_commit_after_flush : MDEV-16966 - Server crash
+rpl-tokudb.* : MDEV-14354 - Tests fail with tcmalloc
+rpl-tokudb.rpl_deadlock_tokudb : MDEV-20529 - mysqltest failed but provided no output
+rpl-tokudb.rpl_extra_col_master_tokudb : MDEV-13258 - Extra warning
+rpl-tokudb.rpl_tokudb_commit_after_flush : MDEV-16966 - Server crash
#-----------------------------------------------------------------------
@@ -991,8 +1028,12 @@ rpl/extra/rpl_tests.* : MDEV-10994 - Not maintained
#-----------------------------------------------------------------------
-sphinx.* : MDEV-10986 - Tests have not been maintained
-sphinx.sphinx : MDEV-10986 - Sporadic failures
+sequence.group_by : Modified in 10.4.9
+
+#-----------------------------------------------------------------------
+
+sphinx.* : MDEV-10986 - Tests have not been maintained; suite.pm modified in 10.4.9
+sphinx.sphinx : MDEV-10986 - Sporadic failures; modified in 10.4.9
sphinx.union-5539 : MDEV-10986 - Sporadic failures
#-----------------------------------------------------------------------
@@ -1014,11 +1055,16 @@ spider/bg.vp_fixes : MDEV-9329 - Fails on Ubuntu/s390x
#-----------------------------------------------------------------------
+spider/bugfix.select_by_null : Added in 10.4.9
+
+#-----------------------------------------------------------------------
+
spider/handler.* : MDEV-10987, MDEV-10990 - Tests have not been maintained
#-----------------------------------------------------------------------
sql_sequence.concurrent_create : MDEV-16635 - Server crash
+sql_sequence.other : Modified in 10.4.9
#-----------------------------------------------------------------------
@@ -1043,11 +1089,12 @@ sys_vars.character_set_server_func : Modified in 10.4.8
sys_vars.collation_connection_basic : Modified in 10.4.8
sys_vars.collation_database_basic : Modified in 10.4.8
sys_vars.collation_server_basic : Modified in 10.4.8
+sys_vars.delayed_insert_limit_func : Modified in 10.4.9
sys_vars.expire_logs_days_basic : Modified in 10.4.8
sys_vars.histogram_size_basic : Modified in 10.2.27
sys_vars.host_cache_size_auto : MDEV-20112 - Wrong result
sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error
-sys_vars.innodb_ft_result_cache_limit : Modified in 10.2.26
+sys_vars.innodb_change_buffering_debug_basic : Modified in 10.4.9
sys_vars.innodb_max_dirty_pages_pct_basic : Modified in 10.4.8
sys_vars.innodb_max_dirty_pages_pct_lwm_basic : Modified in 10.4.8
sys_vars.innodb_read_io_threads_basic : Configuration added in 10.4.8
@@ -1122,11 +1169,11 @@ tokudb_bugs.frm_store : MDEV-12823 - Valgrind
tokudb_bugs.frm_store2 : MDEV-12823 - Valgrind
tokudb_bugs.frm_store3 : MDEV-12823 - Valgrind
tokudb_bugs.xa : MDEV-11804 - Lock wait timeout
-tokudb_bugs.xa-3 : MDEV-16953 - Corrupt log record found
#-----------------------------------------------------------------------
tokudb_parts.partition_alter4_tokudb : MDEV-12640 - Lost connection
+tokudb_parts.partition_debug_tokudb : Include file modified in 10.4.9
tokudb_parts.partition_exch_qa_4_tokudb : Include file modified in 10.4.8
tokudb_parts.partition_exch_qa_8_tokudb : Include file modified in 10.4.8
tokudb_parts.partition_mgm_lc0_tokudb : Include file modified in 10.4.8
@@ -1152,55 +1199,58 @@ unit.conc_ps_bugs : MDEV-13252 - not ok 44 test_bug4236
unit.ma_pagecache_consist_64kRD : MDEV-19367 - AddressSanitizer CHECK failed
unit.ma_pagecache_consist_64kWR : MDEV-19367 - AddressSanitizer CHECK failed
unit.ma_test_loghandler : MDEV-10638 - record read not ok
+unit.mf_iocache : MDEV-20952 - ASAN stack-buffer-overflow
#-----------------------------------------------------------------------
-vcol.cross_db : Modified in 10.4.8
-vcol.not_supported : MDEV-10639 - Testcase timeout
-vcol.update : Modified in 10.4.8
-vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout
-vcol.vcol_misc : MDEV-16651 - Wrong error message; modified in 10.4.7
-vcol.vcol_select_innodb : Modified in 10.4.8
-vcol.vcol_select_myisam : Modified in 10.4.8
-vcol.vcol_sql_mode : Added in 10.4.8
-vcol.vcol_sql_mode_upgrade : Added in 10.4.8
-vcol.vcol_trigger_sp_innodb : Include file modified in 10.4.8
-vcol.vcol_trigger_sp_myisam : Include file modified in 10.4.8
+vcol.cross_db : Modified in 10.4.8
+vcol.not_supported : MDEV-10639 - Testcase timeout
+vcol.update : Modified in 10.4.8
+vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout; modified in 10.4.9
+vcol.vcol_misc : MDEV-16651 - Wrong error message
+vcol.vcol_select_innodb : Modified in 10.4.8
+vcol.vcol_select_myisam : Modified in 10.4.8
+vcol.vcol_sql_mode : Added in 10.4.8
+vcol.vcol_sql_mode_datetime : Added in 10.4.9
+vcol.vcol_sql_mode_time : Added in 10.4.9
+vcol.vcol_sql_mode_timestamp : Added in 10.4.9
+vcol.vcol_sql_mode_upgrade : Added in 10.4.8
+vcol.vcol_trigger_sp_innodb : Include file modified in 10.4.8
+vcol.vcol_trigger_sp_myisam : Include file modified in 10.4.8
#-----------------------------------------------------------------------
-versioning.alter : Modified in 10.4.8
-versioning.auto_increment : Include file modified in 10.4.8
-versioning.commit_id : Include file modified in 10.4.8
-versioning.create : Modified in 10.4.8
+versioning.alter : Modified in 10.4.9
+versioning.auto_increment : Include file modified in 10.4.9
+versioning.commit_id : Include file modified in 10.4.9
+versioning.create : Modified in 10.4.9
versioning.cte : Modified in 10.4.8
-versioning.delete : Modified in 10.4.8
+versioning.delete : Modified in 10.4.9
versioning.derived : Modified in 10.4.8
-versioning.foreign : Modified in 10.4.8
-versioning.insert : Include file modified in 10.4.8
-versioning.online : Modified in 10.4.8
-versioning.partition : Modified in 10.4.8
-versioning.partition_innodb : Modified in 10.4.8
-versioning.replace : Modified in 10.4.8
-versioning.select : Modified in 10.4.8
-versioning.select2 : Include file modified in 10.4.8
-versioning.simple : Modified in 10.3.17
-versioning.truncate : Modified in 10.4.8
-versioning.trx_id : Modified in 10.4.8
-versioning.update : Include file modified in 10.4.8
-versioning.update-big : Modified in 10.4.8
-versioning.view : Modified in 10.4.8
+versioning.engines : Combinations added in 10.4.9
+versioning.foreign : Modified in 10.4.9
+versioning.insert : Include file modified in 10.4.9
+versioning.key_type : Combinations added in 10.4.9
+versioning.online : Modified in 10.4.9
+versioning.partition : Modified in 10.4.9
+versioning.partition_innodb : Modified in 10.4.9
+versioning.replace : Modified in 10.4.9
+versioning.select : Include file modified in 10.4.9
+versioning.select2 : Include file modified in 10.4.9
+versioning.truncate : Modified in 10.4.9
+versioning.trx_id : Modified in 10.4.9
+versioning.update : MDEV-20955 - Wrong result code; modified in 10.4.9
+versioning.update-big : Modified in 10.4.9
+versioning.view : Modified in 10.4.9
#-----------------------------------------------------------------------
-wsrep.* : suite.pm modified in 10.4.7
wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node
-wsrep.mdev_6832 : MDEV-14195 - Check testcase failed
+wsrep.mdev_6832 : MDEV-14195 - Check testcase failed; modified in 10.4.9
wsrep.mysql_tzinfo_to_sql_symlink_skip : Added in 10.4.8
wsrep.pool_of_threads : MDEV-17345 - WSREP has not yet prepared node for application use
-wsrep.variables : MDEV-14311 - Wrong result; MDEV-17585 - Deadlock; modified in 10.4.7
+wsrep.variables : MDEV-14311 - Wrong result; MDEV-17585 - Deadlock; modified in 10.4.9
#-----------------------------------------------------------------------
-wsrep_info.* : suite.pm modified in 10.4.7
wsrep_info.plugin : MDEV-13569 - No nodes coming from prim view
diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh
index 15a81cc1e8a..b2a9edf4953 100644
--- a/scripts/mysql_secure_installation.sh
+++ b/scripts/mysql_secure_installation.sh
@@ -440,7 +440,7 @@ if [ "$reply" = "n" ]; then
echo " ... skipping."
else
emptypass=0
- do_query "UPDATE mysql.global_priv SET priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', 'invalid', '$.auth_or', json_array(json_object(), json_object('plugin', 'unix_socket'))) WHERE User='root';"
+ do_query "UPDATE mysql.global_priv SET priv=json_set(priv, '$.password_last_changed', UNIX_TIMESTAMP(), '$.plugin', 'mysql_native_password', '$.authentication_string', 'invalid', '$.auth_or', json_array(json_object(), json_object('plugin', 'unix_socket'))) WHERE User='root';"
if [ $? -eq 0 ]; then
echo "Enabled successfully!"
echo "Reloading privilege tables.."
diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh
index c599aa96c57..aaf711b0fb9 100644
--- a/scripts/mysqlaccess.sh
+++ b/scripts/mysqlaccess.sh
@@ -26,7 +26,7 @@ use Fcntl;
BEGIN {
# ****************************
# static information...
- $VERSION = "2.06, 20 Dec 2000";
+ $VERSION = "2.10, 13 Sep 2019";
$0 =~ m%/([^/]+)$%o;
$script = $1;
$script = 'MySQLAccess' unless $script;
diff --git a/sql/backup.cc b/sql/backup.cc
index 73cd13ffe2a..5976506cf92 100644
--- a/sql/backup.cc
+++ b/sql/backup.cc
@@ -290,6 +290,14 @@ static bool backup_block_commit(THD *thd)
/* We can ignore errors from flush_tables () */
(void) flush_tables(thd, FLUSH_SYS_TABLES);
+
+ if (mysql_bin_log.is_open())
+ {
+ mysql_mutex_lock(mysql_bin_log.get_log_lock());
+ mysql_file_sync(mysql_bin_log.get_log_file()->file,
+ MYF(MY_WME|MY_SYNC_FILESIZE));
+ mysql_mutex_unlock(mysql_bin_log.get_log_lock());
+ }
thd->clear_error();
DBUG_RETURN(0);
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 45ea9eb1552..10d97328c70 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -3461,8 +3461,7 @@ bool ha_partition::init_partition_bitmaps()
/*
Open handler object
-
- SYNOPSIS
+SYNOPSIS
open()
name Full path of table name
mode Open mode flags
@@ -3588,6 +3587,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
}
else
{
+ check_insert_autoincrement();
if (unlikely((error= open_read_partitions(name_buff, sizeof(name_buff)))))
goto err_handler;
m_num_locks= m_file_sample->lock_count();
@@ -4473,11 +4473,8 @@ exit:
table->found_next_number_field->field_index))
{
update_next_auto_inc_val();
- /*
- The following call is safe as part_share->auto_inc_initialized
- (tested in the call) is guaranteed to be set for update statements.
- */
- set_auto_increment_if_higher(table->found_next_number_field);
+ if (part_share->auto_inc_initialized)
+ set_auto_increment_if_higher(table->found_next_number_field);
}
DBUG_RETURN(error);
}
@@ -8138,6 +8135,7 @@ int ha_partition::info(uint flag)
if (flag & HA_STATUS_AUTO)
{
bool auto_inc_is_first_in_idx= (table_share->next_number_keypart == 0);
+ bool all_parts_opened= true;
DBUG_PRINT("info", ("HA_STATUS_AUTO"));
if (!table->found_next_number_field)
stats.auto_increment_value= 0;
@@ -8168,6 +8166,15 @@ int ha_partition::info(uint flag)
("checking all partitions for auto_increment_value"));
do
{
+ if (!bitmap_is_set(&m_opened_partitions, (uint)(file_array - m_file)))
+ {
+ /*
+ Some partitions aren't opened.
+ So we can't calculate the autoincrement.
+ */
+ all_parts_opened= false;
+ break;
+ }
file= *file_array;
file->info(HA_STATUS_AUTO | no_lock_flag);
set_if_bigger(auto_increment_value,
@@ -8176,7 +8183,7 @@ int ha_partition::info(uint flag)
DBUG_ASSERT(auto_increment_value);
stats.auto_increment_value= auto_increment_value;
- if (auto_inc_is_first_in_idx)
+ if (all_parts_opened && auto_inc_is_first_in_idx)
{
set_if_bigger(part_share->next_auto_inc_val,
auto_increment_value);
@@ -8485,6 +8492,7 @@ int ha_partition::change_partitions_to_open(List<String> *partition_names)
return 0;
}
+ check_insert_autoincrement();
if (bitmap_cmp(&m_opened_partitions, &m_part_info->read_partitions) != 0)
return 0;
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 0fe98dc4608..ff02ea5aa1c 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1329,6 +1329,19 @@ private:
unlock_auto_increment();
}
+ void check_insert_autoincrement()
+ {
+ /*
+ If we INSERT into the table having the AUTO_INCREMENT column,
+ we have to read all partitions for the next autoincrement value
+ unless we already did it.
+ */
+ if (!part_share->auto_inc_initialized &&
+ ha_thd()->lex->sql_command == SQLCOM_INSERT &&
+ table->found_next_number_field)
+ bitmap_set_all(&m_part_info->read_partitions);
+ }
+
public:
/*
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index bf571473211..78c29ac8e33 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2666,10 +2666,17 @@ const int FORMAT_MAX_DECIMALS= 30;
bool Item_func_format::fix_length_and_dec()
{
- uint32 char_length= args[0]->max_char_length();
- uint32 max_sep_count= (char_length / 3) + (decimals ? 1 : 0) + /*sign*/1;
+ uint32 char_length= args[0]->type_handler()->Item_decimal_notation_int_digits(args[0]);
+ uint dec= FORMAT_MAX_DECIMALS;
+ if (args[1]->const_item() && !args[1]->is_expensive())
+ {
+ Longlong_hybrid tmp= args[1]->to_longlong_hybrid();
+ if (!args[1]->null_value)
+ dec= tmp.to_uint(FORMAT_MAX_DECIMALS);
+ }
+ uint32 max_sep_count= (char_length / 3) + (dec ? 1 : 0) + /*sign*/1;
collation.set(default_charset());
- fix_char_length(char_length + max_sep_count + decimals);
+ fix_char_length(char_length + max_sep_count + dec);
if (arg_count == 3)
locale= args[2]->basic_const_item() ? args[2]->locale_from_val_str() : NULL;
else
diff --git a/sql/keycaches.cc b/sql/keycaches.cc
index f38a43f83cf..60049cdd67d 100644
--- a/sql/keycaches.cc
+++ b/sql/keycaches.cc
@@ -68,7 +68,7 @@ uchar* find_named(I_List<NAMED_ILINK> *list, const char *name, size_t length,
}
-bool NAMED_ILIST::delete_element(const char *name, size_t length, void (*free_element)(const char *name, uchar*))
+bool NAMED_ILIST::delete_element(const char *name, size_t length, void (*free_element)(const char *name, void*))
{
I_List_iterator<NAMED_ILINK> it(*this);
NAMED_ILINK *element;
@@ -85,7 +85,7 @@ bool NAMED_ILIST::delete_element(const char *name, size_t length, void (*free_el
DBUG_RETURN(1);
}
-void NAMED_ILIST::delete_elements(void (*free_element)(const char *name, uchar*))
+void NAMED_ILIST::delete_elements(void (*free_element)(const char *name, void*))
{
NAMED_ILINK *element;
DBUG_ENTER("NAMED_ILIST::delete_elements");
@@ -157,9 +157,9 @@ KEY_CACHE *get_or_create_key_cache(const char *name, size_t length)
}
-void free_key_cache(const char *name, KEY_CACHE *key_cache)
+void free_key_cache(const char *name, void *key_cache)
{
- end_key_cache(key_cache, 1); // Can never fail
+ end_key_cache(static_cast<KEY_CACHE *>(key_cache), 1); // Can never fail
my_free(key_cache);
}
@@ -221,13 +221,12 @@ Rpl_filter *get_or_create_rpl_filter(const char *name, size_t length)
return filter;
}
-void free_rpl_filter(const char *name, Rpl_filter *filter)
+void free_rpl_filter(const char *name, void *filter)
{
- delete filter;
- filter= 0;
+ delete static_cast<Rpl_filter*>(filter);
}
void free_all_rpl_filters()
{
- rpl_filters.delete_elements((void (*)(const char*, uchar*)) free_rpl_filter);
+ rpl_filters.delete_elements(free_rpl_filter);
}
diff --git a/sql/keycaches.h b/sql/keycaches.h
index 9da93e5f7ba..68c3dd3a2b0 100644
--- a/sql/keycaches.h
+++ b/sql/keycaches.h
@@ -30,8 +30,8 @@ class NAMED_ILINK;
class NAMED_ILIST: public I_List<NAMED_ILINK>
{
public:
- void delete_elements(void (*free_element)(const char*, uchar*));
- bool delete_element(const char *name, size_t length, void (*free_element)(const char*, uchar*));
+ void delete_elements(void (*free_element)(const char*, void*));
+ bool delete_element(const char *name, size_t length, void (*free_element)(const char*, void*));
};
/* For key cache */
@@ -42,7 +42,7 @@ extern NAMED_ILIST key_caches;
KEY_CACHE *create_key_cache(const char *name, size_t length);
KEY_CACHE *get_key_cache(const LEX_CSTRING *cache_name);
KEY_CACHE *get_or_create_key_cache(const char *name, size_t length);
-void free_key_cache(const char *name, KEY_CACHE *key_cache);
+void free_key_cache(const char *name, void *key_cache);
bool process_key_caches(process_key_cache_t func, void *param);
/* For Rpl_filter */
@@ -52,7 +52,6 @@ extern NAMED_ILIST rpl_filters;
Rpl_filter *create_rpl_filter(const char *name, size_t length);
Rpl_filter *get_rpl_filter(LEX_CSTRING *filter_name);
Rpl_filter *get_or_create_rpl_filter(const char *name, size_t length);
-void free_rpl_filter(const char *name, Rpl_filter *filter);
void free_all_rpl_filters(void);
#endif /* KEYCACHES_INCLUDED */
diff --git a/sql/log.cc b/sql/log.cc
index 4f51a9a9c17..98fb4a6d5a6 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -5968,7 +5968,6 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
DBUG_ASSERT(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open());
DBUG_PRINT("enter", ("event: %p", event));
- int error= 0;
binlog_cache_mngr *const cache_mngr=
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
@@ -6006,7 +6005,7 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
thd->binlog_set_pending_rows_event(event, is_transactional);
- DBUG_RETURN(error);
+ DBUG_RETURN(0);
}
@@ -7718,7 +7717,7 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry)
mysql_mutex_unlock(&LOCK_prepare_ordered);
DEBUG_SYNC(orig_entry->thd, "commit_after_release_LOCK_prepare_ordered");
- DBUG_PRINT("info", ("Queued for group commit as %s\n",
+ DBUG_PRINT("info", ("Queued for group commit as %s",
(orig_queue == NULL) ? "leader" : "participant"));
DBUG_RETURN(orig_queue == NULL);
}
@@ -10734,13 +10733,13 @@ bool wsrep_stmt_rollback_is_safe(THD* thd)
binlog_cache_data * trx_cache = &cache_mngr->trx_cache;
if (thd->wsrep_sr().fragments_certified() > 0 &&
(trx_cache->get_prev_position() == MY_OFF_T_UNDEF ||
- trx_cache->get_prev_position() < thd->wsrep_sr().bytes_certified()))
+ trx_cache->get_prev_position() < thd->wsrep_sr().log_position()))
{
WSREP_DEBUG("statement rollback is not safe for streaming replication"
" pre-stmt_pos: %llu, frag repl pos: %zu\n"
"Thread: %llu, SQL: %s",
trx_cache->get_prev_position(),
- thd->wsrep_sr().bytes_certified(),
+ thd->wsrep_sr().log_position(),
thd->thread_id, thd->query());
ret = false;
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 1df08eb739e..18b8148ed57 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -668,7 +668,9 @@ SHOW_COMP_OPTION have_crypt, have_compress;
SHOW_COMP_OPTION have_profiling;
SHOW_COMP_OPTION have_openssl;
+#ifndef EMBEDDED_LIBRARY
static std::atomic<char*> shutdown_user;
+#endif //EMBEDDED_LIBRARY
/* Thread specific variables */
@@ -1987,7 +1989,7 @@ static void clean_up(bool print_message)
tdc_deinit();
mdl_destroy();
dflt_key_cache= 0;
- key_caches.delete_elements((void (*)(const char*, uchar*)) free_key_cache);
+ key_caches.delete_elements(free_key_cache);
wt_end();
multi_keycache_free();
sp_cache_end();
@@ -4303,7 +4305,6 @@ static int init_common_variables()
return 1;
}
- global_system_variables.in_subquery_conversion_threshold= IN_SUBQUERY_CONVERSION_THRESHOLD;
#ifdef WITH_WSREP
/*
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index eeefe4200da..484836af23e 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -2681,9 +2681,17 @@ bool find_eq_ref_candidate(TABLE *table, table_map sj_inner_tables)
{
do /* For all equalities on all key parts */
{
- /* Check if this is "t.keypart = expr(outer_tables) */
+ /*
+ Check if this is "t.keypart = expr(outer_tables)
+
+ Don't allow variants that can produce duplicates:
+ - Dont allow "ref or null"
+ - the keyuse (that is, the operation) must be null-rejecting,
+ unless the other expression is non-NULLable.
+ */
if (!(keyuse->used_tables & sj_inner_tables) &&
- !(keyuse->optimize & KEY_OPTIMIZE_REF_OR_NULL))
+ !(keyuse->optimize & KEY_OPTIMIZE_REF_OR_NULL) &&
+ (keyuse->null_rejecting || !keyuse->val->maybe_null))
{
bound_parts |= 1 << keyuse->keypart;
}
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 48bc2bb0210..6d55b06b497 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1561,7 +1561,7 @@ scan_one_gtid_slave_pos_table(THD *thd, HASH *hash, DYNAMIC_ARRAY *array,
sub_id= (ulonglong)table->field[1]->val_int();
server_id= (uint32)table->field[2]->val_int();
seq_no= (ulonglong)table->field[3]->val_int();
- DBUG_PRINT("info", ("Read slave state row: %u-%u-%lu sub_id=%lu\n",
+ DBUG_PRINT("info", ("Read slave state row: %u-%u-%lu sub_id=%lu",
(unsigned)domain_id, (unsigned)server_id,
(ulong)seq_no, (ulong)sub_id));
diff --git a/sql/semisync_master.cc b/sql/semisync_master.cc
index f9fb4d9147d..b239a9776a7 100644
--- a/sql/semisync_master.cc
+++ b/sql/semisync_master.cc
@@ -806,7 +806,7 @@ int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name,
if (!get_master_enabled() || !is_on())
goto l_end;
- DBUG_PRINT("semisync", ("%s: wait pos (%s, %lu), repl(%d)\n",
+ DBUG_PRINT("semisync", ("%s: wait pos (%s, %lu), repl(%d)",
"Repl_semi_sync_master::commit_trx",
trx_wait_binlog_name, (ulong)trx_wait_binlog_pos,
(int)is_on()));
diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc
index b365b393e0b..204d671d53b 100644
--- a/sql/service_wsrep.cc
+++ b/sql/service_wsrep.cc
@@ -55,7 +55,26 @@ extern "C" const char* wsrep_thd_transaction_state_str(const THD *thd)
extern "C" const char *wsrep_thd_query(const THD *thd)
{
- return thd ? thd->query() : NULL;
+ if (thd)
+ {
+ switch(thd->lex->sql_command)
+ {
+ case SQLCOM_CREATE_USER:
+ return "CREATE USER";
+ case SQLCOM_GRANT:
+ return "GRANT";
+ case SQLCOM_REVOKE:
+ return "REVOKE";
+ case SQLCOM_SET_OPTION:
+ if (thd->lex->definer)
+ return "SET PASSWORD";
+ /* fallthrough */
+ default:
+ if (thd->query())
+ return thd->query();
+ }
+ }
+ return "NULL";
}
extern "C" query_id_t wsrep_thd_transaction_id(const THD *thd)
diff --git a/sql/sp.cc b/sql/sp.cc
index c9d1e2e3c4a..058a29e65f7 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1466,7 +1466,7 @@ log:
/* Such a statement can always go directly to binlog, no trans cache */
if (thd->binlog_query(THD::STMT_QUERY_TYPE,
log_query.ptr(), log_query.length(),
- FALSE, FALSE, FALSE, 0))
+ FALSE, FALSE, FALSE, 0) > 0)
{
my_error(ER_ERROR_ON_WRITE, MYF(0), "binary log", -1);
goto done;
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 8c07a060f30..945b3ac8854 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -4722,6 +4722,7 @@ typedef struct st_sp_table
uint lock_count;
uint query_lock_count;
uint8 trg_event_map;
+ my_bool for_insert_data;
} SP_TABLE;
@@ -4817,6 +4818,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
if (tab->query_lock_count > tab->lock_count)
tab->lock_count++;
tab->trg_event_map|= table->trg_event_map;
+ tab->for_insert_data|= table->for_insert_data;
}
else
{
@@ -4840,6 +4842,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
tab->lock_type= table->lock_type;
tab->lock_count= tab->query_lock_count= 1;
tab->trg_event_map= table->trg_event_map;
+ tab->for_insert_data= table->for_insert_data;
if (my_hash_insert(&m_sptabs, (uchar *)tab))
return FALSE;
}
@@ -4923,7 +4926,8 @@ sp_head::add_used_tables_to_table_list(THD *thd,
TABLE_LIST::PRELOCK_ROUTINE,
belong_to_view,
stab->trg_event_map,
- query_tables_last_ptr);
+ query_tables_last_ptr,
+ stab->for_insert_data);
tab_buff+= ALIGN_SIZE(sizeof(TABLE_LIST));
result= TRUE;
}
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index ff8a2bebb8d..4c8eaee3145 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -3788,7 +3788,7 @@ bool change_password(THD *thd, LEX_USER *user)
DBUG_ASSERT(query_length);
thd->clear_error();
result= thd->binlog_query(THD::STMT_QUERY_TYPE, buff, query_length,
- FALSE, FALSE, FALSE, 0);
+ FALSE, FALSE, FALSE, 0) > 0;
}
end:
if (result)
@@ -3940,7 +3940,7 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
DBUG_ASSERT(query_length);
thd->clear_error();
result= thd->binlog_query(THD::STMT_QUERY_TYPE, buff, query_length,
- FALSE, FALSE, FALSE, 0);
+ FALSE, FALSE, FALSE, 0) > 0;
}
end:
close_mysql_tables(thd);
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 5dcb7ffac72..3b15c5a505e 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -1317,7 +1317,7 @@ bool Sql_cmd_analyze_table::execute(THD *thd)
"analyze", lock_type, 1, 0, 0, 0,
&handler::ha_analyze, 0);
/* ! we write after unlocking the table */
- if (!res && !m_lex->no_write_to_binlog)
+ if (!res && !m_lex->no_write_to_binlog && (!opt_readonly || thd->slave_thread))
{
/*
Presumably, ANALYZE and binlog writing doesn't require synchronization
@@ -1377,7 +1377,7 @@ bool Sql_cmd_optimize_table::execute(THD *thd)
"optimize", TL_WRITE, 1, 0, 0, 0,
&handler::ha_optimize, 0);
/* ! we write after unlocking the table */
- if (!res && !m_lex->no_write_to_binlog)
+ if (!res && !m_lex->no_write_to_binlog && (!opt_readonly || thd->slave_thread))
{
/*
Presumably, OPTIMIZE and binlog writing doesn't require synchronization
@@ -1413,7 +1413,7 @@ bool Sql_cmd_repair_table::execute(THD *thd)
&handler::ha_repair, &view_repair);
/* ! we write after unlocking the table */
- if (!res && !m_lex->no_write_to_binlog)
+ if (!res && !m_lex->no_write_to_binlog && (!opt_readonly || thd->slave_thread))
{
/*
Presumably, REPAIR and binlog writing doesn't require synchronization
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 15c0e976c26..da061adfc1f 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2668,6 +2668,7 @@ Locked_tables_list::reopen_tables(THD *thd, bool need_reopen)
{
thd->locked_tables_list.unlink_from_list(thd, table_list, false);
mysql_lock_remove(thd, thd->lock, *prev);
+ (*prev)->file->extra(HA_EXTRA_PREPARE_FOR_FORCED_CLOSE);
close_thread_table(thd, prev);
break;
}
@@ -4604,9 +4605,11 @@ add_internal_tables(THD *thd, Query_tables_list *prelocking_ctx,
TABLE_LIST *tables)
{
TABLE_LIST *global_table_list= prelocking_ctx->query_tables;
+ DBUG_ENTER("add_internal_tables");
do
{
+ DBUG_PRINT("info", ("table name: %s", tables->table_name.str));
/*
Skip table if already in the list. Can happen with prepared statements
*/
@@ -4616,20 +4619,22 @@ add_internal_tables(THD *thd, Query_tables_list *prelocking_ctx,
TABLE_LIST *tl= (TABLE_LIST *) thd->alloc(sizeof(TABLE_LIST));
if (!tl)
- return TRUE;
+ DBUG_RETURN(TRUE);
tl->init_one_table_for_prelocking(&tables->db,
&tables->table_name,
NULL, tables->lock_type,
TABLE_LIST::PRELOCK_NONE,
0, 0,
- &prelocking_ctx->query_tables_last);
+ &prelocking_ctx->query_tables_last,
+ tables->for_insert_data);
/*
Store link to the new table_list that will be used by open so that
Item_func_nextval() can find it
*/
tables->next_local= tl;
+ DBUG_PRINT("info", ("table name: %s added", tables->table_name.str));
} while ((tables= tables->next_global));
- return FALSE;
+ DBUG_RETURN(FALSE);
}
@@ -4660,6 +4665,7 @@ bool DML_prelocking_strategy::
handle_table(THD *thd, Query_tables_list *prelocking_ctx,
TABLE_LIST *table_list, bool *need_prelocking)
{
+ DBUG_ENTER("handle_table");
TABLE *table= table_list->table;
/* We rely on a caller to check that table is going to be changed. */
DBUG_ASSERT(table_list->lock_type >= TL_WRITE_ALLOW_WRITE ||
@@ -4690,7 +4696,7 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
{
if (arena)
thd->restore_active_arena(arena, &backup);
- return TRUE;
+ DBUG_RETURN(TRUE);
}
*need_prelocking= TRUE;
@@ -4718,7 +4724,8 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
NULL, lock_type,
TABLE_LIST::PRELOCK_FK,
table_list->belong_to_view, op,
- &prelocking_ctx->query_tables_last);
+ &prelocking_ctx->query_tables_last,
+ table_list->for_insert_data);
}
if (arena)
thd->restore_active_arena(arena, &backup);
@@ -4726,8 +4733,11 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
}
/* Open any tables used by DEFAULT (like sequence tables) */
+ DBUG_PRINT("info", ("table: %p name: %s db: %s flags: %u",
+ table_list, table_list->table_name.str,
+ table_list->db.str, table_list->for_insert_data));
if (table->internal_tables &&
- ((sql_command_flags[thd->lex->sql_command] & CF_INSERTS_DATA) ||
+ (table_list->for_insert_data ||
thd->lex->default_used))
{
Query_arena *arena, backup;
@@ -4740,10 +4750,10 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
if (unlikely(error))
{
*need_prelocking= TRUE;
- return TRUE;
+ DBUG_RETURN(TRUE);
}
}
- return FALSE;
+ DBUG_RETURN(FALSE);
}
@@ -4760,7 +4770,7 @@ bool open_and_lock_internal_tables(TABLE *table, bool lock_table)
THD *thd= table->in_use;
TABLE_LIST *tl;
MYSQL_LOCK *save_lock,*new_lock;
- DBUG_ENTER("open_internal_tables");
+ DBUG_ENTER("open_and_lock_internal_tables");
/* remove pointer to old select_lex which is already destroyed */
for (tl= table->internal_tables ; tl ; tl= tl->next_global)
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index a4861620bf0..cc572065e92 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -49,7 +49,7 @@
#include <m_ctype.h>
#include <sys/stat.h>
#include <thr_alarm.h>
-#ifdef __WIN__
+#ifdef __WIN__0
#include <io.h>
#endif
#include <mysys_err.h>
@@ -5848,17 +5848,33 @@ int THD::decide_logging_format(TABLE_LIST *tables)
Get the capabilities vector for all involved storage engines and
mask out the flags for the binary log.
*/
- for (TABLE_LIST *table= tables; table; table= table->next_global)
+ for (TABLE_LIST *tbl= tables; tbl; tbl= tbl->next_global)
{
- if (table->placeholder())
+ TABLE *table;
+ TABLE_SHARE *share;
+ handler::Table_flags flags;
+ if (tbl->placeholder())
continue;
- handler::Table_flags const flags= table->table->file->ha_table_flags();
+ table= tbl->table;
+ share= table->s;
+ flags= table->file->ha_table_flags();
+ if (!share->table_creation_was_logged)
+ {
+ /*
+ This is a temporary table which was not logged in the binary log.
+ Disable statement logging to enforce row level logging.
+ */
+ DBUG_ASSERT(share->tmp_table);
+ flags&= ~HA_BINLOG_STMT_CAPABLE;
+ /* We can only use row logging */
+ set_current_stmt_binlog_format_row();
+ }
DBUG_PRINT("info", ("table: %s; ha_table_flags: 0x%llx",
- table->table_name.str, flags));
+ tbl->table_name.str, flags));
- if (table->table->s->no_replicate)
+ if (share->no_replicate)
{
/*
The statement uses a table that is not replicated.
@@ -5876,44 +5892,44 @@ int THD::decide_logging_format(TABLE_LIST *tables)
*/
lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_TABLE);
- if (table->lock_type >= TL_WRITE_ALLOW_WRITE)
+ if (tbl->lock_type >= TL_WRITE_ALLOW_WRITE)
{
non_replicated_tables_count++;
continue;
}
}
- if (table == lex->first_not_own_table())
+ if (tbl == lex->first_not_own_table())
found_first_not_own_table= true;
replicated_tables_count++;
- if (table->prelocking_placeholder != TABLE_LIST::PRELOCK_FK)
+ if (tbl->prelocking_placeholder != TABLE_LIST::PRELOCK_FK)
{
- if (table->lock_type <= TL_READ_NO_INSERT)
+ if (tbl->lock_type <= TL_READ_NO_INSERT)
has_read_tables= true;
- else if (table->table->found_next_number_field &&
- (table->lock_type >= TL_WRITE_ALLOW_WRITE))
+ else if (table->found_next_number_field &&
+ (tbl->lock_type >= TL_WRITE_ALLOW_WRITE))
{
has_auto_increment_write_tables= true;
has_auto_increment_write_tables_not_first= found_first_not_own_table;
- if (table->table->s->next_number_keypart != 0)
+ if (share->next_number_keypart != 0)
has_write_table_auto_increment_not_first_in_pk= true;
}
}
- if (table->lock_type >= TL_WRITE_ALLOW_WRITE)
+ if (tbl->lock_type >= TL_WRITE_ALLOW_WRITE)
{
bool trans;
if (prev_write_table && prev_write_table->file->ht !=
- table->table->file->ht)
+ table->file->ht)
multi_write_engine= TRUE;
- if (table->table->s->non_determinstic_insert &&
+ if (share->non_determinstic_insert &&
!(sql_command_flags[lex->sql_command] & CF_SCHEMA_CHANGE))
has_write_tables_with_unsafe_statements= true;
- trans= table->table->file->has_transactions();
+ trans= table->file->has_transactions();
- if (table->table->s->tmp_table)
+ if (share->tmp_table)
lex->set_stmt_accessed_table(trans ? LEX::STMT_WRITES_TEMP_TRANS_TABLE :
LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE);
else
@@ -5924,17 +5940,16 @@ int THD::decide_logging_format(TABLE_LIST *tables)
flags_write_some_set |= flags;
is_write= TRUE;
- prev_write_table= table->table;
+ prev_write_table= table;
}
flags_access_some_set |= flags;
- if (lex->sql_command != SQLCOM_CREATE_TABLE ||
- (lex->sql_command == SQLCOM_CREATE_TABLE && lex->tmp_table()))
+ if (lex->sql_command != SQLCOM_CREATE_TABLE || lex->tmp_table())
{
- my_bool trans= table->table->file->has_transactions();
+ my_bool trans= table->file->has_transactions();
- if (table->table->s->tmp_table)
+ if (share->tmp_table)
lex->set_stmt_accessed_table(trans ? LEX::STMT_READS_TEMP_TRANS_TABLE :
LEX::STMT_READS_TEMP_NON_TRANS_TABLE);
else
@@ -5943,10 +5958,10 @@ int THD::decide_logging_format(TABLE_LIST *tables)
}
if (prev_access_table && prev_access_table->file->ht !=
- table->table->file->ht)
+ table->file->ht)
multi_access_engine= TRUE;
- prev_access_table= table->table;
+ prev_access_table= table;
}
if (wsrep_binlog_format() != BINLOG_FORMAT_ROW)
@@ -6075,10 +6090,17 @@ int THD::decide_logging_format(TABLE_LIST *tables)
{
/*
5. Error: Cannot modify table that uses a storage engine
- limited to row-logging when binlog_format = STATEMENT
+ limited to row-logging when binlog_format = STATEMENT, except
+ if all tables that are updated are temporary tables
*/
- if (IF_WSREP((!WSREP_NNULL(this) ||
- wsrep_cs().mode() == wsrep::client_state::m_local),1))
+ if (!lex->stmt_writes_to_non_temp_table())
+ {
+ /* As all updated tables are temporary, nothing will be logged */
+ set_current_stmt_binlog_format_row();
+ }
+ else if (IF_WSREP((!WSREP(this) ||
+ wsrep_cs().mode() ==
+ wsrep::client_state::m_local),1))
{
my_error((error= ER_BINLOG_STMT_MODE_AND_ROW_ENGINE), MYF(0), "");
}
@@ -6147,10 +6169,8 @@ int THD::decide_logging_format(TABLE_LIST *tables)
"ROW" : "STATEMENT"));
if (variables.binlog_format == BINLOG_FORMAT_ROW &&
- (lex->sql_command == SQLCOM_UPDATE ||
- lex->sql_command == SQLCOM_UPDATE_MULTI ||
- lex->sql_command == SQLCOM_DELETE ||
- lex->sql_command == SQLCOM_DELETE_MULTI))
+ (sql_command_flags[lex->sql_command] &
+ (CF_UPDATES_DATA | CF_DELETES_DATA)))
{
String table_names;
/*
@@ -6170,8 +6190,8 @@ int THD::decide_logging_format(TABLE_LIST *tables)
}
if (!table_names.is_empty())
{
- bool is_update= (lex->sql_command == SQLCOM_UPDATE ||
- lex->sql_command == SQLCOM_UPDATE_MULTI);
+ bool is_update= MY_TEST(sql_command_flags[lex->sql_command] &
+ CF_UPDATES_DATA);
/*
Replace the last ',' with '.' for table_names
*/
@@ -7008,11 +7028,12 @@ void THD::issue_unsafe_warnings()
@see decide_logging_format
+ @retval < 0 No logging of query (ok)
@retval 0 Success
-
- @retval nonzero If there is a failure when writing the query (e.g.,
- write failure), then the error code is returned.
+ @retval > 0 If there is a failure when writing the query (e.g.,
+ write failure), then the error code is returned.
*/
+
int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
ulong query_len, bool is_trans, bool direct,
bool suppress_use, int errcode)
@@ -7038,7 +7059,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
The current statement is to be ignored, and not written to
the binlog. Do not call issue_unsafe_warnings().
*/
- DBUG_RETURN(0);
+ DBUG_RETURN(-1);
}
/*
@@ -7054,7 +7075,10 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
{
int error;
if (unlikely(error= binlog_flush_pending_rows_event(TRUE, is_trans)))
+ {
+ DBUG_ASSERT(error > 0);
DBUG_RETURN(error);
+ }
}
/*
@@ -7097,7 +7121,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
("is_current_stmt_binlog_format_row: %d",
is_current_stmt_binlog_format_row()));
if (is_current_stmt_binlog_format_row())
- DBUG_RETURN(0);
+ DBUG_RETURN(-1);
/* Fall through */
/*
@@ -7138,7 +7162,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
}
binlog_table_maps= 0;
- DBUG_RETURN(error);
+ DBUG_RETURN(error >= 0 ? error : 1);
}
case THD::QUERY_TYPE_COUNT:
diff --git a/sql/sql_class.h b/sql/sql_class.h
index a208b627b7e..2fb5797b325 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1630,12 +1630,16 @@ public:
/**
@class Sub_statement_state
@brief Used to save context when executing a function or trigger
+
+ operations on stat tables aren't technically a sub-statement, but they are
+ similar in a sense that they cannot change the transaction status.
*/
/* Defines used for Sub_statement_state::in_sub_stmt */
#define SUB_STMT_TRIGGER 1
#define SUB_STMT_FUNCTION 2
+#define SUB_STMT_STAT_TABLES 4
class Sub_statement_state
@@ -6654,6 +6658,11 @@ public:
/* Bits in server_command_flags */
/**
+ Statement that deletes existing rows (DELETE, DELETE_MULTI)
+*/
+#define CF_DELETES_DATA (1U << 24)
+
+/**
Skip the increase of the global query id counter. Commonly set for
commands that are stateless (won't cause any change on the server
internal states).
@@ -6858,6 +6867,22 @@ class Sql_mode_save
sql_mode_t old_mode; // SQL mode saved at construction time.
};
+class Switch_to_definer_security_ctx
+{
+ public:
+ Switch_to_definer_security_ctx(THD *thd, TABLE_LIST *table) :
+ m_thd(thd), m_sctx(thd->security_ctx)
+ {
+ if (table->security_ctx)
+ thd->security_ctx= table->security_ctx;
+ }
+ ~Switch_to_definer_security_ctx() { m_thd->security_ctx = m_sctx; }
+
+ private:
+ THD *m_thd;
+ Security_context *m_sctx;
+};
+
class Sql_mode_instant_set: public Sql_mode_save
{
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 8161a761486..0ea00a7d61c 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -930,7 +930,7 @@ cleanup:
transactional_table, FALSE, FALSE,
errcode);
- if (log_result)
+ if (log_result > 0)
{
error=1;
}
@@ -1616,7 +1616,7 @@ bool multi_delete::send_eof()
if (unlikely(thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query(), thd->query_length(),
transactional_tables, FALSE, FALSE,
- errcode)) &&
+ errcode) > 0) &&
!normal_tables)
{
local_error=1; // Log write failed: roll back the SQL statement
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 7be005bd79b..329b6a130b0 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1193,13 +1193,13 @@ values_loop_end:
else if (thd->binlog_query(THD::ROW_QUERY_TYPE,
log_query.c_ptr(), log_query.length(),
transactional_table, FALSE, FALSE,
- errcode))
+ errcode) > 0)
error= 1;
}
else if (thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query(), thd->query_length(),
transactional_table, FALSE, FALSE,
- errcode))
+ errcode) > 0)
error= 1;
}
}
@@ -3964,6 +3964,7 @@ bool select_insert::prepare_eof()
int error;
bool const trans_table= table->file->has_transactions();
bool changed;
+ bool binary_logged= 0;
killed_state killed_status= thd->killed;
DBUG_ENTER("select_insert::prepare_eof");
@@ -4014,18 +4015,22 @@ bool select_insert::prepare_eof()
(likely(!error) || thd->transaction.stmt.modified_non_trans_table))
{
int errcode= 0;
+ int res;
if (likely(!error))
thd->clear_error();
else
errcode= query_error_code(thd, killed_status == NOT_KILLED);
- if (thd->binlog_query(THD::ROW_QUERY_TYPE,
- thd->query(), thd->query_length(),
- trans_table, FALSE, FALSE, errcode))
+ res= thd->binlog_query(THD::ROW_QUERY_TYPE,
+ thd->query(), thd->query_length(),
+ trans_table, FALSE, FALSE, errcode);
+ if (res > 0)
{
table->file->ha_release_auto_increment();
DBUG_RETURN(true);
}
+ binary_logged= res == 0 || !table->s->tmp_table;
}
+ table->s->table_creation_was_logged|= binary_logged;
table->file->ha_release_auto_increment();
if (unlikely(error))
@@ -4082,8 +4087,9 @@ bool select_insert::send_eof()
DBUG_RETURN(res);
}
-void select_insert::abort_result_set() {
-
+void select_insert::abort_result_set()
+{
+ bool binary_logged= 0;
DBUG_ENTER("select_insert::abort_result_set");
/*
If the creation of the table failed (due to a syntax error, for
@@ -4135,16 +4141,20 @@ void select_insert::abort_result_set() {
if(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
+ int res;
/* error of writing binary log is ignored */
- (void) thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(),
- thd->query_length(),
- transactional_table, FALSE, FALSE, errcode);
+ res= thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(),
+ thd->query_length(),
+ transactional_table, FALSE, FALSE, errcode);
+ binary_logged= res == 0 || !table->s->tmp_table;
}
if (changed)
query_cache_invalidate3(thd, table, 1);
}
DBUG_ASSERT(transactional_table || !changed ||
thd->transaction.stmt.modified_non_trans_table);
+
+ table->s->table_creation_was_logged|= binary_logged;
table->file->ha_release_auto_increment();
}
@@ -4213,6 +4223,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
/* Add selected items to field list */
List_iterator_fast<Item> it(*items);
Item *item;
+ bool save_table_creation_was_logged;
DBUG_ENTER("select_create::create_table_from_items");
tmp_table.s= &share;
@@ -4367,6 +4378,14 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
table->reginfo.lock_type=TL_WRITE;
hooks->prelock(&table, 1); // Call prelock hooks
+
+ /*
+ Ensure that decide_logging_format(), called by mysql_lock_tables(), works
+ with temporary tables that will be logged later if needed.
+ */
+ save_table_creation_was_logged= table->s->table_creation_was_logged;
+ table->s->table_creation_was_logged= 1;
+
/*
mysql_lock_tables() below should never fail with request to reopen table
since it won't wait for the table lock (we have exclusive metadata lock on
@@ -4379,8 +4398,11 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
/*
This can happen in innodb when you get a deadlock when using same table
in insert and select or when you run out of memory.
+ It can also happen if there was a conflict in
+ THD::decide_logging_format()
*/
- my_error(ER_CANT_LOCK, MYF(0), my_errno);
+ if (!thd->is_error())
+ my_error(ER_CANT_LOCK, MYF(0), my_errno);
if (*lock)
{
mysql_unlock_tables(thd, *lock);
@@ -4390,6 +4412,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
DBUG_RETURN(0);
/* purecov: end */
}
+ table->s->table_creation_was_logged= save_table_creation_was_logged;
DBUG_RETURN(table);
}
@@ -4593,7 +4616,7 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
/* is_trans */ TRUE,
/* direct */ FALSE,
/* suppress_use */ FALSE,
- errcode);
+ errcode) > 0;
}
#ifdef WITH_WSREP
if (thd->wsrep_trx().active())
@@ -4717,8 +4740,6 @@ bool select_create::send_eof()
}
#endif /* WITH_WSREP */
}
- else if (!thd->is_current_stmt_binlog_format_row())
- table->s->table_creation_was_logged= 1;
/*
exit_done must only be set after last potential call to
@@ -4804,7 +4825,8 @@ void select_create::abort_result_set()
if (table)
{
bool tmp_table= table->s->tmp_table;
-
+ bool table_creation_was_logged= (!tmp_table ||
+ table->s->table_creation_was_logged);
if (tmp_table)
{
DBUG_ASSERT(saved_tmp_table_share);
@@ -4833,7 +4855,9 @@ void select_create::abort_result_set()
/* Remove logging of drop, create + insert rows */
binlog_reset_cache(thd);
/* Original table was deleted. We have to log it */
- log_drop_table(thd, &create_table->db, &create_table->table_name, tmp_table);
+ if (table_creation_was_logged)
+ log_drop_table(thd, &create_table->db, &create_table->table_name,
+ tmp_table);
}
}
DBUG_VOID_RETURN;
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 34dcb0bcbe9..e5e6b1f3afd 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -7723,7 +7723,7 @@ uint binlog_unsafe_map[256];
#define UNSAFE(a, b, c) \
{ \
- DBUG_PRINT("unsafe_mixed_statement", ("SETTING BASE VALUES: %s, %s, %02X\n", \
+ DBUG_PRINT("unsafe_mixed_statement", ("SETTING BASE VALUES: %s, %s, %02X", \
LEX::stmt_accessed_table_string(a), \
LEX::stmt_accessed_table_string(b), \
c)); \
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index e34cd2ebfd7..7fc905528d6 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -2208,6 +2208,14 @@ public:
((1U << STMT_READS_TEMP_TRANS_TABLE) |
(1U << STMT_WRITES_TEMP_TRANS_TABLE))) != 0);
}
+ inline bool stmt_writes_to_non_temp_table()
+ {
+ DBUG_ENTER("THD::stmt_writes_to_non_temp_table");
+
+ DBUG_RETURN((stmt_accessed_table_flag &
+ ((1U << STMT_WRITES_TRANS_TABLE) |
+ (1U << STMT_WRITES_NON_TRANS_TABLE))));
+ }
/**
Checks if a temporary non-transactional table is about to be accessed
@@ -2259,7 +2267,7 @@ public:
unsafe= (binlog_unsafe_map[stmt_accessed_table_flag] & condition);
#if !defined(DBUG_OFF)
- DBUG_PRINT("LEX::is_mixed_stmt_unsafe", ("RESULT %02X %02X %02X\n", condition,
+ DBUG_PRINT("LEX::is_mixed_stmt_unsafe", ("RESULT %02X %02X %02X", condition,
binlog_unsafe_map[stmt_accessed_table_flag],
(binlog_unsafe_map[stmt_accessed_table_flag] & condition)));
@@ -4593,6 +4601,8 @@ public:
const Lex_length_and_dec_st &attr);
bool set_cast_type_udt(Lex_cast_type_st *type,
const LEX_CSTRING &name);
+
+ void mark_first_table_as_inserting();
};
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 3fa6e095f10..89cc3f8da64 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -2053,7 +2053,7 @@ int READ_INFO::read_xml(THD *thd)
chr= read_value(delim, &value);
if (attribute.length() > 0 && value.length() > 0)
{
- DBUG_PRINT("read_xml", ("lev:%i att:%s val:%s\n",
+ DBUG_PRINT("read_xml", ("lev:%i att:%s val:%s",
level + 1,
attribute.c_ptr_safe(),
value.c_ptr_safe()));
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 0493176b264..beda00592e1 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -610,11 +610,12 @@ void init_update_queries(void)
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
CF_CAN_BE_EXPLAINED |
- CF_SP_BULK_SAFE;
+ CF_SP_BULK_SAFE | CF_DELETES_DATA;
sql_command_flags[SQLCOM_DELETE_MULTI]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
- CF_CAN_BE_EXPLAINED;
+ CF_CAN_BE_EXPLAINED |
+ CF_DELETES_DATA;
sql_command_flags[SQLCOM_REPLACE]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
@@ -3313,6 +3314,10 @@ mysql_execute_command(THD *thd)
#endif
DBUG_ENTER("mysql_execute_command");
+ // check that we correctly marked first table for data insertion
+ DBUG_ASSERT(!(sql_command_flags[lex->sql_command] & CF_INSERTS_DATA) ||
+ first_table->for_insert_data);
+
if (thd->security_ctx->password_expired &&
lex->sql_command != SQLCOM_SET_OPTION)
{
@@ -6840,11 +6845,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
bool check_single_table_access(THD *thd, ulong privilege,
TABLE_LIST *all_tables, bool no_errors)
{
- Security_context * backup_ctx= thd->security_ctx;
-
- /* we need to switch to the saved context (if any) */
- if (all_tables->security_ctx)
- thd->security_ctx= all_tables->security_ctx;
+ Switch_to_definer_security_ctx backup_sctx(thd, all_tables);
const char *db_name;
if ((all_tables->view || all_tables->field_translation) &&
@@ -6857,20 +6858,15 @@ bool check_single_table_access(THD *thd, ulong privilege,
&all_tables->grant.privilege,
&all_tables->grant.m_internal,
0, no_errors))
- goto deny;
+ return 1;
/* Show only 1 table for check_grant */
if (!(all_tables->belong_to_view &&
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS)) &&
check_grant(thd, privilege, all_tables, FALSE, 1, no_errors))
- goto deny;
+ return 1;
- thd->security_ctx= backup_ctx;
return 0;
-
-deny:
- thd->security_ctx= backup_ctx;
- return 1;
}
/**
@@ -7045,7 +7041,6 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
{
TABLE_LIST *org_tables= tables;
TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table();
- Security_context *sctx= thd->security_ctx, *backup_ctx= thd->security_ctx;
uint i= 0;
/*
The check that first_not_own_table is not reached is for the case when
@@ -7057,12 +7052,9 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
{
TABLE_LIST *const table_ref= tables->correspondent_table ?
tables->correspondent_table : tables;
+ Switch_to_definer_security_ctx backup_ctx(thd, table_ref);
ulong want_access= requirements;
- if (table_ref->security_ctx)
- sctx= table_ref->security_ctx;
- else
- sctx= backup_ctx;
/*
Register access for view underlying table.
@@ -7073,7 +7065,7 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
if (table_ref->schema_table_reformed)
{
if (check_show_access(thd, table_ref))
- goto deny;
+ return 1;
continue;
}
@@ -7083,8 +7075,6 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
if (table_ref->is_anonymous_derived_table())
continue;
- thd->security_ctx= sctx;
-
if (table_ref->sequence)
{
/* We want to have either SELECT or INSERT rights to sequences depending
@@ -7098,15 +7088,11 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
&table_ref->grant.privilege,
&table_ref->grant.m_internal,
0, no_errors))
- goto deny;
+ return 1;
}
- thd->security_ctx= backup_ctx;
return check_grant(thd,requirements,org_tables,
any_combination_of_privileges_will_do,
number, no_errors);
-deny:
- thd->security_ctx= backup_ctx;
- return TRUE;
}
@@ -10401,3 +10387,14 @@ CHARSET_INFO *find_bin_collation(CHARSET_INFO *cs)
}
return cs;
}
+
+void LEX::mark_first_table_as_inserting()
+{
+ TABLE_LIST *t= first_select_lex()->table_list.first;
+ DBUG_ENTER("Query_tables_list::mark_tables_with_important_flags");
+ DBUG_ASSERT(sql_command_flags[sql_command] & CF_INSERTS_DATA);
+ t->for_insert_data= TRUE;
+ DBUG_PRINT("info", ("table_list: %p name: %s db: %s command: %u",
+ t, t->table_name.str,t->db.str, sql_command));
+ DBUG_VOID_RETURN;
+}
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index e5723cb3b78..424a039a5be 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -3303,7 +3303,7 @@ void mysql_sql_stmt_execute(THD *thd)
/* Query text for binary, general or slow log, if any of them is open */
String expanded_query;
DBUG_ENTER("mysql_sql_stmt_execute");
- DBUG_PRINT("info", ("EXECUTE: %.*s\n", (int) name->length, name->str));
+ DBUG_PRINT("info", ("EXECUTE: %.*s", (int) name->length, name->str));
if (!(stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
{
@@ -3541,7 +3541,7 @@ void mysql_sql_stmt_close(THD *thd)
{
Prepared_statement* stmt;
const LEX_CSTRING *name= &thd->lex->prepared_stmt.name();
- DBUG_PRINT("info", ("DEALLOCATE PREPARE: %.*s\n", (int) name->length,
+ DBUG_PRINT("info", ("DEALLOCATE PREPARE: %.*s", (int) name->length,
name->str));
if (! (stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 4b47f9683eb..43914a0003d 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2860,8 +2860,12 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
else
protocol->store_null();
protocol->store(thd_info->state_info, system_charset_info);
- protocol->store(thd_info->query_string.str(),
- thd_info->query_string.charset());
+ if (thd_info->query_string.length())
+ protocol->store(thd_info->query_string.str(),
+ thd_info->query_string.length(),
+ thd_info->query_string.charset());
+ else
+ protocol->store_null();
if (!thd->variables.old_mode &&
!(thd->variables.old_behavior & OLD_MODE_NO_PROGRESS_INFO))
protocol->store(thd_info->progress, 3, &store_buffer);
@@ -8019,8 +8023,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
mark_all_fields_used_in_query(thd, fields_info, &bitmap, all_items);
- TMP_TABLE_PARAM *tmp_table_param =
- (TMP_TABLE_PARAM*) (thd->alloc(sizeof(TMP_TABLE_PARAM)));
+ TMP_TABLE_PARAM *tmp_table_param = new (thd->mem_root) TMP_TABLE_PARAM;
tmp_table_param->init();
tmp_table_param->table_charset= system_charset_info;
tmp_table_param->field_count= field_count;
@@ -8577,6 +8580,7 @@ bool get_schema_tables_result(JOIN *join,
cond= tab->cache_select->cond;
}
+ Switch_to_definer_security_ctx backup_ctx(thd, table_list);
if (table_list->schema_table->fill_table(thd, table_list, cond))
{
result= 1;
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index abf6a8a3cad..a94fb1196b4 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -230,10 +230,8 @@ index_stat_def= {INDEX_STAT_N_FIELDS, index_stat_fields, 4, index_stat_pk_col};
Open all statistical tables and lock them
*/
-static
-inline int open_stat_tables(THD *thd, TABLE_LIST *tables,
- Open_tables_backup *backup,
- bool for_write)
+static int open_stat_tables(THD *thd, TABLE_LIST *tables,
+ Open_tables_backup *backup, bool for_write)
{
int rc;
@@ -241,12 +239,14 @@ inline int open_stat_tables(THD *thd, TABLE_LIST *tables,
thd->push_internal_handler(&deh);
init_table_list_for_stat_tables(tables, for_write);
init_mdl_requests(tables);
+ thd->in_sub_stmt|= SUB_STMT_STAT_TABLES;
rc= open_system_tables_for_read(thd, tables, backup);
+ thd->in_sub_stmt&= ~SUB_STMT_STAT_TABLES;
thd->pop_internal_handler();
/* If the number of tables changes, we should revise the check below. */
- DBUG_ASSERT(STATISTICS_TABLES == 3);
+ compile_time_assert(STATISTICS_TABLES == 3);
if (!rc &&
(stat_table_intact.check(tables[TABLE_STAT].table, &table_stat_def) ||
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f824abbcabc..2917a320603 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1987,7 +1987,7 @@ int write_bin_log(THD *thd, bool clear_error,
errcode= query_error_code(thd, TRUE);
error= thd->binlog_query(THD::STMT_QUERY_TYPE,
query, query_length, is_trans, FALSE, FALSE,
- errcode);
+ errcode) > 0;
thd_proc_info(thd, 0);
}
return error;
@@ -2603,24 +2603,24 @@ err:
/* Chop of the last comma */
built_non_trans_tmp_query.chop();
built_non_trans_tmp_query.append(" /* generated by server */");
- error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
- built_non_trans_tmp_query.ptr(),
- built_non_trans_tmp_query.length(),
- FALSE, FALSE,
- is_drop_tmp_if_exists_added,
- 0);
+ error |= (thd->binlog_query(THD::STMT_QUERY_TYPE,
+ built_non_trans_tmp_query.ptr(),
+ built_non_trans_tmp_query.length(),
+ FALSE, FALSE,
+ is_drop_tmp_if_exists_added,
+ 0) > 0);
}
if (trans_tmp_table_deleted)
{
/* Chop of the last comma */
built_trans_tmp_query.chop();
built_trans_tmp_query.append(" /* generated by server */");
- error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
- built_trans_tmp_query.ptr(),
- built_trans_tmp_query.length(),
- TRUE, FALSE,
- is_drop_tmp_if_exists_added,
- 0);
+ error |= (thd->binlog_query(THD::STMT_QUERY_TYPE,
+ built_trans_tmp_query.ptr(),
+ built_trans_tmp_query.length(),
+ TRUE, FALSE,
+ is_drop_tmp_if_exists_added,
+ 0) > 0);
}
if (non_tmp_table_deleted)
{
@@ -2629,11 +2629,11 @@ err:
built_query.append(" /* generated by server */");
int error_code = non_tmp_error ? thd->get_stmt_da()->sql_errno()
: 0;
- error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
- built_query.ptr(),
- built_query.length(),
- TRUE, FALSE, FALSE,
- error_code);
+ error |= (thd->binlog_query(THD::STMT_QUERY_TYPE,
+ built_query.ptr(),
+ built_query.length(),
+ TRUE, FALSE, FALSE,
+ error_code) > 0);
}
}
}
@@ -2716,7 +2716,7 @@ bool log_drop_table(THD *thd, const LEX_CSTRING *db_name,
"failed CREATE OR REPLACE */"));
error= thd->binlog_query(THD::STMT_QUERY_TYPE,
query.ptr(), query.length(),
- FALSE, FALSE, temporary_table, 0);
+ FALSE, FALSE, temporary_table, 0) > 0;
DBUG_RETURN(error);
}
@@ -5281,9 +5281,13 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
}
err:
- /* In RBR we don't need to log CREATE TEMPORARY TABLE */
- if (!result && thd->is_current_stmt_binlog_format_row() && create_info->tmp_table())
+ /* In RBR or readonly server we don't need to log CREATE TEMPORARY TABLE */
+ if (!result && create_info->tmp_table() &&
+ (thd->is_current_stmt_binlog_format_row() || (opt_readonly && !thd->slave_thread)))
+ {
+ /* Note that table->s->table_creation_was_logged is not set! */
DBUG_RETURN(result);
+ }
if (create_info->tmp_table())
thd->transaction.stmt.mark_created_temp_table();
@@ -5300,11 +5304,13 @@ err:
*/
thd->locked_tables_list.unlock_locked_table(thd, mdl_ticket);
}
- else if (likely(!result) && create_info->tmp_table() && create_info->table)
+ else if (likely(!result) && create_info->table)
{
/*
- Remember that tmp table creation was logged so that we know if
+ Remember that table creation was logged so that we know if
we should log a delete of it.
+ If create_info->table was not set, it's a normal table and
+ table_creation_was_logged will be set when the share is created.
*/
create_info->table->s->table_creation_was_logged= 1;
}
@@ -6893,7 +6899,7 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
}
if (field->vcol_info->is_in_partitioning_expr() ||
- field->flags & PART_KEY_FLAG)
+ field->flags & PART_KEY_FLAG || field->stored_in_db())
{
if (value_changes)
ha_alter_info->handler_flags|= ALTER_COLUMN_VCOL;
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index f43599d682b..323f693302f 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -4030,7 +4030,6 @@ uint32 Type_handler_temporal_result::max_display_length(const Item *item) const
return item->max_length;
}
-
uint32 Type_handler_string_result::max_display_length(const Item *item) const
{
return item->max_length;
@@ -4048,6 +4047,50 @@ uint32 Type_handler_bit::max_display_length(const Item *item) const
return item->max_length;
}
+/*************************************************************************/
+
+uint32
+Type_handler_decimal_result::Item_decimal_notation_int_digits(const Item *item)
+ const
+{
+ return item->decimal_int_part();
+}
+
+
+uint32
+Type_handler_temporal_result::Item_decimal_notation_int_digits(const Item *item)
+ const
+{
+ return item->decimal_int_part();
+}
+
+
+uint32
+Type_handler_bit::Item_decimal_notation_int_digits(const Item *item)
+ const
+{
+ return Bit_decimal_notation_int_digits(item);
+}
+
+
+uint32
+Type_handler_general_purpose_int::Item_decimal_notation_int_digits(
+ const Item *item) const
+{
+ return type_limits_int()->precision();
+}
+
+/*************************************************************************/
+
+/*
+ Decimal to binary digits ratio converges to log2(10) thus using 3 as
+ a divisor.
+*/
+uint32
+Type_handler_bit::Bit_decimal_notation_int_digits(const Item *item)
+{
+ return item->max_length/3+1;
+}
/*************************************************************************/
diff --git a/sql/sql_type.h b/sql/sql_type.h
index dda5768e753..3943a3f761f 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -3752,6 +3752,7 @@ public:
SORT_FIELD_ATTR *attr) const= 0;
virtual uint32 max_display_length(const Item *item) const= 0;
+ virtual uint32 Item_decimal_notation_int_digits(const Item *item) const { return 0; }
virtual uint32 calc_pack_length(uint32 length) const= 0;
virtual uint calc_key_length(const Column_definition &def) const;
virtual void Item_update_null_value(Item *item) const= 0;
@@ -4594,6 +4595,7 @@ public:
const Type_std_attributes *item,
SORT_FIELD_ATTR *attr) const override;
uint32 max_display_length(const Item *item) const override;
+ uint32 Item_decimal_notation_int_digits(const Item *item) const override;
Item *create_typecast_item(THD *thd, Item *item,
const Type_cast_attributes &attr) const override;
bool Item_const_eq(const Item_const *a, const Item_const *b,
@@ -4908,6 +4910,7 @@ public:
{
return type_limits_int()->char_length();
}
+ uint32 Item_decimal_notation_int_digits(const Item *item) const override;
bool partition_field_check(const LEX_CSTRING &field_name,
Item *item_expr) const override
{
@@ -4946,6 +4949,7 @@ public:
const Type_all_attributes *attr,
const st_value *value) const override;
uint32 max_display_length(const Item *item) const override;
+ uint32 Item_decimal_notation_int_digits(const Item *item) const override;
bool can_change_cond_ref_to_const(Item_bool_func2 *target,
Item *target_expr, Item *target_value,
Item_bool_func2 *source,
@@ -5043,6 +5047,12 @@ public:
Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
uchar *buff) const override;
uint32 max_display_length(const Item *item) const override;
+ /*
+ The next method returns 309 for long stringified doubles in scientific
+ notation, e.g. FORMAT('1e308', 2).
+ */
+ uint32 Item_decimal_notation_int_digits(const Item *item) const override
+ { return 309; }
bool Item_const_eq(const Item_const *a, const Item_const *b,
bool binary_cmp) const override;
bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
@@ -5472,6 +5482,8 @@ public:
return PROTOCOL_SEND_SHORT;
}
uint32 max_display_length(const Item *item) const override;
+ uint32 Item_decimal_notation_int_digits(const Item *item) const override
+ { return 4; };
uint32 max_display_length_for_field(const Conv_source &src) const override
{ return 4; }
uint32 calc_pack_length(uint32 length) const override { return 1; }
@@ -5522,6 +5534,8 @@ public:
return PROTOCOL_SEND_STRING;
}
uint32 max_display_length(const Item *item) const override;
+ uint32 Item_decimal_notation_int_digits(const Item *item) const override;
+ static uint32 Bit_decimal_notation_int_digits(const Item *item);
uint32 max_display_length_for_field(const Conv_source &src) const override;
uint32 calc_pack_length(uint32 length) const override { return length / 8; }
uint calc_key_length(const Column_definition &def) const override;
@@ -5634,6 +5648,8 @@ public:
}
bool type_can_have_auto_increment_attribute() const override { return true; }
uint32 max_display_length(const Item *item) const override { return 53; }
+ uint32 Item_decimal_notation_int_digits(const Item *item) const override
+ { return 309; }
uint32 max_display_length_for_field(const Conv_source &src) const override
{ return 22; }
uint32 calc_pack_length(uint32 length) const override
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 1b589d941b2..9f298a51b72 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1262,7 +1262,7 @@ update_end:
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query(), thd->query_length(),
- transactional_table, FALSE, FALSE, errcode))
+ transactional_table, FALSE, FALSE, errcode) > 0)
{
error=1; // Rollback update
}
@@ -2991,7 +2991,7 @@ bool multi_update::send_eof()
if (thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(),
thd->query_length(), transactional_tables, FALSE,
- FALSE, errcode))
+ FALSE, errcode) > 0)
local_error= 1; // Rollback update
thd->set_current_stmt_binlog_format(save_binlog_format);
}
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index ca66da1fd0d..2011abf79ba 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -698,7 +698,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
thd->reset_unsafe_warnings();
if (thd->binlog_query(THD::STMT_QUERY_TYPE,
buff.ptr(), buff.length(), FALSE, FALSE, FALSE,
- errcode))
+ errcode) > 0)
res= TRUE;
}
@@ -1498,6 +1498,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
privileges of top_view
*/
tbl->grant.want_privilege= SELECT_ACL;
+
/*
After unfolding the view we lose the list of tables referenced in it
(we will have only a list of underlying tables in case of MERGE
@@ -1548,6 +1549,18 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
views with subqueries in select list.
*/
view_main_select_tables= lex->first_select_lex()->table_list.first;
+ /*
+ Mergeable view can be used for inserting, so we move the flag down
+ */
+ if (table->for_insert_data)
+ {
+ for (TABLE_LIST *t= view_main_select_tables;
+ t;
+ t= t->next_local)
+ {
+ t->for_insert_data= TRUE;
+ }
+ }
/*
Let us set proper lock type for tables of the view's main
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index e111b268e65..b06d2f5a80c 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -7836,6 +7836,7 @@ alter:
Lex->first_select_lex()->db=
(Lex->first_select_lex()->table_list.first)->db;
Lex->create_last_non_select_table= Lex->last_table();
+ Lex->mark_first_table_as_inserting();
}
alter_commands
{
@@ -13483,7 +13484,10 @@ insert:
Select->set_lock_for_tables($4, true);
}
insert_field_spec opt_insert_update opt_returning
- stmt_end {}
+ stmt_end
+ {
+ Lex->mark_first_table_as_inserting();
+ }
;
replace:
@@ -13497,7 +13501,10 @@ replace:
Select->set_lock_for_tables($4, true);
}
insert_field_spec opt_returning
- stmt_end {}
+ stmt_end
+ {
+ Lex->mark_first_table_as_inserting();
+ }
;
insert_start: {
@@ -15008,7 +15015,10 @@ load:
opt_xml_rows_identified_by
opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec
opt_load_data_set_spec
- stmt_end {}
+ stmt_end
+ {
+ Lex->mark_first_table_as_inserting();
+ }
;
data_or_xml:
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index c3727c4819d..c18acd3ef96 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -7799,6 +7799,7 @@ alter:
Lex->first_select_lex()->db=
(Lex->first_select_lex()->table_list.first)->db;
Lex->create_last_non_select_table= Lex->last_table();
+ Lex->mark_first_table_as_inserting();
}
alter_commands
{
@@ -13471,7 +13472,10 @@ insert:
Select->set_lock_for_tables($4, true);
}
insert_field_spec opt_insert_update opt_returning
- stmt_end {}
+ stmt_end
+ {
+ Lex->mark_first_table_as_inserting();
+ }
;
replace:
@@ -13485,7 +13489,10 @@ replace:
Select->set_lock_for_tables($4, true);
}
insert_field_spec opt_returning
- stmt_end {}
+ stmt_end
+ {
+ Lex->mark_first_table_as_inserting();
+ }
;
insert_start: {
@@ -15003,7 +15010,10 @@ load:
opt_xml_rows_identified_by
opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec
opt_load_data_set_spec
- stmt_end {}
+ stmt_end
+ {
+ Lex->mark_first_table_as_inserting();
+ }
;
data_or_xml:
diff --git a/sql/table.cc b/sql/table.cc
index 8dc4cc5e9a0..b745ce22946 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -695,7 +695,11 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags)
frmlen= read_length + sizeof(head);
share->init_from_binary_frm_image(thd, false, buf, frmlen);
- error_given= true; // init_from_binary_frm_image has already called my_error()
+ /*
+ Don't give any additional errors. If there would be a problem,
+ init_from_binary_frm_image would call my_error() itself.
+ */
+ error_given= true;
my_free(buf);
goto err_not_open;
@@ -704,6 +708,9 @@ err:
mysql_file_close(file, MYF(MY_WME));
err_not_open:
+ /* Mark that table was created earlier and thus should have been logged */
+ share->table_creation_was_logged= 1;
+
if (unlikely(share->error && !error_given))
{
share->open_errno= my_errno;
@@ -3324,6 +3331,8 @@ ret:
sql_copy);
DBUG_RETURN(HA_ERR_GENERIC);
}
+ /* Treat the table as normal table from binary logging point of view */
+ table_creation_was_logged= 1;
DBUG_RETURN(0);
}
diff --git a/sql/table.h b/sql/table.h
index 898c31c4aff..b9ab61e85fd 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -752,10 +752,15 @@ struct TABLE_SHARE
bool system; /* Set if system table (one record) */
bool not_usable_by_query_cache;
bool online_backup; /* Set if on-line backup supported */
+ /*
+ This is used by log tables, for tables that have their own internal
+ binary logging or for tables that doesn't support statement or row logging
+ */
bool no_replicate;
bool crashed;
bool is_view;
bool can_cmp_whole_record;
+ /* This is set for temporary tables where CREATE was binary logged */
bool table_creation_was_logged;
bool non_determinstic_insert;
bool vcols_need_refixing;
@@ -1989,7 +1994,8 @@ struct TABLE_LIST
prelocking_types prelocking_type,
TABLE_LIST *belong_to_view_arg,
uint8 trg_event_map_arg,
- TABLE_LIST ***last_ptr)
+ TABLE_LIST ***last_ptr,
+ my_bool insert_data)
{
init_one_table(db_arg, table_name_arg, alias_arg, lock_type_arg);
@@ -2004,6 +2010,7 @@ struct TABLE_LIST
**last_ptr= this;
prev_global= *last_ptr;
*last_ptr= &next_global;
+ for_insert_data= insert_data;
}
@@ -2430,6 +2437,8 @@ struct TABLE_LIST
return period_conditions.is_set();
}
+ my_bool for_insert_data;
+
/**
@brief
Find the bottom in the chain of embedded table VIEWs.
diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc
index cfa709b1055..a81503a50da 100644
--- a/sql/wsrep_binlog.cc
+++ b/sql/wsrep_binlog.cc
@@ -123,7 +123,7 @@ static int wsrep_write_cache_inc(THD* const thd,
DBUG_ENTER("wsrep_write_cache_inc");
my_off_t const saved_pos(my_b_tell(cache));
- if (reinit_io_cache(cache, READ_CACHE, thd->wsrep_sr().bytes_certified(), 0, 0))
+ if (reinit_io_cache(cache, READ_CACHE, thd->wsrep_sr().log_position(), 0, 0))
{
WSREP_ERROR("failed to initialize io-cache");
DBUG_RETURN(1);;
@@ -158,7 +158,7 @@ static int wsrep_write_cache_inc(THD* const thd,
}
if (ret == 0)
{
- assert(total_length + thd->wsrep_sr().bytes_certified() == saved_pos);
+ assert(total_length + thd->wsrep_sr().log_position() == saved_pos);
}
cleanup:
diff --git a/sql/wsrep_client_service.cc b/sql/wsrep_client_service.cc
index 8d58f62bd03..696a097db21 100644
--- a/sql/wsrep_client_service.cc
+++ b/sql/wsrep_client_service.cc
@@ -137,7 +137,8 @@ void Wsrep_client_service::cleanup_transaction()
}
-int Wsrep_client_service::prepare_fragment_for_replication(wsrep::mutable_buffer& buffer)
+int Wsrep_client_service::prepare_fragment_for_replication(
+ wsrep::mutable_buffer& buffer, size_t& log_position)
{
DBUG_ASSERT(m_thd == current_thd);
THD* thd= m_thd;
@@ -151,7 +152,7 @@ int Wsrep_client_service::prepare_fragment_for_replication(wsrep::mutable_buffer
}
const my_off_t saved_pos(my_b_tell(cache));
- if (reinit_io_cache(cache, READ_CACHE, thd->wsrep_sr().bytes_certified(), 0, 0))
+ if (reinit_io_cache(cache, READ_CACHE, thd->wsrep_sr().log_position(), 0, 0))
{
DBUG_RETURN(1);
}
@@ -185,6 +186,7 @@ int Wsrep_client_service::prepare_fragment_for_replication(wsrep::mutable_buffer
while (cache->file >= 0 && (length= my_b_fill(cache)));
}
DBUG_ASSERT(total_length == buffer.size());
+ log_position= saved_pos;
cleanup:
if (reinit_io_cache(cache, WRITE_CACHE, saved_pos, 0, 0))
{
diff --git a/sql/wsrep_client_service.h b/sql/wsrep_client_service.h
index b1695b7aedf..aa58d99c3cf 100644
--- a/sql/wsrep_client_service.h
+++ b/sql/wsrep_client_service.h
@@ -43,7 +43,7 @@ public:
void cleanup_transaction();
bool statement_allowed_for_streaming() const;
size_t bytes_generated() const;
- int prepare_fragment_for_replication(wsrep::mutable_buffer&);
+ int prepare_fragment_for_replication(wsrep::mutable_buffer&, size_t&);
int remove_fragments();
void emergency_shutdown()
{ throw wsrep::not_implemented_error(); }
diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc
index 2ea434c092b..b5adef17442 100644
--- a/sql/wsrep_dummy.cc
+++ b/sql/wsrep_dummy.cc
@@ -66,7 +66,7 @@ const char *wsrep_thd_exec_mode_str(THD *)
{ return NULL; }
const char *wsrep_thd_query(const THD *)
-{ return 0; }
+{ return "NULL"; }
const char *wsrep_thd_query_state_str(THD *)
{ return 0; }
diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc
index 84c89ccb705..987a1765dcf 100644
--- a/sql/wsrep_high_priority_service.cc
+++ b/sql/wsrep_high_priority_service.cc
@@ -222,6 +222,12 @@ const wsrep::transaction& Wsrep_high_priority_service::transaction() const
DBUG_RETURN(m_thd->wsrep_trx());
}
+int Wsrep_high_priority_service::next_fragment(const wsrep::ws_meta& ws_meta)
+{
+ DBUG_ENTER(" Wsrep_high_priority_service::next_fragment");
+ DBUG_RETURN(m_thd->wsrep_cs().next_fragment(ws_meta));
+}
+
int Wsrep_high_priority_service::adopt_transaction(
const wsrep::transaction& transaction)
{
@@ -242,7 +248,8 @@ int Wsrep_high_priority_service::adopt_transaction(
int Wsrep_high_priority_service::append_fragment_and_commit(
const wsrep::ws_handle& ws_handle,
const wsrep::ws_meta& ws_meta,
- const wsrep::const_buffer& data)
+ const wsrep::const_buffer& data,
+ const wsrep::xid& xid WSREP_UNUSED)
{
DBUG_ENTER("Wsrep_high_priority_service::append_fragment_and_commit");
int ret= start_transaction(ws_handle, ws_meta);
diff --git a/sql/wsrep_high_priority_service.h b/sql/wsrep_high_priority_service.h
index 5657a2e82fc..a14498037d7 100644
--- a/sql/wsrep_high_priority_service.h
+++ b/sql/wsrep_high_priority_service.h
@@ -34,13 +34,15 @@ public:
~Wsrep_high_priority_service();
int start_transaction(const wsrep::ws_handle&,
const wsrep::ws_meta&);
+ int next_fragment(const wsrep::ws_meta&);
const wsrep::transaction& transaction() const;
int adopt_transaction(const wsrep::transaction&);
int apply_write_set(const wsrep::ws_meta&, const wsrep::const_buffer&,
wsrep::mutable_buffer&) = 0;
int append_fragment_and_commit(const wsrep::ws_handle&,
const wsrep::ws_meta&,
- const wsrep::const_buffer&);
+ const wsrep::const_buffer&,
+ const wsrep::xid&);
int remove_fragments(const wsrep::ws_meta&);
int commit(const wsrep::ws_handle&, const wsrep::ws_meta&);
int rollback(const wsrep::ws_handle&, const wsrep::ws_meta&);
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index a6f9d3a6b17..e35d13be4c6 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -627,6 +627,7 @@ static wsrep::gtid wsrep_server_initial_position()
*/
static void wsrep_init_provider_status_variables()
{
+ wsrep_inited= 1;
const wsrep::provider& provider=
Wsrep_server_state::instance().provider();
strncpy(provider_name,
@@ -711,9 +712,7 @@ int wsrep_init()
WSREP_ERROR("wsrep::init() failed: %d, must shutdown", err);
}
else
- {
wsrep_init_provider_status_variables();
- }
return err;
}
@@ -749,7 +748,6 @@ int wsrep_init()
Wsrep_server_state::instance().unload_provider();
return 1;
}
- wsrep_inited= 1;
wsrep_init_provider_status_variables();
wsrep_capabilities_export(Wsrep_server_state::instance().provider().capabilities(),
@@ -1705,26 +1703,6 @@ static bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table,
}
}
-#if UNUSED /* 323f269d4099 (Jan Lindström 2018-07-19) */
-static const char* wsrep_get_query_or_msg(const THD* thd)
-{
- switch(thd->lex->sql_command)
- {
- case SQLCOM_CREATE_USER:
- return "CREATE USER";
- case SQLCOM_GRANT:
- return "GRANT";
- case SQLCOM_REVOKE:
- return "REVOKE";
- case SQLCOM_SET_OPTION:
- if (thd->lex->definer)
- return "SET PASSWORD";
- /* fallthrough */
- default:
- return thd->query();
- }
-}
-#endif //UNUSED
static int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len)
{
@@ -2662,7 +2640,7 @@ void* start_wsrep_THD(void *arg)
need to know the start of the stack so that we could check for
stack overruns.
*/
- DBUG_PRINT("wsrep", ("handle_one_connection called by thread %lld\n",
+ DBUG_PRINT("wsrep", ("handle_one_connection called by thread %lld",
(long long)thd->thread_id));
/* now that we've called my_thread_init(), it is safe to call DBUG_* */
diff --git a/sql/wsrep_storage_service.cc b/sql/wsrep_storage_service.cc
index 6dfe3eee448..2ad817fe25a 100644
--- a/sql/wsrep_storage_service.cc
+++ b/sql/wsrep_storage_service.cc
@@ -100,7 +100,8 @@ void Wsrep_storage_service::adopt_transaction(const wsrep::transaction& transact
int Wsrep_storage_service::append_fragment(const wsrep::id& server_id,
wsrep::transaction_id transaction_id,
int flags,
- const wsrep::const_buffer& data)
+ const wsrep::const_buffer& data,
+ const wsrep::xid& xid WSREP_UNUSED)
{
DBUG_ENTER("Wsrep_storage_service::append_fragment");
DBUG_ASSERT(m_thd == current_thd);
diff --git a/sql/wsrep_storage_service.h b/sql/wsrep_storage_service.h
index 6208300930f..f39543a89bc 100644
--- a/sql/wsrep_storage_service.h
+++ b/sql/wsrep_storage_service.h
@@ -33,7 +33,8 @@ public:
int append_fragment(const wsrep::id&,
wsrep::transaction_id,
int flags,
- const wsrep::const_buffer&);
+ const wsrep::const_buffer&,
+ const wsrep::xid&);
int update_fragment_meta(const wsrep::ws_meta&);
int remove_fragments();
int commit(const wsrep::ws_handle&, const wsrep::ws_meta&);
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index b44258836c8..e5b0771afb3 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -320,7 +320,12 @@ IF(CONNECT_WITH_REST)
# INCLUDE_DIRECTORIES(${CPPRESTSDK_INCLUDE_DIR})
# If needed edit next line to set the path to libcpprest.so
SET(REST_LIBRARY -lcpprest)
-# MESSAGE (STATUS ${REST_LIBRARY})
+ MESSAGE (STATUS ${REST_LIBRARY})
+ ELSE(NOT UNIX)
+# Next line sets debug compile mode matching cpprest_2_10d.dll
+# when it was binary installed (can be change later in Visual Studio)
+# Comment it out if not needed depending on your cpprestsdk installation.
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
ENDIF(UNIX)
IF(REST_LIBRARY)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp restget.cpp tabrest.h)
diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc
index f1227248240..28345b85c42 100644
--- a/storage/connect/connect.cc
+++ b/storage/connect/connect.cc
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
/***********************************************************************/
-/* Author Olivier BERTRAND bertrandop@gmail.com 2004-2017 */
+/* Author Olivier BERTRAND bertrandop@gmail.com 2004-2019 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -389,6 +389,9 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool reset, bool mrr)
try {
for (colp = tdbp->GetColumns(); rc == RC_OK && colp;
colp = colp->GetNext()) {
+ xtrc(2, "Going to read column %s of table %s\n",
+ colp->GetName(), tdbp->GetName());
+
if (reset)
colp->Reset();
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 6939e6948f9..e098faaf995 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -4496,34 +4496,13 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, const char *dbn, bool
case TAB_DIR:
case TAB_ZIP:
case TAB_OEM:
-#ifdef NO_EMBEDDED_ACCESS_CHECKS
- return false;
- #endif
-
- /*
- Check FILE_ACL
- If table or table->mdl_ticket is NULL - it's a DLL, e.g. CREATE TABLE.
- if the table has an MDL_EXCLUSIVE lock - it's a DDL too, e.g. the
- insert step of CREATE ... SELECT.
-
- Otherwise it's a DML, the table was normally opened, locked,
- privilege were already checked, and table->grant.privilege is set.
- With SQL SECURITY DEFINER, table->grant.privilege has definer's privileges.
-
- Unless we're in prelocking mode, in this case table->grant.privilege
- is only checked in start_stmt(), not in external_lock().
- */
- if (!table || !table->mdl_ticket || table->mdl_ticket->get_type() == MDL_EXCLUSIVE)
- return check_access(thd, FILE_ACL, db, NULL, NULL, 0, 0);
-
- if ((!quick && thd->lex->requires_prelocking()) || table->grant.privilege & FILE_ACL)
- return false;
-
- status_var_increment(thd->status_var.access_denied_errors);
- my_error(access_denied_error_code(thd->password), MYF(0),
- thd->security_ctx->priv_user, thd->security_ctx->priv_host,
- (thd->password ? ER(ER_YES) : ER(ER_NO)));
- return true;
+ if (table && table->pos_in_table_list) // if SELECT
+ {
+ Switch_to_definer_security_ctx backup_ctx(thd, table->pos_in_table_list);
+ return check_global_access(thd, FILE_ACL);
+ }
+ else
+ return check_global_access(thd, FILE_ACL);
case TAB_ODBC:
case TAB_JDBC:
case TAB_MONGO:
diff --git a/storage/connect/inihandl.cpp b/storage/connect/inihandl.cpp
index c39c94fb30d..ab6d5db4f0a 100644
--- a/storage/connect/inihandl.cpp
+++ b/storage/connect/inihandl.cpp
@@ -192,7 +192,7 @@ static void PROFILE_Save( FILE *file, PROFILESECTION *section )
}
for (key = section->key; key; key = key->next)
- if (key->name[0]) {
+ if (key->name && key->name[0]) {
fprintf(file, "%s", SVP(key->name));
if (key->value)
diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp
index b718f7f108f..cea4d0a5b30 100644
--- a/storage/connect/jdbconn.cpp
+++ b/storage/connect/jdbconn.cpp
@@ -1195,9 +1195,14 @@ int JDBConn::GetResultSize(PCSZ sql, PCOL colp)
if ((rc = ExecuteQuery(sql)) != RC_OK)
return -1;
- if ((rc = Fetch()) > 0)
- SetColumnValue(1, NULL, colp->GetValue());
- else
+ if ((rc = Fetch()) > 0) {
+ try {
+ SetColumnValue(1, NULL, colp->GetValue());
+ } catch (...) {
+ return -4;
+ } // end catch
+
+ } else
return -2;
if ((rc = Fetch()) != 0)
diff --git a/storage/connect/mysql-test/connect/r/grant.result b/storage/connect/mysql-test/connect/r/grant.result
index c43ad3a5b79..2e7f0e4b2bc 100644
--- a/storage/connect/mysql-test/connect/r/grant.result
+++ b/storage/connect/mysql-test/connect/r/grant.result
@@ -15,7 +15,7 @@ fname VARCHAR(256) NOT NULL,
ftype CHAR(4) NOT NULL,
size DOUBLE(12,0) NOT NULL flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.*';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -34,19 +34,19 @@ SELECT user();
user()
user@localhost
SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO t1 VALUES ();
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM t1 WHERE path='xxx';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 SET path='yyy' WHERE path='xxx';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
TRUNCATE TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 READONLY=1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CREATE VIEW v1 AS SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
# Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user();
@@ -58,13 +58,13 @@ SELECT user();
user()
user@localhost
SELECT * FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1 VALUES (1,1,1,1);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1 SET path=123;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
disconnect user;
connection default;
SELECT user();
@@ -111,7 +111,7 @@ a
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -123,23 +123,23 @@ SELECT user();
user()
user@localhost
INSERT INTO t1 VALUES (10);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 SET a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
TRUNCATE TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 READONLY=1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 FILE_NAME='t2.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DROP TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CREATE VIEW v1 AS SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
# Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user();
@@ -151,13 +151,13 @@ SELECT user();
user()
user@localhost
SELECT * FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1 VALUES (2);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1 SET a=123;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -173,7 +173,7 @@ SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
disconnect user;
@@ -216,7 +216,7 @@ a
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -228,23 +228,23 @@ SELECT user();
user()
user@localhost
INSERT INTO t1 VALUES (10);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 SET a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
TRUNCATE TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 READONLY=1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 FILE_NAME='t2.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DROP TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CREATE VIEW v1 AS SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
# Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user();
@@ -256,13 +256,13 @@ SELECT user();
user()
user@localhost
SELECT * FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1 VALUES (2);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1 SET a=123;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -278,7 +278,7 @@ SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
disconnect user;
@@ -321,7 +321,7 @@ a
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -333,23 +333,23 @@ SELECT user();
user()
user@localhost
INSERT INTO t1 VALUES (10);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 SET a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
TRUNCATE TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 READONLY=1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 FILE_NAME='t2.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DROP TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CREATE VIEW v1 AS SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
# Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user();
@@ -361,13 +361,13 @@ SELECT user();
user()
user@localhost
SELECT * FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1 VALUES (2);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1 SET a=123;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -383,7 +383,7 @@ SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
disconnect user;
@@ -426,7 +426,7 @@ a
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -438,23 +438,23 @@ SELECT user();
user()
user@localhost
INSERT INTO t1 VALUES (10);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 SET a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
TRUNCATE TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 READONLY=1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 FILE_NAME='t2.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DROP TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CREATE VIEW v1 AS SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
# Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user();
@@ -466,13 +466,13 @@ SELECT user();
user()
user@localhost
SELECT * FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1 VALUES (2);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1 SET a=123;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -488,7 +488,7 @@ SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
disconnect user;
@@ -531,7 +531,7 @@ a
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100 FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -543,23 +543,23 @@ SELECT user();
user()
user@localhost
INSERT INTO t1 VALUES (10);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 SET a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
TRUNCATE TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 READONLY=1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 FILE_NAME='t2.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DROP TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CREATE VIEW v1 AS SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
# Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user();
@@ -571,13 +571,13 @@ SELECT user();
user()
user@localhost
SELECT * FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1 VALUES (2);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1 SET a=123;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -593,7 +593,7 @@ SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
disconnect user;
diff --git a/storage/connect/mysql-test/connect/r/grant2.result b/storage/connect/mysql-test/connect/r/grant2.result
index 73e41f49256..2e20dc39596 100644
--- a/storage/connect/mysql-test/connect/r/grant2.result
+++ b/storage/connect/mysql-test/connect/r/grant2.result
@@ -21,12 +21,12 @@ SELECT * FROM v1_definer;
a
10
SELECT * FROM v1_baddefiner;
-ERROR 28000: Access denied for user 'root'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connect user,localhost,user,,;
SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
SELECT * FROM v1_invoker;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
SELECT * FROM v1_definer;
a
10
@@ -44,9 +44,9 @@ UPDATE v1_invoker SET a=12;
UPDATE v1_definer SET a=13;
connection user;
UPDATE t1 SET a=21;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_invoker SET a=22;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_definer SET a=23;
connection default;
DROP VIEW v1_invoker, v1_definer;
@@ -62,9 +62,9 @@ INSERT INTO v1_invoker VALUES (12);
INSERT INTO v1_definer VALUES (13);
connection user;
INSERT INTO t1 VALUES (21);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1_invoker VALUES (22);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1_definer VALUES (23);
connection default;
DROP VIEW v1_invoker, v1_definer;
@@ -83,9 +83,9 @@ REPLACE INTO v1_definer VALUES (13);
ERROR 42000: CONNECT Unsupported command
connection user;
REPLACE INTO t1 VALUES (21);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
REPLACE INTO v1_invoker VALUES (22);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
REPLACE INTO v1_definer VALUES (23);
ERROR 42000: CONNECT Unsupported command
connection default;
@@ -102,9 +102,9 @@ DELETE FROM v1_invoker WHERE a=12;
DELETE FROM v1_definer WHERE a=13;
connection user;
DELETE FROM t1 WHERE a=21;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM v1_invoker WHERE a=22;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM v1_definer WHERE a=23;
connection default;
DROP VIEW v1_invoker, v1_definer;
@@ -120,9 +120,9 @@ LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker;
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer;
connection user;
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer;
connection default;
DROP VIEW v1_invoker, v1_definer;
@@ -135,7 +135,7 @@ TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (11);
connection user;
TRUNCATE TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
# Testing SQLCOM_DROP_TABLE
@@ -144,7 +144,7 @@ CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
connection user;
DROP TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
# Testing SQLCOM_DROP_VIEW
@@ -165,7 +165,7 @@ DROP TABLE t1;
# Testing SQLCOM_CREATE_TABLE
connection user;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
# Testing SQLCOM_LOCK_TABLES
connection default;
@@ -187,13 +187,13 @@ LOCK TABLE v1_definer WRITE;
UNLOCK TABLES;
connection user;
LOCK TABLE t1 READ;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
LOCK TABLE t1 WRITE;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
LOCK TABLE v1_invoker READ;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
LOCK TABLE v1_invoker WRITE;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
LOCK TABLE v1_definer READ;
UNLOCK TABLES;
LOCK TABLE v1_definer WRITE;
@@ -264,93 +264,93 @@ UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
connection user;
UPDATE t1 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t2 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t2 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t2 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t2 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t2 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t2 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t2 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t3 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t3 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t3 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE t3 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t3 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE t3 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t3 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v1_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v1_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v1_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v2_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v2_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v2_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v2_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v2_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v2_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v2_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v2_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v2_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
connection default;
DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer;
@@ -418,93 +418,93 @@ DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a;
connection user;
DELETE a1 FROM t1 a1,t1 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t1 a1,t2 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t1 a1,t3 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t1 a1,v1_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t1 a1,v1_definer a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t1 a1,v2_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t1 a1,v2_definer a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t2 a1,t1 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t2 a1,t2 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t2 a1,t3 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t2 a1,v1_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t2 a1,v1_definer a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t2 a1,v2_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t2 a1,v2_definer a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t3 a1,t1 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t3 a1,t2 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t3 a1,t3 a2 WHERE a1.a=a2.a;
DELETE a1 FROM t3 a1,v1_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t3 a1,v1_definer a2 WHERE a1.a=a2.a;
DELETE a1 FROM t3 a1,v2_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM t3 a1,v2_definer a2 WHERE a1.a=a2.a;
DELETE a1 FROM v1_invoker a1,t1 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v1_invoker a1,t2 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v1_invoker a1,t3 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v1_invoker a1,v1_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v1_invoker a1,v1_definer a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v1_invoker a1,v2_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v1_invoker a1,v2_definer a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v1_definer a1,t1 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v1_definer a1,t2 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v1_definer a1,t3 a2 WHERE a1.a=a2.a;
DELETE a1 FROM v1_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v1_definer a1,v1_definer a2 WHERE a1.a=a2.a;
DELETE a1 FROM v1_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v1_definer a1,v2_definer a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_invoker a1,t1 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v2_invoker a1,t2 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v2_invoker a1,t3 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v2_invoker a1,v1_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v2_invoker a1,v1_definer a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v2_invoker a1,v2_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v2_invoker a1,v2_definer a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v2_definer a1,t1 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v2_definer a1,t2 a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v2_definer a1,t3 a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a;
connection default;
DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer;
@@ -521,9 +521,9 @@ CREATE VIEW v2 AS SELECT * FROM v1_definer;
DROP VIEW v2;
connection user;
CREATE VIEW v2 AS SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CREATE VIEW v2 AS SELECT * FROM v1_invoker;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CREATE VIEW v2 AS SELECT * FROM v1_definer;
DROP VIEW v2;
connection default;
@@ -546,21 +546,21 @@ INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
connection user;
INSERT INTO t1 SELECT * FROM t1 WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO t1 SELECT * FROM v1_invoker WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO t1 SELECT * FROM v1_definer WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1_invoker SELECT * FROM t1 WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
connection default;
DROP VIEW v1_invoker, v1_definer;
@@ -591,17 +591,17 @@ REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
ERROR 42000: CONNECT Unsupported command
connection user;
REPLACE INTO t1 SELECT * FROM t1 WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
REPLACE INTO t1 SELECT * FROM v1_invoker WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
REPLACE INTO t1 SELECT * FROM v1_definer WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
REPLACE INTO v1_invoker SELECT * FROM t1 WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
REPLACE INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
REPLACE INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
REPLACE INTO v1_definer SELECT * FROM t1 WHERE a=20;
ERROR 42000: CONNECT Unsupported command
REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
@@ -624,7 +624,7 @@ t2 CREATE TABLE `t2` (
RENAME TABLE t2 TO t1;
connection user;
RENAME TABLE t1 TO t2;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (for ALTER..RENAME)
@@ -640,7 +640,7 @@ t2 CREATE TABLE `t2` (
ALTER TABLE t2 RENAME TO t1;
connection user;
ALTER TABLE t1 RENAME TO t2;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (changing ENGINE to non-CONNECT)
@@ -653,7 +653,7 @@ CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
connection user;
ALTER TABLE t1 ENGINE=MyISAM;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (changing ENGINE to CONNECT)
@@ -669,7 +669,7 @@ CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (10);
connection user;
ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
# Testing SQLCOM_OPTIMIZE
@@ -682,7 +682,7 @@ test.t1 optimize status OK
connection user;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
-test.t1 optimize Error Access denied for user 'user'@'localhost' (using password: NO)
+test.t1 optimize Error Access denied; you need (at least one of) the FILE privilege(s) for this operation
test.t1 optimize Error Got error 122 'This operation requires the FILE privilege' from CONNECT
test.t1 optimize error Corrupt
connection default;
@@ -696,7 +696,7 @@ Warnings:
Warning 1105 This is an outward table, table data were not modified.
connection user;
ALTER TABLE t1 ADD c INT;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (removing columns)
@@ -708,7 +708,7 @@ Warnings:
Warning 1105 This is an outward table, table data were not modified.
connection user;
ALTER TABLE t1 DROP c;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (adding keys)
@@ -718,7 +718,7 @@ INSERT INTO t1 VALUES (10,10);
ALTER TABLE t1 ADD KEY(a);
connection user;
ALTER TABLE t1 ADD KEY(b);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (removing keys)
@@ -728,7 +728,7 @@ INSERT INTO t1 VALUES (10,10);
ALTER TABLE t1 DROP KEY a;
connection user;
ALTER TABLE t1 DROP KEY b;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
# Testing SQLCOM_CREATE_INDEX and SQLCOM_DROP_INDEX
@@ -740,9 +740,9 @@ DROP INDEX a ON t1;
CREATE INDEX a ON t1 (a);
connection user;
CREATE INDEX b ON t1 (b);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DROP INDEX a ON t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
# Testing stored procedures
@@ -757,10 +757,10 @@ DROP TABLE t1;
CALL p_invoker();
DROP TABLE t1;
CALL p_baddefiner();
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection user;
CALL p_invoker();
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CALL p_definer();
connection default;
DROP TABLE t1;
diff --git a/storage/connect/mysql-test/connect/r/ini_grant.result b/storage/connect/mysql-test/connect/r/ini_grant.result
index 8cbf88123fb..96d5e192c7d 100644
--- a/storage/connect/mysql-test/connect/r/ini_grant.result
+++ b/storage/connect/mysql-test/connect/r/ini_grant.result
@@ -34,7 +34,7 @@ sec val
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -46,21 +46,21 @@ SELECT user();
user()
user@localhost
INSERT INTO t1 VALUES ('sec2','val2');
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 SET val='val11';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
TRUNCATE TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 READONLY=1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DROP TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CREATE VIEW v1 AS SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
# Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user();
@@ -72,13 +72,13 @@ SELECT user();
user()
user@localhost
SELECT * FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1 VALUES ('sec3','val3');
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1 SET val='val11';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
disconnect user;
connection default;
DROP VIEW v1;
diff --git a/storage/connect/mysql-test/connect/r/mysql_grant.result b/storage/connect/mysql-test/connect/r/mysql_grant.result
index 11a3dbba36c..83a906afed5 100644
--- a/storage/connect/mysql-test/connect/r/mysql_grant.result
+++ b/storage/connect/mysql-test/connect/r/mysql_grant.result
@@ -11,7 +11,7 @@ SELECT user();
user()
user@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=PORT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -29,19 +29,19 @@ SELECT user();
user()
user@localhost
SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO t1 VALUES ('xxx');
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM t1 WHERE a='xxx';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 SET a='yyy' WHERE a='xxx';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
TRUNCATE TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 READONLY=1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CREATE VIEW v1 AS SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
# Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user();
@@ -53,13 +53,13 @@ SELECT user();
user()
user@localhost
SELECT * FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1 VALUES (2);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1 SET a=123;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
disconnect user;
connection default;
SELECT user();
diff --git a/storage/connect/mysql-test/connect/r/xml2_grant.result b/storage/connect/mysql-test/connect/r/xml2_grant.result
index 817d3f5bf57..a6e6c150b59 100644
--- a/storage/connect/mysql-test/connect/r/xml2_grant.result
+++ b/storage/connect/mysql-test/connect/r/xml2_grant.result
@@ -35,7 +35,7 @@ a
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row' FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -47,23 +47,23 @@ SELECT user();
user()
user@localhost
INSERT INTO t1 VALUES (10);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 SET a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
TRUNCATE TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 READONLY=1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 FILE_NAME='t2.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DROP TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CREATE VIEW v1 AS SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
# Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user();
@@ -75,13 +75,13 @@ SELECT user();
user()
user@localhost
SELECT * FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1 VALUES (2);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1 SET a=123;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -97,7 +97,7 @@ SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
disconnect user;
diff --git a/storage/connect/mysql-test/connect/r/xml_grant.result b/storage/connect/mysql-test/connect/r/xml_grant.result
index 950ae4a3b35..f1a6ad101cb 100644
--- a/storage/connect/mysql-test/connect/r/xml_grant.result
+++ b/storage/connect/mysql-test/connect/r/xml_grant.result
@@ -33,7 +33,7 @@ a
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row' FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -45,23 +45,23 @@ SELECT user();
user()
user@localhost
INSERT INTO t1 VALUES (10);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE t1 SET a=20;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
TRUNCATE TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 READONLY=1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
ALTER TABLE t1 FILE_NAME='t2.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DROP TABLE t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
CREATE VIEW v1 AS SELECT * FROM t1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
# Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user();
@@ -73,13 +73,13 @@ SELECT user();
user()
user@localhost
SELECT * FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
INSERT INTO v1 VALUES (2);
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
UPDATE v1 SET a=123;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
DELETE FROM v1;
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
SELECT user();
user()
@@ -95,7 +95,7 @@ SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
-ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
connection default;
DROP TABLE t1;
disconnect user;
diff --git a/storage/connect/mysql-test/connect/t/grant.inc b/storage/connect/mysql-test/connect/t/grant.inc
index 6580c845b56..ef6e0cec297 100644
--- a/storage/connect/mysql-test/connect/t/grant.inc
+++ b/storage/connect/mysql-test/connect/t/grant.inc
@@ -25,7 +25,7 @@ DROP TABLE t1;
# Making sure DROP erased the data file
--error 1
--remove_file $MYSQLD_DATADIR/test/t1.$FILE_EXT
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
--eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT $TABLE_OPTIONS FILE_NAME='t1.EXT'
--connection default
SELECT user();
@@ -33,23 +33,23 @@ SELECT user();
INSERT INTO t1 VALUES (10);
--connection user
SELECT user();
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO t1 VALUES (10);
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
SELECT * FROM t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t1 SET a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE FROM t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
TRUNCATE TABLE t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 READONLY=1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 FILE_NAME='t2.EXT';
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DROP TABLE t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE VIEW v1 AS SELECT * FROM t1;
--echo # Testing a VIEW created with FILE privileges but accessed with no FILE
--connection default
@@ -57,13 +57,13 @@ SELECT user();
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
--connection user
SELECT user();
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
SELECT * FROM v1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO v1 VALUES (2);
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1 SET a=123;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE FROM v1;
--connection default
SELECT user();
@@ -74,7 +74,7 @@ DROP TABLE t1;
INSERT INTO t1 VALUES (10);
--connection user
SELECT user();
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 FILE_NAME='t1.EXT';
--connection default
DROP TABLE t1;
diff --git a/storage/connect/mysql-test/connect/t/grant.test b/storage/connect/mysql-test/connect/t/grant.test
index c4a91904e73..afe550267c4 100644
--- a/storage/connect/mysql-test/connect/t/grant.test
+++ b/storage/connect/mysql-test/connect/t/grant.test
@@ -11,7 +11,7 @@ REVOKE FILE ON *.* FROM user@localhost;
--connect(user,localhost,user,,)
--connection user
SELECT user();
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE TABLE t1 (
path VARCHAR(256) NOT NULL flag=1,
fname VARCHAR(256) NOT NULL,
@@ -32,19 +32,19 @@ SELECT fname, ftype, size FROM t1 WHERE size>0 AND ftype!='.opt';
--connection user
SELECT user();
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
SELECT * FROM t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO t1 VALUES ();
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE FROM t1 WHERE path='xxx';
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t1 SET path='yyy' WHERE path='xxx';
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
TRUNCATE TABLE t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 READONLY=1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE VIEW v1 AS SELECT * FROM t1;
--echo # Testing a VIEW created with FILE privileges but accessed with no FILE
@@ -53,13 +53,13 @@ SELECT user();
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
--connection user
SELECT user();
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
SELECT * FROM v1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO v1 VALUES (1,1,1,1);
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1 SET path=123;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE FROM v1;
--disconnect user
diff --git a/storage/connect/mysql-test/connect/t/grant2.test b/storage/connect/mysql-test/connect/t/grant2.test
index 8e7d9453e70..351eb97f11a 100644
--- a/storage/connect/mysql-test/connect/t/grant2.test
+++ b/storage/connect/mysql-test/connect/t/grant2.test
@@ -23,13 +23,13 @@ CREATE DEFINER=user@localhost SQL SECURITY DEFINER VIEW v1_baddefiner AS SELECT
SELECT * FROM t1;
SELECT * FROM v1_invoker;
SELECT * FROM v1_definer;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
SELECT * FROM v1_baddefiner;
--connect(user,localhost,user,,)
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
SELECT * FROM t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
SELECT * FROM v1_invoker;
SELECT * FROM v1_definer;
--connection default
@@ -47,9 +47,9 @@ UPDATE t1 SET a=11;
UPDATE v1_invoker SET a=12;
UPDATE v1_definer SET a=13;
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t1 SET a=21;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1_invoker SET a=22;
UPDATE v1_definer SET a=23;
--connection default
@@ -67,9 +67,9 @@ INSERT INTO t1 VALUES (11);
INSERT INTO v1_invoker VALUES (12);
INSERT INTO v1_definer VALUES (13);
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO t1 VALUES (21);
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO v1_invoker VALUES (22);
INSERT INTO v1_definer VALUES (23);
--connection default
@@ -79,7 +79,7 @@ DROP TABLE t1;
--echo # Testing SQLCOM_REPLACE
# REPLACE is not supported by ConnectSE, so we're testing the difference
-# between ER_ACCESS_DENIED_ERROR vs ER_NOT_ALLOWED_COMMAND
+# between ER_SPECIFIC_ACCESS_DENIED_ERROR vs ER_NOT_ALLOWED_COMMAND
--connection default
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
@@ -92,9 +92,9 @@ REPLACE INTO v1_invoker VALUES (12);
--error ER_NOT_ALLOWED_COMMAND
REPLACE INTO v1_definer VALUES (13);
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
REPLACE INTO t1 VALUES (21);
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
REPLACE INTO v1_invoker VALUES (22);
--error ER_NOT_ALLOWED_COMMAND
REPLACE INTO v1_definer VALUES (23);
@@ -113,9 +113,9 @@ DELETE FROM t1 WHERE a=11;
DELETE FROM v1_invoker WHERE a=12;
DELETE FROM v1_definer WHERE a=13;
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE FROM t1 WHERE a=21;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE FROM v1_invoker WHERE a=22;
DELETE FROM v1_definer WHERE a=23;
--connection default
@@ -137,10 +137,10 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
--eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer
--connection user
--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
--eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1
--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
--eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker
--replace_result $MTR_SUITE_DIR MTR_SUITE_DIR
--eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer
@@ -156,7 +156,7 @@ INSERT INTO t1 VALUES (10);
TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (11);
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
TRUNCATE TABLE t1;
--connection default
DROP TABLE t1;
@@ -168,7 +168,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DROP TABLE t1;
--connection default
DROP TABLE t1;
@@ -193,7 +193,7 @@ DROP TABLE t1;
--echo # Testing SQLCOM_CREATE_TABLE
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
--connection default
@@ -216,13 +216,13 @@ UNLOCK TABLES;
LOCK TABLE v1_definer WRITE;
UNLOCK TABLES;
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
LOCK TABLE t1 READ;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
LOCK TABLE t1 WRITE;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
LOCK TABLE v1_invoker READ;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
LOCK TABLE v1_invoker WRITE;
LOCK TABLE v1_definer READ;
UNLOCK TABLES;
@@ -299,108 +299,108 @@ UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
--connection user
# All queries with t1 should fail
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t1 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t1 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t1 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t1 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t1 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t1 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t1 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
# All queries with t2 should fail
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t2 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t2 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t2 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t2 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t2 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t2 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t2 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
# t3 does not need FILE_ALC
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t3 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t3 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
# This is OK:
UPDATE t3 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t3 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
# This is OK:
UPDATE t3 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t3 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
# This is OK:
UPDATE t3 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
# All queries with v1_invoker should fail
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
# v1_definer does not need FILE_ACL from the invoker
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v1_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v1_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v1_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
# All queries with v2_invoker should fail
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v2_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v2_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v2_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v2_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v2_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v2_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v2_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
# v2_definer does not need FILE_ACL from the invoker
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v2_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v2_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v2_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
@@ -476,108 +476,108 @@ DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a;
--connection user
# All queries with t1 should fail
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t1 a1,t1 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t1 a1,t2 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t1 a1,t3 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t1 a1,v1_invoker a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t1 a1,v1_definer a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t1 a1,v2_invoker a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t1 a1,v2_definer a2 WHERE a1.a=a2.a;
# All queries with t2 should fail
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t2 a1,t1 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t2 a1,t2 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t2 a1,t3 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t2 a1,v1_invoker a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t2 a1,v1_definer a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t2 a1,v2_invoker a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t2 a1,v2_definer a2 WHERE a1.a=a2.a;
# t3 does not need FILE_ALC
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t3 a1,t1 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t3 a1,t2 a2 WHERE a1.a=a2.a;
# This is OK:
DELETE a1 FROM t3 a1,t3 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t3 a1,v1_invoker a2 WHERE a1.a=a2.a;
# This is OK:
DELETE a1 FROM t3 a1,v1_definer a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM t3 a1,v2_invoker a2 WHERE a1.a=a2.a;
# This is OK:
DELETE a1 FROM t3 a1,v2_definer a2 WHERE a1.a=a2.a;
# All queries with v1_invoker should fail
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v1_invoker a1,t1 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v1_invoker a1,t2 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v1_invoker a1,t3 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v1_invoker a1,v1_invoker a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v1_invoker a1,v1_definer a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v1_invoker a1,v2_invoker a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v1_invoker a1,v2_definer a2 WHERE a1.a=a2.a;
# v1_definer does not need FILE_ACL from the invoker
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v1_definer a1,t1 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v1_definer a1,t2 a2 WHERE a1.a=a2.a;
DELETE a1 FROM v1_definer a1,t3 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v1_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
DELETE a1 FROM v1_definer a1,v1_definer a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v1_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
DELETE a1 FROM v1_definer a1,v2_definer a2 WHERE a1.a=a2.a;
# All queries with v2_invoker should fail
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v2_invoker a1,t1 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v2_invoker a1,t2 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v2_invoker a1,t3 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v2_invoker a1,v1_invoker a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v2_invoker a1,v1_definer a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v2_invoker a1,v2_invoker a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v2_invoker a1,v2_definer a2 WHERE a1.a=a2.a;
# v2_definer does not need FILE_ACL from the invoker
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v2_definer a1,t1 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v2_definer a1,t2 a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,t3 a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v2_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a;
@@ -598,9 +598,9 @@ DROP VIEW v2;
CREATE VIEW v2 AS SELECT * FROM v1_definer;
DROP VIEW v2;
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE VIEW v2 AS SELECT * FROM t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE VIEW v2 AS SELECT * FROM v1_invoker;
CREATE VIEW v2 AS SELECT * FROM v1_definer;
DROP VIEW v2;
@@ -625,21 +625,21 @@ INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20;
INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO t1 SELECT * FROM t1 WHERE a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO t1 SELECT * FROM v1_invoker WHERE a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO t1 SELECT * FROM v1_definer WHERE a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO v1_invoker SELECT * FROM t1 WHERE a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
# This is OK:
INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
@@ -650,7 +650,7 @@ DROP TABLE t1;
--echo # Testing SQLCOM_REPLACE_SELECT
# REPLACE is not supported by CONNECT
-# so we're testing ER_NOT_ALLOWED_COMMAND vs ER_ACCESS_DENIED_ERROR here
+# so we're testing ER_NOT_ALLOWED_COMMAND vs ER_SPECIFIC_ACCESS_DENIED_ERROR here
--connection default
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
@@ -676,17 +676,17 @@ REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
REPLACE INTO t1 SELECT * FROM t1 WHERE a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
REPLACE INTO t1 SELECT * FROM v1_invoker WHERE a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
REPLACE INTO t1 SELECT * FROM v1_definer WHERE a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
REPLACE INTO v1_invoker SELECT * FROM t1 WHERE a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
REPLACE INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
REPLACE INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
--error ER_NOT_ALLOWED_COMMAND
REPLACE INTO v1_definer SELECT * FROM t1 WHERE a=20;
@@ -708,7 +708,7 @@ SHOW CREATE TABLE t2;
RENAME TABLE t2 TO t1;
--connection user
# TODO: Perhaps FILE_ACL is needed for RENAME. Discuss with Oliver.
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
RENAME TABLE t1 TO t2;
--connection default
DROP TABLE t1;
@@ -723,7 +723,7 @@ SHOW CREATE TABLE t2;
ALTER TABLE t2 RENAME TO t1;
--connection user
# TODO: Perhaps FILE_ACL is not needed for ALTER..RENAME. Discuss with Olivier.
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 RENAME TO t2;
--connection default
DROP TABLE t1;
@@ -739,7 +739,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 ENGINE=MyISAM;
--connection default
DROP TABLE t1;
@@ -756,7 +756,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (10);
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
--connection default
DROP TABLE t1;
@@ -779,7 +779,7 @@ CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
ALTER TABLE t1 ADD b INT;
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 ADD c INT;
--connection default
DROP TABLE t1;
@@ -791,7 +791,7 @@ CREATE TABLE t1 (a INT,b INT,c INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.
INSERT INTO t1 VALUES (10,10,10);
ALTER TABLE t1 DROP b;
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 DROP c;
--connection default
DROP TABLE t1;
@@ -803,7 +803,7 @@ CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FI
INSERT INTO t1 VALUES (10,10);
ALTER TABLE t1 ADD KEY(a);
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 ADD KEY(b);
--connection default
DROP TABLE t1;
@@ -816,7 +816,7 @@ CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL, KEY a(a), KEY b(b)) ENGINE=CONNE
INSERT INTO t1 VALUES (10,10);
ALTER TABLE t1 DROP KEY a;
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 DROP KEY b;
--connection default
DROP TABLE t1;
@@ -831,9 +831,9 @@ CREATE INDEX a ON t1 (a);
DROP INDEX a ON t1;
CREATE INDEX a ON t1 (a);
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE INDEX b ON t1 (b);
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DROP INDEX a ON t1;
--connection default
DROP TABLE t1;
@@ -852,11 +852,11 @@ CALL p_definer();
DROP TABLE t1;
CALL p_invoker();
DROP TABLE t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CALL p_baddefiner();
--connection user
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CALL p_invoker();
CALL p_definer();
diff --git a/storage/connect/mysql-test/connect/t/ini_grant.test b/storage/connect/mysql-test/connect/t/ini_grant.test
index b0ddcb57979..bbf85e5f794 100644
--- a/storage/connect/mysql-test/connect/t/ini_grant.test
+++ b/storage/connect/mysql-test/connect/t/ini_grant.test
@@ -29,7 +29,7 @@ DROP TABLE t1;
# Making sure DROP erased the data file
--error 1
--remove_file $MYSQLD_DATADIR/test/t1.ini
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT';
--connection default
SELECT user();
@@ -37,21 +37,21 @@ CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CON
INSERT INTO t1 VALUES ('sec1','val1');
--connection user
SELECT user();
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO t1 VALUES ('sec2','val2');
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
SELECT * FROM t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t1 SET val='val11';
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE FROM t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
TRUNCATE TABLE t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 READONLY=1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DROP TABLE t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE VIEW v1 AS SELECT * FROM t1;
--echo # Testing a VIEW created with FILE privileges but accessed with no FILE
--connection default
@@ -59,13 +59,13 @@ SELECT user();
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
--connection user
SELECT user();
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
SELECT * FROM v1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO v1 VALUES ('sec3','val3');
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1 SET val='val11';
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE FROM v1;
--disconnect user
--connection default
diff --git a/storage/connect/mysql-test/connect/t/mysql_grant.test b/storage/connect/mysql-test/connect/t/mysql_grant.test
index 7d3d05cb8fd..30737258a1f 100644
--- a/storage/connect/mysql-test/connect/t/mysql_grant.test
+++ b/storage/connect/mysql-test/connect/t/mysql_grant.test
@@ -27,7 +27,7 @@ set sql_mode=default;
--connection user
SELECT user();
--replace_result $PORT PORT
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
--eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=$PORT'
--connection default
SELECT user();
@@ -38,19 +38,19 @@ INSERT INTO t1remote VALUES (10),(20),(30);
SELECT * FROM t1;
--connection user
SELECT user();
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
SELECT * FROM t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO t1 VALUES ('xxx');
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE FROM t1 WHERE a='xxx';
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE t1 SET a='yyy' WHERE a='xxx';
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
TRUNCATE TABLE t1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
ALTER TABLE t1 READONLY=1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE VIEW v1 AS SELECT * FROM t1;
--echo # Testing a VIEW created with FILE privileges but accessed with no FILE
@@ -59,13 +59,13 @@ SELECT user();
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
--connection user
SELECT user();
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
SELECT * FROM v1;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
INSERT INTO v1 VALUES (2);
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
UPDATE v1 SET a=123;
---error ER_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
DELETE FROM v1;
--disconnect user
diff --git a/storage/connect/rest.h b/storage/connect/rest.h
deleted file mode 100644
index f1d77e0a279..00000000000
--- a/storage/connect/rest.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/***********************************************************************/
-/* Definitions needed by the included files. */
-/***********************************************************************/
-#if !defined(MY_GLOBAL_H)
-#define MY_GLOBAL_H
-typedef unsigned int uint;
-typedef unsigned int uint32;
-typedef unsigned short ushort;
-typedef unsigned long ulong;
-typedef unsigned long DWORD;
-typedef char *LPSTR;
-typedef const char *LPCSTR;
-typedef int BOOL;
-#if defined(_WINDOWS)
-typedef void *HANDLE;
-#else
-typedef int HANDLE;
-#endif
-typedef char *PSZ;
-typedef const char *PCSZ;
-typedef unsigned char BYTE;
-typedef unsigned char uchar;
-typedef long long longlong;
-typedef unsigned long long ulonglong;
-typedef char my_bool;
-struct charset_info_st {};
-typedef const charset_info_st CHARSET_INFO;
-#define FALSE 0
-#define TRUE 1
-#define Item char
-#define MY_MAX(a,b) ((a>b)?(a):(b))
-#define MY_MIN(a,b) ((a<b)?(a):(b))
-#endif // MY_GLOBAL_H \ No newline at end of file
diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp
index b713e290684..77d82556d8c 100644
--- a/storage/connect/tabodbc.cpp
+++ b/storage/connect/tabodbc.cpp
@@ -603,8 +603,10 @@ bool TDBODBC::OpenDB(PGLOBAL g)
Cnp->InitValue(g);
if ((n = Ocp->GetResultSize(Query->GetStr(), Cnp)) < 0) {
- strcpy(g->Message, "Cannot get result size");
- return true;
+ char* msg = PlugDup(g, g->Message);
+
+ sprintf(g->Message, "Get result size: %s (rc=%d)", msg, n);
+ return true;
} else if (n) {
Ocp->m_Rows = n;
diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp
index 355691fbd4d..2ae9382609d 100644
--- a/storage/connect/valblk.cpp
+++ b/storage/connect/valblk.cpp
@@ -206,6 +206,7 @@ void VALBLK::ChkIndx(int n)
{
if (n < 0 || n >= Nval) {
PGLOBAL& g = Global;
+ xtrc(1, "ChkIndx: n=%d Nval=%d\n", n, Nval);
strcpy(g->Message, MSG(BAD_VALBLK_INDX));
throw Type;
} // endif n
@@ -216,7 +217,8 @@ void VALBLK::ChkTyp(PVAL v)
{
if (Check && (Type != v->GetType() || Unsigned != v->IsUnsigned())) {
PGLOBAL& g = Global;
- strcpy(g->Message, MSG(VALTYPE_NOMATCH));
+ xtrc(1, "ChkTyp: Type=%d valType=%d\n", Type, v->GetType());
+ strcpy(g->Message, MSG(VALTYPE_NOMATCH));
throw Type;
} // endif Type
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index 5da54543750..2fad67f453b 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -123,7 +123,7 @@ ulonglong CharToNumber(const char *p, int n, ulonglong maxval,
case '+':
p++;
break;
- } // endswitch *p
+ } // endswitch *p
for (val = 0; p < p2 && (c = (uchar)(*p - '0')) < 10; p++)
if (val > (maxval - c) / 10) {
@@ -140,7 +140,7 @@ ulonglong CharToNumber(const char *p, int n, ulonglong maxval,
/* GetTypeName: returns the PlugDB internal type name. */
/***********************************************************************/
PCSZ GetTypeName(int type)
- {
+{
PCSZ name;
switch (type) {
@@ -155,17 +155,17 @@ PCSZ GetTypeName(int type)
case TYPE_BIN: name = "BINARY"; break;
case TYPE_PCHAR: name = "PCHAR"; break;
default: name = "UNKNOWN"; break;
- } // endswitch type
+ } // endswitch type
return name;
- } // end of GetTypeName
+} // end of GetTypeName
/***********************************************************************/
/* GetTypeSize: returns the PlugDB internal type size. */
/***********************************************************************/
int GetTypeSize(int type, int len)
{
- switch (type) {
+ switch (type) {
case TYPE_DECIM:
case TYPE_BIN:
case TYPE_STRING: len = len * sizeof(char); break;
@@ -177,16 +177,16 @@ int GetTypeSize(int type, int len)
case TYPE_TINY: len = sizeof(char); break;
case TYPE_PCHAR: len = sizeof(char*); break;
default: len = -1;
- } // endswitch type
+ } // endswitch type
return len;
- } // end of GetTypeSize
+} // end of GetTypeSize
/***********************************************************************/
/* GetFormatType: returns the FORMAT character(s) according to type. */
/***********************************************************************/
const char *GetFormatType(int type)
- {
+{
const char *c = "X";
switch (type) {
@@ -200,16 +200,16 @@ const char *GetFormatType(int type)
case TYPE_DECIM: c = "M"; break;
case TYPE_BIN: c = "B"; break;
case TYPE_PCHAR: c = "P"; break;
- } // endswitch type
+ } // endswitch type
return c;
- } // end of GetFormatType
+} // end of GetFormatType
/***********************************************************************/
/* GetFormatType: returns the FORMAT type according to character. */
/***********************************************************************/
int GetFormatType(char c)
- {
+{
int type = TYPE_ERROR;
switch (c) {
@@ -223,31 +223,31 @@ int GetFormatType(char c)
case 'M': type = TYPE_DECIM; break;
case 'B': type = TYPE_BIN; break;
case 'P': type = TYPE_PCHAR; break;
- } // endswitch type
+ } // endswitch type
return type;
- } // end of GetFormatType
+} // end of GetFormatType
/***********************************************************************/
/* IsTypeChar: returns true for character type(s). */
/***********************************************************************/
bool IsTypeChar(int type)
- {
+{
switch (type) {
case TYPE_STRING:
case TYPE_DECIM:
case TYPE_BIN:
return true;
- } // endswitch type
+ } // endswitch type
return false;
- } // end of IsTypeChar
+} // end of IsTypeChar
/***********************************************************************/
/* IsTypeNum: returns true for numeric types. */
/***********************************************************************/
bool IsTypeNum(int type)
- {
+{
switch (type) {
case TYPE_INT:
case TYPE_BIGINT:
@@ -258,16 +258,16 @@ bool IsTypeNum(int type)
case TYPE_TINY:
case TYPE_DECIM:
return true;
- } // endswitch type
+ } // endswitch type
return false;
- } // end of IsTypeNum
+} // end of IsTypeNum
/***********************************************************************/
/* GetFmt: returns the format to use with a typed value. */
/***********************************************************************/
const char *GetFmt(int type, bool un)
- {
+{
const char *fmt;
switch (type) {
@@ -278,10 +278,10 @@ const char *GetFmt(int type, bool un)
case TYPE_DOUBLE: fmt = "%.*lf"; break;
case TYPE_BIN: fmt = "%*x"; break;
default: fmt = (un) ? "%u" : "%d"; break;
- } // endswitch Type
+ } // endswitch Type
return fmt;
- } // end of GetFmt
+} // end of GetFmt
/***********************************************************************/
/* ConvertType: what this function does is to determine the type to */
@@ -293,7 +293,7 @@ const char *GetFmt(int type, bool un)
/* IsType... functions so match does not prevent correct setting. */
/***********************************************************************/
int ConvertType(int target, int type, CONV kind, bool match)
- {
+{
switch (kind) {
case CNV_CHAR:
if (match && (!IsTypeChar(target) || !IsTypeChar(type)))
@@ -326,15 +326,15 @@ int ConvertType(int target, int type, CONV kind, bool match)
: (target == TYPE_STRING || type == TYPE_STRING) ? TYPE_STRING
: (target == TYPE_TINY || type == TYPE_TINY) ? TYPE_TINY
: TYPE_ERROR;
- } // endswitch kind
+ } // endswitch kind
- } // end of ConvertType
+} // end of ConvertType
/***********************************************************************/
/* AllocateConstant: allocates a constant Value. */
/***********************************************************************/
PVAL AllocateValue(PGLOBAL g, void *value, short type, short prec)
- {
+{
PVAL valp;
if (trace(1))
@@ -362,18 +362,18 @@ PVAL AllocateValue(PGLOBAL g, void *value, short type, short prec)
default:
sprintf(g->Message, MSG(BAD_VALUE_TYPE), type);
return NULL;
- } // endswitch Type
+ } // endswitch Type
valp->SetGlobal(g);
return valp;
- } // end of AllocateValue
+} // end of AllocateValue
/***********************************************************************/
/* Allocate a variable Value according to type, length and precision. */
/***********************************************************************/
PVAL AllocateValue(PGLOBAL g, int type, int len, int prec,
bool uns, PCSZ fmt)
- {
+{
PVAL valp;
switch (type) {
@@ -423,18 +423,18 @@ PVAL AllocateValue(PGLOBAL g, int type, int len, int prec,
default:
sprintf(g->Message, MSG(BAD_VALUE_TYPE), type);
return NULL;
- } // endswitch type
+ } // endswitch type
valp->SetGlobal(g);
return valp;
- } // end of AllocateValue
+} // end of AllocateValue
/***********************************************************************/
/* Allocate a constant Value converted to newtype. */
/* Can also be used to copy a Value eventually converted. */
/***********************************************************************/
PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
- {
+{
PSZ p, sp;
bool un = (uns < 0) ? false : (uns > 0) ? true : valp->IsUnsigned();
PVAL vp;
@@ -495,13 +495,13 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
default:
sprintf(g->Message, MSG(BAD_VALUE_TYPE), newtype);
return NULL;
- } // endswitch type
+ } // endswitch type
vp->SetNullable(valp->GetNullable());
vp->SetNull(valp->IsNull());
vp->SetGlobal(g);
return vp;
- } // end of AllocateValue
+} // end of AllocateValue
/* -------------------------- Class VALUE ---------------------------- */
@@ -509,7 +509,7 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
/* Class VALUE protected constructor. */
/***********************************************************************/
VALUE::VALUE(int type, bool un) : Type(type)
- {
+{
Null = false;
Nullable = false;
Unsigned = un;
@@ -517,13 +517,13 @@ VALUE::VALUE(int type, bool un) : Type(type)
Prec = 0;
Fmt = GetFmt(Type, Unsigned);
Xfmt = GetXfmt();
- } // end of VALUE constructor
+} // end of VALUE constructor
/***********************************************************************/
/* VALUE GetXfmt: returns the extended format to use with typed value. */
/***********************************************************************/
const char *VALUE::GetXfmt(void)
- {
+{
const char *fmt;
switch (Type) {
@@ -537,7 +537,7 @@ const char *VALUE::GetXfmt(void)
} // endswitch Type
return fmt;
- } // end of GetFmt
+} // end of GetXFmt
/***********************************************************************/
/* Returns a BYTE indicating the comparison between two values. */
@@ -545,20 +545,20 @@ const char *VALUE::GetXfmt(void)
/* More than 1 bit can be set only in the case of TYPE_LIST. */
/***********************************************************************/
BYTE VALUE::TestValue(PVAL vp)
- {
+{
int n = CompareValue(vp);
return (n > 0) ? 0x04 : (n < 0) ? 0x02 : 0x01;
- } // end of TestValue
+} // end of TestValue
/***********************************************************************/
/* Compute a function on a string. */
/***********************************************************************/
bool VALUE::Compute(PGLOBAL g, PVAL *, int, OPVAL)
- {
+{
strcpy(g->Message, "Compute not implemented for this value type");
return true;
- } // end of Compute
+} // end of Compute
/***********************************************************************/
/* Make file output of an object value. */
@@ -600,11 +600,11 @@ void VALUE::Prints(PGLOBAL g, char *ps, uint z)
template <class TYPE>
TYPVAL<TYPE>::TYPVAL(TYPE n, int type, int prec, bool un)
: VALUE(type, un)
- {
+{
Tval = n;
Clen = sizeof(TYPE);
Prec = prec;
- } // end of TYPVAL constructor
+} // end of TYPVAL constructor
/***********************************************************************/
/* Return unsigned max value for the type. */
@@ -641,19 +641,19 @@ ulonglong TYPVAL<ulonglong>::MaxVal(void) {return ULONGLONG_MAX;}
/***********************************************************************/
template <class TYPE>
int TYPVAL<TYPE>::GetValLen(void)
- {
+{
char c[32];
- return sprintf(c, Fmt, Tval);
- } // end of GetValLen
+ return snprintf(c, 32, Fmt, Tval);
+} // end of GetValLen
template <>
int TYPVAL<double>::GetValLen(void)
- {
+{
char c[32];
- return sprintf(c, Fmt, Prec, Tval);
- } // end of GetValLen
+ return snprintf(c, 32, Fmt, Prec, Tval);
+} // end of GetValLen
/***********************************************************************/
/* TYPVAL SetValue: copy the value of another Value object. */
@@ -661,7 +661,7 @@ int TYPVAL<double>::GetValLen(void)
/***********************************************************************/
template <class TYPE>
bool TYPVAL<TYPE>::SetValue_pval(PVAL valp, bool chktype)
- {
+{
if (valp != this) {
if (chktype && Type != valp->GetType())
return true;
@@ -671,10 +671,10 @@ bool TYPVAL<TYPE>::SetValue_pval(PVAL valp, bool chktype)
else
Reset();
- } // endif valp
+ } // endif valp
return false;
- } // end of SetValue
+} // end of SetValue
template <>
short TYPVAL<short>::GetTypedValue(PVAL valp)
@@ -717,7 +717,7 @@ uchar TYPVAL<uchar>::GetTypedValue(PVAL valp)
/***********************************************************************/
template <class TYPE>
bool TYPVAL<TYPE>::SetValue_char(const char *p, int n)
- {
+{
bool rc, minus;
ulonglong maxval = MaxVal();
ulonglong val = CharToNumber(p, n, maxval, Unsigned, &minus, &rc);
@@ -731,15 +731,15 @@ bool TYPVAL<TYPE>::SetValue_char(const char *p, int n)
char buf[64];
htrc(strcat(strcat(strcpy(buf, " setting %s to: "), Fmt), "\n"),
GetTypeName(Type), Tval);
- } // endif trace
+ } // endif trace
Null = false;
return rc;
- } // end of SetValue
+} // end of SetValue
template <>
bool TYPVAL<double>::SetValue_char(const char *p, int n)
- {
+{
if (p && n > 0) {
char buf[64];
@@ -760,14 +760,14 @@ bool TYPVAL<double>::SetValue_char(const char *p, int n)
} // endif p
return false;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* TYPVAL SetValue: fill a typed value from a string. */
/***********************************************************************/
template <class TYPE>
void TYPVAL<TYPE>::SetValue_psz(PCSZ s)
- {
+{
if (s) {
SetValue_char(s, (int)strlen(s));
Null = false;
@@ -776,17 +776,17 @@ void TYPVAL<TYPE>::SetValue_psz(PCSZ s)
Null = Nullable;
} // endif p
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* TYPVAL SetValue: set value with a TYPE extracted from a block. */
/***********************************************************************/
template <class TYPE>
void TYPVAL<TYPE>::SetValue_pvblk(PVBLK blk, int n)
- {
+{
Tval = GetTypedValue(blk, n);
Null = false;
- } // end of SetValue
+} // end of SetValue
template <>
int TYPVAL<int>::GetTypedValue(PVBLK blk, int n)
@@ -852,7 +852,7 @@ void TYPVAL<TYPE>::SetBinValue(void *p)
/***********************************************************************/
template <class TYPE>
bool TYPVAL<TYPE>::GetBinValue(void *buf, int buflen, bool go)
- {
+{
// Test on length was removed here until a variable in column give the
// real field length. For BIN files the field length logically cannot
// be different from the variable length because no conversion is done.
@@ -876,40 +876,41 @@ bool TYPVAL<TYPE>::GetBinValue(void *buf, int buflen, bool go)
Null = false;
return false;
- } // end of GetBinValue
+} // end of GetBinValue
/***********************************************************************/
/* TYPVAL ShowValue: get string representation of a typed value. */
/***********************************************************************/
template <class TYPE>
int TYPVAL<TYPE>::ShowValue(char *buf, int len)
- {
+{
return snprintf(buf, len + 1, Xfmt, len, Tval);
- } // end of ShowValue
+} // end of ShowValue
template <>
int TYPVAL<double>::ShowValue(char *buf, int len)
- {
+{
// TODO: use a more appropriate format to avoid possible truncation
return snprintf(buf, len + 1, Xfmt, len, Prec, Tval);
- } // end of ShowValue
+} // end of ShowValue
/***********************************************************************/
/* TYPVAL GetCharString: get string representation of a typed value. */
/***********************************************************************/
template <class TYPE>
char *TYPVAL<TYPE>::GetCharString(char *p)
- {
+{
sprintf(p, Fmt, Tval);
return p;
- } // end of GetCharString
+} // end of GetCharString
template <>
char *TYPVAL<double>::GetCharString(char *p)
- {
- sprintf(p, Fmt, Prec, Tval);
+{
+ // Most callers use a 32 long buffer
+ snprintf(p, 32, Fmt, Prec, Tval);
return p;
- } // end of GetCharString
+} // end of GetCharString
#if 0
/***********************************************************************/
@@ -917,50 +918,50 @@ char *TYPVAL<double>::GetCharString(char *p)
/***********************************************************************/
template <class TYPE>
char *TYPVAL<TYPE>::GetShortString(char *p, int n)
- {
+{
sprintf(p, "%*hd", n, (short)Tval);
return p;
- } // end of GetShortString
+} // end of GetShortString
/***********************************************************************/
/* TYPVAL GetIntString: get int representation of a typed value. */
/***********************************************************************/
template <class TYPE>
char *TYPVAL<TYPE>::GetIntString(char *p, int n)
- {
+{
sprintf(p, "%*d", n, (int)Tval);
return p;
- } // end of GetIntString
+} // end of GetIntString
/***********************************************************************/
/* TYPVAL GetBigintString: get big int representation of a TYPE value.*/
/***********************************************************************/
template <class TYPE>
char *TYPVAL<TYPE>::GetBigintString(char *p, int n)
- {
+{
sprintf(p, "%*lld", n, (longlong)Tval);
return p;
- } // end of GetBigintString
+} // end of GetBigintString
/***********************************************************************/
/* TYPVAL GetFloatString: get double representation of a typed value. */
/***********************************************************************/
template <class TYPE>
char *TYPVAL<TYPE>::GetFloatString(char *p, int n, int prec)
- {
+{
sprintf(p, "%*.*lf", n, (prec < 0) ? 2 : prec, (double)Tval);
return p;
- } // end of GetFloatString
+} // end of GetFloatString
/***********************************************************************/
/* TYPVAL GetTinyString: get char representation of a typed value. */
/***********************************************************************/
template <class TYPE>
char *TYPVAL<TYPE>::GetTinyString(char *p, int n)
- {
+{
sprintf(p, "%*d", n, (int)(char)Tval);
return p;
- } // end of GetIntString
+} // end of GetIntString
#endif // 0
/***********************************************************************/
@@ -968,7 +969,7 @@ char *TYPVAL<TYPE>::GetTinyString(char *p, int n)
/***********************************************************************/
template <class TYPE>
bool TYPVAL<TYPE>::IsEqual(PVAL vp, bool chktype)
- {
+{
if (this == vp)
return true;
else if (chktype && Type != vp->GetType())
@@ -980,7 +981,7 @@ bool TYPVAL<TYPE>::IsEqual(PVAL vp, bool chktype)
else
return (Tval == GetTypedValue(vp));
- } // end of IsEqual
+} // end of IsEqual
/***********************************************************************/
/* Compare values and returns 1, 0 or -1 according to comparison. */
@@ -988,7 +989,7 @@ bool TYPVAL<TYPE>::IsEqual(PVAL vp, bool chktype)
/***********************************************************************/
template <class TYPE>
int TYPVAL<TYPE>::CompareValue(PVAL vp)
- {
+{
//assert(vp->GetType() == Type);
// Process filtering on numeric values.
@@ -998,7 +999,7 @@ int TYPVAL<TYPE>::CompareValue(PVAL vp)
// htrc(" Comparing: val=%d,%d\n", Tval, n);
return (Tval > n) ? 1 : (Tval < n) ? (-1) : 0;
- } // end of CompareValue
+} // end of CompareValue
/***********************************************************************/
/* Return max type value if b is true, else min type value. */
@@ -1044,7 +1045,7 @@ uchar TYPVAL<uchar>::MinMaxVal(bool b)
/***********************************************************************/
template <class TYPE>
TYPE TYPVAL<TYPE>::SafeAdd(TYPE n1, TYPE n2)
- {
+{
PGLOBAL& g = Global;
TYPE n = n1 + n2;
@@ -1059,20 +1060,20 @@ TYPE TYPVAL<TYPE>::SafeAdd(TYPE n1, TYPE n2)
} // endif's n2
return n;
- } // end of SafeAdd
+} // end of SafeAdd
template <>
inline double TYPVAL<double>::SafeAdd(double n1, double n2)
- {
+{
return n1 + n2;
- } // end of SafeAdd
+} // end of SafeAdd
/***********************************************************************/
/* SafeMult: multiply values and test whether overflow occurred. */
/***********************************************************************/
template <class TYPE>
TYPE TYPVAL<TYPE>::SafeMult(TYPE n1, TYPE n2)
- {
+{
PGLOBAL& g = Global;
double n = (double)n1 * (double)n2;
@@ -1087,20 +1088,20 @@ TYPE TYPVAL<TYPE>::SafeMult(TYPE n1, TYPE n2)
} // endif's n2
return (TYPE)n;
- } // end of SafeMult
+} // end of SafeMult
template <>
inline double TYPVAL<double>::SafeMult(double n1, double n2)
- {
+{
return n1 * n2;
- } // end of SafeMult
+} // end of SafeMult
/***********************************************************************/
/* Compute defined functions for the type. */
/***********************************************************************/
template <class TYPE>
bool TYPVAL<TYPE>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
- {
+{
bool rc = false;
TYPE val[2];
@@ -1127,14 +1128,14 @@ bool TYPVAL<TYPE>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
default:
rc = Compall(g, vp, np, op);
break;
- } // endswitch op
+ } // endswitch op
return rc;
- } // end of Compute
+} // end of Compute
template <>
bool TYPVAL<double>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
- {
+{
bool rc = false;
double val[2];
@@ -1152,17 +1153,17 @@ bool TYPVAL<double>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
break;
default:
rc = Compall(g, vp, np, op);
- } // endswitch op
+ } // endswitch op
return rc;
- } // end of Compute
+} // end of Compute
/***********************************************************************/
/* Compute a function for all types. */
/***********************************************************************/
template <class TYPE>
bool TYPVAL<TYPE>::Compall(PGLOBAL g, PVAL *vp, int np, OPVAL op)
- {
+{
TYPE val[2];
for (int i = 0; i < np; i++)
@@ -1191,10 +1192,10 @@ bool TYPVAL<TYPE>::Compall(PGLOBAL g, PVAL *vp, int np, OPVAL op)
// sprintf(g->Message, MSG(BAD_EXP_OPER), op);
strcpy(g->Message, "Function not supported");
return true;
- } // endswitch op
+ } // endswitch op
return false;
- } // end of Compall
+} // end of Compall
/***********************************************************************/
/* FormatValue: This function set vp (a STRING value) to the string */
@@ -1203,26 +1204,28 @@ bool TYPVAL<TYPE>::Compall(PGLOBAL g, PVAL *vp, int np, OPVAL op)
/***********************************************************************/
template <class TYPE>
bool TYPVAL<TYPE>::FormatValue(PVAL vp, PCSZ fmt)
- {
- char *buf = (char*)vp->GetTo_Val(); // Should be big enough
+{
+ // This function is wrong and should never be called
+ assert(false);
+ char *buf = (char*)vp->GetTo_Val(); // Not big enough
int n = sprintf(buf, fmt, Tval);
return (n > vp->GetValLen());
- } // end of FormatValue
+} // end of FormatValue
/***********************************************************************/
/* TYPVAL SetFormat function (used to set SELECT output format). */
/***********************************************************************/
template <class TYPE>
bool TYPVAL<TYPE>::SetConstFormat(PGLOBAL g, FORMAT& fmt)
- {
+{
char c[32];
fmt.Type[0] = *GetFormatType(Type);
fmt.Length = sprintf(c, Fmt, Tval);
fmt.Prec = Prec;
return false;
- } // end of SetConstFormat
+} // end of SetConstFormat
/* -------------------------- Class STRING --------------------------- */
@@ -1230,19 +1233,19 @@ bool TYPVAL<TYPE>::SetConstFormat(PGLOBAL g, FORMAT& fmt)
/* STRING public constructor from a constant string. */
/***********************************************************************/
TYPVAL<PSZ>::TYPVAL(PSZ s, short c) : VALUE(TYPE_STRING)
- {
+{
Strp = s;
Len = strlen(s);
Clen = Len;
Ci = (c == 1);
- } // end of STRING constructor
+} // end of STRING constructor
/***********************************************************************/
/* STRING public constructor from char. */
/***********************************************************************/
TYPVAL<PSZ>::TYPVAL(PGLOBAL g, PSZ s, int n, int c)
: VALUE(TYPE_STRING)
- {
+{
Len = (g) ? n : (s) ? strlen(s) : 0;
if (!s) {
@@ -1260,89 +1263,89 @@ TYPVAL<PSZ>::TYPVAL(PGLOBAL g, PSZ s, int n, int c)
Clen = Len;
Ci = (c != 0);
- } // end of STRING constructor
+} // end of STRING constructor
/***********************************************************************/
/* Get the tiny value represented by the Strp string. */
/***********************************************************************/
char TYPVAL<PSZ>::GetTinyValue(void)
- {
+{
bool m;
ulonglong val = CharToNumber(Strp, strlen(Strp), INT_MAX8, false, &m);
return (m && val < INT_MAX8) ? (char)(-(signed)val) : (char)val;
- } // end of GetTinyValue
+} // end of GetTinyValue
/***********************************************************************/
/* Get the unsigned tiny value represented by the Strp string. */
/***********************************************************************/
uchar TYPVAL<PSZ>::GetUTinyValue(void)
- {
+{
return (uchar)CharToNumber(Strp, strlen(Strp), UINT_MAX8, true);
- } // end of GetUTinyValue
+} // end of GetUTinyValue
/***********************************************************************/
/* Get the short value represented by the Strp string. */
/***********************************************************************/
short TYPVAL<PSZ>::GetShortValue(void)
- {
+{
bool m;
ulonglong val = CharToNumber(Strp, strlen(Strp), INT_MAX16, false, &m);
return (m && val < INT_MAX16) ? (short)(-(signed)val) : (short)val;
- } // end of GetShortValue
+} // end of GetShortValue
/***********************************************************************/
/* Get the unsigned short value represented by the Strp string. */
/***********************************************************************/
ushort TYPVAL<PSZ>::GetUShortValue(void)
- {
+{
return (ushort)CharToNumber(Strp, strlen(Strp), UINT_MAX16, true);
- } // end of GetUshortValue
+} // end of GetUshortValue
/***********************************************************************/
/* Get the integer value represented by the Strp string. */
/***********************************************************************/
int TYPVAL<PSZ>::GetIntValue(void)
- {
+{
bool m;
ulonglong val = CharToNumber(Strp, strlen(Strp), INT_MAX32, false, &m);
return (m && val < INT_MAX32) ? (int)(-(signed)val) : (int)val;
- } // end of GetIntValue
+} // end of GetIntValue
/***********************************************************************/
/* Get the unsigned integer value represented by the Strp string. */
/***********************************************************************/
uint TYPVAL<PSZ>::GetUIntValue(void)
- {
+{
return (uint)CharToNumber(Strp, strlen(Strp), UINT_MAX32, true);
- } // end of GetUintValue
+} // end of GetUintValue
/***********************************************************************/
/* Get the big integer value represented by the Strp string. */
/***********************************************************************/
longlong TYPVAL<PSZ>::GetBigintValue(void)
- {
+{
bool m;
ulonglong val = CharToNumber(Strp, strlen(Strp), INT_MAX64, false, &m);
return (m && val < INT_MAX64) ? (-(signed)val) : (longlong)val;
- } // end of GetBigintValue
+} // end of GetBigintValue
/***********************************************************************/
/* Get the unsigned big integer value represented by the Strp string. */
/***********************************************************************/
ulonglong TYPVAL<PSZ>::GetUBigintValue(void)
- {
+{
return CharToNumber(Strp, strlen(Strp), ULONGLONG_MAX, true);
- } // end of GetUBigintValue
+} // end of GetUBigintValue
/***********************************************************************/
/* STRING SetValue: copy the value of another Value object. */
/***********************************************************************/
bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
- {
+{
if (valp != this) {
if (chktype && (valp->GetType() != Type || valp->GetSize() > Len))
return true;
@@ -1354,16 +1357,16 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
else
Reset();
- } // endif valp
+ } // endif valp
return false;
- } // end of SetValue_pval
+} // end of SetValue_pval
/***********************************************************************/
/* STRING SetValue: fill string with chars extracted from a line. */
/***********************************************************************/
bool TYPVAL<PSZ>::SetValue_char(const char *cp, int n)
- {
+{
bool rc = false;
if (!cp || n == 0) {
@@ -1389,16 +1392,16 @@ bool TYPVAL<PSZ>::SetValue_char(const char *cp, int n)
Reset();
Null = false;
- } // endif p
+ } // endif cp
return rc;
- } // end of SetValue_char
+} // end of SetValue_char
/***********************************************************************/
/* STRING SetValue: fill string with another string. */
/***********************************************************************/
void TYPVAL<PSZ>::SetValue_psz(PCSZ s)
- {
+{
if (!s) {
Reset();
Null = Nullable;
@@ -1407,26 +1410,26 @@ void TYPVAL<PSZ>::SetValue_psz(PCSZ s)
Null = false;
} // endif s
- } // end of SetValue_psz
+} // end of SetValue_psz
/***********************************************************************/
/* STRING SetValue: fill string with a string extracted from a block. */
/***********************************************************************/
void TYPVAL<PSZ>::SetValue_pvblk(PVBLK blk, int n)
- {
+{
// STRBLK's can return a NULL pointer
PSZ vp = blk->GetCharString(Strp, n);
if (vp != Strp)
SetValue_psz(vp);
- } // end of SetValue_pvblk
+} // end of SetValue_pvblk
/***********************************************************************/
/* STRING SetValue: get the character representation of an integer. */
/***********************************************************************/
void TYPVAL<PSZ>::SetValue(int n)
- {
+{
char buf[16];
PGLOBAL& g = Global;
int k = sprintf(buf, "%d", n);
@@ -1438,13 +1441,13 @@ void TYPVAL<PSZ>::SetValue(int n)
SetValue_psz(buf);
Null = false;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* STRING SetValue: get the character representation of an uint. */
/***********************************************************************/
void TYPVAL<PSZ>::SetValue(uint n)
- {
+{
char buf[16];
PGLOBAL& g = Global;
int k = sprintf(buf, "%u", n);
@@ -1456,31 +1459,31 @@ void TYPVAL<PSZ>::SetValue(uint n)
SetValue_psz(buf);
Null = false;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* STRING SetValue: get the character representation of a short int. */
/***********************************************************************/
void TYPVAL<PSZ>::SetValue(short i)
- {
+{
SetValue((int)i);
Null = false;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* STRING SetValue: get the character representation of a ushort int. */
/***********************************************************************/
void TYPVAL<PSZ>::SetValue(ushort i)
- {
+{
SetValue((uint)i);
Null = false;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* STRING SetValue: get the character representation of a big integer.*/
/***********************************************************************/
void TYPVAL<PSZ>::SetValue(longlong n)
- {
+{
char buf[24];
PGLOBAL& g = Global;
int k = sprintf(buf, "%lld", n);
@@ -1492,13 +1495,13 @@ void TYPVAL<PSZ>::SetValue(longlong n)
SetValue_psz(buf);
Null = false;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* STRING SetValue: get the character representation of a big integer.*/
/***********************************************************************/
void TYPVAL<PSZ>::SetValue(ulonglong n)
- {
+{
char buf[24];
PGLOBAL& g = Global;
int k = sprintf(buf, "%llu", n);
@@ -1510,13 +1513,13 @@ void TYPVAL<PSZ>::SetValue(ulonglong n)
SetValue_psz(buf);
Null = false;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* STRING SetValue: get the character representation of a double. */
/***********************************************************************/
void TYPVAL<PSZ>::SetValue(double f)
- {
+{
char *p, buf[64];
PGLOBAL& g = Global;
int k = sprintf(buf, "%lf", f);
@@ -1535,33 +1538,33 @@ void TYPVAL<PSZ>::SetValue(double f)
SetValue_psz(buf);
Null = false;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* STRING SetValue: get the character representation of a tiny int. */
/***********************************************************************/
void TYPVAL<PSZ>::SetValue(char c)
- {
+{
SetValue((int)c);
Null = false;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* STRING SetValue: get the character representation of a tiny int. */
/***********************************************************************/
void TYPVAL<PSZ>::SetValue(uchar c)
- {
+{
SetValue((uint)c);
Null = false;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* STRING SetBinValue: fill string with chars extracted from a line. */
/***********************************************************************/
void TYPVAL<PSZ>::SetBinValue(void *p)
- {
+{
SetValue_char((const char *)p, Len);
- } // end of SetBinValue
+} // end of SetBinValue
/***********************************************************************/
/* GetBinValue: fill a buffer with the internal binary value. */
@@ -1570,7 +1573,7 @@ void TYPVAL<PSZ>::SetBinValue(void *p)
/* Currently used by WriteColumn of binary files. */
/***********************************************************************/
bool TYPVAL<PSZ>::GetBinValue(void *buf, int buflen, bool go)
- {
+{
int len = (Null) ? 0 : strlen(Strp);
if (len > buflen)
@@ -1581,7 +1584,7 @@ bool TYPVAL<PSZ>::GetBinValue(void *buf, int buflen, bool go)
} // endif go
return false;
- } // end of GetBinValue
+} // end of GetBinValue
/***********************************************************************/
/* STRING ShowValue: get string representation of a char value. */
@@ -1591,7 +1594,7 @@ int TYPVAL<PSZ>::ShowValue(char *buf, int buflen)
int len = (Null) ? 0 : strlen(Strp);
if (buf && buf != Strp) {
- memset(buf, ' ', buflen + 1);
+ memset(buf, ' ', (size_t)buflen + 1);
memcpy(buf, Strp, MY_MIN(len, buflen));
} // endif buf
@@ -1602,15 +1605,15 @@ int TYPVAL<PSZ>::ShowValue(char *buf, int buflen)
/* STRING GetCharString: get string representation of a char value. */
/***********************************************************************/
char *TYPVAL<PSZ>::GetCharString(char *)
- {
+{
return Strp;
- } // end of GetCharString
+} // end of GetCharString
/***********************************************************************/
/* STRING compare value with another Value. */
/***********************************************************************/
bool TYPVAL<PSZ>::IsEqual(PVAL vp, bool chktype)
- {
+{
if (this == vp)
return true;
else if (chktype && Type != vp->GetType())
@@ -1625,14 +1628,14 @@ bool TYPVAL<PSZ>::IsEqual(PVAL vp, bool chktype)
else // (!Ci)
return !strcmp(Strp, vp->GetCharString(buf));
- } // end of IsEqual
+} // end of IsEqual
/***********************************************************************/
/* Compare values and returns 1, 0 or -1 according to comparison. */
/* This function is used for evaluation of numeric filters. */
/***********************************************************************/
int TYPVAL<PSZ>::CompareValue(PVAL vp)
- {
+{
int n;
//assert(vp->GetType() == Type);
@@ -1651,13 +1654,13 @@ int TYPVAL<PSZ>::CompareValue(PVAL vp)
#endif // __WIN__
return (n > 0) ? 1 : (n < 0) ? -1 : 0;
- } // end of CompareValue
+} // end of CompareValue
/***********************************************************************/
/* Compute a function on a string. */
/***********************************************************************/
bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
- {
+{
char *p[2], val[2][32];
int i;
@@ -1704,7 +1707,7 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
Null = false;
return false;
- } // end of Compute
+} // end of Compute
/***********************************************************************/
/* FormatValue: This function set vp (a STRING value) to the string */
@@ -1712,23 +1715,23 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
/* This function assumes that the format matches the value type. */
/***********************************************************************/
bool TYPVAL<PSZ>::FormatValue(PVAL vp, PCSZ fmt)
- {
+{
char *buf = (char*)vp->GetTo_Val(); // Should be big enough
int n = sprintf(buf, fmt, Strp);
return (n > vp->GetValLen());
- } // end of FormatValue
+} // end of FormatValue
/***********************************************************************/
/* STRING SetFormat function (used to set SELECT output format). */
/***********************************************************************/
bool TYPVAL<PSZ>::SetConstFormat(PGLOBAL, FORMAT& fmt)
- {
+{
fmt.Type[0] = 'C';
fmt.Length = Len;
fmt.Prec = 0;
return false;
- } // end of SetConstFormat
+} // end of SetConstFormat
/***********************************************************************/
/* Make string output of an object value. */
@@ -1748,38 +1751,38 @@ void TYPVAL<PSZ>::Prints(PGLOBAL g, char *ps, uint z)
/* DECIMAL public constructor from a constant string. */
/***********************************************************************/
DECVAL::DECVAL(PSZ s) : TYPVAL<PSZ>(s)
- {
+{
if (s) {
char *p = strchr(Strp, '.');
Prec = (p) ? (int)(Len - (p - Strp)) : 0;
- } // endif s
+ } // endif s
Type = TYPE_DECIM;
- } // end of DECVAL constructor
+} // end of DECVAL constructor
/***********************************************************************/
/* DECIMAL public constructor from char. */
/***********************************************************************/
DECVAL::DECVAL(PGLOBAL g, PSZ s, int n, int prec, bool uns)
: TYPVAL<PSZ>(g, s, n + (prec ? 1 : 0) + (uns ? 0 : 1), 0)
- {
+{
Prec = prec;
Unsigned = uns;
Type = TYPE_DECIM;
- } // end of DECVAL constructor
+} // end of DECVAL constructor
/***********************************************************************/
/* DECIMAL: Check whether the numerica value is equal to 0. */
/***********************************************************************/
bool DECVAL::IsZero(void)
- {
+{
for (int i = 0; Strp[i]; i++)
if (!strchr("0 +-.", Strp[i]))
return false;
return true;
- } // end of IsZero
+} // end of IsZero
/***********************************************************************/
/* DECIMAL: Reset value to zero. */
@@ -1797,7 +1800,7 @@ void DECVAL::Reset(void)
Strp[i++] = '0';
} while (i < Prec + 2);
- } // endif Prec
+ } // endif Prec
Strp[i] = 0;
} // end of Reset
@@ -1806,9 +1809,9 @@ void DECVAL::Reset(void)
/* DECIMAL ShowValue: get string representation right justified. */
/***********************************************************************/
int DECVAL::ShowValue(char *buf, int len)
- {
+{
return snprintf(buf, len + 1, Xfmt, len, Strp);
- } // end of ShowValue
+} // end of ShowValue
/***********************************************************************/
/* GetBinValue: fill a buffer with the internal binary value. */
@@ -1817,7 +1820,7 @@ int DECVAL::ShowValue(char *buf, int len)
/* Currently used by WriteColumn of binary files. */
/***********************************************************************/
bool DECVAL::GetBinValue(void *buf, int buflen, bool go)
- {
+{
int len = (Null) ? 0 : strlen(Strp);
if (len > buflen)
@@ -1825,16 +1828,16 @@ bool DECVAL::GetBinValue(void *buf, int buflen, bool go)
else if (go) {
memset(buf, ' ', buflen - len);
memcpy((char*)buf + buflen - len, Strp, len);
- } // endif go
+ } // endif go
return false;
- } // end of GetBinValue
+} // end of GetBinValue
/***********************************************************************/
/* DECIMAL compare value with another Value. */
/***********************************************************************/
bool DECVAL::IsEqual(PVAL vp, bool chktype)
- {
+{
if (this == vp)
return true;
else if (chktype && Type != vp->GetType())
@@ -1845,14 +1848,14 @@ bool DECVAL::IsEqual(PVAL vp, bool chktype)
char buf[64];
return !strcmp(Strp, vp->GetCharString(buf));
- } // end of IsEqual
+} // end of IsEqual
/***********************************************************************/
/* Compare values and returns 1, 0 or -1 according to comparison. */
/* This function is used for evaluation of numeric filters. */
/***********************************************************************/
int DECVAL::CompareValue(PVAL vp)
- {
+{
//assert(vp->GetType() == Type);
// Process filtering on numeric values.
@@ -1862,7 +1865,7 @@ int DECVAL::CompareValue(PVAL vp)
// htrc(" Comparing: val=%d,%d\n", f, n);
return (f > n) ? 1 : (f < n) ? (-1) : 0;
- } // end of CompareValue
+} // end of CompareValue
/* -------------------------- Class BINVAL --------------------------- */
@@ -1870,7 +1873,7 @@ int DECVAL::CompareValue(PVAL vp)
/* BINVAL public constructor from bytes. */
/***********************************************************************/
BINVAL::BINVAL(PGLOBAL g, void *p, int cl, int n) : VALUE(TYPE_BIN)
- {
+{
assert(g);
Len = n;
Clen = cl;
@@ -1881,19 +1884,19 @@ BINVAL::BINVAL(PGLOBAL g, void *p, int cl, int n) : VALUE(TYPE_BIN)
memcpy(Binp, p, MY_MIN(Len,Clen));
Chrp = NULL;
- } // end of BINVAL constructor
+} // end of BINVAL constructor
/***********************************************************************/
/* BINVAL: Check whether the hexadecimal value is equal to 0. */
/***********************************************************************/
bool BINVAL::IsZero(void)
- {
+{
for (int i = 0; i < Len; i++)
if (((char*)Binp)[i] != 0)
return false;
return true;
- } // end of IsZero
+} // end of IsZero
/***********************************************************************/
/* BINVAL: Reset value to zero. */
@@ -1908,77 +1911,77 @@ void BINVAL::Reset(void)
/* Get the tiny value pointed by Binp. */
/***********************************************************************/
char BINVAL::GetTinyValue(void)
- {
+{
return *(char*)Binp;
- } // end of GetTinyValue
+} // end of GetTinyValue
/***********************************************************************/
/* Get the unsigned tiny value pointed by Binp. */
/***********************************************************************/
uchar BINVAL::GetUTinyValue(void)
- {
+{
return *(uchar*)Binp;
- } // end of GetUTinyValue
+} // end of GetUTinyValue
/***********************************************************************/
/* Get the short value pointed by Binp. */
/***********************************************************************/
short BINVAL::GetShortValue(void)
- {
+{
if (Len >= 2)
return *(short*)Binp;
else
return (short)GetTinyValue();
- } // end of GetShortValue
+} // end of GetShortValue
/***********************************************************************/
/* Get the unsigned short value pointed by Binp. */
/***********************************************************************/
ushort BINVAL::GetUShortValue(void)
- {
+{
return (ushort)GetShortValue();
- } // end of GetUshortValue
+} // end of GetUshortValue
/***********************************************************************/
/* Get the integer value pointed by Binp. */
/***********************************************************************/
int BINVAL::GetIntValue(void)
- {
+{
if (Len >= 4)
return *(int*)Binp;
else
return (int)GetShortValue();
- } // end of GetIntValue
+} // end of GetIntValue
/***********************************************************************/
/* Get the unsigned integer value pointed by Binp. */
/***********************************************************************/
uint BINVAL::GetUIntValue(void)
- {
+{
return (uint)GetIntValue();
- } // end of GetUintValue
+} // end of GetUintValue
/***********************************************************************/
/* Get the big integer value pointed by Binp. */
/***********************************************************************/
longlong BINVAL::GetBigintValue(void)
- {
+{
if (Len >= 8)
return *(longlong*)Binp;
else
return (longlong)GetIntValue();
- } // end of GetBigintValue
+} // end of GetBigintValue
/***********************************************************************/
/* Get the unsigned big integer value pointed by Binp. */
/***********************************************************************/
ulonglong BINVAL::GetUBigintValue(void)
- {
+{
return (ulonglong)GetBigintValue();
- } // end of GetUBigintValue
+} // end of GetUBigintValue
/***********************************************************************/
/* Get the double value pointed by Binp. */
@@ -1998,7 +2001,7 @@ double BINVAL::GetFloatValue(void)
/* BINVAL SetValue: copy the value of another Value object. */
/***********************************************************************/
bool BINVAL::SetValue_pval(PVAL valp, bool chktype)
- {
+{
bool rc = false;
if (valp != this) {
@@ -2018,16 +2021,16 @@ bool BINVAL::SetValue_pval(PVAL valp, bool chktype)
} else
Reset();
- } // endif valp
+ } // endif valp
return rc;
- } // end of SetValue_pval
+} // end of SetValue_pval
/***********************************************************************/
/* BINVAL SetValue: fill value with chars extracted from a line. */
/***********************************************************************/
bool BINVAL::SetValue_char(const char *p, int n)
- {
+{
bool rc;
if (p && n > 0) {
@@ -2047,13 +2050,13 @@ bool BINVAL::SetValue_char(const char *p, int n)
} // endif p
return rc;
- } // end of SetValue_char
+} // end of SetValue_char
/***********************************************************************/
/* BINVAL SetValue: fill value with another string. */
/***********************************************************************/
void BINVAL::SetValue_psz(PCSZ s)
- {
+{
if (s) {
int len = Len;
@@ -2068,13 +2071,13 @@ void BINVAL::SetValue_psz(PCSZ s)
Null = Nullable;
} // endif s
- } // end of SetValue_psz
+} // end of SetValue_psz
/***********************************************************************/
/* BINVAL SetValue: fill value with bytes extracted from a block. */
/***********************************************************************/
void BINVAL::SetValue_pvblk(PVBLK blk, int n)
- {
+{
// STRBLK's can return a NULL pointer
void *vp = blk->GetValPtrEx(n);
@@ -2097,13 +2100,13 @@ void BINVAL::SetValue_pvblk(PVBLK blk, int n)
Null = false;
} // endif vp
- } // end of SetValue_pvblk
+} // end of SetValue_pvblk
/***********************************************************************/
/* BINVAL SetValue: get the binary representation of an integer. */
/***********************************************************************/
void BINVAL::SetValue(int n)
- {
+{
if (Clen >= 4) {
if (Len > 4)
memset(Binp, 0, Len);
@@ -2113,13 +2116,13 @@ void BINVAL::SetValue(int n)
} else
SetValue((short)n);
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* BINVAL SetValue: get the binary representation of an uint. */
/***********************************************************************/
void BINVAL::SetValue(uint n)
- {
+{
if (Clen >= 4) {
if (Len > 4)
memset(Binp, 0, Len);
@@ -2129,13 +2132,13 @@ void BINVAL::SetValue(uint n)
} else
SetValue((ushort)n);
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* BINVAL SetValue: get the binary representation of a short int. */
/***********************************************************************/
void BINVAL::SetValue(short i)
- {
+{
if (Clen >= 2) {
if (Len > 2)
memset(Binp, 0, Len);
@@ -2145,13 +2148,13 @@ void BINVAL::SetValue(short i)
} else
SetValue((char)i);
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* BINVAL SetValue: get the binary representation of a ushort int. */
/***********************************************************************/
void BINVAL::SetValue(ushort i)
- {
+{
if (Clen >= 2) {
if (Len > 2)
memset(Binp, 0, Len);
@@ -2161,13 +2164,13 @@ void BINVAL::SetValue(ushort i)
} else
SetValue((uchar)i);
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* BINVAL SetValue: get the binary representation of a big integer. */
/***********************************************************************/
void BINVAL::SetValue(longlong n)
- {
+{
if (Clen >= 8) {
if (Len > 8)
memset(Binp, 0, Len);
@@ -2177,13 +2180,13 @@ void BINVAL::SetValue(longlong n)
} else
SetValue((int)n);
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* BINVAL SetValue: get the binary representation of a big integer. */
/***********************************************************************/
void BINVAL::SetValue(ulonglong n)
- {
+{
if (Clen >= 8) {
if (Len > 8)
memset(Binp, 0, Len);
@@ -2192,13 +2195,14 @@ void BINVAL::SetValue(ulonglong n)
Len = 8;
} else
SetValue((uint)n);
- } // end of SetValue
+
+} // end of SetValue
/***********************************************************************/
/* BINVAL SetValue: get the binary representation of a double. */
/***********************************************************************/
void BINVAL::SetValue(double n)
- {
+{
if (Len > 8)
memset(Binp, 0, Len);
@@ -2211,40 +2215,40 @@ void BINVAL::SetValue(double n)
} else
Len = 0;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* BINVAL SetValue: get the character binary of a tiny int. */
/***********************************************************************/
void BINVAL::SetValue(char c)
- {
+{
if (Len > 1)
memset(Binp, 0, Len);
*((char*)Binp) = c;
Len = 1;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* BINVAL SetValue: get the binary representation of a tiny int. */
/***********************************************************************/
void BINVAL::SetValue(uchar c)
- {
+{
if (Len > 1)
memset(Binp, 0, Len);
*((uchar*)Binp) = c;
Len = 1;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* BINVAL SetBinValue: fill string with bytes extracted from a line. */
/***********************************************************************/
void BINVAL::SetBinValue(void *p)
- {
+{
memcpy(Binp, p, Clen);
Len = Clen;
- } // end of SetBinValue
+} // end of SetBinValue
/***********************************************************************/
/* GetBinValue: fill a buffer with the internal binary value. */
@@ -2253,7 +2257,7 @@ void BINVAL::SetBinValue(void *p)
/* Currently used by WriteColumn of binary files. */
/***********************************************************************/
bool BINVAL::GetBinValue(void *buf, int buflen, bool go)
- {
+{
if (Len > buflen)
return true;
else if (go) {
@@ -2262,7 +2266,7 @@ bool BINVAL::GetBinValue(void *buf, int buflen, bool go)
} // endif go
return false;
- } // end of GetBinValue
+} // end of GetBinValue
/***********************************************************************/
/* BINVAL ShowValue: get string representation of a binary value. */
@@ -2278,19 +2282,19 @@ int BINVAL::ShowValue(char *buf, int len)
/* BINVAL GetCharString: get string representation of a binary value. */
/***********************************************************************/
char *BINVAL::GetCharString(char *)
- {
+{
if (!Chrp)
Chrp = (char*)PlugSubAlloc(Global, NULL, Clen * 2 + 1);
sprintf(Chrp, GetXfmt(), Len, Binp);
return Chrp;
- } // end of GetCharString
+} // end of GetCharString
/***********************************************************************/
/* BINVAL compare value with another Value. */
/***********************************************************************/
bool BINVAL::IsEqual(PVAL vp, bool chktype)
- {
+{
if (this == vp)
return true;
else if (chktype && Type != vp->GetType())
@@ -2308,7 +2312,7 @@ bool BINVAL::IsEqual(PVAL vp, bool chktype)
return false;
return true;
- } // end of IsEqual
+} // end of IsEqual
/***********************************************************************/
/* FormatValue: This function set vp (a STRING value) to the string */
@@ -2316,23 +2320,23 @@ bool BINVAL::IsEqual(PVAL vp, bool chktype)
/* This function assumes that the format matches the value type. */
/***********************************************************************/
bool BINVAL::FormatValue(PVAL vp, PCSZ fmt)
- {
+{
char *buf = (char*)vp->GetTo_Val(); // Should be big enough
int n = sprintf(buf, fmt, Len, Binp);
return (n > vp->GetValLen());
- } // end of FormatValue
+} // end of FormatValue
/***********************************************************************/
/* BINVAL SetFormat function (used to set SELECT output format). */
/***********************************************************************/
bool BINVAL::SetConstFormat(PGLOBAL, FORMAT& fmt)
- {
+{
fmt.Type[0] = 'B';
fmt.Length = Clen;
fmt.Prec = 0;
return false;
- } // end of SetConstFormat
+} // end of SetConstFormat
/* -------------------------- Class DTVAL ---------------------------- */
@@ -2341,7 +2345,7 @@ bool BINVAL::SetConstFormat(PGLOBAL, FORMAT& fmt)
/***********************************************************************/
DTVAL::DTVAL(PGLOBAL g, int n, int prec, PCSZ fmt)
: TYPVAL<int>((int)0, TYPE_DATE)
- {
+{
if (!fmt) {
Pdtp = NULL;
Sdate = NULL;
@@ -2351,37 +2355,37 @@ DTVAL::DTVAL(PGLOBAL g, int n, int prec, PCSZ fmt)
SetFormat(g, fmt, n, prec);
//Type = TYPE_DATE;
- } // end of DTVAL constructor
+} // end of DTVAL constructor
/***********************************************************************/
/* DTVAL public constructor from int. */
/***********************************************************************/
DTVAL::DTVAL(int n) : TYPVAL<int>(n, TYPE_DATE)
- {
+{
Pdtp = NULL;
Len = 19;
//Type = TYPE_DATE;
Sdate = NULL;
DefYear = 0;
- } // end of DTVAL constructor
+} // end of DTVAL constructor
/***********************************************************************/
/* Set format so formatted dates can be converted on input/output. */
/***********************************************************************/
bool DTVAL::SetFormat(PGLOBAL g, PCSZ fmt, int len, int year)
- {
+{
Pdtp = MakeDateFormat(g, fmt, true, true, (year > 9999) ? 1 : 0);
Sdate = (char*)PlugSubAlloc(g, NULL, len + 1);
DefYear = (int)((year > 9999) ? (year - 10000) : year);
Len = len;
return false;
- } // end of SetFormat
+} // end of SetFormat
/***********************************************************************/
/* Set format from the format of another date value. */
/***********************************************************************/
bool DTVAL::SetFormat(PGLOBAL g, PVAL valp)
- {
+{
DTVAL *vp;
if (valp->GetType() != TYPE_DATE) {
@@ -2395,14 +2399,14 @@ bool DTVAL::SetFormat(PGLOBAL g, PVAL valp)
Sdate = (char*)PlugSubAlloc(g, NULL, Len + 1);
DefYear = vp->DefYear;
return false;
- } // end of SetFormat
+} // end of SetFormat
/***********************************************************************/
/* We need TimeShift because the mktime C function does a correction */
/* for local time zone that we want to override for DB operations. */
/***********************************************************************/
void DTVAL::SetTimeShift(void)
- {
+{
struct tm dtm;
memset(&dtm, 0, sizeof(dtm));
dtm.tm_mday=2;
@@ -2414,7 +2418,7 @@ void DTVAL::SetTimeShift(void)
if (trace(1))
htrc("DTVAL Shift=%d\n", Shift);
- } // end of SetTimeShift
+} // end of SetTimeShift
// Added by Alexander Barkov
static void TIME_to_localtime(struct tm *tm, const MYSQL_TIME *ltime)
@@ -2444,7 +2448,7 @@ static struct tm *gmtime_mysql(const time_t *timep, struct tm *tm)
/* extend the range of valid dates by accepting negative time values. */
/***********************************************************************/
struct tm *DTVAL::GetGmTime(struct tm *tm_buffer)
- {
+{
struct tm *datm;
time_t t = (time_t)Tval;
@@ -2463,7 +2467,7 @@ struct tm *DTVAL::GetGmTime(struct tm *tm_buffer)
datm = gmtime_mysql(&t, tm_buffer);
return datm;
- } // end of GetGmTime
+} // end of GetGmTime
// Added by Alexander Barkov
static time_t mktime_mysql(struct tm *ptm)
@@ -2482,7 +2486,7 @@ static time_t mktime_mysql(struct tm *ptm)
/* range of valid dates by accepting to set negative time values. */
/***********************************************************************/
bool DTVAL::MakeTime(struct tm *ptm)
- {
+{
int n, y = ptm->tm_year;
time_t t = mktime_mysql(ptm);
@@ -2498,7 +2502,7 @@ bool DTVAL::MakeTime(struct tm *ptm)
for (n = 0; t == -1 && n < 20; n++) {
ptm->tm_year += 4;
t = mktime_mysql(ptm);
- } // endfor t
+ } // endfor t
if (t == -1)
return true;
@@ -2506,20 +2510,21 @@ bool DTVAL::MakeTime(struct tm *ptm)
if ((t -= (n * FOURYEARS)) > 2000000000)
return true;
- }
+ } // endif t
+
Tval= (int) t;
if (trace(2))
htrc("MakeTime Ival=%d\n", Tval);
return false;
- } // end of MakeTime
+} // end of MakeTime
/***********************************************************************/
/* Make a time_t datetime from its components (YY, MM, DD, hh, mm, ss) */
/***********************************************************************/
bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval)
- {
+{
int i, m;
int n;
bool rc = false;
@@ -2589,9 +2594,9 @@ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval)
case 3: datm.tm_hour = n; break;
case 4: datm.tm_min = n; break;
case 5: datm.tm_sec = n; break;
- } // endswitch i
+ } // endswitch i
- } // endfor i
+ } // endfor i
if (trace(2))
htrc("MakeDate datm=(%d,%d,%d,%d,%d,%d)\n",
@@ -2608,14 +2613,14 @@ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval)
Tval = 0;
}
return rc;
- } // end of MakeDate
+} // end of MakeDate
/***********************************************************************/
/* DTVAL SetValue: copy the value of another Value object. */
/* This function allows conversion if chktype is false. */
/***********************************************************************/
bool DTVAL::SetValue_pval(PVAL valp, bool chktype)
- {
+{
if (valp != this) {
if (chktype && Type != valp->GetType())
return true;
@@ -2637,16 +2642,16 @@ bool DTVAL::SetValue_pval(PVAL valp, bool chktype)
} else
Reset();
- } // endif valp
+ } // endif valp
return false;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* SetValue: convert chars extracted from a line to date value. */
/***********************************************************************/
bool DTVAL::SetValue_char(const char *p, int n)
- {
+{
bool rc= 0;
if (Pdtp) {
@@ -2662,7 +2667,7 @@ bool DTVAL::SetValue_char(const char *p, int n)
n = Len;
memcpy(Sdate, p, n);
- } // endif n
+ } // endif n
Sdate[n] = '\0';
@@ -2679,13 +2684,13 @@ bool DTVAL::SetValue_char(const char *p, int n)
} // endif Pdtp
return rc;
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* SetValue: convert a char string to date value. */
/***********************************************************************/
void DTVAL::SetValue_psz(PCSZ p)
- {
+{
if (Pdtp) {
int ndv;
int dval[6];
@@ -2705,13 +2710,13 @@ void DTVAL::SetValue_psz(PCSZ p)
Null = (Nullable && Tval == 0);
} // endif Pdtp
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* DTVAL SetValue: set value with a value extracted from a block. */
/***********************************************************************/
void DTVAL::SetValue_pvblk(PVBLK blk, int n)
- {
+{
if (Pdtp && !::IsTypeNum(blk->GetType())) {
int ndv;
int dval[6];
@@ -2721,13 +2726,13 @@ void DTVAL::SetValue_pvblk(PVBLK blk, int n)
} else
Tval = blk->GetIntValue(n);
- } // end of SetValue
+} // end of SetValue
/***********************************************************************/
/* DTVAL GetCharString: get string representation of a date value. */
/***********************************************************************/
char *DTVAL::GetCharString(char *p)
- {
+{
if (Pdtp) {
size_t n = 0;
struct tm tm, *ptm= GetGmTime(&tm);
@@ -2746,7 +2751,7 @@ char *DTVAL::GetCharString(char *p)
//Null = false; ??????????????
return p;
- } // end of GetCharString
+} // end of GetCharString
/***********************************************************************/
/* DTVAL ShowValue: get string representation of a date value. */
@@ -2784,7 +2789,7 @@ int DTVAL::ShowValue(char *buf, int len)
/* Returns a member of the struct tm representation of the date. */
/***********************************************************************/
bool DTVAL::GetTmMember(OPVAL op, int& mval)
- {
+{
bool rc = false;
struct tm tm, *ptm = GetGmTime(&tm);
@@ -2797,10 +2802,10 @@ bool DTVAL::GetTmMember(OPVAL op, int& mval)
case OP_QUART: mval = ptm->tm_mon / 3 + 1; break;
default:
rc = true;
- } // endswitch op
+ } // endswitch op
return rc;
- } // end of GetTmMember
+} // end of GetTmMember
/***********************************************************************/
/* Calculates the week number of the year for the internal date value.*/
@@ -2811,7 +2816,7 @@ bool DTVAL::GetTmMember(OPVAL op, int& mval)
/* the week that contains the January 4th. */
/***********************************************************************/
bool DTVAL::WeekNum(PGLOBAL g, int& nval)
- {
+{
// w is the start of the week SUN=0, MON=1, etc.
int m, n, w = nval % 7;
struct tm tm, *ptm = GetGmTime(&tm);
@@ -2828,7 +2833,7 @@ bool DTVAL::WeekNum(PGLOBAL g, int& nval)
// Everything should be Ok
return false;
- } // end of WeekNum
+} // end of WeekNum
#endif // 0
/***********************************************************************/
@@ -2837,7 +2842,7 @@ bool DTVAL::WeekNum(PGLOBAL g, int& nval)
/* This function assumes that the format matches the value type. */
/***********************************************************************/
bool DTVAL::FormatValue(PVAL vp, PCSZ fmt)
- {
+{
char *buf = (char*)vp->GetTo_Val(); // Should be big enough
struct tm tm, *ptm = GetGmTime(&tm);
@@ -2854,6 +2859,6 @@ bool DTVAL::FormatValue(PVAL vp, PCSZ fmt)
} else
return true;
- } // end of FormatValue
+} // end of FormatValue
/* -------------------------- End of Value --------------------------- */
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index b03c9dfd002..e0e25442d71 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -429,6 +429,10 @@ int ha_heap::reset_auto_increment(ulonglong value)
int ha_heap::external_lock(THD *thd, int lock_type)
{
+#ifndef DBUG_OFF
+ if (lock_type == F_UNLCK && file->s->changed && heap_check_heap(file, 0))
+ return HA_ERR_CRASHED;
+#endif
return 0; // No external locking
}
diff --git a/storage/heap/hp_close.c b/storage/heap/hp_close.c
index 092048a7c1c..82d6186340a 100644
--- a/storage/heap/hp_close.c
+++ b/storage/heap/hp_close.c
@@ -35,12 +35,6 @@ int hp_close(register HP_INFO *info)
{
int error=0;
DBUG_ENTER("hp_close");
-#ifndef DBUG_OFF
- if (info->s->changed && heap_check_heap(info,0))
- {
- error=my_errno=HA_ERR_CRASHED;
- }
-#endif
info->s->changed=0;
if (info->open_list.data)
heap_open_list=list_delete(heap_open_list,&info->open_list);
diff --git a/storage/innobase/.clang-format b/storage/innobase/.clang-format
new file mode 100644
index 00000000000..54f7b47bc88
--- /dev/null
+++ b/storage/innobase/.clang-format
@@ -0,0 +1,11 @@
+UseTab: Always
+TabWidth: 8
+IndentWidth: 8
+ContinuationIndentWidth: 8
+BreakBeforeBinaryOperators: All
+PointerAlignment: Left
+BreakBeforeBraces: Custom
+ColumnLimit: 79
+BraceWrapping:
+ AfterFunction: true
+AccessModifierOffset: -8
diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc
index f2ad31f3a5d..387dad8dca1 100644
--- a/storage/innobase/btr/btr0bulk.cc
+++ b/storage/innobase/btr/btr0bulk.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2014, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -51,7 +51,7 @@ PageBulk::init()
m_heap = mem_heap_create(1000);
m_mtr.start();
- mtr_x_lock(&m_index->lock, &m_mtr);
+
if (m_flush_observer) {
m_mtr.set_log_mode(MTR_LOG_NO_REDO);
m_mtr.set_flush_observer(m_flush_observer);
@@ -607,22 +607,20 @@ PageBulk::storeExt(
btr_pcur.pos_state = BTR_PCUR_IS_POSITIONED;
btr_pcur.latch_mode = BTR_MODIFY_LEAF;
btr_pcur.btr_cur.index = m_index;
-
- page_cur_t* page_cur = &btr_pcur.btr_cur.page_cur;
- page_cur->index = m_index;
- page_cur->rec = m_cur_rec;
- page_cur->offsets = offsets;
- page_cur->block = m_block;
+ btr_pcur.btr_cur.page_cur.index = m_index;
+ btr_pcur.btr_cur.page_cur.rec = m_cur_rec;
+ btr_pcur.btr_cur.page_cur.offsets = offsets;
+ btr_pcur.btr_cur.page_cur.block = m_block;
dberr_t err = btr_store_big_rec_extern_fields(
&btr_pcur, offsets, big_rec, &m_mtr, BTR_STORE_INSERT_BULK);
- ut_ad(page_offset(m_cur_rec) == page_offset(page_cur->rec));
-
/* Reset m_block and m_cur_rec from page cursor, because
- block may be changed during blob insert. */
- m_block = page_cur->block;
- m_cur_rec = page_cur->rec;
+ block may be changed during blob insert. (FIXME: Can it really?) */
+ ut_ad(m_block == btr_pcur.btr_cur.page_cur.block);
+
+ m_block = btr_pcur.btr_cur.page_cur.block;
+ m_cur_rec = btr_pcur.btr_cur.page_cur.rec;
m_page = buf_block_get_frame(m_block);
return(err);
@@ -649,7 +647,7 @@ dberr_t
PageBulk::latch()
{
m_mtr.start();
- mtr_x_lock(&m_index->lock, &m_mtr);
+
if (m_flush_observer) {
m_mtr.set_log_mode(MTR_LOG_NO_REDO);
m_mtr.set_flush_observer(m_flush_observer);
@@ -754,6 +752,10 @@ BtrBulk::pageCommit(
page_bulk->setNext(FIL_NULL);
}
+ ut_ad(!rw_lock_own_flagged(&m_index->lock,
+ RW_LOCK_FLAG_X | RW_LOCK_FLAG_SX
+ | RW_LOCK_FLAG_S));
+
/* Compress page if it's a compressed table. */
if (page_bulk->getPageZip() != NULL && !page_bulk->compress()) {
return(pageSplit(page_bulk, next_page_bulk));
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index a1019e19cf6..8fc30796228 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -7415,7 +7415,7 @@ struct btr_blob_log_check_t {
ulint page_no = ULINT_UNDEFINED;
FlushObserver* observer = m_mtr->get_flush_observer();
- if (m_op == BTR_STORE_INSERT_BULK) {
+ if (UNIV_UNLIKELY(m_op == BTR_STORE_INSERT_BULK)) {
offs = page_offset(*m_rec);
page_no = page_get_page_no(
buf_block_get_frame(*m_block));
@@ -7438,8 +7438,7 @@ struct btr_blob_log_check_t {
index->set_modified(*m_mtr);
m_mtr->set_flush_observer(observer);
- if (m_op == BTR_STORE_INSERT_BULK) {
- mtr_x_lock(dict_index_get_lock(index), m_mtr);
+ if (UNIV_UNLIKELY(m_op == BTR_STORE_INSERT_BULK)) {
m_pcur->btr_cur.page_cur.block = btr_block_get(
*index, page_no, RW_X_LATCH, false, m_mtr);
m_pcur->btr_cur.page_cur.rec
@@ -7466,9 +7465,10 @@ struct btr_blob_log_check_t {
*m_rec,
MTR_MEMO_PAGE_X_FIX | MTR_MEMO_PAGE_SX_FIX));
- ut_ad(mtr_memo_contains_flagged(m_mtr,
- dict_index_get_lock(index),
- MTR_MEMO_SX_LOCK | MTR_MEMO_X_LOCK));
+ ut_ad((m_op == BTR_STORE_INSERT_BULK)
+ == !mtr_memo_contains_flagged(m_mtr, &index->lock,
+ MTR_MEMO_SX_LOCK
+ | MTR_MEMO_X_LOCK));
}
};
@@ -7522,8 +7522,10 @@ btr_store_big_rec_extern_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(rec_offs_any_extern(offsets));
- ut_ad(mtr_memo_contains_flagged(btr_mtr, dict_index_get_lock(index),
- MTR_MEMO_X_LOCK | MTR_MEMO_SX_LOCK));
+ ut_ad(op == BTR_STORE_INSERT_BULK
+ || mtr_memo_contains_flagged(btr_mtr, &index->lock,
+ MTR_MEMO_X_LOCK
+ | MTR_MEMO_SX_LOCK));
ut_ad(mtr_memo_contains(btr_mtr, rec_block, MTR_MEMO_PAGE_X_FIX));
ut_ad(buf_block_get_frame(rec_block) == page_align(rec));
ut_a(dict_index_is_clust(index));
@@ -7643,7 +7645,7 @@ btr_store_big_rec_extern_fields(
mtr_t *alloc_mtr;
- if (op == BTR_STORE_INSERT_BULK) {
+ if (UNIV_UNLIKELY(op == BTR_STORE_INSERT_BULK)) {
mtr_bulk.start();
mtr_bulk.set_spaces(mtr);
alloc_mtr = &mtr_bulk;
@@ -7666,7 +7668,7 @@ btr_store_big_rec_extern_fields(
index->table->space->release_free_extents(r_extents);
- if (op == BTR_STORE_INSERT_BULK) {
+ if (UNIV_UNLIKELY(op == BTR_STORE_INSERT_BULK)) {
mtr_bulk.commit();
}
@@ -7826,7 +7828,7 @@ btr_store_big_rec_extern_fields(
}
/* We compress a page when finish bulk insert.*/
- if (op != BTR_STORE_INSERT_BULK) {
+ if (UNIV_LIKELY(op != BTR_STORE_INSERT_BULK)) {
page_zip_write_blob_ptr(
page_zip, rec, index, offsets,
field_no, &mtr);
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index fcaf4b0ab3b..df4786a7e20 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -43,8 +43,7 @@ Created 4/24/1996 Heikki Tuuri
#include "rem0cmp.h"
#include "srv0start.h"
#include "srv0srv.h"
-#include <stack>
-#include <set>
+#include "fts0opt.h"
/** Following are the InnoDB system tables. The positions in
this array are referenced by enum dict_system_table_id. */
@@ -3079,8 +3078,12 @@ func_exit:
FTS */
fts_optimize_remove_table(table);
fts_free(table);
- } else {
+ } else if (fts_optimize_wq) {
fts_optimize_add_table(table);
+ } else {
+ /* fts_optimize_thread is not started yet.
+ So make the table as non-evictable from cache. */
+ dict_sys.prevent_eviction(table);
}
}
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 3f2f25f2485..db9c747a3b9 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1987,8 +1987,6 @@ fil_crypt_rotate_page(
return;
}
- ut_d(const bool was_free = fseg_page_is_free(space, (uint32_t)offset));
-
mtr_t mtr;
mtr.start();
if (buf_block_t* block = fil_crypt_get_page_throttle(state,
@@ -2003,9 +2001,9 @@ fil_crypt_rotate_page(
if (space->is_stopping()) {
/* The tablespace is closing (in DROP TABLE or
TRUNCATE TABLE or similar): avoid further access */
- } else if (!*reinterpret_cast<uint32_t*>(FIL_PAGE_OFFSET
- + frame)) {
- /* It looks like this page was never
+ } else if (!kv && !*reinterpret_cast<uint16_t*>
+ (&frame[FIL_PAGE_TYPE])) {
+ /* It looks like this page is not
allocated. Because key rotation is accessing
pages in a pattern that is unlike the normal
B-tree and undo log access pattern, we cannot
@@ -2015,9 +2013,20 @@ fil_crypt_rotate_page(
tablespace latch before acquiring block->lock,
then the fseg_page_is_free() information
could be stale already. */
- ut_ad(was_free);
- ut_ad(kv == 0);
- ut_ad(page_get_space_id(frame) == 0);
+
+ /* If the data file was originally created
+ before MariaDB 10.0 or MySQL 5.6, some
+ allocated data pages could carry 0 in
+ FIL_PAGE_TYPE. The FIL_PAGE_TYPE on those
+ pages will be updated in
+ buf_flush_init_for_writing() when the page
+ is modified the next time.
+
+ Also, when the doublewrite buffer pages are
+ allocated on bootstrap in a non-debug build,
+ some dummy pages will be allocated, with 0 in
+ the FIL_PAGE_TYPE. Those pages should be
+ skipped from key rotation forever. */
} else if (fil_crypt_needs_rotation(
crypt_data,
kv,
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index c248726913a..79307c36b01 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -2685,6 +2685,10 @@ retry:
}
if (read_only) {
+ /* InnoDB stores actual synced_doc_id value + 1 in
+ FTS_CONFIG table. Reduce the value by 1 while reading
+ after startup. */
+ if (*doc_id) *doc_id -= 1;
goto func_exit;
}
@@ -5316,11 +5320,11 @@ fts_t::fts_t(
const dict_table_t* table,
mem_heap_t* heap)
:
- in_queue(0), added_synced(0), dict_locked(0),
+ added_synced(0), dict_locked(0),
bg_threads(0),
add_wq(NULL),
cache(NULL),
- doc_col(ULINT_UNDEFINED),
+ doc_col(ULINT_UNDEFINED), in_queue(false),
fts_heap(heap)
{
ut_a(table->fts == NULL);
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index a7204974f84..d21107b4728 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -35,9 +35,10 @@ Completed 2011/7/10 Sunny and Jimmy Yang
#include "srv0start.h"
#include "ut0list.h"
#include "zlib.h"
+#include "fts0opt.h"
/** The FTS optimize thread's work queue. */
-static ib_wqueue_t* fts_optimize_wq;
+ib_wqueue_t* fts_optimize_wq;
/** The FTS vector to store fts_slot_t */
static ib_vector_t* fts_slots;
@@ -168,8 +169,8 @@ struct fts_encode_t {
/** We use this information to determine when to start the optimize
cycle for a table. */
struct fts_slot_t {
- /** table identifier, or 0 if the slot is empty */
- table_id_t table_id;
+ /** table, or NULL if the slot is unused */
+ dict_table_t* table;
/** whether this slot is being processed */
bool running;
@@ -2391,14 +2392,7 @@ fts_optimize_table_bk(
return(DB_SUCCESS);
}
- dict_table_t* table = dict_table_open_on_id(
- slot->table_id, FALSE, DICT_TABLE_OP_NORMAL);
-
- if (!table) {
- slot->last_run = now;
- return DB_SUCCESS;
- }
-
+ dict_table_t* table = slot->table;
dberr_t error;
if (fil_table_accessible(table)
@@ -2418,8 +2412,6 @@ fts_optimize_table_bk(
error = DB_SUCCESS;
}
- dict_table_close(table, FALSE, FALSE);
-
return(error);
}
/*********************************************************************//**
@@ -2564,11 +2556,13 @@ void fts_optimize_add_table(dict_table_t* table)
msg = fts_optimize_create_msg(FTS_MSG_ADD_TABLE, table);
- ib_wqueue_add(fts_optimize_wq, msg, msg->heap);
+ mutex_enter(&fts_optimize_wq->mutex);
+
+ ib_wqueue_add(fts_optimize_wq, msg, msg->heap, true);
- mutex_enter(&table->fts->bg_threads_mutex);
table->fts->in_queue = true;
- mutex_exit(&table->fts->bg_threads_mutex);
+
+ mutex_exit(&fts_optimize_wq->mutex);
}
/**********************************************************************//**
@@ -2595,12 +2589,10 @@ fts_optimize_remove_table(
return;
}
- fts_t* fts = table->fts;
- mutex_enter(&fts->bg_threads_mutex);
- bool is_in_optimize_queue = fts->in_queue;
- mutex_exit(&fts->bg_threads_mutex);
+ mutex_enter(&fts_optimize_wq->mutex);
- if (!is_in_optimize_queue) {
+ if (!table->fts->in_queue) {
+ mutex_exit(&fts_optimize_wq->mutex);
return;
}
@@ -2616,15 +2608,17 @@ fts_optimize_remove_table(
remove->event = event;
msg->ptr = remove;
- ib_wqueue_add(fts_optimize_wq, msg, msg->heap);
+ ib_wqueue_add(fts_optimize_wq, msg, msg->heap, true);
+
+ mutex_exit(&fts_optimize_wq->mutex);
os_event_wait(event);
os_event_destroy(event);
- mutex_enter(&fts->bg_threads_mutex);
- fts->in_queue = false;
- mutex_exit(&fts->bg_threads_mutex);
+ ut_d(mutex_enter(&fts_optimize_wq->mutex));
+ ut_ad(!table->fts->in_queue);
+ ut_d(mutex_exit(&fts_optimize_wq->mutex));
}
/** Send sync fts cache for the table.
@@ -2633,9 +2627,6 @@ void
fts_optimize_request_sync_table(
dict_table_t* table)
{
- fts_msg_t* msg;
- table_id_t* table_id;
-
/* if the optimize system not yet initialized, return */
if (!fts_optimize_wq) {
return;
@@ -2648,39 +2639,36 @@ fts_optimize_request_sync_table(
return;
}
- msg = fts_optimize_create_msg(FTS_MSG_SYNC_TABLE, NULL);
+ fts_msg_t* msg = fts_optimize_create_msg(FTS_MSG_SYNC_TABLE, table);
- table_id = static_cast<table_id_t*>(
- mem_heap_alloc(msg->heap, sizeof(table_id_t)));
- *table_id = table->id;
- msg->ptr = table_id;
+ mutex_enter(&fts_optimize_wq->mutex);
- ib_wqueue_add(fts_optimize_wq, msg, msg->heap);
+ ib_wqueue_add(fts_optimize_wq, msg, msg->heap, true);
- mutex_enter(&table->fts->bg_threads_mutex);
table->fts->in_queue = true;
- mutex_exit(&table->fts->bg_threads_mutex);
+
+ mutex_exit(&fts_optimize_wq->mutex);
}
/** Add a table to fts_slots if it doesn't already exist. */
static bool fts_optimize_new_table(dict_table_t* table)
{
+ ut_ad(table);
+
ulint i;
fts_slot_t* slot;
fts_slot_t* empty = NULL;
- const table_id_t table_id = table->id;
- ut_ad(table_id);
/* Search for duplicates, also find a free slot if one exists. */
for (i = 0; i < ib_vector_size(fts_slots); ++i) {
slot = static_cast<fts_slot_t*>(ib_vector_get(fts_slots, i));
- if (!slot->table_id) {
+ if (!slot->table) {
empty = slot;
- } else if (slot->table_id == table_id) {
+ } else if (slot->table == table) {
/* Already exists in our optimize queue. */
- return(FALSE);
+ return false;
}
}
@@ -2689,36 +2677,35 @@ static bool fts_optimize_new_table(dict_table_t* table)
memset(slot, 0x0, sizeof(*slot));
- slot->table_id = table->id;
- slot->running = false;
-
- return(TRUE);
+ slot->table = table;
+ return true;
}
/** Remove a table from fts_slots if it exists.
@param[in,out] table table to be removed from fts_slots */
static bool fts_optimize_del_table(const dict_table_t* table)
{
- const table_id_t table_id = table->id;
- ut_ad(table_id);
-
+ ut_ad(table);
for (ulint i = 0; i < ib_vector_size(fts_slots); ++i) {
fts_slot_t* slot;
slot = static_cast<fts_slot_t*>(ib_vector_get(fts_slots, i));
- if (slot->table_id == table_id) {
+ if (slot->table == table) {
if (fts_enable_diag_print) {
ib::info() << "FTS Optimize Removing table "
<< table->name;
}
- slot->table_id = 0;
- return(TRUE);
+ mutex_enter(&fts_optimize_wq->mutex);
+ slot->table->fts->in_queue = false;
+ mutex_exit(&fts_optimize_wq->mutex);
+ slot->table = NULL;
+ return true;
}
}
- return(FALSE);
+ return false;
}
/**********************************************************************//**
@@ -2732,7 +2719,7 @@ static ulint fts_optimize_how_many()
for (ulint i = 0; i < ib_vector_size(fts_slots); ++i) {
const fts_slot_t* slot = static_cast<const fts_slot_t*>(
ib_vector_get_const(fts_slots, i));
- if (slot->table_id == 0) {
+ if (!slot->table) {
continue;
}
@@ -2768,22 +2755,14 @@ static bool fts_is_sync_needed()
const fts_slot_t* slot = static_cast<const fts_slot_t*>(
ib_vector_get_const(fts_slots, i));
- if (slot->table_id == 0) {
- continue;
- }
-
- dict_table_t* table = dict_table_open_on_id(
- slot->table_id, FALSE, DICT_TABLE_OP_NORMAL);
- if (!table) {
+ if (!slot->table) {
continue;
}
- if (table->fts && table->fts->cache) {
- total_memory += table->fts->cache->total_size;
+ if (slot->table->fts && slot->table->fts->cache) {
+ total_memory += slot->table->fts->cache->total_size;
}
- dict_table_close(table, FALSE, FALSE);
-
if (total_memory > fts_max_total_cache_size) {
return(true);
}
@@ -2793,22 +2772,14 @@ static bool fts_is_sync_needed()
}
/** Sync fts cache of a table
-@param[in] table_id table id */
-static void fts_optimize_sync_table(table_id_t table_id)
+@param[in,out] table table to be synced */
+static void fts_optimize_sync_table(dict_table_t* table)
{
- if (dict_table_t* table = dict_table_open_on_id(
- table_id, FALSE, DICT_TABLE_OP_NORMAL)) {
- if (fil_table_accessible(table)
- && table->fts && table->fts->cache) {
- fts_sync_table(table, false);
- }
-
- DBUG_EXECUTE_IF(
- "ib_optimize_wq_hang",
- os_thread_sleep(6000000););
-
- dict_table_close(table, FALSE, FALSE);
+ if (table->fts && table->fts->cache && fil_table_accessible(table)) {
+ fts_sync_table(table, false);
}
+
+ DBUG_EXECUTE_IF("ib_optimize_wq_hang", os_thread_sleep(6000000););
}
/**********************************************************************//**
@@ -2847,7 +2818,7 @@ DECLARE_THREAD(fts_optimize_thread)(
ib_vector_get(fts_slots, current));
/* Handle the case of empty slots. */
- if (slot->table_id) {
+ if (slot->table) {
slot->running = true;
fts_optimize_table_bk(slot);
}
@@ -2906,7 +2877,7 @@ DECLARE_THREAD(fts_optimize_thread)(
os_thread_sleep(300000););
fts_optimize_sync_table(
- *static_cast<table_id_t*>(msg->ptr));
+ static_cast<dict_table_t*>(msg->ptr));
break;
default:
@@ -2925,8 +2896,8 @@ DECLARE_THREAD(fts_optimize_thread)(
fts_slot_t* slot = static_cast<fts_slot_t*>(
ib_vector_get(fts_slots, i));
- if (table_id_t table_id = slot->table_id) {
- fts_optimize_sync_table(table_id);
+ if (slot->table) {
+ fts_optimize_sync_table(slot->table);
}
}
}
@@ -2954,7 +2925,6 @@ fts_optimize_init(void)
{
mem_heap_t* heap;
ib_alloc_t* heap_alloc;
- dict_table_t* table;
ut_ad(!srv_read_only_mode);
@@ -2970,31 +2940,25 @@ fts_optimize_init(void)
heap_alloc = ib_heap_allocator_create(heap);
fts_slots = ib_vector_create(heap_alloc, sizeof(fts_slot_t), 4);
- /* Add fts tables to the fts_slots vector which were skipped during restart */
- std::vector<dict_table_t*> table_vector;
- std::vector<dict_table_t*>::iterator it;
-
+ /* Add fts tables to fts_slots which could be skipped
+ during dict_load_table_one() because fts_optimize_thread
+ wasn't even started. */
mutex_enter(&dict_sys.mutex);
- for (table = UT_LIST_GET_FIRST(dict_sys.table_LRU);
- table != NULL;
- table = UT_LIST_GET_NEXT(table_LRU, table)) {
- if (table->fts &&
- dict_table_has_fts_index(table)) {
- if (fts_optimize_new_table(table)){
- table_vector.push_back(table);
- }
+ for (dict_table_t* table = UT_LIST_GET_FIRST(dict_sys.table_LRU);
+ table != NULL;
+ table = UT_LIST_GET_NEXT(table_LRU, table)) {
+ if (!table->fts || !dict_table_has_fts_index(table)) {
+ continue;
}
- }
- /* It is better to call dict_table_prevent_eviction()
- outside the above loop because it operates on
- dict_sys.table_LRU list.*/
- for (it=table_vector.begin();it!=table_vector.end();++it) {
- dict_table_prevent_eviction(*it);
+ /* fts_optimize_thread is not started yet. So there is no
+ need to acquire fts_optimize_wq->mutex for adding the fts
+ table to the fts slots. */
+ ut_ad(!table->can_be_evicted);
+ fts_optimize_new_table(table);
+ table->fts->in_queue = true;
}
-
mutex_exit(&dict_sys.mutex);
- table_vector.clear();
fts_opt_shutdown_event = os_event_create(0);
last_check_sync_time = time(NULL);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2e5b3c50a87..90d2d904c0f 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -2464,11 +2464,10 @@ innobase_next_autoinc(
if (next_value == 0) {
ulonglong next;
- if (current >= offset) {
+ if (current > offset) {
next = (current - offset) / step;
} else {
- next = 0;
- block -= step;
+ next = (offset - current) / step;
}
ut_a(max_value > next);
@@ -16221,7 +16220,7 @@ ha_innobase::get_auto_increment(
if (increment > 1 && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE
&& autoinc < col_max_value) {
- ulonglong prev_auto_inc = autoinc;
+ ulonglong prev_auto_inc = autoinc;
autoinc = ((autoinc - 1) + increment - offset)/ increment;
@@ -16275,27 +16274,6 @@ ha_innobase::get_auto_increment(
current = *first_value;
- if (m_prebuilt->autoinc_increment != increment) {
-
- WSREP_DEBUG("autoinc decrease: %llu -> %llu\n"
- "THD: %ld, current: %llu, autoinc: %llu",
- m_prebuilt->autoinc_increment,
- increment,
- thd_get_thread_id(m_user_thd),
- current, autoinc);
- if (!wsrep_on(m_user_thd)) {
- current = autoinc
- - m_prebuilt->autoinc_increment;
- current = innobase_next_autoinc(
- current, 1, increment, offset, col_max_value);
- }
-
- dict_table_autoinc_initialize(
- m_prebuilt->table, current);
-
- *first_value = current;
- }
-
/* Compute the last value in the interval */
next_value = innobase_next_autoinc(
current, *nb_reserved_values, increment, offset,
@@ -19255,6 +19233,11 @@ static MYSQL_SYSVAR_ENUM(stats_method, srv_innodb_stats_method,
NULL, NULL, SRV_STATS_NULLS_EQUAL, &innodb_stats_method_typelib);
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+static MYSQL_SYSVAR_BOOL(change_buffer_dump, ibuf_dump,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Dump the change buffer at startup.",
+ NULL, NULL, FALSE);
+
static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,
PLUGIN_VAR_RQCMDARG,
"Debug flags for InnoDB change buffering (0=none, 1=try to buffer)",
@@ -19729,6 +19712,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(change_buffering),
MYSQL_SYSVAR(change_buffer_max_size),
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+ MYSQL_SYSVAR(change_buffer_dump),
MYSQL_SYSVAR(change_buffering_debug),
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
#ifdef WITH_INNODB_DISALLOW_WRITES
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index cffbf692fe7..565171529af 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -8789,25 +8789,21 @@ innobase_drop_foreign_try(
}
/** Rename a column in the data dictionary tables.
-@param[in] user_table InnoDB table that was being altered
-@param[in] trx Data dictionary transaction
+@param[in] ctx ALTER TABLE context
+@param[in,out] trx Data dictionary transaction
@param[in] table_name Table name in MySQL
@param[in] from old column name
@param[in] to new column name
-@param[in] new_clustered whether the table has been rebuilt
-@param[in] evict_fk_cache Evict the fk info from cache
@retval true Failure
@retval false Success */
static MY_ATTRIBUTE((nonnull, warn_unused_result))
bool
innobase_rename_column_try(
- const dict_table_t* user_table,
- trx_t* trx,
- const char* table_name,
- const char* from,
- const char* to,
- bool new_clustered,
- bool evict_fk_cache)
+ const ha_innobase_inplace_ctx& ctx,
+ trx_t* trx,
+ const char* table_name,
+ const char* from,
+ const char* to)
{
dberr_t error;
@@ -8817,7 +8813,7 @@ innobase_rename_column_try(
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_d(dict_sys.assert_locked());
- if (new_clustered) {
+ if (ctx.need_rebuild()) {
goto rename_foreign;
}
@@ -8826,7 +8822,7 @@ innobase_rename_column_try(
trx->op_info = "renaming column in SYS_FIELDS";
for (const dict_index_t* index = dict_table_get_first_index(
- user_table);
+ ctx.old_table);
index != NULL;
index = dict_table_get_next_index(index)) {
@@ -8886,8 +8882,8 @@ rename_foreign:
std::set<dict_foreign_t*> fk_evict;
bool foreign_modified;
- for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin();
- it != user_table->foreign_set.end();
+ for (dict_foreign_set::const_iterator it = ctx.old_table->foreign_set.begin();
+ it != ctx.old_table->foreign_set.end();
++it) {
dict_foreign_t* foreign = *it;
@@ -8900,6 +8896,14 @@ rename_foreign:
continue;
}
+ /* Ignore the foreign key rename if fk info
+ is being dropped. */
+ if (innobase_dropping_foreign(
+ foreign, ctx.drop_fk,
+ ctx.num_to_drop_fk)) {
+ continue;
+ }
+
pars_info_t* info = pars_info_create();
pars_info_add_str_literal(info, "id", foreign->id);
@@ -8928,8 +8932,8 @@ rename_foreign:
}
for (dict_foreign_set::const_iterator it
- = user_table->referenced_set.begin();
- it != user_table->referenced_set.end();
+ = ctx.old_table->referenced_set.begin();
+ it != ctx.old_table->referenced_set.end();
++it) {
foreign_modified = false;
@@ -8970,7 +8974,7 @@ rename_foreign:
}
/* Reload the foreign key info for instant table too. */
- if (new_clustered || evict_fk_cache) {
+ if (ctx.need_rebuild() || ctx.is_instant()) {
std::for_each(fk_evict.begin(), fk_evict.end(),
dict_foreign_remove_from_cache);
}
@@ -9017,11 +9021,9 @@ innobase_rename_columns_try(
while (Create_field* cf = cf_it++) {
if (cf->field == *fp) {
if (innobase_rename_column_try(
- ctx->old_table, trx, table_name,
+ *ctx, trx, table_name,
cf->field->field_name.str,
- cf->field_name.str,
- ctx->need_rebuild(),
- ctx->is_instant())) {
+ cf->field_name.str)) {
return(true);
}
goto processed_field;
@@ -9150,9 +9152,8 @@ innobase_rename_or_enlarge_column_try(
const bool same_name = !strcmp(col_name, f.field_name.str);
if (!same_name
- && innobase_rename_column_try(user_table, trx, table_name,
- col_name, f.field_name.str,
- false, ctx->is_instant())) {
+ && innobase_rename_column_try(*ctx, trx, table_name,
+ col_name, f.field_name.str)) {
DBUG_RETURN(true);
}
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 460359a96b4..55bcd331f27 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -181,6 +181,8 @@ access order rules. */
ulong innodb_change_buffering;
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+/** Dump the change buffer at startup */
+my_bool ibuf_dump;
/** Flag to control insert buffer debugging. */
uint ibuf_debug;
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
@@ -487,6 +489,25 @@ ibuf_init_at_db_start(void)
#endif /* BTR_CUR_ADAPT */
ibuf.index->page = FSP_IBUF_TREE_ROOT_PAGE_NO;
ut_d(ibuf.index->cached = TRUE);
+
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+ if (!ibuf_dump) {
+ return DB_SUCCESS;
+ }
+ ib::info() << "Dumping the change buffer";
+ ibuf_mtr_start(&mtr);
+ btr_pcur_t pcur;
+ if (DB_SUCCESS == btr_pcur_open_at_index_side(
+ true, ibuf.index, BTR_SEARCH_LEAF, &pcur,
+ true, 0, &mtr)) {
+ while (btr_pcur_move_to_next_user_rec(&pcur, &mtr)) {
+ rec_print_old(stderr, btr_pcur_get_rec(&pcur));
+ }
+ }
+ ibuf_mtr_commit(&mtr);
+ ib::info() << "Dumped the change buffer";
+#endif
+
return DB_SUCCESS;
}
diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h
index 0b20bfbe975..5e53dce8429 100644
--- a/storage/innobase/include/data0data.h
+++ b/storage/innobase/include/data0data.h
@@ -168,7 +168,7 @@ dfield_data_is_binary_equal(
const dfield_t* field, /*!< in: field */
ulint len, /*!< in: data length or UNIV_SQL_NULL */
const byte* data) /*!< in: data */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ MY_ATTRIBUTE((nonnull(1), warn_unused_result));
/*********************************************************************//**
Gets info bits in a data tuple.
diff --git a/storage/innobase/include/data0data.ic b/storage/innobase/include/data0data.ic
index be0186d53fe..92be8f8c589 100644
--- a/storage/innobase/include/data0data.ic
+++ b/storage/innobase/include/data0data.ic
@@ -225,7 +225,7 @@ dfield_data_is_binary_equal(
{
ut_ad(len != UNIV_SQL_DEFAULT);
return(len == dfield_get_len(field)
- && (len == UNIV_SQL_NULL
+ && (!len || len == UNIV_SQL_NULL
|| !memcmp(dfield_get_data(field), data, len)));
}
diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h
index d0e1ddaa664..d0da45ab218 100644
--- a/storage/innobase/include/dict0types.h
+++ b/storage/innobase/include/dict0types.h
@@ -141,6 +141,8 @@ struct table_name_t
};
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+/** Dump the change buffer at startup */
+extern my_bool ibuf_dump;
/** Flag to control insert buffer debugging. */
extern uint ibuf_debug;
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index 8643f0f79a3..74e0ee7b360 100644
--- a/storage/innobase/include/fts0fts.h
+++ b/storage/innobase/include/fts0fts.h
@@ -320,9 +320,6 @@ public:
/** Mutex protecting bg_threads* and fts_add_wq. */
ib_mutex_t bg_threads_mutex;
- /** Whether the table was added to fts_optimize_wq();
- protected by bg_threads_mutex */
- unsigned in_queue:1;
/** Whether the ADDED table record sync-ed after
crash recovery; protected by bg_threads_mutex */
unsigned added_synced:1;
@@ -348,6 +345,10 @@ public:
/** Vector of FTS indexes, this is mainly for caching purposes. */
ib_vector_t* indexes;
+ /** Whether the table exists in fts_optimize_wq;
+ protected by fts_optimize_wq mutex */
+ bool in_queue;
+
/** Heap for fts_t allocation. */
mem_heap_t* fts_heap;
};
diff --git a/storage/innobase/include/fts0opt.h b/storage/innobase/include/fts0opt.h
index 4b4d1c4c84a..c527ad8e528 100644
--- a/storage/innobase/include/fts0opt.h
+++ b/storage/innobase/include/fts0opt.h
@@ -25,6 +25,9 @@ Created 2011-02-15 Jimmy Yang
#ifndef INNODB_FTS0OPT_H
#define INNODB_FTS0OPT_H
+/** The FTS optimize thread's work queue. */
+extern ib_wqueue_t* fts_optimize_wq;
+
/********************************************************************
Callback function to fetch the rows in an FTS INDEX record. */
ibool
diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h
index 6d0f95cba19..fa22b3d3086 100644
--- a/storage/innobase/include/mem0mem.h
+++ b/storage/innobase/include/mem0mem.h
@@ -237,7 +237,10 @@ inline
void*
mem_heap_dup(mem_heap_t* heap, const void* data, size_t len)
{
- return(memcpy(mem_heap_alloc(heap, len), data, len));
+ ut_ad(data || !len);
+ return UNIV_LIKELY(data != NULL)
+ ? memcpy(mem_heap_alloc(heap, len), data, len)
+ : NULL;
}
/** Duplicate a NUL-terminated string, allocated from a memory heap.
diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h
index eae636d6b7d..0aadf59bfb2 100644
--- a/storage/innobase/include/rem0rec.h
+++ b/storage/innobase/include/rem0rec.h
@@ -1024,7 +1024,7 @@ rec_init_offsets_temp(
ulint n_core,
const dict_col_t::def_t*def_val,
rec_comp_status_t status = REC_STATUS_ORDINARY)
- MY_ATTRIBUTE((nonnull));
+ MY_ATTRIBUTE((nonnull(1,2,3)));
/** Determine the offset to each field in temporary file.
@param[in] rec temporary file record
@param[in] index index of that the record belongs to
diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h
index 87a72d88eb6..9b6aac9c548 100644
--- a/storage/innobase/include/row0ins.h
+++ b/storage/innobase/include/row0ins.h
@@ -146,9 +146,8 @@ row_ins_sec_index_entry(
dict_index_t* index, /*!< in: secondary index */
dtuple_t* entry, /*!< in/out: index entry to insert */
que_thr_t* thr, /*!< in: query thread */
- bool check_ref) /*!< in: TRUE if we want to check that
- the referenced table is ok, FALSE if we
- want to check the foreign key table */
+ bool check_foreign = true) /*!< in: true if check
+ foreign table is needed, false otherwise */
MY_ATTRIBUTE((warn_unused_result));
/***********************************************************//**
Inserts a row to a table. This is a high-level function used in
diff --git a/storage/innobase/include/ut0mem.h b/storage/innobase/include/ut0mem.h
index 1a430e98a10..414c00dfae8 100644
--- a/storage/innobase/include/ut0mem.h
+++ b/storage/innobase/include/ut0mem.h
@@ -30,29 +30,6 @@ Created 5/30/1994 Heikki Tuuri
#include "os0event.h"
#include "ut0mutex.h"
-/**********************************************************************//**
-Copies up to size - 1 characters from the NUL-terminated string src to
-dst, NUL-terminating the result. Returns strlen(src), so truncation
-occurred if the return value >= size.
-@return strlen(src) */
-ulint
-ut_strlcpy(
-/*=======*/
- char* dst, /*!< in: destination buffer */
- const char* src, /*!< in: source buffer */
- ulint size); /*!< in: size of destination buffer */
-
-/**********************************************************************//**
-Like ut_strlcpy, but if src doesn't fit in dst completely, copies the last
-(size - 1) bytes of src, not the first.
-@return strlen(src) */
-ulint
-ut_strlcpy_rev(
-/*===========*/
- char* dst, /*!< in: destination buffer */
- const char* src, /*!< in: source buffer */
- ulint size); /*!< in: size of destination buffer */
-
/********************************************************************
Concatenate 3 strings.*/
char*
diff --git a/storage/innobase/include/ut0wqueue.h b/storage/innobase/include/ut0wqueue.h
index 6a096a36894..5a895f4ea3c 100644
--- a/storage/innobase/include/ut0wqueue.h
+++ b/storage/innobase/include/ut0wqueue.h
@@ -38,7 +38,18 @@ processing.
// Forward declaration
struct ib_list_t;
-struct ib_wqueue_t;
+
+/** Work queue */
+struct ib_wqueue_t
+{
+ /** Mutex protecting everything */
+ ib_mutex_t mutex;
+ /** Work item list */
+ ib_list_t* items;
+ /** event we use to signal additions to list;
+ os_event_set() and os_event_reset() are protected by the mutex */
+ os_event_t event;
+};
/****************************************************************//**
Create a new work queue.
@@ -54,15 +65,14 @@ ib_wqueue_free(
/*===========*/
ib_wqueue_t* wq); /*!< in: work queue */
-/****************************************************************//**
-Add a work item to the queue. */
+/** Add a work item to the queue.
+@param[in,out] wq work queue
+@param[in] item work item
+@param[in,out] heap memory heap to use for allocating list node
+@param[in] wq_locked work queue mutex locked */
void
-ib_wqueue_add(
-/*==========*/
- ib_wqueue_t* wq, /*!< in: work queue */
- void* item, /*!< in: work item */
- mem_heap_t* heap); /*!< in: memory heap to use for
- allocating the list node */
+ib_wqueue_add(ib_wqueue_t* wq, void* item, mem_heap_t* heap,
+ bool wq_locked = false);
/** Check if queue is empty.
@param wq wait queue
@@ -101,5 +111,4 @@ ib_wqueue_len(
/*==========*/
ib_wqueue_t* wq); /*<! in: work queue */
-
#endif /* IB_WORK_QUEUE_H */
diff --git a/storage/innobase/mem/mem0mem.cc b/storage/innobase/mem/mem0mem.cc
index 929bffb881c..a298a7c0b2f 100644
--- a/storage/innobase/mem/mem0mem.cc
+++ b/storage/innobase/mem/mem0mem.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 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
@@ -228,6 +228,17 @@ mem_heap_validate(
ut_ad(size == heap->total_size);
}
+
+/** Copy the tail of a string.
+@param[in,out] dst destination buffer
+@param[in] src string whose tail to copy
+@param[in] size size of dst buffer, in bytes, including NUL terminator
+@return strlen(src) */
+static void ut_strlcpy_rev(char* dst, const char* src, ulint size)
+{
+ size_t src_size = strlen(src), n = std::min(src_size, size - 1);
+ memcpy(dst, src + src_size - n, n + 1);
+}
#endif /* UNIV_DEBUG */
/***************************************************************//**
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 40d77fa50eb..f9028122f8d 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -4577,19 +4577,23 @@ os_file_get_status_win32(
CloseHandle(fh);
}
}
+ stat_info->block_size = 0;
+ /* What follows, is calculation of FS block size, which is not important
+ (it is just shown in I_S innodb tables). The error to calculate it will be ignored.*/
char volname[MAX_PATH];
BOOL result = GetVolumePathName(path, volname, MAX_PATH);
-
+ static bool warned_once = false;
if (!result) {
-
- ib::error()
- << "os_file_get_status_win32: "
- << "Failed to get the volume path name for: "
- << path
- << "- OS error number " << GetLastError();
-
- return(DB_FAIL);
+ if (!warned_once) {
+ ib::warn()
+ << "os_file_get_status_win32: "
+ << "Failed to get the volume path name for: "
+ << path
+ << "- OS error number " << GetLastError();
+ warned_once = true;
+ }
+ return(DB_SUCCESS);
}
DWORD sectorsPerCluster;
@@ -4605,15 +4609,15 @@ os_file_get_status_win32(
&totalNumberOfClusters);
if (!result) {
-
- ib::error()
- << "GetDiskFreeSpace(" << volname << ",...) "
- << "failed "
- << "- OS error number " << GetLastError();
-
- return(DB_FAIL);
+ if (!warned_once) {
+ ib::warn()
+ << "GetDiskFreeSpace(" << volname << ",...) "
+ << "failed "
+ << "- OS error number " << GetLastError();
+ warned_once = true;
+ }
+ return(DB_SUCCESS);
}
-
stat_info->block_size = bytesPerSector * sectorsPerCluster;
} else {
stat_info->type = OS_FILE_TYPE_UNKNOWN;
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 5bb299193ed..b4b767df3e4 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -1972,10 +1972,7 @@ row_ins_check_foreign_constraints(
dict_index_t* index, /*!< in: index */
bool pk, /*!< in: index->is_primary() */
dtuple_t* entry, /*!< in: index entry for index */
- que_thr_t* thr, /*!< in: query thread */
- bool check_ref = true) /*!< in: TRUE if we want to check that
- the referenced table is ok, FALSE if we
- want to check the foreign key table */
+ que_thr_t* thr) /*!< in: query thread */
{
dict_foreign_t* foreign;
dberr_t err;
@@ -2024,7 +2021,7 @@ row_ins_check_foreign_constraints(
table from being dropped while the check is running. */
err = row_ins_check_foreign_constraint(
- check_ref, foreign, table, entry, thr);
+ TRUE, foreign, table, entry, thr);
if (referenced_table) {
foreign->foreign_table->dec_fk_checks();
@@ -3270,9 +3267,8 @@ row_ins_sec_index_entry(
dict_index_t* index, /*!< in: secondary index */
dtuple_t* entry, /*!< in/out: index entry to insert */
que_thr_t* thr, /*!< in: query thread */
- bool check_ref) /*!< in: true if we want to check that
- the referenced table is ok, false if we
- want to check the foreign key table */
+ bool check_foreign) /*!< in: true if check
+ foreign table is needed, false otherwise */
{
dberr_t err;
mem_heap_t* offsets_heap;
@@ -3283,10 +3279,9 @@ row_ins_sec_index_entry(
DBUG_SET("-d,row_ins_sec_index_entry_timeout");
return(DB_LOCK_WAIT);});
- if (!index->table->foreign_set.empty()) {
+ if (check_foreign && !index->table->foreign_set.empty()) {
err = row_ins_check_foreign_constraints(index->table, index,
- false, entry, thr,
- check_ref);
+ false, entry, thr);
if (err != DB_SUCCESS) {
return(err);
@@ -3361,7 +3356,7 @@ row_ins_index_entry(
if (index->is_primary()) {
return row_ins_clust_index_entry(index, entry, thr, 0);
} else {
- return(row_ins_sec_index_entry(index, entry, thr, true));
+ return row_ins_sec_index_entry(index, entry, thr);
}
}
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 180577ecdae..355f29acc08 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -2694,7 +2694,7 @@ write_buffers:
buf, fts_index, old_table,
new_table, psort_info, row, ext,
&doc_id, conv_heap,
- &err, &v_heap, table, trx)))) {
+ &err, &v_heap, eval_table, trx)))) {
/* An empty buffer should have enough
room for at least one record. */
ut_error;
diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc
index 88dea6c7995..becca3600dc 100644
--- a/storage/innobase/row/row0uins.cc
+++ b/storage/innobase/row/row0uins.cc
@@ -249,10 +249,8 @@ row_undo_ins_remove_sec_low(
que_thr_t* thr) /*!< in: query thread */
{
btr_pcur_t pcur;
- btr_cur_t* btr_cur;
dberr_t err = DB_SUCCESS;
mtr_t mtr;
- enum row_search_result search_result;
const bool modify_leaf = mode == BTR_MODIFY_LEAF;
row_mtr_start(&mtr, index, !modify_leaf);
@@ -277,12 +275,15 @@ row_undo_ins_remove_sec_low(
mode |= BTR_RTREE_UNDO_INS;
}
- search_result = row_search_index_entry(index, entry, mode,
- &pcur, &mtr);
-
- switch (search_result) {
+ switch (row_search_index_entry(index, entry, mode, &pcur, &mtr)) {
+ case ROW_BUFFERED:
+ case ROW_NOT_DELETED_REF:
+ /* These are invalid outcomes, because the mode passed
+ to row_search_index_entry() did not include any of the
+ flags BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK. */
+ ut_error;
case ROW_NOT_FOUND:
- goto func_exit;
+ break;
case ROW_FOUND:
if (dict_index_is_spatial(index)
&& rec_get_deleted_flag(
@@ -292,31 +293,22 @@ row_undo_ins_remove_sec_low(
<< " is deleted marked on insert rollback.";
ut_ad(0);
}
- break;
- case ROW_BUFFERED:
- case ROW_NOT_DELETED_REF:
- /* These are invalid outcomes, because the mode passed
- to row_search_index_entry() did not include any of the
- flags BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK. */
- ut_error;
- }
-
- btr_cur = btr_pcur_get_btr_cur(&pcur);
+ btr_cur_t* btr_cur = btr_pcur_get_btr_cur(&pcur);
- if (modify_leaf) {
- err = btr_cur_optimistic_delete(btr_cur, 0, &mtr)
- ? DB_SUCCESS : DB_FAIL;
- } else {
- /* Passing rollback=false here, because we are
- deleting a secondary index record: the distinction
- only matters when deleting a record that contains
- externally stored columns. */
- ut_ad(!dict_index_is_clust(index));
- btr_cur_pessimistic_delete(&err, FALSE, btr_cur, 0,
- false, &mtr);
+ if (modify_leaf) {
+ err = btr_cur_optimistic_delete(btr_cur, 0, &mtr)
+ ? DB_SUCCESS : DB_FAIL;
+ } else {
+ /* Passing rollback=false here, because we are
+ deleting a secondary index record: the distinction
+ only matters when deleting a record that contains
+ externally stored columns. */
+ btr_cur_pessimistic_delete(&err, FALSE, btr_cur, 0,
+ false, &mtr);
+ }
}
-func_exit:
+
btr_pcur_close(&pcur);
func_exit_no_pcur:
mtr_commit(&mtr);
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index 88d08f13c25..a3279a3c87b 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -2457,17 +2457,27 @@ row_upd_sec_index_entry(
case DB_NO_REFERENCED_ROW:
err = DB_SUCCESS;
break;
+ case DB_LOCK_WAIT:
+ if (wsrep_debug) {
+ ib::warn() << "WSREP: sec index FK lock wait"
+ << " index " << index->name
+ << " table " << index->table->name
+ << " query " << wsrep_thd_query(trx->mysql_thd);
+ }
+ break;
case DB_DEADLOCK:
if (wsrep_get_debug()) {
ib::warn() << "WSREP: sec index FK check fail for deadlock"
<< " index " << index->name
- << " table " << index->table->name;
+ << " table " << index->table->name
+ << " query " << wsrep_thd_query(trx->mysql_thd);
}
break;
default:
ib::error() << "WSREP: referenced FK check fail: " << ut_strerr(err)
<< " index " << index->name
- << " table " << index->table->name;
+ << " table " << index->table->name
+ << " query " << wsrep_thd_query(trx->mysql_thd);
break;
}
@@ -2509,8 +2519,7 @@ row_upd_sec_index_entry(
ut_a(entry);
/* Insert new index entry */
- err = row_ins_sec_index_entry(index, entry, thr,
- node->is_delete != VERSIONED_DELETE);
+ err = row_ins_sec_index_entry(index, entry, thr, !node->is_delete);
func_exit:
mem_heap_free(heap);
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index f5d98e8f05a..2db1fee062c 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -418,9 +418,15 @@ trx_undo_report_insert_virtual(
const dfield_t* vfield = dtuple_get_nth_v_field(
row, col->v_pos);
- ulint flen = vfield->len;
+ switch (ulint flen = vfield->len) {
+ case 0: case UNIV_SQL_NULL:
+ if (trx_undo_left(undo_block, *ptr) < 5) {
+ return(false);
+ }
- if (flen != UNIV_SQL_NULL) {
+ *ptr += mach_write_compressed(*ptr, flen);
+ break;
+ default:
ulint max_len
= dict_max_v_field_len_store_undo(
table, col_no);
@@ -437,12 +443,6 @@ trx_undo_report_insert_virtual(
memcpy(*ptr, vfield->data, flen);
*ptr += flen;
- } else {
- if (trx_undo_left(undo_block, *ptr) < 5) {
- return(false);
- }
-
- *ptr += mach_write_compressed(*ptr, flen);
}
}
}
@@ -521,7 +521,10 @@ trx_undo_page_report_insert(
ptr += mach_write_compressed(ptr, flen);
- if (flen != UNIV_SQL_NULL) {
+ switch (flen) {
+ case 0: case UNIV_SQL_NULL:
+ break;
+ default:
if (trx_undo_left(undo_block, ptr) < flen) {
return(0);
@@ -1447,7 +1450,10 @@ already_logged:
ptr += mach_write_compressed(ptr, flen);
- if (flen != UNIV_SQL_NULL) {
+ switch (flen) {
+ case 0: case UNIV_SQL_NULL:
+ break;
+ default:
if (trx_undo_left(undo_block, ptr)
< flen) {
return(0);
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 5d42650953b..bf26b5b20ef 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -79,7 +79,8 @@ trx_set_detailed_error(
trx_t* trx, /*!< in: transaction struct */
const char* msg) /*!< in: detailed error message */
{
- ut_strlcpy(trx->detailed_error, msg, MAX_DETAILED_ERROR_LEN);
+ strncpy(trx->detailed_error, msg, MAX_DETAILED_ERROR_LEN - 1);
+ trx->detailed_error[MAX_DETAILED_ERROR_LEN - 1] = '\0';
}
/*************************************************************//**
diff --git a/storage/innobase/ut/ut0mem.cc b/storage/innobase/ut/ut0mem.cc
index 32a90accd21..faade827283 100644
--- a/storage/innobase/ut/ut0mem.cc
+++ b/storage/innobase/ut/ut0mem.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 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
@@ -24,55 +25,6 @@ Created 5/11/1994 Heikki Tuuri
*************************************************************************/
#include "ut0mem.h"
-#include "os0thread.h"
-#include "srv0srv.h"
-#include <stdlib.h>
-
-/**********************************************************************//**
-Copies up to size - 1 characters from the NUL-terminated string src to
-dst, NUL-terminating the result. Returns strlen(src), so truncation
-occurred if the return value >= size.
-@return strlen(src) */
-ulint
-ut_strlcpy(
-/*=======*/
- char* dst, /*!< in: destination buffer */
- const char* src, /*!< in: source buffer */
- ulint size) /*!< in: size of destination buffer */
-{
- ulint src_size = strlen(src);
-
- if (size != 0) {
- ulint n = ut_min(src_size, size - 1);
-
- memcpy(dst, src, n);
- dst[n] = '\0';
- }
-
- return(src_size);
-}
-
-/**********************************************************************//**
-Like ut_strlcpy, but if src doesn't fit in dst completely, copies the last
-(size - 1) bytes of src, not the first.
-@return strlen(src) */
-ulint
-ut_strlcpy_rev(
-/*===========*/
- char* dst, /*!< in: destination buffer */
- const char* src, /*!< in: source buffer */
- ulint size) /*!< in: size of destination buffer */
-{
- ulint src_size = strlen(src);
-
- if (size != 0) {
- ulint n = ut_min(src_size, size - 1);
-
- memcpy(dst, src + src_size - n, n + 1);
- }
-
- return(src_size);
-}
/********************************************************************
Concatenate 3 strings.*/
diff --git a/storage/innobase/ut/ut0wqueue.cc b/storage/innobase/ut/ut0wqueue.cc
index 026431695ed..ae97009430e 100644
--- a/storage/innobase/ut/ut0wqueue.cc
+++ b/storage/innobase/ut/ut0wqueue.cc
@@ -28,15 +28,6 @@ A work queue
Created 4/26/2006 Osku Salerma
************************************************************************/
-/* Work queue. */
-struct ib_wqueue_t {
- ib_mutex_t mutex; /*!< mutex protecting everything */
- ib_list_t* items; /*!< work item list */
- os_event_t event; /*!< event we use to signal additions to list;
- os_event_set() and os_event_reset() are
- protected by ib_wqueue_t::mutex */
-};
-
/****************************************************************//**
Create a new work queue.
@return work queue */
@@ -72,22 +63,24 @@ ib_wqueue_free(
ut_free(wq);
}
-/****************************************************************//**
-Add a work item to the queue. */
+/** Add a work item to the queue.
+@param[in,out] wq work queue
+@param[in] item work item
+@param[in,out] heap memory heap to use for allocating list node
+@param[in] wq_locked work queue mutex locked */
void
-ib_wqueue_add(
-/*==========*/
- ib_wqueue_t* wq, /*!< in: work queue */
- void* item, /*!< in: work item */
- mem_heap_t* heap) /*!< in: memory heap to use for allocating the
- list node */
+ib_wqueue_add(ib_wqueue_t* wq, void* item, mem_heap_t* heap, bool wq_locked)
{
- mutex_enter(&wq->mutex);
+ if (!wq_locked) {
+ mutex_enter(&wq->mutex);
+ }
ib_list_add_last(wq->items, item, heap);
os_event_set(wq->event);
- mutex_exit(&wq->mutex);
+ if (!wq_locked) {
+ mutex_exit(&wq->mutex);
+ }
}
/****************************************************************//**
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 406de66bc9f..be7634f7521 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -6398,6 +6398,7 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn,
}
else if (lsn_korr(buff) >= lsn) /* Test if already applied */
{
+ check_skipped_lsn(info, lsn_korr(buff), 1, page);
/* Fix bitmap, just in case */
empty_space= uint2korr(buff + EMPTY_SPACE_OFFSET);
if (!enough_free_entries_on_page(share, buff))
@@ -6565,6 +6566,7 @@ uint _ma_apply_redo_purge_row_head_or_tail(MARIA_HA *info, LSN lsn,
Note that in case the page is not anymore a head or tail page
a future redo will fix the bitmap.
*/
+ check_skipped_lsn(info, lsn_korr(buff), 1, page);
if ((uint) (buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK) == page_type)
{
empty_space= uint2korr(buff+EMPTY_SPACE_OFFSET);
@@ -6735,6 +6737,7 @@ uint _ma_apply_redo_free_head_or_tail(MARIA_HA *info, LSN lsn,
if (lsn_korr(buff) >= lsn)
{
/* Already applied */
+ check_skipped_lsn(info, lsn_korr(buff), 1, page);
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
@@ -6912,8 +6915,7 @@ uint _ma_apply_redo_insert_row_blobs(MARIA_HA *info,
if (lsn_korr(buff) >= lsn)
{
/* Already applied */
- DBUG_PRINT("info", ("already applied %llu >= %llu",
- lsn_korr(buff), lsn));
+ check_skipped_lsn(info, lsn_korr(buff), 1, page);
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
diff --git a/storage/maria/ma_key_recover.c b/storage/maria/ma_key_recover.c
index ee2734548f4..afa69fce444 100644
--- a/storage/maria/ma_key_recover.c
+++ b/storage/maria/ma_key_recover.c
@@ -777,7 +777,7 @@ uint _ma_apply_redo_index_new_page(MARIA_HA *info, LSN lsn,
else if (lsn_korr(buff) >= lsn)
{
/* Already applied */
- DBUG_PRINT("info", ("Page is up to date, skipping redo"));
+ check_skipped_lsn(info, lsn_korr(buff), 0, root_page);
result= 0;
goto err;
}
@@ -865,6 +865,7 @@ uint _ma_apply_redo_index_free_page(MARIA_HA *info,
if (lsn_korr(buff) >= lsn)
{
/* Already applied */
+ check_skipped_lsn(info, lsn_korr(buff), 0, page);
result= 0;
goto err;
}
@@ -966,7 +967,7 @@ uint _ma_apply_redo_index(MARIA_HA *info,
if (lsn_korr(buff) >= lsn)
{
/* Already applied */
- DBUG_PRINT("info", ("Page is up to date, skipping redo"));
+ check_skipped_lsn(info, lsn_korr(buff), 0, page_pos);
result= 0;
goto err;
}
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 8f3c9d4bfac..a55026e3251 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -19,6 +19,9 @@
#include "ma_key_recover.h" /* For some in-write hooks */
#include "ma_checkpoint.h"
#include "ma_servicethread.h"
+#include "ma_recovery.h"
+#include "ma_loghandler_lsn.h"
+#include "ma_recovery_util.h"
/*
On Windows, neither my_open() nor mysql_file_sync() work for directories.
@@ -7906,6 +7909,34 @@ static my_bool translog_sync_files(uint32 min, uint32 max,
}
+/**
+ check_skipped_lsn
+
+ Check if lsn skipped in redo is ok
+*/
+
+void check_skipped_lsn(MARIA_HA *info, LSN lsn, my_bool index_file,
+ pgcache_page_no_t page)
+{
+ if (lsn <= log_descriptor.horizon)
+ {
+ DBUG_PRINT("info", ("Page is up to date, skipping redo"));
+ }
+ else
+ {
+ /* Give error, but don't flood the log */
+ if (skipped_lsn_err_count++ < 10 && ! info->s->redo_error_given++)
+ {
+ eprint(tracef, "Table %s has wrong LSN: " LSN_FMT " on page: %llu",
+ (index_file ? info->s->data_file_name.str :
+ info->s->index_file_name.str),
+ LSN_IN_PARTS(lsn), (ulonglong) page);
+ recovery_found_crashed_tables++;
+ }
+ }
+}
+
+
/*
@brief Flushes buffers with LSNs in them less or equal address <lsn>
diff --git a/storage/maria/ma_loghandler.h b/storage/maria/ma_loghandler.h
index 8234789e398..3e5c58a8053 100644
--- a/storage/maria/ma_loghandler.h
+++ b/storage/maria/ma_loghandler.h
@@ -386,6 +386,8 @@ int translog_soft_sync_start(void);
void translog_soft_sync_end(void);
void translog_sync();
void translog_set_group_commit_interval(uint32 interval);
+extern void check_skipped_lsn(MARIA_HA *info, LSN lsn, my_bool index_file,
+ pgcache_page_no_t page);
/*
all the rest added because of recovery; should we make
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index ae86de4b731..6ce158dd468 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -57,8 +57,7 @@ static my_bool trns_created;
static ulong skipped_undo_phase;
static ulonglong now; /**< for tracking execution time of phases */
static void (*save_error_handler_hook)(uint, const char *,myf);
-static uint recovery_warnings; /**< count of warnings */
-static uint recovery_found_crashed_tables;
+static ulong recovery_warnings; /**< count of warnings */
HASH tables_to_redo; /* For maria_read_log */
ulong maria_recovery_force_crash_counter;
TrID max_long_trid= 0; /**< max long trid seen by REDO phase */
@@ -291,6 +290,7 @@ int maria_apply_log(LSN from_lsn, LSN end_lsn,
DBUG_ASSERT(apply == MARIA_LOG_APPLY || !should_run_undo_phase);
DBUG_ASSERT(!maria_multi_threaded);
recovery_warnings= recovery_found_crashed_tables= 0;
+ skipped_lsn_err_count= 0;
maria_recovery_changed_data= 0;
/* checkpoints can happen only if TRNs have been built */
DBUG_ASSERT(should_run_undo_phase || !take_checkpoints);
diff --git a/storage/maria/ma_recovery.h b/storage/maria/ma_recovery.h
index 8084ce03f3b..0a75479365f 100644
--- a/storage/maria/ma_recovery.h
+++ b/storage/maria/ma_recovery.h
@@ -33,4 +33,6 @@ int maria_apply_log(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply,
/* Table of tables to recover */
extern HASH tables_to_redo;
extern ulong maria_recovery_force_crash_counter;
+extern ulong recovery_found_crashed_tables;
+extern uint skipped_lsn_err_count;
C_MODE_END
diff --git a/storage/maria/ma_recovery_util.c b/storage/maria/ma_recovery_util.c
index 3b617f625f0..fe43d812600 100644
--- a/storage/maria/ma_recovery_util.c
+++ b/storage/maria/ma_recovery_util.c
@@ -51,6 +51,8 @@ LSN checkpoint_start= LSN_IMPOSSIBLE;
my_bool procent_printed;
FILE *tracef; /**< trace file for debugging */
+ulong recovery_found_crashed_tables;
+uint skipped_lsn_err_count;
/** @brief Prints to a trace file if it is not NULL */
void tprint(FILE *trace_file __attribute__ ((unused)),
@@ -59,11 +61,12 @@ void tprint(FILE *trace_file __attribute__ ((unused)),
va_list args;
#ifndef DBUG_OFF
{
- char buff[1024], *end;
+ char buff[1024];
+ size_t length;
va_start(args, format);
- vsnprintf(buff, sizeof(buff)-1, format, args);
- if (*(end= strend(buff)) == '\n')
- *end= 0; /* Don't print end \n */
+ length= my_vsnprintf(buff, sizeof(buff)-1, format, args);
+ if (length && buff[length-1] == '\n')
+ buff[length-1]= 0; /* Don't print end \n */
DBUG_PRINT("info", ("%s", buff));
va_end(args);
}
diff --git a/storage/maria/ma_state.c b/storage/maria/ma_state.c
index da1cb5b4dcd..2eff64ec7cd 100644
--- a/storage/maria/ma_state.c
+++ b/storage/maria/ma_state.c
@@ -456,7 +456,7 @@ my_bool _ma_trnman_end_trans_hook(TRN *trn, my_bool commit,
MARIA_USED_TABLES *tables, *next;
DBUG_ENTER("_ma_trnman_end_trans_hook");
DBUG_PRINT("enter", ("trn: %p used_tables: %p", trn, trn->used_tables));
-
+
for (tables= (MARIA_USED_TABLES*) trn->used_tables;
tables;
tables= next)
@@ -580,7 +580,7 @@ void _ma_remove_table_from_trnman(MARIA_HA *info)
if (trn == &dummy_transaction_object)
DBUG_VOID_RETURN;
-
+
/* First remove share from used_tables */
for (prev= (MARIA_USED_TABLES**) (char*) &trn->used_tables;
(tables= *prev);
@@ -594,7 +594,7 @@ void _ma_remove_table_from_trnman(MARIA_HA *info)
break;
}
}
- if (tables != 0)
+ if (!tables)
{
/*
This can only happens in case of rename of intermediate table as
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index 13ae2a6150a..8f6106edb3d 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -514,6 +514,7 @@ typedef struct st_maria_share
my_bool have_versioning;
my_bool key_del_used; /* != 0 if key_del is locked */
my_bool deleting; /* we are going to delete this table */
+ my_bool redo_error_given; /* Used during recovery */
THR_LOCK lock;
void (*lock_restore_status)(void *);
/**
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 60d28481669..8488f9ee963 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -3010,7 +3010,7 @@ protected:
time_t tm;
tm = time(nullptr);
for (auto &it : modified_tables) {
- it->update_time = tm;
+ it->m_update_time = tm;
}
modified_tables.clear();
}
@@ -3018,6 +3018,7 @@ protected:
modified_tables.clear();
}
public:
+ // Inform the transaction that this table was modified
void log_table_write_op(Rdb_tbl_def *tbl) {
modified_tables.insert(tbl);
}
@@ -7725,8 +7726,6 @@ int ha_rocksdb::create_table(const std::string &table_name,
goto error;
}
- m_tbl_def->put_creation_time(&dict_manager, batch, time(nullptr));
-
err = dict_manager.commit(batch);
if (err != HA_EXIT_SUCCESS) {
dict_manager.unlock();
@@ -11044,11 +11043,11 @@ int ha_rocksdb::info(uint flag) {
}
}
- stats.create_time = m_tbl_def->get_creation_time(&dict_manager);
+ stats.create_time = m_tbl_def->get_create_time();
}
if (flag & HA_STATUS_TIME) {
- stats.update_time = m_tbl_def->update_time;
+ stats.update_time = m_tbl_def->m_update_time;
}
if (flag & HA_STATUS_ERRKEY) {
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/show_table_status.result b/storage/rocksdb/mysql-test/rocksdb/r/show_table_status.result
index 457a4822301..139d323bb1a 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/show_table_status.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/show_table_status.result
@@ -57,4 +57,80 @@ where table_schema=database() and table_name='t1';
create_time=@create_tm 1
timestampdiff(second, @update_tm, update_time) > 2 1
check_time NULL
+#
+# Check how create_time survives ALTER TABLE.
+# First, an ALTER TABLE that re-creates the table:
+alter table t1 add b int;
+select
+create_time<>@create_tm /* should change */,
+create_time IS NOT NULL,
+update_time IS NULL
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+create_time<>@create_tm 1
+create_time IS NOT NULL 1
+update_time IS NULL 1
+insert into t1 values (5,5);
+select create_time, update_time into @create_tm, @update_tm
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+# Then, an in-place ALTER TABLE:
+select sleep(2);
+sleep(2) 0
+alter table t1 add key (a);
+# create_time will change as .frm file is rewritten:
+select
+create_time=@create_tm,
+update_time
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+create_time=@create_tm 0
+update_time NULL
+# Check TRUNCATE TABLE
+insert into t1 values (10,10);
+select create_time, update_time into @create_tm, @update_tm
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+select sleep(2);
+sleep(2) 0
+truncate table t1;
+select
+create_time=@create_tm /* should not change */,
+update_time
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+create_time=@create_tm 1
+update_time NULL
+#
+# Check what is left after server restart
+#
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1);
+# Save t1's creation time
+create table t2 as
+select create_time
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+select sleep(2);
+sleep(2) 0
+# restart
+select
+create_time=(select create_time from t2) /* should not change */,
+update_time
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+create_time=(select create_time from t2) 1
+update_time NULL
+drop table t1, t2;
+#
+# Check how it works for partitioned tables
+#
+create table t1 (pk int primary key) partition by hash(pk) partitions 2;
+insert into t1 values (1);
+select create_time IS NOT NULL , update_time IS NOT NULL
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+create_time IS NOT NULL 1
+update_time IS NOT NULL 1
drop table t1;
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test b/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test
index 2aa4c4cc13a..55854710c31 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test
@@ -1,4 +1,5 @@
--source include/have_rocksdb.inc
+--source include/have_partition.inc
--source include/not_windows.inc # decorated database names is too long, exceeded OS limits
#
@@ -95,4 +96,80 @@ select
from information_schema.tables
where table_schema=database() and table_name='t1';
+--echo #
+--echo # Check how create_time survives ALTER TABLE.
+--echo # First, an ALTER TABLE that re-creates the table:
+alter table t1 add b int;
+select
+ create_time<>@create_tm /* should change */,
+ create_time IS NOT NULL,
+ update_time IS NULL
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+
+insert into t1 values (5,5);
+
+select create_time, update_time into @create_tm, @update_tm
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+
+--echo # Then, an in-place ALTER TABLE:
+select sleep(2);
+alter table t1 add key (a);
+
+--echo # create_time will change as .frm file is rewritten:
+select
+ create_time=@create_tm,
+ update_time
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+
+--echo # Check TRUNCATE TABLE
+insert into t1 values (10,10);
+select create_time, update_time into @create_tm, @update_tm
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+
+select sleep(2);
+truncate table t1;
+
+select
+ create_time=@create_tm /* should not change */,
+ update_time
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+
+
+--echo #
+--echo # Check what is left after server restart
+--echo #
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1);
+--echo # Save t1's creation time
+create table t2 as
+select create_time
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+
+select sleep(2);
+--source include/restart_mysqld.inc
+
+select
+ create_time=(select create_time from t2) /* should not change */,
+ update_time
+from information_schema.tables
+where table_schema=database() and table_name='t1';
+
+drop table t1, t2;
+
+--echo #
+--echo # Check how it works for partitioned tables
+--echo #
+create table t1 (pk int primary key) partition by hash(pk) partitions 2;
+insert into t1 values (1);
+
+select create_time IS NOT NULL , update_time IS NOT NULL
+from information_schema.tables
+where table_schema=database() and table_name='t1';
drop table t1;
diff --git a/storage/rocksdb/rdb_datadic.cc b/storage/rocksdb/rdb_datadic.cc
index 928ee55d3ce..0d43d4da5c4 100644
--- a/storage/rocksdb/rdb_datadic.cc
+++ b/storage/rocksdb/rdb_datadic.cc
@@ -3517,27 +3517,6 @@ Rdb_tbl_def::~Rdb_tbl_def() {
}
}
-void Rdb_tbl_def::put_creation_time(Rdb_dict_manager *dict_manager,
- rocksdb::WriteBatchBase *batch,
- time_t timeval) {
- dict_manager->put_creation_time(batch,
- m_key_descr_arr[0]->get_gl_index_id(),
- timeval);
- create_time = timeval;
-}
-
-time_t Rdb_tbl_def::get_creation_time(Rdb_dict_manager *dict_manager) {
- time_t tm;
- if (create_time == CREATE_TIME_UNKNOWN) {
- if (dict_manager->get_creation_time(m_key_descr_arr[0]->get_gl_index_id(),
- &tm))
- create_time = tm;
- else
- create_time = 0; // Not available
- }
- return create_time;
-}
-
/*
Put table definition DDL entry. Actual write is done at
Rdb_dict_manager::commit.
@@ -3613,6 +3592,26 @@ bool Rdb_tbl_def::put_dict(Rdb_dict_manager *const dict,
return false;
}
+time_t Rdb_tbl_def::get_create_time() {
+ time_t create_time = m_create_time;
+
+ if (create_time == CREATE_TIME_UNKNOWN) {
+ // Read it from the .frm file. It's not a problem if several threads do this
+ // concurrently
+ char path[FN_REFLEN];
+ snprintf(path, sizeof(path), "%s/%s/%s%s", mysql_data_home,
+ m_dbname.c_str(), m_tablename.c_str(), reg_ext);
+ unpack_filename(path,path);
+ MY_STAT f_stat;
+ if (my_stat(path, &f_stat, MYF(0)))
+ create_time = f_stat.st_ctime;
+ else
+ create_time = 0; // will be shown as SQL NULL
+ m_create_time = create_time;
+ }
+ return create_time;
+}
+
// Length that each index flag takes inside the record.
// Each index in the array maps to the enum INDEX_FLAG
static const std::array<uint, 1> index_flag_lengths = {
@@ -5364,7 +5363,6 @@ rocksdb::Status Rdb_dict_manager::put_auto_incr_val(
value_writer.to_slice());
}
-
bool Rdb_dict_manager::get_auto_incr_val(const GL_INDEX_ID &gl_index_id,
ulonglong *new_val) const {
Rdb_buf_writer<Rdb_key_def::INDEX_NUMBER_SIZE * 3> key_writer;
@@ -5384,51 +5382,6 @@ bool Rdb_dict_manager::get_auto_incr_val(const GL_INDEX_ID &gl_index_id,
return false;
}
-
-rocksdb::Status
-Rdb_dict_manager::put_creation_time(rocksdb::WriteBatchBase *batch,
- const GL_INDEX_ID &gl_index_id,
- time_t timeval) const {
- uchar key_buf[Rdb_key_def::INDEX_NUMBER_SIZE * 3] = {0};
- dump_index_id(key_buf, Rdb_key_def::TABLE_CREATION_TS, gl_index_id);
- const rocksdb::Slice key =
- rocksdb::Slice(reinterpret_cast<char *>(key_buf), sizeof(key_buf));
-
- // Value is constructed by storing the version and the value.
- uchar value_buf[RDB_SIZEOF_TABLE_CREATION_TS_VERSION +
- ROCKSDB_SIZEOF_TABLE_CREATION_TS] = {0};
- uchar *ptr = value_buf;
- rdb_netbuf_store_uint16(ptr, Rdb_key_def::TABLE_CREATION_TS_VERSION);
- ptr += RDB_SIZEOF_TABLE_CREATION_TS_VERSION;
- rdb_netbuf_store_uint64(ptr, timeval);
- ptr += ROCKSDB_SIZEOF_TABLE_CREATION_TS;
- const rocksdb::Slice value =
- rocksdb::Slice(reinterpret_cast<char *>(value_buf), ptr - value_buf);
-
- return batch->Put(m_system_cfh, key, value);
-}
-
-bool Rdb_dict_manager::get_creation_time(const GL_INDEX_ID &gl_index_id,
- time_t *new_val) const {
- uchar key_buf[Rdb_key_def::INDEX_NUMBER_SIZE * 3] = {0};
- dump_index_id(key_buf, Rdb_key_def::TABLE_CREATION_TS, gl_index_id);
-
- std::string value;
- const rocksdb::Status status = get_value(
- rocksdb::Slice(reinterpret_cast<char *>(key_buf), sizeof(key_buf)),
- &value);
-
- if (status.ok() && value.size() >= RDB_SIZEOF_TABLE_CREATION_TS_VERSION) {
- const uchar *const val = reinterpret_cast<const uchar *>(value.data());
-
- if (rdb_netbuf_to_uint16(val) <= Rdb_key_def::TABLE_CREATION_TS_VERSION) {
- *new_val = rdb_netbuf_to_uint64(val + RDB_SIZEOF_TABLE_CREATION_TS_VERSION);
- return true;
- }
- }
- return false;
-}
-
uint Rdb_seq_generator::get_and_update_next_number(
Rdb_dict_manager *const dict) {
DBUG_ASSERT(dict != nullptr);
diff --git a/storage/rocksdb/rdb_datadic.h b/storage/rocksdb/rdb_datadic.h
index ab67c839153..7bcc45d3f62 100644
--- a/storage/rocksdb/rdb_datadic.h
+++ b/storage/rocksdb/rdb_datadic.h
@@ -201,7 +201,6 @@ const size_t RDB_SIZEOF_INDEX_TYPE = sizeof(uchar);
const size_t RDB_SIZEOF_KV_VERSION = sizeof(uint16);
const size_t RDB_SIZEOF_INDEX_FLAGS = sizeof(uint32);
const size_t RDB_SIZEOF_AUTO_INCREMENT_VERSION = sizeof(uint16);
-const size_t RDB_SIZEOF_TABLE_CREATION_TS_VERSION = sizeof(uint16);
// Possible return values for rdb_index_field_unpack_t functions.
enum {
@@ -505,7 +504,6 @@ class Rdb_key_def {
MAX_INDEX_ID = 7,
DDL_CREATE_INDEX_ONGOING = 8,
AUTO_INC = 9,
- TABLE_CREATION_TS = 10,
END_DICT_INDEX_ID = 255
};
@@ -519,7 +517,6 @@ class Rdb_key_def {
MAX_INDEX_ID_VERSION = 1,
DDL_CREATE_INDEX_ONGOING_VERSION = 1,
AUTO_INCREMENT_VERSION = 1,
- TABLE_CREATION_TS_VERSION = 1
// Version for index stats is stored in IndexStats struct
};
@@ -1095,29 +1092,25 @@ class Rdb_tbl_def {
Rdb_tbl_def &operator=(const Rdb_tbl_def &) = delete;
explicit Rdb_tbl_def(const std::string &name)
- : m_key_descr_arr(nullptr), m_hidden_pk_val(0), m_auto_incr_val(0) {
+ : m_key_descr_arr(nullptr), m_hidden_pk_val(0), m_auto_incr_val(0),
+ m_update_time(0), m_create_time(CREATE_TIME_UNKNOWN) {
set_name(name);
}
Rdb_tbl_def(const char *const name, const size_t len)
- : m_key_descr_arr(nullptr), m_hidden_pk_val(0), m_auto_incr_val(0) {
+ : m_key_descr_arr(nullptr), m_hidden_pk_val(0), m_auto_incr_val(0),
+ m_update_time(0), m_create_time(CREATE_TIME_UNKNOWN) {
set_name(std::string(name, len));
}
explicit Rdb_tbl_def(const rocksdb::Slice &slice, const size_t pos = 0)
- : m_key_descr_arr(nullptr), m_hidden_pk_val(0), m_auto_incr_val(0) {
+ : m_key_descr_arr(nullptr), m_hidden_pk_val(0), m_auto_incr_val(0),
+ m_update_time(0), m_create_time(CREATE_TIME_UNKNOWN) {
set_name(std::string(slice.data() + pos, slice.size() - pos));
}
~Rdb_tbl_def();
- // time values are shown in SHOW TABLE STATUS
- void put_creation_time(Rdb_dict_manager *dict_manager,
- rocksdb::WriteBatchBase *batch, time_t timeval);
- time_t get_creation_time(Rdb_dict_manager *dict_manager);
-
- time_t update_time = 0; // in-memory only value, maintained right here
-
void check_and_set_read_free_rpl_table();
/* Number of indexes */
@@ -1144,11 +1137,14 @@ class Rdb_tbl_def {
const std::string &base_partition() const { return m_partition; }
GL_INDEX_ID get_autoincr_gl_index_id();
+ time_t get_create_time();
+ std::atomic<time_t> m_update_time; // in-memory only value
+
private:
const time_t CREATE_TIME_UNKNOWN= 1;
// CREATE_TIME_UNKNOWN means "didn't try to read, yet"
- // 0 means "no data available" (and SQL layer shares this)
- time_t create_time = CREATE_TIME_UNKNOWN;
+ // 0 means "no data available"
+ std::atomic<time_t> m_create_time;
};
/*
@@ -1363,10 +1359,6 @@ class Rdb_binlog_manager {
value: version, {max auto_increment so far}
max auto_increment is 8 bytes
- 10. Table creation timestamp
- key: Rdb_key_def::TABLE_CREATION_TIMESTAMP + cf_id + index_id
- value: timestamp
-
Data dictionary operations are atomic inside RocksDB. For example,
when creating a table with two indexes, it is necessary to call Put
three times. They have to be atomic. Rdb_dict_manager has a wrapper function
@@ -1525,11 +1517,6 @@ class Rdb_dict_manager {
bool overwrite = false) const;
bool get_auto_incr_val(const GL_INDEX_ID &gl_index_id,
ulonglong *new_val) const;
- rocksdb::Status put_creation_time(rocksdb::WriteBatchBase *batch,
- const GL_INDEX_ID &gl_index_id,
- time_t timeval_arg) const;
- bool get_creation_time(const GL_INDEX_ID &gl_index_id,
- time_t *new_val) const;
};
struct Rdb_index_info {
diff --git a/storage/rocksdb/rdb_global.h b/storage/rocksdb/rdb_global.h
index b058aace420..7213571bf61 100644
--- a/storage/rocksdb/rdb_global.h
+++ b/storage/rocksdb/rdb_global.h
@@ -228,8 +228,6 @@ const char *const RDB_TTL_COL_QUALIFIER = "ttl_col";
#define ROCKSDB_SIZEOF_AUTOINC_VALUE sizeof(longlong)
-#define ROCKSDB_SIZEOF_TABLE_CREATION_TS sizeof(uint64_t)
-
/*
Maximum index prefix length in bytes.
*/
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index c4f50e967cb..d1ead4ad415 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -91,6 +91,7 @@ CONFIGURE_FILE(tokudb.cnf.in tokudb.cnf @ONLY)
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-shadow")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla" DEBUG)
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough")
+MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-cpp" DEBUG)
############################################
MARK_AS_ADVANCED(BUILDNAME)
diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
index 9769b7db13d..b312111a3a2 100644
--- a/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
+++ b/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
@@ -1,39 +1,5 @@
include(ExternalProject)
-if (CMAKE_PROJECT_NAME STREQUAL TokuDB)
- ## add jemalloc with an external project
- set(JEMALLOC_SOURCE_DIR "${TokuDB_SOURCE_DIR}/third_party/jemalloc" CACHE FILEPATH "Where to find jemalloc sources.")
- if (EXISTS "${JEMALLOC_SOURCE_DIR}/configure")
- set(jemalloc_configure_opts "CC=${CMAKE_C_COMPILER}" "--with-jemalloc-prefix=" "--with-private-namespace=tokudb_jemalloc_internal_" "--enable-cc-silence")
- option(JEMALLOC_DEBUG "Build jemalloc with --enable-debug." OFF)
- if (JEMALLOC_DEBUG)
- list(APPEND jemalloc_configure_opts --enable-debug)
- endif ()
- ExternalProject_Add(build_jemalloc
- PREFIX jemalloc
- SOURCE_DIR "${JEMALLOC_SOURCE_DIR}"
- CONFIGURE_COMMAND
- "${JEMALLOC_SOURCE_DIR}/configure" ${jemalloc_configure_opts}
- "--prefix=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc"
- )
-
- add_library(jemalloc STATIC IMPORTED GLOBAL)
- set_target_properties(jemalloc PROPERTIES IMPORTED_LOCATION
- "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc_pic.a")
- add_dependencies(jemalloc build_jemalloc)
- add_library(jemalloc_nopic STATIC IMPORTED GLOBAL)
- set_target_properties(jemalloc_nopic PROPERTIES IMPORTED_LOCATION
- "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc.a")
- add_dependencies(jemalloc_nopic build_jemalloc)
-
- # detect when we are being built as a subproject
- if (NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING)
- install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib" DESTINATION .
- COMPONENT tokukv_libs_extra)
- endif ()
- endif ()
-endif ()
-
## add lzma with an external project
set(xz_configure_opts --with-pic --enable-static)
if (APPLE)
diff --git a/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash b/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash
index cd5743cddf2..3daa87ce03c 100644
--- a/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash
+++ b/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash
@@ -26,7 +26,7 @@ if [ ! -d build ] ; then
-D RUN_LONG_TESTS=ON \
-D TOKUDB_DATA=$tokudbdir/../tokudb.data \
..
- ninja build_jemalloc build_lzma build_snappy
+ ninja build_lzma build_snappy
popd
fi
diff --git a/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash b/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash
index 3c688581385..1ef819d8e37 100644
--- a/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash
+++ b/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash
@@ -25,7 +25,7 @@ if [ ! -d build ] ; then
-D RUN_LONG_TESTS=ON \
-D TOKUDB_DATA=$tokudbdir/../tokudb.data \
..
- ninja build_jemalloc build_lzma build_snappy
+ ninja build_lzma build_snappy
popd
fi
diff --git a/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash b/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash
index 80938bad8a6..c1039a0b28f 100644
--- a/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash
+++ b/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash
@@ -25,7 +25,7 @@ if [ ! -d build ] ; then
-D RUN_LONG_TESTS=ON \
-D TOKUDB_DATA=$tokudbdir/../tokudb.data \
..
- ninja build_jemalloc build_lzma build_snappy
+ ninja build_lzma build_snappy
popd
fi
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index c19a75d680d..614d47efe59 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -1077,7 +1077,8 @@ static inline int tokudb_generate_row(DB* dest_db,
}
buff = (uchar *)dest_key->data;
- assert_always(buff != NULL && max_key_len > 0);
+ assert_always(buff != nullptr);
+ assert_always(max_key_len > 0);
} else {
assert_unreachable();
}
diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h
index f95143a6b4b..fb1d2cd7a67 100644
--- a/storage/tokudb/ha_tokudb.h
+++ b/storage/tokudb/ha_tokudb.h
@@ -387,7 +387,8 @@ inline void TOKUDB_SHARE::init_cardinality_counts(
assert_debug(_mutex.is_owned_by_me());
// can not change number of keys live
- assert_always(_rec_per_key == NULL && _rec_per_keys == 0);
+ assert_always(_rec_per_key == nullptr);
+ assert_always(_rec_per_keys == 0);
_rec_per_keys = rec_per_keys;
_rec_per_key = rec_per_key;
}
diff --git a/storage/tokudb/hatoku_cmp.cc b/storage/tokudb/hatoku_cmp.cc
index d4bfa4e5b27..5f82d1e48be 100644
--- a/storage/tokudb/hatoku_cmp.cc
+++ b/storage/tokudb/hatoku_cmp.cc
@@ -957,9 +957,8 @@ static inline int tokudb_compare_two_hidden_keys(
const void* saved_key_data,
const uint32_t saved_key_size
) {
- assert_always(
- (new_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH) &&
- (saved_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH));
+ assert_always(new_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH);
+ assert_always(saved_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH);
ulonglong a = hpk_char_to_num((uchar *) new_key_data);
ulonglong b = hpk_char_to_num((uchar *) saved_key_data);
return a < b ? -1 : (a > b ? 1 : 0);
@@ -2537,7 +2536,8 @@ static uint32_t create_toku_secondary_key_pack_descriptor (
bool is_col_in_pk = false;
if (bitmap_is_set(&kc_info->key_filters[pk_index],field_index)) {
- assert_always(!has_hpk && prim_key != NULL);
+ assert_always(!has_hpk);
+ assert_always(prim_key != nullptr);
is_col_in_pk = true;
}
else {
diff --git a/storage/tokudb/tests/math_test_int.cc b/storage/tokudb/tests/math_test_int.cc
index 10085dbd704..3313bdf5895 100644
--- a/storage/tokudb/tests/math_test_int.cc
+++ b/storage/tokudb/tests/math_test_int.cc
@@ -54,16 +54,20 @@ static void test_int8() {
assert(over);
else if (m < -max)
assert(over);
- else
- assert(!over && n == m);
+ else {
+ assert(!over);
+ assert(n == m);
+ }
n = int_sub(x, y, 8, &over);
m = x - y;
if (m > max-1)
assert(over);
else if (m < -max)
assert(over);
- else
- assert(!over && n == m);
+ else {
+ assert(!over);
+ asset(n == m);
+ }
}
}
}
@@ -82,16 +86,20 @@ static void test_int16() {
assert(over);
else if (m < -max)
assert(over);
- else
- assert(!over && n == m);
+ else {
+ assert(!over);
+ assert(n == m);
+ }
n = int_sub(x, y, 16, &over);
m = x - y;
if (m > max-1)
assert(over);
else if (m < -max)
assert(over);
- else
- assert(!over && n == m);
+ else {
+ assert(!over);
+ assert(n == m);
+ }
}
}
}
@@ -104,20 +112,42 @@ static void test_int24() {
s = int_add(1, (1ULL<<23)-1, 24, &over); assert(over);
s = int_add((1ULL<<23)-1, 1, 24, &over); assert(over);
- s = int_sub(-1, (1ULL<<23), 24, &over); assert(!over && s == (1ULL<<23)-1);
+ s = int_sub(-1, (1ULL<<23), 24, &over);
+ assert(!over);
+ assert(s == (1ULL<<23)-1);
s = int_sub((1ULL<<23), 1, 24, &over); assert(over);
- s = int_add(0, 0, 24, &over); assert(!over && s == 0);
- s = int_sub(0, 0, 24, &over); assert(!over && s == 0);
- s = int_add(0, -1, 24, &over); assert(!over && s == -1);
- s = int_sub(0, 1, 24, &over); assert(!over && s == -1);
- s = int_add(0, (1ULL<<23), 24, &over); assert(!over && (s & ((1ULL<<24)-1)) == (1ULL<<23));
- s = int_sub(0, (1ULL<<23)-1, 24, &over); assert(!over && (s & ((1ULL<<24)-1)) == (1ULL<<23)+1);
-
- s = int_add(-1, 0, 24, &over); assert(!over && s == -1);
- s = int_add(-1, 1, 24, &over); assert(!over && s == 0);
- s = int_sub(-1, -1, 24, &over); assert(!over && s == 0);
- s = int_sub(-1, (1ULL<<23)-1, 24, &over); assert(!over && (s & ((1ULL<<24)-1)) == (1ULL<<23));
+ s = int_add(0, 0, 24, &over);
+ assert(!over);
+ assert(s == 0);
+ s = int_sub(0, 0, 24, &over);
+ assert(!over);
+ assert(s == 0);
+ s = int_add(0, -1, 24, &over);
+ assert(!over);
+ assert(s == -1);
+ s = int_sub(0, 1, 24, &over);
+ assert(!over);
+ assert(s == -1);
+ s = int_add(0, (1ULL<<23), 24, &over);
+ assert(!over);
+ assert((s & ((1ULL<<24)-1)) == (1ULL<<23));
+ s = int_sub(0, (1ULL<<23)-1, 24, &over);
+ assert(!over);
+ assert((s & ((1ULL<<24)-1)) == (1ULL<<23)+1);
+
+ s = int_add(-1, 0, 24, &over);
+ assert(!over);
+ assert(s == -1);
+ s = int_add(-1, 1, 24, &over);
+ assert(!over);
+ assert(s == 0);
+ s = int_sub(-1, -1, 24, &over);
+ assert(!over);
+ assert(s == 0);
+ s = int_sub(-1, (1ULL<<23)-1, 24, &over);
+ assert(!over);
+ assert((s & ((1ULL<<24)-1)) == (1ULL<<23));
}
static void test_int32() {
@@ -128,20 +158,42 @@ static void test_int32() {
s = int_add(1, (1ULL<<31)-1, 32, &over); assert(over);
s = int_add((1ULL<<31)-1, 1, 32, &over); assert(over);
- s = int_sub(-1, (1ULL<<31), 32, &over); assert(s == (1ULL<<31)-1 && !over);
+ s = int_sub(-1, (1ULL<<31), 32, &over);
+ assert(s == (1ULL<<31)-1);
+ assert(!over);
s = int_sub((1ULL<<31), 1, 32, &over); assert(over);
- s = int_add(0, 0, 32, &over); assert(s == 0 && !over);
- s = int_sub(0, 0, 32, &over); assert(s == 0 && !over);
- s = int_add(0, -1, 32, &over); assert(s == -1 && !over);
- s = int_sub(0, 1, 32, &over); assert(s == -1 && !over);
- s = int_add(0, (1ULL<<31), 32, &over); assert((s & ((1ULL<<32)-1)) == (1ULL<<31) && !over);
- s = int_sub(0, (1ULL<<31)-1, 32, &over); assert((s & ((1ULL<<32)-1)) == (1ULL<<31)+1 && !over);
-
- s = int_add(-1, 0, 32, &over); assert(s == -1 && !over);
- s = int_add(-1, 1, 32, &over); assert(s == 0 && !over);
- s = int_sub(-1, -1, 32, &over); assert(s == 0 && !over);
- s = int_sub(-1, (1ULL<<31)-1, 32, &over); assert((s & ((1ULL<<32)-1)) == (1ULL<<31) && !over);
+ s = int_add(0, 0, 32, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_sub(0, 0, 32, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_add(0, -1, 32, &over);
+ assert(s == -1);
+ assert(!over);
+ s = int_sub(0, 1, 32, &over);
+ assert(s == -1);
+ assert(!over);
+ s = int_add(0, (1ULL<<31), 32, &over);
+ assert((s & ((1ULL<<32)-1)) == (1ULL<<31));
+ assert(!over);
+ s = int_sub(0, (1ULL<<31)-1, 32, &over);
+ assert((s & ((1ULL<<32)-1)) == (1ULL<<31)+1);
+ assert(!over);
+
+ s = int_add(-1, 0, 32, &over);
+ assert(s == -1);
+ assert(!over);
+ s = int_add(-1, 1, 32, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_sub(-1, -1, 32, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_sub(-1, (1ULL<<31)-1, 32, &over);
+ assert((s & ((1ULL<<32)-1)) == (1ULL<<31));
+ assert(!over);
}
static void test_int64() {
@@ -152,20 +204,42 @@ static void test_int64() {
s = int_add(1, (1ULL<<63)-1, 64, &over); assert(over);
s = int_add((1ULL<<63)-1, 1, 64, &over); assert(over);
- s = int_sub(-1, (1ULL<<63), 64, &over); assert(s == (1ULL<<63)-1 && !over);
+ s = int_sub(-1, (1ULL<<63), 64, &over);
+ assert(s == (1ULL<<63)-1);
+ assert(!over);
s = int_sub((1ULL<<63), 1, 64, &over); assert(over);
- s = int_add(0, 0, 64, &over); assert(s == 0 && !over);
- s = int_sub(0, 0, 64, &over); assert(s == 0 && !over);
- s = int_add(0, -1, 64, &over); assert(s == -1 && !over);
- s = int_sub(0, 1, 64, &over); assert(s == -1 && !over);
- s = int_add(0, (1ULL<<63), 64, &over); assert(s == (int64_t)(1ULL<<63) && !over);
- s = int_sub(0, (1ULL<<63)-1, 64, &over); assert(s == (int64_t)((1ULL<<63)+1) && !over);
-
- s = int_add(-1, 0, 64, &over); assert(s == -1 && !over);
- s = int_add(-1, 1, 64, &over); assert(s == 0 && !over);
- s = int_sub(-1, -1, 64, &over); assert(s == 0 && !over);
- s = int_sub(-1, (1ULL<<63)-1, 64, &over); assert(s == (int64_t)(1ULL<<63) && !over);
+ s = int_add(0, 0, 64, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_sub(0, 0, 64, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_add(0, -1, 64, &over);
+ assert(s == -1);
+ assert(!over);
+ s = int_sub(0, 1, 64, &over);
+ assert(s == -1);
+ assert(!over);
+ s = int_add(0, (1ULL<<63), 64, &over);
+ assert(s == (int64_t)(1ULL<<63));
+ assert(!over);
+ s = int_sub(0, (1ULL<<63)-1, 64, &over);
+ assert(s == (int64_t)((1ULL<<63)+1));
+ assert(!over);
+
+ s = int_add(-1, 0, 64, &over);
+ assert(s == -1);
+ assert(!over);
+ s = int_add(-1, 1, 64, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_sub(-1, -1, 64, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_sub(-1, (1ULL<<63)-1, 64, &over);
+ assert(s == (int64_t)(1ULL<<63));
+ assert(!over);
}
static void test_int_sign(uint length_bits) {
diff --git a/storage/tokudb/tests/math_test_uint.cc b/storage/tokudb/tests/math_test_uint.cc
index 2fc8de8e093..2c5c9261c89 100644
--- a/storage/tokudb/tests/math_test_uint.cc
+++ b/storage/tokudb/tests/math_test_uint.cc
@@ -51,14 +51,18 @@ static void test_uint8() {
m = x + y;
if (m > (1ULL<<8)-1)
assert(over);
- else
- assert(!over && n == (m % 256));
+ else {
+ assert(!over);
+ assert(n == (m % 256));
+ }
n = uint_sub(x, y, 8, &over);
m = x - y;
if (m > x)
assert(over);
- else
- assert(!over && n == (m % 256));
+ else {
+ assert(!over);
+ assert(n == (m % 256));
+ }
}
}
}
@@ -75,14 +79,18 @@ static void test_uint16() {
m = x + y;
if (m > (1ULL<<16)-1)
assert(over);
- else
- assert(!over && n == (m % (1ULL<<16)));
+ else {
+ assert(!over);
+ assert(n == (m % (1ULL<<16)));
+ }
n = uint_sub(x, y, 16, &over);
m = x - y;
if (m > x)
assert(over);
- else
- assert(!over && n == (m % (1ULL<<16)));
+ else {
+ assert(!over);
+ assert(n == (m % (1ULL<<16)));
+ }
}
}
}
@@ -95,13 +103,23 @@ static void test_uint24() {
s = uint_add((1ULL<<24)-1, (1ULL<<24)-1, 24, &over); assert(over);
s = uint_add((1ULL<<24)-1, 1, 24, &over); assert(over);
- s = uint_add((1ULL<<24)-1, 0, 24, &over); assert(!over && s == (1ULL<<24)-1);
- s = uint_add(0, 1, 24, &over); assert(!over && s == 1);
- s = uint_add(0, 0, 24, &over); assert(!over && s == 0);
- s = uint_sub(0, 0, 24, &over); assert(!over && s == 0);
+ s = uint_add((1ULL<<24)-1, 0, 24, &over);
+ assert(!over);
+ assert(s == (1ULL<<24)-1);
+ s = uint_add(0, 1, 24, &over);
+ assert(!over);
+ assert(s == 1);
+ s = uint_add(0, 0, 24, &over);
+ assert(!over);
+ assert(s == 0);
+ s = uint_sub(0, 0, 24, &over);
+ assert(!over);
+ assert(s == 0);
s = uint_sub(0, 1, 24, &over); assert(over);
s = uint_sub(0, (1ULL<<24)-1, 24, &over); assert(over);
- s = uint_sub((1ULL<<24)-1, (1ULL<<24)-1, 24, &over); assert(!over && s == 0);
+ s = uint_sub((1ULL<<24)-1, (1ULL<<24)-1, 24, &over);
+ assert(!over);
+ assert(s == 0);
}
static void test_uint32() {
@@ -112,13 +130,23 @@ static void test_uint32() {
s = uint_add((1ULL<<32)-1, (1ULL<<32)-1, 32, &over); assert(over);
s = uint_add((1ULL<<32)-1, 1, 32, &over); assert(over);
- s = uint_add((1ULL<<32)-1, 0, 32, &over); assert(!over && s == (1ULL<<32)-1);
- s = uint_add(0, 1, 32, &over); assert(!over && s == 1);
- s = uint_add(0, 0, 32, &over); assert(!over && s == 0);
- s = uint_sub(0, 0, 32, &over); assert(!over && s == 0);
+ s = uint_add((1ULL<<32)-1, 0, 32, &over);
+ assert(!over);
+ assert(s == (1ULL<<32)-1);
+ s = uint_add(0, 1, 32, &over);
+ assert(!over);
+ assert(s == 1);
+ s = uint_add(0, 0, 32, &over);
+ assert(!over);
+ assert(s == 0);
+ s = uint_sub(0, 0, 32, &over);
+ assert(!over);
+ assert(s == 0);
s = uint_sub(0, 1, 32, &over); assert(over);
s = uint_sub(0, (1ULL<<32)-1, 32, &over); assert(over);
- s = uint_sub((1ULL<<32)-1, (1ULL<<32)-1, 32, &over); assert(!over && s == 0);
+ s = uint_sub((1ULL<<32)-1, (1ULL<<32)-1, 32, &over);
+ assert(!over);
+ assert(s == 0);
}
static void test_uint64() {
@@ -129,13 +157,23 @@ static void test_uint64() {
s = uint_add(~0ULL, ~0ULL, 64, &over); assert(over);
s = uint_add(~0ULL, 1, 64, &over); assert(over);
- s = uint_add(~0ULL, 0, 64, &over); assert(!over && s == ~0ULL);
- s = uint_add(0, 1, 64, &over); assert(!over && s == 1);
- s = uint_add(0, 0, 64, &over); assert(!over && s == 0);
- s = uint_sub(0, 0, 64, &over); assert(!over && s == 0);
+ s = uint_add(~0ULL, 0, 64, &over);
+ assert(!over);
+ assert(s == ~0ULL);
+ s = uint_add(0, 1, 64, &over);
+ assert(!over);
+ assert(s == 1);
+ s = uint_add(0, 0, 64, &over);
+ assert(!over);
+ assert(s == 0);
+ s = uint_sub(0, 0, 64, &over);
+ assert(!over);
+ assert(s == 0);
s = uint_sub(0, 1, 64, &over); assert(over);
s = uint_sub(0, ~0ULL, 64, &over); assert(over);
- s = uint_sub(~0ULL, ~0ULL, 64, &over); assert(!over && s == 0);
+ s = uint_sub(~0ULL, ~0ULL, 64, &over);
+ assert(!over);
+ assert(s == 0);
}
int main() {
diff --git a/storage/tokudb/tests/sint_test.cc b/storage/tokudb/tests/sint_test.cc
index 9078ae87281..7823ee5a692 100644
--- a/storage/tokudb/tests/sint_test.cc
+++ b/storage/tokudb/tests/sint_test.cc
@@ -27,7 +27,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
-#include <assert.h>
#include <sys/types.h>
#include <tokudb_math.h>
diff --git a/storage/tokudb/tests/tokudb_buffer_test.cc b/storage/tokudb/tests/tokudb_buffer_test.cc
index a786cdf4592..7e296790d39 100644
--- a/storage/tokudb/tests/tokudb_buffer_test.cc
+++ b/storage/tokudb/tests/tokudb_buffer_test.cc
@@ -32,9 +32,13 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
static void test_null() {
tokudb::buffer b;
- assert(b.data() == NULL && b.size() == 0 && b.limit() == 0);
+ assert(b.data() == nullptr);
+ assert(b.size() == 0);
+ assert(b.limit() == 0);
b.append(NULL, 0);
- assert(b.data() == NULL && b.size() == 0 && b.limit() == 0);
+ assert(b.data() == nullptr);
+ assert(b.size() == 0);
+ assert(b.limit() == 0);
}
static void append_az(tokudb::buffer &b) {
@@ -132,7 +136,8 @@ static void test_replace_grow() {
}
for (size_t i = 0; i < a.size()/2; i++) {
unsigned char *cp = (unsigned char *) a.data() + 2*i;
- assert(cp[0] == 'a'+i && cp[1] == 'a'+i);
+ assert(cp[0] == 'a'+i);
+ assert(cp[1] == 'a'+i);
}
}
diff --git a/storage/tokudb/tests/uint_test.cc b/storage/tokudb/tests/uint_test.cc
index b2c653b8fdd..e3aa1a6fe2f 100644
--- a/storage/tokudb/tests/uint_test.cc
+++ b/storage/tokudb/tests/uint_test.cc
@@ -27,7 +27,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
-#include <assert.h>
#include <sys/types.h>
#include <tokudb_math.h>
diff --git a/storage/tokudb/tests/vlq_test.cc b/storage/tokudb/tests/vlq_test.cc
index 80d797339b4..12b222f06c1 100644
--- a/storage/tokudb/tests/vlq_test.cc
+++ b/storage/tokudb/tests/vlq_test.cc
@@ -52,7 +52,8 @@ static void test_vlq_uint32_error(void) {
in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, 1);
assert(in_s == 0);
in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, 2);
- assert(in_s == 2 && n == 128);
+ assert(in_s == 2);
+ assert(n == 128);
}
static void test_80000000(void) {
@@ -63,7 +64,8 @@ static void test_80000000(void) {
out_s = tokudb::vlq_encode_ui<uint64_t>(v, b, sizeof b);
assert(out_s == 5);
in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 5 && n == v);
+ assert(in_s == 5);
+ assert(n == v);
}
static void test_100000000(void) {
@@ -74,7 +76,8 @@ static void test_100000000(void) {
out_s = tokudb::vlq_encode_ui<uint64_t>(v, b, sizeof b);
assert(out_s == 5);
in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 5 && n == v);
+ assert(in_s == 5);
+ assert(n == v);
}
int main(void) {
diff --git a/storage/tokudb/tests/vlq_test_uint32.cc b/storage/tokudb/tests/vlq_test_uint32.cc
index c5661b33ab5..3cc8af771a9 100644
--- a/storage/tokudb/tests/vlq_test_uint32.cc
+++ b/storage/tokudb/tests/vlq_test_uint32.cc
@@ -44,7 +44,8 @@ static void test_vlq_uint32(void) {
assert(out_s == 1);
uint32_t n;
size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s);
- assert(in_s == 1 && n == v);
+ assert(in_s == 1);
+ assert(n == v);
}
printf("%u\n", 1<<7);
@@ -54,7 +55,8 @@ static void test_vlq_uint32(void) {
assert(out_s == 2);
uint32_t n;
size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s);
- assert(in_s == 2 && n == v);
+ assert(in_s == 2);
+ assert(n == v);
}
printf("%u\n", 1<<14);
@@ -64,7 +66,8 @@ static void test_vlq_uint32(void) {
assert(out_s == 3);
uint32_t n;
size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s);
- assert(in_s == 3 && n == v);
+ assert(in_s == 3);
+ assert(n == v);
}
printf("%u\n", 1<<21);
@@ -74,7 +77,8 @@ static void test_vlq_uint32(void) {
assert(out_s == 4);
uint32_t n;
size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s);
- assert(in_s == 4 && n == v);
+ assert(in_s == 4);
+ assert(n == v);
}
printf("%u\n", 1<<28);
@@ -84,7 +88,8 @@ static void test_vlq_uint32(void) {
assert(out_s == 5);
uint32_t n;
size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s);
- assert(in_s == 5 && n == v);
+ assert(in_s == 5);
+ assert(n == v);
}
}
diff --git a/storage/tokudb/tests/vlq_test_uint64.cc b/storage/tokudb/tests/vlq_test_uint64.cc
index a626db69487..697c597756c 100644
--- a/storage/tokudb/tests/vlq_test_uint64.cc
+++ b/storage/tokudb/tests/vlq_test_uint64.cc
@@ -46,7 +46,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert(out_s == 1);
uint64_t n;
size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 1 && n == v);
+ assert(in_s == 1);
+ assert(n == v);
}
printf("%u\n", 1<<7);
@@ -56,7 +57,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert(out_s == 2);
uint64_t n;
size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 2 && n == v);
+ assert(in_s == 2);
+ assert(n == v);
}
printf("%u\n", 1<<14);
@@ -66,7 +68,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert(out_s == 3);
uint64_t n;
size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 3 && n == v);
+ assert(in_s == 3);
+ assert(n == v);
}
printf("%u\n", 1<<21);
@@ -76,7 +79,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert(out_s == 4);
uint64_t n;
size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 4 && n == v);
+ assert(in_s == 4);
+ assert(n == v);
}
printf("%u\n", 1<<28);
@@ -90,7 +94,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert(out_s == 5);
uint64_t n;
size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 5 && n == v);
+ assert(in_s == 5);
+ assert(n == v);
}
}
diff --git a/storage/tokudb/tokudb_buffer.h b/storage/tokudb/tokudb_buffer.h
index 022f1b49643..1605543c378 100644
--- a/storage/tokudb/tokudb_buffer.h
+++ b/storage/tokudb/tokudb_buffer.h
@@ -134,8 +134,8 @@ public:
char* data_offset = (char*)m_data + offset;
if (new_s != old_s) {
size_t n = m_size - (offset + old_s);
- assert_always(
- offset + new_s + n <= m_limit && offset + old_s + n <= m_limit);
+ assert_always(offset + new_s + n <= m_limit);
+ assert_always(offset + old_s + n <= m_limit);
memmove(data_offset + new_s, data_offset + old_s, n);
if (new_s > old_s)
m_size += new_s - old_s;
diff --git a/storage/tokudb/tokudb_math.h b/storage/tokudb/tokudb_math.h
index 0338bf3871e..99cebd5b1d1 100644
--- a/storage/tokudb/tokudb_math.h
+++ b/storage/tokudb/tokudb_math.h
@@ -59,7 +59,8 @@ TOKUDB_UNUSED(static uint64_t uint_add(
bool* over));
static uint64_t uint_add(uint64_t x, uint64_t y, uint length_bits, bool *over) {
uint64_t mask = uint_mask(length_bits);
- assert_always((x & ~mask) == 0 && (y & ~mask) == 0);
+ assert_always((x & ~mask) == 0);
+ assert_always((y & ~mask) == 0);
uint64_t s = (x + y) & mask;
*over = s < x; // check for overflow
return s;
@@ -75,7 +76,8 @@ TOKUDB_UNUSED(static uint64_t uint_sub(
bool* over));
static uint64_t uint_sub(uint64_t x, uint64_t y, uint length_bits, bool *over) {
uint64_t mask = uint_mask(length_bits);
- assert_always((x & ~mask) == 0 && (y & ~mask) == 0);
+ assert_always((x & ~mask) == 0);
+ assert_always((y & ~mask) == 0);
uint64_t s = (x - y) & mask;
*over = s > x; // check for overflow
return s;
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 3124bf8fc96..91232a1e31f 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2013, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, SkySQL Ab.
+ Copyright (c) 2009, 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
@@ -1726,10 +1726,20 @@ exp: /* [ E [ <sign> ] <unsigned integer> ] */
goto ret_sign;
}
}
- for (exponent= 0 ;
- str < end && (ch= (uchar) (*str - '0')) < 10;
- str++)
+ if (shift > 0 && !negative_exp)
+ goto ret_too_big;
+ for (exponent= 0 ; str < end && (ch= (uchar) (*str - '0')) < 10; str++)
{
+ if (negative_exp)
+ {
+ if (exponent - shift > DIGITS_IN_ULONGLONG)
+ goto ret_zero;
+ }
+ else
+ {
+ if (exponent + shift > DIGITS_IN_ULONGLONG)
+ goto ret_too_big;
+ }
exponent= exponent * 10 + ch;
}
shift+= negative_exp ? -exponent : exponent;
diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh
index ef40376127e..bccda7fbb8b 100644
--- a/support-files/rpm/server-postin.sh
+++ b/support-files/rpm/server-postin.sh
@@ -16,7 +16,8 @@ fi
# Make MySQL start/shutdown automatically when the machine does it.
if [ $1 = 1 ] ; then
if [ -x /usr/bin/systemctl ] ; then
- /usr/bin/systemctl daemon-reload >/dev/null 2>&1
+ /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ /usr/bin/systemctl preset mariadb.service >/dev/null 2>&1 || :
elif [ -x /sbin/chkconfig ] ; then
/sbin/chkconfig --add mysql
fi
diff --git a/wsrep-lib b/wsrep-lib
-Subproject 58aa3e821f575532870c5f76f6f1cf833458eed
+Subproject c9513bd2e49abbc0941689af1f2f2636a25e253