diff --git a/CMakeLists.txt b/CMakeLists.txt index c6a6715f6fe..6a4b8d18651 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,11 +123,13 @@ FOREACH(_base ENDIF() ENDFOREACH() +IF(NOT RPM AND NOT DEB) FOREACH(tool gtar tar) STRING(TOUPPER ${tool} TOOL) FIND_PROGRAM(${TOOL}_EXECUTABLE ${tool} DOC "path to the executable") MARK_AS_ADVANCED(${TOOL}_EXECUTABLE) ENDFOREACH() +ENDIF() FIND_PACKAGE(Git) diff --git a/cmake/FindGit.cmake b/cmake/FindGit.cmake new file mode 100644 index 00000000000..8178b614a3e --- /dev/null +++ b/cmake/FindGit.cmake @@ -0,0 +1,13 @@ +if(GIT_EXECUTABLE) + set(GIT_FOUND TRUE) + return() +endif() +if(DEFINED GIT_EXECUTABLE) + set(GIT_FOUND FALSE) + return() +endif() + +set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) +unset(CMAKE_MODULE_PATH) +include(FindGit) +set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH}) diff --git a/cmake/FindJNI.cmake b/cmake/FindJNI.cmake index fb2f4801a70..12305d7c86d 100644 --- a/cmake/FindJNI.cmake +++ b/cmake/FindJNI.cmake @@ -1,4 +1,9 @@ +if(JAVA_AWT_LIBRARY) + set(JNI_FOUND TRUE) + return() +endif() if(DEFINED JAVA_AWT_LIBRARY) + set(JNI_FOUND FALSE) return() endif() diff --git a/cmake/FindJava.cmake b/cmake/FindJava.cmake index 95bbf8682cd..714f56b1f72 100644 --- a/cmake/FindJava.cmake +++ b/cmake/FindJava.cmake @@ -1,4 +1,9 @@ +if(Java_JAVA_EXECUTABLE) + set(JAVA_FOUND TRUE) + return() +endif() if(DEFINED Java_JAVA_EXECUTABLE) + set(JAVA_FOUND FALSE) return() endif() diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index ed3b702b817..fc90529a8b5 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -85,6 +85,12 @@ ENDIF() SET(WITH_INNODB_SNAPPY OFF CACHE STRING "") SET(WITH_NUMA 0 CACHE BOOL "") +SET(CPU_LEVEL1_DCACHE_LINESIZE 0) + +IF(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git) + SET(GIT_EXECUTABLE GIT_EXECUTABLE-NOTFOUND CACHE FILEPATH "") +ENDIF() + IF(WIN32) SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "") SET(INSTALL_SQLBENCHDIR "" CACHE STRING "") diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index f64d16918d2..0f1aafe388d 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -125,8 +125,6 @@ SET(ignored "%ignore ${CMAKE_INSTALL_PREFIX}/share/man" "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1" "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8" - "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1*" - "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8*" "%ignore ${CMAKE_INSTALL_PREFIX}/share/pkgconfig" ) diff --git a/cmake/cpu_info.cmake b/cmake/cpu_info.cmake index 1acfad5897f..2abeb5e12c1 100644 --- a/cmake/cpu_info.cmake +++ b/cmake/cpu_info.cmake @@ -15,6 +15,8 @@ # Symbols with information about the CPU. +IF(NOT DEFINED CPU_LEVEL1_DCACHE_LINESIZE) + IF(CMAKE_SYSTEM_NAME MATCHES "Darwin") FIND_PROGRAM(SYSCTL sysctl) MARK_AS_ADVANCED(SYSCTL) @@ -37,3 +39,5 @@ ELSE() ) ENDIF() ENDIF() + +ENDIF() diff --git a/dbug/CMakeLists.txt b/dbug/CMakeLists.txt index d45401be290..d938788aded 100644 --- a/dbug/CMakeLists.txt +++ b/dbug/CMakeLists.txt @@ -30,7 +30,7 @@ IF(NOT CMAKE_CROSSCOMPILING OR DEFINED CMAKE_CROSSCOMPILING_EMULATOR) TARGET_LINK_LIBRARIES(factorial dbug) ENDIF() -IF(NOT WIN32 AND NOT CMAKE_GENERATOR MATCHES Xcode) +IF(NOT WIN32 AND NOT CMAKE_GENERATOR MATCHES Xcode AND NOT RPM AND NOT DEB) FIND_PROGRAM(GROFF groff) FIND_PROGRAM(NROFF nroff) MARK_AS_ADVANCED(GROFF) diff --git a/debian/mariadb-plugin-connect.install b/debian/mariadb-plugin-connect.install index e2500269438..6cf529163cd 100644 --- a/debian/mariadb-plugin-connect.install +++ b/debian/mariadb-plugin-connect.install @@ -1,2 +1,6 @@ etc/mysql/mariadb.conf.d/connect.cnf usr/lib/mysql/plugin/ha_connect.so +usr/share/mysql/Mongo2.jar +usr/share/mysql/Mongo3.jar +usr/share/mysql/JavaWrappers.jar +usr/share/mysql/JdbcInterface.jar diff --git a/mysql-test/main/ctype_filename.result b/mysql-test/main/ctype_filename.result index 2eee5d2888e..aaccea91793 100644 --- a/mysql-test/main/ctype_filename.result +++ b/mysql-test/main/ctype_filename.result @@ -22,21 +22,50 @@ SELECT @a:=CONVERT('aя' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a @a BINARY @a REVERSE(@a) HEX(@a) HEX(REVERSE(@a)) aя a@r1 яa 61407231 40723161 # +# Beginning of 10.2 test. +# +# MDEV-25462: Assertion `m_status == DA_ERROR || m_status == DA_OK || +# m_status == DA_OK_BULK' failed in Diagnostics_area::message from +# get_schema_tables_record +# +SELECT @@character_set_client, @@character_set_connection, @@character_set_results; +@@character_set_client @@character_set_connection @@character_set_results +utf8 utf8 utf8 +SET @old_character_set_client= @@character_set_client; +SET @old_character_set_connection= @@character_set_connection; +SET @old_character_set_results= @@character_set_results; +SET NAMES 'filename'; +ERROR 42000: Variable 'character_set_client' can't be set to the value of 'filename' +SELECT @@character_set_client, @@character_set_connection, @@character_set_results; +@@character_set_client @@character_set_connection @@character_set_results +utf8 utf8 utf8 +CREATE VIEW v2 AS SELECT 1; +SHOW TABLE STATUS; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +v2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL +DROP VIEW v2; +SET @@character_set_client= @old_character_set_client; +SET @@character_set_connection= @old_character_set_connection; +SET @@character_set_results= @old_character_set_results; +# +# End of 10.2 test +# +# # MDEV-22022 Various mangled SQL statements will crash 10.3 to 10.5 debug builds # SET CHARACTER_SET_CLIENT=17; +ERROR 42000: Variable 'character_set_client' can't be set to the value of '17' SELECT doc.`Children`.0 FROM t1; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?Children??0?FROM?t1' at line 1 +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.0 FROM t1' at line 1 SET NAMES latin1; -# -# Start of 10.5 tests -# +# End of 10.3 tests # # MDEV-22043 Special character leads to assertion in my_wc_to_printable_generic on 10.5.2 (debug) # SET NAMES filename; +ERROR 42000: Variable 'character_set_client' can't be set to the value of 'filename' EXECUTE IMMEDIATE _latin1 0x01; -ERROR 42000: You@0020have@0020an@0020error@0020in@0020your@0020SQL@0020syntax@003b@0020check@0020the@0020manual@0020that@0020corresponds@0020to@0020your@0020MariaDB@0020server@0020version@0020for@0020the@0020right@0020syntax@0020to@0020use@0020near@0020@0027@005c0001@0027@0020at@0020line@00201 +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\0001' at line 1 SET NAMES utf8; # # MDEV-23435 Functions do not convert numbers to character_set_results @@ -103,6 +132,4 @@ a c @002d1 @002d1 DROP TABLE t1; SET NAMES utf8; -# # End of 10.5 tests -# diff --git a/mysql-test/main/ctype_filename.test b/mysql-test/main/ctype_filename.test index 17ab71e3985..ba42d1a2807 100644 --- a/mysql-test/main/ctype_filename.test +++ b/mysql-test/main/ctype_filename.test @@ -28,25 +28,49 @@ select convert(convert(',' using filename) using binary); SET NAMES utf8; SELECT @a:=CONVERT('aя' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a), HEX(REVERSE(@a)); +--echo # +--echo # Beginning of 10.2 test. +--echo # +--echo # MDEV-25462: Assertion `m_status == DA_ERROR || m_status == DA_OK || +--echo # m_status == DA_OK_BULK' failed in Diagnostics_area::message from +--echo # get_schema_tables_record +--echo # + +SELECT @@character_set_client, @@character_set_connection, @@character_set_results; +SET @old_character_set_client= @@character_set_client; +SET @old_character_set_connection= @@character_set_connection; +SET @old_character_set_results= @@character_set_results; +--error ER_WRONG_VALUE_FOR_VAR +SET NAMES 'filename'; +SELECT @@character_set_client, @@character_set_connection, @@character_set_results; +CREATE VIEW v2 AS SELECT 1; +SHOW TABLE STATUS; +DROP VIEW v2; +SET @@character_set_client= @old_character_set_client; +SET @@character_set_connection= @old_character_set_connection; +SET @@character_set_results= @old_character_set_results; + +--echo # +--echo # End of 10.2 test +--echo # --echo # --echo # MDEV-22022 Various mangled SQL statements will crash 10.3 to 10.5 debug builds --echo # +--error ER_WRONG_VALUE_FOR_VAR SET CHARACTER_SET_CLIENT=17; --error ER_PARSE_ERROR SELECT doc.`Children`.0 FROM t1; SET NAMES latin1; - ---echo # ---echo # Start of 10.5 tests ---echo # +--echo # End of 10.3 tests --echo # --echo # MDEV-22043 Special character leads to assertion in my_wc_to_printable_generic on 10.5.2 (debug) --echo # +--error ER_WRONG_VALUE_FOR_VAR SET NAMES filename; --error ER_PARSE_ERROR EXECUTE IMMEDIATE _latin1 0x01; @@ -114,7 +138,4 @@ SET NAMES utf8; --enable_ps_protocol - ---echo # --echo # End of 10.5 tests ---echo # diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 141ef94ad59..7b0ce27ead3 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -1566,7 +1566,7 @@ lc-messages-dir MYSQL_SHAREDIR/ lc-time-names en_US local-infile TRUE lock-wait-timeout 86400 -log-bin (No default value) +log-bin foo log-bin-compress FALSE log-bin-compress-min-len 256 log-bin-index (No default value) diff --git a/mysql-test/main/mysqld--help.test b/mysql-test/main/mysqld--help.test index 4405b198951..f918670d319 100644 --- a/mysql-test/main/mysqld--help.test +++ b/mysql-test/main/mysqld--help.test @@ -13,7 +13,7 @@ # force symbolic-links=0 (valgrind build has a different default) # -exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --lower-case-table-names=1 --help --verbose > $MYSQL_TMP_DIR/mysqld--help.txt 2>&1; +exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --log-bin=foo --lower-case-table-names=1 --help --verbose > $MYSQL_TMP_DIR/mysqld--help.txt 2>&1; # The inline perl code below will copy $MYSQL_TMP_DIR/mysqld--help.txt # to output, but filter away some variable stuff (e.g. paths). diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result index 3bfb755120b..7b97f499768 100644 --- a/mysql-test/main/subselect4.result +++ b/mysql-test/main/subselect4.result @@ -2721,7 +2721,15 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2); a DROP TABLE t1,t2; -# End of 10.2 tests +# +# MDEV-22462: Item_in_subselect::create_single_in_to_exists_cond(JOIN *, Item **, Item **): Assertion `false' failed. +# +select 1 from dual where 1 in (select 5 from dual where 1); +1 +create table t1 (a int); +insert into t1 values (1),(2),(3); +update t1 set a = 2 where a in (select a from dual where a = a); +drop table t1; # # MDEV-18335: Assertion `!error || error == 137' failed in subselect_rowid_merge_engine::init # @@ -2848,6 +2856,17 @@ INSERT INTO t2 VALUES (3),(4); SELECT 1 IN (SELECT (SELECT a FROM t1) AS x FROM t2 GROUP BY x); ERROR 21000: Subquery returns more than 1 row drop table t1,t2; +# +# MDEV-25629: Crash in get_sort_by_table() in subquery with order by having outer ref +# +CREATE TABLE t1 (i1 int); +insert into t1 values (1),(2); +SELECT 1 +FROM (t1 JOIN t1 AS ref_t1 ON +(t1.i1 > (SELECT ref_t1.i1 AS c0 FROM t1 b ORDER BY -c0))); +ERROR 21000: Subquery returns more than 1 row +DROP TABLE t1; +# End of 10.2 tests # End of 10.3 tests # # MDEV-19134: EXISTS() slower if ORDER BY is defined diff --git a/mysql-test/main/subselect4.test b/mysql-test/main/subselect4.test index a1a4108de37..2f65db875f8 100644 --- a/mysql-test/main/subselect4.test +++ b/mysql-test/main/subselect4.test @@ -2236,7 +2236,17 @@ SELECT a FROM t1 WHERE (a, a) IN (SELECT 1, 2) AND a = (SELECT MIN(b) FROM t2); DROP TABLE t1,t2; ---echo # End of 10.2 tests +--echo # +--echo # MDEV-22462: Item_in_subselect::create_single_in_to_exists_cond(JOIN *, Item **, Item **): Assertion `false' failed. +--echo # + +select 1 from dual where 1 in (select 5 from dual where 1); + +create table t1 (a int); +insert into t1 values (1),(2),(3); + +update t1 set a = 2 where a in (select a from dual where a = a); +drop table t1; --echo # --echo # MDEV-18335: Assertion `!error || error == 137' failed in subselect_rowid_merge_engine::init @@ -2355,6 +2365,21 @@ INSERT INTO t2 VALUES (3),(4); # Optional, fails either way SELECT 1 IN (SELECT (SELECT a FROM t1) AS x FROM t2 GROUP BY x); drop table t1,t2; +--echo # +--echo # MDEV-25629: Crash in get_sort_by_table() in subquery with order by having outer ref +--echo # +CREATE TABLE t1 (i1 int); +insert into t1 values (1),(2); + +--error ER_SUBQUERY_NO_1_ROW +SELECT 1 +FROM (t1 JOIN t1 AS ref_t1 ON + (t1.i1 > (SELECT ref_t1.i1 AS c0 FROM t1 b ORDER BY -c0))); + +DROP TABLE t1; + +--echo # End of 10.2 tests + --echo # End of 10.3 tests --echo # diff --git a/mysql-test/suite/binlog/r/binlog_admin_cmd_kill.result b/mysql-test/suite/binlog/r/binlog_admin_cmd_kill.result index a2eb7ee5c0a..d9bfead8dd1 100644 --- a/mysql-test/suite/binlog/r/binlog_admin_cmd_kill.result +++ b/mysql-test/suite/binlog/r/binlog_admin_cmd_kill.result @@ -20,7 +20,7 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (f INT) ENGINE=INNODB master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (f INT) ENGINE=INNODB DROP TABLE t1,t2; -FLUSH LOGS; +RESET MASTER; # # Kill OPTIMIZE command after table modification # diff --git a/mysql-test/suite/binlog/t/binlog_admin_cmd_kill.test b/mysql-test/suite/binlog/t/binlog_admin_cmd_kill.test index 9b248097ae2..e2397f0eab8 100644 --- a/mysql-test/suite/binlog/t/binlog_admin_cmd_kill.test +++ b/mysql-test/suite/binlog/t/binlog_admin_cmd_kill.test @@ -56,7 +56,7 @@ SET debug_sync = 'reset'; --source include/show_binlog_events.inc DROP TABLE t1,t2; -FLUSH LOGS; +RESET MASTER; --echo # --echo # Kill OPTIMIZE command after table modification @@ -81,6 +81,9 @@ eval KILL $thd_id; SET debug_sync = 'reset'; --disconnect con1 +--let $wait_binlog_event= OPTIMIZE +--source include/wait_for_binlog_event.inc + DROP TABLE t1,t2; let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); FLUSH LOGS; diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 38ce0bd0e1d..e5573bd4409 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -42,11 +42,11 @@ galera_var_notify_cmd : MDEV-21905 Galera test galera_var_notify_cmd causes hang galera_var_reject_queries : assertion in inline_mysql_socket_send galera_var_replicate_myisam_on : MDEV-24062 Galera test failure on galera_var_replicate_myisam_on galera_var_retry_autocommit: MDEV-18181 Galera test failure on galera.galera_var_retry_autocommit -#galera_wan : MDEV-17259 Test failure on galera.galera_wan mysql-wsrep#198 : MDEV-24446: galera.mysql-wsrep#198 MTR failed: query 'reap' failed: 2000: Unknown MySQL error partition : MDEV-19958 Galera test failure on galera.partition query_cache: MDEV-15805 Test failure on galera.query_cache -#sql_log_bin : MDEV-21491 galera.sql_log_bin versioning_trx_id: MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch galera_wsrep_provider_unset_set: wsrep_provider is read-only for security reasons pxc-421: wsrep_provider is read-only for security reasons + +MDEV-25562: MDEV-25562 FIXME: lock wait timeout exceeded diff --git a/mysql-test/suite/galera/r/MDEV-25562.result b/mysql-test/suite/galera/r/MDEV-25562.result new file mode 100644 index 00000000000..b0d77af374b --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-25562.result @@ -0,0 +1,16 @@ +connection node_2; +connection node_1; +SET SESSION WSREP_ON=0; +FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT; +SET SESSION WSREP_ON=1; +UNLOCK TABLES; +SET GLOBAL wsrep_ignore_apply_errors=1; +CREATE TABLE t1 (a CHAR(1)) engine=innodb; +CREATE TABLE t1 (a CHAR(1)) engine=innodb; +ERROR 42S01: Table 't1' already exists +SHOW PROCEDURE STATUS WHERE db = 'test'; +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +SET GLOBAL read_only=1; +SET GLOBAL wsrep_ignore_apply_errors=DEFAULT; +SET GLOBAL read_only=DEFAULT; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/MDEV-25562.test b/mysql-test/suite/galera/t/MDEV-25562.test new file mode 100644 index 00000000000..01729936b08 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-25562.test @@ -0,0 +1,23 @@ +# +# MDEV-25562 Assertion `pause_seqno_.is_undefined() == false' failed in void wsrep::server_state::resume() +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +SET SESSION WSREP_ON=0; +FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT; +SET SESSION WSREP_ON=1; +UNLOCK TABLES; + +SET GLOBAL wsrep_ignore_apply_errors=1; +CREATE TABLE t1 (a CHAR(1)) engine=innodb; +--error ER_TABLE_EXISTS_ERROR +CREATE TABLE t1 (a CHAR(1)) engine=innodb; +SHOW PROCEDURE STATUS WHERE db = 'test'; +SET GLOBAL read_only=1; + +SET GLOBAL wsrep_ignore_apply_errors=DEFAULT; +SET GLOBAL read_only=DEFAULT; +DROP TABLE t1; + diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result index b50bf047265..a64086c9802 100644 --- a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result +++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result @@ -264,6 +264,18 @@ t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; +# +# MDEV-25271 Double free of table when inplace alter +# FTS add index fails +# +call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation."); +call mtr.add_suppression("InnoDB: Error number .* means"); +call mtr.add_suppression("InnoDB: Cannot create file"); +call mtr.add_suppression("InnoDB: Failed to create"); +CREATE TABLE t1(a TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL UNIQUE) ENGINE=InnoDB; +ALTER TABLE t1 ADD FULLTEXT(a), ALGORITHM=INPLACE; +ERROR HY000: Got error 11 "Resource temporarily unavailable" from storage engine InnoDB +DROP TABLE t1; CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB; ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b); DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/misc_debug.result b/mysql-test/suite/innodb_fts/r/misc_debug.result index 10e3cf8874d..41f8d08ea7d 100644 --- a/mysql-test/suite/innodb_fts/r/misc_debug.result +++ b/mysql-test/suite/innodb_fts/r/misc_debug.result @@ -52,3 +52,16 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; +# +# MDEV-25663 Double free of transaction during TRUNCATE +# +call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)"); +SET DEBUG_DBUG='-d,ib_create_table_fail_too_many_trx'; +CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB; +SET @save_dbug= @@debug_dbug; +SET debug_dbug='+d,ib_create_table_fail_too_many_trx'; +TRUNCATE t1; +ERROR HY000: Got error -1 "Internal error < 0 (Not system error)" from storage engine InnoDB +SET debug_dbug=@save_dbug; +DROP TABLE t1; +# End of 10.3 tests diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.opt b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.opt new file mode 100644 index 00000000000..e6ae8d0fe0a --- /dev/null +++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.opt @@ -0,0 +1 @@ +--enable-plugin-innodb-sys-tables diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test index 7c56811a2d9..78494910b48 100644 --- a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test +++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test @@ -319,6 +319,25 @@ ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=INPLACE; SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # MDEV-25271 Double free of table when inplace alter +--echo # FTS add index fails +--echo # +call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation."); +call mtr.add_suppression("InnoDB: Error number .* means"); +call mtr.add_suppression("InnoDB: Cannot create file"); +call mtr.add_suppression("InnoDB: Failed to create"); + +let MYSQLD_DATADIR=`select @@datadir`; +CREATE TABLE t1(a TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL UNIQUE) ENGINE=InnoDB; +let $fts_aux_file= `select concat('FTS_',right(concat(repeat('0',16), lower(hex(TABLE_ID))),16),'_BEING_DELETED.ibd') FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME='test/t1'`; +write_file $MYSQLD_DATADIR/test/$fts_aux_file; +EOF +--error ER_GET_ERRNO +ALTER TABLE t1 ADD FULLTEXT(a), ALGORITHM=INPLACE; +DROP TABLE t1; +remove_file $MYSQLD_DATADIR/test/$fts_aux_file; + # Add more than one FTS index CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB; ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b); diff --git a/mysql-test/suite/innodb_fts/t/misc_debug.test b/mysql-test/suite/innodb_fts/t/misc_debug.test index 461e3f1d9d4..90cb84976ce 100644 --- a/mysql-test/suite/innodb_fts/t/misc_debug.test +++ b/mysql-test/suite/innodb_fts/t/misc_debug.test @@ -83,3 +83,18 @@ ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL; CHECK TABLE t1; DROP TABLE t1; --source include/wait_until_count_sessions.inc + +--echo # +--echo # MDEV-25663 Double free of transaction during TRUNCATE +--echo # +call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)"); +SET DEBUG_DBUG='-d,ib_create_table_fail_too_many_trx'; + +CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB; +SET @save_dbug= @@debug_dbug; +SET debug_dbug='+d,ib_create_table_fail_too_many_trx'; +--error ER_GET_ERRNO +TRUNCATE t1; +SET debug_dbug=@save_dbug; +DROP TABLE t1; +--echo # End of 10.3 tests diff --git a/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_ed25519.result b/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_ed25519.result new file mode 100644 index 00000000000..6e3d928509c --- /dev/null +++ b/mysql-test/suite/perfschema/r/hostcache_ipv4_auth_ed25519.result @@ -0,0 +1,121 @@ +install soname 'auth_ed25519'; +flush status; +flush hosts; +flush user_resources; +flush privileges; +select `User`, `Host` from mysql.`user` where `host` like '%\\%%'; +User Host +select `User`, `Host` from mysql.`user` where `user` like '192.%'; +User Host +select `User`, `Host` from mysql.`user` where `user` like '2001:%'; +User Host +select `User`, `Host` from mysql.`user` where `user` like 'santa.claus.%'; +User Host +create user plug1@'santa.claus.ipv4.example.com' + identified with ed25519; +update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'foo') where user='plug1'; +flush privileges; +create user plug2@'santa.claus.ipv4.example.com' + identified with ED25519 as 'vubFBzIrapbfHct1/J72dnUryz5VS7lA6XHH8sIx4TI'; +set @saved_dbug = @@global.debug_dbug; +set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; +connect(127.0.0.1,plug1,foo,test,PORT,SOCKET); +connect con1, 127.0.0.1, plug1,foo,,$MASTER_MYPORT; +ERROR 28000: Access denied for user 'plug1'@'santa.claus.ipv4.example.com' (using password: YES) +# Dumping performance_schema.host_cache +IP 192.0.2.4 +HOST santa.claus.ipv4.example.com +HOST_VALIDATED YES +SUM_CONNECT_ERRORS 1 +COUNT_HOST_BLOCKED_ERRORS 0 +COUNT_NAMEINFO_TRANSIENT_ERRORS 0 +COUNT_NAMEINFO_PERMANENT_ERRORS 0 +COUNT_FORMAT_ERRORS 0 +COUNT_ADDRINFO_TRANSIENT_ERRORS 0 +COUNT_ADDRINFO_PERMANENT_ERRORS 0 +COUNT_FCRDNS_ERRORS 0 +COUNT_HOST_ACL_ERRORS 0 +COUNT_NO_AUTH_PLUGIN_ERRORS 0 +COUNT_AUTH_PLUGIN_ERRORS 0 +COUNT_HANDSHAKE_ERRORS 1 +COUNT_PROXY_USER_ERRORS 0 +COUNT_PROXY_USER_ACL_ERRORS 0 +COUNT_AUTHENTICATION_ERRORS 0 +COUNT_SSL_ERRORS 0 +COUNT_MAX_USER_CONNECTIONS_ERRORS 0 +COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS 0 +COUNT_DEFAULT_DATABASE_ERRORS 0 +COUNT_INIT_CONNECT_ERRORS 0 +COUNT_LOCAL_ERRORS 0 +COUNT_UNKNOWN_ERRORS 0 +FIRST_ERROR_SEEN set +LAST_ERROR_SEEN set +connect(127.0.0.1,plug2,bar,test,PORT,SOCKET); +connect con1, 127.0.0.1, plug2,bar,,$MASTER_MYPORT; +ERROR 28000: Access denied for user 'plug2'@'santa.claus.ipv4.example.com' (using password: YES) +# Dumping performance_schema.host_cache +IP 192.0.2.4 +HOST santa.claus.ipv4.example.com +HOST_VALIDATED YES +SUM_CONNECT_ERRORS 1 +COUNT_HOST_BLOCKED_ERRORS 0 +COUNT_NAMEINFO_TRANSIENT_ERRORS 0 +COUNT_NAMEINFO_PERMANENT_ERRORS 0 +COUNT_FORMAT_ERRORS 0 +COUNT_ADDRINFO_TRANSIENT_ERRORS 0 +COUNT_ADDRINFO_PERMANENT_ERRORS 0 +COUNT_FCRDNS_ERRORS 0 +COUNT_HOST_ACL_ERRORS 0 +COUNT_NO_AUTH_PLUGIN_ERRORS 0 +COUNT_AUTH_PLUGIN_ERRORS 0 +COUNT_HANDSHAKE_ERRORS 1 +COUNT_PROXY_USER_ERRORS 0 +COUNT_PROXY_USER_ACL_ERRORS 0 +COUNT_AUTHENTICATION_ERRORS 1 +COUNT_SSL_ERRORS 0 +COUNT_MAX_USER_CONNECTIONS_ERRORS 0 +COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS 0 +COUNT_DEFAULT_DATABASE_ERRORS 0 +COUNT_INIT_CONNECT_ERRORS 0 +COUNT_LOCAL_ERRORS 0 +COUNT_UNKNOWN_ERRORS 0 +FIRST_ERROR_SEEN set +LAST_ERROR_SEEN set +connect con1, 127.0.0.1, plug2,foo,,$MASTER_MYPORT; +select current_user(); +current_user() +plug2@santa.claus.ipv4.example.com +disconnect con1; +connection default; +# Dumping performance_schema.host_cache +IP 192.0.2.4 +HOST santa.claus.ipv4.example.com +HOST_VALIDATED YES +SUM_CONNECT_ERRORS 0 +COUNT_HOST_BLOCKED_ERRORS 0 +COUNT_NAMEINFO_TRANSIENT_ERRORS 0 +COUNT_NAMEINFO_PERMANENT_ERRORS 0 +COUNT_FORMAT_ERRORS 0 +COUNT_ADDRINFO_TRANSIENT_ERRORS 0 +COUNT_ADDRINFO_PERMANENT_ERRORS 0 +COUNT_FCRDNS_ERRORS 0 +COUNT_HOST_ACL_ERRORS 0 +COUNT_NO_AUTH_PLUGIN_ERRORS 0 +COUNT_AUTH_PLUGIN_ERRORS 0 +COUNT_HANDSHAKE_ERRORS 1 +COUNT_PROXY_USER_ERRORS 0 +COUNT_PROXY_USER_ACL_ERRORS 0 +COUNT_AUTHENTICATION_ERRORS 1 +COUNT_SSL_ERRORS 0 +COUNT_MAX_USER_CONNECTIONS_ERRORS 0 +COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS 0 +COUNT_DEFAULT_DATABASE_ERRORS 0 +COUNT_INIT_CONNECT_ERRORS 0 +COUNT_LOCAL_ERRORS 0 +COUNT_UNKNOWN_ERRORS 0 +FIRST_ERROR_SEEN set +LAST_ERROR_SEEN set +drop user plug1@'santa.claus.ipv4.example.com'; +drop user plug2@'santa.claus.ipv4.example.com'; +set @@global.debug_dbug = @saved_dbug; +uninstall plugin ed25519; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_ed25519.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_ed25519.test new file mode 100644 index 00000000000..4c68d3af51e --- /dev/null +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_auth_ed25519.test @@ -0,0 +1,56 @@ +# +# Tests for the performance_schema host_cache. +# +# Test authorization with auth plugins. +# error reporting in: +# - column COUNT_AUTH_PLUGIN_ERRORS +# - column COUNT_PROXY_USER_ERRORS +# - column COUNT_PROXY_USER_ACL_ERRORS + +source include/not_embedded.inc; +source include/have_debug.inc; +source include/have_perfschema.inc; +source include/have_plugin_auth.inc; +source include/have_hostname_cache.inc; + +if (!$AUTH_ED25519_SO) { + skip No auth_ed25519 plugin; +} +install soname 'auth_ed25519'; + +# Enforce a clean state +source ../include/wait_for_pfs_thread_count.inc; +source ../include/hostcache_set_state.inc; + +create user plug1@'santa.claus.ipv4.example.com' + identified with ed25519; +update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'foo') where user='plug1'; +flush privileges; + +create user plug2@'santa.claus.ipv4.example.com' + identified with ED25519 as 'vubFBzIrapbfHct1/J72dnUryz5VS7lA6XHH8sIx4TI'; + +set @saved_dbug = @@global.debug_dbug; +set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_ipv4,getaddrinfo_fake_good_ipv4"; + +replace_result $MASTER_MYPORT PORT $MASTER_MYSOCK SOCKET; +error ER_ACCESS_DENIED_ERROR; +connect con1, 127.0.0.1, plug1,foo,,$MASTER_MYPORT; +source ../include/hostcache_dump.inc; + +replace_result $MASTER_MYPORT PORT $MASTER_MYSOCK SOCKET; +error ER_ACCESS_DENIED_ERROR; +connect con1, 127.0.0.1, plug2,bar,,$MASTER_MYPORT; +source ../include/hostcache_dump.inc; + +connect con1, 127.0.0.1, plug2,foo,,$MASTER_MYPORT; +select current_user(); +disconnect con1; +connection default; +source ../include/hostcache_dump.inc; + +drop user plug1@'santa.claus.ipv4.example.com'; +drop user plug2@'santa.claus.ipv4.example.com'; + +set @@global.debug_dbug = @saved_dbug; +uninstall plugin ed25519; diff --git a/plugin/auth_ed25519/server_ed25519.c b/plugin/auth_ed25519/server_ed25519.c index 6fec98c56fc..b789bd34ca4 100644 --- a/plugin/auth_ed25519/server_ed25519.c +++ b/plugin/auth_ed25519/server_ed25519.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2017, MariaDB + Copyright (c) 2017, 2021, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ static int auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) /* prepare random nonce */ if (my_random_bytes((unsigned char *)nonce, (int)sizeof(nonce))) - return CR_AUTH_USER_CREDENTIALS; + return CR_ERROR; // eh? OpenSSL error /* send it */ if (vio->write_packet(vio, reply + CRYPTO_BYTES, NONCE_BYTES)) @@ -55,7 +55,7 @@ static int auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) if (crypto_sign_open(reply, CRYPTO_BYTES + NONCE_BYTES, (unsigned char*)info->auth_string)) - return CR_ERROR; + return CR_AUTH_USER_CREDENTIALS; // wrong password provided by the user return CR_OK; } diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index f4ac2e9936d..952a37f75d2 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -875,7 +875,9 @@ get_openssl() readonly OPENSSL_BINARY } +# # Generate a string equivalent to 16 random bytes +# wsrep_gen_secret() { get_openssl @@ -889,16 +891,36 @@ wsrep_gen_secret() fi } +# +# Checking if the address passed to us is local. +# If the second parameter is nonzero, then this function +# does not check for matches with local domain names: +# is_local_ip() { - [ "$1" = '127.0.0.1' ] && return 0 - [ "$1" = '127.0.0.2' ] && return 0 - [ "$1" = 'localhost' ] && return 0 - [ "$1" = '[::1]' ] && return 0 - [ "$1" = "$(hostname -s)" ] && return 0 - [ "$1" = "$(hostname -f)" ] && return 0 - [ "$1" = "$(hostname -d)" ] && return 0 - + # Rapid recognition of the most common cases: + [ "$1" = '127.0.0.1' -o \ + "$1" = '127.0.0.2' -o \ + "$1" = 'localhost' -o \ + "$1" = '[::1]' ] && return 0 + # If the address starts with "127." this is probably a local + # address, but we need to clarify what follows this prefix: + if [ "${1#127.}" != "$1" ]; then + # All 127.0.0.0/8 addresses are local: + if echo "$1" | grep -q -E '^127\.[0-9]+\.[0-9]+\.[0-9]+$'; then + return 0 + fi + fi + # If the second parameter is nonzero, then we will skip + # the domain name check: + if [ "${2:-0}" -eq 0 ]; then + # We consider all the names of a given host to be local addresses: + [ "$1" = "$(hostname -s)" -o \ + "$1" = "$(hostname -f)" -o \ + "$1" = "$(hostname -d)" ] && return 0 + fi + # Now let's check if the given address is assigned to + # one of the network cards: local ip_util="$(command -v ip)" if [ -n "$ip_util" ]; then # ip address show ouput format is " inet[6]
/": @@ -914,7 +936,6 @@ is_local_ip() | grep -F " $1 " >/dev/null && return 0 fi fi - return 1 } diff --git a/sql/item.cc b/sql/item.cc index 8cad7111e07..2658c443f4d 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5902,6 +5902,7 @@ bool Item_field::fix_fields(THD *thd, Item **reference) */ set_max_sum_func_level(thd, select); set_field(new_field); + depended_from= (*((Item_field**)res))->depended_from; return 0; } else diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index ffebf7d6994..abc4003c35f 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -2321,11 +2321,12 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join, */ Item *item= (Item*) select_lex->item_list.head(); - if (select_lex->table_list.elements) + if (select_lex->table_list.elements || + !(select_lex->master_unit()->is_unit_op())) { Item *having= item; Item *orig_item= item; - + item= func->create(thd, expr, item); if (!abort_on_null && orig_item->maybe_null) { @@ -2369,32 +2370,28 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join, } else { - if (select_lex->master_unit()->is_unit_op()) - { - LEX_CSTRING field_name= {STRING_WITH_LEN("") }; - Item *new_having= - func->create(thd, expr, - new (thd->mem_root) Item_ref_null_helper(thd, + DBUG_ASSERT(select_lex->master_unit()->is_unit_op()); + LEX_CSTRING field_name= {STRING_WITH_LEN("") }; + Item *new_having= + func->create(thd, expr, + new (thd->mem_root) Item_ref_null_helper(thd, &select_lex->context, this, &select_lex->ref_pointer_array[0], no_matter_name, field_name)); - if (!abort_on_null && left_expr->maybe_null) - { - disable_cond_guard_for_const_null_left_expr(0); - if (!(new_having= new (thd->mem_root) Item_func_trig_cond(thd, new_having, - get_cond_guard(0)))) - DBUG_RETURN(true); - } - - new_having->name= in_having_cond; - if (fix_having(new_having, select_lex)) + if (!abort_on_null && left_expr->maybe_null) + { + disable_cond_guard_for_const_null_left_expr(0); + if (!(new_having= new (thd->mem_root) + Item_func_trig_cond(thd, new_having, get_cond_guard(0)))) DBUG_RETURN(true); - *having_item= new_having; } - else - DBUG_ASSERT(false); + + new_having->name= in_having_cond; + if (fix_having(new_having, select_lex)) + DBUG_RETURN(true); + *having_item= new_having; } } diff --git a/sql/lock.cc b/sql/lock.cc index 5d502755541..559f1195b32 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1124,21 +1124,22 @@ void Global_read_lock::unlock_global_read_lock(THD *thd) thd->mdl_context.release_lock(m_mdl_global_read_lock); #ifdef WITH_WSREP - if (m_state == GRL_ACQUIRED_AND_BLOCKS_COMMIT) + if (m_state == GRL_ACQUIRED_AND_BLOCKS_COMMIT && + wsrep_locked_seqno != WSREP_SEQNO_UNDEFINED) { Wsrep_server_state& server_state= Wsrep_server_state::instance(); if (server_state.state() == Wsrep_server_state::s_donor || (WSREP_NNULL(thd) && server_state.state() != Wsrep_server_state::s_synced)) { - /* TODO: maybe redundant here?: */ - wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; server_state.resume(); + wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; } else if (WSREP_NNULL(thd) && server_state.state() == Wsrep_server_state::s_synced) { server_state.resume_and_resync(); + wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; } } #endif /* WITH_WSREP */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 29aaf389ca1..3a164d68574 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4822,7 +4822,7 @@ static int init_server_components() } #endif /* WITH_WSREP */ - if (opt_bin_log) + if (!opt_help && opt_bin_log) { if (mysql_bin_log.open_index_file(opt_binlog_index_name, opt_bin_logname, TRUE)) diff --git a/sql/mysqld.h b/sql/mysqld.h index 24580d6bb90..8ca3a109333 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -708,7 +708,7 @@ extern struct st_VioSSLFd * ssl_acceptor_fd; */ extern my_bool opt_large_pages; extern uint opt_large_page_size; -extern char lc_messages_dir[FN_REFLEN]; +extern MYSQL_PLUGIN_IMPORT char lc_messages_dir[FN_REFLEN]; extern char *lc_messages_dir_ptr, *log_error_file_ptr; extern MYSQL_PLUGIN_IMPORT char reg_ext[FN_EXTLEN]; extern MYSQL_PLUGIN_IMPORT uint reg_ext_length; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 5f5f5428dad..71b5defeef8 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -13904,7 +13904,12 @@ static int server_mpvio_read_packet(MYSQL_PLUGIN_VIO *param, uchar **buf) done: if (set_user_salt_if_needed(mpvio->acl_user, mpvio->curr_auth, mpvio->plugin)) + { + ai->thd->clear_error(); // authenticating user should not see these errors + my_error(ER_ACCESS_DENIED_ERROR, MYF(0), ai->thd->security_ctx->user, + ai->thd->security_ctx->host_or_ip, ER_THD(ai->thd, ER_YES)); goto err; + } ai->user_name= ai->thd->security_ctx->user; ai->user_name_length= (uint) strlen(ai->user_name); diff --git a/sql/sql_class.h b/sql/sql_class.h index ac8d26cce03..62ce5c8a2d2 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1044,7 +1044,7 @@ mysqld_collation_get_by_name(const char *name, static inline bool is_supported_parser_charset(CHARSET_INFO *cs) { - return MY_TEST(cs->mbminlen == 1); + return MY_TEST(cs->mbminlen == 1 && cs->number != 17 /* filename */); } /** THD registry */ @@ -5156,7 +5156,6 @@ public: THD_TRANS::EXECUTED_TABLE_ADMIN_CMD)); } - uint get_net_wait_timeout() { if (in_active_multi_stmt_transaction()) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index de323ae336d..27088df3417 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation + Copyright (c) 2009, 2021, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e9252f0b694..68344b49857 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -8288,7 +8288,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ptr->is_fqtn= TRUE; ptr->db= table->db; } - else if (!lex->with_cte_resolution && lex->copy_db_to(&ptr->db)) + else if (!lex->with_cte_resolution && lex->copy_db_to(&ptr->db)) DBUG_RETURN(0); else ptr->is_fqtn= FALSE; @@ -8303,7 +8303,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, if (ptr->db.length && ptr->db.str != any_db) ptr->db.length= my_casedn_str(files_charset_info, (char*) ptr->db.str); } - + ptr->table_name= table->table; ptr->lock_type= lock_type; ptr->mdl_type= mdl_type; @@ -8989,7 +8989,7 @@ void st_select_lex::set_lock_for_tables(thr_lock_type lock_type, bool for_update tables->lock_type= lock_type; tables->updating= for_update; - if (tables->db.str && tables->db.str[0]) + if (tables->db.length) tables->mdl_request.set_type((lock_type >= TL_WRITE_ALLOW_WRITE) ? MDL_SHARED_WRITE : MDL_SHARED_READ); } diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 01fd42458a1..b7f64389f02 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -34,7 +34,6 @@ #include "sp_cache.h" #include "datadict.h" // dd_frm_is_view() #include "sql_derived.h" -#include "sql_cte.h" // check_dependencies_in_with_clauses() #include "opt_trace.h" #include "wsrep_mysqld.h" @@ -893,6 +892,13 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, { LEX *lex= thd->lex; + /* + Ensure character set number != 17 (character set = filename) and mbminlen=1 + because these character sets are not parser friendly, which can give weird + sequence in .frm file of view and later give parsing error. + */ + DBUG_ASSERT(thd->charset()->mbminlen == 1 && thd->charset()->number != 17); + /* View definition query -- a SELECT statement that fully defines view. It is generated from the Item-tree built from the original (specified by diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index 14ab86cf2d8..ebb61bb487b 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -423,11 +423,11 @@ IF(CONNECT_WITH_JDBC AND JAVA_FOUND AND JNI_FOUND) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mysql-test/connect/std_data/JavaWrappers.jar ${CMAKE_CURRENT_BINARY_DIR}/JdbcInterface.jar - DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine) + DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT connect-engine) IF(CONNECT_WITH_MONGO) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mysql-test/connect/std_data/Mongo2.jar ${CMAKE_CURRENT_SOURCE_DIR}/mysql-test/connect/std_data/Mongo3.jar - DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine) + DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT connect-engine) ENDIF() ENDIF() diff --git a/storage/connect/javaconn.cpp b/storage/connect/javaconn.cpp index eda5d31c80b..03c9ecb9221 100644 --- a/storage/connect/javaconn.cpp +++ b/storage/connect/javaconn.cpp @@ -57,8 +57,8 @@ extern "C" HINSTANCE s_hModule; // Saved module handle extern char *JvmPath; // The connect_jvm_path global variable value extern char *ClassPath; // The connect_class_path global variable value -char *GetPluginDir(void); char *GetJavaWrapper(void); // The connect_java_wrapper variable value +extern MYSQL_PLUGIN_IMPORT char lc_messages_dir[FN_REFLEN]; /***********************************************************************/ /* Static JAVAConn objects. */ @@ -401,23 +401,23 @@ bool JAVAConn::Open(PGLOBAL g) } // endif ClassPath #if 0 - // Java source will be compiled as a jar file installed in the plugin dir + // Java source will be compiled as a jar file installed in the mysql share dir jpop->Append(sep); - jpop->Append(GetPluginDir()); + jpop->Append(lc_messages_dir); jpop->Append("JdbcInterface.jar"); #endif // 0 - // All wrappers are pre-compiled in JavaWrappers.jar in the plugin dir + // All wrappers are pre-compiled in JavaWrappers.jar in the mysql share dir jpop->Append(sep); - jpop->Append(GetPluginDir()); + jpop->Append(lc_messages_dir); jpop->Append("JavaWrappers.jar"); #if defined(MONGO_SUPPORT) jpop->Append(sep); - jpop->Append(GetPluginDir()); + jpop->Append(lc_messages_dir); jpop->Append("Mongo3.jar"); jpop->Append(sep); - jpop->Append(GetPluginDir()); + jpop->Append(lc_messages_dir); jpop->Append("Mongo2.jar"); #endif // MONGO_SUPPORT diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index cc0a41042af..bdc6660c0a6 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -1774,7 +1774,6 @@ fts_create_one_common_table( dict_table_add_system_columns(new_table, heap); error = row_create_table_for_mysql(new_table, trx, FIL_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY); - if (error == DB_SUCCESS) { dict_index_t* index = dict_mem_index_create( @@ -1795,17 +1794,22 @@ fts_create_one_common_table( error = row_create_index_for_mysql(index, trx, NULL); trx->dict_operation = op; + } else { +err_exit: + new_table = NULL; + ib::warn() << "Failed to create FTS common table " + << fts_table_name; + trx->error_state = error; + return NULL; } if (error != DB_SUCCESS) { dict_mem_table_free(new_table); - new_table = NULL; - ib::warn() << "Failed to create FTS common table " - << fts_table_name; trx->error_state = DB_SUCCESS; row_drop_table_for_mysql(fts_table_name, trx, SQLCOM_DROP_DB); - trx->error_state = error; + goto err_exit; } + return(new_table); } @@ -1851,6 +1855,8 @@ fts_create_common_tables( FTS_INIT_FTS_TABLE(&fts_table, NULL, FTS_COMMON_TABLE, table); + op = trx_get_dict_operation(trx); + error = fts_drop_common_tables(trx, &fts_table); if (error != DB_SUCCESS) { @@ -1866,7 +1872,8 @@ fts_create_common_tables( dict_table_t* common_table = fts_create_one_common_table( trx, table, full_name[i], fts_table.suffix, heap); - if (common_table == NULL) { + if (!common_table) { + trx->error_state = DB_SUCCESS; error = DB_ERROR; goto func_exit; } else { @@ -1912,8 +1919,6 @@ fts_create_common_tables( error = row_create_index_for_mysql(index, trx, NULL); - trx->dict_operation = op; - func_exit: if (error != DB_SUCCESS) { for (it = common_tables.begin(); it != common_tables.end(); @@ -1923,6 +1928,8 @@ func_exit: } } + trx->dict_operation = op; + common_tables.clear(); mem_heap_free(heap); @@ -2006,16 +2013,20 @@ fts_create_one_index_table( error = row_create_index_for_mysql(index, trx, NULL); trx->dict_operation = op; + } else { +err_exit: + new_table = NULL; + ib::warn() << "Failed to create FTS index table " + << table_name; + trx->error_state = error; + return NULL; } if (error != DB_SUCCESS) { dict_mem_table_free(new_table); - new_table = NULL; - ib::warn() << "Failed to create FTS index table " - << table_name; trx->error_state = DB_SUCCESS; row_drop_table_for_mysql(table_name, trx, SQLCOM_DROP_DB); - trx->error_state = error; + goto err_exit; } return(new_table); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 20f21c29992..e023ed2a646 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5930,7 +5930,9 @@ ha_innobase::open(const char* name, int, uint) /* Index block size in InnoDB: used by MySQL in query optimization */ stats.block_size = static_cast(srv_page_size); - if (m_prebuilt->table == NULL + const my_bool for_vc_purge = THDVAR(thd, background_thread); + + if (for_vc_purge || !m_prebuilt->table || m_prebuilt->table->is_temporary() || m_prebuilt->table->persistent_autoinc || !m_prebuilt->table->is_readable()) { @@ -5957,7 +5959,7 @@ ha_innobase::open(const char* name, int, uint) ut_ad(!m_prebuilt->table || table->versioned() == m_prebuilt->table->versioned()); - if (!THDVAR(thd, background_thread)) { + if (!for_vc_purge) { info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_OPEN); } @@ -12911,7 +12913,6 @@ create_table_info_t::create_table_update_dict() if (m_flags2 & DICT_TF2_FTS) { if (!innobase_fts_load_stopword(innobase_table, NULL, m_thd)) { dict_table_close(innobase_table, FALSE, FALSE); - m_trx->free(); DBUG_RETURN(-1); } @@ -13041,19 +13042,12 @@ ha_innobase::create( } trx_rollback_for_mysql(trx); row_mysql_unlock_data_dictionary(trx); - if (own_trx) { - trx->free(); - } - DBUG_RETURN(error); + goto func_exit; } innobase_commit_low(trx); row_mysql_unlock_data_dictionary(trx); - if (own_trx) { - trx->free(); - } - /* Flush the log to reduce probability that the .frm files and the InnoDB data dictionary get out-of-sync if the user runs with innodb_flush_log_at_trx_commit = 0 */ @@ -13063,6 +13057,11 @@ ha_innobase::create( error = info.create_table_update_dict(); +func_exit: + if (own_trx) { + trx->free(); + } + DBUG_RETURN(error); } diff --git a/storage/mroonga/vendor/groonga/CMakeLists.txt b/storage/mroonga/vendor/groonga/CMakeLists.txt index ebb8b6906ec..b6ad3a9e50d 100644 --- a/storage/mroonga/vendor/groonga/CMakeLists.txt +++ b/storage/mroonga/vendor/groonga/CMakeLists.txt @@ -588,14 +588,13 @@ else() set(GRN_WITH_MESSAGE_PACK FALSE) endif() -find_program(RUBY NAMES - "ruby2.3" "ruby23" - "ruby2.2" "ruby22" - "ruby2.1" "ruby21" - "ruby") - option(GRN_WITH_MRUBY "use mruby" OFF) if(GRN_WITH_MRUBY) + find_program(RUBY NAMES + "ruby2.3" "ruby23" + "ruby2.2" "ruby22" + "ruby2.1" "ruby21" + "ruby") set(MRUBY_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/vendor/mruby-source/include") set(MRUBY_LIBS mruby)