diff options
43 files changed, 1447 insertions, 78 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 83b3a7e450d..c1ce1c55978 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -350,6 +350,11 @@ MYSQL_CHECK_READLINE() CHECK_JEMALLOC() +IF(CMAKE_CROSSCOMPILING) + SET(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Path to import_executables.cmake from a native build") + INCLUDE(${IMPORT_EXECUTABLES}) +ENDIF() + # # Setup maintainer mode options by the end. Platform checks are # not run with the warning options as to not perturb fragile checks diff --git a/debian/dist/Debian/mariadb-server-5.5.files.in b/debian/dist/Debian/mariadb-server-5.5.files.in index 5682adbdce0..c1ea58740e4 100644 --- a/debian/dist/Debian/mariadb-server-5.5.files.in +++ b/debian/dist/Debian/mariadb-server-5.5.files.in @@ -1,5 +1,4 @@ usr/lib/mysql/plugin/ha_innodb.so -usr/lib/mysql/plugin/ha_oqgraph.so usr/lib/mysql/plugin/sphinx.so usr/lib/mysql/plugin/auth_socket.so usr/lib/mysql/plugin/auth_pam.so @@ -73,3 +72,4 @@ usr/share/mysql/mysql_system_tables.sql usr/share/mysql/mysql_performance_tables.sql usr/share/mysql/mysql_test_data_timezone.sql @TOKUDB_DEB_FILES@ +@OQGRAPH_DEB_FILES@ diff --git a/debian/dist/Ubuntu/mariadb-server-5.5.files.in b/debian/dist/Ubuntu/mariadb-server-5.5.files.in index 06a6643d650..7f75ccc2303 100644 --- a/debian/dist/Ubuntu/mariadb-server-5.5.files.in +++ b/debian/dist/Ubuntu/mariadb-server-5.5.files.in @@ -1,5 +1,4 @@ usr/lib/mysql/plugin/ha_innodb.so -usr/lib/mysql/plugin/ha_oqgraph.so usr/lib/mysql/plugin/sphinx.so usr/lib/mysql/plugin/auth_socket.so usr/lib/mysql/plugin/auth_pam.so @@ -75,3 +74,4 @@ usr/share/mysql/mysql_system_tables.sql usr/share/mysql/mysql_performance_tables.sql usr/share/mysql/mysql_test_data_timezone.sql @TOKUDB_DEB_FILES@ +@OQGRAPH_DEB_FILES@ diff --git a/debian/dist/Ubuntu/mariadb-server-5.5.postinst b/debian/dist/Ubuntu/mariadb-server-5.5.postinst index 1c7aa37f69f..920868e22e6 100644 --- a/debian/dist/Ubuntu/mariadb-server-5.5.postinst +++ b/debian/dist/Ubuntu/mariadb-server-5.5.postinst @@ -213,7 +213,7 @@ EOF # admin might already have chosen to remove one or more plugins. Newlines are necessary. install_plugins=`/bin/echo -e \ "USE mysql;\n" \ - "CREATE TABLE plugin (name char(64) COLLATE utf8_bin NOT NULL DEFAULT '', " \ + "CREATE TABLE IF NOT EXISTS plugin (name char(64) COLLATE utf8_bin NOT NULL DEFAULT '', " \ " dl char(128) COLLATE utf8_bin NOT NULL DEFAULT '', " \ " PRIMARY KEY (name)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='MySQL plugins';" ` diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index ba69416b0ef..700b5de44f5 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1607,4 +1607,7 @@ create table t1 (pt point); insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))')); ERROR 22007: Incorrect POINT value: 'POLYGON' for column 'pt' at row 1 drop table t1; +SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)); +st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)) +GEOMETRYCOLLECTION EMPTY End of 5.5 tests diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index feb8ea37ba6..ee9779a2c23 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -5398,6 +5398,19 @@ DROP VIEW v1; DROP TABLE t1, t2; create view v1 as select 1; drop view v1; +# +# MDEV-7260: Crash in get_best_combination when executing multi-table +# UPDATE with nested views +# +CREATE TABLE `t1` (`id` bigint(20)); +INSERT INTO `t1` VALUES (1),(2); +CREATE TABLE `t2` (`id` bigint(20)); +CREATE TABLE `t3` (`id` bigint(20), `flag` tinyint(4)); +create view v1 as select id from t1; +create view v2 as select t2.* from (t2 left join v1 using (id)); +update t3 left join v2 using (id) set flag=flag+1; +drop view v2, v1; +drop table t1, t2, t3; # ----------------------------------------------------------------- # -- End of 5.5 tests. # ----------------------------------------------------------------- diff --git a/mysql-test/suite/innodb/r/innodb-mdev-7055.result b/mysql-test/suite/innodb/r/innodb-mdev-7055.result new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-mdev-7055.result @@ -0,0 +1 @@ +1 diff --git a/mysql-test/suite/innodb/r/innodb-mdev-7513.result b/mysql-test/suite/innodb/r/innodb-mdev-7513.result new file mode 100644 index 00000000000..bb3531e3f90 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-mdev-7513.result @@ -0,0 +1,204 @@ +call mtr.add_suppression("Row size too large (> 8126)*"); +CREATE TABLE t1 ( text1 TEXT, +text2 TEXT, +text3 TEXT, +text4 TEXT, +text5 TEXT, +text6 TEXT, +text7 TEXT, +text8 TEXT, +text9 TEXT, +text10 TEXT, +text11 TEXT, +text12 TEXT, +text13 TEXT, +text14 TEXT, +text15 TEXT, +text16 TEXT, +text17 TEXT, +text18 TEXT, +text19 TEXT, +text20 TEXT, +text21 TEXT, +text22 TEXT, +text23 TEXT, +text24 TEXT, +text25 TEXT, +text26 TEXT, +text27 TEXT, +text28 TEXT, +text29 TEXT, +text30 TEXT, +text31 TEXT, +text32 TEXT, +text33 TEXT, +text34 TEXT, +text35 TEXT, +text36 TEXT, +text37 TEXT, +text38 TEXT, +text39 TEXT, +text40 TEXT, +text41 TEXT, +text42 TEXT, +text43 TEXT, +text44 TEXT, +text45 TEXT, +text46 TEXT, +text47 TEXT, +text48 TEXT, +text49 TEXT, +text50 TEXT, +text51 TEXT, +text52 TEXT, +text53 TEXT, +text54 TEXT, +text55 TEXT, +text56 TEXT, +text57 TEXT, +text58 TEXT, +text59 TEXT, +text60 TEXT, +text61 TEXT, +text62 TEXT, +text63 TEXT, +text64 TEXT, +text65 TEXT, +text66 TEXT, +text67 TEXT, +text68 TEXT, +text69 TEXT, +text70 TEXT, +text71 TEXT, +text72 TEXT, +text73 TEXT, +text74 TEXT, +text75 TEXT, +text76 TEXT, +text77 TEXT, +text78 TEXT, +text79 TEXT, +text80 TEXT, +text81 TEXT, +text82 TEXT, +text83 TEXT, +text84 TEXT, +text85 TEXT, +text86 TEXT, +text87 TEXT, +text88 TEXT, +text89 TEXT, +text90 TEXT, +text91 TEXT, +text92 TEXT, +text93 TEXT, +text94 TEXT, +text95 TEXT, +text96 TEXT, +text97 TEXT, +text98 TEXT, +text99 TEXT, +text100 TEXT, +text101 TEXT, +text102 TEXT, +text103 TEXT, +text104 TEXT, +text105 TEXT, +text106 TEXT, +text107 TEXT, +text108 TEXT, +text109 TEXT, +text110 TEXT, +text111 TEXT, +text112 TEXT, +text113 TEXT, +text114 TEXT, +text115 TEXT, +text116 TEXT, +text117 TEXT, +text118 TEXT, +text119 TEXT, +text120 TEXT, +text121 TEXT, +text122 TEXT, +text123 TEXT, +text124 TEXT, +text125 TEXT, +text126 TEXT, +text127 TEXT, +text128 TEXT, +text129 TEXT, +text130 TEXT, +text131 TEXT, +text132 TEXT, +text133 TEXT, +text134 TEXT, +text135 TEXT, +text136 TEXT, +text137 TEXT, +text138 TEXT, +text139 TEXT, +text140 TEXT, +text141 TEXT, +text142 TEXT, +text143 TEXT, +text144 TEXT, +text145 TEXT, +text146 TEXT, +text147 TEXT, +text148 TEXT, +text149 TEXT, +text150 TEXT, +text151 TEXT, +text152 TEXT, +text153 TEXT, +text154 TEXT, +text155 TEXT, +text156 TEXT, +text157 TEXT, +text158 TEXT, +text159 TEXT, +text160 TEXT, +text161 TEXT, +text162 TEXT, +text163 TEXT, +text164 TEXT, +text165 TEXT, +text166 TEXT, +text167 TEXT, +text168 TEXT, +text169 TEXT, +text170 TEXT, +text171 TEXT, +text172 TEXT, +text173 TEXT, +text174 TEXT, +text175 TEXT, +text176 TEXT, +text177 TEXT, +text178 TEXT, +text179 TEXT, +text180 TEXT, +text181 TEXT, +text182 TEXT, +text183 TEXT, +text184 TEXT, +text185 TEXT, +text186 TEXT, +text187 TEXT, +text188 TEXT, +text189 TEXT, +text190 TEXT, +text191 TEXT, +text192 TEXT, +text193 TEXT, +text194 TEXT, +text195 TEXT, +text196 TEXT, +text197 TEXT +) ENGINE = InnoDB; +INSERT INTO t1 VALUES ('abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef'); +DELETE FROM t1 WHERE text1 = 'abcdef'; +SELECT * from t1; +text1 text2 text3 text4 text5 text6 text7 text8 text9 text10 text11 text12 text13 text14 text15 text16 text17 text18 text19 text20 text21 text22 text23 text24 text25 text26 text27 text28 text29 text30 text31 text32 text33 text34 text35 text36 text37 text38 text39 text40 text41 text42 text43 text44 text45 text46 text47 text48 text49 text50 text51 text52 text53 text54 text55 text56 text57 text58 text59 text60 text61 text62 text63 text64 text65 text66 text67 text68 text69 text70 text71 text72 text73 text74 text75 text76 text77 text78 text79 text80 text81 text82 text83 text84 text85 text86 text87 text88 text89 text90 text91 text92 text93 text94 text95 text96 text97 text98 text99 text100 text101 text102 text103 text104 text105 text106 text107 text108 text109 text110 text111 text112 text113 text114 text115 text116 text117 text118 text119 text120 text121 text122 text123 text124 text125 text126 text127 text128 text129 text130 text131 text132 text133 text134 text135 text136 text137 text138 text139 text140 text141 text142 text143 text144 text145 text146 text147 text148 text149 text150 text151 text152 text153 text154 text155 text156 text157 text158 text159 text160 text161 text162 text163 text164 text165 text166 text167 text168 text169 text170 text171 text172 text173 text174 text175 text176 text177 text178 text179 text180 text181 text182 text183 text184 text185 text186 text187 text188 text189 text190 text191 text192 text193 text194 text195 text196 text197 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-mdev-7055.test b/mysql-test/suite/innodb/t/innodb-mdev-7055.test new file mode 100644 index 00000000000..8f4d647e35d --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-mdev-7055.test @@ -0,0 +1,23 @@ +-- source include/have_innodb.inc + +# MDEV-7055: MySQL#74664 - InnoDB: Failing assertion: len <= col->len +# || col->mtype == 5 || (col->len == 0 && col->mtype == 1) in +# file rem0rec.cc line 845 +--disable_query_log +--disable_warnings +--disable_result_log +set @old_character_set=@@character_set_connection; +set character_set_connection=ucs2; +create TABLE t1 engine=innodb select if(0=0,'Y','N'); +insert INTO t1 values(date_format('2001-01-01','%W')); +select * from t1; +drop table t1; +set @@character_set_connection=@old_character_set; +--enable_result_log +--enable_warnings +--enable_query_log + +#produce something +--echo 1 + + diff --git a/mysql-test/suite/innodb/t/innodb-mdev-7513.test b/mysql-test/suite/innodb/t/innodb-mdev-7513.test new file mode 100644 index 00000000000..b929ea14781 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-mdev-7513.test @@ -0,0 +1,220 @@ +-- source include/have_innodb.inc +-- source include/not_embedded.inc + +# MDEV-7513: ib_warn_row_too_big dereferences null thd + +call mtr.add_suppression("Row size too large (> 8126)*"); + +--disable_warnings +CREATE TABLE t1 ( text1 TEXT, +text2 TEXT, +text3 TEXT, +text4 TEXT, +text5 TEXT, +text6 TEXT, +text7 TEXT, +text8 TEXT, +text9 TEXT, +text10 TEXT, +text11 TEXT, +text12 TEXT, +text13 TEXT, +text14 TEXT, +text15 TEXT, +text16 TEXT, +text17 TEXT, +text18 TEXT, +text19 TEXT, +text20 TEXT, +text21 TEXT, +text22 TEXT, +text23 TEXT, +text24 TEXT, +text25 TEXT, +text26 TEXT, +text27 TEXT, +text28 TEXT, +text29 TEXT, +text30 TEXT, +text31 TEXT, +text32 TEXT, +text33 TEXT, +text34 TEXT, +text35 TEXT, +text36 TEXT, +text37 TEXT, +text38 TEXT, +text39 TEXT, +text40 TEXT, +text41 TEXT, +text42 TEXT, +text43 TEXT, +text44 TEXT, +text45 TEXT, +text46 TEXT, +text47 TEXT, +text48 TEXT, +text49 TEXT, +text50 TEXT, +text51 TEXT, +text52 TEXT, +text53 TEXT, +text54 TEXT, +text55 TEXT, +text56 TEXT, +text57 TEXT, +text58 TEXT, +text59 TEXT, +text60 TEXT, +text61 TEXT, +text62 TEXT, +text63 TEXT, +text64 TEXT, +text65 TEXT, +text66 TEXT, +text67 TEXT, +text68 TEXT, +text69 TEXT, +text70 TEXT, +text71 TEXT, +text72 TEXT, +text73 TEXT, +text74 TEXT, +text75 TEXT, +text76 TEXT, +text77 TEXT, +text78 TEXT, +text79 TEXT, +text80 TEXT, +text81 TEXT, +text82 TEXT, +text83 TEXT, +text84 TEXT, +text85 TEXT, +text86 TEXT, +text87 TEXT, +text88 TEXT, +text89 TEXT, +text90 TEXT, +text91 TEXT, +text92 TEXT, +text93 TEXT, +text94 TEXT, +text95 TEXT, +text96 TEXT, +text97 TEXT, +text98 TEXT, +text99 TEXT, +text100 TEXT, +text101 TEXT, +text102 TEXT, +text103 TEXT, +text104 TEXT, +text105 TEXT, +text106 TEXT, +text107 TEXT, +text108 TEXT, +text109 TEXT, +text110 TEXT, +text111 TEXT, +text112 TEXT, +text113 TEXT, +text114 TEXT, +text115 TEXT, +text116 TEXT, +text117 TEXT, +text118 TEXT, +text119 TEXT, +text120 TEXT, +text121 TEXT, +text122 TEXT, +text123 TEXT, +text124 TEXT, +text125 TEXT, +text126 TEXT, +text127 TEXT, +text128 TEXT, +text129 TEXT, +text130 TEXT, +text131 TEXT, +text132 TEXT, +text133 TEXT, +text134 TEXT, +text135 TEXT, +text136 TEXT, +text137 TEXT, +text138 TEXT, +text139 TEXT, +text140 TEXT, +text141 TEXT, +text142 TEXT, +text143 TEXT, +text144 TEXT, +text145 TEXT, +text146 TEXT, +text147 TEXT, +text148 TEXT, +text149 TEXT, +text150 TEXT, +text151 TEXT, +text152 TEXT, +text153 TEXT, +text154 TEXT, +text155 TEXT, +text156 TEXT, +text157 TEXT, +text158 TEXT, +text159 TEXT, +text160 TEXT, +text161 TEXT, +text162 TEXT, +text163 TEXT, +text164 TEXT, +text165 TEXT, +text166 TEXT, +text167 TEXT, +text168 TEXT, +text169 TEXT, +text170 TEXT, +text171 TEXT, +text172 TEXT, +text173 TEXT, +text174 TEXT, +text175 TEXT, +text176 TEXT, +text177 TEXT, +text178 TEXT, +text179 TEXT, +text180 TEXT, +text181 TEXT, +text182 TEXT, +text183 TEXT, +text184 TEXT, +text185 TEXT, +text186 TEXT, +text187 TEXT, +text188 TEXT, +text189 TEXT, +text190 TEXT, +text191 TEXT, +text192 TEXT, +text193 TEXT, +text194 TEXT, +text195 TEXT, +text196 TEXT, +text197 TEXT +) ENGINE = InnoDB; + +INSERT INTO t1 VALUES ('abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef', 'abcdef'); +--enable_warnings + +DELETE FROM t1 WHERE text1 = 'abcdef'; + +--source include/restart_mysqld.inc + +--disable_warnings +SELECT * from t1; +--enable_warnings + +DROP TABLE t1; + diff --git a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test index 753f2e29ef2..88da919bfaa 100644 --- a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test +++ b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test @@ -3,11 +3,6 @@ # -- source include/have_innodb.inc -if (`select plugin_auth_version <= "5.5.40-MariaDB-36.1" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in XtraDB as of 5.5.40-MariaDB-36.1 or earlier -} - # Issues with innodb_change_buffering_debug on Windows, so the test scenario # cannot be created on windows --source include/not_windows.inc @@ -16,6 +11,7 @@ if (`select plugin_auth_version <= "5.5.40-MariaDB-36.1" from information_schema --source include/have_debug.inc -- disable_query_log +call mtr.add_suppression("Flagged corruption of idx.*in CHECK TABLE"); # This test setup is extracted from bug56680.test: # The flag innodb_change_buffering_debug is only available in debug builds. # It instructs InnoDB to try to evict pages from the buffer pool when @@ -28,10 +24,10 @@ SET GLOBAL innodb_change_buffering_debug = 1; SET UNIQUE_CHECKS=0; CREATE DATABASE pad; -let $i=345; +let $i=338; while ($i) { - --eval CREATE TABLE pad.t$i (a INT PRIMARY KEY) ENGINE=InnoDB; +--eval CREATE TABLE pad.t$i(a INT PRIMARY KEY)ENGINE=InnoDB; dec $i; } diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index 8843fc8b3e9..d91a4f424fe 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -85,6 +85,66 @@ create table sa_t1(id int); insert into sa_t1 values (1), (2); drop table sa_t1; drop database sa_db; +create database sa_db; +use sa_db; +CREATE USER u1 IDENTIFIED BY 'pwd-123'; +GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; +SET PASSWORD FOR u1 = PASSWORD('pwd 098'); +CREATE USER u3 IDENTIFIED BY ''; +drop user u1, u2, u3; +set global server_audit_events='query_ddl'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +id +1 +2 +select 2; +2 +2 +(select 2); +2 +2 +/*! select 2*/; +2 +2 +/*comment*/ select 2; +2 +2 +drop table t1; +set global server_audit_events='query_ddl,query_dml'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +id +1 +2 +select 2; +2 +2 +drop table t1; +set global server_audit_events='query_dml'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +id +1 +2 +select 2; +2 +2 +(select 2); +2 +2 +/*! select 2*/; +2 +2 +/*comment*/ select 2; +2 +2 +drop table t1; +set global server_audit_events=''; +drop database sa_db; set global server_audit_file_path='.'; show status like 'server_audit_current_log'; Variable_name Value @@ -176,19 +236,65 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc, TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0 TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,sa_db,,0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'.\'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'.\'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show status like \'server_audit_current_log\'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'\'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'\'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show status like \'server_audit_current_log\'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\' \'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\' \'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show status like \'server_audit_current_log\'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'nonexisting_dir/\'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_file_path=\'nonexisting_dir/\'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SHOW WARNINGS',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show status like \'server_audit_current_log\'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show variables like \'server_audit%\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create database sa_db',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'use sa_db',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select 2',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select 2',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'(select 2)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*! select 2*/',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*comment*/ select 2',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,proc, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proc, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,event, +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop database sa_db',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'.\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\' \'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\' \'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'nonexisting_dir/\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_file_path=\'nonexisting_dir/\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SHOW WARNINGS',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show status like \'server_audit_current_log\'',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'show variables like \'server_audit%\'',0 TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,plugin, -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'uninstall plugin server_audit',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'uninstall plugin server_audit',0 diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test index f63c8022392..f59a68e3148 100644 --- a/mysql-test/suite/plugins/t/server_audit.test +++ b/mysql-test/suite/plugins/t/server_audit.test @@ -15,6 +15,7 @@ connect (con1,localhost,root,,mysql); connection default; disconnect con1; --sleep 2 +--sleep 2 --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR connect (con1,localhost,no_such_user,,mysql); @@ -45,6 +46,8 @@ set global server_audit_events=''; create database sa_db; connect (con1,localhost,root,,test); connection con1; +--sleep 2 +--sleep 2 create table t1 (id2 int); insert into t1 values (1), (2); select * from t1; @@ -56,8 +59,43 @@ drop table sa_t1; drop database sa_db; connection default; disconnect con1; - --sleep 2 +--sleep 2 +create database sa_db; +use sa_db; +CREATE USER u1 IDENTIFIED BY 'pwd-123'; +GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; +SET PASSWORD FOR u1 = PASSWORD('pwd 098'); +CREATE USER u3 IDENTIFIED BY ''; +drop user u1, u2, u3; + +set global server_audit_events='query_ddl'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +select 2; +(select 2); +/*! select 2*/; +/*comment*/ select 2; +drop table t1; +set global server_audit_events='query_ddl,query_dml'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +select 2; +drop table t1; +set global server_audit_events='query_dml'; +create table t1(id int); +insert into t1 values (1), (2); +select * from t1; +select 2; +(select 2); +/*! select 2*/; +/*comment*/ select 2; +drop table t1; +set global server_audit_events=''; +drop database sa_db; + set global server_audit_file_path='.'; --replace_regex /\.[\\\/]/HOME_DIR\// show status like 'server_audit_current_log'; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 4d421e15d58..bce1fa2c226 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -1465,4 +1465,9 @@ create table t1 (pt point); insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))')); drop table t1; +# +# MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int) +# +SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)); + --echo End of 5.5 tests diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 8056836fe9a..b96799215fe 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -5345,6 +5345,28 @@ create view v1 as select 1; drop view v1; +--echo # +--echo # MDEV-7260: Crash in get_best_combination when executing multi-table +--echo # UPDATE with nested views +--echo # + +CREATE TABLE `t1` (`id` bigint(20)); + +INSERT INTO `t1` VALUES (1),(2); + +CREATE TABLE `t2` (`id` bigint(20)); + +CREATE TABLE `t3` (`id` bigint(20), `flag` tinyint(4)); + +create view v1 as select id from t1; + +create view v2 as select t2.* from (t2 left join v1 using (id)); + +update t3 left join v2 using (id) set flag=flag+1; + +drop view v2, v1; +drop table t1, t2, t3; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.5 tests. --echo # ----------------------------------------------------------------- diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 5c19b366347..491a98e44dd 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -14,11 +14,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define PLUGIN_VERSION 0x101 -#define PLUGIN_STR_VERSION "1.1.7" +#define PLUGIN_VERSION 0x102 +#define PLUGIN_STR_VERSION "1.2.0" #include <my_config.h> - #include <stdio.h> #include <time.h> #include <string.h> @@ -142,6 +141,10 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)), #define flogger_mutex_lock(A) pthread_mutex_lock(&(A)->m_mutex) #define flogger_mutex_unlock(A) pthread_mutex_unlock(&(A)->m_mutex) +static char **int_mysql_data_home; +static char *default_home= (char *)"."; +#define mysql_data_home (*int_mysql_data_home) + #include "../../mysys/file_logger.c" #endif /*!MARIADB_ONLY*/ @@ -165,6 +168,7 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)), extern char server_version[]; static const char *serv_ver= NULL; static int started_mysql= 0; +static int started_mariadb= 0; static int maria_above_5= 0; static char *incl_users, *excl_users, *file_path, *syslog_info; @@ -222,11 +226,15 @@ static MYSQL_SYSVAR_STR(excl_users, excl_users, PLUGIN_VAR_RQCMDARG, NULL, update_excl_users, NULL); /* bits in the event filter. */ #define EVENT_CONNECT 1 -#define EVENT_QUERY 2 +#define EVENT_QUERY_ALL 2 +#define EVENT_QUERY 26 #define EVENT_TABLE 4 +#define EVENT_QUERY_DDL 8 +#define EVENT_QUERY_DML 16 + static const char *event_names[]= { - "CONNECT", "QUERY", "TABLE", + "CONNECT", "QUERY", "TABLE", "QUERY_DDL", "QUERY_DML", NULL }; static TYPELIB events_typelib= @@ -234,7 +242,7 @@ static TYPELIB events_typelib= array_elements(event_names) - 1, "", event_names, NULL }; static MYSQL_SYSVAR_SET(events, events, PLUGIN_VAR_RQCMDARG, - "Specifies the set of events to monitor. Can be CONNECT, QUERY, TABLE.", + "Specifies the set of events to monitor. Can be CONNECT, QUERY, TABLE, QUERY_DDL, QUERY_DML.", NULL, NULL, 0, &events_typelib); #define OUTPUT_SYSLOG 0 #define OUTPUT_FILE 1 @@ -526,6 +534,103 @@ static int user_hash_fill(HASH *h, char *users, } +enum sa_keywords +{ + SQLCOM_NOTHING=0, + SQLCOM_DDL, + SQLCOM_DML, + SQLCOM_GRANT, + SQLCOM_CREATE_USER, + SQLCOM_CHANGE_MASTER, + SQLCOM_CREATE_SERVER, + SQLCOM_SET_OPTION, + SQLCOM_ALTER_SERVER, + SQLCOM_TRUNCATE, + SQLCOM_QUERY_ADMIN, + SQLCOM_DCL, +}; + +struct sa_keyword +{ + int length; + const char *wd; + struct sa_keyword *next; + enum sa_keywords type; +}; + + +struct sa_keyword xml_word= {3, "XML", 0, SQLCOM_NOTHING}; +struct sa_keyword user_word= {4, "USER", 0, SQLCOM_NOTHING}; +struct sa_keyword data_word= {4, "DATA", 0, SQLCOM_NOTHING}; +struct sa_keyword server_word= {6, "SERVER", 0, SQLCOM_NOTHING}; +struct sa_keyword master_word= {6, "MASTER", 0, SQLCOM_NOTHING}; +struct sa_keyword password_word= {8, "PASSWORD", 0, SQLCOM_NOTHING}; +struct sa_keyword function_word= {8, "FUNCTION", 0, SQLCOM_NOTHING}; +struct sa_keyword statement_word= {9, "STATEMENT", 0, SQLCOM_NOTHING}; +struct sa_keyword procedure_word= {9, "PROCEDURE", 0, SQLCOM_NOTHING}; + + +struct sa_keyword keywords_to_skip[]= +{ + {3, "SET", &statement_word, SQLCOM_QUERY_ADMIN}, + {0, NULL, 0, SQLCOM_DDL} +}; + + +struct sa_keyword not_ddl_keywords[]= +{ + {4, "DROP", &function_word, SQLCOM_QUERY_ADMIN}, + {4, "DROP", &procedure_word, SQLCOM_QUERY_ADMIN}, + {4, "DROP", &user_word, SQLCOM_DCL}, + {6, "CREATE", &user_word, SQLCOM_DCL}, + {6, "CREATE", &function_word, SQLCOM_QUERY_ADMIN}, + {6, "CREATE", &procedure_word, SQLCOM_QUERY_ADMIN}, + {6, "RENAME", &user_word, SQLCOM_DCL}, + {0, NULL, 0, SQLCOM_DDL} +}; + + +struct sa_keyword ddl_keywords[]= +{ + {4, "DROP", 0, SQLCOM_DDL}, + {5, "ALTER", 0, SQLCOM_DDL}, + {6, "CREATE", 0, SQLCOM_DDL}, + {6, "RENAME", 0, SQLCOM_DDL}, + {8, "TRUNCATE", 0, SQLCOM_DDL}, + {0, NULL, 0, SQLCOM_DDL} +}; + + +struct sa_keyword dml_keywords[]= +{ + {2, "DO", 0, SQLCOM_DML}, + {4, "CALL", 0, SQLCOM_DML}, + {4, "LOAD", &data_word, SQLCOM_DML}, + {4, "LOAD", &xml_word, SQLCOM_DML}, + {6, "DELETE", 0, SQLCOM_DML}, + {6, "INSERT", 0, SQLCOM_DML}, + {6, "SELECT", 0, SQLCOM_DML}, + {6, "UPDATE", 0, SQLCOM_DML}, + {7, "HANDLER", 0, SQLCOM_DML}, + {7, "REPLACE", 0, SQLCOM_DML}, + {0, NULL, 0, SQLCOM_DML} +}; + + +struct sa_keyword passwd_keywords[]= +{ + {3, "SET", &password_word, SQLCOM_SET_OPTION}, + {5, "ALTER", &server_word, SQLCOM_ALTER_SERVER}, + {5, "GRANT", 0, SQLCOM_GRANT}, + {6, "CREATE", &user_word, SQLCOM_CREATE_USER}, + {6, "CREATE", &server_word, SQLCOM_CREATE_SERVER}, + {6, "CHANGE", &master_word, SQLCOM_CHANGE_MASTER}, + {0, NULL, 0, SQLCOM_NOTHING} +}; + +#define MAX_KEYWORD 9 + + static void error_header() { struct tm tm_time; @@ -563,6 +668,7 @@ struct connection_info int log_always; }; + static HASH connection_hash; @@ -773,6 +879,21 @@ static struct connection_info * #define SAFE_STRLEN(s) (s ? strlen(s) : 0) +static int is_space(char c) +{ + return c == ' ' || c == '\r' || c == '\n' || c == '\t'; +} + + +#define SKIP_SPACES(str) \ +do { \ + while (is_space(*str)) \ + ++str; \ +} while(0) + + + + static struct connection_info * add_connection_initdb(const struct mysql_event_general *event) { @@ -980,6 +1101,98 @@ static size_t escape_string(const char *str, unsigned int len, } +static size_t escape_string_hide_passwords(const char *str, unsigned int len, + char *result, size_t result_len, + const char *word1, size_t word1_len, + const char *word2, size_t word2_len, + int next_text_string) +{ + const char *res_start= result; + const char *res_end= result + result_len - 2; + size_t d_len; + char b_char; + + while (len) + { + if (len > word1_len + 1 && strncasecmp(str, word1, word1_len) == 0) + { + const char *next_s= str + word1_len; + size_t c; + + if (next_text_string) + { + while (*next_s && *next_s != '\'' && *next_s != '"') + ++next_s; + } + else + { + if (word2) + { + SKIP_SPACES(next_s); + if (len < (next_s - str) + word2_len + 1 || + strncasecmp(next_s, word2, word2_len) != 0) + goto no_password; + next_s+= word2_len; + } + + while (*next_s && *next_s != '\'' && *next_s != '"') + ++next_s; + } + + d_len= next_s - str; + if (result + d_len + 5 > res_end) + break; + + for (c=0; c<d_len; c++) + result[c]= is_space(str[c]) ? ' ' : str[c]; + + memmove(result + d_len, "*****", 5); + result+= d_len + 5; + b_char= *(next_s++); + while (*next_s) + { + if (*next_s == b_char) + { + ++next_s; + break; + } + if (*next_s == '\\') + { + if (next_s[1]) + next_s++; + } + next_s++; + } + len-= next_s - str; + str= next_s; + continue; + } +no_password: + if (result >= res_end) + break; + if (*str == '\'') + { + *(result++)= '\\'; + *(result++)= '\''; + } + else if (*str == '\\') + { + *(result++)= '\\'; + *(result++)= '\\'; + } + else if (is_space(*str)) + *(result++)= ' '; + else + *(result++)= *str; + str++; + len--; + } + *result= 0; + return result - res_start; +} + + + static int do_log_user(const char *name) { size_t len; @@ -998,6 +1211,96 @@ static int do_log_user(const char *name) } +static int get_next_word(const char *query, char *word) +{ + int len= 0; + char c; + while ((c= query[len])) + { + if (c >= 'a' && c <= 'z') + word[len]= 'A' + (c-'a'); + else if (c >= 'A' && c <= 'Z') + word[len]= c; + else + break; + + if (len++ == MAX_KEYWORD) + return 0; + } + word[len]= 0; + return len; +} + + +static int filter_query_type(const char *query, struct sa_keyword *kwd) +{ + int qwe_in_list; + char fword[MAX_KEYWORD + 1], nword[MAX_KEYWORD + 1]; + int len, nlen= 0; + const struct sa_keyword *l_keywords; + + while (*query && (is_space(*query) || *query == '(' || *query == '/')) + { + /* comment handling */ + if (*query == '/' && query[1] == '*') + { + if (query[2] == '!') + { + query+= 3; + while (*query >= '0' && *query <= '9') + query++; + continue; + } + query+= 2; + while (*query) + { + if (*query=='*' && query[1] == '/') + { + query+= 2; + break; + } + query++; + } + continue; + } + query++; + } + + qwe_in_list= 0; + if (!(len= get_next_word(query, fword))) + goto not_in_list; + query+= len+1; + + l_keywords= kwd; + while (l_keywords->length) + { + if (l_keywords->length == len && strncmp(l_keywords->wd, fword, len) == 0) + { + if (l_keywords->next) + { + if (nlen == 0) + { + while (*query && is_space(*query)) + query++; + nlen= get_next_word(query, nword); + } + if (l_keywords->next->length != nlen || + strncmp(l_keywords->next->wd, nword, nlen) != 0) + goto do_loop; + } + + qwe_in_list= l_keywords->type; + break; + }; +do_loop: + l_keywords++; + } + +not_in_list: + return qwe_in_list; +} + + static int log_statement_ex(const struct connection_info *cn, time_t ev_time, unsigned long thd_id, const char *query, unsigned int query_len, @@ -1034,10 +1337,77 @@ static int log_statement_ex(const struct connection_info *cn, /* Can happen after the error in mysqld_prepare_stmt() */ query= cn->query; query_len= cn->query_length; + if (query == 0 || query_len == 0) + return 0; + } + + if (query && !(events & EVENT_QUERY_ALL) && + (events & EVENT_QUERY)) + { + const char *orig_query= query; + + if (filter_query_type(query, keywords_to_skip)) + { + char fword[MAX_KEYWORD + 1]; + int len; + do + { + len= get_next_word(query, fword); + query+= len ? len : 1; + if (len == 3 && strncmp(fword, "FOR", 3) == 0) + break; + } while (*query); + + if (*query == 0) + return 0; + } + + if (events & EVENT_QUERY_DDL) + { + if (!filter_query_type(query, not_ddl_keywords) && + filter_query_type(query, ddl_keywords)) + goto do_log_query; + } + if (events & EVENT_QUERY_DML) + { + if (filter_query_type(query, dml_keywords)) + goto do_log_query; + } + + return 0; +do_log_query: + query= orig_query; } - esc_q_len= escape_string(query, query_len, - uh_buffer, sizeof(uh_buffer)); + switch (filter_query_type(query, passwd_keywords)) + { + case SQLCOM_GRANT: + case SQLCOM_CREATE_USER: + esc_q_len= escape_string_hide_passwords(query, query_len, + uh_buffer, sizeof(uh_buffer), + "IDENTIFIED", 10, "BY", 2, 0); + break; + case SQLCOM_CHANGE_MASTER: + esc_q_len= escape_string_hide_passwords(query, query_len, + uh_buffer, sizeof(uh_buffer), + "MASTER_PASSWORD", 15, "=", 1, 0); + break; + case SQLCOM_CREATE_SERVER: + case SQLCOM_ALTER_SERVER: + esc_q_len= escape_string_hide_passwords(query, query_len, + uh_buffer, sizeof(uh_buffer), + "PASSWORD", 8, NULL, 0, 0); + break; + case SQLCOM_SET_OPTION: + esc_q_len= escape_string_hide_passwords(query, query_len, + uh_buffer, sizeof(uh_buffer), + "=", 1, NULL, 0, 1); + break; + default: + esc_q_len= escape_string(query, query_len, + uh_buffer, sizeof(uh_buffer)); + break; + } csize+= my_snprintf(message+csize, sizeof(message) - 1 - csize, ",\'%.*s\',%d", esc_q_len, uh_buffer, error_code); message[csize]= '\n'; @@ -1386,6 +1756,105 @@ exit_func: } +#ifdef DBUG_OFF + #ifdef __x86_64__ +static const int cmd_off= 4200; +static const int db_off= 120; +static const int db_len_off= 128; + #else +static const int cmd_off= 2668; +static const int db_off= 60; +static const int db_len_off= 64; + #endif /*x86_64*/ +#else + #ifdef __x86_64__ +static const int cmd_off= 4432; +static const int db_off= 120; +static const int db_len_off= 128; + #else +static const int cmd_off= 2808; +static const int db_off= 64; +static const int db_len_off= 68; + #endif /*x86_64*/ +#endif /*DBUG_OFF*/ + +struct mysql_event_general_v8 +{ + unsigned int event_class; + unsigned int event_subclass; + int general_error_code; + unsigned long general_thread_id; + const char *general_user; + unsigned int general_user_length; + const char *general_command; + unsigned int general_command_length; + const char *general_query; + unsigned int general_query_length; + struct charset_info_st *general_charset; + unsigned long long general_time; + unsigned long long general_rows; +}; + +static void auditing_v8(MYSQL_THD thd, struct mysql_event_general_v8 *ev_v8) +{ + struct mysql_event_general event; + + if (ev_v8->event_class != MYSQL_AUDIT_GENERAL_CLASS) + return; + + event.event_subclass= ev_v8->event_subclass; + event.general_error_code= ev_v8->general_error_code; + event.general_thread_id= ev_v8->general_thread_id; + event.general_user= ev_v8->general_user; + event.general_user_length= ev_v8->general_user_length; + event.general_command= ev_v8->general_command; + event.general_command_length= ev_v8->general_command_length; + event.general_query= ev_v8->general_query; + event.general_query_length= ev_v8->general_query_length; + event.general_charset= ev_v8->general_charset; + event.general_time= ev_v8->general_time; + event.general_rows= ev_v8->general_rows; + event.database= 0; + event.database_length= 0; + + if (event.general_query_length > 0) + { + event.event_subclass= MYSQL_AUDIT_GENERAL_STATUS; + event.general_command= "Query"; + event.general_command_length= 5; +#ifdef __linux__ + event.database= *(char **) (((char *) thd) + db_off); + event.database_length= *(size_t *) (((char *) thd) + db_len_off); +#endif /*__linux*/ + } +#ifdef __linux__ + else if (*((int *) (((char *)thd) + cmd_off)) == 2) + { + event.event_subclass= MYSQL_AUDIT_GENERAL_LOG; + event.general_command= "Init DB"; + event.general_command_length= 7; + event.general_query= *(char **) (((char *) thd) + db_off); + event.general_query_length= *(size_t *) (((char *) thd) + db_len_off); + } +#endif /*__linux*/ + auditing(thd, ev_v8->event_class, &event); +} + + +static void auditing_v13(MYSQL_THD thd, unsigned int *ev_v0) +{ + struct mysql_event_general event= *(const struct mysql_event_general *) (ev_v0+1); + + if (event.general_query_length > 0) + { + event.event_subclass= MYSQL_AUDIT_GENERAL_STATUS; + event.general_command= "Query"; + event.general_command_length= 5; + } + auditing(thd, ev_v0[0], &event); +} + + /* As it's just too difficult to #include "sql_class.h", let's just copy the necessary part of the system_variables @@ -1461,15 +1930,19 @@ typedef struct loc_system_variables ulong query_cache_type; } LOC_SV; + static int server_audit_init(void *p __attribute__((unused))) { const void *my_hash_init_ptr; + + if (!serv_ver) + { #ifdef _WIN32 - serv_ver= (const char *) GetProcAddress(0, "server_version"); + serv_ver= (const char *) GetProcAddress(0, "server_version"); #else - serv_ver= server_version; + serv_ver= server_version; #endif /*_WIN32*/ - + } my_hash_init_ptr= dlsym(RTLD_DEFAULT, "_my_hash_init"); if (!my_hash_init_ptr) { @@ -1477,8 +1950,14 @@ static int server_audit_init(void *p __attribute__((unused))) my_hash_init_ptr= dlsym(RTLD_DEFAULT, "my_hash_init2"); } + if(!(int_mysql_data_home= dlsym(RTLD_DEFAULT, "mysql_data_home"))) + { + if(!(int_mysql_data_home= dlsym(RTLD_DEFAULT, "?mysql_data_home@@3PADA"))) + int_mysql_data_home= &default_home; + } + if (!serv_ver || !my_hash_init_ptr) - return 0; + return 1; if (!started_mysql) { @@ -1489,7 +1968,6 @@ static int server_audit_init(void *p __attribute__((unused))) } } - if (gethostname(servhost, sizeof(servhost))) strcpy(servhost, "unknown"); @@ -1608,8 +2086,8 @@ mysql_declare_plugin(server_audit) MYSQL_AUDIT_PLUGIN, &mysql_descriptor, "SERVER_AUDIT", - " Alexey Botchkov (MariaDB)", - "Audit the server activity.", + " Alexey Botchkov (MariaDB Corporation)", + "Audit the server activity", PLUGIN_LICENSE_GPL, server_audit_init_mysql, server_audit_deinit, @@ -1636,8 +2114,8 @@ maria_declare_plugin(server_audit) MYSQL_AUDIT_PLUGIN, &maria_descriptor, "SERVER_AUDIT", - "Alexey Botchkov (MariaDB)", - "Audit the server activity.", + "Alexey Botchkov (MariaDB Corporation)", + "Audit the server activity", PLUGIN_LICENSE_GPL, server_audit_init, server_audit_deinit, @@ -1645,7 +2123,7 @@ maria_declare_plugin(server_audit) audit_status, vars, PLUGIN_STR_VERSION, - MariaDB_PLUGIN_MATURITY_BETA + MariaDB_PLUGIN_MATURITY_GAMMA } maria_declare_plugin_end; @@ -1915,3 +2393,48 @@ static void update_syslog_ident(MYSQL_THD thd __attribute__((unused)), } +#ifdef _WIN32 +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + if (fdwReason != DLL_PROCESS_ATTACH) + return 1; + + serv_ver= (const char *) GetProcAddress(0, "server_version"); +#else +void __attribute__ ((constructor)) audit_plugin_so_init(void) +{ + serv_ver= server_version; +#endif /*_WIN32*/ + + if (!serv_ver) + goto exit; + + started_mariadb= strstr(serv_ver, "MariaDB") != 0; + + if (!started_mariadb) + { + if (serv_ver[0] == '5' && serv_ver[2] == '5') + { + int sc= serv_ver[4] - '0'; + if (serv_ver[5] >= '0' && serv_ver[5] <= '9') + sc= sc * 10 + serv_ver[5] - '0'; + if (sc <= 10) + { + mysql_descriptor.interface_version= 0x0200; + mysql_descriptor.event_notify= (void *) auditing_v8; + } + else if (sc < 14) + { + mysql_descriptor.interface_version= 0x0200; + mysql_descriptor.event_notify= (void *) auditing_v13; + } + } + } +exit: +#ifdef _WIN32 + return 1; +#else + return; +#endif +} + diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 3428fff6a59..303e7a29a6d 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -28,6 +28,7 @@ syslog_tag= user='@MYSQLD_USER@' pid_file= err_log= +err_log_base= syslog_tag_mysqld=mysqld syslog_tag_mysqld_safe=mysqld_safe @@ -208,7 +209,7 @@ parse_arguments() { --user=*) user="$val"; SET_USER=1 ;; --log-basename=*|--hostname=*|--loose-log-basename=*) pid_file="$val.pid"; - err_log="$val.err"; + err_log_base="$val"; ;; # these might have been set in a [mysqld_safe] section of my.cnf @@ -577,7 +578,16 @@ then * ) err_log="$DATADIR/$err_log" ;; esac else - err_log=$DATADIR/`@HOSTNAME@`.err + if [ -n "$err_log_base" ] + then + err_log=$err_log_base.err + case "$err_log" in + /* ) ;; + * ) err_log="$DATADIR/$err_log" ;; + esac + else + err_log=$DATADIR/`@HOSTNAME@`.err + fi fi append_arg_to_args "--log-error=$err_log" diff --git a/sql-common/client_plugin.c b/sql-common/client_plugin.c index d96f9648011..f31ddb22a6a 100644 --- a/sql-common/client_plugin.c +++ b/sql-common/client_plugin.c @@ -28,6 +28,11 @@ There is no reference counting and no unloading either. */ +#if _MSC_VER +/* Silence warnings about variable 'unused' being used. */ +#define FORCE_INIT_OF_VARS 1 +#endif + #include <my_global.h> #include "mysql.h" #include <my_sys.h> diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index a38e9d416a7..5e1c0add54b 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -1286,6 +1286,13 @@ String *Item_func_buffer::val_str(String *str_value) if (dist > 0.0) mbr.buffer(dist); + else + { + /* This happens when dist is too far negative. */ + if (mbr.xmax + dist < mbr.xmin || mbr.ymax + dist < mbr.ymin) + goto return_empty_result; + } + collector.set_extent(mbr.xmin, mbr.xmax, mbr.ymin, mbr.ymax); /* If the distance given is 0, the Buffer function is in fact NOOP, @@ -1313,6 +1320,7 @@ String *Item_func_buffer::val_str(String *str_value) goto mem_error; +return_empty_result: str_value->set_charset(&my_charset_bin); if (str_value->reserve(SRID_SIZE, 512)) goto mem_error; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 90a12eb366d..3c36c2b514a 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2028,6 +2028,9 @@ unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list, bool check_alias) { TABLE_LIST *dup; + + table= table->find_table_for_update(); + if (table->table && table->table->file->ht->db_type == DB_TYPE_MRG_MYISAM) { TABLE_LIST *child; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 97d3d10c21c..055b4858598 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -657,9 +657,10 @@ multi_delete::initialize_tables(JOIN *join) delete_while_scanning= 1; for (walk= delete_tables; walk; walk= walk->next_local) { - tables_to_delete_from|= walk->table->map; + TABLE_LIST *tbl= walk->correspondent_table->find_table_for_update(); + tables_to_delete_from|= tbl->table->map; if (delete_while_scanning && - unique_table(thd, walk, join->tables_list, false)) + unique_table(thd, tbl, join->tables_list, false)) { /* If the table we are going to delete from appears diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 004cccb41a9..56748fa110d 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -507,6 +507,9 @@ bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived) DBUG_RETURN(FALSE); if (derived->is_materialized_derived()) DBUG_RETURN(mysql_derived_prepare(thd, lex, derived)); + if ((thd->lex->sql_command == SQLCOM_UPDATE_MULTI || + thd->lex->sql_command == SQLCOM_DELETE_MULTI)) + DBUG_RETURN(FALSE); if (!derived->is_multitable()) { if (!derived->single_table_updatable()) diff --git a/sql/table.h b/sql/table.h index 8e8c2811b71..7a1e380f14c 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1984,6 +1984,24 @@ struct TABLE_LIST TABLE_LIST *find_underlying_table(TABLE *table); TABLE_LIST *first_leaf_for_name_resolution(); TABLE_LIST *last_leaf_for_name_resolution(); + /** + @brief + Find the bottom in the chain of embedded table VIEWs. + + @detail + This is used for single-table UPDATE/DELETE when they are modifying a + single-table VIEW. + */ + TABLE_LIST *find_table_for_update() + { + TABLE_LIST *tbl= this; + while(!tbl->is_multitable() && tbl->single_table_updatable() && + tbl->merge_underlying_list) + { + tbl= tbl->merge_underlying_list; + } + return tbl; + } TABLE *get_real_join_table(); bool is_leaf_for_name_resolution(); inline TABLE_LIST *top_table() diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index c298f867ae3..9a99a03b70e 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -2530,7 +2530,7 @@ dict_foreign_remove_from_cache( rbt = foreign->referenced_table->referenced_rbt; - if (rbt != NULL) { + if (rbt != NULL && foreign->id != NULL) { const ib_rbt_node_t* node = rbt_lookup(rbt, foreign->id); dict_foreign_t* val = *(dict_foreign_t**) node->value; @@ -2549,7 +2549,7 @@ dict_foreign_remove_from_cache( foreign); rbt = foreign->foreign_table->foreign_rbt; - if (rbt != NULL) { + if (rbt != NULL && foreign->id != NULL) { const ib_rbt_node_t* node = rbt_lookup(rbt, foreign->id); dict_foreign_t* val = *(dict_foreign_t**) node->value; diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index d22fc8b9962..eee5402daa7 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -2731,6 +2731,14 @@ ibuf_contract_for_n_pages( ulint n_bytes; ulint n_pag2; +#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG + if (ibuf_debug) { + return(0); + } +#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ + + + while (sum_pages < n_pages) { n_bytes = ibuf_contract_ext(&n_pag2, sync); diff --git a/storage/innobase/rem/rem0rec.c b/storage/innobase/rem/rem0rec.c index d938aa696dd..95f249bc70e 100644 --- a/storage/innobase/rem/rem0rec.c +++ b/storage/innobase/rem/rem0rec.c @@ -830,7 +830,8 @@ rec_get_converted_size_comp_prefix_low( } ut_ad(len <= col->len || col->mtype == DATA_BLOB - || (col->len == 0 && col->mtype == DATA_VARCHAR)); + || col->mtype == DATA_VARMYSQL + || (col->len == 0 && col->mtype == DATA_VARCHAR)); fixed_len = field->fixed_len; if (temp && fixed_len @@ -1257,7 +1258,8 @@ rec_convert_dtuple_to_rec_comp( *lens-- = (byte) len; } else { ut_ad(len <= dtype_get_len(type) - || dtype_get_mtype(type) == DATA_BLOB); + || dtype_get_mtype(type) == DATA_BLOB + || dtype_get_mtype(type) == DATA_VARMYSQL); if (len < 128 || (dtype_get_len(type) < 256 && dtype_get_mtype(type) != DATA_BLOB)) { diff --git a/storage/oqgraph/CMakeLists.txt b/storage/oqgraph/CMakeLists.txt index 7b110b7de5a..0a3cabcd03c 100644 --- a/storage/oqgraph/CMakeLists.txt +++ b/storage/oqgraph/CMakeLists.txt @@ -52,4 +52,5 @@ IF(BOOST_OK) MYSQL_ADD_PLUGIN(oqgraph ha_oqgraph.cc graphcore.cc STORAGE_ENGINE MODULE_ONLY) + SET(OQGRAPH_DEB_FILES "usr/lib/mysql/plugin/ha_oqgraph.so\n" PARENT_SCOPE) ENDIF(BOOST_OK) diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt index 50f05159d10..1c3bf769ef4 100644 --- a/storage/xtradb/CMakeLists.txt +++ b/storage/xtradb/CMakeLists.txt @@ -330,6 +330,14 @@ SET(INNOBASE_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c ut/ut0byte.c ut/ut0dbg.c ut/ut0list.c ut/ut0mem.c ut/ut0rbt.c ut/ut0rnd.c ut/ut0ut.c ut/ut0vec.c ut/ut0wqueue.c ut/ut0bh.c) +# These files have unused result errors, so we skip Werror +CHECK_C_COMPILER_FLAG("-Werror" HAVE_WERROR) +IF(HAVE_WERROR) + INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake) + ADD_COMPILE_FLAGS(page/page0zip.c COMPILE_FLAGS "-Wno-error") + ADD_COMPILE_FLAGS(ut/ut0ut.c COMPILE_FLAGS "-Wno-error") +ENDIF() + IF(WITH_INNODB) # Legacy option SET(WITH_INNOBASE_STORAGE_ENGINE TRUE) diff --git a/storage/xtradb/dict/dict0dict.c b/storage/xtradb/dict/dict0dict.c index cf246bcdd5f..80f040564cf 100644 --- a/storage/xtradb/dict/dict0dict.c +++ b/storage/xtradb/dict/dict0dict.c @@ -42,6 +42,12 @@ UNIV_INTERN dict_index_t* dict_ind_compact; UNIV_INTERN uint ibuf_debug; #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ +/********************************************************************** +Issue a warning that the row is too big. */ +void +ib_warn_row_too_big(const dict_table_t* table); + + #ifndef UNIV_HOTBACKUP #include "buf0buf.h" #include "data0type.h" @@ -1892,11 +1898,18 @@ dict_index_add_to_cache( new_index->n_fields = new_index->n_def; - if (strict && dict_index_too_big_for_tree(table, new_index)) { + if (dict_index_too_big_for_tree(table, new_index)) { + + if (strict) { too_big: - dict_mem_index_free(new_index); - dict_mem_index_free(index); - return(DB_TOO_BIG_RECORD); + dict_mem_index_free(new_index); + dict_mem_index_free(index); + return(DB_TOO_BIG_RECORD); + } else { + + ib_warn_row_too_big(table); + + } } if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) { @@ -2650,8 +2663,14 @@ dict_foreign_remove_from_cache( foreign); rbt = foreign->referenced_table->referenced_rbt; - if (rbt != NULL) { - rbt_delete(rbt, foreign->id); + if (rbt != NULL && foreign->id != NULL) { + const ib_rbt_node_t* node + = rbt_lookup(rbt, foreign->id); + dict_foreign_t* val = *(dict_foreign_t**) node->value; + + if (val == foreign) { + rbt_delete(rbt, foreign->id); + } } } @@ -2663,8 +2682,14 @@ dict_foreign_remove_from_cache( foreign); rbt = foreign->foreign_table->foreign_rbt; - if (rbt != NULL) { - rbt_delete(rbt, foreign->id); + if (rbt != NULL && foreign->id != NULL) { + const ib_rbt_node_t* node + = rbt_lookup(rbt, foreign->id); + dict_foreign_t* val = *(dict_foreign_t**) node->value; + + if (val == foreign) { + rbt_delete(rbt, foreign->id); + } } } @@ -6031,11 +6056,11 @@ dict_set_corrupted( dict_index_copy_types(tuple, sys_index, 2); - btr_cur_search_to_nth_level(sys_index, 0, tuple, PAGE_CUR_GE, + btr_cur_search_to_nth_level(sys_index, 0, tuple, PAGE_CUR_LE, BTR_MODIFY_LEAF, &cursor, 0, __FILE__, __LINE__, &mtr); - if (cursor.up_match == dtuple_get_n_fields(tuple)) { + if (cursor.low_match == dtuple_get_n_fields(tuple)) { /* UPDATE SYS_INDEXES SET TYPE=index->type WHERE TABLE_ID=index->table->id AND INDEX_ID=index->id */ ulint len; diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index e4f5e088b9d..235caeb5067 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -10457,6 +10457,7 @@ ha_innobase::start_stmt( thr_lock_type lock_type) { trx_t* trx; + DBUG_ENTER("ha_innobase::start_stmt"); update_thd(thd); @@ -10479,6 +10480,28 @@ ha_innobase::start_stmt( prebuilt->hint_need_to_fetch_extra_cols = 0; reset_template(); + if (dict_table_is_temporary(prebuilt->table) + && prebuilt->mysql_has_locked + && prebuilt->select_lock_type == LOCK_NONE) { + ulint error; + + switch (thd_sql_command(thd)) { + case SQLCOM_INSERT: + case SQLCOM_UPDATE: + case SQLCOM_DELETE: + init_table_handle_for_HANDLER(); + prebuilt->select_lock_type = LOCK_X; + error = row_lock_table_for_mysql(prebuilt, NULL, 1); + + if (error != DB_SUCCESS) { + error = convert_error_code_to_mysql( + (int) error, 0, thd); + DBUG_RETURN((int) error); + } + break; + } + } + if (!prebuilt->mysql_has_locked) { /* This handle is for a temporary table created inside this same LOCK TABLES; since MySQL does NOT call external_lock @@ -10511,7 +10534,7 @@ ha_innobase::start_stmt( innobase_register_trx(ht, thd, trx); - return(0); + DBUG_RETURN(0); } /******************************************************************//** @@ -13958,6 +13981,37 @@ innobase_convert_to_filename_charset( } +/********************************************************************** +Issue a warning that the row is too big. */ +extern "C" +void +ib_warn_row_too_big(const dict_table_t* table) +{ + /* If prefix is true then a 768-byte prefix is stored + locally for BLOB fields. Refer to dict_table_get_format() */ + const bool prefix = ((table->flags & DICT_TF_FORMAT_MASK) + >> DICT_TF_FORMAT_SHIFT) < UNIV_FORMAT_B; + + const ulint free_space = page_get_free_space_of_empty( + table->flags & DICT_TF_COMPACT) / 2; + + THD* thd = current_thd; + + if (thd == NULL) { + return; + } + + push_warning_printf( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_ERR_TO_BIG_ROW, + "Row size too large (> %lu). Changing some columns to TEXT" + " or BLOB %smay help. In current row format, BLOB prefix of" + " %d bytes is stored inline.", free_space + , prefix ? "or using ROW_FORMAT=DYNAMIC or" + " ROW_FORMAT=COMPRESSED ": "" + , prefix ? DICT_MAX_FIXED_COL_LEN : 0); +} + + /**************************************************************************** * DS-MRR implementation ***************************************************************************/ diff --git a/storage/xtradb/ibuf/ibuf0ibuf.c b/storage/xtradb/ibuf/ibuf0ibuf.c index e04b6ac3ba6..7811b6ba19e 100644 --- a/storage/xtradb/ibuf/ibuf0ibuf.c +++ b/storage/xtradb/ibuf/ibuf0ibuf.c @@ -2775,6 +2775,12 @@ ibuf_contract_for_n_pages( ulint n_bytes; ulint n_pag2; +#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG + if (ibuf_debug) { + return(0); + } +#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ + while (sum_pages < n_pages) { n_bytes = ibuf_contract_ext(&n_pag2, sync); diff --git a/storage/xtradb/include/btr0cur.ic b/storage/xtradb/include/btr0cur.ic index 5fc4651ca13..5d122101fab 100644 --- a/storage/xtradb/include/btr0cur.ic +++ b/storage/xtradb/include/btr0cur.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. 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 @@ -28,7 +28,7 @@ Created 10/16/1994 Heikki Tuuri #ifdef UNIV_DEBUG # define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE)\ -if (btr_cur_limit_optimistic_insert_debug\ +if (btr_cur_limit_optimistic_insert_debug > 1\ && (NREC) >= (ulint)btr_cur_limit_optimistic_insert_debug) {\ CODE;\ } diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h index 2b53a33e103..3d05f40eb08 100644 --- a/storage/xtradb/include/dict0dict.h +++ b/storage/xtradb/include/dict0dict.h @@ -1399,6 +1399,14 @@ dict_table_init_referenced_rbt( /*===========================*/ dict_table_t* table); /*!< in: the table object whose table->referenced_rbt will be initialized */ +/********************************************************************//** +Check if it is a temporary table. +@return true if temporary table flag is set. */ +UNIV_INLINE +ibool +dict_table_is_temporary( +/*====================*/ + const dict_table_t* table); /*!< in: table to check */ #ifndef UNIV_NONINL #include "dict0dict.ic" diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic index 00ae3d0a718..6836928ff49 100644 --- a/storage/xtradb/include/dict0dict.ic +++ b/storage/xtradb/include/dict0dict.ic @@ -1017,3 +1017,15 @@ dict_table_init_referenced_rbt( ut_a(table->referenced_rbt != NULL); return(table->referenced_rbt); } + +/********************************************************************//** +Check if it is a temporary table. +@return true if temporary table flag is set. */ +UNIV_INLINE +ibool +dict_table_is_temporary( +/*====================*/ + const dict_table_t* table) /*!< in: table to check */ +{ + return(table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT)); +} diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i index af9560dbc13..1154e2e2f42 100644 --- a/storage/xtradb/include/univ.i +++ b/storage/xtradb/include/univ.i @@ -64,10 +64,10 @@ component, i.e. we show M.N.P as M.N */ (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR) #ifndef PERCONA_INNODB_VERSION -#define PERCONA_INNODB_VERSION 36.1 +#define PERCONA_INNODB_VERSION 37.0 #endif -#define INNODB_VERSION_STR "5.5.40-MariaDB-" IB_TO_STR(PERCONA_INNODB_VERSION) +#define INNODB_VERSION_STR "5.5.41-MariaDB-" IB_TO_STR(PERCONA_INNODB_VERSION) #define REFMAN "http://dev.mysql.com/doc/refman/" \ IB_TO_STR(MYSQL_MAJOR_VERSION) "." \ @@ -122,6 +122,10 @@ if we are compiling on Windows. */ # include <sched.h> # endif +# ifdef HAVE_MALLOC_H +# include <malloc.h> +# endif + /* We only try to do explicit inlining of functions with gcc and Sun Studio */ diff --git a/storage/xtradb/log/log0log.c b/storage/xtradb/log/log0log.c index ca866ab3036..bc208f42e50 100644 --- a/storage/xtradb/log/log0log.c +++ b/storage/xtradb/log/log0log.c @@ -260,7 +260,7 @@ log_buffer_extend( { ulint move_start; ulint move_end; - byte *tmp_buf=alloca(OS_FILE_LOG_BLOCK_SIZE); + byte* tmp_buf = alloca(OS_FILE_LOG_BLOCK_SIZE); mutex_enter(&(log_sys->mutex)); diff --git a/storage/xtradb/log/log0online.c b/storage/xtradb/log/log0online.c index 58f86d1581a..acb3bd58714 100644 --- a/storage/xtradb/log/log0online.c +++ b/storage/xtradb/log/log0online.c @@ -1817,7 +1817,7 @@ log_online_purge_changed_page_bitmaps( return TRUE; } - if (srv_track_changed_pages && lsn >= log_bmp_sys->end_lsn) { + if (srv_track_changed_pages && lsn > log_bmp_sys->end_lsn) { /* If we have to delete the current output file, close it first. */ os_file_close(log_bmp_sys->out.file); diff --git a/storage/xtradb/log/log0recv.c b/storage/xtradb/log/log0recv.c index 61239dfb25d..cae36421c52 100644 --- a/storage/xtradb/log/log0recv.c +++ b/storage/xtradb/log/log0recv.c @@ -2996,10 +2996,10 @@ recv_recovery_from_checkpoint_start_func( #endif /* UNIV_LOG_ARCHIVE */ byte* buf; byte* log_hdr_buf; - byte *log_hdr_buf_base; + byte* log_hdr_buf_base = alloca(LOG_FILE_HDR_SIZE + + OS_FILE_LOG_BLOCK_SIZE); ulint err; - log_hdr_buf_base= alloca(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE); log_hdr_buf = ut_align(log_hdr_buf_base, OS_FILE_LOG_BLOCK_SIZE); #ifdef UNIV_LOG_ARCHIVE diff --git a/storage/xtradb/rem/rem0rec.c b/storage/xtradb/rem/rem0rec.c index d938aa696dd..95f249bc70e 100644 --- a/storage/xtradb/rem/rem0rec.c +++ b/storage/xtradb/rem/rem0rec.c @@ -830,7 +830,8 @@ rec_get_converted_size_comp_prefix_low( } ut_ad(len <= col->len || col->mtype == DATA_BLOB - || (col->len == 0 && col->mtype == DATA_VARCHAR)); + || col->mtype == DATA_VARMYSQL + || (col->len == 0 && col->mtype == DATA_VARCHAR)); fixed_len = field->fixed_len; if (temp && fixed_len @@ -1257,7 +1258,8 @@ rec_convert_dtuple_to_rec_comp( *lens-- = (byte) len; } else { ut_ad(len <= dtype_get_len(type) - || dtype_get_mtype(type) == DATA_BLOB); + || dtype_get_mtype(type) == DATA_BLOB + || dtype_get_mtype(type) == DATA_VARMYSQL); if (len < 128 || (dtype_get_len(type) < 256 && dtype_get_mtype(type) != DATA_BLOB)) { diff --git a/storage/xtradb/row/row0mysql.c b/storage/xtradb/row/row0mysql.c index 7028c51babb..9496df8774a 100644 --- a/storage/xtradb/row/row0mysql.c +++ b/storage/xtradb/row/row0mysql.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2000, 2014, Oracle and/or its affiliates. All Rights Reserved. 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 @@ -3227,6 +3227,9 @@ row_drop_table_for_mysql( ulint namelen; ibool locked_dictionary = FALSE; pars_info_t* info = NULL; + DBUG_ENTER("row_drop_table_for_mysql"); + + DBUG_PRINT("row_drop_table_for_mysql", ("table: %s", name)); ut_a(name != NULL); @@ -3237,7 +3240,7 @@ row_drop_table_for_mysql( "InnoDB: Shut down mysqld and edit my.cnf so that newraw" " is replaced with raw.\n", stderr); - return(DB_ERROR); + DBUG_RETURN(DB_ERROR); } trx->op_info = "dropping table"; @@ -3644,7 +3647,7 @@ funct_exit: srv_wake_master_thread(); - return((int) err); + DBUG_RETURN((int) err); } /*********************************************************************//** diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index a19f09fc91f..e23b8373ec4 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -146,6 +146,9 @@ parse_server_arguments() { --datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` datadir_set=1 ;; + --log-basename=*|--hostname=*|--loose-log-basename=*) + mysqld_pid_file_path=`echo "$arg.pid" | sed -e 's/^[^=]*=//'` + ;; --pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; --service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; esac diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake index e429907cb2e..f9334f09570 100644 --- a/win/packaging/heidisql.cmake +++ b/win/packaging/heidisql.cmake @@ -1,4 +1,4 @@ -SET(HEIDISQL_BASE_NAME "HeidiSQL_8.3_Portable")
+SET(HEIDISQL_BASE_NAME "HeidiSQL_9.1_Portable")
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
diff --git a/win/packaging/heidisql.wxi.in b/win/packaging/heidisql.wxi.in index 1e6e3d552a8..6b1176921bc 100644 --- a/win/packaging/heidisql.wxi.in +++ b/win/packaging/heidisql.wxi.in @@ -23,9 +23,10 @@ uninstallation. We use RemoveFile to force delete in any case.
-->
<RemoveFile Id="Remove_HeidiSQL_exe" Name="heidisql.exe" On="uninstall" />
+ <!-- remove readme.txt too, it's not included in HeidiSQL-9.1-Portable.zip -->
+ <RemoveFile Id="Remove_readme_txt" Name="readme.txt" On="uninstall" />
<File Id="heidisql.license.txt" Name="license.txt" Source="${HEIDISQL_DOWNLOAD_DIR}\license.txt" />
- <File Id="heidisql.readme.txt" Name="readme.txt" Source="${HEIDISQL_DOWNLOAD_DIR}\readme.txt" />
</Component>
<Component Id="component.HeidiSQL_MenuShortcut" Guid="*" Win64="no">
<RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall" Name="shortcuts.heidisql" Value="1" Type="string" KeyPath="yes" />
@@ -34,6 +35,26 @@ <Component Id="component.HeidiSQL_libmysql.dll" Guid="*" Win64="no">
<File Id="heidisql.libmysql.dll" Name="libmysql.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql.dll" />
</Component>
+
+ <Component Id="component.HeidiSQL_libeay32.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libeay32.dll" Name="libeay32.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libeay32.dll" />
+ </Component>
+ <Component Id="component.HeidiSQL_libpq.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libpq.dll" Name="libpq.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libpq.dll" />
+ </Component>
+ <Component Id="component.HeidiSQL_ssleay32.dll" Guid="*" Win64="no">
+ <File Id="heidisql.ssleay32.dll" Name="ssleay32.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\ssleay32.dll" />
+ </Component>
+ <Component Id="component.HeidiSQL_libintl.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libintl.dll" Name="libintl.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libintl.dll" />
+ </Component>
+
+ <Directory Id="D.HeidiSQL.plugins" Name="plugins">
+ <Component Id="component.HeidiSQL_dialog.dll" Guid="*" Win64="no">
+ <File Id="heidisql.dialog.dll" Name="dialog.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\plugins\dialog.dll" />
+ </Component>
+ </Directory>
+
<Component Id="component.HeidiSQL_CleanupSettings" Guid="*" Win64="no">
<Condition>HEIDISQLINSTALLED</Condition>
<RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\UninstallCleanupHeidiSQLSettings" Name="cleanup.heidisql" Value="1" Type="string" KeyPath="yes" />
@@ -46,6 +67,11 @@ <ComponentRef Id="component.HeidiSQL"/>
<ComponentRef Id="component.HeidiSQL_MenuShortcut"/>
<ComponentRef Id="component.HeidiSQL_libmysql.dll"/>
+ <ComponentRef Id="component.HeidiSQL_libeay32.dll" />
+ <ComponentRef Id="component.HeidiSQL_libpq.dll" />
+ <ComponentRef Id="component.HeidiSQL_ssleay32.dll" />
+ <ComponentRef Id="component.HeidiSQL_libintl.dll" />
+ <ComponentRef Id="component.HeidiSQL_dialog.dll" />
<ComponentRef Id="component.HeidiSQL_CleanupSettings"/>
</ComponentGroup>
</Include>
|