summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/cpack_rpm.cmake2
-rw-r--r--debian/po/ca.po4
-rw-r--r--debian/po/cs.po4
-rw-r--r--debian/po/da.po72
-rw-r--r--debian/po/es.po4
-rw-r--r--debian/po/pt_BR.po4
-rw-r--r--debian/po/tr.po4
-rw-r--r--extra/mariabackup/xtrabackup.cc64
-rw-r--r--include/my_valgrind.h10
-rw-r--r--man/mysqlimport.118
-rw-r--r--mysql-test/main/delete_use_source.test2
-rw-r--r--mysql-test/main/derived_view.result401
-rw-r--r--mysql-test/main/derived_view.test260
-rw-r--r--mysql-test/main/disabled.def1
-rw-r--r--mysql-test/main/join_cache.result1499
-rw-r--r--mysql-test/main/join_cache.test79
-rw-r--r--mysql-test/main/join_nested_jcl6.result2
-rw-r--r--mysql-test/main/join_outer.result142
-rw-r--r--mysql-test/main/join_outer.test130
-rw-r--r--mysql-test/main/join_outer_jcl6.result198
-rw-r--r--mysql-test/main/lowercase_table4.test2
-rw-r--r--mysql-test/main/mysql_client_test.test2
-rw-r--r--mysql-test/main/mysql_client_test_nonblock.test2
-rw-r--r--mysql-test/main/mysqldump.test3
-rw-r--r--mysql-test/main/selectivity_innodb.test2
-rw-r--r--mysql-test/main/subselect_sj.result1
-rw-r--r--mysql-test/main/subselect_sj.test2
-rw-r--r--mysql-test/main/subselect_sj_jcl6.result1
-rw-r--r--mysql-test/main/trigger_null-8605.test4
-rw-r--r--mysql-test/suite/encryption/r/corrupted_during_recovery.result7
-rw-r--r--mysql-test/suite/encryption/r/innodb-force-corrupt.result5
-rw-r--r--mysql-test/suite/encryption/t/corrupted_during_recovery.combinations5
-rw-r--r--mysql-test/suite/encryption/t/corrupted_during_recovery.test13
-rw-r--r--mysql-test/suite/encryption/t/innodb-force-corrupt.test5
-rw-r--r--mysql-test/suite/galera/disabled.def1
-rw-r--r--mysql-test/suite/galera/r/MW-336.result18
-rw-r--r--mysql-test/suite/galera/r/galera_gcs_fc_limit.result27
-rw-r--r--mysql-test/suite/galera/t/MW-336.test28
-rw-r--r--mysql-test/suite/galera/t/galera_gcs_fc_limit.test30
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result25
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test47
-rw-r--r--mysql-test/suite/innodb/include/innodb-page-compression.inc2
-rw-r--r--mysql-test/suite/innodb/r/corrupted_during_recovery.result7
-rw-r--r--mysql-test/suite/innodb/r/innodb_force_recovery.result23
-rw-r--r--mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result20
-rw-r--r--mysql-test/suite/innodb/t/corrupted_during_recovery.opt3
-rw-r--r--mysql-test/suite/innodb/t/corrupted_during_recovery.test6
-rw-r--r--mysql-test/suite/innodb/t/doublewrite.test2
-rw-r--r--mysql-test/suite/innodb/t/full_crc32_import.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-table.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-change-buffer-recovery.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-index-debug.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-page-cleaners.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_compression_zip.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_force_recovery.test15
-rw-r--r--mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.combinations5
-rw-r--r--mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.opt2
-rw-r--r--mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test59
-rw-r--r--mysql-test/suite/innodb/t/log_file_size.test2
-rw-r--r--mysql-test/suite/innodb/t/mdev-15707.test2
-rw-r--r--mysql-test/suite/innodb/t/table_definition_cache_debug.test2
-rw-r--r--mysql-test/suite/innodb/t/update_time.test2
-rw-r--r--mysql-test/suite/mariabackup/mdev-14447.test2
-rw-r--r--mysql-test/suite/plugins/r/server_audit.result2
-rw-r--r--mysql-test/suite/plugins/r/thread_pool_server_audit.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result15
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test29
-rw-r--r--mysys/my_alloc.c3
-rw-r--r--plugin/server_audit/server_audit.c15
-rw-r--r--sql/log_event.cc3
-rw-r--r--sql/mysqld.h6
-rw-r--r--sql/opt_subselect.cc73
-rw-r--r--sql/records.cc33
-rw-r--r--sql/records.h6
-rw-r--r--sql/sql_const.h8
-rw-r--r--sql/sql_lex.h32
-rw-r--r--sql/sql_parse.cc7
-rw-r--r--sql/sql_select.cc179
-rw-r--r--sql/sql_window.h1
-rw-r--r--sql/temporary_tables.cc15
-rw-r--r--storage/innobase/buf/buf0buf.cc53
-rw-r--r--storage/innobase/buf/buf0lru.cc8
-rw-r--r--storage/innobase/fil/fil0crypt.cc49
-rw-r--r--storage/innobase/fil/fil0fil.cc54
-rw-r--r--storage/innobase/handler/ha_innodb.cc99
-rw-r--r--storage/innobase/handler/handler0alter.cc2
-rw-r--r--storage/innobase/handler/i_s.cc2
-rw-r--r--storage/innobase/include/btr0pcur.h10
-rw-r--r--storage/innobase/include/btr0pcur.ic20
-rw-r--r--storage/innobase/include/buf0lru.h6
-rw-r--r--storage/innobase/include/fil0fil.h24
-rw-r--r--storage/innobase/include/log0recv.h5
-rw-r--r--storage/innobase/include/ut0dbg.h6
-rw-r--r--storage/innobase/log/log0recv.cc26
-rw-r--r--storage/innobase/row/row0merge.cc16
-rw-r--r--storage/innobase/row/row0sel.cc58
-rw-r--r--storage/rocksdb/build_rocksdb.cmake25
97 files changed, 2877 insertions, 1310 deletions
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index db377184499..85965971286 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -37,7 +37,7 @@ IF(CMAKE_VERSION VERSION_LESS "3.6.0")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}")
ELSE()
SET(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
- SET(CPACK_RPM_DEBUGINFO_PACKAGE ON)
+ SET(CPACK_RPM_DEBUGINFO_PACKAGE ON CACHE INTERNAL "")
ENDIF()
SET(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}")
diff --git a/debian/po/ca.po b/debian/po/ca.po
index e2ba65054ba..0d4220a0258 100644
--- a/debian/po/ca.po
+++ b/debian/po/ca.po
@@ -203,13 +203,13 @@ msgstr ""
#~ msgid ""
#~ "MySQL will only install if you have a non-numeric hostname that is "
#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.4.0.1 "
+#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
#~ "myhostname\"."
#~ msgstr ""
#~ "El MySQL nom�s s'instal�la en cas de tenir un nom d'ordinador central que "
#~ "no sigui num�ric i que es pugui resoldre a trav�s del fitxer /etc/hosts. "
#~ "Ex. si l'ordre \"hostname\" retorna \"myhostname\", llavors hi ha d'haver "
-#~ "una l�nia com la seg�ent \"10.4.0.1 myhostname\"."
+#~ "una línia com la següent \"10.0.0.1 myhostname\"."
#, fuzzy
#~ msgid ""
diff --git a/debian/po/cs.po b/debian/po/cs.po
index c0d66613637..9b021acbc78 100644
--- a/debian/po/cs.po
+++ b/debian/po/cs.po
@@ -310,13 +310,13 @@ msgstr ""
#~ msgid ""
#~ "MySQL will only install if you have a non-numeric hostname that is "
#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.4.0.1 "
+#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
#~ "myhostname\"."
#~ msgstr ""
#~ "MySQL se nainstaluje pouze v případě, že používáte nenumerické jméno "
#~ "poÄítaÄe, které se dá pÅ™eložit pÅ™es soubor /etc/hosts. NapÅ™. když příkaz "
#~ "\"hostname\" vrátí \"diamond\", tak v /etc/hosts musí existovat obdobný "
-#~ "řádek jako \"10.4.0.1 diamond\"."
+#~ "řádek jako \"10.0.0.1 diamond\"."
#~ msgid ""
#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account "
diff --git a/debian/po/da.po b/debian/po/da.po
index 06d40cd58af..e2f1800c012 100644
--- a/debian/po/da.po
+++ b/debian/po/da.po
@@ -80,7 +80,7 @@ msgid ""
"You should also check the permissions and ownership of the /var/lib/mysql "
"directory:"
msgstr ""
-"Du b�r ogs� tjekke filrettighederne og ejerskabet af mappen /var/lib/mysql:"
+"Du bør også tjekke filrettighederne og ejerskabet af mappen /var/lib/mysql:"
#. Type: boolean
#. Description
@@ -107,7 +107,7 @@ msgid ""
"the data should be kept."
msgstr ""
"Hvis du fjerner MariaDB-pakken for senere at installere en nyere version, "
-"eller hvis en anden mariadb-server-pakke allerede benytter den, b�r dataene "
+"eller hvis en anden mariadb-server-pakke allerede benytter den, bør dataene "
"bevares."
#. Type: password
@@ -123,7 +123,7 @@ msgid ""
"While not mandatory, it is highly recommended that you set a password for "
"the MariaDB administrative \"root\" user."
msgstr ""
-"Selvom det ikke kr�ves, anbefales det kraftigt, at du s�tter en adgangskode "
+"Selvom det ikke kræves, anbefales det kraftigt, at du sætter en adgangskode "
"for MariaDB's administrationsbruger \"root\"."
#. Type: password
@@ -132,7 +132,7 @@ msgstr ""
#, fuzzy
#| msgid "If that field is left blank, the password will not be changed."
msgid "If this field is left blank, the password will not be changed."
-msgstr "Hvis du lader dette felt st� tomt, vil adgangskoden ikke blive �ndret."
+msgstr "Hvis du lader dette felt stå tomt, vil adgangskoden ikke blive ændret."
#. Type: password
#. Description
@@ -146,7 +146,7 @@ msgstr "Ny adgangskode for MariaDB's \"root\"-bruger:"
#. Description
#: ../mariadb-server-10.4.templates:7001
msgid "Unable to set password for the MariaDB \"root\" user"
-msgstr "Kunne ikke s�tte adgangskoden for MariaDB's \"root\"-bruger"
+msgstr "Kunne ikke sætte adgangskoden for MariaDB's \"root\"-bruger"
#. Type: error
#. Description
@@ -157,7 +157,7 @@ msgid ""
"because of a communication problem with the MariaDB server."
msgstr ""
"Der opstod en fejl, da adgangskoden for MariaDB's administrationsbruger blev "
-"fors�gt �ndret. Dette kan v�re sket, fordi brugeren allerede har en "
+"forsøgt ændret. Dette kan være sket, fordi brugeren allerede har en "
"adgangskode, eller fordi der var problemer med at kommunikere med MariaDB-"
"serveren."
@@ -165,7 +165,7 @@ msgstr ""
#. Description
#: ../mariadb-server-10.4.templates:7001
msgid "You should check the account's password after the package installation."
-msgstr "Du b�r tjekke kontoens adgangskode efter pakkeinstallationen."
+msgstr "Du bør tjekke kontoens adgangskode efter pakkeinstallationen."
#. Type: error
#. Description
@@ -194,11 +194,11 @@ msgid "The two passwords you entered were not the same. Please try again."
msgstr ""
#~ msgid "Really proceed with downgrade?"
-#~ msgstr "�nsker du virkelig at forts�tte nedgraderingen?"
+#~ msgstr "Ønsker du virkelig at fortsætte nedgraderingen?"
#~ msgid "A file named /var/lib/mysql/debian-*.flag exists on this system."
#~ msgstr ""
-#~ "Der er en fil med navnet /var/lib/mysql/debian-*.flag p� dette system."
+#~ "Der er en fil med navnet /var/lib/mysql/debian-*.flag på dette system."
#, fuzzy
#~| msgid ""
@@ -208,7 +208,7 @@ msgstr ""
#~ "Such a file is an indication that a mariadb-server package with a higher "
#~ "version has been installed previously."
#~ msgstr ""
-#~ "S�dan en fil tyder p� at der tidligere har v�ret installeret en h�jere "
+#~ "Sådan en fil tyder på at der tidligere har været installeret en højere "
#~ "version af mariadb-server-pakken."
#~ msgid ""
@@ -232,7 +232,7 @@ msgstr ""
#~ "To use MariaDB, the following entries for users and groups should be "
#~ "added to the system:"
#~ msgstr ""
-#~ "Nedenst�ende linjer for brugere og grupper skal tilf�jes dette system for "
+#~ "Nedenstående linjer for brugere og grupper skal tilføjes dette system for "
#~ "at benytte MariaDB:"
#~ msgid "Cannot upgrade if ISAM tables are present!"
@@ -246,18 +246,18 @@ msgstr ""
#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert "
#~ "those tables."
#~ msgstr ""
-#~ "Nyere versioner af MySQL kan ikke l�ngere benytte det gamle ISAM-"
-#~ "tabelformat, og det er derfor n�dvendigt at konvertere dine tabeller til "
+#~ "Nyere versioner af MySQL kan ikke længere benytte det gamle ISAM-"
+#~ "tabelformat, og det er derfor nødvendigt at konvertere dine tabeller til "
#~ "f.eks. MyISAM forud for opgraderingen med \"mysql_convert_table_format\" "
#~ "eller \"ALTER TABLE x ENGINE=MyISAM\". Installationen af mysql-server-5.1 "
#~ "afbrydes nu. Skulle din gamle mysql-server-4.1 alligevel bliver "
-#~ "afinstalleret, s� geninstall�r den blot og konverter tabellerne."
+#~ "afinstalleret, så geninstallér den blot og konverter tabellerne."
#~ msgid ""
#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?"
#~ msgstr ""
-#~ "Underst�t MySQL-forbindelser fra maskiner, der k�rer Debian \"Sarge\" "
-#~ "eller �ldre?"
+#~ "Understøt MySQL-forbindelser fra maskiner, der kører Debian \"Sarge\" "
+#~ "eller ældre?"
#~ msgid ""
#~ "In old versions of MySQL clients on Debian, passwords were not stored "
@@ -265,10 +265,10 @@ msgstr ""
#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to "
#~ "recent accounts or accounts whose password have been changed."
#~ msgstr ""
-#~ "Gamle udgaver af MySQL-klienter p� Debian gemte ikke adgangskoderne "
+#~ "Gamle udgaver af MySQL-klienter på Debian gemte ikke adgangskoderne "
#~ "sikkert. Dette er blevet forbedret siden da, men klienter (f.eks. PHP) "
-#~ "fra maskiner, der k�rer Debian 3.1 Sarge vil ikke kunne forbinde til "
-#~ "nyere konti eller konti, hvis adgangskode er blevet �ndret."
+#~ "fra maskiner, der kører Debian 3.1 Sarge vil ikke kunne forbinde til "
+#~ "nyere konti eller konti, hvis adgangskode er blevet ændret."
#~ msgid ""
#~ "To use mysql you must install an equivalent user and group to the "
@@ -276,7 +276,7 @@ msgstr ""
#~ "permissions (the uid/gid may be different)."
#~ msgstr ""
#~ "For at kunne bruge mysql skal du installere en bruger og en gruppe, der "
-#~ "svarer til nedenst�ende, og sikre dig at /var/lib/mysql har de rigtige "
+#~ "svarer til nedenstående, og sikre dig at /var/lib/mysql har de rigtige "
#~ "adgangsrettigheder (uid/gid kan afvige)."
#~ msgid ""
@@ -295,14 +295,14 @@ msgstr ""
#~ msgid ""
#~ "If you do not provide a password no changes will be made to the account."
-#~ msgstr "Hvis du ikke angiver en adgangskode, vil kontoen ikke blive �ndret."
+#~ msgstr "Hvis du ikke angiver en adgangskode, vil kontoen ikke blive ændret."
#~ msgid ""
#~ "When installation finishes, you should verify that the account is "
#~ "properly protected with a password (see README.Debian for more "
#~ "information)."
#~ msgstr ""
-#~ "N�r installationen afsluttes, b�r du tjekke at kontoen er ordentligt "
+#~ "Når installationen afsluttes, bør du tjekke at kontoen er ordentligt "
#~ "beskyttet med en adgangskode (se README.Debian for yderligere "
#~ "oplysninger)."
@@ -314,12 +314,12 @@ msgstr ""
#~ "corrupted! This script also enhances the privilege tables but is not "
#~ "supposed to give any user more rights that he had before,"
#~ msgstr ""
-#~ "Du skal k�re \"mysql_upgrade\" efter opgraderingen, da tabellerne eller "
-#~ "kan blive �delagt! Dette script forbedrer ogs� rettighedstabellerne, men "
+#~ "Du skal køre \"mysql_upgrade\" efter opgraderingen, da tabellerne eller "
+#~ "kan blive ødelagt! Dette script forbedrer også rettighedstabellerne, men "
#~ "burde ikke give nogen bruger flere rettigheder, end han havde tidligere,"
#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html"
-#~ msgstr "L�s ogs� http://www.mysql.com/doc/en/Upgrade.html"
+#~ msgstr "Læs også http://www.mysql.com/doc/en/Upgrade.html"
#~ msgid "Install Hints"
#~ msgstr "Installationstips"
@@ -331,17 +331,17 @@ msgstr ""
#~ msgstr ""
#~ "Ved opgraderinger fra MySQL 3.23, der fulgte med Debian Woody, kan de "
#~ "symbolske /var/lib/mysql or /var/log/mysql blive fjernet ved et uheld, og "
-#~ "m� genskabes manuelt."
+#~ "må genskabes manuelt."
#~ msgid ""
#~ "MySQL will only install if you have a non-numeric hostname that is "
#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.4.0.1 "
+#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
#~ "myhostname\"."
#~ msgstr ""
-#~ "MySQL vil kun blive installeret, hvis du har et ikke-numerisk v�rtsnavn, "
-#~ "som kan sl�s op i filen /ets/hosts. Hvis f.eks. kommandoen \"hostname\" "
-#~ "svarer med \"mitvaertsnavn\", skal du have en linje a'la \"10.4.0.1 "
+#~ "MySQL vil kun blive installeret, hvis du har et ikke-numerisk værtsnavn, "
+#~ "som kan slås op i filen /ets/hosts. Hvis f.eks. kommandoen \"hostname\" "
+#~ "svarer med \"mitvaertsnavn\", skal du have en linje a'la \"10.0.0.1 "
#~ "mitvaertsnavn\" i /etc/hosts."
#~ msgid ""
@@ -356,8 +356,8 @@ msgstr ""
#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in "
#~ "there, never only the password!"
#~ msgstr ""
-#~ "Husk at s�tte en ADGANGSKODE for MySQLs root-bruger! Hvis du bruger en /"
-#~ "etc/.my.cnf, s� skriv altid \"user\"- og \"password\"-linjer ind her, "
+#~ "Husk at sætte en ADGANGSKODE for MySQLs root-bruger! Hvis du bruger en /"
+#~ "etc/.my.cnf, så skriv altid \"user\"- og \"password\"-linjer ind her, "
#~ "ikke kun adgangskoden!"
#~ msgid ""
@@ -365,7 +365,7 @@ msgstr ""
#~ "by all MySQL versions, not necessarily only the one you are about to "
#~ "purge?"
#~ msgstr ""
-#~ "Skal jeg fjerne hele mappetr�et /var/lib/mysql, som benyttes af alle "
+#~ "Skal jeg fjerne hele mappetræet /var/lib/mysql, som benyttes af alle "
#~ "MySQL-versioner, ikke kun den version, du er ved at slette?"
#~ msgid ""
@@ -373,7 +373,7 @@ msgstr ""
#~ "make use of it mysql_fix_privilege_tables must be executed manually. The "
#~ "script is not supposed to give any user more rights that he had before,"
#~ msgstr ""
-#~ "En sj�lden gang imellem, f.eks. ved nye hovedversioner, sker det at "
-#~ "rettighedssystemet forbedres. For at g�re brug af dette, skal "
-#~ "mysql_fix_privilege_tables k�res manuelt. Scriptet vil ikke give nogen "
+#~ "En sjælden gang imellem, f.eks. ved nye hovedversioner, sker det at "
+#~ "rettighedssystemet forbedres. For at gøre brug af dette, skal "
+#~ "mysql_fix_privilege_tables køres manuelt. Scriptet vil ikke give nogen "
#~ "bruger flere rettigheder, end vedkommende havde tidligere,"
diff --git a/debian/po/es.po b/debian/po/es.po
index 825cda108ab..498e943ca6a 100644
--- a/debian/po/es.po
+++ b/debian/po/es.po
@@ -354,13 +354,13 @@ msgstr ""
#~ msgid ""
#~ "MySQL will only install if you have a non-numeric hostname that is "
#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.4.0.1 "
+#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
#~ "myhostname\"."
#~ msgstr ""
#~ "Sólo se instalará MySQL si tiene un nombre de equipo que no sea una "
#~ "dirección IP y pueda resolverse a través del archivo /etc/hosts. Por "
#~ "ejemplo, si la orden «hostname» devuelve «MiNombreEquipo» entonces deberá "
-#~ "existir una línea «10.4.0.1 MiNombreEquipo» en dicho archivo."
+#~ "existir una línea «10.0.0.1 MiNombreEquipo» en dicho archivo."
#~ msgid ""
#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account "
diff --git a/debian/po/pt_BR.po b/debian/po/pt_BR.po
index 31c9239f217..bdddcc4e5df 100644
--- a/debian/po/pt_BR.po
+++ b/debian/po/pt_BR.po
@@ -322,13 +322,13 @@ msgstr ""
#~ msgid ""
#~ "MySQL will only install if you have a non-numeric hostname that is "
#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.4.0.1 "
+#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
#~ "myhostname\"."
#~ msgstr ""
#~ "O MySQL será instalado somente caso você possua um nome de host NÃO "
#~ "NUMÉRICO que possa ser resolvido através do arquivo /etc/hosts, ou seja, "
#~ "caso o comando \"hostname\" retorne \"myhostname\", uma linha como "
-#~ "\"10.4.0.1 myhostname\" deverá existir no arquivo /etc/hosts."
+#~ "\"10.0.0.1 myhostname\" deverá existir no arquivo /etc/hosts."
#~ msgid ""
#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account "
diff --git a/debian/po/tr.po b/debian/po/tr.po
index 6695bdd8a96..77875e462ea 100644
--- a/debian/po/tr.po
+++ b/debian/po/tr.po
@@ -202,12 +202,12 @@ msgstr ""
#~ msgid ""
#~ "MySQL will only install if you have a non-numeric hostname that is "
#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command "
-#~ "returns \"myhostname\" then there must be a line like \"10.4.0.1 "
+#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 "
#~ "myhostname\"."
#~ msgstr ""
#~ "MySQL sadece /etc/hosts dosyası yoluyla çözülebilir NUMERİK OLMAYAN bir "
#~ "makine adına sahipseniz kurulacaktır. Örneğin, eğer \"hostname\" komutu "
-#~ "\"makinem\" ismini döndürüyorsa, bu dosya içinde \"10.4.0.1 makinem\" "
+#~ "\"makinem\" ismini döndürüyorsa, bu dosya içinde \"10.0.0.1 makinem\" "
#~ "gibi bir satır olmalıdır."
#, fuzzy
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 56653a192d3..a4b18950838 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -4146,9 +4146,12 @@ reread_log_header:
log_header_read(max_cp_field);
- if (checkpoint_no_start != mach_read_from_8(buf + LOG_CHECKPOINT_NO)) {
+ if (checkpoint_no_start != mach_read_from_8(buf + LOG_CHECKPOINT_NO)
+ || checkpoint_lsn_start
+ != mach_read_from_8(buf + LOG_CHECKPOINT_LSN)
+ || log_sys.log.get_lsn_offset()
+ != mach_read_from_8(buf + LOG_CHECKPOINT_OFFSET))
goto reread_log_header;
- }
log_mutex_exit();
@@ -4168,42 +4171,39 @@ reread_log_header:
}
/* label it */
- byte MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE) log_hdr[OS_FILE_LOG_BLOCK_SIZE];
- memset(log_hdr, 0, sizeof log_hdr);
- mach_write_to_4(LOG_HEADER_FORMAT + log_hdr, log_sys.log.format);
- mach_write_to_4(LOG_HEADER_SUBFORMAT + log_hdr, log_sys.log.subformat);
- mach_write_to_8(LOG_HEADER_START_LSN + log_hdr, checkpoint_lsn_start);
- strcpy(reinterpret_cast<char*>(LOG_HEADER_CREATOR + log_hdr),
- "Backup " MYSQL_SERVER_VERSION);
- log_block_set_checksum(log_hdr,
- log_block_calc_checksum_crc32(log_hdr));
-
- /* Write the log header. */
- if (ds_write(dst_log_file, log_hdr, sizeof log_hdr)) {
- log_write_fail:
- msg("error: write to logfile failed");
- goto fail;
- }
- /* Adjust the checkpoint page. */
- memcpy(log_hdr, buf, OS_FILE_LOG_BLOCK_SIZE);
- mach_write_to_8(log_hdr + LOG_CHECKPOINT_OFFSET,
- (checkpoint_lsn_start & (OS_FILE_LOG_BLOCK_SIZE - 1))
- | LOG_FILE_HDR_SIZE);
+ byte MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE) log_hdr_buf[LOG_FILE_HDR_SIZE];
+ memset(log_hdr_buf, 0, sizeof log_hdr_buf);
+
+ byte *log_hdr_field = log_hdr_buf;
+ mach_write_to_4(LOG_HEADER_FORMAT + log_hdr_field, log_sys.log.format);
+ mach_write_to_4(LOG_HEADER_SUBFORMAT + log_hdr_field, log_sys.log.subformat);
+ mach_write_to_8(LOG_HEADER_START_LSN + log_hdr_field, checkpoint_lsn_start);
+ strcpy(reinterpret_cast<char*>(LOG_HEADER_CREATOR + log_hdr_field),
+ "Backup " MYSQL_SERVER_VERSION);
+ log_block_set_checksum(log_hdr_field,
+ log_block_calc_checksum_crc32(log_hdr_field));
+
+ /* copied from log_group_checkpoint() */
+ log_hdr_field +=
+ (log_sys.next_checkpoint_no & 1) ? LOG_CHECKPOINT_2 : LOG_CHECKPOINT_1;
/* The least significant bits of LOG_CHECKPOINT_OFFSET must be
stored correctly in the copy of the ib_logfile. The most significant
bits, which identify the start offset of the log block in the file,
we did choose freely, as LOG_FILE_HDR_SIZE. */
ut_ad(!((log_sys.log.get_lsn() ^ checkpoint_lsn_start)
& (OS_FILE_LOG_BLOCK_SIZE - 1)));
- log_block_set_checksum(log_hdr,
- log_block_calc_checksum_crc32(log_hdr));
- /* Write checkpoint page 1 and two empty log pages before the
- payload. */
- if (ds_write(dst_log_file, log_hdr, OS_FILE_LOG_BLOCK_SIZE)
- || !memset(log_hdr, 0, sizeof log_hdr)
- || ds_write(dst_log_file, log_hdr, sizeof log_hdr)
- || ds_write(dst_log_file, log_hdr, sizeof log_hdr)) {
- goto log_write_fail;
+ /* Adjust the checkpoint page. */
+ memcpy(log_hdr_field, log_sys.checkpoint_buf, OS_FILE_LOG_BLOCK_SIZE);
+ mach_write_to_8(log_hdr_field + LOG_CHECKPOINT_OFFSET,
+ (checkpoint_lsn_start & (OS_FILE_LOG_BLOCK_SIZE - 1))
+ | LOG_FILE_HDR_SIZE);
+ log_block_set_checksum(log_hdr_field,
+ log_block_calc_checksum_crc32(log_hdr_field));
+
+ /* Write log header*/
+ if (ds_write(dst_log_file, log_hdr_buf, sizeof(log_hdr_buf))) {
+ msg("error: write to logfile failed");
+ goto fail;
}
log_copying_running = true;
diff --git a/include/my_valgrind.h b/include/my_valgrind.h
index 3b2dcb22dcf..9159ec5b138 100644
--- a/include/my_valgrind.h
+++ b/include/my_valgrind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010, 2017, MariaDB Corporation.
+/* Copyright (C) 2010, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,6 +13,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
+#ifndef MY_VALGRIND_INCLUDED
+#define MY_VALGRIND_INCLUDED
+
/* clang -> gcc */
#ifndef __has_feature
# define __has_feature(x) 0
@@ -33,6 +36,7 @@
# define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
# define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len)
# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
+# define REDZONE_SIZE 8
#elif defined(__SANITIZE_ADDRESS__)
# include <sanitizer/asan_interface.h>
/* How to do manual poisoning:
@@ -41,11 +45,13 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
# define MEM_NOACCESS(a,len) ASAN_POISON_MEMORY_REGION(a,len)
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
+# define REDZONE_SIZE 8
#else
# define MEM_UNDEFINED(a,len) ((void) (a), (void) (len))
# define MEM_NOACCESS(a,len) ((void) 0)
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
+# define REDZONE_SIZE 0
#endif /* HAVE_VALGRIND_MEMCHECK_H */
#if defined(TRASH_FREED_MEMORY)
@@ -56,3 +62,5 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
#define TRASH_ALLOC(A,B) do { TRASH_FILL(A,B,0xA5); MEM_UNDEFINED(A,B); } while(0)
#define TRASH_FREE(A,B) do { TRASH_FILL(A,B,0x8F); MEM_NOACCESS(A,B); } while(0)
+
+#endif /* MY_VALGRIND_INCLUDED */
diff --git a/man/mysqlimport.1 b/man/mysqlimport.1
index bc50bb1a785..2e9dc854669 100644
--- a/man/mysqlimport.1
+++ b/man/mysqlimport.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLIMPORT\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
+.TH "\FBMYSQLIMPORT\FR" "1" "21 May 2019" "MariaDB 10\&.4" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -346,6 +346,22 @@ option\&.
.sp -1
.IP \(bu 2.3
.\}
+.\" mysqlimport: ignore-foreign-keys option
+.\" ignore-foreign-keys option: mysqlimport
+\fB\-\-ignore\-foreign\-keys\fR,
+\fB\-k\fR
+.sp
+Disable foreign key checks while importing the data\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
.\" mysqlimport: ignore-lines option
.\" ignore-lines option: mysqlimport
\fB\-\-ignore\-lines=\fR\fB\fIN\fR\fR
diff --git a/mysql-test/main/delete_use_source.test b/mysql-test/main/delete_use_source.test
index 93065c6fe23..9b7b1f8650c 100644
--- a/mysql-test/main/delete_use_source.test
+++ b/mysql-test/main/delete_use_source.test
@@ -1,5 +1,7 @@
--source include/have_sequence.inc
--source include/have_innodb.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
create table t1(c1 integer not null,c2 integer not null, key (c1)) engine=InnoDb;
create view v1 as select * from t1 where c1 in (0,1);
diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result
index 28c3e2958e9..b488cbe09e4 100644
--- a/mysql-test/main/derived_view.result
+++ b/mysql-test/main/derived_view.result
@@ -3021,3 +3021,404 @@ DROP VIEW v1,v2,v3;
DROP TABLE t1;
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
+#
+# Bug mdev-12812: EXPLAIN for query with many expensive derived
+#
+CREATE TABLE t1
+(id int auto_increment primary key,
+uid int NOT NULL,
+gp_id int NOT NULL,
+r int NOT NULL
+);
+INSERT INTO t1(uid,gp_id,r) VALUES
+(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),
+(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),
+(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),
+(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),
+(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),
+(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),
+(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),
+(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),
+(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),
+(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),
+(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),
+(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),
+(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),
+(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),
+(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),
+(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),
+(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),
+(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),
+(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),
+(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),
+(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),
+(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),
+(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),
+(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),
+(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),
+(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),
+(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),
+(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),
+(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),
+(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),
+(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),
+(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),
+(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),
+(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),
+(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),
+(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),
+(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),
+(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),
+(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),
+(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),
+(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),
+(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),
+(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),
+(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),
+(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),
+(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),
+(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),
+(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),
+(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),
+(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),
+(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),
+(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),
+(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),
+(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),
+(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),
+(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),
+(1,11,1);
+CREATE TABLE t2 (id int) ;
+INSERT INTO t2 VALUES (1);
+explain SELECT 1 FROM t2 JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+) gp_1 ON gp_1.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+) gp_2 ON gp_2.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p1 ON p1.r=1 AND p1.uid=t2.id
+JOIN t1 p3 ON p3.r=3 AND p3.uid=t2.id
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+) gp_3 ON gp_3.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p1 ON p1.r=1 AND p1.uid=t2.id
+JOIN t1 p3 ON p3.r=3 AND p3.uid=t2.id
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+) gp_4 ON gp_4.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p1 ON p1.r=1 AND p1.uid=t2.id
+JOIN t1 p3 ON p3.r=3 AND p3.uid=t2.id
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+) gp_5 ON gp_5.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p1 ON p1.r=1 AND p1.uid=t2.id
+JOIN t1 p3 ON p3.r=3 AND p3.uid=t2.id
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+) gp_6 ON gp_6.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p1 ON p1.r=1 AND p1.uid=t2.id
+JOIN t1 p3 ON p3.r=3 AND p3.uid=t2.id
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+WHERE p1.gp_id=7) gp_7 ON gp_7.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+) gp_8 ON gp_8.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+) gp_9 ON gp_9.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+) gp_14 ON gp_14.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+) gp_15 ON gp_15.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+) gp_16 ON gp_16.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+)gp_17 ON gp_17.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+)gp_18 ON gp_18.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+)gp_19 ON gp_19.id=t2.id
+JOIN
+(SELECT t2.id
+FROM t2
+JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+) gp_20 ON gp_20.id=t2.id ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 system NULL NULL NULL NULL 1
+1 PRIMARY t2 system NULL NULL NULL NULL 1
+1 PRIMARY t2 system NULL NULL NULL NULL 1
+1 PRIMARY t2 system NULL NULL NULL NULL 1
+1 PRIMARY t2 system NULL NULL NULL NULL 1
+1 PRIMARY t2 system NULL NULL NULL NULL 1
+1 PRIMARY p4 ALL NULL NULL NULL NULL 550 Using where
+1 PRIMARY p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p4 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p1 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p3 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p4 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p1 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p3 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p4 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p1 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p3 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p4 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY <derived17> ALL NULL NULL NULL NULL 50328437500000 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY <derived14> ALL NULL NULL NULL NULL 27680640625000000 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY <derived7> ALL NULL NULL NULL NULL 7798774269472204800 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY <derived8> ALL NULL NULL NULL NULL 7798774269472204800 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY <derived9> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY <derived10> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY <derived11> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY <derived12> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY <derived13> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY <derived15> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY <derived16> ALL NULL NULL NULL NULL 15224352343750000640 Using where; Using join buffer (incremental, BNL join)
+17 DERIVED t2 system NULL NULL NULL NULL 1
+17 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where
+17 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join)
+17 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+17 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+17 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+16 DERIVED t2 system NULL NULL NULL NULL 1
+16 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where
+16 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join)
+16 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+16 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+16 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+16 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+16 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+15 DERIVED t2 system NULL NULL NULL NULL 1
+15 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where
+15 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join)
+15 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+15 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+15 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+15 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+15 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+14 DERIVED t2 system NULL NULL NULL NULL 1
+14 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where
+14 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join)
+14 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+14 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+14 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+14 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+13 DERIVED t2 system NULL NULL NULL NULL 1
+13 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where
+13 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join)
+13 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+13 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+13 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+13 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+13 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+12 DERIVED t2 system NULL NULL NULL NULL 1
+12 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where
+12 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join)
+12 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+12 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+12 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+12 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+12 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+11 DERIVED t2 system NULL NULL NULL NULL 1
+11 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where
+11 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join)
+11 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+11 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+11 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+11 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+11 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+10 DERIVED t2 system NULL NULL NULL NULL 1
+10 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where
+10 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join)
+10 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+10 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+10 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+10 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+10 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+9 DERIVED t2 system NULL NULL NULL NULL 1
+9 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where
+9 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join)
+9 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+9 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+9 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+9 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+9 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+8 DERIVED t2 system NULL NULL NULL NULL 1
+8 DERIVED p1 ALL NULL NULL NULL NULL 550 Using where
+8 DERIVED p3 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join)
+8 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+8 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+8 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+8 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+8 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+8 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+8 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+7 DERIVED t2 system NULL NULL NULL NULL 1
+7 DERIVED p1 ALL NULL NULL NULL NULL 550 Using where
+7 DERIVED p3 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (flat, BNL join)
+7 DERIVED p4 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+7 DERIVED p5 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+7 DERIVED p6 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+7 DERIVED p7 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+7 DERIVED p8 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+7 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+7 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
+DROP TABLE t1, t2;
diff --git a/mysql-test/main/derived_view.test b/mysql-test/main/derived_view.test
index 68f334e1ac4..2b89d3e4be6 100644
--- a/mysql-test/main/derived_view.test
+++ b/mysql-test/main/derived_view.test
@@ -1976,3 +1976,263 @@ DROP TABLE t1;
# The following command must be the last one the file
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
+
+--echo #
+--echo # Bug mdev-12812: EXPLAIN for query with many expensive derived
+--echo #
+
+CREATE TABLE t1
+(id int auto_increment primary key,
+ uid int NOT NULL,
+ gp_id int NOT NULL,
+ r int NOT NULL
+);
+
+INSERT INTO t1(uid,gp_id,r) VALUES
+(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),
+(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),
+(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),
+(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),
+(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,1,1),
+(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),
+(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),
+(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),
+(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),
+(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),(1,2,1),
+(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),
+(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),
+(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),
+(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),
+(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),(1,3,1),
+(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),
+(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),
+(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),
+(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),
+(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),(1,4,1),
+(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),
+(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),
+(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),
+(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),
+(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),(1,5,1),
+(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),
+(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),
+(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),
+(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),
+(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),(1,6,1),
+(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),
+(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),
+(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),
+(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),
+(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),(1,7,1),
+(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),
+(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),
+(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),
+(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),
+(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),(1,8,1),
+(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),
+(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),
+(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),
+(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),
+(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),(1,9,1),
+(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),
+(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),
+(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),
+(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),
+(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),
+(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,10,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),
+(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),
+(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),
+(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),
+(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),
+(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),(1,11,1),
+(1,11,1);
+
+CREATE TABLE t2 (id int) ;
+INSERT INTO t2 VALUES (1);
+
+explain SELECT 1 FROM t2 JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ ) gp_1 ON gp_1.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ ) gp_2 ON gp_2.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p1 ON p1.r=1 AND p1.uid=t2.id
+ JOIN t1 p3 ON p3.r=3 AND p3.uid=t2.id
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ ) gp_3 ON gp_3.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p1 ON p1.r=1 AND p1.uid=t2.id
+ JOIN t1 p3 ON p3.r=3 AND p3.uid=t2.id
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ ) gp_4 ON gp_4.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p1 ON p1.r=1 AND p1.uid=t2.id
+ JOIN t1 p3 ON p3.r=3 AND p3.uid=t2.id
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ ) gp_5 ON gp_5.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p1 ON p1.r=1 AND p1.uid=t2.id
+ JOIN t1 p3 ON p3.r=3 AND p3.uid=t2.id
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ ) gp_6 ON gp_6.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p1 ON p1.r=1 AND p1.uid=t2.id
+ JOIN t1 p3 ON p3.r=3 AND p3.uid=t2.id
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ WHERE p1.gp_id=7) gp_7 ON gp_7.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ ) gp_8 ON gp_8.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ ) gp_9 ON gp_9.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ ) gp_14 ON gp_14.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ ) gp_15 ON gp_15.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ ) gp_16 ON gp_16.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ )gp_17 ON gp_17.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ )gp_18 ON gp_18.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ JOIN t1 p9 ON p9.r=9 AND p9.uid=t2.id
+ JOIN t1 p10 ON p10.r=10 AND p10.uid=t2.id
+ )gp_19 ON gp_19.id=t2.id
+JOIN
+(SELECT t2.id
+ FROM t2
+ JOIN t1 p4 ON p4.r=4 AND p4.uid=t2.id
+ JOIN t1 p5 ON p5.r=5 AND p5.uid=t2.id
+ JOIN t1 p6 ON p6.r=6 AND p6.uid=t2.id
+ JOIN t1 p7 ON p7.r=7 AND p7.uid=t2.id
+ JOIN t1 p8 ON p8.r=8 AND p8.uid=t2.id
+ ) gp_20 ON gp_20.id=t2.id ;
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/main/disabled.def b/mysql-test/main/disabled.def
index 43bf4f9ab76..93fff886791 100644
--- a/mysql-test/main/disabled.def
+++ b/mysql-test/main/disabled.def
@@ -19,4 +19,3 @@ innodb_bug12902967 : broken upstream
file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
partition_open_files_limit : open_files_limit check broken by MDEV-18360
-join_cache : enable after MDEV-17752 is fixed
diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result
index 999ed500a84..cc536126332 100644
--- a/mysql-test/main/join_cache.result
+++ b/mysql-test/main/join_cache.result
@@ -60,21 +60,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -84,9 +84,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where
-1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -96,33 +96,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
set join_cache_level=2;
show variables like 'join_cache_level';
Variable_name Value
@@ -138,21 +138,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -162,9 +162,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where
-1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
+1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -174,33 +174,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
set join_cache_level=3;
show variables like 'join_cache_level';
Variable_name Value
@@ -216,21 +216,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -241,8 +241,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
-1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -252,33 +252,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
set join_cache_level=4;
show variables like 'join_cache_level';
Variable_name Value
@@ -294,21 +294,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -319,8 +319,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
-1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -330,33 +330,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
SELECT Country.Name, Country.Population, City.Name, City.Population
FROM Country LEFT JOIN City
ON City.Country=Country.Code AND City.Population > 5000000
@@ -478,21 +478,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -502,9 +502,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where
+1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -514,33 +514,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
set join_cache_level=2;
show variables like 'join_cache_level';
Variable_name Value
@@ -556,21 +556,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -580,9 +580,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where
+1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -592,33 +592,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
set join_cache_level=3;
show variables like 'join_cache_level';
Variable_name Value
@@ -634,21 +634,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -658,9 +658,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE Country hash_ALL NULL #hash#$hj 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
+1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -670,33 +670,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
set join_cache_level=4;
show variables like 'join_cache_level';
Variable_name Value
@@ -712,21 +712,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -736,9 +736,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE Country hash_ALL NULL #hash#$hj 3 world.City.Country 239 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where
+1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join)
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -748,33 +748,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
set join_cache_level=default;
set join_buffer_size=default;
show variables like 'join_buffer_size';
@@ -829,21 +829,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -854,8 +854,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE CountryLanguage hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (flat, BNLH join); Using rowid filter
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -865,33 +865,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
@@ -1029,21 +1029,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -1054,8 +1054,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE CountryLanguage hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (incremental, BNLH join); Using rowid filter
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -1065,33 +1065,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
@@ -1288,21 +1288,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -1313,8 +1313,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -1323,34 +1323,34 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
-Lomas de Zamora Argentina Spanish
La Matanza Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-Lleida (Lérida) Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Liupanshui China Chinese
-Liangcheng China Chinese
-Lianyungang China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Leverkusen Germany German
-Ludwigshafen am Rhein Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
@@ -1485,21 +1485,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -1510,8 +1510,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
-1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -1520,34 +1520,34 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
-Lomas de Zamora Argentina Spanish
La Matanza Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-Lleida (Lérida) Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Liupanshui China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lianyungang China Chinese
-Las Margaritas Mexico Spanish
Lagos de Moreno Mexico Spanish
-Lázaro Cárdenas Mexico Spanish
-Lashio (Lasho) Myanmar Burmese
Lalitapur Nepal Nepali
-Leverkusen Germany German
-Ludwigshafen am Rhein Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
+Lashio (Lasho) Myanmar Burmese
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Little Rock United States English
-Louisville United States English
+Leverkusen Germany German
Lexington-Fayette United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
+Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
Long Beach United States English
+Los Angeles Chile Spanish
Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
@@ -1682,21 +1682,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -1707,8 +1707,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -1718,33 +1718,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Lleida (Lérida) Spain Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Liupanshui China Chinese
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
-Lázaro Cárdenas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Leverkusen Germany German
-Ludwigshafen am Rhein Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
-Los Angeles United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
@@ -1879,21 +1879,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -1904,8 +1904,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
-1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -1915,33 +1915,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Lleida (Lérida) Spain Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Liupanshui China Chinese
Lagos de Moreno Mexico Spanish
-Lázaro Cárdenas Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Leverkusen Germany German
-Ludwigshafen am Rhein Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
+Leverkusen Germany German
Lexington-Fayette United States English
-Los Angeles United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
+Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
Louisville United States English
-Little Rock United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
@@ -2080,21 +2080,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -2105,8 +2105,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE CountryLanguage hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (flat, BNLH join); Using rowid filter
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -2116,33 +2116,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
@@ -2184,21 +2184,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -2209,8 +2209,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (incremental, BNLH join)
+1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE CountryLanguage hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (incremental, BNLH join); Using rowid filter
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -2220,33 +2220,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
@@ -2288,21 +2288,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -2313,8 +2313,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -2324,33 +2324,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
@@ -2392,21 +2392,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -2417,8 +2417,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
-1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -2428,33 +2428,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
@@ -2496,21 +2496,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -2521,8 +2521,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -2532,33 +2532,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Liangcheng China Chinese
-Lianyungang China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
-Las Margaritas Mexico Spanish
Lagos de Moreno Mexico Spanish
-Lashio (Lasho) Myanmar Burmese
Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
+Lashio (Lasho) Myanmar Burmese
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
+Leverkusen Germany German
Lexington-Fayette United States English
-Los Angeles United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
+Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
Louisville United States English
-Little Rock United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
@@ -2600,21 +2600,21 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
EXPLAIN
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
@@ -2625,8 +2625,8 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
-1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
-1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
+1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -2636,33 +2636,33 @@ CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
Name Name Language
La Matanza Argentina Spanish
-Lomas de Zamora Argentina Spanish
-Lauro de Freitas Brazil Portuguese
-Los Angeles Chile Spanish
-Las Palmas de Gran Canaria Spain Spanish
-L´Hospitalet de Llobregat Spain Spanish
-Lleida (Lérida) Spain Spanish
-Liupanshui China Chinese
-Lianyungang China Chinese
-Liangcheng China Chinese
-Lengshuijiang China Chinese
-Lázaro Cárdenas Mexico Spanish
Lagos de Moreno Mexico Spanish
+Lalitapur Nepal Nepali
Las Margaritas Mexico Spanish
+Las Palmas de Gran Canaria Spain Spanish
Lashio (Lasho) Myanmar Burmese
-Lalitapur Nepal Nepali
-Ludwigshafen am Rhein Germany German
-Leverkusen Germany German
-Luchou Taiwan Min
-Lungtan Taiwan Min
-Lower Hutt New Zealand English
-Los Teques Venezuela Spanish
+Lauro de Freitas Brazil Portuguese
+Lengshuijiang China Chinese
Leninsk-Kuznetski Russian Federation Russian
-Los Angeles United States English
-Long Beach United States English
+Leverkusen Germany German
Lexington-Fayette United States English
-Louisville United States English
+Liangcheng China Chinese
+Lianyungang China Chinese
Little Rock United States English
+Liupanshui China Chinese
+Lleida (Lérida) Spain Spanish
+Lomas de Zamora Argentina Spanish
+Long Beach United States English
+Los Angeles Chile Spanish
+Los Angeles United States English
+Los Teques Venezuela Spanish
+Louisville United States English
+Lower Hutt New Zealand English
+Luchou Taiwan Min
+Ludwigshafen am Rhein Germany German
+Lungtan Taiwan Min
+L´Hospitalet de Llobregat Spain Spanish
+Lázaro Cárdenas Mexico Spanish
EXPLAIN
SELECT Name FROM City
WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
@@ -2701,52 +2701,52 @@ set join_cache_level=1;
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND City.Population > 3000000;
Name Name
-Sydney Australia
-Dhaka Bangladesh
-São Paulo Brazil
-Rio de Janeiro Brazil
-London United Kingdom
-Santiago de Chile Chile
-Cairo Egypt
Alexandria Egypt
-Jakarta Indonesia
-Mumbai (Bombay) India
-Delhi India
+Ankara Turkey
+Baghdad Iraq
+Bangkok Thailand
+Berlin Germany
+Cairo Egypt
Calcutta [Kolkata] India
+Chengdu China
Chennai (Madras) India
-Baghdad Iraq
-Teheran Iran
-Tokyo Japan
-Jokohama [Yokohama] Japan
-Shanghai China
-Peking China
Chongqing China
-Tianjin China
-Wuhan China
+Ciudad de México Mexico
+Delhi India
+Dhaka Bangladesh
Harbin China
-Shenyang China
+Ho Chi Minh City Vietnam
+Istanbul Turkey
+Jakarta Indonesia
+Jokohama [Yokohama] Japan
Kanton [Guangzhou] China
-Chengdu China
-Santafé de Bogotá Colombia
-Kinshasa Congo, The Democratic Republic of the
-Seoul South Korea
-Pusan South Korea
-Ciudad de México Mexico
-Rangoon (Yangon) Myanmar
Karachi Pakistan
+Kinshasa Congo, The Democratic Republic of the
Lahore Pakistan
Lima Peru
-Berlin Germany
+London United Kingdom
+Los Angeles United States
+Moscow Russian Federation
+Mumbai (Bombay) India
+New York United States
+Peking China
+Pusan South Korea
+Rangoon (Yangon) Myanmar
+Rio de Janeiro Brazil
Riyadh Saudi Arabia
+Santafé de Bogotá Colombia
+Santiago de Chile Chile
+Seoul South Korea
+Shanghai China
+Shenyang China
Singapore Singapore
-Bangkok Thailand
-Istanbul Turkey
-Ankara Turkey
-Moscow Russian Federation
St Petersburg Russian Federation
-Ho Chi Minh City Vietnam
-New York United States
-Los Angeles United States
+Sydney Australia
+São Paulo Brazil
+Teheran Iran
+Tianjin China
+Tokyo Japan
+Wuhan China
set join_cache_level=8;
set join_buffer_size=384;
EXPLAIN
@@ -2811,41 +2811,41 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
ALTER TABLE Country MODIFY Name varchar(300) NOT NULL default '';
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name
-Vientiane Laos
-Riga Latvia
-Daugavpils Latvia
-Maseru Lesotho
+?iauliai Lithuania
Beirut Lebanon
-Tripoli Lebanon
-Monrovia Liberia
-Tripoli Libyan Arab Jamahiriya
Bengasi Libyan Arab Jamahiriya
-Misrata Libyan Arab Jamahiriya
-Vilnius Lithuania
+Daugavpils Latvia
Kaunas Lithuania
Klaipeda Lithuania
-?iauliai Lithuania
+Maseru Lesotho
+Misrata Libyan Arab Jamahiriya
+Monrovia Liberia
Panevezys Lithuania
+Riga Latvia
+Tripoli Lebanon
+Tripoli Libyan Arab Jamahiriya
+Vientiane Laos
+Vilnius Lithuania
ALTER TABLE Country ADD COLUMN PopulationBar text;
UPDATE Country
SET PopulationBar=REPEAT('x', CAST(Population/100000 AS unsigned int));
@@ -2853,43 +2853,74 @@ SELECT City.Name, Country.Name, Country.PopulationBar FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name PopulationBar
-Vientiane Laos xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-Riga Latvia xxxxxxxxxxxxxxxxxxxxxxxx
-Daugavpils Latvia xxxxxxxxxxxxxxxxxxxxxxxx
-Maseru Lesotho xxxxxxxxxxxxxxxxxxxxxx
+?iauliai Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Beirut Lebanon xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-Tripoli Lebanon xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-Monrovia Liberia xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-Tripoli Libyan Arab Jamahiriya xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bengasi Libyan Arab Jamahiriya xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-Misrata Libyan Arab Jamahiriya xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-Vilnius Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Daugavpils Latvia xxxxxxxxxxxxxxxxxxxxxxxx
Kaunas Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Klaipeda Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-?iauliai Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Maseru Lesotho xxxxxxxxxxxxxxxxxxxxxx
+Misrata Libyan Arab Jamahiriya xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Monrovia Liberia xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Panevezys Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Riga Latvia xxxxxxxxxxxxxxxxxxxxxxxx
+Tripoli Lebanon xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Tripoli Libyan Arab Jamahiriya xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Vientiane Laos xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Vilnius Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
set join_buffer_size=256;
SELECT City.Name, Country.Name, Country.PopulationBar FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
Name Name PopulationBar
-Vientiane Laos xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-Riga Latvia xxxxxxxxxxxxxxxxxxxxxxxx
-Daugavpils Latvia xxxxxxxxxxxxxxxxxxxxxxxx
-Maseru Lesotho xxxxxxxxxxxxxxxxxxxxxx
+?iauliai Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Beirut Lebanon xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-Tripoli Lebanon xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-Monrovia Liberia xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-Tripoli Libyan Arab Jamahiriya xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bengasi Libyan Arab Jamahiriya xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-Misrata Libyan Arab Jamahiriya xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-Vilnius Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Daugavpils Latvia xxxxxxxxxxxxxxxxxxxxxxxx
Kaunas Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Klaipeda Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-?iauliai Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Maseru Lesotho xxxxxxxxxxxxxxxxxxxxxx
+Misrata Libyan Arab Jamahiriya xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Monrovia Liberia xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Panevezys Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Riga Latvia xxxxxxxxxxxxxxxxxxxxxxxx
+Tripoli Lebanon xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Tripoli Libyan Arab Jamahiriya xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Vientiane Laos xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Vilnius Lithuania xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
set join_cache_level=default;
set join_buffer_size=default;
+#
+# MDEV-17752: Plan changes from hash_index_merge to index_merge with new optimizer defaults
+#
+set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
+set @save_use_stat_tables=@@use_stat_tables;
+set optimizer_use_condition_selectivity=4;
+set use_stat_tables='preferably';
+use world;
+set join_cache_level=4;
+CREATE INDEX City_Name ON City(Name);
+ANALYZE TABLE City, Country;
+EXPLAIN
+SELECT Country.Name, Country.Population, City.Name, City.Population
+FROM Country LEFT JOIN City
+ON City.Country=Country.Code AND City.Population > 5000000
+WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE Country range Name Name 302 NULL 15 Using index condition; Using where; Rowid-ordered scan
+1 SIMPLE City hash_range Population,Country #hash#Country:Population 3:4 world.Country.Code 24 Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join)
+EXPLAIN
+SELECT Country.Name, Country.Population, City.Name, City.Population
+FROM Country LEFT JOIN City
+ON City.Country=Country.Code AND
+(City.Population > 5000000 OR City.Name LIKE 'Za%')
+WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE Country range Name Name 302 NULL 15 Using index condition; Using where; Rowid-ordered scan
+1 SIMPLE City hash_index_merge Population,Country,City_Name #hash#Country:Population,City_Name 3:4,35 world.Country.Code 96 Using sort_union(Population,City_Name); Using where; Using join buffer (flat, BNLH join)
+set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+set @@use_stat_tables=@save_use_stat_tables;
+set join_cache_level=default;
DROP DATABASE world;
use test;
CREATE TABLE t1(
@@ -5034,8 +5065,8 @@ EXPLAIN
SELECT * FROM t1,t2
WHERE t1.f1 = t2.f4 AND (t1.f3 = 1 AND t2.f3 = 4 OR t1.f3 = 2 AND t2.f3 = 6);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Rowid-ordered scan
-1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 2 Using where
+1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
SELECT * FROM t1,t2
WHERE t1.f1 = t2.f4 AND (t1.f3 = 1 AND t2.f3 = 4 OR t1.f3 = 2 AND t2.f3 = 6);
f1 f3 f3 f2 f4
@@ -5044,8 +5075,8 @@ EXPLAIN
SELECT * FROM t1,t2
WHERE t1.f1 = t2.f4 AND (t1.f3 = 1 AND t2.f3 = 4 OR t1.f3 = 2 AND t2.f3 = 6);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan
-1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 2 Using where
+1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
SELECT * FROM t1,t2
WHERE t1.f1 = t2.f4 AND (t1.f3 = 1 AND t2.f3 = 4 OR t1.f3 = 2 AND t2.f3 = 6);
f1 f3 f3 f2 f4
@@ -5941,7 +5972,9 @@ INSERT INTO t2 VALUES
(228,'x'),(3,'y'),(1,'z'),(9,'z');
ANALYZE TABLE t1,t2;
Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
CREATE TABLE temp
SELECT t1.i1 AS f1, t1.v1 AS f2 FROM (t2 JOIN t1 ON (t1.v1 = t2.v1));
@@ -5961,7 +5994,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 100.00
1 PRIMARY temp hash_ALL NULL #hash#$hj 9 test.t1.i1,test.t1.v1 7 100.00 Using where; Using join buffer (flat, BNLH join)
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 1 100.00 Using where
-2 MATERIALIZED t2 hash_index v1 #hash#v1:v1 4:9 test.t1.v1 10 10.00 Using index; Using join buffer (flat, BNLH join)
+2 MATERIALIZED t2 hash_index v1 #hash#v1:v1 4:9 test.t1.v1 10 33.33 Using index; Using join buffer (flat, BNLH join)
Warnings:
Note 1003 select `test`.`temp`.`f1` AS `f1`,`test`.`temp`.`f2` AS `f2` from `test`.`temp` semi join (`test`.`t2` join `test`.`t1`) where `test`.`temp`.`f1` = `test`.`t1`.`i1` and `test`.`t2`.`v1` = `test`.`t1`.`v1` and `test`.`temp`.`f2` = `test`.`t1`.`v1`
DROP TABLE t1,t2,temp;
@@ -6033,7 +6066,7 @@ select @@join_buffer_size;
explain select count(*) from t1, t1 t2 where t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 11
-1 SIMPLE t2 ALL NULL NULL NULL NULL 11 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join)
set join_buffer_space_limit=default;
drop table t1;
#
diff --git a/mysql-test/main/join_cache.test b/mysql-test/main/join_cache.test
index b69be56a435..97f660e7e0d 100644
--- a/mysql-test/main/join_cache.test
+++ b/mysql-test/main/join_cache.test
@@ -49,6 +49,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -62,6 +63,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -78,6 +80,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -91,6 +94,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -107,6 +111,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -121,6 +126,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -138,6 +144,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -151,6 +158,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -217,6 +225,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -230,6 +239,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -246,6 +256,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -259,6 +270,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -275,6 +287,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -288,6 +301,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -304,6 +318,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -317,6 +332,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -357,6 +373,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -370,6 +387,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -409,6 +427,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -422,6 +441,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -491,6 +511,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -504,6 +525,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -542,6 +564,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -555,6 +578,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -593,6 +617,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -606,6 +631,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -644,6 +670,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -657,6 +684,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -698,6 +726,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -711,6 +740,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -736,6 +766,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -749,6 +780,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -774,6 +806,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -787,6 +820,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -812,6 +846,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -825,6 +860,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -850,6 +886,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -863,6 +900,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -888,6 +926,7 @@ SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -901,6 +940,7 @@ SELECT City.Name, Country.Name, CountryLanguage.Language
CountryLanguage.Percentage > 50 AND
LENGTH(Language) < LENGTH(City.Name) - 2;
+--sorted_result
SELECT City.Name, Country.Name, CountryLanguage.Language
FROM City,Country,CountryLanguage
WHERE City.Country=Country.Code AND
@@ -926,6 +966,7 @@ show variables like 'join_cache_level';
set join_cache_level=1;
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND City.Population > 3000000;
@@ -947,12 +988,14 @@ set join_cache_level=6;
ALTER TABLE Country MODIFY Name varchar(52) NOT NULL default '';
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
ALTER TABLE Country MODIFY Name varchar(300) NOT NULL default '';
+--sorted_result
SELECT City.Name, Country.Name FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -961,12 +1004,14 @@ ALTER TABLE Country ADD COLUMN PopulationBar text;
UPDATE Country
SET PopulationBar=REPEAT('x', CAST(Population/100000 AS unsigned int));
+--sorted_result
SELECT City.Name, Country.Name, Country.PopulationBar FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
set join_buffer_size=256;
+--sorted_result
SELECT City.Name, Country.Name, Country.PopulationBar FROM City,Country
WHERE City.Country=Country.Code AND
Country.Name LIKE 'L%' AND City.Population > 100000;
@@ -974,6 +1019,40 @@ SELECT City.Name, Country.Name, Country.PopulationBar FROM City,Country
set join_cache_level=default;
set join_buffer_size=default;
+
+--echo #
+--echo # MDEV-17752: Plan changes from hash_index_merge to index_merge with new optimizer defaults
+--echo #
+
+set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
+set @save_use_stat_tables=@@use_stat_tables;
+set optimizer_use_condition_selectivity=4;
+set use_stat_tables='preferably';
+
+use world;
+set join_cache_level=4;
+CREATE INDEX City_Name ON City(Name);
+
+--disable_result_log
+ANALYZE TABLE City, Country;
+--enable_result_log
+
+EXPLAIN
+SELECT Country.Name, Country.Population, City.Name, City.Population
+ FROM Country LEFT JOIN City
+ ON City.Country=Country.Code AND City.Population > 5000000
+ WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
+
+EXPLAIN
+SELECT Country.Name, Country.Population, City.Name, City.Population
+ FROM Country LEFT JOIN City
+ ON City.Country=Country.Code AND
+ (City.Population > 5000000 OR City.Name LIKE 'Za%')
+ WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
+set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+set @@use_stat_tables=@save_use_stat_tables;
+set join_cache_level=default;
+
DROP DATABASE world;
use test;
diff --git a/mysql-test/main/join_nested_jcl6.result b/mysql-test/main/join_nested_jcl6.result
index 67534b24e32..6ac34a8728d 100644
--- a/mysql-test/main/join_nested_jcl6.result
+++ b/mysql-test/main/join_nested_jcl6.result
@@ -1342,7 +1342,7 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.c11 0 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE t3 ALL NULL NULL NULL NULL 0 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.c11 0 Using where; Using join buffer (incremental, BNLH join)
DROP TABLE t1,t2,t3;
CREATE TABLE t1 (goods int(12) NOT NULL, price varchar(128) NOT NULL);
INSERT INTO t1 VALUES (23, 2340), (26, 9900);
diff --git a/mysql-test/main/join_outer.result b/mysql-test/main/join_outer.result
index 05991b56aba..1c81c57b23a 100644
--- a/mysql-test/main/join_outer.result
+++ b/mysql-test/main/join_outer.result
@@ -2003,6 +2003,7 @@ INSERT INTO t2 VALUES
CREATE TABLE t3 ( a int, b int NOT NULL , PRIMARY KEY (b)) ;
INSERT INTO t3 VALUES
(0,6),(0,7),(0,8),(2,9),(0,10),(2,21),(0,22),(2,23),(2,24),(2,25);
+set @save_join_cache_level= @@join_cache_level;
SET SESSION join_cache_level=4;
EXPLAIN EXTENDED
SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b;
@@ -2021,7 +2022,7 @@ EXECUTE stmt;
b b a b
10 10 0 10
DEALLOCATE PREPARE stmt;
-SET SESSION join_cache_level=default;
+SET SESSION join_cache_level=@save_join_cache_level;
DROP TABLE t1,t2,t3;
#
# LP bug #943543: LEFT JOIN converted to JOIN with
@@ -2448,7 +2449,7 @@ t1.b1+'0' t2.b2 + '0'
0 0
1 1
DROP TABLE t1, t2;
-set @join_cache_level= @save_join_cache_level;
+set @@join_cache_level= @save_join_cache_level;
#
# MDEV-14779: using left join causes incorrect results with materialization and derived tables
#
@@ -2515,6 +2516,143 @@ v2
DROP TABLE t1,t2;
# end of 5.5 tests
#
+# MDEV-19258: chained right joins all converted to inner joins
+#
+CREATE TABLE t1 (
+id int NOT NULL AUTO_INCREMENT,
+timestamp bigint NOT NULL,
+modifiedBy varchar(255) DEFAULT NULL,
+PRIMARY KEY (id)
+);
+CREATE TABLE t2 (
+id int NOT NULL,
+REV int NOT NULL,
+REVTYPE tinyint DEFAULT NULL,
+profile_id int DEFAULT NULL,
+PRIMARY KEY (id,REV)
+);
+CREATE TABLE t3 (
+id int NOT NULL,
+REV int NOT NULL,
+person_id int DEFAULT NULL,
+PRIMARY KEY (id,REV)
+);
+CREATE TABLE t4 (
+id int NOT NULL,
+REV int NOT NULL,
+PRIMARY KEY (id,REV)
+);
+INSERT INTO t1 VALUES
+(1,1294391193890,'Cxqy$*9.kKeE'),(2,1294643906883,'rE4wqGV0gif@'),
+(3,1294643927456,'L?3yt(%dY$Br'),(4,1294644343525,'WH&ObiZ$#2S4'),
+(5,1294644616416,'YXnCbt?olUZ0'),(6,1294644954537,'8Npe4!(#lU@k'),
+(7,1294645046659,'knc0GhXB1#ib'),(8,1294645183829,'w*oPpVfuS8^m'),
+(9,1294645386701,'hwXR@3qVzrbU'),(10,1294645525982,'BeLW*Y9ndP0l'),
+(11,1294645627723,'nTegib^)qZ$I'),(12,1294650860266,'u62C^Kzx3wH8'),
+(13,1294657613745,'4&BkFjGa!qLg'),(14,1294660627161,')anpt312SCoh'),
+(15,1294661023336,'LtJ2PX?*kTmx'),(16,1294662838066,'POGRr@?#ofpl'),
+(17,1294663020989,'o.)1EOT2jnF7'),(18,1294663308065,'&TZ0F0LHE6.h'),
+(19,1294664900039,'j)kSC%^In$9d'),(20,1294668904556,'97glN50)cAo.'),
+(21,1294728056853,'lrKZxmw?I.Ek'),(22,1294728157174,'@P*SRg!pT.q?'),
+(23,1294728327099,'W9gPrptF.)8n'),(24,1294728418481,'$q*c^sM&URd#'),
+(25,1294728729620,'9*f4&bTPRtHo'),(26,1294728906014,')4VtTEnS7$oI'),
+(27,1294732190003,'8dkNSPq2u3AQ'),(28,1294733205065,'SV2N6IoEf438'),
+(29,1294741984927,'rBKj.0S^Ey%*'),(30,1294751748352,'j$2DvlBqk)Fw'),
+(31,1294753902212,'C$N6OrEw8elz'),(32,1294758120598,'DCSVZw!rnxXq'),
+(33,1294761769556,'OTS@QU8a6s5c'),(34,1294816845305,'IUE2stG0D3L5'),
+(35,1294816966909,'Xd16yka.9nHe'),(36,1294817116302,'lOQHZpm%!8qb'),
+(37,1294817374775,'^&pE3IhNf7ey'),(38,1294817538907,'oEn4#7C0Vhfp'),
+(39,1294818482950,'bx54J*O0Va&?'),(40,1294819047024,'J%@a&1.qgdb?'),
+(41,1294821826077,'C9kojr$L3Phz'),(42,1294825454458,'gG#BOnM80ZPi'),
+(43,1294904129918,'F^!TrjM#zdvc'),(44,1294904254166,'Va&Tb)k0RvlM'),
+(45,1294904414964,'dJjq0M6HvhR#'),(46,1294904505784,'nJmxg)ELqY(b'),
+(47,1294904602835,'dhF#or$Vge!7'),(48,1294904684728,'?bIh5E3l!0em'),
+(49,1294904877898,'Y*WflOdcxnk.'),(50,1294905002390,'*?H!lUgez5A.'),
+(51,1294905096043,'wlEIY3n9uz!p'),(52,1294905404621,'T?qv3H6&hlQD'),
+(53,1294905603922,'S@Bhys^Ti7bt'),(54,1294905788416,'KR?a5NVukz#l'),
+(55,1294905993190,'A*&q4kWhED!o'),(56,1294906205254,'fT0%7z0DF6h*'),
+(57,1294906319680,'LhzdW4?ivjR0'),(58,1294906424296,'h0KDlns%U*6T'),
+(59,1294906623844,'b$CfB1noI6Ax'),(60,1294911258896,'#T1*LP!3$Oys');
+INSERT INTO t2 VALUES
+(1,1,0,10209),(1,42480,1,10209),(1,61612,1,10209),(1,257545,1,10209),
+(1,385332,1,10209),(1,1687999,1,10209),(3,1,0,10210),(3,617411,2,10210),
+(4,11,0,14),(4,95149,1,10211),(4,607890,2,10211),(5,1,0,10212),
+(6,1,0,10213),(6,93344,1,10213),(6,295578,1,10213),(6,295579,1,10213),
+(6,295644,1,10213),(7,1,0,10214),(7,12,1,7),(7,688796,1,10214),
+(7,1140433,1,10214),(7,1715227,1,10214),(8,1,0,10215),(8,74253,1,10215),
+(8,93345,1,10215),(8,12,2,2),(9,1,0,10216),(9,93342,1,10216),
+(9,122354,1,10216),(9,301499,2,10216),(10,11,0,5),(10,93343,1,10217),
+(10,122355,1,10217),(10,123050,1,10217),(10,301500,2,10217),(11,1,0,10218),
+(11,87852,1,10218),(11,605499,2,10218),(12,1,0,10219),(12,88024,1,10219),
+(12,605892,2,10219),(13,1,0,10220);
+INSERT INTO t3 VALUES
+(1,1,300003),(1,117548,NULL),(2,1,300003),(2,117548,300006),
+(3,1,300153),(3,117548,NULL),(4,1,300153),(4,117548,NULL),
+(5,1,300153),(5,117548,NULL),(6,1,300182),(6,117548,NULL),
+(7,1,300205),(7,117548,NULL),(8,1,300217),(8,117548,NULL),
+(9,1,300290),(9,117548,NULL),(10,1,300290),(10,117548,NULL),
+(11,1,300405),(11,117548,NULL),(12,1,300670),(12,117548,NULL),
+(13,1,300670),(13,117548,NULL),(14,1,300006),(14,117548,NULL),
+(15,1,300671),(15,117548,NULL),(16,1,300732),(16,117548,NULL);
+INSERT INTO t4 VALUES
+(300000,1),(300001,1),(300003,1),(300004,1),
+(300005,1),(300005,688796),(300006,1),(300006,97697),
+(300009,1),(300010,1),(300011,1),(300012,1),(300013,1),
+(300014,1),(300015,1),(300016,1),(300017,1),(300018,1),
+(300019,1),(300020,1),(300021,1),(300022,1),(300023,1),
+(300024,1),(300025,1),(300026,1),(300027,1),(300028,1);
+# This should have join order of t2,t3,t4,t1
+EXPLAIN EXTENDED SELECT *
+FROM t1 INNER JOIN t2 ON t2.REV=t1.id
+INNER JOIN t3 ON t3.id=t2.profile_id
+INNER JOIN t4 ON t4.id=t3.person_id
+WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416 AND
+t2.REVTYPE=2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 42 100.00 Using where
+1 SIMPLE t3 ref PRIMARY PRIMARY 4 test.t2.profile_id 1 100.00 Using where
+1 SIMPLE t4 ref PRIMARY PRIMARY 4 test.t3.person_id 1 100.00 Using index
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.REV 1 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`timestamp` AS `timestamp`,`test`.`t1`.`modifiedBy` AS `modifiedBy`,`test`.`t2`.`id` AS `id`,`test`.`t2`.`REV` AS `REV`,`test`.`t2`.`REVTYPE` AS `REVTYPE`,`test`.`t2`.`profile_id` AS `profile_id`,`test`.`t3`.`id` AS `id`,`test`.`t3`.`REV` AS `REV`,`test`.`t3`.`person_id` AS `person_id`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`REV` AS `REV` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t2`.`REVTYPE` = 2 and `test`.`t4`.`id` = `test`.`t3`.`person_id` and `test`.`t3`.`id` = `test`.`t2`.`profile_id` and `test`.`t1`.`id` = `test`.`t2`.`REV` and `test`.`t1`.`timestamp` < 1294664900039 and `test`.`t1`.`timestamp` > 1294644616416
+SELECT *
+FROM t1 INNER JOIN t2 ON t2.REV=t1.id
+INNER JOIN t3 ON t3.id=t2.profile_id
+INNER JOIN t4 ON t4.id=t3.person_id
+WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416 AND
+t2.REVTYPE=2;
+id timestamp modifiedBy id REV REVTYPE profile_id id REV person_id id REV
+12 1294650860266 u62C^Kzx3wH8 8 12 2 2 2 1 300003 300003 1
+12 1294650860266 u62C^Kzx3wH8 8 12 2 2 2 117548 300006 300006 1
+12 1294650860266 u62C^Kzx3wH8 8 12 2 2 2 117548 300006 300006 97697
+# This should have join order of t2,t3,t4,t1 with the same plan as above
+# because all RIGHT JOIN operations are converted into INNER JOIN
+EXPLAIN EXTENDED SELECT *
+FROM t1 RIGHT JOIN t2 ON t2.REV=t1.id
+RIGHT JOIN t3 ON t3.id=t2.profile_id
+RIGHT JOIN t4 ON t4.id=t3.person_id
+WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416
+AND t2.REVTYPE=2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 42 100.00 Using where
+1 SIMPLE t3 ref PRIMARY PRIMARY 4 test.t2.profile_id 1 100.00 Using where
+1 SIMPLE t4 ref PRIMARY PRIMARY 4 test.t3.person_id 1 100.00 Using index
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.REV 1 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`timestamp` AS `timestamp`,`test`.`t1`.`modifiedBy` AS `modifiedBy`,`test`.`t2`.`id` AS `id`,`test`.`t2`.`REV` AS `REV`,`test`.`t2`.`REVTYPE` AS `REVTYPE`,`test`.`t2`.`profile_id` AS `profile_id`,`test`.`t3`.`id` AS `id`,`test`.`t3`.`REV` AS `REV`,`test`.`t3`.`person_id` AS `person_id`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`REV` AS `REV` from `test`.`t4` join `test`.`t3` join `test`.`t2` join `test`.`t1` where `test`.`t2`.`REVTYPE` = 2 and `test`.`t1`.`id` = `test`.`t2`.`REV` and `test`.`t3`.`id` = `test`.`t2`.`profile_id` and `test`.`t4`.`id` = `test`.`t3`.`person_id` and `test`.`t1`.`timestamp` < 1294664900039 and `test`.`t1`.`timestamp` > 1294644616416
+SELECT *
+FROM t1 RIGHT JOIN t2 ON t2.REV=t1.id
+RIGHT JOIN t3 ON t3.id=t2.profile_id
+RIGHT JOIN t4 ON t4.id=t3.person_id
+WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416
+AND t2.REVTYPE=2;
+id timestamp modifiedBy id REV REVTYPE profile_id id REV person_id id REV
+12 1294650860266 u62C^Kzx3wH8 8 12 2 2 2 1 300003 300003 1
+12 1294650860266 u62C^Kzx3wH8 8 12 2 2 2 117548 300006 300006 1
+12 1294650860266 u62C^Kzx3wH8 8 12 2 2 2 117548 300006 300006 97697
+DROP TABLE t1,t2,t3,t4;
+# end of 10.1 tests
+#
# MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins
#
create table t1(a int);
diff --git a/mysql-test/main/join_outer.test b/mysql-test/main/join_outer.test
index 82127397bee..c9ac0224745 100644
--- a/mysql-test/main/join_outer.test
+++ b/mysql-test/main/join_outer.test
@@ -1575,6 +1575,7 @@ CREATE TABLE t3 ( a int, b int NOT NULL , PRIMARY KEY (b)) ;
INSERT INTO t3 VALUES
(0,6),(0,7),(0,8),(2,9),(0,10),(2,21),(0,22),(2,23),(2,24),(2,25);
+set @save_join_cache_level= @@join_cache_level;
SET SESSION join_cache_level=4;
EXPLAIN EXTENDED
@@ -1588,7 +1589,7 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-SET SESSION join_cache_level=default;
+SET SESSION join_cache_level=@save_join_cache_level;
DROP TABLE t1,t2,t3;
@@ -1976,7 +1977,7 @@ set @save_join_cache_level= @@join_cache_level;
SET @@join_cache_level = 3;
SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2;
DROP TABLE t1, t2;
-set @join_cache_level= @save_join_cache_level;
+set @@join_cache_level= @save_join_cache_level;
--echo #
--echo # MDEV-14779: using left join causes incorrect results with materialization and derived tables
@@ -2043,6 +2044,131 @@ DROP TABLE t1,t2;
--echo # end of 5.5 tests
--echo #
+--echo # MDEV-19258: chained right joins all converted to inner joins
+--echo #
+
+ CREATE TABLE t1 (
+ id int NOT NULL AUTO_INCREMENT,
+ timestamp bigint NOT NULL,
+ modifiedBy varchar(255) DEFAULT NULL,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE t2 (
+ id int NOT NULL,
+ REV int NOT NULL,
+ REVTYPE tinyint DEFAULT NULL,
+ profile_id int DEFAULT NULL,
+ PRIMARY KEY (id,REV)
+);
+
+CREATE TABLE t3 (
+ id int NOT NULL,
+ REV int NOT NULL,
+ person_id int DEFAULT NULL,
+ PRIMARY KEY (id,REV)
+);
+
+CREATE TABLE t4 (
+ id int NOT NULL,
+ REV int NOT NULL,
+ PRIMARY KEY (id,REV)
+);
+
+INSERT INTO t1 VALUES
+(1,1294391193890,'Cxqy$*9.kKeE'),(2,1294643906883,'rE4wqGV0gif@'),
+(3,1294643927456,'L?3yt(%dY$Br'),(4,1294644343525,'WH&ObiZ$#2S4'),
+(5,1294644616416,'YXnCbt?olUZ0'),(6,1294644954537,'8Npe4!(#lU@k'),
+(7,1294645046659,'knc0GhXB1#ib'),(8,1294645183829,'w*oPpVfuS8^m'),
+(9,1294645386701,'hwXR@3qVzrbU'),(10,1294645525982,'BeLW*Y9ndP0l'),
+(11,1294645627723,'nTegib^)qZ$I'),(12,1294650860266,'u62C^Kzx3wH8'),
+(13,1294657613745,'4&BkFjGa!qLg'),(14,1294660627161,')anpt312SCoh'),
+(15,1294661023336,'LtJ2PX?*kTmx'),(16,1294662838066,'POGRr@?#ofpl'),
+(17,1294663020989,'o.)1EOT2jnF7'),(18,1294663308065,'&TZ0F0LHE6.h'),
+(19,1294664900039,'j)kSC%^In$9d'),(20,1294668904556,'97glN50)cAo.'),
+(21,1294728056853,'lrKZxmw?I.Ek'),(22,1294728157174,'@P*SRg!pT.q?'),
+(23,1294728327099,'W9gPrptF.)8n'),(24,1294728418481,'$q*c^sM&URd#'),
+(25,1294728729620,'9*f4&bTPRtHo'),(26,1294728906014,')4VtTEnS7$oI'),
+(27,1294732190003,'8dkNSPq2u3AQ'),(28,1294733205065,'SV2N6IoEf438'),
+(29,1294741984927,'rBKj.0S^Ey%*'),(30,1294751748352,'j$2DvlBqk)Fw'),
+(31,1294753902212,'C$N6OrEw8elz'),(32,1294758120598,'DCSVZw!rnxXq'),
+(33,1294761769556,'OTS@QU8a6s5c'),(34,1294816845305,'IUE2stG0D3L5'),
+(35,1294816966909,'Xd16yka.9nHe'),(36,1294817116302,'lOQHZpm%!8qb'),
+(37,1294817374775,'^&pE3IhNf7ey'),(38,1294817538907,'oEn4#7C0Vhfp'),
+(39,1294818482950,'bx54J*O0Va&?'),(40,1294819047024,'J%@a&1.qgdb?'),
+(41,1294821826077,'C9kojr$L3Phz'),(42,1294825454458,'gG#BOnM80ZPi'),
+(43,1294904129918,'F^!TrjM#zdvc'),(44,1294904254166,'Va&Tb)k0RvlM'),
+(45,1294904414964,'dJjq0M6HvhR#'),(46,1294904505784,'nJmxg)ELqY(b'),
+(47,1294904602835,'dhF#or$Vge!7'),(48,1294904684728,'?bIh5E3l!0em'),
+(49,1294904877898,'Y*WflOdcxnk.'),(50,1294905002390,'*?H!lUgez5A.'),
+(51,1294905096043,'wlEIY3n9uz!p'),(52,1294905404621,'T?qv3H6&hlQD'),
+(53,1294905603922,'S@Bhys^Ti7bt'),(54,1294905788416,'KR?a5NVukz#l'),
+(55,1294905993190,'A*&q4kWhED!o'),(56,1294906205254,'fT0%7z0DF6h*'),
+(57,1294906319680,'LhzdW4?ivjR0'),(58,1294906424296,'h0KDlns%U*6T'),
+(59,1294906623844,'b$CfB1noI6Ax'),(60,1294911258896,'#T1*LP!3$Oys');
+
+
+INSERT INTO t2 VALUES
+(1,1,0,10209),(1,42480,1,10209),(1,61612,1,10209),(1,257545,1,10209),
+(1,385332,1,10209),(1,1687999,1,10209),(3,1,0,10210),(3,617411,2,10210),
+(4,11,0,14),(4,95149,1,10211),(4,607890,2,10211),(5,1,0,10212),
+(6,1,0,10213),(6,93344,1,10213),(6,295578,1,10213),(6,295579,1,10213),
+(6,295644,1,10213),(7,1,0,10214),(7,12,1,7),(7,688796,1,10214),
+(7,1140433,1,10214),(7,1715227,1,10214),(8,1,0,10215),(8,74253,1,10215),
+(8,93345,1,10215),(8,12,2,2),(9,1,0,10216),(9,93342,1,10216),
+(9,122354,1,10216),(9,301499,2,10216),(10,11,0,5),(10,93343,1,10217),
+(10,122355,1,10217),(10,123050,1,10217),(10,301500,2,10217),(11,1,0,10218),
+(11,87852,1,10218),(11,605499,2,10218),(12,1,0,10219),(12,88024,1,10219),
+(12,605892,2,10219),(13,1,0,10220);
+
+INSERT INTO t3 VALUES
+(1,1,300003),(1,117548,NULL),(2,1,300003),(2,117548,300006),
+(3,1,300153),(3,117548,NULL),(4,1,300153),(4,117548,NULL),
+(5,1,300153),(5,117548,NULL),(6,1,300182),(6,117548,NULL),
+(7,1,300205),(7,117548,NULL),(8,1,300217),(8,117548,NULL),
+(9,1,300290),(9,117548,NULL),(10,1,300290),(10,117548,NULL),
+(11,1,300405),(11,117548,NULL),(12,1,300670),(12,117548,NULL),
+(13,1,300670),(13,117548,NULL),(14,1,300006),(14,117548,NULL),
+(15,1,300671),(15,117548,NULL),(16,1,300732),(16,117548,NULL);
+
+INSERT INTO t4 VALUES
+(300000,1),(300001,1),(300003,1),(300004,1),
+(300005,1),(300005,688796),(300006,1),(300006,97697),
+(300009,1),(300010,1),(300011,1),(300012,1),(300013,1),
+(300014,1),(300015,1),(300016,1),(300017,1),(300018,1),
+(300019,1),(300020,1),(300021,1),(300022,1),(300023,1),
+(300024,1),(300025,1),(300026,1),(300027,1),(300028,1);
+
+let $q1=
+SELECT *
+FROM t1 INNER JOIN t2 ON t2.REV=t1.id
+ INNER JOIN t3 ON t3.id=t2.profile_id
+ INNER JOIN t4 ON t4.id=t3.person_id
+WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416 AND
+ t2.REVTYPE=2;
+
+--echo # This should have join order of t2,t3,t4,t1
+eval EXPLAIN EXTENDED $q1;
+eval $q1;
+
+let $q2=
+SELECT *
+FROM t1 RIGHT JOIN t2 ON t2.REV=t1.id
+ RIGHT JOIN t3 ON t3.id=t2.profile_id
+ RIGHT JOIN t4 ON t4.id=t3.person_id
+WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416
+ AND t2.REVTYPE=2;
+
+--echo # This should have join order of t2,t3,t4,t1 with the same plan as above
+--echo # because all RIGHT JOIN operations are converted into INNER JOIN
+eval EXPLAIN EXTENDED $q2;
+eval $q2;
+
+DROP TABLE t1,t2,t3,t4;
+
+--echo # end of 10.1 tests
+
+--echo #
--echo # MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins
--echo #
create table t1(a int);
diff --git a/mysql-test/main/join_outer_jcl6.result b/mysql-test/main/join_outer_jcl6.result
index 399d6306fa0..91378d1add0 100644
--- a/mysql-test/main/join_outer_jcl6.result
+++ b/mysql-test/main/join_outer_jcl6.result
@@ -2014,6 +2014,7 @@ INSERT INTO t2 VALUES
CREATE TABLE t3 ( a int, b int NOT NULL , PRIMARY KEY (b)) ;
INSERT INTO t3 VALUES
(0,6),(0,7),(0,8),(2,9),(0,10),(2,21),(0,22),(2,23),(2,24),(2,25);
+set @save_join_cache_level= @@join_cache_level;
SET SESSION join_cache_level=4;
EXPLAIN EXTENDED
SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b;
@@ -2032,7 +2033,7 @@ EXECUTE stmt;
b b a b
10 10 0 10
DEALLOCATE PREPARE stmt;
-SET SESSION join_cache_level=default;
+SET SESSION join_cache_level=@save_join_cache_level;
DROP TABLE t1,t2,t3;
#
# LP bug #943543: LEFT JOIN converted to JOIN with
@@ -2089,7 +2090,7 @@ WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5
ORDER BY t1.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref idx idx 4 const 2 100.00 Using where
-1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00
+1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`t1`.`b`
SELECT t1.b, t2.c, t2.d FROM t2 JOIN t1 ON t2.c = t1.a
@@ -2097,16 +2098,16 @@ WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5
ORDER BY t1.b;
b c d
5 8 88
-5 8 81
5 8 88
5 8 81
+5 8 81
EXPLAIN EXTENDED
SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a
WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5
ORDER BY t1.b;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref PRIMARY,idx idx 4 const 2 100.00 Using where
-1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00
+1 SIMPLE t2 ref c c 5 test.t1.a 2 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` join `test`.`t1` where `test`.`t2`.`c` = `test`.`t1`.`a` and `test`.`t1`.`b` = 5 order by `test`.`t1`.`b`
SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a
@@ -2114,9 +2115,9 @@ WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5
ORDER BY t1.b;
b c d
5 8 88
-5 8 81
5 8 88
5 8 81
+5 8 81
DROP TABLE t1,t2;
#
# Bug mdev-4336: LEFT JOIN with disjunctive
@@ -2232,10 +2233,10 @@ SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON i2 = i3 ON i1 = i3
WHERE d3 IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.i1 2 100.00 Using where; Using join buffer (flat, BNLH join)
+1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.i1 2 100.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`i2` = `test`.`t1`.`i1` and `test`.`t3`.`i3` = `test`.`t1`.`i1`) where `test`.`t3`.`d3` = 0 or `test`.`t3`.`d3` is null
+Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t2`.`i2` AS `i2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`d3` AS `d3` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t2`.`i2` = `test`.`t1`.`i1` and `test`.`t3`.`i3` = `test`.`t1`.`i1` and `test`.`t1`.`i1` is not null and `test`.`t1`.`i1` is not null) where `test`.`t3`.`d3` = 0 or `test`.`t3`.`d3` is null
DROP TABLE t1,t2,t3;
#
# Bug mdev-6705: wrong on expression after constant row substitution
@@ -2253,9 +2254,9 @@ WHERE b IN (1,2,3) OR b = d;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 const 2 100.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
-Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`d` = 10) where `test`.`t2`.`c` = 8 and `test`.`t3`.`d` = 8
+Note 1003 select 10 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`d` = 10 and 10 is not null) where `test`.`t2`.`c` = 8 and `test`.`t3`.`d` = 8
SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
WHERE b IN (1,2,3) OR b = d;
a b c d
@@ -2282,11 +2283,11 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select * from t1 left join t2 on t2.b is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 9
-1 SIMPLE t2 ref b b 5 const 780 Using where
+1 SIMPLE t2 ref b b 5 const 780 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
explain select * from t1 left join t2 on t2.c is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 9
-1 SIMPLE t2 ref c c 5 const 393 Using where
+1 SIMPLE t2 ref c c 5 const 393 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
drop table t1,t2;
#
# MDEV-10006: optimizer doesn't convert outer join to inner on views with WHERE clause
@@ -2328,8 +2329,8 @@ LEFT JOIN t3 on t2.i2 = t3.i3
WHERE v3 = 4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ref PRIMARY,v3 v3 5 const 1 100.00
-1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3`
# This should have the same join order like the query above:
@@ -2346,8 +2347,8 @@ AND 1 = 1
WHERE v3 = 4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ref PRIMARY,v3 v3 5 const 1 100.00
-1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t3.i3 1 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3`
drop table t1,t2,t3;
@@ -2370,9 +2371,9 @@ ON t1.x = t2.x
WHERE IFNULL(t2.x,0)=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.x 2 100.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where ifnull(`test`.`t2`.`x`,0) = 0
+Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x` and `test`.`t1`.`x` is not null) where ifnull(`test`.`t2`.`x`,0) = 0
SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
FROM t t1 LEFT JOIN t t2
ON t1.x = t2.x
@@ -2386,9 +2387,9 @@ ON t1.x = t2.x
WHERE f(t2.x,0)=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.x 2 100.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where `f`(`test`.`t2`.`x`,0) = 0
+Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x` and `test`.`t1`.`x` is not null) where `f`(`test`.`t2`.`x`,0) = 0
drop function f;
drop table t;
CREATE TABLE t1 (
@@ -2426,9 +2427,9 @@ FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
WHERE IFNULL(t2.col3,0) = 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 17 test.t1.col1 2 100.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where ifnull(`test`.`t2`.`col3`,0) = 0
+Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1` and `test`.`t1`.`col1` is not null) where ifnull(`test`.`t2`.`col3`,0) = 0
SELECT t1.col1, t2.col1, t2.col3
FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
WHERE f1(t2.col3,0) = 0;
@@ -2440,9 +2441,9 @@ FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
WHERE f1(t2.col3,0) = 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 hash_ALL NULL #hash#$hj 17 test.t1.col1 2 100.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where `f1`(`test`.`t2`.`col3`,0) = 0
+Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1` and `test`.`t1`.`col1` is not null) where `f1`(`test`.`t2`.`col3`,0) = 0
DROP FUNCTION f1;
DROP TABLE t1,t2;
#
@@ -2459,7 +2460,7 @@ t1.b1+'0' t2.b2 + '0'
0 0
1 1
DROP TABLE t1, t2;
-set @join_cache_level= @save_join_cache_level;
+set @@join_cache_level= @save_join_cache_level;
#
# MDEV-14779: using left join causes incorrect results with materialization and derived tables
#
@@ -2526,6 +2527,143 @@ v2
DROP TABLE t1,t2;
# end of 5.5 tests
#
+# MDEV-19258: chained right joins all converted to inner joins
+#
+CREATE TABLE t1 (
+id int NOT NULL AUTO_INCREMENT,
+timestamp bigint NOT NULL,
+modifiedBy varchar(255) DEFAULT NULL,
+PRIMARY KEY (id)
+);
+CREATE TABLE t2 (
+id int NOT NULL,
+REV int NOT NULL,
+REVTYPE tinyint DEFAULT NULL,
+profile_id int DEFAULT NULL,
+PRIMARY KEY (id,REV)
+);
+CREATE TABLE t3 (
+id int NOT NULL,
+REV int NOT NULL,
+person_id int DEFAULT NULL,
+PRIMARY KEY (id,REV)
+);
+CREATE TABLE t4 (
+id int NOT NULL,
+REV int NOT NULL,
+PRIMARY KEY (id,REV)
+);
+INSERT INTO t1 VALUES
+(1,1294391193890,'Cxqy$*9.kKeE'),(2,1294643906883,'rE4wqGV0gif@'),
+(3,1294643927456,'L?3yt(%dY$Br'),(4,1294644343525,'WH&ObiZ$#2S4'),
+(5,1294644616416,'YXnCbt?olUZ0'),(6,1294644954537,'8Npe4!(#lU@k'),
+(7,1294645046659,'knc0GhXB1#ib'),(8,1294645183829,'w*oPpVfuS8^m'),
+(9,1294645386701,'hwXR@3qVzrbU'),(10,1294645525982,'BeLW*Y9ndP0l'),
+(11,1294645627723,'nTegib^)qZ$I'),(12,1294650860266,'u62C^Kzx3wH8'),
+(13,1294657613745,'4&BkFjGa!qLg'),(14,1294660627161,')anpt312SCoh'),
+(15,1294661023336,'LtJ2PX?*kTmx'),(16,1294662838066,'POGRr@?#ofpl'),
+(17,1294663020989,'o.)1EOT2jnF7'),(18,1294663308065,'&TZ0F0LHE6.h'),
+(19,1294664900039,'j)kSC%^In$9d'),(20,1294668904556,'97glN50)cAo.'),
+(21,1294728056853,'lrKZxmw?I.Ek'),(22,1294728157174,'@P*SRg!pT.q?'),
+(23,1294728327099,'W9gPrptF.)8n'),(24,1294728418481,'$q*c^sM&URd#'),
+(25,1294728729620,'9*f4&bTPRtHo'),(26,1294728906014,')4VtTEnS7$oI'),
+(27,1294732190003,'8dkNSPq2u3AQ'),(28,1294733205065,'SV2N6IoEf438'),
+(29,1294741984927,'rBKj.0S^Ey%*'),(30,1294751748352,'j$2DvlBqk)Fw'),
+(31,1294753902212,'C$N6OrEw8elz'),(32,1294758120598,'DCSVZw!rnxXq'),
+(33,1294761769556,'OTS@QU8a6s5c'),(34,1294816845305,'IUE2stG0D3L5'),
+(35,1294816966909,'Xd16yka.9nHe'),(36,1294817116302,'lOQHZpm%!8qb'),
+(37,1294817374775,'^&pE3IhNf7ey'),(38,1294817538907,'oEn4#7C0Vhfp'),
+(39,1294818482950,'bx54J*O0Va&?'),(40,1294819047024,'J%@a&1.qgdb?'),
+(41,1294821826077,'C9kojr$L3Phz'),(42,1294825454458,'gG#BOnM80ZPi'),
+(43,1294904129918,'F^!TrjM#zdvc'),(44,1294904254166,'Va&Tb)k0RvlM'),
+(45,1294904414964,'dJjq0M6HvhR#'),(46,1294904505784,'nJmxg)ELqY(b'),
+(47,1294904602835,'dhF#or$Vge!7'),(48,1294904684728,'?bIh5E3l!0em'),
+(49,1294904877898,'Y*WflOdcxnk.'),(50,1294905002390,'*?H!lUgez5A.'),
+(51,1294905096043,'wlEIY3n9uz!p'),(52,1294905404621,'T?qv3H6&hlQD'),
+(53,1294905603922,'S@Bhys^Ti7bt'),(54,1294905788416,'KR?a5NVukz#l'),
+(55,1294905993190,'A*&q4kWhED!o'),(56,1294906205254,'fT0%7z0DF6h*'),
+(57,1294906319680,'LhzdW4?ivjR0'),(58,1294906424296,'h0KDlns%U*6T'),
+(59,1294906623844,'b$CfB1noI6Ax'),(60,1294911258896,'#T1*LP!3$Oys');
+INSERT INTO t2 VALUES
+(1,1,0,10209),(1,42480,1,10209),(1,61612,1,10209),(1,257545,1,10209),
+(1,385332,1,10209),(1,1687999,1,10209),(3,1,0,10210),(3,617411,2,10210),
+(4,11,0,14),(4,95149,1,10211),(4,607890,2,10211),(5,1,0,10212),
+(6,1,0,10213),(6,93344,1,10213),(6,295578,1,10213),(6,295579,1,10213),
+(6,295644,1,10213),(7,1,0,10214),(7,12,1,7),(7,688796,1,10214),
+(7,1140433,1,10214),(7,1715227,1,10214),(8,1,0,10215),(8,74253,1,10215),
+(8,93345,1,10215),(8,12,2,2),(9,1,0,10216),(9,93342,1,10216),
+(9,122354,1,10216),(9,301499,2,10216),(10,11,0,5),(10,93343,1,10217),
+(10,122355,1,10217),(10,123050,1,10217),(10,301500,2,10217),(11,1,0,10218),
+(11,87852,1,10218),(11,605499,2,10218),(12,1,0,10219),(12,88024,1,10219),
+(12,605892,2,10219),(13,1,0,10220);
+INSERT INTO t3 VALUES
+(1,1,300003),(1,117548,NULL),(2,1,300003),(2,117548,300006),
+(3,1,300153),(3,117548,NULL),(4,1,300153),(4,117548,NULL),
+(5,1,300153),(5,117548,NULL),(6,1,300182),(6,117548,NULL),
+(7,1,300205),(7,117548,NULL),(8,1,300217),(8,117548,NULL),
+(9,1,300290),(9,117548,NULL),(10,1,300290),(10,117548,NULL),
+(11,1,300405),(11,117548,NULL),(12,1,300670),(12,117548,NULL),
+(13,1,300670),(13,117548,NULL),(14,1,300006),(14,117548,NULL),
+(15,1,300671),(15,117548,NULL),(16,1,300732),(16,117548,NULL);
+INSERT INTO t4 VALUES
+(300000,1),(300001,1),(300003,1),(300004,1),
+(300005,1),(300005,688796),(300006,1),(300006,97697),
+(300009,1),(300010,1),(300011,1),(300012,1),(300013,1),
+(300014,1),(300015,1),(300016,1),(300017,1),(300018,1),
+(300019,1),(300020,1),(300021,1),(300022,1),(300023,1),
+(300024,1),(300025,1),(300026,1),(300027,1),(300028,1);
+# This should have join order of t2,t3,t4,t1
+EXPLAIN EXTENDED SELECT *
+FROM t1 INNER JOIN t2 ON t2.REV=t1.id
+INNER JOIN t3 ON t3.id=t2.profile_id
+INNER JOIN t4 ON t4.id=t3.person_id
+WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416 AND
+t2.REVTYPE=2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 42 100.00 Using where
+1 SIMPLE t3 ref PRIMARY PRIMARY 4 test.t2.profile_id 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE t4 ref PRIMARY PRIMARY 4 test.t3.person_id 1 100.00 Using index
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.REV 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`timestamp` AS `timestamp`,`test`.`t1`.`modifiedBy` AS `modifiedBy`,`test`.`t2`.`id` AS `id`,`test`.`t2`.`REV` AS `REV`,`test`.`t2`.`REVTYPE` AS `REVTYPE`,`test`.`t2`.`profile_id` AS `profile_id`,`test`.`t3`.`id` AS `id`,`test`.`t3`.`REV` AS `REV`,`test`.`t3`.`person_id` AS `person_id`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`REV` AS `REV` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t2`.`REVTYPE` = 2 and `test`.`t4`.`id` = `test`.`t3`.`person_id` and `test`.`t3`.`id` = `test`.`t2`.`profile_id` and `test`.`t1`.`id` = `test`.`t2`.`REV` and `test`.`t1`.`timestamp` < 1294664900039 and `test`.`t1`.`timestamp` > 1294644616416
+SELECT *
+FROM t1 INNER JOIN t2 ON t2.REV=t1.id
+INNER JOIN t3 ON t3.id=t2.profile_id
+INNER JOIN t4 ON t4.id=t3.person_id
+WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416 AND
+t2.REVTYPE=2;
+id timestamp modifiedBy id REV REVTYPE profile_id id REV person_id id REV
+12 1294650860266 u62C^Kzx3wH8 8 12 2 2 2 1 300003 300003 1
+12 1294650860266 u62C^Kzx3wH8 8 12 2 2 2 117548 300006 300006 1
+12 1294650860266 u62C^Kzx3wH8 8 12 2 2 2 117548 300006 300006 97697
+# This should have join order of t2,t3,t4,t1 with the same plan as above
+# because all RIGHT JOIN operations are converted into INNER JOIN
+EXPLAIN EXTENDED SELECT *
+FROM t1 RIGHT JOIN t2 ON t2.REV=t1.id
+RIGHT JOIN t3 ON t3.id=t2.profile_id
+RIGHT JOIN t4 ON t4.id=t3.person_id
+WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416
+AND t2.REVTYPE=2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 42 100.00 Using where
+1 SIMPLE t3 ref PRIMARY PRIMARY 4 test.t2.profile_id 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE t4 ref PRIMARY PRIMARY 4 test.t3.person_id 1 100.00 Using index
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.REV 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`timestamp` AS `timestamp`,`test`.`t1`.`modifiedBy` AS `modifiedBy`,`test`.`t2`.`id` AS `id`,`test`.`t2`.`REV` AS `REV`,`test`.`t2`.`REVTYPE` AS `REVTYPE`,`test`.`t2`.`profile_id` AS `profile_id`,`test`.`t3`.`id` AS `id`,`test`.`t3`.`REV` AS `REV`,`test`.`t3`.`person_id` AS `person_id`,`test`.`t4`.`id` AS `id`,`test`.`t4`.`REV` AS `REV` from `test`.`t4` join `test`.`t3` join `test`.`t2` join `test`.`t1` where `test`.`t2`.`REVTYPE` = 2 and `test`.`t1`.`id` = `test`.`t2`.`REV` and `test`.`t3`.`id` = `test`.`t2`.`profile_id` and `test`.`t4`.`id` = `test`.`t3`.`person_id` and `test`.`t1`.`timestamp` < 1294664900039 and `test`.`t1`.`timestamp` > 1294644616416
+SELECT *
+FROM t1 RIGHT JOIN t2 ON t2.REV=t1.id
+RIGHT JOIN t3 ON t3.id=t2.profile_id
+RIGHT JOIN t4 ON t4.id=t3.person_id
+WHERE t1.timestamp < 1294664900039 AND t1.timestamp > 1294644616416
+AND t2.REVTYPE=2;
+id timestamp modifiedBy id REV REVTYPE profile_id id REV person_id id REV
+12 1294650860266 u62C^Kzx3wH8 8 12 2 2 2 1 300003 300003 1
+12 1294650860266 u62C^Kzx3wH8 8 12 2 2 2 117548 300006 300006 1
+12 1294650860266 u62C^Kzx3wH8 8 12 2 2 2 117548 300006 300006 97697
+DROP TABLE t1,t2,t3,t4;
+# end of 10.1 tests
+#
# MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins
#
create table t1(a int);
@@ -2538,13 +2676,13 @@ insert into t3 select A.a + B.a* 10 + C.a * 100, 12345 from t1 A, t1 B, t1 C;
explain select * from t1 left join t3 on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
-1 SIMPLE t3 range a a 5 NULL 5 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join)
+1 SIMPLE t3 hash_range a #hash#$hj:a 5:5 test.t1.a 5 Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join)
# This must use range for table t3, too:
explain select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
-1 SIMPLE t3 range a a 5 NULL 5 Using where; Rowid-ordered scan; Using join buffer (incremental, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 hash_range a #hash#$hj:a 5:5 test.t1.a 5 Using where; Rowid-ordered scan; Using join buffer (incremental, BNLH join)
#
# .. part 2: make sure condition selectivity can use the condition too.
#
@@ -2570,8 +2708,8 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` A
explain extended select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
-1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
-1 SIMPLE t3 ALL NULL NULL NULL NULL 1000 1.96 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a 1000 1.96 Using where; Using join buffer (incremental, BNLH join)
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t3` join `test`.`t2`) on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5 and `test`.`t1`.`a` is not null) where 1
drop table t1,t2,t3;
diff --git a/mysql-test/main/lowercase_table4.test b/mysql-test/main/lowercase_table4.test
index 981c8a14564..24d2aa16f49 100644
--- a/mysql-test/main/lowercase_table4.test
+++ b/mysql-test/main/lowercase_table4.test
@@ -1,5 +1,7 @@
--source include/have_case_insensitive_file_system.inc
--source include/have_innodb.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
--echo #
--echo # Bug#46941 crash with lower_case_table_names=2 and
diff --git a/mysql-test/main/mysql_client_test.test b/mysql-test/main/mysql_client_test.test
index a4da24c448f..69d89272221 100644
--- a/mysql-test/main/mysql_client_test.test
+++ b/mysql-test/main/mysql_client_test.test
@@ -2,6 +2,8 @@
-- source include/not_embedded.inc
# need to have the dynamic loading turned on for the client plugin tests
--source include/have_plugin_auth.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
SET @old_general_log= @@global.general_log;
SET @old_slow_query_log= @@global.slow_query_log;
diff --git a/mysql-test/main/mysql_client_test_nonblock.test b/mysql-test/main/mysql_client_test_nonblock.test
index 31de14e4178..768a0590c30 100644
--- a/mysql-test/main/mysql_client_test_nonblock.test
+++ b/mysql-test/main/mysql_client_test_nonblock.test
@@ -2,6 +2,8 @@
# The non-blocking API is not supported in the embedded server.
-- source include/not_embedded.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
SET @old_general_log= @@global.general_log;
SET @old_slow_query_log= @@global.slow_query_log;
diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test
index 97724a621e3..b9504637d82 100644
--- a/mysql-test/main/mysqldump.test
+++ b/mysql-test/main/mysqldump.test
@@ -19,6 +19,9 @@ let collation=utf8_unicode_ci;
# There are tables in 'mysql' database of type innodb
--source include/have_innodb.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
+
disable_query_log;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
enable_query_log;
diff --git a/mysql-test/main/selectivity_innodb.test b/mysql-test/main/selectivity_innodb.test
index e2dba034363..f407eb052fe 100644
--- a/mysql-test/main/selectivity_innodb.test
+++ b/mysql-test/main/selectivity_innodb.test
@@ -1,4 +1,6 @@
--source include/have_innodb.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
SET SESSION STORAGE_ENGINE='InnoDB';
diff --git a/mysql-test/main/subselect_sj.result b/mysql-test/main/subselect_sj.result
index a4dd6601f48..7114024310c 100644
--- a/mysql-test/main/subselect_sj.result
+++ b/mysql-test/main/subselect_sj.result
@@ -3197,6 +3197,7 @@ drop table t1,t2,t3;
#
# MDEV-18896: IN subquery in WHERE of a table-less query used for INSERT
#
+set @@optimizer_switch= @subselect_sj_tmp;
create table t1 (a1 varchar(25));
create table t2 (a2 varchar(25)) ;
insert into t1 select 'xxx' from dual where 'xxx' in (select a2 from t2);
diff --git a/mysql-test/main/subselect_sj.test b/mysql-test/main/subselect_sj.test
index d735d852a5e..ad4577b72b0 100644
--- a/mysql-test/main/subselect_sj.test
+++ b/mysql-test/main/subselect_sj.test
@@ -2880,6 +2880,8 @@ drop table t1,t2,t3;
--echo # MDEV-18896: IN subquery in WHERE of a table-less query used for INSERT
--echo #
+set @@optimizer_switch= @subselect_sj_tmp;
+
create table t1 (a1 varchar(25));
create table t2 (a2 varchar(25)) ;
insert into t1 select 'xxx' from dual where 'xxx' in (select a2 from t2);
diff --git a/mysql-test/main/subselect_sj_jcl6.result b/mysql-test/main/subselect_sj_jcl6.result
index 36cca52b534..f7f87fc2511 100644
--- a/mysql-test/main/subselect_sj_jcl6.result
+++ b/mysql-test/main/subselect_sj_jcl6.result
@@ -3211,6 +3211,7 @@ drop table t1,t2,t3;
#
# MDEV-18896: IN subquery in WHERE of a table-less query used for INSERT
#
+set @@optimizer_switch= @subselect_sj_tmp;
create table t1 (a1 varchar(25));
create table t2 (a2 varchar(25)) ;
insert into t1 select 'xxx' from dual where 'xxx' in (select a2 from t2);
diff --git a/mysql-test/main/trigger_null-8605.test b/mysql-test/main/trigger_null-8605.test
index 34a57654b48..7645b61f5ad 100644
--- a/mysql-test/main/trigger_null-8605.test
+++ b/mysql-test/main/trigger_null-8605.test
@@ -149,6 +149,7 @@ EOF
load data infile 'mdev8605.txt' into table t1 fields terminated by ',';
select * from t1;
drop table t1;
+--remove_file $datadir/test/mdev8605.txt
# timestamps (on NULL = NOW())
create table t1 (a timestamp, b int auto_increment primary key);
@@ -218,6 +219,7 @@ load data infile 'sep8605.txt' into table t1 fields terminated by ','
(@a,a2,a3,b,c) set a1=100-@a;
select 100-a1,a2,a3,b,c from t1;
delete from t1;
+--remove_file $datadir/test/sep8605.txt
--write_file $datadir/test/fix8605.txt
00012010-11-12 01:02:030010000000000000000
@@ -231,6 +233,7 @@ set statement timestamp=777777777 for
load data infile 'fix8605.txt' into table t1 fields terminated by '';
select * from t1;
delete from t1;
+--remove_file $datadir/test/fix8605.txt
--write_file $datadir/test/xml8605.txt
<data>
@@ -300,6 +303,7 @@ set statement timestamp=777777777 for
load xml infile 'xml8605.txt' into table t1 rows identified by '<row>';
select * from t1;
drop table t1;
+--remove_file $datadir/test/xml8605.txt
# explicit DEFAULT
create table t1 (a int not null default 5, b int, c int);
diff --git a/mysql-test/suite/encryption/r/corrupted_during_recovery.result b/mysql-test/suite/encryption/r/corrupted_during_recovery.result
index 41c0d7d75a8..356dce64f8d 100644
--- a/mysql-test/suite/encryption/r/corrupted_during_recovery.result
+++ b/mysql-test/suite/encryption/r/corrupted_during_recovery.result
@@ -9,14 +9,11 @@ INSERT INTO t2 VALUES(2);
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
-a
-1
-2
+ERROR 42S02: Table 'test.t1' doesn't exist in engine
SELECT * FROM t2;
a
2
-CHECK TABLE t1,t2;
+CHECK TABLE t2;
Table Op Msg_type Msg_text
-test.t1 check status OK
test.t2 check status OK
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/encryption/r/innodb-force-corrupt.result b/mysql-test/suite/encryption/r/innodb-force-corrupt.result
index 8c9f480554d..012901010b4 100644
--- a/mysql-test/suite/encryption/r/innodb-force-corrupt.result
+++ b/mysql-test/suite/encryption/r/innodb-force-corrupt.result
@@ -1,6 +1,7 @@
call mtr.add_suppression("InnoDB: Table `test`\\.`t[13]` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=\\d+, page number=[36]\\] in file .*test.t[123]\\.ibd looks corrupted; key_version=");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t[13]` is corrupted");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption in an InnoDB type table");
+call mtr.add_suppression("\\[ERROR\\] mysqld.*: Index for table 't2' is corrupt; try to repair it");
SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
# Create and populate tables to be corrupted
@@ -19,7 +20,7 @@ COMMIT;
SELECT * FROM t1;
ERROR 42S02: Table 'test.t1' doesn't exist in engine
SELECT * FROM t2;
-ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
+Got one of the listed errors
SELECT * FROM t3;
ERROR 42S02: Table 'test.t3' doesn't exist in engine
# Restore the original tables
diff --git a/mysql-test/suite/encryption/t/corrupted_during_recovery.combinations b/mysql-test/suite/encryption/t/corrupted_during_recovery.combinations
new file mode 100644
index 00000000000..729380593f3
--- /dev/null
+++ b/mysql-test/suite/encryption/t/corrupted_during_recovery.combinations
@@ -0,0 +1,5 @@
+[strict_crc32]
+--innodb-checksum-algorithm=strict_crc32
+
+[strict_full_crc32]
+--innodb-checksum-algorithm=strict_full_crc32
diff --git a/mysql-test/suite/encryption/t/corrupted_during_recovery.test b/mysql-test/suite/encryption/t/corrupted_during_recovery.test
index 44cd03e9f8a..42cdd13d206 100644
--- a/mysql-test/suite/encryption/t/corrupted_during_recovery.test
+++ b/mysql-test/suite/encryption/t/corrupted_during_recovery.test
@@ -11,6 +11,7 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=\\d+, page number=3
call mtr.add_suppression("InnoDB: Table in tablespace \\d+ encrypted. However key management plugin or used key_version \\d+ is not found or used encryption algorithm or method does not match. Can't continue opening the table.");
--enable_query_log
+let INNODB_CHECKSUM_ALGORITHM = `SELECT @@innodb_checksum_algorithm`;
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB, ENCRYPTED=YES;
INSERT INTO t1 VALUES(1);
@@ -34,7 +35,8 @@ my $ps = $ENV{INNODB_PAGE_SIZE};
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
open(FILE, "+<$file") || die "Unable to open $file";
binmode FILE;
-seek (FILE, $ENV{INNODB_PAGE_SIZE} * 3, SEEK_SET) or die "seek";
+my $offset = ($ENV{INNODB_CHECKSUM_ALGORITHM} =~ /full_crc32/) ? 26 : 0;
+seek (FILE, $ENV{INNODB_PAGE_SIZE} * 3 + $offset, SEEK_SET) or die "seek";
print FILE "junk";
close FILE or die "close";
@@ -51,11 +53,16 @@ EOF
--source include/start_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
-let $restart_parameters=--innodb_force_recovery=1;
+--disable_query_log
+call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[1].ibd looks corrupted; key_version=");
+call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted. Please drop the table and recreate.");
+--enable_query_log
+let $restart_parameters=--innodb_force_recovery=1 --skip-innodb-buffer-pool-load-at-startup;
--source include/restart_mysqld.inc
+--error ER_NO_SUCH_TABLE_IN_ENGINE
SELECT * FROM t1;
SELECT * FROM t2;
-CHECK TABLE t1,t2;
+CHECK TABLE t2;
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/encryption/t/innodb-force-corrupt.test b/mysql-test/suite/encryption/t/innodb-force-corrupt.test
index e8048150be2..8144f4597e2 100644
--- a/mysql-test/suite/encryption/t/innodb-force-corrupt.test
+++ b/mysql-test/suite/encryption/t/innodb-force-corrupt.test
@@ -9,7 +9,8 @@
call mtr.add_suppression("InnoDB: Table `test`\\.`t[13]` (has an unreadable root page|is corrupted)");
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=\\d+, page number=[36]\\] in file .*test.t[123]\\.ibd looks corrupted; key_version=");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t[13]` is corrupted");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption in an InnoDB type table");
+call mtr.add_suppression("\\[ERROR\\] mysqld.*: Index for table 't2' is corrupt; try to repair it");
SET GLOBAL innodb_file_per_table = ON;
set global innodb_compression_algorithm = 1;
@@ -69,7 +70,7 @@ EOF
--error ER_NO_SUCH_TABLE_IN_ENGINE
SELECT * FROM t1;
---error ER_GET_ERRMSG
+--error ER_GET_ERRMSG,ER_NOT_KEYFILE
SELECT * FROM t2;
--error ER_NO_SUCH_TABLE_IN_ENGINE
SELECT * FROM t3;
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index d40b409cb33..9a9524f9a82 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -33,7 +33,6 @@ galera_concurrent_ctas : MDEV-18180 Galera test failure on galera.galera_concurr
galera_encrypt_tmp_files : Get error failed to enable encryption of temporary files
galera_flush : MariaDB does not have global.thread_statistics
galera_gcache_recover_manytrx : MDEV-18834 Galera test failure
-galera_gcs_fc_limit : MDEV-17061 Timeout in wait_condition.inc for PROCESSLIST
galera_ist_mariabackup : MDEV-18829 test leaves port open
galera_ist_progress: MDEV-15236 fails when trying to read transfer status
galera_kill_applier : race condition at the start of the test
diff --git a/mysql-test/suite/galera/r/MW-336.result b/mysql-test/suite/galera/r/MW-336.result
index d344775648f..4470cca51fb 100644
--- a/mysql-test/suite/galera/r/MW-336.result
+++ b/mysql-test/suite/galera/r/MW-336.result
@@ -7,11 +7,13 @@ SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 1;
# Wait 10 slave threads to start 1
connection node_2;
-# Generate 12 replication events
+SET SESSION wsrep_sync_wait=15;
+# Generate 100 replication events
connection node_1;
+SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) FROM t1;
COUNT(*)
-13
+101
# Wait 9 slave threads to exit 1
SET GLOBAL wsrep_slave_threads = 10;
# Wait 10 slave threads to start 2
@@ -19,23 +21,21 @@ SET GLOBAL wsrep_slave_threads = 20;
# Wait 20 slave threads to start 3
SET GLOBAL wsrep_slave_threads = 1;
connection node_2;
-# Generate 40 replication events
+# Generate 100 replication events
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
-53
+201
# Wait 10 slave threads to exit 3
SET GLOBAL wsrep_slave_threads = 10;
-SET GLOBAL wsrep_slave_threads = 0;
-Warnings:
-Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
+SET GLOBAL wsrep_slave_threads = 1;
# Wait 10 slave threads to start 3
connection node_2;
-# Generate 12 replication events
+# Generate 100 replication events
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
-65
+301
# Wait 10 slave threads to exit 4
connection node_1;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
index 83eaa0fb7aa..e96e512b61b 100644
--- a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
+++ b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
@@ -1,25 +1,28 @@
connection node_2;
connection node_1;
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,B INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1);
connection node_2;
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
1
SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1';
LOCK TABLE t1 WRITE;
connection node_1;
-INSERT INTO t1 VALUES (2);
-INSERT INTO t1 VALUES (3);
-INSERT INTO t1 VALUES (4);
-INSERT INTO t1 VALUES (5);
+FLUSH STATUS;
+INSERT INTO t1 VALUES (2,2);
+INSERT INTO t1 VALUES (3,3);
+INSERT INTO t1 VALUES (4,4);
+INSERT INTO t1(B) SELECT B FROM t1;
connection node_1a;
+# In node_1 either insert or commit should be stuck
connection node_2;
UNLOCK TABLES;
connection node_1;
-INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (NULL,6);
connection node_2;
-SELECT COUNT(*) = 6 FROM t1;
-COUNT(*) = 6
-1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MW-336.test b/mysql-test/suite/galera/t/MW-336.test
index 6549ecfe6ea..6f778722831 100644
--- a/mysql-test/suite/galera/t/MW-336.test
+++ b/mysql-test/suite/galera/t/MW-336.test
@@ -19,13 +19,14 @@ SET GLOBAL wsrep_slave_threads = 1;
--source include/wait_condition.inc
--connection node_2
+SET SESSION wsrep_sync_wait=15;
# Wait until inserts are replicated
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
---echo # Generate 12 replication events
+--echo # Generate 100 replication events
--disable_query_log
--disable_result_log
---let $count = 12
+--let $count = 100
while ($count)
{
INSERT INTO t1 VALUES (1);
@@ -35,9 +36,7 @@ while ($count)
--enable_query_log
--connection node_1
-# Wait until inserts are replicated
---let $wait_condition = SELECT COUNT(*) = 13 FROM t1;
---source include/wait_condition.inc
+SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) FROM t1;
@@ -61,10 +60,10 @@ SET GLOBAL wsrep_slave_threads = 20;
SET GLOBAL wsrep_slave_threads = 1;
--connection node_2
---echo # Generate 40 replication events
+--echo # Generate 100 replication events
--disable_query_log
--disable_result_log
---let $count = 40
+--let $count = 100
while ($count)
{
INSERT INTO t1 VALUES (1);
@@ -74,11 +73,6 @@ while ($count)
--enable_result_log
--connection node_1
-
-# Wait until inserts are replicated
---let $wait_condition = SELECT COUNT(*) = 53 FROM t1;
---source include/wait_condition.inc
-
SELECT COUNT(*) FROM t1;
--echo # Wait 10 slave threads to exit 3
@@ -87,7 +81,7 @@ SELECT COUNT(*) FROM t1;
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 10;
-SET GLOBAL wsrep_slave_threads = 0;
+SET GLOBAL wsrep_slave_threads = 1;
--echo # Wait 10 slave threads to start 3
--let $wait_timeout=600
@@ -95,10 +89,10 @@ SET GLOBAL wsrep_slave_threads = 0;
--source include/wait_condition.inc
--connection node_2
---echo # Generate 12 replication events
+--echo # Generate 100 replication events
--disable_query_log
--disable_result_log
---let $count = 12
+--let $count = 100
while ($count)
{
INSERT INTO t1 VALUES (1);
@@ -108,10 +102,6 @@ while ($count)
--enable_query_log
--connection node_1
-# Wait until inserts are replicated
---let $wait_condition = SELECT COUNT(*) = 65 FROM t1;
---source include/wait_condition.inc
-
SELECT COUNT(*) FROM t1;
--echo # Wait 10 slave threads to exit 4
diff --git a/mysql-test/suite/galera/t/galera_gcs_fc_limit.test b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test
index 5d341533161..e0626bd8946 100644
--- a/mysql-test/suite/galera/t/galera_gcs_fc_limit.test
+++ b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test
@@ -5,12 +5,12 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,B INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1);
--connection node_2
-SELECT COUNT(*) = 1 FROM t1;
---sleep 1
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) FROM t1;
--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1';
@@ -19,24 +19,22 @@ SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1';
LOCK TABLE t1 WRITE;
--connection node_1
---sleep 1
-INSERT INTO t1 VALUES (2);
---sleep 2
-INSERT INTO t1 VALUES (3);
---sleep 2
-INSERT INTO t1 VALUES (4);
---sleep 2
+FLUSH STATUS;
+INSERT INTO t1 VALUES (2,2);
+INSERT INTO t1 VALUES (3,3);
+INSERT INTO t1 VALUES (4,4);
# This query will hang because flow control will kick in
--send
-INSERT INTO t1 VALUES (5);
---sleep 2
+INSERT INTO t1(B) SELECT B FROM t1;
--let $galera_connection_name = node_1a
--let $galera_server_number = 1
--source include/galera_connect.inc
--connection node_1a
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Commit' AND INFO = 'INSERT INTO t1 VALUES (5)';
+
+--echo # In node_1 either insert or commit should be stuck
+--let $wait_condition = SELECT VARIABLE_VALUE > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_flow_control_paused';
--source include/wait_condition.inc
--connection node_2
@@ -46,11 +44,11 @@ UNLOCK TABLES;
--connection node_1
--reap
-INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (NULL,6);
--connection node_2
# Replication catches up and continues normally
-SELECT COUNT(*) = 6 FROM t1;
+SELECT COUNT(*) FROM t1;
--disable_query_log
--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
diff --git a/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result
index 3543feff78c..b1332a5f87c 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_evs_suspect_timeout.result
@@ -1,28 +1,37 @@
connection node_2;
connection node_1;
connection node_1;
+connection node_2;
+connection node_3;
+connection node_1;
SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S';
connection node_2;
SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S';
connection node_3;
Suspending node ...
connection node_1;
-SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_sync_wait=0;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
-CREATE TABLE t1 (f1 INTEGER);
+CREATE TABLE t1 (f1 INTEGER) engine=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
-SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_sync_wait=0;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
-SET SESSION wsrep_sync_wait = DEFAULT;
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
+SET SESSION wsrep_sync_wait = 15;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
1
-DROP TABLE t1;
connection node_3;
Resuming node ...
-CALL mtr.add_suppression("WSREP: gcs_caused() returned -1 \\(Operation not permitted\\)");
+CALL mtr.add_suppression("WSREP: gcs_caused");
+CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg");
+SET SESSION wsrep_sync_wait = 15;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test
index a4767928681..3f1140b175d 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test
@@ -7,24 +7,28 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+--let $wsrep_cluster_address_node3 = `SELECT @@wsrep_cluster_address`
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
--connection node_1
--let $wsrep_provider_options_node1 = `SELECT @@wsrep_provider_options`
SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S';
--connection node_2
---source include/wait_until_connected_again.inc
--let $wsrep_provider_options_node2 = `SELECT @@wsrep_provider_options`
SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_timeout=PT1S';
---let $galera_connection_name = node_3
---let $galera_server_number = 3
---source include/galera_connect.inc
---connection node_3
---source include/wait_until_connected_again.inc
---let $wsrep_cluster_address_node3 = `SELECT @@wsrep_cluster_address`
-
# Suspend node #3
+--connection node_3
--source include/galera_suspend.inc
--sleep 5
@@ -32,27 +36,27 @@ SET GLOBAL wsrep_provider_options = 'evs.inactive_timeout=PT100M; evs.suspect_ti
--connection node_1
--source include/wait_until_connected_again.inc
-SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_sync_wait=0;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--disable_query_log
--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node1';
--enable_query_log
-
--source include/wait_until_connected_again.inc
-CREATE TABLE t1 (f1 INTEGER);
+
+CREATE TABLE t1 (f1 INTEGER) engine=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
-SET SESSION wsrep_sync_wait = 0;
+--source include/wait_until_connected_again.inc
+SET SESSION wsrep_sync_wait=0;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--disable_query_log
--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node2';
--enable_query_log
-
--source include/wait_until_connected_again.inc
-SET SESSION wsrep_sync_wait = DEFAULT;
-SELECT COUNT(*) = 1 FROM t1;
-DROP TABLE t1;
+
+SET SESSION wsrep_sync_wait = 15;
+SELECT COUNT(*) FROM t1;
# Reconnect node #3 so that MTR's end-of-test checks can run
@@ -65,4 +69,13 @@ DROP TABLE t1;
--enable_query_log
--source include/galera_wait_ready.inc
-CALL mtr.add_suppression("WSREP: gcs_caused() returned -1 \\(Operation not permitted\\)");
+CALL mtr.add_suppression("WSREP: gcs_caused");
+CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg");
+
+SET SESSION wsrep_sync_wait = 15;
+SELECT COUNT(*) FROM t1;
+
+--connection node_1
+DROP TABLE t1;
+# Restore original auto_increment_offset values.
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/innodb/include/innodb-page-compression.inc b/mysql-test/suite/innodb/include/innodb-page-compression.inc
index 0e7ae8cf029..fec0f0cf01c 100644
--- a/mysql-test/suite/innodb/include/innodb-page-compression.inc
+++ b/mysql-test/suite/innodb/include/innodb-page-compression.inc
@@ -1,3 +1,5 @@
+# This test is slow on buildbot.
+--source include/big_test.inc
create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb;
create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1;
create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2;
diff --git a/mysql-test/suite/innodb/r/corrupted_during_recovery.result b/mysql-test/suite/innodb/r/corrupted_during_recovery.result
index 788f17e3284..ee4db08fc85 100644
--- a/mysql-test/suite/innodb/r/corrupted_during_recovery.result
+++ b/mysql-test/suite/innodb/r/corrupted_during_recovery.result
@@ -9,14 +9,11 @@ INSERT INTO t2 VALUES(1);
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
-a
-0
-2
+ERROR 42S02: Table 'test.t1' doesn't exist in engine
SELECT * FROM t2;
a
1
-CHECK TABLE t1,t2;
+CHECK TABLE t2;
Table Op Msg_type Msg_text
-test.t1 check status OK
test.t2 check status OK
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/innodb/r/innodb_force_recovery.result b/mysql-test/suite/innodb/r/innodb_force_recovery.result
index 90b48bac187..838de9844e1 100644
--- a/mysql-test/suite/innodb/r/innodb_force_recovery.result
+++ b/mysql-test/suite/innodb/r/innodb_force_recovery.result
@@ -29,8 +29,10 @@ ERROR HY000: Error on rename of './test/t1' to './test/t3' (errno: 165 "Table is
truncate table t1;
ERROR HY000: Table 't1' is read only
drop table t1;
+ERROR HY000: Table 't1' is read only
show tables;
Tables_in_test
+t1
t2
# Restart the server with innodb_force_recovery as 5.
# restart: --innodb-force-recovery=5
@@ -47,18 +49,21 @@ drop index idx on t2;
ERROR HY000: Can't create table `test`.`t2` (errno: 165 "Table is read only")
update t2 set f1=3 where f2=2;
ERROR HY000: Running in read-only mode
-create table t1(f1 int not null)engine=innodb;
-ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
-drop table t1;
-ERROR 42S02: Unknown table 'test.t1'
+create table t3(f1 int not null)engine=innodb;
+ERROR HY000: Can't create table `test`.`t3` (errno: 165 "Table is read only")
+drop table t3;
+ERROR 42S02: Unknown table 'test.t3'
rename table t2 to t3;
ERROR HY000: Error on rename of './test/t2' to './test/t3' (errno: 165 "Table is read only")
truncate table t2;
ERROR HY000: Table 't2' is read only
drop table t2;
ERROR HY000: Table 't2' is read only
+create schema db;
+drop schema db;
show tables;
Tables_in_test
+t1
t2
# Restart the server with innodb_force_recovery as 6.
# restart: --innodb-force-recovery=6
@@ -75,10 +80,10 @@ drop index idx on t2;
ERROR HY000: Table 't2' is read only
update t2 set f1=3 where f2=2;
ERROR HY000: Table 't2' is read only
-create table t1(f1 int not null)engine=innodb;
-ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
+create table t3(f1 int not null)engine=innodb;
+ERROR HY000: Can't create table `test`.`t3` (errno: 165 "Table is read only")
drop table t1;
-ERROR 42S02: Unknown table 'test.t1'
+ERROR HY000: Table 't1' is read only
rename table t2 to t3;
ERROR HY000: Error on rename of './test/t2' to './test/t3' (errno: 165 "Table is read only")
truncate table t2;
@@ -87,6 +92,7 @@ drop table t2;
ERROR HY000: Table 't2' is read only
show tables;
Tables_in_test
+t1
t2
# Restart the server with innodb_force_recovery=2
# restart: --innodb-force-recovery=2
@@ -96,10 +102,9 @@ f1 f2
begin;
update t2 set f2=3;
connect con1,localhost,root,,;
-create table t3(a int)engine=innodb;
# Force a redo log flush of the above uncommitted UPDATE
SET GLOBAL innodb_flush_log_at_trx_commit=1;
-drop table t3;
+drop table t1;
disconnect con1;
connection default;
# Kill the server
diff --git a/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result b/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result
new file mode 100644
index 00000000000..37ddb0a9348
--- /dev/null
+++ b/mysql-test/suite/innodb/r/leaf_page_corrupted_during_recovery.result
@@ -0,0 +1,20 @@
+CREATE TABLE t1 (pk INT PRIMARY KEY, c CHAR(255))ENGINE=InnoDB STATS_PERSISTENT=0;
+SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG = 2;
+INSERT INTO t1 VALUES(1, 'sql'), (2, 'server'), (3, 'mariadb'),
+(4, 'mariadb'), (5, 'test1'), (6, 'test2'), (7, 'test3'),
+(8, 'test4'), (9, 'test5'), (10, 'test6'), (11, 'test7'),
+(12, 'test8');
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+12
+UPDATE t1 SET c='best8' WHERE pk=12;
+# Kill the server
+# Corrupt the pages
+SELECT * FROM t1 WHERE PK = 1;
+ERROR 42000: Unknown storage engine 'InnoDB'
+SELECT * FROM t1 WHERE PK = 1;
+pk c
+1 sql
+SELECT * FROM t1 WHERE pk = 12;
+ERROR HY000: Index for table 't1' is corrupt; try to repair it
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/corrupted_during_recovery.opt b/mysql-test/suite/innodb/t/corrupted_during_recovery.opt
index 6051f4cd1fa..ba4fa744d8f 100644
--- a/mysql-test/suite/innodb/t/corrupted_during_recovery.opt
+++ b/mysql-test/suite/innodb/t/corrupted_during_recovery.opt
@@ -1 +1,2 @@
---innodb_doublewrite=0
+--skip-innodb-doublewrite
+--skip-innodb-buffer-pool-load-at-startup
diff --git a/mysql-test/suite/innodb/t/corrupted_during_recovery.test b/mysql-test/suite/innodb/t/corrupted_during_recovery.test
index 697d6e2dce0..155a09845a0 100644
--- a/mysql-test/suite/innodb/t/corrupted_during_recovery.test
+++ b/mysql-test/suite/innodb/t/corrupted_during_recovery.test
@@ -6,6 +6,8 @@ call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t1 page");
call mtr.add_suppression("InnoDB: Failed to read file '.*test.t1\\.ibd' at offset 3: Page read from tablespace is corrupted.");
+call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=\\d+, page number=3\\]");
+call mtr.add_suppression("InnoDB: Table `test`.`t1` is corrupted. Please drop the table and recreate.");
--enable_query_log
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
@@ -54,8 +56,10 @@ EOF
SELECT * FROM t1;
let $restart_parameters=--innodb_force_recovery=1;
--source include/restart_mysqld.inc
+
+--error ER_NO_SUCH_TABLE_IN_ENGINE
SELECT * FROM t1;
SELECT * FROM t2;
-CHECK TABLE t1,t2;
+CHECK TABLE t2;
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/innodb/t/doublewrite.test b/mysql-test/suite/innodb/t/doublewrite.test
index 87ca600aea3..62e8549f21b 100644
--- a/mysql-test/suite/innodb/t/doublewrite.test
+++ b/mysql-test/suite/innodb/t/doublewrite.test
@@ -7,6 +7,8 @@
--source include/innodb_page_size.inc
--source include/have_debug.inc
--source include/not_embedded.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
# Slow shutdown and restart to make sure ibuf merge is finished
SET GLOBAL innodb_fast_shutdown = 0;
diff --git a/mysql-test/suite/innodb/t/full_crc32_import.test b/mysql-test/suite/innodb/t/full_crc32_import.test
index f62c68ec543..3916b52d073 100644
--- a/mysql-test/suite/innodb/t/full_crc32_import.test
+++ b/mysql-test/suite/innodb/t/full_crc32_import.test
@@ -1,4 +1,6 @@
-- source include/have_innodb.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
FLUSH TABLES;
diff --git a/mysql-test/suite/innodb/t/innodb-alter-table.test b/mysql-test/suite/innodb/t/innodb-alter-table.test
index 0cf456ad146..ab0bd7b3353 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-table.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-table.test
@@ -1,5 +1,7 @@
--source include/innodb_page_size.inc
--source include/have_partition.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
#
# MMDEV-8386: MariaDB creates very big tmp file and hangs on xtradb
diff --git a/mysql-test/suite/innodb/t/innodb-change-buffer-recovery.test b/mysql-test/suite/innodb/t/innodb-change-buffer-recovery.test
index 6b52e386525..d8cc21c550c 100644
--- a/mysql-test/suite/innodb/t/innodb-change-buffer-recovery.test
+++ b/mysql-test/suite/innodb/t/innodb-change-buffer-recovery.test
@@ -9,6 +9,8 @@
--source include/not_embedded.inc
# DBUG_SUICIDE() hangs under valgrind
--source include/not_valgrind.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
CREATE TABLE t1(
a INT AUTO_INCREMENT PRIMARY KEY,
diff --git a/mysql-test/suite/innodb/t/innodb-index-debug.test b/mysql-test/suite/innodb/t/innodb-index-debug.test
index e680fb719cc..2988a89c651 100644
--- a/mysql-test/suite/innodb/t/innodb-index-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-index-debug.test
@@ -2,6 +2,8 @@
-- source include/have_innodb.inc
-- source include/count_sessions.inc
-- source include/have_debug_sync.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
let $MYSQLD_DATADIR= `select @@datadir`;
diff --git a/mysql-test/suite/innodb/t/innodb-page-cleaners.test b/mysql-test/suite/innodb/t/innodb-page-cleaners.test
index 7ed87ae1734..6f8accec30f 100644
--- a/mysql-test/suite/innodb/t/innodb-page-cleaners.test
+++ b/mysql-test/suite/innodb/t/innodb-page-cleaners.test
@@ -1,4 +1,6 @@
--source include/have_innodb.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
SET @saved_page_cleaners = @@GLOBAL.innodb_page_cleaners;
diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_zip.test b/mysql-test/suite/innodb/t/innodb-page_compression_zip.test
index 45e62722972..ad78767e903 100644
--- a/mysql-test/suite/innodb/t/innodb-page_compression_zip.test
+++ b/mysql-test/suite/innodb/t/innodb-page_compression_zip.test
@@ -1,5 +1,7 @@
--source include/have_innodb.inc
--source include/not_embedded.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
# zlib
set global innodb_compression_algorithm = 1;
diff --git a/mysql-test/suite/innodb/t/innodb_force_recovery.test b/mysql-test/suite/innodb/t/innodb_force_recovery.test
index 926719e193c..00b888c2768 100644
--- a/mysql-test/suite/innodb/t/innodb_force_recovery.test
+++ b/mysql-test/suite/innodb/t/innodb_force_recovery.test
@@ -52,6 +52,7 @@ rename table t1 to t3;
--error ER_OPEN_AS_READONLY
truncate table t1;
+--error ER_OPEN_AS_READONLY
drop table t1;
show tables;
@@ -77,10 +78,10 @@ drop index idx on t2;
update t2 set f1=3 where f2=2;
--error ER_CANT_CREATE_TABLE
-create table t1(f1 int not null)engine=innodb;
+create table t3(f1 int not null)engine=innodb;
--error ER_BAD_TABLE_ERROR
-drop table t1;
+drop table t3;
--error ER_ERROR_ON_RENAME
rename table t2 to t3;
@@ -90,6 +91,9 @@ truncate table t2;
--error ER_OPEN_AS_READONLY
drop table t2;
+
+create schema db;
+drop schema db;
show tables;
--echo # Restart the server with innodb_force_recovery as 6.
@@ -114,9 +118,9 @@ drop index idx on t2;
update t2 set f1=3 where f2=2;
--error ER_CANT_CREATE_TABLE
-create table t1(f1 int not null)engine=innodb;
+create table t3(f1 int not null)engine=innodb;
---error ER_BAD_TABLE_ERROR
+--error ER_OPEN_AS_READONLY
drop table t1;
--error ER_ERROR_ON_RENAME
@@ -138,10 +142,9 @@ begin;
update t2 set f2=3;
connect (con1,localhost,root,,);
-create table t3(a int)engine=innodb;
--echo # Force a redo log flush of the above uncommitted UPDATE
SET GLOBAL innodb_flush_log_at_trx_commit=1;
-drop table t3;
+drop table t1;
disconnect con1;
connection default;
diff --git a/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.combinations b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.combinations
new file mode 100644
index 00000000000..729380593f3
--- /dev/null
+++ b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.combinations
@@ -0,0 +1,5 @@
+[strict_crc32]
+--innodb-checksum-algorithm=strict_crc32
+
+[strict_full_crc32]
+--innodb-checksum-algorithm=strict_full_crc32
diff --git a/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.opt b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.opt
new file mode 100644
index 00000000000..ba4fa744d8f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.opt
@@ -0,0 +1,2 @@
+--skip-innodb-doublewrite
+--skip-innodb-buffer-pool-load-at-startup
diff --git a/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test
new file mode 100644
index 00000000000..d81d613e7f1
--- /dev/null
+++ b/mysql-test/suite/innodb/t/leaf_page_corrupted_during_recovery.test
@@ -0,0 +1,59 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t1 page ");
+call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=\\d+, page number=19\\]");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Failed to read file '.*test.t1\\.ibd' at offset 19: Page read from tablespace is corrupted\\.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Plugin initialization aborted at srv0start\\.cc.* with error Data structure corruption");
+call mtr.add_suppression("\\[ERROR\\] Plugin 'InnoDB' (init function|registration)");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption");
+call mtr.add_suppression("\\[ERROR\\] mysqld.*: Index for table 't1' is corrupt; try to repair it");
+--enable_query_log
+CREATE TABLE t1 (pk INT PRIMARY KEY, c CHAR(255))ENGINE=InnoDB STATS_PERSISTENT=0;
+
+SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG = 2;
+
+INSERT INTO t1 VALUES(1, 'sql'), (2, 'server'), (3, 'mariadb'),
+ (4, 'mariadb'), (5, 'test1'), (6, 'test2'), (7, 'test3'),
+ (8, 'test4'), (9, 'test5'), (10, 'test6'), (11, 'test7'),
+ (12, 'test8');
+
+let $restart_noprint=2;
+--source include/restart_mysqld.inc
+
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+let MYSQLD_DATADIR=`select @@datadir`;
+
+SELECT COUNT(*) FROM t1;
+--source ../include/no_checkpoint_start.inc
+UPDATE t1 SET c='best8' WHERE pk=12;
+
+--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1;
+--source ../include/no_checkpoint_end.inc
+--echo # Corrupt the pages
+
+perl;
+my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
+open(FILE, "+<$file") || die "Unable to open $file";
+binmode FILE;
+seek (FILE, $ENV{INNODB_PAGE_SIZE} * 19 + 38, SEEK_SET) or die "seek";
+print FILE "junk";
+close FILE or die "close";
+EOF
+
+--source include/start_mysqld.inc
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t1 WHERE PK = 1;
+
+let $restart_parameters=--innodb-force-recovery=1;
+# Work around MDEV-19435 to avoid crash in row_purge_reset_trx_id()
+let $restart_parameters=--innodb-force-recovery=2;
+--source include/restart_mysqld.inc
+SELECT * FROM t1 WHERE PK = 1;
+--error ER_NOT_KEYFILE
+SELECT * FROM t1 WHERE pk = 12;
+
+DROP TABLE t1;
+let $restart_parameters=;
+--source include/restart_mysqld.inc
diff --git a/mysql-test/suite/innodb/t/log_file_size.test b/mysql-test/suite/innodb/t/log_file_size.test
index 1e6c7cd4d00..6f15b830e8d 100644
--- a/mysql-test/suite/innodb/t/log_file_size.test
+++ b/mysql-test/suite/innodb/t/log_file_size.test
@@ -4,6 +4,8 @@
--source include/not_embedded.inc
# DBUG_EXECUTE_IF is needed
--source include/have_debug.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
if (`SELECT @@innodb_log_file_size = 1048576`) {
--skip Test requires innodb_log_file_size>1M.
diff --git a/mysql-test/suite/innodb/t/mdev-15707.test b/mysql-test/suite/innodb/t/mdev-15707.test
index 46e1ee7ce57..a0446ef4f81 100644
--- a/mysql-test/suite/innodb/t/mdev-15707.test
+++ b/mysql-test/suite/innodb/t/mdev-15707.test
@@ -1,4 +1,6 @@
--source include/windows.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
# Deadlock in conjunction with the innodb change buffering.
diff --git a/mysql-test/suite/innodb/t/table_definition_cache_debug.test b/mysql-test/suite/innodb/t/table_definition_cache_debug.test
index 1f3598d68c9..70467b53435 100644
--- a/mysql-test/suite/innodb/t/table_definition_cache_debug.test
+++ b/mysql-test/suite/innodb/t/table_definition_cache_debug.test
@@ -1,6 +1,8 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
call mtr.add_suppression("InnoDB: innodb_open_files=13 is exceeded");
diff --git a/mysql-test/suite/innodb/t/update_time.test b/mysql-test/suite/innodb/t/update_time.test
index 1a00e3b9f73..a95c5171e9b 100644
--- a/mysql-test/suite/innodb/t/update_time.test
+++ b/mysql-test/suite/innodb/t/update_time.test
@@ -8,6 +8,8 @@
-- source include/have_innodb_max_16k.inc
# restart does not work with embedded
-- source include/not_embedded.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
CREATE TABLE t (a INT) ENGINE=INNODB;
diff --git a/mysql-test/suite/mariabackup/mdev-14447.test b/mysql-test/suite/mariabackup/mdev-14447.test
index 54cac745dc8..17f78b4d1c9 100644
--- a/mysql-test/suite/mariabackup/mdev-14447.test
+++ b/mysql-test/suite/mariabackup/mdev-14447.test
@@ -1,4 +1,6 @@
--source include/have_debug.inc
+# This test is slow on buildbot.
+--source include/big_test.inc
call mtr.add_suppression("InnoDB: New log files created");
let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result
index 02c2b872ebc..39614b4505c 100644
--- a/mysql-test/suite/plugins/r/server_audit.result
+++ b/mysql-test/suite/plugins/r/server_audit.result
@@ -271,6 +271,7 @@ TIME,HOSTNAME,root,localhost,ID,0,CONNECT,mysql,,0
TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,mysql,,0
TIME,HOSTNAME,no_such_user,localhost,ID,0,FAILED_CONNECT,,,ID
TIME,HOSTNAME,no_such_user,localhost,ID,0,DISCONNECT,,,0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, dva, tri\'',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, root, dva, tri\'',0
TIME,HOSTNAME,root,localhost,ID,ID,CREATE,test,t2,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t2 (id int)',0
@@ -393,6 +394,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY ***
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',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,'set global server_audit_logging= off',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_logging= on',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0
diff --git a/mysql-test/suite/plugins/r/thread_pool_server_audit.result b/mysql-test/suite/plugins/r/thread_pool_server_audit.result
index eceb2280ed4..1a3a7d4c5bf 100644
--- a/mysql-test/suite/plugins/r/thread_pool_server_audit.result
+++ b/mysql-test/suite/plugins/r/thread_pool_server_audit.result
@@ -244,6 +244,7 @@ TIME,HOSTNAME,root,localhost,ID,0,CONNECT,mysql,,0
TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,mysql,,0
TIME,HOSTNAME,no_such_user,localhost,ID,0,FAILED_CONNECT,,,ID
TIME,HOSTNAME,no_such_user,localhost,ID,0,DISCONNECT,,,0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, dva, tri\'',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users=\'odin, root, dva, tri\'',0
TIME,HOSTNAME,root,localhost,ID,ID,CREATE,test,t2,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'create table t2 (id int)',0
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result b/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result
index 811715d1439..ec9607148d4 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_skip_repl.result
@@ -7,24 +7,27 @@ SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
connection slave;
include/stop_slave.inc
SET @@GLOBAL.replicate_events_marked_for_skip=FILTER_ON_MASTER;
-SET @@GLOBAL. rpl_semi_sync_slave_enabled = 1;
+SET @@GLOBAL.rpl_semi_sync_slave_enabled = 1;
include/start_slave.inc
connection master;
CREATE TABLE t1 (a INT) ENGINE=innodb;
-SET @@GLOBAL.debug_dbug= "d,dbug_master_binlog_over_2GB";
+SET @@GLOBAL.debug_dbug="d,dbug_master_binlog_over_2GB";
SET @@SESSION.skip_replication=1;
INSERT INTO t1 SET a=1;
SET @@SESSION.skip_replication=0;
INSERT INTO t1 SET a=0;
+SET @@GLOBAL.debug_dbug="";
+FLUSH LOGS;
connection slave;
connection master;
-SET @@GLOBAL.debug_dbug="";
-SET @@GLOBAL. rpl_semi_sync_master_timeout = 10000;
-SET @@GLOBAL. rpl_semi_sync_master_enabled = 0;
+SET @@GLOBAL.debug_dbug=@@GLOBAL.debug_dbug;
+SET @@GLOBAL.rpl_semi_sync_master_timeout = 10000;
+SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
connection master;
DROP TABLE t1;
connection slave;
include/stop_slave.inc
-SET @@GLOBAL. rpl_semi_sync_slave_enabled = 0;
+SET @@GLOBAL.rpl_semi_sync_slave_enabled = 0;
SET @@GLOBAL.replicate_events_marked_for_skip = REPLICATE;
+include/start_slave.inc
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test b/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test
index f5c423741a6..8dd30b8a161 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_skip_repl.test
@@ -15,29 +15,34 @@ source include/master-slave.inc;
# Suppress warnings that might be generated during the test
call mtr.add_suppression("Timeout waiting for reply of binlog");
---let $sav_enabled_master=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled `
---let $sav_timeout_master=`SELECT @@GLOBAL.rpl_semi_sync_master_timeout `
+--let $sav_enabled_master=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled`
+--let $sav_timeout_master=`SELECT @@GLOBAL.rpl_semi_sync_master_timeout`
SET @@GLOBAL.rpl_semi_sync_master_enabled = 1;
SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
--connection slave
+--let $sav_skip_marked_slave=`SELECT @@GLOBAL.replicate_events_marked_for_skip`
+--let $sav_enabled_slave=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled`
source include/stop_slave.inc;
---let $sav_skip_marked_slave=`SELECT @@GLOBAL.replicate_events_marked_for_skip `
SET @@GLOBAL.replicate_events_marked_for_skip=FILTER_ON_MASTER;
---let $sav_enabled_slave=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled `
-SET @@GLOBAL. rpl_semi_sync_slave_enabled = 1;
-
+SET @@GLOBAL.rpl_semi_sync_slave_enabled = 1;
source include/start_slave.inc;
--connection master
CREATE TABLE t1 (a INT) ENGINE=innodb;
# Make the following events as if they offset over 2GB from the beginning of binlog
-SET @@GLOBAL.debug_dbug= "d,dbug_master_binlog_over_2GB";
+--let $sav_debug_dbug=@@GLOBAL.debug_dbug
+SET @@GLOBAL.debug_dbug="d,dbug_master_binlog_over_2GB";
SET @@SESSION.skip_replication=1;
INSERT INTO t1 SET a=1;
SET @@SESSION.skip_replication=0;
INSERT INTO t1 SET a=0;
+SET @@GLOBAL.debug_dbug="";
+
+# The current binlog is inconsistent so let's rotate it away
+# to clean up simulation results.
+FLUSH LOGS;
--sync_slave_with_master
@@ -45,17 +50,17 @@ INSERT INTO t1 SET a=0;
# Clean up
#
--connection master
-SET @@GLOBAL.debug_dbug="";
---eval SET @@GLOBAL. rpl_semi_sync_master_timeout = $sav_timeout_master
---eval SET @@GLOBAL. rpl_semi_sync_master_enabled = $sav_enabled_master
+--eval SET @@GLOBAL.debug_dbug=$sav_debug_dbug
+--eval SET @@GLOBAL.rpl_semi_sync_master_timeout = $sav_timeout_master
+--eval SET @@GLOBAL.rpl_semi_sync_master_enabled = $sav_enabled_master
--connection master
DROP TABLE t1;
--sync_slave_with_master
source include/stop_slave.inc;
---eval SET @@GLOBAL. rpl_semi_sync_slave_enabled = $sav_enabled_slave
+--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled = $sav_enabled_slave
--eval SET @@GLOBAL.replicate_events_marked_for_skip = $sav_skip_marked_slave
---let $rpl_only_running_threads= 1
+source include/start_slave.inc;
--source include/rpl_end.inc
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index 47a6d8da2cb..79e4ba9d563 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -225,7 +225,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
DBUG_SET("-d,simulate_out_of_memory");
DBUG_RETURN((void*) 0); /* purecov: inspected */
});
- length= ALIGN_SIZE(length);
+ length= ALIGN_SIZE(length) + REDZONE_SIZE;
if ((*(prev= &mem_root->free)) != NULL)
{
if ((*prev)->left < length &&
@@ -274,6 +274,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
mem_root->used= next;
mem_root->first_block_usage= 0;
}
+ point+= REDZONE_SIZE;
TRASH_ALLOC(point, original_length);
DBUG_PRINT("exit",("ptr: %p", point));
DBUG_RETURN((void*) point);
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index efd40a2ae64..e0504a0a24c 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -15,7 +15,7 @@
#define PLUGIN_VERSION 0x104
-#define PLUGIN_STR_VERSION "1.4.5"
+#define PLUGIN_STR_VERSION "1.4.6"
#define _my_thread_var loc_thread_var
@@ -2024,10 +2024,14 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
update_connection_info(cn, event_class, ev, &after_action);
if (!logging)
+ {
+ if (cn)
+ cn->log_always= 0;
goto exit_func;
+ }
if (event_class == MYSQL_AUDIT_GENERAL_CLASS && FILTER(EVENT_QUERY) &&
- cn && do_log_user(cn->user))
+ cn && (cn->log_always || do_log_user(cn->user)))
{
const struct mysql_event_general *event =
(const struct mysql_event_general *) ev;
@@ -2040,6 +2044,7 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
{
log_statement(cn, event, "QUERY");
cn->query_length= 0; /* So the log_current_query() won't log this again. */
+ cn->log_always= 0;
}
}
else if (event_class == MYSQL_AUDIT_TABLE_CLASS && FILTER(EVENT_TABLE) && cn)
@@ -2110,8 +2115,6 @@ exit_func:
break;
}
}
- if (cn)
- cn->log_always= 0;
flogger_mutex_unlock(&lock_operations);
}
@@ -2556,8 +2559,7 @@ static void log_current_query(MYSQL_THD thd)
if (!thd)
return;
cn= get_loc_info(thd);
- if (!ci_needs_setup(cn) && cn->query_length &&
- FILTER(EVENT_QUERY) && do_log_user(cn->user))
+ if (!ci_needs_setup(cn) && cn->query_length)
{
cn->log_always= 1;
log_statement_ex(cn, cn->query_time, thd_get_thread_id(thd),
@@ -2817,6 +2819,7 @@ static void update_logging(MYSQL_THD thd,
{
CLIENT_ERROR(1, "Logging was disabled.", MYF(ME_WARNING));
}
+ mark_always_logged(thd);
}
else
{
diff --git a/sql/log_event.cc b/sql/log_event.cc
index f25ebd56792..731cbf99060 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -7957,6 +7957,7 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
flags2((standalone ? FL_STANDALONE : 0) | (commit_id_arg ? FL_GROUP_COMMIT_ID : 0))
{
cache_type= Log_event::EVENT_NO_CACHE;
+ bool is_tmp_table= thd_arg->lex->stmt_accessed_temp_table();
if (thd_arg->transaction.stmt.trans_did_wait() ||
thd_arg->transaction.all.trans_did_wait())
flags2|= FL_WAITED;
@@ -7965,7 +7966,7 @@ Gtid_log_event::Gtid_log_event(THD *thd_arg, uint64 seq_no_arg,
thd_arg->transaction.all.trans_did_ddl() ||
thd_arg->transaction.all.has_created_dropped_temp_table())
flags2|= FL_DDL;
- else if (is_transactional)
+ else if (is_transactional && !is_tmp_table)
flags2|= FL_TRANSACTIONAL;
if (!(thd_arg->variables.option_bits & OPTION_RPL_SKIP_PARALLEL))
flags2|= FL_ALLOW_PARALLEL;
diff --git a/sql/mysqld.h b/sql/mysqld.h
index b6d2d688809..a29ca9ef8fe 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2006, 2016, Oracle and/or its affiliates.
- Copyright (c) 2010, 2017, MariaDB Corporation.
+ Copyright (c) 2010, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -613,10 +613,10 @@ extern mysql_mutex_t
LOCK_item_func_sleep, LOCK_status,
LOCK_error_log, LOCK_delayed_insert, LOCK_short_uuid_generator,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
- LOCK_active_mi, LOCK_manager,
- LOCK_global_system_variables, LOCK_user_conn,
+ LOCK_active_mi, LOCK_manager, LOCK_user_conn,
LOCK_prepared_stmt_count, LOCK_error_messages, LOCK_connection_count,
LOCK_slave_background;
+extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_global_system_variables;
extern mysql_rwlock_t LOCK_all_status_vars;
extern mysql_mutex_t LOCK_start_thread;
#ifdef HAVE_OPENSSL
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index d80603c5ebc..599642b3a26 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2010, 2015, MariaDB
+ Copyright (c) 2010, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,6 +28,7 @@
#include "mariadb.h"
#include "sql_base.h"
+#include "sql_const.h"
#include "sql_select.h"
#include "filesort.h"
#include "opt_subselect.h"
@@ -522,7 +523,7 @@ bool is_materialization_applicable(THD *thd, Item_in_subselect *in_subs,
!child_select->is_part_of_union() && // 1
parent_unit->first_select()->leaf_tables.elements && // 2
child_select->outer_select() &&
- child_select->outer_select()->leaf_tables.elements && // 2A
+ child_select->outer_select()->table_list.first && // 2A
subquery_types_allow_materialization(thd, in_subs) &&
(in_subs->is_top_level_item() || //3
optimizer_flag(thd,
@@ -1418,8 +1419,8 @@ void get_delayed_table_estimates(TABLE *table,
*startup_cost= item->jtbm_read_time;
/* Calculate cost of scanning the temptable */
- double data_size= item->jtbm_record_count *
- hash_sj_engine->tmp_table->s->reclength;
+ double data_size= COST_MULT(item->jtbm_record_count,
+ hash_sj_engine->tmp_table->s->reclength);
/* Do like in handler::read_time */
*scan_time= data_size/IO_SIZE + 2;
}
@@ -2494,7 +2495,8 @@ bool optimize_semijoin_nests(JOIN *join, table_map all_table_map)
int tableno;
double rows= 1.0;
while ((tableno = tm_it.next_bit()) != Table_map_iterator::BITMAP_END)
- rows *= join->map2table[tableno]->table->quick_condition_rows;
+ rows= COST_MULT(rows,
+ join->map2table[tableno]->table->quick_condition_rows);
sjm->rows= MY_MIN(sjm->rows, rows);
}
memcpy((uchar*) sjm->positions,
@@ -2607,7 +2609,7 @@ static uint get_tmp_table_rec_length(Ref_ptr_array p_items, uint elements)
double
get_tmp_table_lookup_cost(THD *thd, double row_count, uint row_size)
{
- if (row_count * row_size > thd->variables.max_heap_table_size)
+ if (row_count > thd->variables.max_heap_table_size / (double) row_size)
return (double) DISK_TEMPTABLE_LOOKUP_COST;
else
return (double) HEAP_TEMPTABLE_LOOKUP_COST;
@@ -3014,8 +3016,11 @@ bool Sj_materialization_picker::check_qep(JOIN *join,
}
double mat_read_time= prefix_cost.total_cost();
- mat_read_time += mat_info->materialization_cost.total_cost() +
- prefix_rec_count * mat_info->lookup_cost.total_cost();
+ mat_read_time=
+ COST_ADD(mat_read_time,
+ COST_ADD(mat_info->materialization_cost.total_cost(),
+ COST_MULT(prefix_rec_count,
+ mat_info->lookup_cost.total_cost())));
/*
NOTE: When we pick to use SJM[-Scan] we don't memcpy its POSITION
@@ -3055,9 +3060,12 @@ bool Sj_materialization_picker::check_qep(JOIN *join,
}
/* Add materialization cost */
- prefix_cost += mat_info->materialization_cost.total_cost() +
- prefix_rec_count * mat_info->scan_cost.total_cost();
- prefix_rec_count *= mat_info->rows;
+ prefix_cost=
+ COST_ADD(prefix_cost,
+ COST_ADD(mat_info->materialization_cost.total_cost(),
+ COST_MULT(prefix_rec_count,
+ mat_info->scan_cost.total_cost())));
+ prefix_rec_count= COST_MULT(prefix_rec_count, mat_info->rows);
uint i;
table_map rem_tables= remaining_tables;
@@ -3072,8 +3080,8 @@ bool Sj_materialization_picker::check_qep(JOIN *join,
{
best_access_path(join, join->positions[i].table, rem_tables, i,
disable_jbuf, prefix_rec_count, &curpos, &dummy);
- prefix_rec_count *= curpos.records_read;
- prefix_cost += curpos.read_time;
+ prefix_rec_count= COST_MULT(prefix_rec_count, curpos.records_read);
+ prefix_cost= COST_ADD(prefix_cost, curpos.read_time);
}
*strategy= SJ_OPT_MATERIALIZE_SCAN;
@@ -3380,16 +3388,18 @@ bool Duplicate_weedout_picker::check_qep(JOIN *join,
for (uint j= first_dupsweedout_table; j <= idx; j++)
{
POSITION *p= join->positions + j;
- current_fanout *= p->records_read;
- dups_cost += p->read_time + current_fanout / TIME_FOR_COMPARE;
+ current_fanout= COST_MULT(current_fanout, p->records_read);
+ dups_cost= COST_ADD(dups_cost,
+ COST_ADD(p->read_time,
+ current_fanout / TIME_FOR_COMPARE));
if (p->table->emb_sj_nest)
{
- sj_inner_fanout *= p->records_read;
+ sj_inner_fanout= COST_MULT(sj_inner_fanout, p->records_read);
dups_removed_fanout |= p->table->table->map;
}
else
{
- sj_outer_fanout *= p->records_read;
+ sj_outer_fanout= COST_MULT(sj_outer_fanout, p->records_read);
temptable_rec_size += p->table->table->file->ref_length;
}
}
@@ -3408,12 +3418,13 @@ bool Duplicate_weedout_picker::check_qep(JOIN *join,
sj_outer_fanout,
temptable_rec_size);
- double write_cost= join->positions[first_tab].prefix_record_count*
- sj_outer_fanout * one_write_cost;
- double full_lookup_cost= join->positions[first_tab].prefix_record_count*
- sj_outer_fanout* sj_inner_fanout *
- one_lookup_cost;
- dups_cost += write_cost + full_lookup_cost;
+ double write_cost= COST_MULT(join->positions[first_tab].prefix_record_count,
+ sj_outer_fanout * one_write_cost);
+ double full_lookup_cost=
+ COST_MULT(join->positions[first_tab].prefix_record_count,
+ COST_MULT(sj_outer_fanout,
+ sj_inner_fanout * one_lookup_cost));
+ dups_cost= COST_ADD(dups_cost, COST_ADD(write_cost, full_lookup_cost));
*read_time= dups_cost;
*record_count= prefix_rec_count * sj_outer_fanout;
@@ -3560,8 +3571,8 @@ static void recalculate_prefix_record_count(JOIN *join, uint start, uint end)
if (j == join->const_tables)
prefix_count= 1.0;
else
- prefix_count= join->best_positions[j-1].prefix_record_count *
- join->best_positions[j-1].records_read;
+ prefix_count= COST_MULT(join->best_positions[j-1].prefix_record_count,
+ join->best_positions[j-1].records_read);
join->best_positions[j].prefix_record_count= prefix_count;
}
@@ -6387,14 +6398,16 @@ bool JOIN::choose_subquery_plan(table_map join_tables)
The cost of executing the subquery and storing its result in an indexed
temporary table.
*/
- double materialization_cost= inner_read_time_1 +
- write_cost * inner_record_count_1;
+ double materialization_cost= COST_ADD(inner_read_time_1,
+ COST_MULT(write_cost,
+ inner_record_count_1));
- materialize_strategy_cost= materialization_cost +
- outer_lookup_keys * lookup_cost;
+ materialize_strategy_cost= COST_ADD(materialization_cost,
+ COST_MULT(outer_lookup_keys,
+ lookup_cost));
/* C.2 Compute the cost of the IN=>EXISTS strategy. */
- in_exists_strategy_cost= outer_lookup_keys * inner_read_time_2;
+ in_exists_strategy_cost= COST_MULT(outer_lookup_keys, inner_read_time_2);
/* C.3 Compare the costs and choose the cheaper strategy. */
if (materialize_strategy_cost >= in_exists_strategy_cost)
diff --git a/sql/records.cc b/sql/records.cc
index 3decb8f1d24..c2db29c4912 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -194,7 +194,6 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
bzero((char*) info,sizeof(*info));
info->thd=thd;
info->table=table;
- info->forms= &info->table; /* Only one table */
info->addon_field= addon_field;
if ((table->s->tmp_table == INTERNAL_TMP_TABLE ||
@@ -583,33 +582,34 @@ static int rr_unpack_from_buffer(READ_RECORD *info)
}
/* cacheing of records from a database */
+static const uint STRUCT_LENGTH= 3 + MAX_REFLENGTH;
+
static int init_rr_cache(THD *thd, READ_RECORD *info)
{
- uint rec_cache_size;
+ uint rec_cache_size, cache_records;
DBUG_ENTER("init_rr_cache");
- info->struct_length= 3+MAX_REFLENGTH;
info->reclength= ALIGN_SIZE(info->table->s->reclength+1);
- if (info->reclength < info->struct_length)
- info->reclength= ALIGN_SIZE(info->struct_length);
+ if (info->reclength < STRUCT_LENGTH)
+ info->reclength= ALIGN_SIZE(STRUCT_LENGTH);
info->error_offset= info->table->s->reclength;
- info->cache_records= (thd->variables.read_rnd_buff_size /
- (info->reclength+info->struct_length));
- rec_cache_size= info->cache_records*info->reclength;
- info->rec_cache_size= info->cache_records*info->ref_length;
+ cache_records= thd->variables.read_rnd_buff_size /
+ (info->reclength + STRUCT_LENGTH);
+ rec_cache_size= cache_records * info->reclength;
+ info->rec_cache_size= cache_records * info->ref_length;
// We have to allocate one more byte to use uint3korr (see comments for it)
- if (info->cache_records <= 2 ||
- !(info->cache=(uchar*) my_malloc_lock(rec_cache_size+info->cache_records*
- info->struct_length+1,
- MYF(MY_THREAD_SPECIFIC))))
+ if (cache_records <= 2 ||
+ !(info->cache= (uchar*) my_malloc_lock(rec_cache_size + cache_records *
+ STRUCT_LENGTH + 1,
+ MYF(MY_THREAD_SPECIFIC))))
DBUG_RETURN(1);
#ifdef HAVE_valgrind
// Avoid warnings in qsort
- bzero(info->cache,rec_cache_size+info->cache_records* info->struct_length+1);
+ bzero(info->cache, rec_cache_size + cache_records * STRUCT_LENGTH + 1);
#endif
- DBUG_PRINT("info",("Allocated buffert for %d records",info->cache_records));
+ DBUG_PRINT("info", ("Allocated buffer for %d records", cache_records));
info->read_positions=info->cache+rec_cache_size;
info->cache_pos=info->cache_end=info->cache;
DBUG_RETURN(0);
@@ -664,8 +664,7 @@ static int rr_from_cache(READ_RECORD *info)
int3store(ref_position,(long) i);
ref_position+=3;
}
- my_qsort(info->read_positions, length, info->struct_length,
- (qsort_cmp) rr_cmp);
+ my_qsort(info->read_positions, length, STRUCT_LENGTH, (qsort_cmp) rr_cmp);
position=info->read_positions;
for (i=0 ; i < length ; i++)
diff --git a/sql/records.h b/sql/records.h
index 4f8e14da9ac..e97f6b273cc 100644
--- a/sql/records.h
+++ b/sql/records.h
@@ -52,15 +52,11 @@ struct READ_RECORD
typedef int (*Setup_func)(struct st_join_table*);
TABLE *table; /* Head-form */
- //handler *file;
- TABLE **forms; /* head and ref forms */
Unlock_row_func unlock_row;
Read_func read_record_func;
THD *thd;
SQL_SELECT *select;
- uint cache_records;
- uint ref_length,struct_length,reclength,rec_cache_size,error_offset;
- uint index;
+ uint ref_length, reclength, rec_cache_size, error_offset;
uchar *ref_pos; /* pointer to form->refpos */
uchar *record;
uchar *rec_buf; /* to read field values after filesort */
diff --git a/sql/sql_const.h b/sql/sql_const.h
index 1f9353cdef3..7aa4249f5ad 100644
--- a/sql/sql_const.h
+++ b/sql/sql_const.h
@@ -247,6 +247,14 @@
#define DISK_TEMPTABLE_LOOKUP_COST 1.0
#define SORT_INDEX_CMP_COST 0.02
+
+#define COST_MAX (DBL_MAX * (1.0 - DBL_EPSILON))
+
+#define COST_ADD(c,d) (COST_MAX - (d) > (c) ? (c) + (d) : COST_MAX)
+
+#define COST_MULT(c,f) (COST_MAX / (f) > (c) ? (c) * (f) : COST_MAX)
+
+
#define MY_CHARSET_BIN_MB_MAXLEN 1
/** Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used). */
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index b205207f64d..0e1d17d13f0 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -2143,6 +2143,38 @@ public:
}
/**
+ Checks either a trans/non trans temporary table is being accessed while
+ executing a statement.
+
+ @return
+ @retval TRUE if a temporary table is being accessed
+ @retval FALSE otherwise
+ */
+ inline bool stmt_accessed_temp_table()
+ {
+ DBUG_ENTER("THD::stmt_accessed_temp_table");
+ DBUG_RETURN(stmt_accessed_non_trans_temp_table() ||
+ stmt_accessed_trans_temp_table());
+ }
+
+ /**
+ Checks if a temporary transactional table is being accessed while executing
+ a statement.
+
+ @return
+ @retval TRUE if a temporary transactional table is being accessed
+ @retval FALSE otherwise
+ */
+ inline bool stmt_accessed_trans_temp_table()
+ {
+ DBUG_ENTER("THD::stmt_accessed_trans_temp_table");
+
+ DBUG_RETURN((stmt_accessed_table_flag &
+ ((1U << STMT_READS_TEMP_TRANS_TABLE) |
+ (1U << STMT_WRITES_TEMP_TRANS_TABLE))) != 0);
+ }
+
+ /**
Checks if a temporary non-transactional table is about to be accessed
while executing a statement.
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 0305f70edad..deb8c383bde 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -4878,6 +4878,13 @@ end_with_restore_list:
*/
/* Skip first table, which is the table we are inserting in */
TABLE_LIST *second_table= first_table->next_local;
+ /*
+ This is a hack: this leaves select_lex->table_list in an inconsistent
+ state as 'elements' does not contain number of elements in the list.
+ Moreover, if second_table == NULL then 'next' becomes invalid.
+ TODO: fix it by removing the front element (restoring of it should
+ be done properly as well)
+ */
select_lex->table_list.first= second_table;
select_lex->context.table_list=
select_lex->context.first_name_resolution_table= second_table;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 598f46594e5..46be6dfef27 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2016 Oracle and/or its affiliates.
- Copyright (c) 2009, 2019 MariaDB Corporation
+/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -7451,7 +7451,7 @@ best_access_path(JOIN *join,
else
tmp= table->file->read_time(key, 1,
(ha_rows) MY_MIN(tmp,s->worst_seeks));
- tmp*= record_count;
+ tmp= COST_MULT(tmp, record_count);
}
}
else
@@ -7632,7 +7632,7 @@ best_access_path(JOIN *join,
else
tmp= table->file->read_time(key, 1,
(ha_rows) MY_MIN(tmp,s->worst_seeks));
- tmp*= record_count;
+ tmp= COST_MULT(tmp, record_count);
}
else
{
@@ -7642,7 +7642,7 @@ best_access_path(JOIN *join,
}
}
- tmp += s->startup_cost;
+ tmp= COST_ADD(tmp, s->startup_cost);
loose_scan_opt.check_ref_access_part2(key, start_key, records, tmp);
} /* not ft_key */
@@ -7665,7 +7665,7 @@ best_access_path(JOIN *join,
if (tmp + 0.0001 < best_time - records/(double) TIME_FOR_COMPARE)
{
trace_access_idx.add("chosen", true);
- best_time= tmp + records/(double) TIME_FOR_COMPARE;
+ best_time= COST_ADD(tmp, records/(double) TIME_FOR_COMPARE);
best= tmp;
best_records= records;
best_key= start_key;
@@ -7707,14 +7707,18 @@ best_access_path(JOIN *join,
use_cond_selectivity);
tmp= s->quick ? s->quick->read_time : s->scan_time();
- tmp+= (s->records - rnd_records)/(double) TIME_FOR_COMPARE;
+ double cmp_time= (s->records - rnd_records)/(double) TIME_FOR_COMPARE;
+ tmp= COST_ADD(tmp, cmp_time);
/* We read the table as many times as join buffer becomes full. */
- tmp*= (1.0 + floor((double) cache_record_length(join,idx) *
- record_count /
- (double) thd->variables.join_buff_size));
- best_time= tmp +
- (record_count*join_sel) / TIME_FOR_COMPARE * rnd_records;
+
+ double refills= (1.0 + floor((double) cache_record_length(join,idx) *
+ record_count /
+ (double) thd->variables.join_buff_size));
+ tmp= COST_MULT(tmp, refills);
+ best_time= COST_ADD(tmp,
+ COST_MULT((record_count*join_sel) / TIME_FOR_COMPARE,
+ rnd_records));
best= tmp;
records= rnd_records;
best_key= hj_start_key;
@@ -7746,7 +7750,8 @@ best_access_path(JOIN *join,
'range' access using index IDX, and the best way to perform 'ref'
access is to use the same index IDX, with the same or more key parts.
(note: it is not clear how this rule is/should be extended to
- index_merge quick selects)
+ index_merge quick selects). Also if we have a hash join we prefer that
+ over a table scan
(3) See above note about InnoDB.
(4) NOT ("FORCE INDEX(...)" is used for table and there is 'ref' access
path, but there is no quick select)
@@ -7763,6 +7768,7 @@ best_access_path(JOIN *join,
*/
Json_writer_object trace_access_scan(thd);
if ((records >= s->found_records || best > s->read_time) && // (1)
+ !(best_key && best_key->key == MAX_KEY) && // (2)
!(s->quick && best_key && s->quick->index == best_key->key && // (2)
best_max_key_part >= s->table->quick_key_parts[best_key->key]) &&// (2)
!((s->table->file->ha_table_flags() & HA_TABLE_SCAN_ON_INDEX) && // (3)
@@ -7795,9 +7801,9 @@ best_access_path(JOIN *join,
access (see first else-branch below), but we don't take it into
account here for range/index_merge access. Find out why this is so.
*/
- tmp= record_count *
- (s->quick->read_time +
- (s->found_records - rnd_records)/(double) TIME_FOR_COMPARE);
+ double cmp_time= (s->found_records - rnd_records)/(double) TIME_FOR_COMPARE;
+ tmp= COST_MULT(record_count,
+ COST_ADD(s->quick->read_time, cmp_time));
if ( s->quick->get_type() == QUICK_SELECT_I::QS_TYPE_RANGE)
{
@@ -7836,16 +7842,15 @@ best_access_path(JOIN *join,
- read the whole table record
- skip rows which does not satisfy join condition
*/
- tmp= record_count *
- (tmp +
- (s->records - rnd_records)/(double) TIME_FOR_COMPARE);
+ double cmp_time= (s->records - rnd_records)/(double) TIME_FOR_COMPARE;
+ tmp= COST_MULT(record_count, COST_ADD(tmp,cmp_time));
}
else
{
- /* We read the table as many times as join buffer becomes full. */
- tmp*= (1.0 + floor((double) cache_record_length(join,idx) *
- record_count /
- (double) thd->variables.join_buff_size));
+ double refills= (1.0 + floor((double) cache_record_length(join,idx) *
+ (record_count /
+ (double) thd->variables.join_buff_size)));
+ tmp= COST_MULT(tmp, refills);
/*
We don't make full cartesian product between rows in the scanned
table and existing records because we skip all rows from the
@@ -7853,7 +7858,8 @@ best_access_path(JOIN *join,
we read the table (see flush_cached_records for details). Here we
take into account cost to read and skip these records.
*/
- tmp+= (s->records - rnd_records)/(double) TIME_FOR_COMPARE;
+ double cmp_time= (s->records - rnd_records)/(double) TIME_FOR_COMPARE;
+ tmp= COST_ADD(tmp, cmp_time);
}
}
@@ -7869,19 +7875,17 @@ best_access_path(JOIN *join,
tmp give us total cost of using TABLE SCAN
*/
- double best_filter_cmp_gain= 0;
- if (best_filter)
- {
- best_filter_cmp_gain= best_filter->get_cmp_gain(record_count * records);
- }
+ const double best_filter_cmp_gain= best_filter
+ ? best_filter->get_cmp_gain(record_count * records)
+ : 0;
trace_access_scan.add("resulting_rows", rnd_records);
trace_access_scan.add("cost", tmp);
if (best == DBL_MAX ||
- (tmp + record_count/(double) TIME_FOR_COMPARE*rnd_records <
+ COST_ADD(tmp, record_count/(double) TIME_FOR_COMPARE*rnd_records) <
(best_key->is_for_hash_join() ? best_time :
- best + record_count/(double) TIME_FOR_COMPARE*records -
- best_filter_cmp_gain)))
+ COST_ADD(best - best_filter_cmp_gain,
+ record_count/(double) TIME_FOR_COMPARE*records)))
{
/*
If the table has a range (s->quick is set) make_join_select()
@@ -8420,16 +8424,13 @@ optimize_straight_join(JOIN *join, table_map join_tables)
position, &loose_scan_pos);
/* compute the cost of the new plan extended with 's' */
- record_count*= position->records_read;
- double filter_cmp_gain= 0;
- if (position->range_rowid_filter_info)
- {
- filter_cmp_gain=
- position->range_rowid_filter_info->get_cmp_gain(record_count);
- }
- read_time+= position->read_time +
- record_count / (double) TIME_FOR_COMPARE -
- filter_cmp_gain;
+ record_count= COST_MULT(record_count, position->records_read);
+ const double filter_cmp_gain= position->range_rowid_filter_info
+ ? position->range_rowid_filter_info->get_cmp_gain(record_count)
+ : 0;
+ read_time+= COST_ADD(read_time - filter_cmp_gain,
+ COST_ADD(position->read_time,
+ record_count / (double) TIME_FOR_COMPARE));
advance_sj_state(join, join_tables, idx, &record_count, &read_time,
&loose_scan_pos);
@@ -8619,9 +8620,10 @@ greedy_search(JOIN *join,
swap_variables(JOIN_TAB*, join->best_ref[idx], join->best_ref[best_idx]);
/* compute the cost of the new plan extended with 'best_table' */
- record_count*= join->positions[idx].records_read;
- read_time+= join->positions[idx].read_time +
- record_count / (double) TIME_FOR_COMPARE;
+ record_count= COST_MULT(record_count, join->positions[idx].records_read);
+ read_time= COST_ADD(read_time,
+ COST_ADD(join->positions[idx].read_time,
+ record_count / (double) TIME_FOR_COMPARE));
remaining_tables&= ~(best_table->table->map);
--size_remain;
@@ -8728,11 +8730,13 @@ void JOIN::get_partial_cost_and_fanout(int end_tab_idx,
}
if (tab->records_read && (cur_table_map & filter_map))
{
- record_count *= tab->records_read;
- read_time += tab->read_time + record_count / (double) TIME_FOR_COMPARE;
+ record_count= COST_MULT(record_count, tab->records_read);
+ read_time= COST_ADD(read_time,
+ COST_ADD(tab->read_time,
+ record_count / (double) TIME_FOR_COMPARE));
if (tab->emb_sj_nest)
- sj_inner_fanout *= tab->records_read;
- }
+ sj_inner_fanout= COST_MULT(sj_inner_fanout, tab->records_read);
+ }
if (i == last_sj_table)
{
@@ -8770,8 +8774,8 @@ void JOIN::get_prefix_cost_and_fanout(uint n_tables,
{
if (best_positions[i].records_read)
{
- record_count *= best_positions[i].records_read;
- read_time += best_positions[i].read_time;
+ record_count= COST_MULT(record_count, best_positions[i].records_read);
+ read_time= COST_ADD(read_time, best_positions[i].read_time);
}
}
*read_time_arg= read_time;// + record_count / TIME_FOR_COMPARE;
@@ -9351,20 +9355,16 @@ best_extension_by_limited_search(JOIN *join,
best_access_path(join, s, remaining_tables, idx, disable_jbuf,
record_count, position, &loose_scan_pos);
- /* Compute the cost of extending the plan with 's', avoid overflow */
- if (position->records_read < DBL_MAX / record_count)
- current_record_count= record_count * position->records_read;
- else
- current_record_count= DBL_MAX;
- double filter_cmp_gain= 0;
- if (position->range_rowid_filter_info)
- {
- filter_cmp_gain=
- position->range_rowid_filter_info->get_cmp_gain(current_record_count);
- }
- current_read_time=read_time + position->read_time +
- current_record_count / (double) TIME_FOR_COMPARE -
- filter_cmp_gain;
+ /* Compute the cost of extending the plan with 's' */
+ current_record_count= COST_MULT(record_count, position->records_read);
+ const double filter_cmp_gain= position->range_rowid_filter_info
+ ? position->range_rowid_filter_info->get_cmp_gain(current_record_count)
+ : 0;
+ current_read_time=COST_ADD(read_time,
+ COST_ADD(position->read_time -
+ filter_cmp_gain,
+ current_record_count /
+ (double) TIME_FOR_COMPARE));
advance_sj_state(join, remaining_tables, idx, &current_record_count,
&current_read_time, &loose_scan_pos);
@@ -9449,12 +9449,12 @@ best_extension_by_limited_search(JOIN *join,
if (join->sort_by_table &&
join->sort_by_table !=
join->positions[join->const_tables].table->table)
- /*
- We may have to make a temp table, note that this is only a
- heuristic since we cannot know for sure at this point.
+ /*
+ We may have to make a temp table, note that this is only a
+ heuristic since we cannot know for sure at this point.
Hence it may be wrong.
*/
- current_read_time+= current_record_count;
+ current_read_time= COST_ADD(current_read_time, current_record_count);
if (current_read_time < join->best_read)
{
memcpy((uchar*) join->best_positions, (uchar*) join->positions,
@@ -9772,8 +9772,8 @@ prev_record_reads(POSITION *positions, uint idx, table_map found_ref)
#max_nested_outer_joins=64-1) will not make it any more precise.
*/
if (pos->records_read)
- found*= pos->records_read;
- }
+ found= COST_MULT(found, pos->records_read);
+ }
}
return found;
}
@@ -11353,8 +11353,16 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
/*
We plan to scan all rows.
Check again if we should use an index.
- We could have used an column from a previous table in
- the index if we are using limit and this is the first table
+
+ There are two cases:
+ 1) There could be an index usage the refers to a previous
+ table that we didn't consider before, but could be consider
+ now as a "last resort". For example
+ SELECT * from t1,t2 where t1.a between t2.a and t2.b;
+ 2) If the current table is the first non const table
+ and there is a limit it still possibly beneficial
+ to use the index even if the index range is big as
+ we can stop when we've found limit rows.
(1) - Don't switch the used index if we are using semi-join
LooseScan on this table. Using different index will not
@@ -16049,8 +16057,20 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top,
table->table->maybe_null= FALSE;
table->outer_join= 0;
if (!(straight_join || table->straight))
- table->dep_tables= table->embedding && !table->embedding->sj_subq_pred ?
- table->embedding->dep_tables : 0;
+ {
+ table->dep_tables= 0;
+ TABLE_LIST *embedding= table->embedding;
+ while (embedding)
+ {
+ if (embedding->nested_join->join_list.head()->outer_join)
+ {
+ if (!embedding->sj_subq_pred)
+ table->dep_tables= embedding->dep_tables;
+ break;
+ }
+ embedding= embedding->embedding;
+ }
+ }
if (table->on_expr)
{
/* Add ON expression to the WHERE or upper-level ON condition. */
@@ -16575,11 +16595,12 @@ void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab,
pos= loose_scan_pos;
reopt_remaining_tables &= ~rs->table->map;
- rec_count *= pos.records_read;
- cost += pos.read_time;
+ rec_count= COST_MULT(rec_count, pos.records_read);
+ cost= COST_ADD(cost, pos.read_time);
+
if (!rs->emb_sj_nest)
- *outer_rec_count *= pos.records_read;
+ *outer_rec_count= COST_MULT(*outer_rec_count, pos.records_read);
}
join->cur_sj_inner_tables= save_cur_sj_inner_tables;
@@ -21039,7 +21060,6 @@ join_read_first(JOIN_TAB *tab)
tab->table->status=0;
tab->read_record.read_record_func= join_read_next;
tab->read_record.table=table;
- tab->read_record.index=tab->index;
tab->read_record.record=table->record[0];
if (!table->file->inited)
error= table->file->ha_index_init(tab->index, tab->sorted);
@@ -21080,7 +21100,6 @@ join_read_last(JOIN_TAB *tab)
tab->table->status=0;
tab->read_record.read_record_func= join_read_prev;
tab->read_record.table=table;
- tab->read_record.index=tab->index;
tab->read_record.record=table->record[0];
if (!table->file->inited)
error= table->file->ha_index_init(tab->index, 1);
diff --git a/sql/sql_window.h b/sql/sql_window.h
index 21f2c8af108..373b367b211 100644
--- a/sql/sql_window.h
+++ b/sql/sql_window.h
@@ -18,7 +18,6 @@
#define SQL_WINDOW_INCLUDED
#include "filesort.h"
-#include "records.h"
class Item_window_func;
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index 89f40b55f86..eca5dd2a7d5 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2016 MariaDB Corporation
+ Copyright (c) 2016, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -377,6 +377,19 @@ bool THD::open_temporary_table(TABLE_LIST *tl)
if (!table && (share= find_tmp_table_share(tl)))
{
table= open_temporary_table(share, tl->get_table_name());
+ /*
+ Temporary tables are not safe for parallel replication. They were
+ designed to be visible to one thread only, so have no table locking.
+ Thus there is no protection against two conflicting transactions
+ committing in parallel and things like that.
+
+ So for now, anything that uses temporary tables will be serialised
+ with anything before it, when using parallel replication.
+ */
+ if (table && rgi_slave &&
+ rgi_slave->is_parallel_exec &&
+ wait_for_prior_commit())
+ DBUG_RETURN(true);
}
if (!table)
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 02a3844cb43..bfd3ffce69b 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -4411,6 +4411,11 @@ loop:
return (NULL);
}
+ if (local_err == DB_PAGE_CORRUPTED
+ && srv_force_recovery) {
+ return NULL;
+ }
+
/* Try to set table as corrupted instead of
asserting. */
if (page_id.space() == TRX_SYS_SPACE) {
@@ -5774,10 +5779,27 @@ buf_page_monitor(
}
/** Mark a table corrupted.
+Also remove the bpage from LRU list.
+@param[in] bpage Corrupted page. */
+static void buf_mark_space_corrupt(buf_page_t* bpage, const fil_space_t* space)
+{
+ /* If block is not encrypted find the table with specified
+ space id, and mark it corrupted. Encrypted tables
+ are marked unusable later e.g. in ::open(). */
+ if (!bpage->encrypted) {
+ dict_set_corrupted_by_space(space);
+ } else {
+ dict_set_encrypted_by_space(space);
+ }
+}
+
+/** Mark a table corrupted.
+@param[in] bpage Corrupted page
+@param[in] space Corrupted page belongs to tablespace
Also remove the bpage from LRU list. */
static
void
-buf_mark_space_corrupt(buf_page_t* bpage, const fil_space_t* space)
+buf_corrupt_page_release(buf_page_t* bpage, const fil_space_t* space)
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
const ibool uncompressed = (buf_page_get_state(bpage)
@@ -5801,13 +5823,8 @@ buf_mark_space_corrupt(buf_page_t* bpage, const fil_space_t* space)
mutex_exit(buf_page_get_mutex(bpage));
- /* If block is not encrypted find the table with specified
- space id, and mark it corrupted. Encrypted tables
- are marked unusable later e.g. in ::open(). */
- if (!bpage->encrypted) {
- dict_set_corrupted_by_space(space);
- } else {
- dict_set_encrypted_by_space(space);
+ if (!srv_force_recovery) {
+ buf_mark_space_corrupt(bpage, space);
}
/* After this point bpage can't be referenced. */
@@ -5869,7 +5886,7 @@ static dberr_t buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space)
not decrypted and it could be either encrypted and corrupted
or corrupted or good page. If we decrypted, there page could
still be corrupted if used key does not match. */
- const bool still_encrypted = key_version
+ const bool still_encrypted = (!space->full_crc32() && key_version)
&& space->crypt_data
&& space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED
&& !bpage->encrypted
@@ -6039,7 +6056,7 @@ database_corrupted:
"buf_page_import_corrupt_failure",
if (!is_predefined_tablespace(
bpage->id.space())) {
- buf_mark_space_corrupt(bpage, space);
+ buf_corrupt_page_release(bpage, space);
ib::info() << "Simulated IMPORT "
"corruption";
space->release_for_io();
@@ -6073,7 +6090,7 @@ database_corrupted:
<< FORCE_RECOVERY_MSG;
}
- if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
+ if (!srv_force_recovery) {
/* If page space id is larger than TRX_SYS_SPACE
(0), we will attempt to mark the corresponding
@@ -6083,7 +6100,7 @@ database_corrupted:
" a corrupt database page.";
}
- buf_mark_space_corrupt(bpage, space);
+ buf_corrupt_page_release(bpage, space);
space->release_for_io();
return(err);
}
@@ -6092,6 +6109,18 @@ database_corrupted:
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure",
page_not_corrupt: bpage = bpage; );
+ if (err == DB_PAGE_CORRUPTED
+ || err == DB_DECRYPTION_FAILED) {
+ buf_corrupt_page_release(bpage, space);
+
+ if (recv_recovery_is_on()) {
+ recv_recover_corrupt_page(bpage);
+ }
+
+ space->release_for_io();
+ return err;
+ }
+
if (recv_recovery_is_on()) {
recv_recover_page(bpage);
}
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc
index 0e2343cff6f..9994e032d88 100644
--- a/storage/innobase/buf/buf0lru.cc
+++ b/storage/innobase/buf/buf0lru.cc
@@ -2176,8 +2176,8 @@ buf_LRU_old_ratio_update_instance(
buf_pool_t* buf_pool,/*!< in: buffer pool instance */
uint old_pct,/*!< in: Reserve this percentage of
the buffer pool for "old" blocks. */
- ibool adjust) /*!< in: TRUE=adjust the LRU list;
- FALSE=just assign buf_pool->LRU_old_ratio
+ bool adjust) /*!< in: true=adjust the LRU list;
+ false=just assign buf_pool->LRU_old_ratio
during the initialization of InnoDB */
{
uint ratio;
@@ -2219,8 +2219,8 @@ buf_LRU_old_ratio_update(
/*=====================*/
uint old_pct,/*!< in: Reserve this percentage of
the buffer pool for "old" blocks. */
- ibool adjust) /*!< in: TRUE=adjust the LRU list;
- FALSE=just assign buf_pool->LRU_old_ratio
+ bool adjust) /*!< in: true=adjust the LRU list;
+ false=just assign buf_pool->LRU_old_ratio
during the initialization of InnoDB */
{
uint new_ratio = 0;
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 3edf7b9d3dd..44cc9daa508 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1162,14 +1162,10 @@ fil_crypt_read_crypt_data(fil_space_t* space)
mtr.commit();
}
-/***********************************************************************
-Start encrypting a space
+/** Start encrypting a space
@param[in,out] space Tablespace
-@return true if a recheck is needed */
-static
-bool
-fil_crypt_start_encrypting_space(
- fil_space_t* space)
+@return true if a recheck of tablespace is needed by encryption thread. */
+static bool fil_crypt_start_encrypting_space(fil_space_t* space)
{
bool recheck = false;
@@ -1627,14 +1623,12 @@ fil_crypt_return_iops(
fil_crypt_update_total_stat(state);
}
-/***********************************************************************
-Search for a space needing rotation
-@param[in,out] key_state Key state
-@param[in,out] state Rotation state
-@param[in,out] recheck recheck ? */
-static
-bool
-fil_crypt_find_space_to_rotate(
+/** Search for a space needing rotation
+@param[in,out] key_state Key state
+@param[in,out] state Rotation state
+@param[in,out] recheck recheck of the tablespace is needed or
+ still encryption thread does write page 0 */
+static bool fil_crypt_find_space_to_rotate(
key_state_t* key_state,
rotate_thread_t* state,
bool* recheck)
@@ -1664,11 +1658,10 @@ fil_crypt_find_space_to_rotate(
/* If key rotation is enabled (default) we iterate all tablespaces.
If key rotation is not enabled we iterate only the tablespaces
added to keyrotation list. */
- if (srv_fil_crypt_rotate_key_age) {
- state->space = fil_space_next(state->space);
- } else {
- state->space = fil_space_keyrotate_next(state->space);
- }
+ state->space = srv_fil_crypt_rotate_key_age
+ ? fil_space_next(state->space)
+ : fil_system.keyrotate_next(state->space, *recheck,
+ key_state->key_version);
while (!state->should_shutdown() && state->space) {
/* If there is no crypt data and we have not yet read
@@ -1686,11 +1679,10 @@ fil_crypt_find_space_to_rotate(
return true;
}
- if (srv_fil_crypt_rotate_key_age) {
- state->space = fil_space_next(state->space);
- } else {
- state->space = fil_space_keyrotate_next(state->space);
- }
+ state->space = srv_fil_crypt_rotate_key_age
+ ? fil_space_next(state->space)
+ : fil_system.keyrotate_next(state->space, *recheck,
+ key_state->key_version);
}
/* if we didn't find any space return iops */
@@ -2315,13 +2307,8 @@ A thread which monitors global key state and rotates tablespaces accordingly
@return a dummy parameter */
extern "C" UNIV_INTERN
os_thread_ret_t
-DECLARE_THREAD(fil_crypt_thread)(
-/*=============================*/
- void* arg __attribute__((unused))) /*!< in: a dummy parameter required
- * by os_thread_create */
+DECLARE_THREAD(fil_crypt_thread)(void*)
{
- UT_NOT_USED(arg);
-
mutex_enter(&fil_crypt_threads_mutex);
uint thread_no = srv_n_fil_crypt_threads_started;
srv_n_fil_crypt_threads_started++;
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 8e8951d0804..be422c7c467 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -5029,25 +5029,29 @@ fil_space_t::acquire() and fil_space_t::release() are invoked here which
blocks a concurrent operation from dropping the tablespace.
@param[in] prev_space Pointer to the previous fil_space_t.
If NULL, use the first fil_space_t on fil_system.space_list.
+@param[in] recheck recheck of the tablespace is needed or
+ still encryption thread does write page0 for it
+@param[in] key_version key version of the key state thread
@return pointer to the next fil_space_t.
-@retval NULL if this was the last*/
+@retval NULL if this was the last */
fil_space_t*
-fil_space_keyrotate_next(
- fil_space_t* prev_space)
+fil_system_t::keyrotate_next(
+ fil_space_t* prev_space,
+ bool recheck,
+ uint key_version)
{
- fil_space_t* space = prev_space;
- fil_space_t* old = NULL;
-
mutex_enter(&fil_system.mutex);
- if (UT_LIST_GET_LEN(fil_system.rotation_list) == 0) {
- if (space) {
- space->release();
- fil_space_remove_from_keyrotation(space);
- }
- mutex_exit(&fil_system.mutex);
- return(NULL);
- }
+ /* If one of the encryption threads already started the encryption
+ of the table then don't remove the unencrypted spaces from
+ rotation list
+
+ If there is a change in innodb_encrypt_tables variables value then
+ don't remove the last processed tablespace from the rotation list. */
+ const bool remove = ((!recheck || prev_space->crypt_data)
+ && (!key_version == !srv_encrypt_tables));
+
+ fil_space_t* space = prev_space;
if (prev_space == NULL) {
space = UT_LIST_GET_FIRST(fil_system.rotation_list);
@@ -5058,22 +5062,17 @@ fil_space_keyrotate_next(
/* Move on to the next fil_space_t */
space->release();
- old = space;
space = UT_LIST_GET_NEXT(rotation_list, space);
- fil_space_remove_from_keyrotation(old);
- }
-
- /* Skip spaces that are being created by fil_ibd_create(),
- or dropped. Note that rotation_list contains only
- space->purpose == FIL_TYPE_TABLESPACE. */
- while (space != NULL
- && (UT_LIST_GET_LEN(space->chain) == 0
- || space->is_stopping())) {
+ while (space != NULL
+ && (UT_LIST_GET_LEN(space->chain) == 0
+ || space->is_stopping())) {
+ space = UT_LIST_GET_NEXT(rotation_list, space);
+ }
- old = space;
- space = UT_LIST_GET_NEXT(rotation_list, space);
- fil_space_remove_from_keyrotation(old);
+ if (remove) {
+ fil_space_remove_from_keyrotation(prev_space);
+ }
}
if (space != NULL) {
@@ -5081,7 +5080,6 @@ fil_space_keyrotate_next(
}
mutex_exit(&fil_system.mutex);
-
return(space);
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index fd9d6208030..1f73e048ff1 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -10891,7 +10891,6 @@ create_table_info_t::create_table_def()
ulint binary_type;
ulint long_true_varchar;
ulint charset_no;
- ulint j = 0;
ulint doc_id_col = 0;
ibool has_doc_id_col = FALSE;
mem_heap_t* heap;
@@ -10973,7 +10972,7 @@ create_table_info_t::create_table_def()
heap = mem_heap_create(1000);
- for (ulint i = 0; i < n_cols; i++) {
+ for (ulint i = 0, j = 0; j < n_cols; i++) {
Field* field = m_form->field[i];
ulint vers_row = 0;
@@ -11094,10 +11093,16 @@ err_col:
dict_mem_table_add_s_col(
table, 0);
}
+
+ if (is_virtual && omit_virtual) {
+ continue;
+ }
+
+ j++;
}
if (num_v) {
- for (ulint i = 0; i < n_cols; i++) {
+ for (ulint i = 0, j = 0; i < n_cols; i++) {
dict_v_col_t* v_col;
const Field* field = m_form->field[i];
@@ -12911,8 +12916,7 @@ inline int ha_innobase::delete_table(const char* name, enum_sql_command sqlcom)
extension, in contrast to ::create */
normalize_table_name(norm_name, name);
- if (srv_read_only_mode
- || srv_force_recovery >= SRV_FORCE_NO_UNDO_LOG_SCAN) {
+ if (high_level_read_only) {
DBUG_RETURN(HA_ERR_TABLE_READONLY);
}
@@ -13101,7 +13105,7 @@ innobase_drop_database(
DBUG_ASSERT(hton == innodb_hton_ptr);
- if (srv_read_only_mode) {
+ if (high_level_read_only) {
return;
}
@@ -17383,11 +17387,13 @@ void
innodb_adaptive_hash_index_update(THD*, st_mysql_sys_var*, void*,
const void* save)
{
+ mysql_mutex_unlock(&LOCK_global_system_variables);
if (*(my_bool*) save) {
btr_search_enable();
} else {
btr_search_disable(true);
}
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
#endif /* BTR_CUR_HASH_ADAPT */
@@ -17401,7 +17407,9 @@ innodb_cmp_per_index_update(THD*, st_mysql_sys_var*, void*, const void* save)
/* Reset the stats whenever we enable the table
INFORMATION_SCHEMA.innodb_cmp_per_index. */
if (!srv_cmp_per_index_enabled && *(my_bool*) save) {
+ mysql_mutex_unlock(&LOCK_global_system_variables);
page_zip_reset_stat_per_index();
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
srv_cmp_per_index_enabled = !!(*(my_bool*) save);
@@ -17414,9 +17422,11 @@ static
void
innodb_old_blocks_pct_update(THD*, st_mysql_sys_var*, void*, const void* save)
{
- innobase_old_blocks_pct = static_cast<uint>(
- buf_LRU_old_ratio_update(
- *static_cast<const uint*>(save), TRUE));
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ uint ratio = buf_LRU_old_ratio_update(*static_cast<const uint*>(save),
+ true);
+ mysql_mutex_lock(&LOCK_global_system_variables);
+ innobase_old_blocks_pct = ratio;
}
/****************************************************************//**
@@ -17427,9 +17437,10 @@ void
innodb_change_buffer_max_size_update(THD*, st_mysql_sys_var*, void*,
const void* save)
{
- srv_change_buffer_max_size =
- (*static_cast<const uint*>(save));
+ srv_change_buffer_max_size = *static_cast<const uint*>(save);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
ibuf_max_size_update(srv_change_buffer_max_size);
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
#ifdef UNIV_DEBUG
@@ -17456,15 +17467,19 @@ innodb_make_page_dirty(THD*, st_mysql_sys_var*, void*, const void* save)
{
mtr_t mtr;
ulong space_id = *static_cast<const ulong*>(save);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
fil_space_t* space = fil_space_acquire_silent(space_id);
if (space == NULL) {
+func_exit_no_space:
+ mysql_mutex_lock(&LOCK_global_system_variables);
return;
}
if (srv_saved_page_number_debug >= space->size) {
+func_exit:
space->release();
- return;
+ goto func_exit_no_space;
}
mtr.start();
@@ -17485,7 +17500,7 @@ innodb_make_page_dirty(THD*, st_mysql_sys_var*, void*, const void* save)
MLOG_2BYTES, &mtr);
}
mtr.commit();
- space->release();
+ goto func_exit;
}
#endif // UNIV_DEBUG
/*************************************************************//**
@@ -18021,8 +18036,11 @@ innodb_buffer_pool_evict_update(THD*, st_mysql_sys_var*, void*,
{
if (const char* op = *static_cast<const char*const*>(save)) {
if (!strcmp(op, "uncompressed")) {
+ mysql_mutex_unlock(&LOCK_global_system_variables);
for (uint tries = 0; tries < 10000; tries++) {
if (innodb_buffer_pool_evict_uncompressed()) {
+ mysql_mutex_lock(
+ &LOCK_global_system_variables);
return;
}
@@ -18296,6 +18314,8 @@ void
checkpoint_now_set(THD*, st_mysql_sys_var*, void*, const void* save)
{
if (*(my_bool*) save) {
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+
while (log_sys.last_checkpoint_lsn
+ SIZE_OF_MLOG_CHECKPOINT
+ (log_sys.append_on_checkpoint != NULL
@@ -18310,6 +18330,8 @@ checkpoint_now_set(THD*, st_mysql_sys_var*, void*, const void* save)
if (err != DB_SUCCESS) {
ib::warn() << "Checkpoint set failed " << err;
}
+
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
}
@@ -18320,7 +18342,9 @@ void
buf_flush_list_now_set(THD*, st_mysql_sys_var*, void*, const void* save)
{
if (*(my_bool*) save) {
+ mysql_mutex_unlock(&LOCK_global_system_variables);
buf_flush_sync_all_buf_pools();
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
}
@@ -18399,7 +18423,9 @@ buffer_pool_dump_now(
check function */
{
if (*(my_bool*) save && !srv_read_only_mode) {
+ mysql_mutex_unlock(&LOCK_global_system_variables);
buf_dump_start();
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
}
@@ -18422,7 +18448,9 @@ buffer_pool_load_now(
check function */
{
if (*(my_bool*) save && !srv_read_only_mode) {
+ mysql_mutex_unlock(&LOCK_global_system_variables);
buf_load_start();
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
}
@@ -18445,7 +18473,9 @@ buffer_pool_load_abort(
check function */
{
if (*(my_bool*) save && !srv_read_only_mode) {
+ mysql_mutex_unlock(&LOCK_global_system_variables);
buf_load_abort();
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
}
@@ -18496,55 +18526,63 @@ innodb_log_write_ahead_size_update(
/** Update innodb_status_output or innodb_status_output_locks,
which control InnoDB "status monitor" output to the error log.
-@param[out] var_ptr current value
+@param[out] var current value
@param[in] save to-be-assigned value */
static
void
-innodb_status_output_update(THD*, st_mysql_sys_var*, void* var_ptr,
- const void* save)
+innodb_status_output_update(THD*,st_mysql_sys_var*,void*var,const void*save)
{
- *static_cast<my_bool*>(var_ptr) = *static_cast<const my_bool*>(save);
+ *static_cast<my_bool*>(var) = *static_cast<const my_bool*>(save);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
/* Wakeup server monitor thread. */
os_event_set(srv_monitor_event);
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
-/******************************************************************
-Update the system variable innodb_encryption_threads */
+/** Update the system variable innodb_encryption_threads.
+@param[in] save to-be-assigned value */
static
void
-innodb_encryption_threads_update(THD*, st_mysql_sys_var*, void*,
- const void* save)
+innodb_encryption_threads_update(THD*,st_mysql_sys_var*,void*,const void*save)
{
+ mysql_mutex_unlock(&LOCK_global_system_variables);
fil_crypt_set_thread_cnt(*static_cast<const uint*>(save));
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
-/******************************************************************
-Update the system variable innodb_encryption_rotate_key_age */
+/** Update the system variable innodb_encryption_rotate_key_age.
+@param[in] save to-be-assigned value */
static
void
innodb_encryption_rotate_key_age_update(THD*, st_mysql_sys_var*, void*,
const void* save)
{
+ mysql_mutex_unlock(&LOCK_global_system_variables);
fil_crypt_set_rotate_key_age(*static_cast<const uint*>(save));
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
-/******************************************************************
-Update the system variable innodb_encryption_rotation_iops */
+/** Update the system variable innodb_encryption_rotation_iops.
+@param[in] save to-be-assigned value */
static
void
innodb_encryption_rotation_iops_update(THD*, st_mysql_sys_var*, void*,
const void* save)
{
+ mysql_mutex_unlock(&LOCK_global_system_variables);
fil_crypt_set_rotation_iops(*static_cast<const uint*>(save));
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
-/******************************************************************
-Update the system variable innodb_encrypt_tables*/
+/** Update the system variable innodb_encrypt_tables.
+@param[in] save to-be-assigned value */
static
void
innodb_encrypt_tables_update(THD*, st_mysql_sys_var*, void*, const void* save)
{
+ mysql_mutex_unlock(&LOCK_global_system_variables);
fil_crypt_set_encrypt_tables(*static_cast<const ulong*>(save));
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
/** Update the innodb_log_checksums parameter.
@@ -19612,13 +19650,16 @@ void
innobase_disallow_writes_update(THD*, st_mysql_sys_var*,
void* var_ptr, const void* save)
{
- *(my_bool*)var_ptr = *(my_bool*)save;
+ const my_bool val = *static_cast<const my_bool*>(save);
+ *static_cast<my_bool*>(var_ptr) = val;
ut_a(srv_allow_writes_event);
- if (*(my_bool*)var_ptr) {
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ if (val) {
os_event_reset(srv_allow_writes_event);
} else {
os_event_set(srv_allow_writes_event);
}
+ mysql_mutex_lock(&LOCK_global_system_variables);
}
static MYSQL_SYSVAR_BOOL(disallow_writes, innobase_disallow_writes,
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index c30414fcf5c..619ee0a403b 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1943,7 +1943,7 @@ ha_innobase::check_if_supported_inplace_alter(
/* Before 10.2.2 information about virtual columns was not stored in
system tables. We need to do a full alter to rebuild proper 10.2.2+
metadata with the information about virtual columns */
- if (table->s->mysql_version < 100202 && table->s->virtual_fields) {
+ if (omits_virtual_cols(*table_share)) {
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index c06a6ef83f9..0e4d09e33d5 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -7185,7 +7185,7 @@ struct st_maria_plugin i_s_innodb_sys_virtual =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
/** SYS_FIELDS ***************************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_FIELDS */
diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h
index f8a3b6ce097..20f4730f48f 100644
--- a/storage/innobase/include/btr0pcur.h
+++ b/storage/innobase/include/btr0pcur.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -333,14 +333,6 @@ btr_pcur_move_to_prev(
function may release the page latch */
mtr_t* mtr); /*!< in: mtr */
/*********************************************************//**
-Moves the persistent cursor to the last record on the same page. */
-UNIV_INLINE
-void
-btr_pcur_move_to_last_on_page(
-/*==========================*/
- btr_pcur_t* cursor, /*!< in: persistent cursor */
- mtr_t* mtr); /*!< in: mtr */
-/*********************************************************//**
Moves the persistent cursor to the next user record in the tree. If no user
records are left, the cursor ends up 'after last in tree'.
@return TRUE if the cursor moved forward, ending on a user record */
diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic
index 053c4db692c..4c3c3359262 100644
--- a/storage/innobase/include/btr0pcur.ic
+++ b/storage/innobase/include/btr0pcur.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2018, MariaDB Corporation.
+Copyright (c) 2015, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -263,24 +263,6 @@ btr_pcur_move_to_prev_on_page(
}
/*********************************************************//**
-Moves the persistent cursor to the last record on the same page. */
-UNIV_INLINE
-void
-btr_pcur_move_to_last_on_page(
-/*==========================*/
- btr_pcur_t* cursor, /*!< in: persistent cursor */
- mtr_t* mtr) /*!< in: mtr */
-{
- UT_NOT_USED(mtr);
- ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
-
- page_cur_set_after_last(btr_pcur_get_block(cursor),
- btr_pcur_get_page_cur(cursor));
-
- cursor->old_stored = false;
-}
-
-/*********************************************************//**
Moves the persistent cursor to the next user record in the tree. If no user
records are left, the cursor ends up 'after last in tree'.
@return TRUE if the cursor moved forward, ending on a user record */
diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h
index 829b9831202..6583629be8c 100644
--- a/storage/innobase/include/buf0lru.h
+++ b/storage/innobase/include/buf0lru.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -192,8 +192,8 @@ buf_LRU_old_ratio_update(
/*=====================*/
uint old_pct,/*!< in: Reserve this percentage of
the buffer pool for "old" blocks. */
- ibool adjust);/*!< in: TRUE=adjust the LRU list;
- FALSE=just assign buf_pool->LRU_old_ratio
+ bool adjust);/*!< in: true=adjust the LRU list;
+ false=just assign buf_pool->LRU_old_ratio
during the initialization of InnoDB */
/********************************************************************//**
Update the historical stats that we are collecting for LRU eviction
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 6f4b9ab491e..04c7f4f18d1 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -965,6 +965,25 @@ public:
@return tablespace
@retval NULL if the tablespace does not exist or cannot be read */
fil_space_t* read_page0(ulint id);
+
+ /** Return the next fil_space_t from key rotation list.
+ Once started, the caller must keep calling this until it returns NULL.
+ fil_space_acquire() and fil_space_release() are invoked here which
+ blocks a concurrent operation from dropping the tablespace.
+ @param[in] prev_space Previous tablespace or NULL to start
+ from beginning of fil_system->rotation
+ list
+ @param[in] recheck recheck of the tablespace is needed or
+ still encryption thread does write page0
+ for it
+ @param[in] key_version key version of the key state thread
+ If NULL, use the first fil_space_t on fil_system->space_list.
+ @return pointer to the next fil_space_t.
+ @retval NULL if this was the last */
+ fil_space_t* keyrotate_next(
+ fil_space_t* prev_space,
+ bool remove,
+ uint key_version);
};
/** The tablespace memory cache. */
@@ -1149,11 +1168,12 @@ fil_space_acquire() and fil_space_t::release() are invoked here which
blocks a concurrent operation from dropping the tablespace.
@param[in,out] prev_space Pointer to the previous fil_space_t.
If NULL, use the first fil_space_t on fil_system.space_list.
+@param[in] remove Whether to remove the previous tablespace from
+ the rotation list
@return pointer to the next fil_space_t.
@retval NULL if this was the last*/
fil_space_t*
-fil_space_keyrotate_next(
- fil_space_t* prev_space)
+fil_space_keyrotate_next(fil_space_t* prev_space, bool remove)
MY_ATTRIBUTE((warn_unused_result));
/********************************************************//**
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index 97063588a4a..cfa0443f301 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -48,6 +48,11 @@ dberr_t
recv_find_max_checkpoint(ulint* max_field)
MY_ATTRIBUTE((nonnull, warn_unused_result));
+/** Reduces recv_sys.n_addrs for the corrupted page.
+This function should called when srv_force_recovery > 0.
+@param[in] bpage buffer pool page */
+void recv_recover_corrupt_page(buf_page_t* bpage);
+
/** Apply any buffered redo log to a page that was just read from a data file.
@param[in,out] bpage buffer pool page */
ATTRIBUTE_COLD void recv_recover_page(buf_page_t* bpage);
diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h
index 7a7d5834e0a..85856660494 100644
--- a/storage/innobase/include/ut0dbg.h
+++ b/storage/innobase/include/ut0dbg.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -68,10 +68,6 @@ ut_dbg_assertion_failed(
#define ut_d(EXPR)
#endif
-/** Silence warnings about an unused variable by doing a null assignment.
-@param A the unused variable */
-#define UT_NOT_USED(A) A = A
-
#if defined(HAVE_SYS_TIME_H) && defined(HAVE_SYS_RESOURCE_H)
#define HAVE_UT_CHRONO_T
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 2315075cf77..f0b62eb8de5 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -2100,6 +2100,32 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
}
}
+/** Reduces recv_sys.n_addrs for the corrupted page.
+This function should called when srv_force_recovery > 0.
+@param[in] bpage buffer pool page */
+void recv_recover_corrupt_page(buf_page_t* bpage)
+{
+ ut_ad(srv_force_recovery);
+ mutex_enter(&recv_sys.mutex);
+
+ if (!recv_sys.apply_log_recs) {
+ mutex_exit(&recv_sys.mutex);
+ return;
+ }
+
+ recv_addr_t* recv_addr = recv_get_fil_addr_struct(
+ bpage->id.space(), bpage->id.page_no());
+
+ ut_ad(recv_addr->state != RECV_WILL_NOT_READ);
+
+ if (recv_addr->state != RECV_BEING_PROCESSED
+ && recv_addr->state != RECV_PROCESSED) {
+ recv_sys.n_addrs--;
+ }
+
+ mutex_exit(&recv_sys.mutex);
+}
+
/** Apply any buffered redo log to a page that was just read from a data file.
@param[in,out] bpage buffer pool page */
void recv_recover_page(buf_page_t* bpage)
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index e2e3662f6f1..d1568764c18 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -27,7 +27,6 @@ Completed by Sunny Bains and Marko Makela
#include <my_global.h>
#include <log.h>
#include <sql_class.h>
-
#include <math.h>
#include "row0merge.h"
@@ -50,12 +49,6 @@ Completed by Sunny Bains and Marko Makela
#include "ut0stage.h"
#include "fil0crypt.h"
-float my_log2f(float n)
-{
- /* log(n) / log(2) is log2. */
- return (float)(log((double)n) / log((double)2));
-}
-
/* Ignore posix_fadvise() on those platforms where it does not exist */
#if defined _WIN32
# define posix_fadvise(fd, offset, len, advice) /* nothing */
@@ -3344,18 +3337,13 @@ row_merge_sort(
stage->begin_phase_sort(log2(num_runs));
}
- /* Find the number N which 2^N is greater or equal than num_runs */
- /* N is merge sort running count */
- total_merge_sort_count = (ulint) ceil(my_log2f((float)num_runs));
- if(total_merge_sort_count <= 0) {
- total_merge_sort_count=1;
- }
-
/* If num_runs are less than 1, nothing to merge */
if (num_runs <= 1) {
DBUG_RETURN(error);
}
+ total_merge_sort_count = ulint(ceil(log2(double(num_runs))));
+
/* "run_offset" records each run's first offset number */
run_offset = (ulint*) ut_malloc_nokey(file->offset * sizeof(ulint));
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 3bad5f5b218..659a824a0d5 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -4775,8 +4775,9 @@ wrong_offs:
<< " of table " << index->table->name
<< ". We try to skip the rest of the page.";
- btr_pcur_move_to_last_on_page(pcur, &mtr);
-
+ page_cur_set_after_last(btr_pcur_get_block(pcur),
+ btr_pcur_get_page_cur(pcur));
+ pcur->old_stored = false;
goto next_rec;
}
}
@@ -5546,36 +5547,47 @@ next_rec:
}
if (moves_up) {
- bool move;
-
- if (spatial_search) {
- move = rtr_pcur_move_to_next(
- search_tuple, mode, pcur, 0, &mtr);
- } else {
- move = btr_pcur_move_to_next(pcur, &mtr);
- }
-
- if (!move) {
-not_moved:
- if (!spatial_search) {
- btr_pcur_store_position(pcur, &mtr);
+ if (UNIV_UNLIKELY(spatial_search)) {
+ if (rtr_pcur_move_to_next(
+ search_tuple, mode, pcur, 0, &mtr)) {
+ goto rec_loop;
}
-
- if (match_mode != 0) {
- err = DB_RECORD_NOT_FOUND;
+ } else {
+ const buf_block_t* block = btr_pcur_get_block(pcur);
+ /* This is based on btr_pcur_move_to_next(),
+ but avoids infinite read loop of a corrupted page. */
+ ut_ad(pcur->pos_state == BTR_PCUR_IS_POSITIONED);
+ ut_ad(pcur->latch_mode != BTR_NO_LATCHES);
+ pcur->old_stored = false;
+ if (btr_pcur_is_after_last_on_page(pcur)) {
+ if (btr_pcur_is_after_last_in_tree(pcur)) {
+ goto not_moved;
+ }
+ btr_pcur_move_to_next_page(pcur, &mtr);
+ if (UNIV_UNLIKELY(btr_pcur_get_block(pcur)
+ == block)) {
+ err = DB_CORRUPTION;
+ goto lock_wait_or_error;
+ }
} else {
- err = DB_END_OF_INDEX;
+ btr_pcur_move_to_next_on_page(pcur);
}
- goto normal_return;
+ goto rec_loop;
}
} else {
- if (UNIV_UNLIKELY(!btr_pcur_move_to_prev(pcur, &mtr))) {
- goto not_moved;
+ if (btr_pcur_move_to_prev(pcur, &mtr)) {
+ goto rec_loop;
}
}
- goto rec_loop;
+not_moved:
+ if (!spatial_search) {
+ btr_pcur_store_position(pcur, &mtr);
+ }
+
+ err = match_mode ? DB_RECORD_NOT_FOUND : DB_END_OF_INDEX;
+ goto normal_return;
lock_wait_or_error:
/* Reset the old and new "did semi-consistent read" flags. */
diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake
index aeb51188ffc..3d17f27a3e6 100644
--- a/storage/rocksdb/build_rocksdb.cmake
+++ b/storage/rocksdb/build_rocksdb.cmake
@@ -112,6 +112,24 @@ if(NOT WIN32)
add_definitions(-DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX)
endif()
+include(CheckCCompilerFlag)
+# ppc64 or ppc64le
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
+ CHECK_C_COMPILER_FLAG("-maltivec" HAS_ALTIVEC)
+ if(HAS_ALTIVEC)
+ message(STATUS " HAS_ALTIVEC yes")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maltivec")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec")
+ endif(HAS_ALTIVEC)
+ if(NOT CMAKE_C_FLAGS MATCHES "m(cpu|tune)")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=power8")
+ endif()
+ if(NOT CMAKE_CXX_FLAGS MATCHES "m(cpu|tune)")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=power8")
+ endif()
+ ADD_DEFINITIONS(-DHAVE_POWER8 -DHAS_ALTIVEC)
+endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
+
option(WITH_FALLOCATE "build with fallocate" ON)
if(WITH_FALLOCATE AND UNIX)
@@ -377,6 +395,13 @@ else()
port/port_posix.cc
env/env_posix.cc
env/io_posix.cc)
+ # ppc64 or ppc64le
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
+ enable_language(ASM)
+ list(APPEND ROCKSDB_SOURCES
+ util/crc32c_ppc.c
+ util/crc32c_ppc_asm.S)
+ endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
endif()
SET(SOURCES)
FOREACH(s ${ROCKSDB_SOURCES})