summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml20
-rw-r--r--.gitmodules6
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/install_macros.cmake2
-rw-r--r--debian/additions/innotop/innotop2
-rwxr-xr-xdebian/additions/mariadb-report4
-rw-r--r--debian/mariadb-server-10.8.mariadb.init8
-rw-r--r--debian/mariadb-server-10.8.postinst2
-rw-r--r--debian/salsa-ci.yml2
-rw-r--r--debian/tests/smoke12
-rw-r--r--extra/mariabackup/backup_copy.cc2
-rw-r--r--extra/mariabackup/backup_mysql.cc8
-rw-r--r--extra/mariabackup/fil_cur.cc25
-rw-r--r--extra/mariabackup/fil_cur.h1
-rw-r--r--extra/mariabackup/xtrabackup.cc113
-rw-r--r--include/CMakeLists.txt3
-rw-r--r--include/heap.h6
-rw-r--r--include/json_lib.h2
-rw-r--r--include/m_ctype.h8
-rw-r--r--include/ma_dyncol.h2
-rw-r--r--include/my_base.h12
-rw-r--r--include/my_compare.h2
-rw-r--r--include/my_decimal_limits.h2
-rw-r--r--include/my_dir.h2
-rw-r--r--include/my_global.h4
-rw-r--r--include/my_rdtsc.h2
-rw-r--r--include/my_sys.h6
-rw-r--r--include/myisam.h4
-rw-r--r--include/myisammrg.h4
-rw-r--r--include/mysql.h2
-rw-r--r--include/mysql/plugin_ftparser.h2
-rw-r--r--include/mysql/psi/mysql_thread.h2
-rw-r--r--include/mysql/psi/psi.h2
-rw-r--r--include/mysql/service_base64.h2
-rw-r--r--include/mysql/service_my_snprintf.h2
-rw-r--r--include/mysql/service_sql.h2
-rw-r--r--include/mysql/service_thd_timezone.h2
-rw-r--r--include/queues.h2
-rw-r--r--include/waiting_threads.h2
-rw-r--r--mysql-test/include/have_gzip.inc6
-rw-r--r--mysql-test/include/maybe_versioning.combinations7
-rw-r--r--mysql-test/include/maybe_versioning.inc47
-rw-r--r--mysql-test/include/start_mysqld.inc19
-rw-r--r--mysql-test/lib/My/CoreDump.pm4
-rw-r--r--mysql-test/main/cte_recursive.result5
-rw-r--r--mysql-test/main/cte_recursive.test5
-rw-r--r--mysql-test/main/func_group.result14
-rw-r--r--mysql-test/main/func_group.test11
-rw-r--r--mysql-test/main/gis.test3
-rw-r--r--mysql-test/main/group_min_max.result20
-rw-r--r--mysql-test/main/group_min_max.test17
-rw-r--r--mysql-test/main/information_schema.result5
-rw-r--r--mysql-test/main/information_schema.test5
-rw-r--r--mysql-test/main/join_cache.result24
-rw-r--r--mysql-test/main/log_slow.result22
-rw-r--r--mysql-test/main/log_slow.test21
-rw-r--r--mysql-test/main/mysqldump.result1
-rw-r--r--mysql-test/main/mysqldump.test2
-rw-r--r--mysql-test/main/opt_trace.result8
-rw-r--r--mysql-test/main/parser.result11
-rw-r--r--mysql-test/main/parser.test8
-rw-r--r--mysql-test/main/range_aria_dbt3.result13
-rw-r--r--mysql-test/main/range_aria_dbt3.test24
-rw-r--r--mysql-test/main/rowid_filter.result68
-rw-r--r--mysql-test/main/rowid_filter_innodb.result37
-rw-r--r--mysql-test/main/rowid_filter_innodb_debug.result26
-rw-r--r--mysql-test/main/rowid_filter_innodb_debug.test44
-rw-r--r--mysql-test/main/select.result8
-rw-r--r--mysql-test/main/select_jcl6.result8
-rw-r--r--mysql-test/main/select_pkeycache.result8
-rw-r--r--mysql-test/main/selectivity.result2
-rw-r--r--mysql-test/main/selectivity_innodb.result2
-rw-r--r--mysql-test/main/sp-security.result20
-rw-r--r--mysql-test/main/sp-security.test23
-rw-r--r--mysql-test/main/stat_tables.result2
-rw-r--r--mysql-test/main/subselect2.result2
-rw-r--r--mysql-test/main/view.result5
-rw-r--r--mysql-test/main/view.test5
-rwxr-xr-xmysql-test/mariadb-test-run.pl13
-rw-r--r--mysql-test/suite/funcs_2/r/innodb_charset.result1
-rw-r--r--mysql-test/suite/funcs_2/t/innodb_charset.test4
-rw-r--r--mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_innodb.result2
-rw-r--r--mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_myisam.result2
-rw-r--r--mysql-test/suite/innodb/r/cursor-restore-locking.result1
-rw-r--r--mysql-test/suite/innodb/r/information_schema_grants.result1
-rw-r--r--mysql-test/suite/innodb/r/insert-before-delete.result35
-rw-r--r--mysql-test/suite/innodb/r/insert_into_empty.result17
-rw-r--r--mysql-test/suite/innodb/r/monitor.result2
-rw-r--r--mysql-test/suite/innodb/t/cursor-restore-locking.test4
-rw-r--r--mysql-test/suite/innodb/t/information_schema_grants.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-mdev7046.test2
-rw-r--r--mysql-test/suite/innodb/t/insert-before-delete.test72
-rw-r--r--mysql-test/suite/innodb/t/insert_into_empty.test20
-rw-r--r--mysql-test/suite/innodb/t/monitor.test3
-rw-r--r--mysql-test/suite/innodb_fts/r/basic.result6
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result761
-rw-r--r--mysql-test/suite/innodb_fts/r/misc_debug.result2
-rw-r--r--mysql-test/suite/innodb_fts/r/stopword,vers.rdiff192
-rw-r--r--mysql-test/suite/innodb_fts/r/stopword.result12
-rw-r--r--mysql-test/suite/innodb_fts/r/versioning,prepare.result695
-rw-r--r--mysql-test/suite/innodb_fts/r/versioning.result304
-rw-r--r--mysql-test/suite/innodb_fts/t/basic.inc264
-rw-r--r--mysql-test/suite/innodb_fts/t/basic.test251
-rw-r--r--mysql-test/suite/innodb_fts/t/crash_recovery.test34
-rw-r--r--mysql-test/suite/innodb_fts/t/create.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/fulltext2.test11
-rw-r--r--mysql-test/suite/innodb_fts/t/fulltext3.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/fulltext_cache.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/fulltext_distinct.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/fulltext_left_join.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/fulltext_multi.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/fulltext_order_by.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/fulltext_update.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/fulltext_var.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test15
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb-fts-fic.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb-fts-stopword.opt1
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb-fts-stopword.test664
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb_fts_multiple_index.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb_fts_result_cache_limit.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb_fts_transaction.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/misc_debug.test10
-rw-r--r--mysql-test/suite/innodb_fts/t/stopword.inc55
-rw-r--r--mysql-test/suite/innodb_fts/t/stopword.test114
-rw-r--r--mysql-test/suite/innodb_fts/t/sync.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/sync_ddl.test17
-rw-r--r--mysql-test/suite/mariabackup/incremental_backup.test2
-rw-r--r--mysql-test/suite/parts/t/partition_repair_myisam.test2
-rw-r--r--mysql-test/suite/perfschema/t/statement_program_concurrency.test4
-rw-r--r--mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result2
-rw-r--r--mysql-test/suite/versioning/r/alter.result5
-rw-r--r--mysql-test/suite/versioning/r/debug.result4
-rw-r--r--mysql-test/suite/versioning/r/delete.result1
-rw-r--r--mysql-test/suite/versioning/r/delete_history.result23
-rw-r--r--mysql-test/suite/versioning/r/foreign.result37
-rw-r--r--mysql-test/suite/versioning/t/alter.test2
-rw-r--r--mysql-test/suite/versioning/t/delete_history.test28
-rw-r--r--mysql-test/suite/versioning/t/foreign.test33
-rw-r--r--mysql-test/suite/wsrep/common.pm8
-rw-r--r--mysys/array.c1
-rw-r--r--mysys/hash.c3
-rw-r--r--mysys/my_alloc.c2
-rw-r--r--mysys/my_malloc.c4
-rw-r--r--plugin/test_sql_service/test_sql_service.c1
-rw-r--r--scripts/galera_recovery.sh2
-rwxr-xr-xscripts/mariadb-service-convert2
-rw-r--r--scripts/mysql_install_db.sh4
-rw-r--r--sql/CMakeLists.txt2
-rw-r--r--sql/handler.cc39
-rw-r--r--sql/handler.h11
-rw-r--r--sql/item.h2
-rw-r--r--sql/item_sum.cc14
-rw-r--r--sql/item_sum.h7
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/mysqld.h1
-rw-r--r--sql/opt_range.cc8
-rw-r--r--sql/opt_sum.cc2
-rw-r--r--sql/sql_acl.cc25
-rw-r--r--sql/sql_connect.cc2
-rw-r--r--sql/sql_parse.cc7
-rw-r--r--sql/sql_select.cc90
-rw-r--r--sql/sql_show.cc4
-rw-r--r--sql/sql_table.cc1
-rw-r--r--sql/sql_yacc.yy10
-rw-r--r--sql/sys_vars.cc2
-rw-r--r--sql/table.h11
-rw-r--r--sql/unireg.h2
-rw-r--r--storage/connect/value.cpp8
-rw-r--r--storage/innobase/dict/dict0mem.cc14
-rw-r--r--storage/innobase/fts/fts0fts.cc134
-rw-r--r--storage/innobase/handler/ha_innodb.cc53
-rw-r--r--storage/innobase/handler/handler0alter.cc40
-rw-r--r--storage/innobase/include/dict0mem.h5
-rw-r--r--storage/innobase/include/fts0fts.h17
-rw-r--r--storage/innobase/include/log0recv.h5
-rw-r--r--storage/innobase/include/row0ins.h1
-rw-r--r--storage/innobase/include/row0upd.h16
-rw-r--r--storage/innobase/include/srv0srv.h6
-rw-r--r--storage/innobase/log/log0recv.cc4
-rw-r--r--storage/innobase/row/row0ins.cc108
-rw-r--r--storage/innobase/row/row0merge.cc38
-rw-r--r--storage/innobase/row/row0mysql.cc11
-rw-r--r--storage/innobase/row/row0row.cc4
-rw-r--r--storage/innobase/row/row0sel.cc11
-rw-r--r--storage/innobase/row/row0upd.cc13
-rw-r--r--storage/innobase/srv/srv0start.cc12
-rw-r--r--storage/maria/ma_locking.c2
-rw-r--r--storage/maria/ma_loghandler.c2
-rw-r--r--storage/myisam/mi_locking.c2
-rw-r--r--storage/rocksdb/ha_rocksdb.cc2
-rw-r--r--storage/spider/ha_spider.cc13
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29562.result47
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_29653.result33
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29562.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29562.test54
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29653.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_29653.test37
201 files changed, 3246 insertions, 2325 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2937a75d636..2639fc579d7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -71,7 +71,7 @@ variables:
echo "$package"
rpm -qlpv "$package" | awk '{print $1 " " $3 "/" $4 " ." $9 " " $10 " " $11}' | sort -k 3
echo "------------------------------------------------"
- done >> ../rpmlist-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log
+ done >> "../rpmlist-$CI_JOB_NAME-$CI_COMMIT_REF_SLUG.log"
# CPackRPM lists contents in build log, so no need to show the output of this,
# just store it as a build artifact that can be downloaded and diffed against
# other builds to detect which files where added/removed/moved
@@ -182,7 +182,7 @@ fedora-sanitizer:
GIT_SUBMODULE_STRATEGY: normal
script:
- yum install -y yum-utils rpm-build openssl-devel clang
- - yum install -y /usr/lib64/libasan.so.6.0.0 /usr/lib64/libtsan.so.0.0.0 /usr/lib64/libubsan.so.1.0.0
+ - yum install -y libasan libtsan libubsan
# This repository does not have any .spec files, so install dependencies based on Fedora spec file
- yum-builddep -y mariadb-server
- mkdir builddir; cd builddir
@@ -305,6 +305,8 @@ mysql-test-run:
stage: test
dependencies:
- fedora
+ needs:
+ - fedora
<<: *mysql-test-run-def
artifacts:
when: always # Also show results when tests fail
@@ -326,6 +328,8 @@ mysql-test-run-asan:
RESTART_POLICY: "--force-restart"
dependencies:
- "fedora-sanitizer: [-DWITH_ASAN=YES]"
+ needs:
+ - "fedora-sanitizer: [-DWITH_ASAN=YES]"
<<: *mysql-test-run-def
artifacts:
when: always # Also show results when tests fail
@@ -339,6 +343,8 @@ mysql-test-run-tsan:
RESTART_POLICY: "--force-restart"
dependencies:
- "fedora-sanitizer: [-DWITH_TSAN=YES]"
+ needs:
+ - "fedora-sanitizer: [-DWITH_TSAN=YES]"
<<: *mysql-test-run-def
allow_failure: true
artifacts:
@@ -353,6 +359,8 @@ mysql-test-run-ubsan:
RESTART_POLICY: "--force-restart"
dependencies:
- "fedora-sanitizer: [-DWITH_UBSAN=YES]"
+ needs:
+ - "fedora-sanitizer: [-DWITH_UBSAN=YES]"
<<: *mysql-test-run-def
allow_failure: true
artifacts:
@@ -367,6 +375,8 @@ mysql-test-run-msan:
RESTART_POLICY: "--force-restart"
dependencies:
- "fedora-sanitizer: [-DWITH_MSAN=YES]"
+ needs:
+ - "fedora-sanitizer: [-DWITH_MSAN=YES]"
<<: *mysql-test-run-def
allow_failure: true
artifacts:
@@ -379,6 +389,8 @@ rpmlint:
stage: test
dependencies:
- fedora
+ needs:
+ - fedora
script:
- yum install -y rpmlint
- rm -f rpm/*debuginfo* # Not relevant in this test
@@ -396,6 +408,8 @@ fedora install:
stage: test
dependencies:
- fedora
+ needs:
+ - fedora
script:
- rm -f rpm/*debuginfo* # Not relevant in this test
# Nothing provides galera-4 on Fedora, so this step fails if built with wsrep
@@ -429,6 +443,8 @@ fedora upgrade:
stage: test
dependencies:
- fedora
+ needs:
+ - fedora
script:
- dnf install -y mariadb-server
# Fedora does not support running services in Docker (like Debian packages do) so start it manually
diff --git a/.gitmodules b/.gitmodules
index 18bcb465fa2..3847bf6bff3 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,19 +1,25 @@
[submodule "libmariadb"]
path = libmariadb
url = https://github.com/MariaDB/mariadb-connector-c.git
+ ignore = all
[submodule "storage/rocksdb/rocksdb"]
path = storage/rocksdb/rocksdb
url = https://github.com/facebook/rocksdb.git
+ ignore = all
[submodule "wsrep-lib"]
path = wsrep-lib
url = https://github.com/codership/wsrep-lib.git
branch = master
+ ignore = all
[submodule "extra/wolfssl/wolfssl"]
path = extra/wolfssl/wolfssl
url = https://github.com/wolfSSL/wolfssl.git
+ ignore = all
[submodule "storage/maria/libmarias3"]
path = storage/maria/libmarias3
url = https://github.com/mariadb-corporation/libmarias3.git
+ ignore = all
[submodule "storage/columnstore/columnstore"]
path = storage/columnstore/columnstore
url = https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
+ ignore = all
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77034d38118..ce77fdc5f1f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -236,7 +236,7 @@ IF (WITH_MSAN)
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO)
ENDIF()
-OPTION(WITH_GPROF "Enable profilingg with gprof" OFF)
+OPTION(WITH_GPROF "Enable profiling with gprof" OFF)
IF (WITH_GPROF)
MY_CHECK_AND_SET_COMPILER_FLAG("-pg -g -no-pie -fPIC")
ENDIF()
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake
index 7814f1dbeac..fba0bd03dac 100644
--- a/cmake/install_macros.cmake
+++ b/cmake/install_macros.cmake
@@ -266,7 +266,7 @@ SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug
FUNCTION(INSTALL_MYSQL_TEST from to)
IF(INSTALL_MYSQLTESTDIR)
IF(NOT WITH_WSREP)
- SET(EXCL_GALERA "(suite/(galera|wsrep|sys_vars/[rt]/(sysvars_)?wsrep).*|include/((w.*)?wsrep.*|.*galera.*)\\.inc|std_data/(galera|wsrep).*)")
+ SET(EXCL_GALERA "(suite/(galera|wsrep|sys_vars/[rt]/(sysvars_)?wsrep).*|std_data/(galera|wsrep).*)")
ELSE()
SET(EXCL_GALERA "^DOES_NOT_EXIST$")
ENDIF()
diff --git a/debian/additions/innotop/innotop b/debian/additions/innotop/innotop
index 5d81980341d..2bc090917fe 100644
--- a/debian/additions/innotop/innotop
+++ b/debian/additions/innotop/innotop
@@ -4933,7 +4933,7 @@ sub noecho_password {
};
if ( $EVAL_ERROR ) {
- die "Cannot read respose; is Term::ReadKey installed? $EVAL_ERROR";
+ die "Cannot read response; is Term::ReadKey installed? $EVAL_ERROR";
}
return $response;
}
diff --git a/debian/additions/mariadb-report b/debian/additions/mariadb-report
index ff73bb0e17e..b95f226b737 100755
--- a/debian/additions/mariadb-report
+++ b/debian/additions/mariadb-report
@@ -726,7 +726,7 @@ sub set_myisam_vals
{
print "set_myisam_vals\n" if $op{debug};
-# should be moved elsewere
+# should be moved elsewhere
$questions = $stats{'Questions'};
$key_read_ratio = sprintf "%.2f",
@@ -1376,7 +1376,7 @@ format QCACHE =
__ Query Cache _________________________________________________________
Memory usage @>>>>>> of @>>>>>> %Usage: @>>>>>
make_short($qc_mem_used, 1), make_short($vars{'query_cache_size'}, 1), perc($qc_mem_used, $vars{'query_cache_size'})
-Block Fragmnt @>>>>>%
+Block Fragment @>>>>>%
perc($stats{'Qcache_free_blocks'}, $stats{'Qcache_total_blocks'})
Hits @>>>>>> @>>>>>/s
make_short($stats{'Qcache_hits'}), t($stats{'Qcache_hits'})
diff --git a/debian/mariadb-server-10.8.mariadb.init b/debian/mariadb-server-10.8.mariadb.init
index aa06221a069..efbecd3b498 100644
--- a/debian/mariadb-server-10.8.mariadb.init
+++ b/debian/mariadb-server-10.8.mariadb.init
@@ -34,6 +34,12 @@ else
exit -1
fi
+if [ ! -x /usr/bin/mariadbd-safe ]
+then
+ log_failure_msg "/usr/bin/mariadbd-safe not found or executable! This SysV init script depends on it."
+ exit -1
+fi
+
# priority can be overridden and "-s" adds output to stderr
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mariadb -i"
@@ -127,7 +133,7 @@ case "${1:-''}" in
test -e /run/mysqld || install -m 755 -o mysql -g root -d /run/mysqld
# Start MariaDB!
- /usr/bin/mysqld_safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER &
+ /usr/bin/mariadbd-safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER &
for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}"); do
sleep 1
diff --git a/debian/mariadb-server-10.8.postinst b/debian/mariadb-server-10.8.postinst
index 32134941cd7..a259a50ac55 100644
--- a/debian/mariadb-server-10.8.postinst
+++ b/debian/mariadb-server-10.8.postinst
@@ -155,7 +155,7 @@ EOF
# This is important to avoid dataloss when there is a removed
# mysql-server version from Woody lying around which used the same
- # data directory and then somewhen gets purged by the admin.
+ # data directory and then somehow gets purged by the admin.
db_set mariadb-server/postrm_remove_database false || true
# Clean up old flags before setting new one
diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml
index c6d58829b3e..7332b9bbcf1 100644
--- a/debian/salsa-ci.yml
+++ b/debian/salsa-ci.yml
@@ -402,7 +402,7 @@ build mariadbclient consumer Python-MySQLdb:
image: debian:${RELEASE}
script:
- *test-prepare-container
- # Run each step separately to avoitda 800+ lines chunk that lacks the
+ # Run each step separately to avoid an 800+ line chunk that lacks the
# commands themselves printed and Gitlab-CI cutting off the output
- apt-get install -y pkg-config ./libmariadb-dev*.deb ./libmariadb3_*.deb ./mariadb-common*.deb
- pkg-config --cflags --libs mysqlclient # See what MySQLdb builds with
diff --git a/debian/tests/smoke b/debian/tests/smoke
index 07dc3df1948..9e001f9692f 100644
--- a/debian/tests/smoke
+++ b/debian/tests/smoke
@@ -45,28 +45,28 @@ else
systemctl restart mariadb
fi
-mysql <<EOT
+mariadb <<EOT
CREATE DATABASE testdatabase;
CREATE USER 'testuser'@'localhost' identified by 'testpassword';
GRANT ALL ON testdatabase.* TO 'testuser'@'localhost';
EOT
-mysql testdatabase <<EOT
+mariadb testdatabase <<EOT
CREATE TABLE foo (bar INTEGER);
INSERT INTO foo (bar) VALUES (41);
EOT
-result=$(echo 'SELECT bar+1 FROM foo;'|mysql --batch --skip-column-names --user=testuser --password=testpassword testdatabase)
+result=$(echo 'SELECT bar+1 FROM foo;'|mariadb --batch --skip-column-names --user=testuser --password=testpassword testdatabase)
if [ "$result" != "42" ]; then
echo "Unexpected result" >&2
exit 1
fi
-mysql --user=testuser --password=testpassword testdatabase <<EOT
+mariadb --user=testuser --password=testpassword testdatabase <<EOT
DROP TABLE foo;
EOT
-mysql <<EOT
+mariadb <<EOT
DROP DATABASE testdatabase;
DROP USER 'testuser'@'localhost';
EOT
@@ -94,7 +94,7 @@ if [ "$(dpkg-architecture -qDEB_HOST_ARCH_BITS)" != 32 ] &&
LOG=/var/lib/mysql/#rocksdb/LOG
# XXX: The server may only be started during the install of
# mariadb-server-10.8, which happens before that of the plugin.
- [ -e $LOG ] || mysql -e "INSTALL PLUGIN RocksDB SONAME 'ha_rocksdb';"
+ [ -e $LOG ] || mariadb -e "INSTALL PLUGIN RocksDB SONAME 'ha_rocksdb';"
# XXX: rocksdb_supported_compression_types variable does not report ZSTD.
# Print RocksDB supported items so test log is easier to debug
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index 32f10da04e2..d1b695118a7 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -1483,8 +1483,6 @@ bool backup_start(CorruptedPages &corrupted_pages)
if (!write_galera_info(mysql_connection)) {
return(false);
}
- // copied from xtrabackup. what is it needed for here?
- write_current_binlog_file(mysql_connection);
}
if (opt_binlog_info == BINLOG_INFO_ON) {
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc
index ea85c478997..8b9962597af 100644
--- a/extra/mariabackup/backup_mysql.cc
+++ b/extra/mariabackup/backup_mysql.cc
@@ -1444,14 +1444,18 @@ write_galera_info(MYSQL *connection)
if ((state_uuid == NULL && state_uuid55 == NULL)
|| (last_committed == NULL && last_committed55 == NULL)) {
- msg("Failed to get master wsrep state from SHOW STATUS.");
- result = false;
+ msg("Warning: failed to get master wsrep state from SHOW STATUS.");
+ result = true;
goto cleanup;
}
result = backup_file_printf(XTRABACKUP_GALERA_INFO,
"%s:%s\n", state_uuid ? state_uuid : state_uuid55,
last_committed ? last_committed : last_committed55);
+ if (result)
+ {
+ write_current_binlog_file(connection);
+ }
cleanup:
free_mysql_variables(status);
diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc
index 7b268df2364..e0a4711a2aa 100644
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@ -129,6 +129,7 @@ xb_fil_cur_open(
in case of error */
cursor->buf = NULL;
cursor->node = NULL;
+ cursor->n_process_batch = 0;
cursor->space_id = node->space->id;
@@ -374,6 +375,8 @@ xb_fil_cur_result_t xb_fil_cur_read(xb_fil_cur_t* cursor,
return(XB_FIL_CUR_EOF);
}
+reinit_buf:
+ cursor->n_process_batch++;
if (to_read > (ib_int64_t) cursor->buf_size) {
to_read = (ib_int64_t) cursor->buf_size;
}
@@ -416,8 +419,26 @@ read_retry:
if (os_file_read(IORequestRead, cursor->file, cursor->buf, offset,
(ulint) to_read, nullptr) != DB_SUCCESS) {
- ret = XB_FIL_CUR_ERROR;
- goto func_exit;
+ if (!srv_is_undo_tablespace(cursor->space_id)) {
+ ret = XB_FIL_CUR_ERROR;
+ goto func_exit;
+ }
+
+ if (cursor->buf_page_no
+ >= SRV_UNDO_TABLESPACE_SIZE_IN_PAGES) {
+ ret = XB_FIL_CUR_SKIP;
+ goto func_exit;
+ }
+
+ to_read = SRV_UNDO_TABLESPACE_SIZE_IN_PAGES * page_size;
+
+ if (cursor->n_process_batch > 1) {
+ ret = XB_FIL_CUR_ERROR;
+ goto func_exit;
+ }
+
+ space->release();
+ goto reinit_buf;
}
defer = UT_LIST_GET_FIRST(space->chain)->deferred;
diff --git a/extra/mariabackup/fil_cur.h b/extra/mariabackup/fil_cur.h
index 6b868bf3edd..b7812f6589e 100644
--- a/extra/mariabackup/fil_cur.h
+++ b/extra/mariabackup/fil_cur.h
@@ -58,6 +58,7 @@ struct xb_fil_cur_t {
uint thread_n; /*!< thread number for diagnostics */
uint32_t space_id; /*!< ID of tablespace */
uint32_t space_size; /*!< space size in pages */
+ uint32_t n_process_batch;/*!< Number of batch processed */
/** @return whether this is not a file-per-table tablespace */
bool is_system() const
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index e214618c7e4..ef826a40105 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -187,6 +187,7 @@ struct xb_filter_entry_t{
xb_filter_entry_t *name_hash;
};
+/** whether log_copying_thread() is active; protected by recv_sys.mutex */
static bool log_copying_running;
int xtrabackup_parallel;
@@ -241,6 +242,10 @@ long innobase_file_io_threads = 4;
ulong innobase_read_io_threads = 4;
ulong innobase_write_io_threads = 4;
+/** Store the failed read of undo tablespace ids. Protected by
+recv_sys.mutex. */
+static std::set<uint32_t> fail_undo_ids;
+
longlong innobase_page_size = (1LL << 14); /* 16KB */
char* innobase_buffer_pool_filename = NULL;
@@ -401,6 +406,10 @@ struct ddl_tracker_t {
static ddl_tracker_t ddl_tracker;
+/** Store the space ids of truncated undo log tablespaces. Protected
+by recv_sys.mutex */
+static std::set<uint32_t> undo_trunc_ids;
+
/** Stores the space ids of page0 INIT_PAGE redo records. It is
used to indicate whether the given deferred tablespace can
be reconstructed. */
@@ -913,6 +922,11 @@ static void backup_file_op_fail(uint32_t space_id, int type,
}
}
+static void backup_undo_trunc(uint32_t space_id)
+{
+ undo_trunc_ids.insert(space_id);
+}
+
/* Function to store the space id of page0 INIT_PAGE
@param space_id space id which has page0 init page */
static void backup_first_page_op(space_id_t space_id)
@@ -2140,7 +2154,6 @@ static bool innodb_init_param()
srv_buf_pool_size = (ulint) xtrabackup_use_memory;
srv_buf_pool_chunk_unit = srv_buf_pool_size;
- srv_n_file_io_threads = (uint) innobase_file_io_threads;
srv_n_read_io_threads = (uint) innobase_read_io_threads;
srv_n_write_io_threads = (uint) innobase_write_io_threads;
@@ -2912,15 +2925,27 @@ static my_bool xtrabackup_copy_datafile(fil_node_t *node, uint thread_n,
}
/* The main copy loop */
- while ((res = xb_fil_cur_read(&cursor, corrupted_pages)) ==
- XB_FIL_CUR_SUCCESS) {
+ while (1) {
+ res = xb_fil_cur_read(&cursor, corrupted_pages);
+ if (res == XB_FIL_CUR_ERROR) {
+ goto error;
+ }
+
+ if (res == XB_FIL_CUR_EOF) {
+ break;
+ }
+
if (!write_filter.process(&write_filt_ctxt, dstfile)) {
goto error;
}
- }
- if (res == XB_FIL_CUR_ERROR) {
- goto error;
+ if (res == XB_FIL_CUR_SKIP) {
+ mysql_mutex_lock(&recv_sys.mutex);
+ fail_undo_ids.insert(
+ static_cast<uint32_t>(cursor.space_id));
+ mysql_mutex_unlock(&recv_sys.mutex);
+ break;
+ }
}
if (write_filter.finalize
@@ -3122,16 +3147,18 @@ static void log_copying_thread()
my_thread_end();
}
+/** whether io_watching_thread() is active; protected by log_sys.mutex */
static bool have_io_watching_thread;
-static pthread_t io_watching_thread_id;
/* io throttle watching (rough) */
-static void *io_watching_thread(void*)
+static void io_watching_thread()
{
+ my_thread_init();
/* currently, for --backup only */
- ut_a(xtrabackup_backup);
+ ut_ad(xtrabackup_backup);
mysql_mutex_lock(&recv_sys.mutex);
+ ut_ad(have_io_watching_thread);
while (log_copying_running && !metadata_to_lsn)
{
@@ -3144,9 +3171,10 @@ static void *io_watching_thread(void*)
/* stop io throttle */
xtrabackup_throttle= 0;
+ have_io_watching_thread= false;
mysql_cond_broadcast(&wait_throttle);
mysql_mutex_unlock(&recv_sys.mutex);
- return nullptr;
+ my_thread_end();
}
#ifndef DBUG_OFF
@@ -4405,27 +4433,29 @@ end:
# define xb_set_max_open_files(x) 0UL
#endif
-static void stop_backup_threads(bool running)
+static void stop_backup_threads()
{
- if (running)
+ mysql_cond_broadcast(&log_copying_stop);
+
+ if (log_copying_running || have_io_watching_thread)
{
+ mysql_mutex_unlock(&recv_sys.mutex);
fputs("mariabackup: Stopping log copying thread", stderr);
fflush(stderr);
- while (log_copying_running)
+ mysql_mutex_lock(&recv_sys.mutex);
+ while (log_copying_running || have_io_watching_thread)
{
+ mysql_cond_broadcast(&log_copying_stop);
+ mysql_mutex_unlock(&recv_sys.mutex);
putc('.', stderr);
fflush(stderr);
std::this_thread::sleep_for(std::chrono::milliseconds(200));
+ mysql_mutex_lock(&recv_sys.mutex);
}
putc('\n', stderr);
- mysql_cond_destroy(&log_copying_stop);
}
- if (have_io_watching_thread)
- {
- pthread_join(io_watching_thread_id, nullptr);
- mysql_cond_destroy(&wait_throttle);
- }
+ mysql_cond_destroy(&log_copying_stop);
}
/** Implement the core of --backup
@@ -4449,11 +4479,7 @@ static bool xtrabackup_backup_low()
}
recv_sys.lsn = lsn;
- mysql_cond_broadcast(&log_copying_stop);
- const bool running= log_copying_running;
- mysql_mutex_unlock(&recv_sys.mutex);
- stop_backup_threads(running);
- mysql_mutex_lock(&recv_sys.mutex);
+ stop_backup_threads();
}
if (metadata_to_lsn && xtrabackup_copy_logfile()) {
@@ -4472,6 +4498,23 @@ static bool xtrabackup_backup_low()
dst_log_file = NULL;
+ std::vector<uint32_t> failed_ids;
+ std::set_difference(
+ fail_undo_ids.begin(), fail_undo_ids.end(),
+ undo_trunc_ids.begin(), undo_trunc_ids.end(),
+ std::inserter(failed_ids, failed_ids.begin()));
+
+ for (uint32_t id : failed_ids) {
+ msg("mariabackup: Failed to read undo log "
+ "tablespace space id %d and there is no undo "
+ "tablespace truncation redo record.",
+ id);
+ }
+
+ if (failed_ids.size() > 0) {
+ return false;
+ }
+
if(!xtrabackup_incremental) {
strcpy(metadata_type, "full-backuped");
metadata_from_lsn = 0;
@@ -4545,6 +4588,7 @@ static bool xtrabackup_backup_func()
srv_operation = SRV_OPERATION_BACKUP;
log_file_op = backup_file_op;
+ undo_space_trunc = backup_undo_trunc;
first_page_init = backup_first_page_op;
metadata_to_lsn = 0;
@@ -4554,12 +4598,12 @@ fail:
if (log_copying_running) {
mysql_mutex_lock(&recv_sys.mutex);
metadata_to_lsn = 1;
- mysql_cond_broadcast(&log_copying_stop);
+ stop_backup_threads();
mysql_mutex_unlock(&recv_sys.mutex);
- stop_backup_threads(true);
}
log_file_op = NULL;
+ undo_space_trunc = NULL;
first_page_init = NULL;
if (dst_log_file) {
ds_close(dst_log_file);
@@ -4595,7 +4639,6 @@ fail:
xb_filters_init();
xb_fil_io_init();
- srv_n_file_io_threads = srv_n_read_io_threads;
if (os_aio_init()) {
msg("Error: cannot initialize AIO subsystem");
@@ -4666,13 +4709,15 @@ fail:
goto fail;
}
log_copying_running = true;
+
+ mysql_cond_init(0, &log_copying_stop, nullptr);
+
/* start io throttle */
- if(xtrabackup_throttle) {
+ if (xtrabackup_throttle) {
io_ticket = xtrabackup_throttle;
have_io_watching_thread = true;
mysql_cond_init(0, &wait_throttle, nullptr);
- mysql_thread_create(0, &io_watching_thread_id, nullptr,
- io_watching_thread, nullptr);
+ std::thread(io_watching_thread).detach();
}
/* Populate fil_system with tablespaces to copy */
@@ -4699,7 +4744,6 @@ fail:
DBUG_MARIABACKUP_EVENT("before_innodb_log_copy_thread_started", {});
- mysql_cond_init(0, &log_copying_stop, nullptr);
std::thread(log_copying_thread).detach();
/* FLUSH CHANGED_PAGE_BITMAPS call */
@@ -4796,6 +4840,7 @@ fail:
innodb_shutdown();
log_file_op = NULL;
+ undo_space_trunc = NULL;
first_page_init = NULL;
pthread_cond_destroy(&scanned_lsn_cond);
if (!corrupted_pages.empty()) {
@@ -5998,12 +6043,6 @@ error:
fil_system.freeze_space_list = 0;
- /* increase IO threads */
- if (srv_n_file_io_threads < 10) {
- srv_n_read_io_threads = 4;
- srv_n_write_io_threads = 4;
- }
-
msg("Starting InnoDB instance for recovery.");
msg("mariabackup: Using %lld bytes for buffer pool "
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 7076d2d88d2..1024821e569 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -25,6 +25,7 @@ SET(HEADERS
mysql.h
mysql_com.h
mysql_com_server.h
+ mariadb_capi_rename.h
pack.h
my_byteorder.h
byte_order_generic.h
@@ -76,7 +77,6 @@ FOREACH(f ${HEADERS_GEN_CONFIGURE})
ENDFOREACH(f)
IF(NOT WITH_WSREP)
SET(EXCL_SERVICE_WSREP "service_wsrep.h")
- SET(EXCL_WSREP "wsrep.h")
ENDIF()
INSTALL(DIRECTORY mysql/
DESTINATION ${INSTALL_INCLUDEDIR}/server/mysql COMPONENT Development
@@ -93,7 +93,6 @@ MACRO(INSTALL_PRIVATE DIR)
FILES_MATCHING PATTERN "*.h"
PATTERN CMakeFiles EXCLUDE
PATTERN mysql EXCLUDE
- PATTERN "${EXCL_WSREP}" EXCLUDE
REGEX "\\./(${EXCL_RE}$)" EXCLUDE)
ENDMACRO()
diff --git a/include/heap.h b/include/heap.h
index f0ac527976c..2e0e9357a3b 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -33,12 +33,12 @@ extern "C" {
#include "my_compare.h"
#include "my_tree.h"
- /* defines used by heap-funktions */
+ /* defines used by heap-functions */
#define HP_MAX_LEVELS 4 /* 128^5 records is enough */
#define HP_PTRS_IN_NOD 128
- /* struct used with heap_funktions */
+ /* struct used with heap_functions */
typedef struct st_heapinfo /* Struct from heap_info */
{
@@ -107,7 +107,7 @@ typedef struct st_heap_block
ulong last_allocated; /* number of records there is allocated space for */
} HP_BLOCK;
-struct st_heap_info; /* For referense */
+struct st_heap_info; /* For reference */
typedef struct st_hp_keydef /* Key definition with open */
{
diff --git a/include/json_lib.h b/include/json_lib.h
index 2d85a7653f2..dfb76cadfad 100644
--- a/include/json_lib.h
+++ b/include/json_lib.h
@@ -378,7 +378,7 @@ int json_find_paths_next(json_engine_t *je, json_find_paths_t *state);
#define JSON_ERROR_ILLEGAL_SYMBOL (-2)
/*
- Converst JSON string constant into ordinary string constant
+ Convert JSON string constant into ordinary string constant
which can involve unpacking json escapes and changing character set.
Returns negative integer in the case of an error,
the length of the result otherwise.
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 442133f3ba7..5f65385fd3f 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -15,7 +15,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
/*
- A better inplementation of the UNIX ctype(3) library.
+ A better implementation of the UNIX ctype(3) library.
*/
#ifndef _m_ctype_h
@@ -139,7 +139,7 @@ const uint16 *my_uca_contraction2_weight(const MY_CONTRACTIONS *c,
my_wc_t wc1, my_wc_t wc2);
-/* Collation weights on a single level (e.g. primary, secondary, tertiarty) */
+/* Collation weights on a single level (e.g. primary, secondary, tertiary) */
typedef struct my_uca_level_info_st
{
my_wc_t maxchar;
@@ -1552,7 +1552,7 @@ uint32 my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
An extended version of my_convert(), to pass non-default mb_wc() and wc_mb().
For example, String::copy_printable() which is used in
Protocol::store_warning() uses this to escape control
- and non-convertable characters.
+ and non-convertible characters.
*/
uint32 my_convert_using_func(char *to, size_t to_length, CHARSET_INFO *to_cs,
my_charset_conv_wc_mb mb_wc,
@@ -1633,7 +1633,7 @@ size_t my_convert_fix(CHARSET_INFO *dstcs, char *dst, size_t dst_length,
@param str - the beginning of the string
@param end - the string end (the next byte after the string)
@return >0, for a multi-byte character
- @rerurn 0, for a single byte character, broken sequence, empty string.
+ @return 0, for a single byte character, broken sequence, empty string.
*/
static inline
uint my_ismbchar(CHARSET_INFO *cs, const char *str, const char *end)
diff --git a/include/ma_dyncol.h b/include/ma_dyncol.h
index 833a25b937e..f697c90707f 100644
--- a/include/ma_dyncol.h
+++ b/include/ma_dyncol.h
@@ -78,7 +78,7 @@ enum enum_dyncol_func_result
ER_DYNCOL_YES= 1, /* For functions returning 0/1 */
ER_DYNCOL_FORMAT= -1, /* Wrong format of the encoded string */
ER_DYNCOL_LIMIT= -2, /* Some limit reached */
- ER_DYNCOL_RESOURCE= -3, /* Out of resourses */
+ ER_DYNCOL_RESOURCE= -3, /* Out of resources */
ER_DYNCOL_DATA= -4, /* Incorrect input data */
ER_DYNCOL_UNKNOWN_CHARSET= -5, /* Unknown character set */
ER_DYNCOL_TRUNCATED= 2 /* OK, but data was truncated */
diff --git a/include/my_base.h b/include/my_base.h
index 30dbec2e6ab..026e4bf347b 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -130,7 +130,7 @@ enum ha_extra_function {
HA_EXTRA_NO_USER_CHANGE=9, /* No user is allowed to write */
HA_EXTRA_KEY_CACHE=10,
HA_EXTRA_NO_KEY_CACHE=11,
- HA_EXTRA_WAIT_LOCK=12, /* Wait until file is avalably (def) */
+ HA_EXTRA_WAIT_LOCK=12, /* Wait until file is available (def) */
HA_EXTRA_NO_WAIT_LOCK=13, /* If file is locked, return quickly */
HA_EXTRA_WRITE_CACHE=14, /* Use write cache in ha_write() */
HA_EXTRA_FLUSH_CACHE=15, /* flush write_record_cache */
@@ -293,7 +293,7 @@ enum ha_base_keytype {
This flag can be calculated -- it's based on key lengths comparison.
*/
#define HA_KEY_HAS_PART_KEY_SEG 65536
-/* Internal Flag Can be calcaluted */
+/* Internal Flag Can be calculated */
#define HA_INVISIBLE_KEY 2<<18
/* Automatic bits in key-flag */
@@ -440,9 +440,9 @@ enum ha_base_keytype {
#define HA_ERR_FIRST 120 /* Copy of first error nr.*/
#define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */
-#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */
+#define HA_ERR_FOUND_DUPP_KEY 121 /* Duplicate key on write */
#define HA_ERR_INTERNAL_ERROR 122 /* Internal error */
-#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */
+#define HA_ERR_RECORD_CHANGED 123 /* Update with is recoverable */
#define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */
#define HA_ERR_CRASHED 126 /* Indexfile is crashed */
#define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */
@@ -458,7 +458,7 @@ enum ha_base_keytype {
#define HA_ERR_UNSUPPORTED 138 /* unsupported extension used */
#define HA_ERR_TO_BIG_ROW 139 /* Too big row */
#define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */
-#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */
+#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Duplicate unique on write */
#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */
#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting tables in MERGE */
#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */
@@ -502,7 +502,7 @@ enum ha_base_keytype {
illegal data being read */
#define HA_ERR_NEW_FILE 172 /* New file format */
#define HA_ERR_ROWS_EVENT_APPLY 173 /* The event could not be processed
- no other hanlder error happened */
+ no other handler error happened */
#define HA_ERR_INITIALIZATION 174 /* Error during initialization */
#define HA_ERR_FILE_TOO_SHORT 175 /* File too short */
#define HA_ERR_WRONG_CRC 176 /* Wrong CRC on page */
diff --git a/include/my_compare.h b/include/my_compare.h
index f936bbe6b0c..c2cb9ae46b9 100644
--- a/include/my_compare.h
+++ b/include/my_compare.h
@@ -132,7 +132,7 @@ extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, const uchar *a);
0=CHECK_NEG - The filter is not satisfied. The engine should discard this
index tuple and continue the scan.
- 1=CHECK_POS - The filter is statisfied. Current index tuple should be
+ 1=CHECK_POS - The filter is satisfied. Current index tuple should be
returned to the SQL layer.
2=CHECK_OUT_OF_RANGE - the index tuple is outside of the range that we're
scanning. (Example: if we're scanning "t.key BETWEEN 10 AND
diff --git a/include/my_decimal_limits.h b/include/my_decimal_limits.h
index ac1df83bb62..5bfd54d6748 100644
--- a/include/my_decimal_limits.h
+++ b/include/my_decimal_limits.h
@@ -32,7 +32,7 @@
digits in one our big digit decreased by 1 (because we always put decimal
point on the border of our big digits))
- With normal precession we can handle 65 digits. MariaDB can store in
+ With normal precision we can handle 65 digits. MariaDB can store in
the .frm up to 63 digits. By default we use DECIMAL_NOT_SPECIFIED digits
when converting strings to decimal, so we don't want to set this too high.
To not use up all digits for the scale we limit the number of decimals to
diff --git a/include/my_dir.h b/include/my_dir.h
index 12cf5db149d..ecd37b2925b 100644
--- a/include/my_dir.h
+++ b/include/my_dir.h
@@ -70,7 +70,7 @@ typedef struct my_stat
dev_t st_rdev; /* more major & minor device numbers (???) */
off_t st_size; /* size of file */
time_t st_atime; /* time for last read */
- time_t st_mtime; /* time for last contens modify */
+ time_t st_mtime; /* time for last contents modify */
time_t st_ctime; /* time for last inode or contents modify */
} MY_STAT;
diff --git a/include/my_global.h b/include/my_global.h
index a849597f468..89a3789b788 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -642,7 +642,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
the mismatch of CRT and mysys file IO usage on Windows at runtime.
CRT file descriptors can be in the range 0-2047, whereas descriptors returned
by my_open() will start with 2048. If a file descriptor with value less then
- MY_FILE_MIN is passed to mysys IO function, chances are it stemms from
+ MY_FILE_MIN is passed to mysys IO function, chances are it stems from
open()/fileno() and not my_open()/my_fileno.
For Posix, mysys functions are light wrappers around libc, and MY_FILE_MIN
@@ -865,7 +865,7 @@ typedef long long my_ptrdiff_t;
#define STDCALL
#endif
-/* Typdefs for easyier portability */
+/* Typdefs for easier portability */
#ifndef HAVE_UCHAR
typedef unsigned char uchar; /* Short for unsigned char */
diff --git a/include/my_rdtsc.h b/include/my_rdtsc.h
index fb0ef0ef5b9..b2d30fa3151 100644
--- a/include/my_rdtsc.h
+++ b/include/my_rdtsc.h
@@ -90,7 +90,7 @@ C_MODE_START
how to ensure that it can be accessed.
On AARCH64, we use the generic timer base register. We override clang
implementation for aarch64 as it access a PMU register which is not
- guarenteed to be active.
+ guaranteed to be active.
On RISC-V, we use the rdcycle instruction to read from mcycle register.
Sadly, we have nothing for the Digital Alpha, MIPS, Motorola m68k,
diff --git a/include/my_sys.h b/include/my_sys.h
index 00a901a313b..20a74adae63 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -438,7 +438,7 @@ typedef struct st_io_cache /* Used when caching files */
/*
A caller will use my_b_read() macro to read from the cache
if the data is already in cache, it will be simply copied with
- memcpy() and internal variables will be accordinging updated with
+ memcpy() and internal variables will be accordingly updated with
no functions invoked. However, if the data is not fully in the cache,
my_b_read() will call read_function to fetch the data. read_function
must never be invoked directly.
@@ -482,7 +482,7 @@ typedef struct st_io_cache /* Used when caching files */
myf myflags; /* Flags used to my_read/my_write */
/*
alloced_buffer is set to the size of the buffer allocated for the IO_CACHE.
- Includes the overhead(storing key to ecnrypt and decrypt) for encryption.
+ Includes the overhead(storing key to encrypt and decrypt) for encryption.
Set to 0 if nothing is allocated.
Currently READ_NET is the only one that will use a buffer allocated
somewhere else
@@ -998,7 +998,7 @@ static inline my_hrtime_t make_hr_time(my_time_t time, ulong time_sec_part)
#define my_munmap(a,b) munmap((a),(b))
#else
-/* not a complete set of mmap() flags, but only those that nesessary */
+/* not a complete set of mmap() flags, but only those that necessary */
#define PROT_READ 1
#define PROT_WRITE 2
#define MAP_NORESERVE 0
diff --git a/include/myisam.h b/include/myisam.h
index 0942584e874..c90026bfc7a 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
-/* This file should be included when using myisam_funktions */
+/* This file should be included when using myisam_functions */
#ifndef _myisam_h
#define _myisam_h
@@ -159,7 +159,7 @@ typedef struct st_mi_create_info
my_bool with_auto_increment;
} MI_CREATE_INFO;
-struct st_myisam_info; /* For referense */
+struct st_myisam_info; /* For reference */
struct st_mi_isam_share;
typedef struct st_myisam_info MI_INFO;
struct st_mi_s_param;
diff --git a/include/myisammrg.h b/include/myisammrg.h
index 78e7ac00e8f..1d7efbe74d6 100644
--- a/include/myisammrg.h
+++ b/include/myisammrg.h
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
-/* This file should be included when using merge_isam_funktions */
+/* This file should be included when using merge_isam_functions */
#ifndef _myisammrg_h
#define _myisammrg_h
@@ -51,7 +51,7 @@ typedef struct st_mymerge_info /* Struct from h_info */
ulonglong data_file_length;
ulonglong dupp_key_pos; /* Offset of the Duplicate key in the merge table */
uint reclength; /* Recordlength */
- int errkey; /* With key was dupplicated on err */
+ int errkey; /* With key was duplicated on err */
uint options; /* HA_OPTION_... used */
ulong *rec_per_key; /* for sql optimizing */
} MYMERGE_INFO;
diff --git a/include/mysql.h b/include/mysql.h
index 46ddc4b9ed9..a66dcc7bd02 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -666,7 +666,7 @@ enum enum_mysql_stmt_state
length - On input: in case when lengths of input values
are different for each execute, you can set this to
- point at a variable containining value length. This
+ point at a variable containing value length. This
way the value length can be different in each execute.
If length is not NULL, buffer_length is not used.
Note, length can even point at buffer_length if
diff --git a/include/mysql/plugin_ftparser.h b/include/mysql/plugin_ftparser.h
index 8db8712926f..511b34bb234 100644
--- a/include/mysql/plugin_ftparser.h
+++ b/include/mysql/plugin_ftparser.h
@@ -101,7 +101,7 @@ enum enum_ft_token_type
<0 Must not be present
0 Neither; the word is optional but its presence increases the relevance
With the default settings of the ft_boolean_syntax system variable,
- >0 corresponds to the '+' operator, <0 corrresponds to the '-' operator,
+ >0 corresponds to the '+' operator, <0 corresponds to the '-' operator,
and 0 means neither operator was used.
weight_adjust: A weighting factor that determines how much a match
diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h
index b6247af65f3..697c23ae423 100644
--- a/include/mysql/psi/mysql_thread.h
+++ b/include/mysql/psi/mysql_thread.h
@@ -625,7 +625,7 @@ typedef struct st_mysql_cond mysql_cond_t;
This function creates both the thread instrumentation and a thread.
@c mysql_thread_create is a replacement for @c pthread_create.
The parameter P4 (or, if it is NULL, P1) will be used as the
- instrumented thread "indentity".
+ instrumented thread "identity".
Providing a P1 / P4 parameter with a different value for each call
will on average improve performances, since this thread identity value
is used internally to randomize access to data and prevent contention.
diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h
index 4c3e2c6a9c4..9b02961749d 100644
--- a/include/mysql/psi/psi.h
+++ b/include/mysql/psi/psi.h
@@ -2384,7 +2384,7 @@ typedef void (*execute_prepared_stmt_v1_t)
(PSI_statement_locker *locker, PSI_prepared_stmt* prepared_stmt);
/**
- Set the statement text for a prepared statment event.
+ Set the statement text for a prepared statement event.
@param prepared_stmt prepared statement.
@param text the prepared statement text
@param text_len the prepared statement text length
diff --git a/include/mysql/service_base64.h b/include/mysql/service_base64.h
index 43b5ba323ba..fa54b4923d4 100644
--- a/include/mysql/service_base64.h
+++ b/include/mysql/service_base64.h
@@ -29,7 +29,7 @@ extern "C" {
#include <stdlib.h>
#endif
-/* Allow multuple chunks 'AAA= AA== AA==', binlog uses this */
+/* Allow multiple chunks 'AAA= AA== AA==', binlog uses this */
#define MY_BASE64_DECODE_ALLOW_MULTIPLE_CHUNKS 1
extern struct base64_service_st {
diff --git a/include/mysql/service_my_snprintf.h b/include/mysql/service_my_snprintf.h
index 6757a658fb6..fcc832fc1f1 100644
--- a/include/mysql/service_my_snprintf.h
+++ b/include/mysql/service_my_snprintf.h
@@ -40,7 +40,7 @@
@post
The syntax of a format string is generally the same:
% <flag> <width> <precision> <length modifier> <format>
- where everithing but the format is optional.
+ where everything but the format is optional.
Three one-character flags are recognized:
'0' has the standard zero-padding semantics;
diff --git a/include/mysql/service_sql.h b/include/mysql/service_sql.h
index be9dcad669e..2fee56ca2c7 100644
--- a/include/mysql/service_sql.h
+++ b/include/mysql/service_sql.h
@@ -101,7 +101,7 @@ extern struct sql_service_st {
*/
MYSQL *mysql_real_connect_local(MYSQL *mysql);
-/* The rest of the function declarations mest be taken from the mysql.h */
+/* The rest of the function declarations must be taken from the mysql.h */
#endif /*MYSQL_DYNAMIC_PLUGIN*/
diff --git a/include/mysql/service_thd_timezone.h b/include/mysql/service_thd_timezone.h
index 89e75274cf0..667137745f4 100644
--- a/include/mysql/service_thd_timezone.h
+++ b/include/mysql/service_thd_timezone.h
@@ -16,7 +16,7 @@
/**
@file
- This service provdes functions to convert between my_time_t and
+ This service provides functions to convert between my_time_t and
MYSQL_TIME taking into account the current value of the time_zone
session variable.
diff --git a/include/queues.h b/include/queues.h
index e9948857dde..9cc7c15a980 100644
--- a/include/queues.h
+++ b/include/queues.h
@@ -24,7 +24,7 @@
*/
/*
- Code for generell handling of priority Queues.
+ Code for general handling of priority Queues.
Implementation of queues from "Algorithms in C" by Robert Sedgewick.
*/
diff --git a/include/waiting_threads.h b/include/waiting_threads.h
index f785cc8988b..5f708f42f96 100644
--- a/include/waiting_threads.h
+++ b/include/waiting_threads.h
@@ -81,7 +81,7 @@ typedef struct st_wt_thd {
1. Latest
Keep all weights equal.
2. Random
- Assight weights at random.
+ Assign weights at random.
(variant: modify a weight randomly before every lock request)
3. Youngest
Set weight to -NOW()
diff --git a/mysql-test/include/have_gzip.inc b/mysql-test/include/have_gzip.inc
new file mode 100644
index 00000000000..09f282b73de
--- /dev/null
+++ b/mysql-test/include/have_gzip.inc
@@ -0,0 +1,6 @@
+--error 0,1,127
+--exec gzip --version > /dev/null 2> /dev/null
+if ($sys_errno)
+{
+ --skip Requires gzip executable
+}
diff --git a/mysql-test/include/maybe_versioning.combinations b/mysql-test/include/maybe_versioning.combinations
new file mode 100644
index 00000000000..246ad30ce7e
--- /dev/null
+++ b/mysql-test/include/maybe_versioning.combinations
@@ -0,0 +1,7 @@
+[orig]
+
+[vers]
+system_versioning_alter_history=keep
+
+[vers_trx]
+system_versioning_alter_history=keep
diff --git a/mysql-test/include/maybe_versioning.inc b/mysql-test/include/maybe_versioning.inc
new file mode 100644
index 00000000000..8a7d7dad44f
--- /dev/null
+++ b/mysql-test/include/maybe_versioning.inc
@@ -0,0 +1,47 @@
+# include file for test files that can be run with and without debug
+# having debug and non-debug tests.
+
+# If $modify_create_table is true CREATE statement must be evaluated with
+# $create_options that adds WITH SYSTEM VERSIONING to the statement. Otherwise
+# system versioning is added implicitly via debug options. The second variant
+# can easily be added to any test but works only for debug builds.
+
+if ($modify_create_table)
+{
+ if ($MTR_COMBINATION_VERS)
+ {
+ let $create_options= `select ' WITH SYSTEM VERSIONING'`;
+ }
+
+ if ($MTR_COMBINATION_VERS_TRX)
+ {
+ --skip Not tested
+ }
+}
+
+if (!$modify_create_table)
+{
+ let $have_debug=`select version() like '%debug%'`;
+
+ if ($MTR_COMBINATION_VERS)
+ {
+ if (!$have_debug)
+ {
+ --skip Requires debug
+ }
+ --disable_query_log
+ set debug_dbug="d,sysvers_force_trx,sysvers_hide";
+ --enable_query_log
+ }
+
+ if ($MTR_COMBINATION_VERS_TRX)
+ {
+ if (!$have_debug)
+ {
+ --skip Requires debug
+ }
+ --disable_query_log
+ set debug_dbug="d,sysvers_force,sysvers_hide";
+ --enable_query_log
+ }
+}
diff --git a/mysql-test/include/start_mysqld.inc b/mysql-test/include/start_mysqld.inc
index b4fe116fe86..6e448cb2efd 100644
--- a/mysql-test/include/start_mysqld.inc
+++ b/mysql-test/include/start_mysqld.inc
@@ -12,25 +12,32 @@ if (!$restart_noprint)
--let $restart_noprint=0
}
+--let $restart_cmd= restart
+
+if ($restart_bindir)
+{
+ --let $restart_cmd= restart_bindir $restart_bindir
+}
+
if ($restart_parameters)
{
- --exec echo "restart: $restart_parameters" > $_expect_file_name
+ --exec echo "$restart_cmd: $restart_parameters" > $_expect_file_name
if (!$restart_noprint)
{
- --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
- --exec echo "# restart: $restart_parameters"
+ --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+ --exec echo "# $restart_cmd: $restart_parameters"
}
if ($restart_noprint == 1)
{
- --exec echo "# restart: with restart_parameters"
+ --exec echo "# $restart_cmd: with restart_parameters"
}
}
if (!$restart_parameters)
{
- --exec echo "restart" > $_expect_file_name
+ --exec echo "$restart_cmd" > $_expect_file_name
if ($restart_noprint < 2)
{
- --exec echo "# restart"
+ --exec echo "# $restart_cmd"
}
}
diff --git a/mysql-test/lib/My/CoreDump.pm b/mysql-test/lib/My/CoreDump.pm
index 298cf9ef877..05b6edf1385 100644
--- a/mysql-test/lib/My/CoreDump.pm
+++ b/mysql-test/lib/My/CoreDump.pm
@@ -108,7 +108,7 @@ for my $f (keys %print_formats)
register_opt('print-core|C', ':s',
"Print core dump format: ". $print_formats. " (for not printing cores). ".
- "Defaults to value of MTR_PRINT_CORE or 'short'");
+ "Defaults to value of MTR_PRINT_CORE or 'medium'");
if (!IS_WINDOWS)
{
register_opt('print-method', '=s',
@@ -134,7 +134,7 @@ sub env_or_default($$) {
}
sub pre_setup() {
- $config{print_core}= env_or_default('short', 'MTR_PRINT_CORE')
+ $config{print_core}= env_or_default('medium', 'MTR_PRINT_CORE')
if not defined $config{print_core};
$config{print_method}= (IS_WINDOWS) ? 'cdb' : 'auto'
if not defined $config{print_method};
diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result
index 10da4b21763..8320c8d3c4d 100644
--- a/mysql-test/main/cte_recursive.result
+++ b/mysql-test/main/cte_recursive.result
@@ -4330,7 +4330,9 @@ drop table t1;
#
# MDEV-24019: query with recursive CTE when no default database is set
#
-drop database test;
+create database dummy;
+use dummy;
+drop database dummy;
with recursive a as
(select 1 from dual union select * from a as r)
select * from a;
@@ -4369,7 +4371,6 @@ a
1
deallocate prepare stmt;
drop database db1;
-create database test;
use test;
#
# MDEV-23406: query with mutually recursive CTEs when big_tables=1
diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test
index 069997b0288..8efbdbf9677 100644
--- a/mysql-test/main/cte_recursive.test
+++ b/mysql-test/main/cte_recursive.test
@@ -2732,7 +2732,9 @@ drop table t1;
--echo # MDEV-24019: query with recursive CTE when no default database is set
--echo #
-drop database test;
+create database dummy;
+use dummy;
+drop database dummy;
let $q=
with recursive a as
@@ -2760,7 +2762,6 @@ deallocate prepare stmt;
drop database db1;
-create database test;
use test;
--echo #
diff --git a/mysql-test/main/func_group.result b/mysql-test/main/func_group.result
index 2e14bd9e403..b7f45cda8a6 100644
--- a/mysql-test/main/func_group.result
+++ b/mysql-test/main/func_group.result
@@ -2553,5 +2553,19 @@ DROP TABLE t1;
#
SET STATEMENT sql_mode=ONLY_FULL_GROUP_BY FOR EXECUTE IMMEDIATE 'ALTER TABLE mysql.time_zone_transition ORDER BY Time_zone_id, Transition_time';
#
+# MDEV-19071 Wrong results when using STDDEV_SAMP() and view
+#
+create table t1(i int);
+insert into t1 values (1),(2),(3),(4),(5);
+create view v1 as select stddev_samp(i),stddev_pop(i),stddev(i),std(i) from t1;
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select stddev_samp(`t1`.`i`) AS `stddev_samp(i)`,std(`t1`.`i`) AS `stddev_pop(i)`,std(`t1`.`i`) AS `stddev(i)`,std(`t1`.`i`) AS `std(i)` from `t1` latin1 latin1_swedish_ci
+select * from v1;
+stddev_samp(i) stddev_pop(i) stddev(i) std(i)
+1.5811 1.4142 1.4142 1.4142
+drop view v1;
+drop table t1;
+#
# End of 10.3 tests
#
diff --git a/mysql-test/main/func_group.test b/mysql-test/main/func_group.test
index fa1fd0f99dd..2aa816efe8b 100644
--- a/mysql-test/main/func_group.test
+++ b/mysql-test/main/func_group.test
@@ -1797,5 +1797,16 @@ DROP TABLE t1;
SET STATEMENT sql_mode=ONLY_FULL_GROUP_BY FOR EXECUTE IMMEDIATE 'ALTER TABLE mysql.time_zone_transition ORDER BY Time_zone_id, Transition_time';
--echo #
+--echo # MDEV-19071 Wrong results when using STDDEV_SAMP() and view
+--echo #
+create table t1(i int);
+insert into t1 values (1),(2),(3),(4),(5);
+create view v1 as select stddev_samp(i),stddev_pop(i),stddev(i),std(i) from t1;
+show create view v1;
+select * from v1;
+drop view v1;
+drop table t1;
+
+--echo #
--echo # End of 10.3 tests
--echo #
diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test
index 6fd1feda183..17151b1bc86 100644
--- a/mysql-test/main/gis.test
+++ b/mysql-test/main/gis.test
@@ -3092,12 +3092,15 @@ SELECT IS_USED_LOCK(POINT(1,1));
--echo #
--echo # MDEV-26161 crash in Gis_point::calculate_haversine
--echo #
+#enable after fix MDEV-30229
+--disable_view_protocol
--error ER_CANT_CREATE_GEOMETRY_OBJECT
select st_distance_sphere(x'01030000000400000004000000000000', multipoint(point(124,204)), 10);
--error ER_CANT_CREATE_GEOMETRY_OBJECT
select st_distance_sphere(x'010300000004000000040000', multipoint(point(124,204)), 10);
--error ER_CANT_CREATE_GEOMETRY_OBJECT
select st_distance_sphere(x'010300000001000000040000', multipoint(point(124,204)), 10);
+--enable_view_protocol
--echo #
--echo # End of 10.3 tests
diff --git a/mysql-test/main/group_min_max.result b/mysql-test/main/group_min_max.result
index 4b39039b533..2b8b10b29b9 100644
--- a/mysql-test/main/group_min_max.result
+++ b/mysql-test/main/group_min_max.result
@@ -4066,6 +4066,26 @@ owner_id
1
DROP TABLE t1;
#
+# MDEV-30240 Wrong result upon aggregate function with SQL_BUFFER_RESULT
+#
+drop table if exists t1,t2;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t2'
+CREATE TABLE t1 (pk INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (1),(2);
+SELECT SQL_BUFFER_RESULT MIN(pk) FROM t1, t2;
+MIN(pk)
+1
+SELECT MIN(pk) FROM t1, t2;
+MIN(pk)
+1
+DROP TABLE t1, t2;
+#
+# End of 10.5 tests
+#
+#
# MDEV-24353: Adding GROUP BY slows down a query
#
CREATE TABLE t1 (p int NOT NULL, a int NOT NULL, PRIMARY KEY (p,a));
diff --git a/mysql-test/main/group_min_max.test b/mysql-test/main/group_min_max.test
index cf9952e817d..0fa91e4d72b 100644
--- a/mysql-test/main/group_min_max.test
+++ b/mysql-test/main/group_min_max.test
@@ -1726,6 +1726,23 @@ SELECT DISTINCT owner_id FROM t1 WHERE foo = true GROUP BY owner_id HAVING (COUN
DROP TABLE t1;
--echo #
+--echo # MDEV-30240 Wrong result upon aggregate function with SQL_BUFFER_RESULT
+--echo #
+
+drop table if exists t1,t2;
+CREATE TABLE t1 (pk INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (1),(2);
+SELECT SQL_BUFFER_RESULT MIN(pk) FROM t1, t2;
+SELECT MIN(pk) FROM t1, t2;
+DROP TABLE t1, t2;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
+
+--echo #
--echo # MDEV-24353: Adding GROUP BY slows down a query
--echo #
diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result
index 6aa7d43dece..156a7a11578 100644
--- a/mysql-test/main/information_schema.result
+++ b/mysql-test/main/information_schema.result
@@ -2366,8 +2366,9 @@ Warning 1931 Query execution was interrupted. The query examined at least ### ro
# m_status == DA_OK_BULK' failed in Diagnostics_area::message()
#
call mtr.add_suppression("Sort aborted.*");
-DROP DATABASE test;
-CREATE DATABASE test;
+create database dummy;
+use dummy;
+drop database dummy;
USE test;
CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema;
SELECT * FROM v LIMIT ROWS EXAMINED 9;
diff --git a/mysql-test/main/information_schema.test b/mysql-test/main/information_schema.test
index 27f5dd6103d..7ef536c2a54 100644
--- a/mysql-test/main/information_schema.test
+++ b/mysql-test/main/information_schema.test
@@ -1939,8 +1939,9 @@ SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10;
call mtr.add_suppression("Sort aborted.*");
-DROP DATABASE test;
-CREATE DATABASE test;
+create database dummy;
+use dummy;
+drop database dummy;
USE test;
CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema;
diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result
index 3a5c975f472..10ed8960b64 100644
--- a/mysql-test/main/join_cache.result
+++ b/mysql-test/main/join_cache.result
@@ -853,7 +853,7 @@ 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 Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 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
@@ -1053,7 +1053,7 @@ 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 Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (incremental, 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
@@ -1312,7 +1312,7 @@ 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 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 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 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
@@ -1509,7 +1509,7 @@ 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 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 PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (incremental, 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
@@ -1706,7 +1706,7 @@ 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 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 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 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
@@ -1903,7 +1903,7 @@ 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 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 PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (incremental, 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
@@ -2104,7 +2104,7 @@ 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 Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 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
@@ -2208,7 +2208,7 @@ 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 Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
-1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (incremental, 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
@@ -2312,7 +2312,7 @@ 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 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 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 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
@@ -2416,7 +2416,7 @@ 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 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 PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (incremental, 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
@@ -2520,7 +2520,7 @@ 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 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 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 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
@@ -2624,7 +2624,7 @@ 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 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 PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (incremental, 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
diff --git a/mysql-test/main/log_slow.result b/mysql-test/main/log_slow.result
index 31d52ff0323..6b9fddb7fb6 100644
--- a/mysql-test/main/log_slow.result
+++ b/mysql-test/main/log_slow.result
@@ -64,7 +64,7 @@ rows_affected int(11) NO NULL
flush slow logs;
set long_query_time=0.1;
set log_slow_filter='';
-set global slow_query_log=1;
+set slow_query_log=1;
set global log_output='TABLE';
select sleep(0.5);
sleep(0.5)
@@ -73,7 +73,7 @@ select count(*) FROM mysql.slow_log;
count(*)
1
set @@long_query_time=default;
-set global slow_query_log= @org_slow_query_log;
+set @@slow_query_log=default;
set @@log_slow_filter=default;
set @@log_slow_verbosity=default;
set global log_output= default;
@@ -115,3 +115,21 @@ Slow_queries_increment
SET log_slow_filter=DEFAULT;
SET @@long_query_time=default;
SET GLOBAL slow_query_log= @org_slow_query_log;
+#
+# MDEV-21187: log_slow_filter="" logs queries not using indexes
+#
+flush status;
+create table t (id int);
+insert into t values (1),(4);
+set log_slow_filter='';
+select * from t;
+id
+1
+4
+show session status like 'Slow_queries';
+Variable_name Value
+Slow_queries 0
+drop table t;
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/log_slow.test b/mysql-test/main/log_slow.test
index b51777d859e..d2e314cf667 100644
--- a/mysql-test/main/log_slow.test
+++ b/mysql-test/main/log_slow.test
@@ -50,14 +50,14 @@ flush slow logs;
# MDEV-4206 (empty filter should be no filter)
set long_query_time=0.1;
set log_slow_filter='';
-set global slow_query_log=1;
+set slow_query_log=1;
set global log_output='TABLE';
select sleep(0.5);
select count(*) FROM mysql.slow_log;
# Reset used variables
set @@long_query_time=default;
-set global slow_query_log= @org_slow_query_log;
+set @@slow_query_log=default;
set @@log_slow_filter=default;
set @@log_slow_verbosity=default;
set global log_output= default;
@@ -102,3 +102,20 @@ SET log_slow_filter=DEFAULT;
SET @@long_query_time=default;
SET GLOBAL slow_query_log= @org_slow_query_log;
+
+--echo #
+--echo # MDEV-21187: log_slow_filter="" logs queries not using indexes
+--echo #
+
+flush status;
+create table t (id int);
+insert into t values (1),(4);
+set log_slow_filter='';
+select * from t;
+show session status like 'Slow_queries';
+
+drop table t;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result
index b9cdfba9a09..0a84b89b687 100644
--- a/mysql-test/main/mysqldump.result
+++ b/mysql-test/main/mysqldump.result
@@ -4590,6 +4590,7 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E
# MDEV-13336: add ignore-database option
# with --all-databases
#
+SET GLOBAL innodb_max_purge_lag_wait=0;
DROP DATABASE test;
SHOW DATABASES LIKE 'test';
Database (test)
diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test
index 586a05ec2f1..238d90e4cdc 100644
--- a/mysql-test/main/mysqldump.test
+++ b/mysql-test/main/mysqldump.test
@@ -1924,6 +1924,8 @@ SHOW EVENTS;
--echo # with --all-databases
--echo #
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --ignore-database test --all-databases > $MYSQLTEST_VARDIR/tmp/mysqldump-MDEV-13336.sql
+# Starting with MariaDB 10.6, ensure that DDL recovery will have completed.
+SET GLOBAL innodb_max_purge_lag_wait=0;
DROP DATABASE test;
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqldump-MDEV-13336.sql
SHOW DATABASES LIKE 'test';
diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result
index 2bc8432e5ae..f3703795970 100644
--- a/mysql-test/main/opt_trace.result
+++ b/mysql-test/main/opt_trace.result
@@ -1020,6 +1020,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
"index": "a",
"used_range_estimates": false,
"reason": "not available",
+ "rowid_filter_skipped": "cost_factor <= 0",
"rows": 1,
"cost": 200.0585794,
"chosen": true
@@ -1076,6 +1077,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
"index": "a",
"used_range_estimates": false,
"reason": "not available",
+ "rowid_filter_skipped": "cost_factor <= 0",
"rows": 1,
"cost": 200.0585794,
"chosen": true
@@ -2103,6 +2105,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
"access_type": "ref",
"index": "a_c",
"used_range_estimates": true,
+ "rowid_filter_skipped": "worst/max seeks clipping",
"rows": 180,
"cost": 180.2743776,
"chosen": true
@@ -4029,6 +4032,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"index": "a",
"used_range_estimates": false,
"reason": "not better than ref estimates",
+ "rowid_filter_skipped": "cost_factor <= 0",
"rows": 1,
"cost": 3.001757383,
"chosen": true
@@ -4085,6 +4089,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"rec_per_key_stats_missing": true,
"used_range_estimates": false,
"reason": "not better than ref estimates",
+ "rowid_filter_skipped": "worst/max seeks clipping",
"rows": 2,
"cost": 3.003514767,
"chosen": true
@@ -8193,6 +8198,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"index": "b",
"used_range_estimates": false,
"reason": "not available",
+ "rowid_filter_skipped": "cost_factor <= 0",
"rows": 1,
"cost": 20.00585794,
"chosen": true
@@ -8417,6 +8423,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"index": "a",
"used_range_estimates": false,
"reason": "not available",
+ "rowid_filter_skipped": "cost_factor <= 0",
"rows": 1,
"cost": 20.00585794,
"chosen": true
@@ -8492,6 +8499,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
"index": "a",
"used_range_estimates": false,
"reason": "not available",
+ "rowid_filter_skipped": "cost_factor <= 0",
"rows": 1,
"cost": 200.0585794,
"chosen": true
diff --git a/mysql-test/main/parser.result b/mysql-test/main/parser.result
index a74f012d7ef..50be9dc49c8 100644
--- a/mysql-test/main/parser.result
+++ b/mysql-test/main/parser.result
@@ -1907,8 +1907,19 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"abc';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"abc' at line 1
SET @@sql_mode=@save_sql_mode;
+#
+# MDEV-30151 parse error 1=2 not between/in
+#
+select 1=2 not in (3,4);
+1=2 not in (3,4)
+1
+select 1=2 not between 3 and 4;
+1=2 not between 3 and 4
+1
+#
# End of 10.3 tests
#
+#
# MDEV-19540: 10.4 allow lock options with SELECT in brackets
# which previous version do not
#
diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test
index 523ccac8003..48cda68b416 100644
--- a/mysql-test/main/parser.test
+++ b/mysql-test/main/parser.test
@@ -1684,7 +1684,15 @@ EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"abc';
SET @@sql_mode=@save_sql_mode;
+--echo #
+--echo # MDEV-30151 parse error 1=2 not between/in
+--echo #
+select 1=2 not in (3,4);
+select 1=2 not between 3 and 4;
+
+--echo #
--echo # End of 10.3 tests
+--echo #
--echo #
--echo # MDEV-19540: 10.4 allow lock options with SELECT in brackets
diff --git a/mysql-test/main/range_aria_dbt3.result b/mysql-test/main/range_aria_dbt3.result
new file mode 100644
index 00000000000..ae5a2e1329f
--- /dev/null
+++ b/mysql-test/main/range_aria_dbt3.result
@@ -0,0 +1,13 @@
+set default_storage_engine=Aria;
+CREATE DATABASE dbt3_s001;
+use dbt3_s001;
+#
+# MDEV-30325 Wrong result upon range query using index condition
+#
+SELECT COUNT(*) FROM lineitem force index (i_l_orderkey_quantity,i_l_shipdate) WHERE l_shipdate < '1994-01-01' AND l_orderkey < 800 OR l_quantity > 3 AND l_orderkey NOT IN ( 157, 1444 );
+COUNT(*)
+5056
+#
+# End of 10.5 tests
+#
+DROP DATABASE dbt3_s001;
diff --git a/mysql-test/main/range_aria_dbt3.test b/mysql-test/main/range_aria_dbt3.test
new file mode 100644
index 00000000000..89328280987
--- /dev/null
+++ b/mysql-test/main/range_aria_dbt3.test
@@ -0,0 +1,24 @@
+#
+# This is generic tests using dbt3_s001 tables
+# This file uses the Aria storage engine
+#
+
+set default_storage_engine=Aria;
+
+CREATE DATABASE dbt3_s001;
+use dbt3_s001;
+--disable_query_log
+--source include/dbt3_s001.inc
+--enable_query_log
+
+--echo #
+--echo # MDEV-30325 Wrong result upon range query using index condition
+--echo #
+
+SELECT COUNT(*) FROM lineitem force index (i_l_orderkey_quantity,i_l_shipdate) WHERE l_shipdate < '1994-01-01' AND l_orderkey < 800 OR l_quantity > 3 AND l_orderkey NOT IN ( 157, 1444 );
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
+
+DROP DATABASE dbt3_s001;
diff --git a/mysql-test/main/rowid_filter.result b/mysql-test/main/rowid_filter.result
index a83b0fdb0d1..2a546f126d1 100644
--- a/mysql-test/main/rowid_filter.result
+++ b/mysql-test/main/rowid_filter.result
@@ -354,7 +354,7 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
o_totalprice between 200000 and 230000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 Using index condition
-1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (5%) Using where; Using rowid filter
+1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where
set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
@@ -391,14 +391,6 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rowid_filter": {
- "range": {
- "key": "i_o_totalprice",
- "used_key_parts": ["o_totalprice"]
- },
- "rows": 69,
- "selectivity_pct": 4.6
- },
"rows": 1,
"filtered": 4.599999905,
"attached_condition": "orders.o_totalprice between 200000 and 230000"
@@ -413,7 +405,7 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
o_totalprice between 200000 and 230000;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 98.00 100.00 100.00 Using index condition
-1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (5%) 0.11 (10%) 4.60 100.00 Using where; Using rowid filter
+1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 4.60 11.22 Using where
set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
@@ -457,26 +449,13 @@ ANALYZE
"key_length": "4",
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rowid_filter": {
- "range": {
- "key": "i_o_totalprice",
- "used_key_parts": ["o_totalprice"]
- },
- "rows": 69,
- "selectivity_pct": 4.6,
- "r_rows": 71,
- "r_lookups": 96,
- "r_selectivity_pct": 10.41666667,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
- },
"r_loops": 98,
"rows": 1,
- "r_rows": 0.112244898,
+ "r_rows": 1,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 4.599999905,
- "r_filtered": 100,
+ "r_filtered": 11.2244898,
"attached_condition": "orders.o_totalprice between 200000 and 230000"
}
}
@@ -636,7 +615,7 @@ l_quantity > 45 AND
o_totalprice between 180000 and 230000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) Using index condition; Using where; Using rowid filter
-1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (9%) Using where; Using rowid filter
+1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where
set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
@@ -684,14 +663,6 @@ EXPLAIN
"key_length": "4",
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rowid_filter": {
- "range": {
- "key": "i_o_totalprice",
- "used_key_parts": ["o_totalprice"]
- },
- "rows": 139,
- "selectivity_pct": 9.266666667
- },
"rows": 1,
"filtered": 9.266666412,
"attached_condition": "orders.o_totalprice between 180000 and 230000"
@@ -707,7 +678,7 @@ l_quantity > 45 AND
o_totalprice between 180000 and 230000;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE lineitem range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) 60.00 (11%) 11.69 100.00 Using index condition; Using where; Using rowid filter
-1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (9%) 0.27 (25%) 9.27 100.00 Using where; Using rowid filter
+1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 9.27 26.67 Using where
set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
@@ -767,26 +738,13 @@ ANALYZE
"key_length": "4",
"used_key_parts": ["o_orderkey"],
"ref": ["dbt3_s001.lineitem.l_orderkey"],
- "rowid_filter": {
- "range": {
- "key": "i_o_totalprice",
- "used_key_parts": ["o_totalprice"]
- },
- "rows": 139,
- "selectivity_pct": 9.266666667,
- "r_rows": 144,
- "r_lookups": 59,
- "r_selectivity_pct": 25.42372881,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
- },
"r_loops": 60,
"rows": 1,
- "r_rows": 0.266666667,
+ "r_rows": 1,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 9.266666412,
- "r_filtered": 100,
+ "r_filtered": 26.66666667,
"attached_condition": "orders.o_totalprice between 180000 and 230000"
}
}
@@ -2258,7 +2216,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( pk1+1 = pk2+2 AND a1 = a2 )
WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 101 100.00 Using where
-1 PRIMARY t1 ref|filter a1,b1 a1|b1 5|4 test.t2.a2 36 (29%) 28.75 Using where; Using rowid filter
+1 PRIMARY t1 ref a1,b1 a1 5 test.t2.a2 36 28.75 Using where
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 100.00 Using index condition
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`pk2` AS `pk2`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a1` = `test`.`t2`.`a2` and `test`.`t1`.`b1` <= (/* select#2 */ select max(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`pk2` <= 1) and `test`.`t1`.`pk1` + 1 = `test`.`t2`.`pk2` + 2
@@ -2287,14 +2245,6 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a1"],
"ref": ["test.t2.a2"],
- "rowid_filter": {
- "range": {
- "key": "b1",
- "used_key_parts": ["b1"]
- },
- "rows": 115,
- "selectivity_pct": 28.75
- },
"rows": 36,
"filtered": 28.75,
"attached_condition": "t1.b1 <= (subquery#2) and t1.pk1 + 1 = t2.pk2 + 2"
diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result
index 1dda096213a..990c6b4e894 100644
--- a/mysql-test/main/rowid_filter_innodb.result
+++ b/mysql-test/main/rowid_filter_innodb.result
@@ -2206,7 +2206,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( pk1+1 = pk2+2 AND a1 = a2 )
WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 );
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 101 100.00 Using where
-1 PRIMARY t1 ref|filter a1,b1 a1|b1 5|4 test.t2.a2 36 (29%) 28.75 Using where; Using rowid filter
+1 PRIMARY t1 ref a1,b1 a1 5 test.t2.a2 36 28.75 Using where
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 100.00 Using index condition
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`pk2` AS `pk2`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a1` = `test`.`t2`.`a2` and `test`.`t1`.`b1` <= (/* select#2 */ select max(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`pk2` <= 1) and `test`.`t1`.`pk1` + 1 = `test`.`t2`.`pk2` + 2
@@ -2235,14 +2235,6 @@ EXPLAIN
"key_length": "5",
"used_key_parts": ["a1"],
"ref": ["test.t2.a2"],
- "rowid_filter": {
- "range": {
- "key": "b1",
- "used_key_parts": ["b1"]
- },
- "rows": 115,
- "selectivity_pct": 28.75
- },
"rows": 36,
"filtered": 28.75,
"attached_condition": "t1.b1 <= (subquery#2) and t1.pk1 + 1 = t2.pk2 + 2"
@@ -2918,7 +2910,7 @@ id y x
explain extended select * from t1 join t2 on t1.id = t2.x where t2.y = 2 and t1.id = 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 Using index
-1 SIMPLE t2 ref x,y y 5 const 2 100.00 Using where
+1 SIMPLE t2 index_merge x,y y,x 5,5 NULL 1 100.00 Using intersect(y,x); Using where; Using index
Warnings:
Note 1003 select 1 AS `id`,`test`.`t2`.`y` AS `y`,`test`.`t2`.`x` AS `x` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`y` = 2 and `test`.`t2`.`x` = 1
drop table t1, t2;
@@ -2955,7 +2947,7 @@ count(*)
5
explain extended select count(*) from t1 where a between 21 and 30 and b=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 ref|filter b,a b|a 5|5 const 24 (10%) 9.60 Using where; Using rowid filter
+1 SIMPLE t1 ref b,a b 5 const 24 9.60 Using where
Warnings:
Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` between 21 and 30
select * from t1 where a between 21 and 30 and b=2;
@@ -3666,7 +3658,7 @@ fi.fh in (6311439873746261694,-397087483897438286,
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index
1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where
-1 SIMPLE fi ref|filter filt_aceid,filt_fh filt_aceid|filt_fh 8|8 test.a.id 24 (14%) 14.46 Using where; Using rowid filter
+1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 24 14.46 Using where
Warnings:
Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)
set statement optimizer_switch='rowid_filter=on' for select t.id, fi.*
@@ -3782,7 +3774,7 @@ fi.fh in (6311439873746261694,-397087483897438286,
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index
1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where; Using join buffer (flat, BKA join); Rowid-ordered scan
-1 SIMPLE fi ref|filter filt_aceid,filt_fh filt_aceid|filt_fh 8|8 test.a.id 24 (14%) 14.46 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan; Using rowid filter
+1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 24 14.46 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)
set statement optimizer_switch='rowid_filter=on' for select t.id, fi.*
@@ -3912,22 +3904,9 @@ ANALYZE
"key_length": "8",
"used_key_parts": ["aceid"],
"ref": ["test.a.id"],
- "rowid_filter": {
- "range": {
- "key": "filt_fh",
- "used_key_parts": ["fh"]
- },
- "rows": 81,
- "selectivity_pct": 14.46428571,
- "r_rows": 80,
- "r_lookups": 80,
- "r_selectivity_pct": 40,
- "r_buffer_size": "REPLACED",
- "r_filling_time_ms": "REPLACED"
- },
"r_loops": 1,
"rows": 24,
- "r_rows": 32,
+ "r_rows": 80,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 14.46428585,
@@ -3938,7 +3917,7 @@ ANALYZE
"join_type": "BKA",
"mrr_type": "Rowid-ordered scan",
"attached_condition": "fi.fh in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)",
- "r_filtered": 100
+ "r_filtered": 40
}
}
]
@@ -4046,7 +4025,7 @@ WHERE t1.c1 NOT IN (SELECT t2.c1 FROM t2, t1 AS a1
WHERE t2.i1 = t1.pk AND t2.i1 BETWEEN 3 AND 5);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 60 100.00 Using where
-2 DEPENDENT SUBQUERY t2 ref|filter c1,i1 c1|i1 3|5 func 38 (25%) 25.00 Using where; Full scan on NULL key; Using rowid filter
+2 DEPENDENT SUBQUERY t2 ref c1,i1 i1 5 test.t1.pk 20 100.00 Using index condition; Using where
2 DEPENDENT SUBQUERY a1 ALL NULL NULL NULL NULL 60 100.00 Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1
diff --git a/mysql-test/main/rowid_filter_innodb_debug.result b/mysql-test/main/rowid_filter_innodb_debug.result
index 5a3fa374bd1..f82b29aa1e6 100644
--- a/mysql-test/main/rowid_filter_innodb_debug.result
+++ b/mysql-test/main/rowid_filter_innodb_debug.result
@@ -48,29 +48,3 @@ ERROR 70100: Query execution was interrupted
set debug_sync='RESET';
drop table t2,t3;
set default_storage_engine=default;
-set @save_optimizer_switch= @@optimizer_switch;
-set @save_use_stat_tables= @@use_stat_tables;
-set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
-set @@use_stat_tables=preferably;
-set optimizer_use_condition_selectivity=2;
-set optimizer_switch='rowid_filter=on';
-#
-# MDEV-22761 KILL QUERY during rowid_filter, crashes
-# (The smaller testcase)
-#
-CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4);
-set debug_sync='handler_rowid_filter_check SIGNAL killme WAIT_FOR go';
-SELECT * FROM t1 WHERE a > 0 AND b=0;
-connect con1, localhost, root,,;
-set debug_sync='now WAIT_FOR killme';
-kill query @id;
-set debug_sync='now SIGNAL go';
-connection default;
-ERROR 70100: Query execution was interrupted
-set debug_sync='RESET';
-disconnect con1;
-drop table t1;
-set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-set @@optimizer_switch=@save_optimizer_switch;
-set @@use_stat_tables=@save_use_stat_tables;
diff --git a/mysql-test/main/rowid_filter_innodb_debug.test b/mysql-test/main/rowid_filter_innodb_debug.test
index f89a2a82da8..60381658eaf 100644
--- a/mysql-test/main/rowid_filter_innodb_debug.test
+++ b/mysql-test/main/rowid_filter_innodb_debug.test
@@ -5,47 +5,3 @@ set default_storage_engine=innodb;
--source include/rowid_filter_debug_kill.inc
set default_storage_engine=default;
---source include/default_optimizer_switch.inc
---source include/count_sessions.inc
-
-set @save_optimizer_switch= @@optimizer_switch;
-set @save_use_stat_tables= @@use_stat_tables;
-set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
-
-set @@use_stat_tables=preferably;
-
-set optimizer_use_condition_selectivity=2;
-set optimizer_switch='rowid_filter=on';
-
---echo #
---echo # MDEV-22761 KILL QUERY during rowid_filter, crashes
---echo # (The smaller testcase)
---echo #
-
-CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4);
-
-let $ID= `SELECT @id := CONNECTION_ID()`;
-
-set debug_sync='handler_rowid_filter_check SIGNAL killme WAIT_FOR go';
-send SELECT * FROM t1 WHERE a > 0 AND b=0;
-
-connect (con1, localhost, root,,);
-let $ignore= `SELECT @id := $ID`;
-set debug_sync='now WAIT_FOR killme';
-kill query @id;
-set debug_sync='now SIGNAL go';
-
-connection default;
---error ER_QUERY_INTERRUPTED
-reap;
-set debug_sync='RESET';
-
-disconnect con1;
-drop table t1;
-
-set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-set @@optimizer_switch=@save_optimizer_switch;
-set @@use_stat_tables=@save_use_stat_tables;
-
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/main/select.result b/mysql-test/main/select.result
index acf08e6a8e9..93687056c91 100644
--- a/mysql-test/main/select.result
+++ b/mysql-test/main/select.result
@@ -3616,7 +3616,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where
-1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
+1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
EXPLAIN
SELECT t3.a FROM t1,t2,t3
WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
@@ -3624,7 +3624,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee') ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where
-1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
+1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
EXPLAIN
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
@@ -3632,7 +3632,7 @@ t3.c IN ('bb','ee');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si si 5 NULL 2 Using index condition; Using where
-1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
+1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
EXPLAIN
SELECT t3.a FROM t1,t2,t3
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
@@ -3640,7 +3640,7 @@ t3.c IN ('bb','ee');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si,ai si 5 NULL 2 Using index condition; Using where
-1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
+1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
DROP TABLE t1,t2,t3;
CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int);
CREATE TABLE t2 ( f11 int PRIMARY KEY );
diff --git a/mysql-test/main/select_jcl6.result b/mysql-test/main/select_jcl6.result
index 9259fa750cf..c1098e660cd 100644
--- a/mysql-test/main/select_jcl6.result
+++ b/mysql-test/main/select_jcl6.result
@@ -3627,7 +3627,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where; Rowid-ordered scan
-1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
+1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
EXPLAIN
SELECT t3.a FROM t1,t2,t3
WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
@@ -3635,7 +3635,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee') ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where; Rowid-ordered scan
-1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
+1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
EXPLAIN
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
@@ -3643,7 +3643,7 @@ t3.c IN ('bb','ee');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si si 5 NULL 2 Using index condition; Using where; Rowid-ordered scan
-1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
+1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
EXPLAIN
SELECT t3.a FROM t1,t2,t3
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
@@ -3651,7 +3651,7 @@ t3.c IN ('bb','ee');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si,ai si 5 NULL 2 Using index condition; Using where; Rowid-ordered scan
-1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
+1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
DROP TABLE t1,t2,t3;
CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int);
CREATE TABLE t2 ( f11 int PRIMARY KEY );
diff --git a/mysql-test/main/select_pkeycache.result b/mysql-test/main/select_pkeycache.result
index acf08e6a8e9..93687056c91 100644
--- a/mysql-test/main/select_pkeycache.result
+++ b/mysql-test/main/select_pkeycache.result
@@ -3616,7 +3616,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where
-1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
+1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
EXPLAIN
SELECT t3.a FROM t1,t2,t3
WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
@@ -3624,7 +3624,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee') ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where
-1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
+1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
EXPLAIN
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
@@ -3632,7 +3632,7 @@ t3.c IN ('bb','ee');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si si 5 NULL 2 Using index condition; Using where
-1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
+1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
EXPLAIN
SELECT t3.a FROM t1,t2,t3
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
@@ -3640,7 +3640,7 @@ t3.c IN ('bb','ee');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
1 SIMPLE t2 range si,ai si 5 NULL 2 Using index condition; Using where
-1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
+1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
DROP TABLE t1,t2,t3;
CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int);
CREATE TABLE t2 ( f11 int PRIMARY KEY );
diff --git a/mysql-test/main/selectivity.result b/mysql-test/main/selectivity.result
index 86c151630a2..cc82c2b0f25 100644
--- a/mysql-test/main/selectivity.result
+++ b/mysql-test/main/selectivity.result
@@ -1661,7 +1661,7 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
# gives selectivity data
explain extended select * from t1 where a in (17,51,5) and b=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 ref|filter b,a b|a 5|5 const 24 (3%) 2.90 Using where; Using rowid filter
+1 SIMPLE t1 ref b,a b 5 const 24 2.90 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (17,51,5)
drop table t1;
diff --git a/mysql-test/main/selectivity_innodb.result b/mysql-test/main/selectivity_innodb.result
index eb9b131b5a6..2ef0d2f5630 100644
--- a/mysql-test/main/selectivity_innodb.result
+++ b/mysql-test/main/selectivity_innodb.result
@@ -1673,7 +1673,7 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
# gives selectivity data
explain extended select * from t1 where a in (17,51,5) and b=2;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE t1 ref|filter b,a b|a 5|5 const 24 (3%) 2.90 Using where; Using rowid filter
+1 SIMPLE t1 ref b,a b 5 const 24 2.90 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (17,51,5)
drop table t1;
diff --git a/mysql-test/main/sp-security.result b/mysql-test/main/sp-security.result
index 8a1f46c7c35..5c62a95b34a 100644
--- a/mysql-test/main/sp-security.result
+++ b/mysql-test/main/sp-security.result
@@ -659,7 +659,9 @@ USE test;
DROP USER 'tester';
DROP USER 'Tester';
DROP DATABASE B48872;
-End of 5.0 tests.
+#
+# End of 5.0 tests.
+#
#
# Test for bug#57061 "User without privilege on routine can discover
# its existence."
@@ -804,7 +806,7 @@ DROP DATABASE u1;
DROP USER u1@localhost;
set @@global.character_set_server=@save_character_set_server;
#
-# Start of 10.5 tests
+# End of 10.2 tests
#
#
# MDEV-20366 Server crashes in get_current_user upon SET PASSWORD via SP
@@ -821,3 +823,17 @@ DROP USER foo@localhost;
#
# End of 10.5 tests
#
+#
+# MDEV-29852 SIGSEGV in mysql_create_routine or is_acl_user on 2nd execution, ASAN use-after-poison in get_current_user (sql_acl.cc)
+#
+set @cmd:="create definer=u function f(i int) returns char binary reads sql data return concat (1,i)";
+prepare s from @cmd;
+execute s;
+Warnings:
+Note 1449 The user specified as a definer ('u'@'%') does not exist
+execute s;
+ERROR 42000: FUNCTION f already exists
+drop function f;
+#
+# End of 10.6 tests
+#
diff --git a/mysql-test/main/sp-security.test b/mysql-test/main/sp-security.test
index e11e8911b60..13fdbd68a55 100644
--- a/mysql-test/main/sp-security.test
+++ b/mysql-test/main/sp-security.test
@@ -911,8 +911,9 @@ DROP USER 'tester';
DROP USER 'Tester';
DROP DATABASE B48872;
---echo End of 5.0 tests.
-
+--echo #
+--echo # End of 5.0 tests.
+--echo #
--echo #
--echo # Test for bug#57061 "User without privilege on routine can discover
@@ -1080,9 +1081,8 @@ DROP USER u1@localhost;
set @@global.character_set_server=@save_character_set_server;
-
--echo #
---echo # Start of 10.5 tests
+--echo # End of 10.2 tests
--echo #
--echo #
@@ -1102,7 +1102,20 @@ CALL p1();
DROP PROCEDURE p1;
DROP USER foo@localhost;
-
--echo #
--echo # End of 10.5 tests
--echo #
+
+--echo #
+--echo # MDEV-29852 SIGSEGV in mysql_create_routine or is_acl_user on 2nd execution, ASAN use-after-poison in get_current_user (sql_acl.cc)
+--echo #
+set @cmd:="create definer=u function f(i int) returns char binary reads sql data return concat (1,i)";
+prepare s from @cmd;
+execute s;
+--error ER_SP_ALREADY_EXISTS
+execute s;
+drop function f;
+
+--echo #
+--echo # End of 10.6 tests
+--echo #
diff --git a/mysql-test/main/stat_tables.result b/mysql-test/main/stat_tables.result
index 22f5bfafb8e..379e9737e1c 100644
--- a/mysql-test/main/stat_tables.result
+++ b/mysql-test/main/stat_tables.result
@@ -216,8 +216,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE part ALL PRIMARY NULL NULL NULL 200 Using where; Using join buffer (flat, BNL join)
1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_partkey 5 dbt3_s001.part.p_partkey 30 Using where
1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where
-1 SIMPLE orders eq_ref|filter PRIMARY,i_o_orderdate,i_o_custkey PRIMARY|i_o_orderdate 4|4 dbt3_s001.lineitem.l_orderkey 1 (27%) Using where; Using rowid filter
1 SIMPLE n2 eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1
+1 SIMPLE orders eq_ref PRIMARY,i_o_orderdate,i_o_custkey PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where
1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
1 SIMPLE n1 eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 Using where
select o_year,
diff --git a/mysql-test/main/subselect2.result b/mysql-test/main/subselect2.result
index e6363610301..7dc3c2f463c 100644
--- a/mysql-test/main/subselect2.result
+++ b/mysql-test/main/subselect2.result
@@ -132,7 +132,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where
1 PRIMARY t3 eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where
1 PRIMARY t3 eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where
-1 PRIMARY t3 ref|filter PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX FFOLDERID_IDX|CMFLDRPARNT_IDX 34|35 test.t3.PARENTID 1 (29%) Using where; Using rowid filter
+1 PRIMARY t3 eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where
drop table t1, t2, t3, t4;
CREATE TABLE t1 (a int(10) , PRIMARY KEY (a)) Engine=InnoDB;
INSERT INTO t1 VALUES (1),(2);
diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result
index b653a5099f7..aec4a5d09f2 100644
--- a/mysql-test/main/view.result
+++ b/mysql-test/main/view.result
@@ -6730,7 +6730,9 @@ DROP TABLE t1;
#
# MDEV-24314: create view with derived table without default database
#
-drop database test;
+create database dummy;
+use dummy;
+drop database dummy;
create database db1;
create table db1.t1 (a int);
insert into db1.t1 values (3),(7),(1);
@@ -6760,7 +6762,6 @@ a
drop view db1.v1;
drop table db1.t1;
drop database db1;
-create database test;
use test;
#
# MDEV-16940: update of multi-table view returning error used in SP
diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test
index f684f072eb3..c6cc9a69f93 100644
--- a/mysql-test/main/view.test
+++ b/mysql-test/main/view.test
@@ -6437,7 +6437,9 @@ DROP TABLE t1;
--echo # MDEV-24314: create view with derived table without default database
--echo #
-drop database test;
+create database dummy;
+use dummy;
+drop database dummy;
create database db1;
create table db1.t1 (a int);
@@ -6460,7 +6462,6 @@ drop view db1.v1;
drop table db1.t1;
drop database db1;
-create database test;
use test;
--echo #
diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl
index 27d62400fd5..46a51d2fa58 100755
--- a/mysql-test/mariadb-test-run.pl
+++ b/mysql-test/mariadb-test-run.pl
@@ -1832,7 +1832,7 @@ sub collect_mysqld_features_from_running_server ()
sub find_mysqld {
- my ($mysqld_basedir)= $ENV{MTR_BINDIR}|| @_;
+ my ($mysqld_basedir)= $ENV{MTR_BINDIR_FORCED} || $ENV{MTR_BINDIR} || @_;
my @mysqld_names= ("mariadbd", "mysqld", "mysqld-max-nt", "mysqld-max",
"mysqld-nt");
@@ -1843,7 +1843,7 @@ sub find_mysqld {
unshift(@mysqld_names, "mysqld-debug");
}
- return my_find_bin($bindir,
+ return my_find_bin($mysqld_basedir,
["sql", "libexec", "sbin", "bin"],
[@mysqld_names]);
}
@@ -4718,6 +4718,7 @@ sub check_expected_crash_and_restart {
mtr_verbose("Test says wait before restart") if $waits == 0;
next;
}
+ delete $ENV{MTR_BINDIR_FORCED};
# Ignore any partial or unknown command
next unless $last_line =~ /^restart/;
@@ -4725,7 +4726,13 @@ sub check_expected_crash_and_restart {
# extra command line options to add to the restarted mysqld.
# Anything other than 'wait' or 'restart:' (with a colon) will
# result in a restart with original mysqld options.
- if ($last_line =~ /restart:(.+)/) {
+ if ($last_line =~ /restart_bindir\s+(\S+)(:.+)?/) {
+ $ENV{MTR_BINDIR_FORCED}= $1;
+ if ($2) {
+ my @rest_opt= split(' ', $2);
+ $mysqld->{'restart_opts'}= \@rest_opt;
+ }
+ } elsif ($last_line =~ /restart:(.+)/) {
my @rest_opt= split(' ', $1);
$mysqld->{'restart_opts'}= \@rest_opt;
} else {
diff --git a/mysql-test/suite/funcs_2/r/innodb_charset.result b/mysql-test/suite/funcs_2/r/innodb_charset.result
index 3f4e2af12e5..399fc1d9fe7 100644
--- a/mysql-test/suite/funcs_2/r/innodb_charset.result
+++ b/mysql-test/suite/funcs_2/r/innodb_charset.result
@@ -1,3 +1,4 @@
+SET GLOBAL innodb_max_purge_lag_wait=0;
set @save_character_set_database= @@character_set_database;
DROP TABLE IF EXISTS test.t1;
SET NAMES armscii8;
diff --git a/mysql-test/suite/funcs_2/t/innodb_charset.test b/mysql-test/suite/funcs_2/t/innodb_charset.test
index da4dea44ad7..631c20352d4 100644
--- a/mysql-test/suite/funcs_2/t/innodb_charset.test
+++ b/mysql-test/suite/funcs_2/t/innodb_charset.test
@@ -9,6 +9,10 @@
--source include/no_valgrind_without_big.inc
--source include/have_innodb.inc
+# Starting with MariaDB 10.6, ensure that DDL recovery will have completed
+# before DROP DATABASE test.
+SET GLOBAL innodb_max_purge_lag_wait=0;
+
let $engine_type= InnoDB;
--source suite/funcs_2/charset/charset_master.test
diff --git a/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_innodb.result b/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_innodb.result
index b9fe877b0f2..6b7faa18da8 100644
--- a/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_innodb.result
@@ -129,7 +129,7 @@ create table t1 (a int, b int generated always as (stddev_pop(a)) virtual);
ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
# STDDEV_SAMP()
create table t1 (a int, b int generated always as (stddev_samp(a)) virtual);
-ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
+ERROR HY000: Function or expression 'stddev_samp()' cannot be used in the GENERATED ALWAYS AS clause of `b`
# STDDEV()
create table t1 (a int, b int generated always as (stddev(a)) virtual);
ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
diff --git a/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_myisam.result b/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_myisam.result
index 23fdea42488..99921c658b3 100644
--- a/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_myisam.result
+++ b/mysql-test/suite/gcol/r/gcol_blocked_sql_funcs_myisam.result
@@ -131,7 +131,7 @@ create table t1 (a int, b int generated always as (stddev_pop(a)) virtual);
ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
# STDDEV_SAMP()
create table t1 (a int, b int generated always as (stddev_samp(a)) virtual);
-ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
+ERROR HY000: Function or expression 'stddev_samp()' cannot be used in the GENERATED ALWAYS AS clause of `b`
# STDDEV()
create table t1 (a int, b int generated always as (stddev(a)) virtual);
ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
diff --git a/mysql-test/suite/innodb/r/cursor-restore-locking.result b/mysql-test/suite/innodb/r/cursor-restore-locking.result
index beeb5a87844..9a9e47fd7c2 100644
--- a/mysql-test/suite/innodb/r/cursor-restore-locking.result
+++ b/mysql-test/suite/innodb/r/cursor-restore-locking.result
@@ -11,6 +11,7 @@ SET DEBUG_SYNC = 'lock_wait_start SIGNAL first_ins_locked';
SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL first_ins_row_inserted WAIT_FOR first_ins_cont';
INSERT INTO t VALUES(10, 20);
connect con_del_2,localhost,root,,;
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET DEBUG_SYNC = 'now WAIT_FOR first_ins_locked';
SET DEBUG_SYNC = 'lock_wait_start SIGNAL second_del_locked';
DELETE FROM t WHERE b = 20;
diff --git a/mysql-test/suite/innodb/r/information_schema_grants.result b/mysql-test/suite/innodb/r/information_schema_grants.result
index feadb7b8d12..a468081db20 100644
--- a/mysql-test/suite/innodb/r/information_schema_grants.result
+++ b/mysql-test/suite/innodb/r/information_schema_grants.result
@@ -263,6 +263,7 @@ select count(*) > -1 from d_trx;
count(*) > -1
1
connection default;
+SET GLOBAL innodb_max_purge_lag_wait=0;
drop database test;
create database test;
drop user select_only@localhost;
diff --git a/mysql-test/suite/innodb/r/insert-before-delete.result b/mysql-test/suite/innodb/r/insert-before-delete.result
new file mode 100644
index 00000000000..f2d2d260294
--- /dev/null
+++ b/mysql-test/suite/innodb/r/insert-before-delete.result
@@ -0,0 +1,35 @@
+connect pause_purge,localhost,root;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+CREATE TABLE t (pk int PRIMARY KEY, sk INT UNIQUE) ENGINE=InnoDB;
+INSERT INTO t VALUES (10, 100);
+connect con1,localhost,root;
+BEGIN;
+SELECT * FROM t WHERE sk = 100 FOR UPDATE;
+pk sk
+10 100
+connect con2,localhost,root;
+SET DEBUG_SYNC="lock_wait_start SIGNAL insert_wait_started";
+INSERT INTO t VALUES (5, 100) # trx 1;
+connect con3,localhost,root;
+SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+SET DEBUG_SYNC="now WAIT_FOR insert_wait_started";
+SET DEBUG_SYNC="lock_wait_start SIGNAL delete_started_waiting";
+DELETE FROM t WHERE sk = 100 # trx 2;
+connection con1;
+SET DEBUG_SYNC="now WAIT_FOR delete_started_waiting";
+DELETE FROM t WHERE sk=100;
+COMMIT;
+disconnect con1;
+connection con2;
+disconnect con2;
+connection con3;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+disconnect con3;
+connection default;
+SELECT * FROM t;
+pk sk
+5 100
+disconnect pause_purge;
+SET DEBUG_SYNC="RESET";
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result
index dd4451deaa2..d1ba0878033 100644
--- a/mysql-test/suite/innodb/r/insert_into_empty.result
+++ b/mysql-test/suite/innodb/r/insert_into_empty.result
@@ -197,8 +197,6 @@ DROP TABLE t1;
#
# MDEV-27214 Import with disabled keys corrupts meta-data like rows, indexes, ...
#
-SET UNIQUE_CHECKS=0;
-SET FOREIGN_KEY_CHECKS=0;
CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
@@ -387,4 +385,19 @@ Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= @format;
+#
+# MDEV-30321 blob data corrupted by row_merge_write_blob_to_tmp_file()
+#
+CREATE TABLE t1 (
+`id` int(11) NOT NULL,
+`data` LONGBLOB NOT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(1, REPEAT('X', @@innodb_sort_buffer_size)),
+(2, REPEAT('X', @@innodb_sort_buffer_size));
+SELECT COUNT(*) AS nb_corrupted_rows FROM t1 WHERE data != REPEAT('X', @@innodb_sort_buffer_size);
+nb_corrupted_rows
+0
+DROP TABLE t1;
# End of 10.7 tests
diff --git a/mysql-test/suite/innodb/r/monitor.result b/mysql-test/suite/innodb/r/monitor.result
index 922c66a068f..221c92faaea 100644
--- a/mysql-test/suite/innodb/r/monitor.result
+++ b/mysql-test/suite/innodb/r/monitor.result
@@ -642,7 +642,7 @@ SET @end = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
= 'lock_rec_lock_created');
SELECT @end - @start;
@end - @start
-0
+1
# Records must not be S/X-locked if a table is X-locked.
SET @start = @end;
SET autocommit = 0;
diff --git a/mysql-test/suite/innodb/t/cursor-restore-locking.test b/mysql-test/suite/innodb/t/cursor-restore-locking.test
index a398768fc66..3514a7ed5cc 100644
--- a/mysql-test/suite/innodb/t/cursor-restore-locking.test
+++ b/mysql-test/suite/innodb/t/cursor-restore-locking.test
@@ -27,6 +27,10 @@ SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL first_ins_row_inserted WAIT_FOR fir
--send INSERT INTO t VALUES(10, 20)
--connect(con_del_2,localhost,root,,)
+# After MDEV-30225 is fixed, the following DELETE creates next-key lock for
+# unqique search for RR, and the above INSERT kills it as deadlock victim.
+# But it still requests not-gap lock for RC.
+SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET DEBUG_SYNC = 'now WAIT_FOR first_ins_locked';
SET DEBUG_SYNC = 'lock_wait_start SIGNAL second_del_locked';
###############################################################################
diff --git a/mysql-test/suite/innodb/t/information_schema_grants.test b/mysql-test/suite/innodb/t/information_schema_grants.test
index 8960db9aad9..d0b2d2db962 100644
--- a/mysql-test/suite/innodb/t/information_schema_grants.test
+++ b/mysql-test/suite/innodb/t/information_schema_grants.test
@@ -270,6 +270,8 @@ select count(*) > -1 from i_trx;
select count(*) > -1 from d_trx;
connection default;
+# Starting with MariaDB 10.6, ensure that DDL recovery will have completed.
+SET GLOBAL innodb_max_purge_lag_wait=0;
drop database test;
create database test;
drop user select_only@localhost;
diff --git a/mysql-test/suite/innodb/t/innodb-mdev7046.test b/mysql-test/suite/innodb/t/innodb-mdev7046.test
index a8c8b7da2db..cad348b1926 100644
--- a/mysql-test/suite/innodb/t/innodb-mdev7046.test
+++ b/mysql-test/suite/innodb/t/innodb-mdev7046.test
@@ -31,6 +31,8 @@ RENAME TABLE t1 TO `t2_new..............................................end`;
show warnings;
drop table t1;
+# Starting with MariaDB 10.6, ensure that DDL recovery will have completed.
+SET GLOBAL innodb_max_purge_lag_wait=0;
drop database test;
create database test;
use test;
diff --git a/mysql-test/suite/innodb/t/insert-before-delete.test b/mysql-test/suite/innodb/t/insert-before-delete.test
new file mode 100644
index 00000000000..2547b94e5ea
--- /dev/null
+++ b/mysql-test/suite/innodb/t/insert-before-delete.test
@@ -0,0 +1,72 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/count_sessions.inc
+
+--connect (pause_purge,localhost,root)
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+
+--connection default
+CREATE TABLE t (pk int PRIMARY KEY, sk INT UNIQUE) ENGINE=InnoDB;
+INSERT INTO t VALUES (10, 100);
+
+--connect (con1,localhost,root)
+BEGIN; # trx 0
+SELECT * FROM t WHERE sk = 100 FOR UPDATE;
+
+--connect (con2,localhost,root)
+SET DEBUG_SYNC="lock_wait_start SIGNAL insert_wait_started";
+# trx 1 is locked on try to read the record in secondary index during duplicates
+# check. It's the first in waiting queue, that's why it will be woken up firstly
+# when trx 0 commits.
+--send INSERT INTO t VALUES (5, 100) # trx 1
+
+--connect (con3,localhost,root)
+# MDEV-30225 is fixed only for RR
+SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+SET DEBUG_SYNC="now WAIT_FOR insert_wait_started";
+SET DEBUG_SYNC="lock_wait_start SIGNAL delete_started_waiting";
+# trx 2 can delete (5, 100) on master, but not on slave, as on slave trx 1
+# can insert (5, 100) after trx 2 positioned it's cursor. Trx 2 lock is placed
+# in waiting queue after trx 1 lock, but its persistent cursor position was
+# stored on (100, 10) record in secondary index before suspending. After trx 1
+# is committed, trx 2 will restore persistent cursor position on (100, 10). As
+# (100, 5) secondary index record was inserted before (100, 10) in logical
+# order, and (100, 10) record is delete-marked, trx 2 just continues scanning.
+#
+# Note. There can be several records with the same key in unique secondary
+# index, but only one of them must be non-delete-marked. That's why when we do
+# point query, cursor position is set in the first record in logical order, and
+# then records are iterated until either non-delete-marked record is found or
+# all records with the same unique fields are iterated.
+--send DELETE FROM t WHERE sk = 100 # trx 2
+
+--connection con1
+SET DEBUG_SYNC="now WAIT_FOR delete_started_waiting";
+DELETE FROM t WHERE sk=100; # trx 0
+COMMIT;
+--disconnect con1
+
+--connection con2
+--reap
+--disconnect con2
+
+--connection con3
+# If the bug is fixed, deadlock error will be there, as trx 2 owns
+# next-key lock waiting for trx 1, and trx 1 requests
+# insert-intention lock, conflicting with trx 2 next-key lock.
+--error ER_LOCK_DEADLOCK
+--reap
+--disconnect con3
+
+--connection default
+# If the bug is not fixed, we will see the row inserted by trx 1 here. This can
+# cause duplicate key error on slave, when some other trx tries in insert row
+# with the same secondary key, as was inserted by trx 1, and not deleted by trx
+# 2.
+SELECT * FROM t;
+
+--disconnect pause_purge
+SET DEBUG_SYNC="RESET";
+DROP TABLE t;
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test
index fab1b882868..68ae83626cb 100644
--- a/mysql-test/suite/innodb/t/insert_into_empty.test
+++ b/mysql-test/suite/innodb/t/insert_into_empty.test
@@ -216,8 +216,6 @@ DROP TABLE t1;
--echo # MDEV-27214 Import with disabled keys corrupts meta-data like rows, indexes, ...
--echo #
-SET UNIQUE_CHECKS=0;
-SET FOREIGN_KEY_CHECKS=0;
CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
@@ -233,7 +231,6 @@ SELECT TABLE_ROWS, AVG_ROW_LENGTH>0 FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
DROP TABLE t1;
-
--echo # End of 10.6 tests
--echo #
@@ -405,4 +402,21 @@ CHECK TABLE t1;
DROP TABLE t1;
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= @format;
+--echo #
+--echo # MDEV-30321 blob data corrupted by row_merge_write_blob_to_tmp_file()
+--echo #
+
+CREATE TABLE t1 (
+ `id` int(11) NOT NULL,
+ `data` LONGBLOB NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+ (1, REPEAT('X', @@innodb_sort_buffer_size)),
+ (2, REPEAT('X', @@innodb_sort_buffer_size));
+
+SELECT COUNT(*) AS nb_corrupted_rows FROM t1 WHERE data != REPEAT('X', @@innodb_sort_buffer_size);
+DROP TABLE t1;
+
--echo # End of 10.7 tests
diff --git a/mysql-test/suite/innodb/t/monitor.test b/mysql-test/suite/innodb/t/monitor.test
index 3a004b22751..d6fa3f2fbc9 100644
--- a/mysql-test/suite/innodb/t/monitor.test
+++ b/mysql-test/suite/innodb/t/monitor.test
@@ -468,6 +468,9 @@ INSERT INTO t1 VALUES(1,1,'a'),(2,9999,'b'),(3,10000,'c'),(4,4,'d');
DELETE FROM t1 WHERE a = 9999 AND b='b';
COMMIT;
+# After MDEV-30225 is fixed, the above DELETE creates next-key lock during
+# secondary index unique search. That's why the result of the following must
+# be 1.
SET @end = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
= 'lock_rec_lock_created');
SELECT @end - @start;
diff --git a/mysql-test/suite/innodb_fts/r/basic.result b/mysql-test/suite/innodb_fts/r/basic.result
index a98de60674a..a8ab0c043e4 100644
--- a/mysql-test/suite/innodb_fts/r/basic.result
+++ b/mysql-test/suite/innodb_fts/r/basic.result
@@ -5,12 +5,6 @@ body TEXT,
FULLTEXT (title,body)
) ENGINE=InnoDB;
ERROR HY000: Cannot create FULLTEXT index on temporary InnoDB table
-CREATE TABLE articles (
-id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-title VARCHAR(200),
-body TEXT,
-FULLTEXT (title,body)
-) ENGINE=InnoDB;
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...') ,
('How To Use MySQL Well','After you went through a ...'),
diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result b/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result
deleted file mode 100644
index ccd2db7425a..00000000000
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result
+++ /dev/null
@@ -1,761 +0,0 @@
-select * from information_schema.innodb_ft_default_stopword;
-value
-a
-about
-an
-are
-as
-at
-be
-by
-com
-de
-en
-for
-from
-how
-i
-in
-is
-it
-la
-of
-on
-or
-that
-the
-this
-to
-was
-what
-when
-where
-who
-will
-with
-und
-the
-www
-CREATE TABLE articles (
-id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-title VARCHAR(200),
-body TEXT,
-FULLTEXT (title,body)
-) ENGINE=InnoDB;
-INSERT INTO articles (title,body) VALUES
-('MySQL Tutorial','DBMS stands for DataBase ...') ,
-('How To Use MySQL Well','After you went through a ...'),
-('Optimizing MySQL','In this tutorial we will show ...'),
-('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
-('MySQL vs. YourSQL','In the following database comparison ...'),
-('MySQL Security','When configured properly, MySQL ...');
-SELECT * FROM articles WHERE MATCH (title,body)
-AGAINST ('the' IN NATURAL LANGUAGE MODE);
-id title body
-select @@innodb_ft_server_stopword_table;
-@@innodb_ft_server_stopword_table
-NULL
-select @@innodb_ft_enable_stopword;
-@@innodb_ft_enable_stopword
-1
-select @@innodb_ft_user_stopword_table;
-@@innodb_ft_user_stopword_table
-NULL
-set global innodb_ft_server_stopword_table = "not_defined";
-ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined'
-create table user_stopword(value varchar(30)) engine = innodb;
-set global innodb_ft_server_stopword_table = "test/user_stopword";
-drop index title on articles;
-create fulltext index idx on articles(title, body);
-SELECT * FROM articles WHERE MATCH (title,body)
-AGAINST ('the' IN NATURAL LANGUAGE MODE);
-id title body
-5 MySQL vs. YourSQL In the following database comparison ...
-CREATE TABLE articles_2 (
-id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-title VARCHAR(200),
-body TEXT,
-FULLTEXT (title,body)
-) ENGINE=InnoDB;
-INSERT INTO articles_2 (title, body)
-VALUES ('test for stopwords','this is it...');
-SELECT * FROM articles_2 WHERE MATCH (title,body)
-AGAINST ('this' IN NATURAL LANGUAGE MODE);
-id title body
-1 test for stopwords this is it...
-insert into user_stopword values("this");
-CREATE TABLE articles_3 (
-id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-title VARCHAR(200),
-body TEXT,
-FULLTEXT (title,body)
-) ENGINE=InnoDB;
-INSERT INTO articles_3 (title, body)
-VALUES ('test for stopwords','this is it...');
-SELECT * FROM articles_3 WHERE MATCH (title,body)
-AGAINST ('this' IN NATURAL LANGUAGE MODE);
-id title body
-create table user_stopword_session(value varchar(30)) engine = innodb;
-insert into user_stopword_session values("session");
-set session innodb_ft_user_stopword_table="test/user_stopword_session";
-CREATE TABLE articles_4 (
-id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-title VARCHAR(200),
-body TEXT,
-FULLTEXT (title,body)
-) ENGINE=InnoDB;
-INSERT INTO articles_4 (title, body)
-VALUES ('test for session stopwords','this should also be excluded...');
-SELECT * FROM articles_4 WHERE MATCH (title,body)
-AGAINST ('session' IN NATURAL LANGUAGE MODE);
-id title body
-SELECT * FROM articles_4 WHERE MATCH (title,body)
-AGAINST ('this' IN NATURAL LANGUAGE MODE);
-id title body
-1 test for session stopwords this should also be excluded...
-connect con1,localhost,root,,;
-CREATE TABLE articles_5 (
-id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-title VARCHAR(200),
-body TEXT,
-FULLTEXT (title,body)
-) ENGINE=InnoDB;
-INSERT INTO articles_5 (title, body)
-VALUES ('test for session stopwords','this should also be excluded...');
-SELECT * FROM articles_5 WHERE MATCH (title,body)
-AGAINST ('session' IN NATURAL LANGUAGE MODE);
-id title body
-1 test for session stopwords this should also be excluded...
-connection default;
-drop table articles;
-drop table articles_2;
-drop table articles_3;
-drop table articles_4;
-drop table articles_5;
-drop table user_stopword;
-drop table user_stopword_session;
-SET GLOBAL innodb_ft_enable_stopword=1;
-SET GLOBAL innodb_ft_server_stopword_table=default;
-CREATE TABLE articles (
-id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-title VARCHAR(200),
-body TEXT,
-FULLTEXT `idx` (title,body)
-) ENGINE=InnoDB;
-SHOW CREATE TABLE articles;
-Table Create Table
-articles CREATE TABLE `articles` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `title` varchar(200) DEFAULT NULL,
- `body` text DEFAULT NULL,
- PRIMARY KEY (`id`),
- FULLTEXT KEY `idx` (`title`,`body`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-INSERT INTO articles (title,body) VALUES
-('MySQL from Tutorial','DBMS stands for DataBase ...') ,
-('when To Use MySQL Well','After that you went through a ...'),
-('where will Optimizing MySQL','In what tutorial we will show ...'),
-('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
-('MySQL vs. YourSQL','In the following database comparison ...'),
-('MySQL Security','When configured properly, MySQL ...');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
-id title body
-INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
-id title body
-UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
-WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
-WHERE id = 7;
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-id title body
-DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE id = 7;
-id title body
-7 update the record to see will is indexed or not
-DELETE FROM articles WHERE id = 7;
-SET SESSION innodb_ft_enable_stopword = 0;
-select @@innodb_ft_enable_stopword;
-@@innodb_ft_enable_stopword
-0
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
-id title body
-INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
-id title body
-UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
-WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
-WHERE id = 8;
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-id title body
-SELECT * FROM articles WHERE id = 8;
-id title body
-8 update the record to see will is indexed or not
-DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE id = 8;
-id title body
-8 update the record to see will is indexed or not
-DELETE FROM articles WHERE id = 8;
-ALTER TABLE articles DROP INDEX idx;
-SHOW CREATE TABLE articles;
-Table Create Table
-articles CREATE TABLE `articles` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `title` varchar(200) DEFAULT NULL,
- `body` text DEFAULT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-ANALYZE TABLE articles;
-Table Op Msg_type Msg_text
-test.articles analyze status Engine-independent statistics collected
-test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
-test.articles analyze status OK
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
-id title body
-2 when To Use MySQL Well After that you went through a ...
-6 MySQL Security When configured properly, MySQL ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-1 MySQL from Tutorial DBMS stands for DataBase ...
-6 MySQL Security When configured properly, MySQL ...
-2 when To Use MySQL Well After that you went through a ...
-4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
-5 MySQL vs. YourSQL In the following database comparison ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
-id title body
-2 when To Use MySQL Well After that you went through a ...
-3 where will Optimizing MySQL In what tutorial we will show ...
-6 MySQL Security When configured properly, MySQL ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
-id title body
-1 MySQL from Tutorial DBMS stands for DataBase ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-id title body
-9 the record will not index the , will words
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
-id title body
-9 the record will not index the , will words
-UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
-WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT COUNT(*),max(id) FROM articles;
-COUNT(*) max(id)
-7 9
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-id title body
-9 update the record to see will is indexed or not
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-9 update the record to see will is indexed or not
-DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE id = 9;
-id title body
-DROP TABLE articles;
-SET SESSION innodb_ft_enable_stopword=1;
-SET GLOBAL innodb_ft_server_stopword_table=default;
-SET SESSION innodb_ft_user_stopword_table=default;
-select @@innodb_ft_server_stopword_table;
-@@innodb_ft_server_stopword_table
-NULL
-select @@innodb_ft_enable_stopword;
-@@innodb_ft_enable_stopword
-1
-select @@innodb_ft_user_stopword_table;
-@@innodb_ft_user_stopword_table
-NULL
-CREATE TABLE articles (
-id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-title VARCHAR(200),
-body TEXT,
-FULLTEXT `idx` (title,body)
-) ENGINE=InnoDB;
-INSERT INTO articles (title,body) VALUES
-('MySQL from Tutorial','DBMS stands for DataBase ...') ,
-('when To Use MySQL Well','After that you went through a ...'),
-('where will Optimizing MySQL','In what tutorial we will show ...'),
-('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
-('MySQL vs. YourSQL','In the following database comparison ...'),
-('MySQL Security','When configured properly, MySQL ...');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-id title body
-create table user_stopword(value varchar(30)) engine = innodb;
-set session innodb_ft_user_stopword_table = "test/user_stopword";
-create table server_stopword(value varchar(30)) engine = innodb;
-set global innodb_ft_server_stopword_table = "test/server_stopword";
-insert into user_stopword values("this"),("will"),("the");
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-id title body
-insert into server_stopword values("what"),("where");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-DELETE FROM user_stopword;
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-insert into user_stopword values("this"),("will"),("the");
-ALTER TABLE articles DROP INDEX idx;
-SET SESSION innodb_ft_enable_stopword = 0;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SET SESSION innodb_ft_enable_stopword = 1;
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-id title body
-SET SESSION innodb_ft_enable_stopword = 1;
-SET SESSION innodb_ft_user_stopword_table = default;
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-DROP TABLE articles,user_stopword,server_stopword;
-SET SESSION innodb_ft_enable_stopword=1;
-SET GLOBAL innodb_ft_server_stopword_table=default;
-SET SESSION innodb_ft_user_stopword_table=default;
-select @@innodb_ft_server_stopword_table;
-@@innodb_ft_server_stopword_table
-NULL
-select @@innodb_ft_enable_stopword;
-@@innodb_ft_enable_stopword
-1
-select @@innodb_ft_user_stopword_table;
-@@innodb_ft_user_stopword_table
-NULL
-CREATE TABLE articles (
-id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-title VARCHAR(200),
-body TEXT,
-FULLTEXT `idx` (title,body)
-) ENGINE=InnoDB;
-SHOW CREATE TABLE articles;
-Table Create Table
-articles CREATE TABLE `articles` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `title` varchar(200) DEFAULT NULL,
- `body` text DEFAULT NULL,
- PRIMARY KEY (`id`),
- FULLTEXT KEY `idx` (`title`,`body`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-INSERT INTO articles (title,body) VALUES
-('MySQL from Tutorial','DBMS stands for DataBase ...') ,
-('when To Use MySQL Well','After that you went through a ...'),
-('where will Optimizing MySQL','In what tutorial we will show ...'),
-('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
-('MySQL vs. YourSQL','In the following database comparison ...'),
-('MySQL Security','When configured properly, MySQL ...');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-id title body
-create table user_stopword(value varchar(30)) engine = innodb;
-set session innodb_ft_user_stopword_table = "test/user_stopword";
-insert into user_stopword values("mysqld"),("DBMS");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
-id title body
-1 MySQL from Tutorial DBMS stands for DataBase ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
-id title body
-4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
-id title body
-set session innodb_ft_user_stopword_table = default;
-create table server_stopword(value varchar(30)) engine = innodb;
-set global innodb_ft_server_stopword_table = "test/server_stopword";
-insert into server_stopword values("root"),("properly");
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
-id title body
-set session innodb_ft_user_stopword_table = "test/user_stopword";
-set global innodb_ft_server_stopword_table = "test/server_stopword";
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
-id title body
-4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
-id title body
-6 MySQL Security When configured properly, MySQL ...
-set session innodb_ft_user_stopword_table = "test/user_stopword";
-DELETE FROM user_stopword;
-set global innodb_ft_server_stopword_table = "test/server_stopword";
-DELETE FROM server_stopword;
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
-id title body
-4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
-id title body
-6 MySQL Security When configured properly, MySQL ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
-id title body
-1 MySQL from Tutorial DBMS stands for DataBase ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
-id title body
-4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
-DROP TABLE articles,user_stopword,server_stopword;
-SET SESSION innodb_ft_enable_stopword=1;
-SET GLOBAL innodb_ft_server_stopword_table=default;
-SET SESSION innodb_ft_user_stopword_table=default;
-CREATE TABLE articles (
-id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
-title VARCHAR(200),
-body TEXT,
-FULLTEXT `idx` (title,body)
-) ENGINE=InnoDB;
-SHOW CREATE TABLE articles;
-Table Create Table
-articles CREATE TABLE `articles` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `title` varchar(200) DEFAULT NULL,
- `body` text DEFAULT NULL,
- PRIMARY KEY (`id`),
- FULLTEXT KEY `idx` (`title`,`body`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
-INSERT INTO articles (title,body) VALUES
-('MySQL from Tutorial','DBMS stands for DataBase ...') ,
-('when To Use MySQL Well','After that you went through a ...'),
-('where will Optimizing MySQL','In what tutorial we will show ...'),
-('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
-('MySQL vs. YourSQL','In the following database comparison ...'),
-('MySQL Security','When configured properly, MySQL ...');
-SET SESSION innodb_ft_enable_stopword = 0;
-select @@innodb_ft_enable_stopword;
-@@innodb_ft_enable_stopword
-0
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-connection con1;
-select @@innodb_ft_enable_stopword;
-@@innodb_ft_enable_stopword
-1
-ANALYZE TABLE articles;
-Table Op Msg_type Msg_text
-test.articles analyze status Engine-independent statistics collected
-test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
-test.articles analyze status OK
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
-id title body
-2 when To Use MySQL Well After that you went through a ...
-6 MySQL Security When configured properly, MySQL ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-1 MySQL from Tutorial DBMS stands for DataBase ...
-6 MySQL Security When configured properly, MySQL ...
-2 when To Use MySQL Well After that you went through a ...
-4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
-5 MySQL vs. YourSQL In the following database comparison ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
-id title body
-2 when To Use MySQL Well After that you went through a ...
-3 where will Optimizing MySQL In what tutorial we will show ...
-6 MySQL Security When configured properly, MySQL ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
-id title body
-1 MySQL from Tutorial DBMS stands for DataBase ...
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SET SESSION innodb_ft_enable_stopword = 1;
-select @@innodb_ft_enable_stopword;
-@@innodb_ft_enable_stopword
-1
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
-id title body
-connection default;
-select @@innodb_ft_enable_stopword;
-@@innodb_ft_enable_stopword
-0
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
-id title body
-INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
-id title body
-SET SESSION innodb_ft_enable_stopword = 1;
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
-id title body
-connection con1;
-SET SESSION innodb_ft_enable_stopword = 1;
-create table user_stopword(value varchar(30)) engine = innodb;
-set session innodb_ft_user_stopword_table = "test/user_stopword";
-insert into user_stopword values("this"),("will"),("the");
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-id title body
-connection default;
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-id title body
-select @@innodb_ft_user_stopword_table;
-@@innodb_ft_user_stopword_table
-NULL
-create table user_stopword_1(value varchar(30)) engine = innodb;
-set session innodb_ft_user_stopword_table = "test/user_stopword_1";
-insert into user_stopword_1 values("when");
-SET SESSION innodb_ft_enable_stopword = 1;
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
-id title body
-2 when To Use MySQL Well After that you went through a ...
-6 MySQL Security When configured properly, MySQL ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
-id title body
-2 when To Use MySQL Well After that you went through a ...
-6 MySQL Security When configured properly, MySQL ...
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
-id title body
-connection con1;
-SET SESSION innodb_ft_enable_stopword = 1;
-SET SESSION innodb_ft_user_stopword_table=default;
-select @@innodb_ft_user_stopword_table;
-@@innodb_ft_user_stopword_table
-NULL
-select @@innodb_ft_server_stopword_table;
-@@innodb_ft_server_stopword_table
-NULL
-create table server_stopword(value varchar(30)) engine = innodb;
-SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
-select @@innodb_ft_server_stopword_table;
-@@innodb_ft_server_stopword_table
-test/server_stopword
-insert into server_stopword values("when"),("the");
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
-id title body
-disconnect con1;
-connection default;
-SET SESSION innodb_ft_enable_stopword = 1;
-SET SESSION innodb_ft_user_stopword_table=default;
-select @@innodb_ft_server_stopword_table;
-@@innodb_ft_server_stopword_table
-test/server_stopword
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-insert into server_stopword values("where"),("will");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
-id title body
-3 where will Optimizing MySQL In what tutorial we will show ...
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
-id title body
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
-id title body
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
-id title body
-DROP TABLE articles,user_stopword,user_stopword_1,server_stopword;
-SET SESSION innodb_ft_enable_stopword=1;
-SET GLOBAL innodb_ft_server_stopword_table=default;
-SET SESSION innodb_ft_user_stopword_table=default;
diff --git a/mysql-test/suite/innodb_fts/r/misc_debug.result b/mysql-test/suite/innodb_fts/r/misc_debug.result
index 11df7d89f0b..cdfc4ff489a 100644
--- a/mysql-test/suite/innodb_fts/r/misc_debug.result
+++ b/mysql-test/suite/innodb_fts/r/misc_debug.result
@@ -68,7 +68,7 @@ DROP TABLE t1;
CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100))ENGINE=InnoDB;
SET DEBUG_DBUG="+d,stats_lock_fail";
ALTER TABLE t1 ADD FULLTEXT(f2);
-ERROR HY000: Got error 15 "Block device required" from storage engine InnoDB
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SET debug_dbug=@saved_debug_dbug;
ALTER TABLE t1 DISCARD TABLESPACE;
ALTER TABLE t1 ADD FULLTEXT(f2);
diff --git a/mysql-test/suite/innodb_fts/r/stopword,vers.rdiff b/mysql-test/suite/innodb_fts/r/stopword,vers.rdiff
new file mode 100644
index 00000000000..7405c47c41d
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/stopword,vers.rdiff
@@ -0,0 +1,192 @@
+--- stopword.result
++++ stopword,vers.reject
+@@ -46,7 +46,7 @@
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+-) ENGINE=InnoDB;
++) WITH SYSTEM VERSIONING ENGINE=InnoDB;
+ INSERT INTO articles (title,body) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+@@ -60,7 +60,7 @@
+ set global innodb_ft_server_stopword_table = "not_defined";
+ ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined'
+ set global innodb_ft_server_stopword_table = NULL;
+-create table user_stopword(value varchar(30)) engine = innodb;
++create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
+ set global innodb_ft_server_stopword_table = "test/user_stopword";
+ drop index title on articles;
+ create fulltext index idx on articles(title, body);
+@@ -73,7 +73,7 @@
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+-) ENGINE=InnoDB;
++) WITH SYSTEM VERSIONING ENGINE=InnoDB;
+ INSERT INTO articles_2 (title, body)
+ VALUES ('test for stopwords','this is it...');
+ SELECT * FROM articles_2 WHERE MATCH (title,body)
+@@ -88,13 +88,13 @@
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+-) ENGINE=InnoDB;
++) WITH SYSTEM VERSIONING ENGINE=InnoDB;
+ INSERT INTO articles_3 (title, body)
+ VALUES ('test for stopwords','this is it...');
+ SELECT * FROM articles_3 WHERE MATCH (title,body)
+ AGAINST ('this' IN NATURAL LANGUAGE MODE);
+ id title body
+-create table user_stopword_session(value varchar(30)) engine = innodb;
++create table user_stopword_session(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
+ insert into user_stopword values("this");
+ delete from user_stopword;
+ insert into user_stopword_session values("session");
+@@ -104,7 +104,7 @@
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+-) ENGINE=InnoDB;
++) WITH SYSTEM VERSIONING ENGINE=InnoDB;
+ INSERT INTO articles_4 (title, body)
+ VALUES ('test for session stopwords','this should also be excluded...');
+ SELECT * FROM articles_4 WHERE MATCH (title,body)
+@@ -120,7 +120,7 @@
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+-) ENGINE=InnoDB;
++) WITH SYSTEM VERSIONING ENGINE=InnoDB;
+ INSERT INTO articles_5 (title, body)
+ VALUES ('test for session stopwords','this should also be excluded...');
+ SELECT * FROM articles_5 WHERE MATCH (title,body)
+@@ -142,7 +142,7 @@
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT `idx` (title,body)
+-) ENGINE=InnoDB;
++) WITH SYSTEM VERSIONING ENGINE=InnoDB;
+ SHOW CREATE TABLE articles;
+ Table Create Table
+ articles CREATE TABLE `articles` (
+@@ -151,7 +151,7 @@
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`title`,`body`)
+-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ INSERT INTO articles (title,body) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+@@ -248,7 +248,7 @@
+ `title` varchar(200) DEFAULT NULL,
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`)
+-) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
++) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+ ANALYZE TABLE articles;
+ Table Op Msg_type Msg_text
+@@ -320,7 +320,7 @@
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT `idx` (title,body)
+-) ENGINE=InnoDB;
++) WITH SYSTEM VERSIONING ENGINE=InnoDB;
+ INSERT INTO articles (title,body) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+@@ -332,9 +332,9 @@
+ id title body
+ SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+ id title body
+-create table user_stopword(value varchar(30)) engine = innodb;
++create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
+ set session innodb_ft_user_stopword_table = "test/user_stopword";
+-create table server_stopword(value varchar(30)) engine = innodb;
++create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
+ set global innodb_ft_server_stopword_table = "test/server_stopword";
+ insert into user_stopword values("when"),("where");
+ delete from user_stopword;
+@@ -419,7 +419,7 @@
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT `idx` (title,body)
+-) ENGINE=InnoDB;
++) WITH SYSTEM VERSIONING ENGINE=InnoDB;
+ SHOW CREATE TABLE articles;
+ Table Create Table
+ articles CREATE TABLE `articles` (
+@@ -428,7 +428,7 @@
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`title`,`body`)
+-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ INSERT INTO articles (title,body) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+@@ -440,7 +440,7 @@
+ id title body
+ SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+ id title body
+-create table user_stopword(value varchar(30)) engine = innodb;
++create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
+ set session innodb_ft_user_stopword_table = "test/user_stopword";
+ insert into user_stopword values("mysqld"),("DBMS");
+ SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+@@ -466,7 +466,7 @@
+ SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+ id title body
+ set session innodb_ft_user_stopword_table = default;
+-create table server_stopword(value varchar(30)) engine = innodb;
++create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
+ set global innodb_ft_server_stopword_table = "test/server_stopword";
+ insert into server_stopword values("root"),("properly");
+ ALTER TABLE articles DROP INDEX idx;
+@@ -530,7 +530,7 @@
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT `idx` (title,body)
+-) ENGINE=InnoDB;
++) WITH SYSTEM VERSIONING ENGINE=InnoDB;
+ SHOW CREATE TABLE articles;
+ Table Create Table
+ articles CREATE TABLE `articles` (
+@@ -539,7 +539,7 @@
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`title`,`body`)
+-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ INSERT INTO articles (title,body) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+@@ -656,7 +656,7 @@
+ "In connection 1"
+ connection con1;
+ SET SESSION innodb_ft_enable_stopword = 1;
+-create table user_stopword(value varchar(30)) engine = innodb;
++create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
+ set session innodb_ft_user_stopword_table = "test/user_stopword";
+ insert into user_stopword values("this"),("will"),("the");
+ ALTER TABLE articles DROP INDEX idx;
+@@ -674,7 +674,7 @@
+ select @@innodb_ft_user_stopword_table;
+ @@innodb_ft_user_stopword_table
+ NULL
+-create table user_stopword_1(value varchar(30)) engine = innodb;
++create table user_stopword_1(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
+ set session innodb_ft_user_stopword_table = "test/user_stopword_1";
+ insert into user_stopword_1 values("when");
+ SET SESSION innodb_ft_enable_stopword = 1;
+@@ -702,7 +702,7 @@
+ select @@innodb_ft_server_stopword_table;
+ @@innodb_ft_server_stopword_table
+ NULL
+-create table server_stopword(value varchar(30)) engine = innodb;
++create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
+ SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
+ select @@innodb_ft_server_stopword_table;
+ @@innodb_ft_server_stopword_table
diff --git a/mysql-test/suite/innodb_fts/r/stopword.result b/mysql-test/suite/innodb_fts/r/stopword.result
index 06990528b81..aa6f51aac76 100644
--- a/mysql-test/suite/innodb_fts/r/stopword.result
+++ b/mysql-test/suite/innodb_fts/r/stopword.result
@@ -1,3 +1,6 @@
+SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table;
+SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword;
+SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table;
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
select * from information_schema.innodb_ft_default_stopword;
@@ -54,9 +57,6 @@ INSERT INTO articles (title,body) VALUES
SELECT * FROM articles WHERE MATCH (title,body)
AGAINST ('the' IN NATURAL LANGUAGE MODE);
id title body
-SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table;
-SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword;
-SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table;
set global innodb_ft_server_stopword_table = "not_defined";
ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined'
set global innodb_ft_server_stopword_table = NULL;
@@ -80,6 +80,8 @@ SELECT * FROM articles_2 WHERE MATCH (title,body)
AGAINST ('this' IN NATURAL LANGUAGE MODE);
id title body
1 test for stopwords this is it...
+insert into user_stopword values("the");
+delete from user_stopword;
insert into user_stopword values("this");
CREATE TABLE articles_3 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
@@ -93,6 +95,8 @@ SELECT * FROM articles_3 WHERE MATCH (title,body)
AGAINST ('this' IN NATURAL LANGUAGE MODE);
id title body
create table user_stopword_session(value varchar(30)) engine = innodb;
+insert into user_stopword values("this");
+delete from user_stopword;
insert into user_stopword_session values("session");
set session innodb_ft_user_stopword_table="test/user_stopword_session";
CREATE TABLE articles_4 (
@@ -334,6 +338,8 @@ create table user_stopword(value varchar(30)) engine = innodb;
set session innodb_ft_user_stopword_table = "test/user_stopword";
create table server_stopword(value varchar(30)) engine = innodb;
set global innodb_ft_server_stopword_table = "test/server_stopword";
+insert into user_stopword values("when"),("where");
+delete from user_stopword;
insert into user_stopword values("this"),("will"),("the");
ALTER TABLE articles DROP INDEX idx;
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
diff --git a/mysql-test/suite/innodb_fts/r/versioning,prepare.result b/mysql-test/suite/innodb_fts/r/versioning,prepare.result
new file mode 100644
index 00000000000..ada4f30d80c
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/versioning,prepare.result
@@ -0,0 +1,695 @@
+# Upgrade test
+CREATE TEMPORARY TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+ERROR HY000: Cannot create FULLTEXT index on temporary InnoDB table
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+)with system versioning ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+INSERT INTO articles (title,body) VALUES
+('test query expansion','for database ...');
+INSERT INTO articles (title,body) VALUES
+('test proximity search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO articles (title,body) VALUES
+('test my proximity fts new search, test, proximity and phrase',
+'search, with proximity innodb');
+INSERT INTO articles (title,body) VALUES
+('test more of proximity fts search, test, more proximity and phrase',
+'search, with proximity innodb');
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
+select * from information_schema.innodb_ft_default_stopword;
+value
+a
+about
+an
+are
+as
+at
+be
+by
+com
+de
+en
+for
+from
+how
+i
+in
+is
+it
+la
+of
+on
+or
+that
+the
+this
+to
+was
+what
+when
+where
+who
+will
+with
+und
+the
+www
+CREATE TABLE articles2 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+)with system versioning ENGINE=InnoDB;
+INSERT INTO articles2 (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles2 WHERE MATCH (title,body)
+AGAINST ('the' IN NATURAL LANGUAGE MODE);
+id title body
+set global innodb_ft_server_stopword_table = "not_defined";
+ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined'
+set global innodb_ft_server_stopword_table = NULL;
+create table user_stopword(value varchar(30)) engine = innodb;
+set global innodb_ft_server_stopword_table = "test/user_stopword";
+drop index title on articles2;
+create fulltext index idx on articles2(title, body);
+insert into articles2 (title, body)
+values ('test for stopwords','this is it...');
+insert into user_stopword values("the");
+delete from user_stopword;
+insert into user_stopword values("this");
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+ERROR HY000: Index articles is corrupted
+call mtr.add_suppression("test/articles.? contains 3 indexes inside InnoDB");
+alter table articles force;
+Warnings:
+Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
+flush tables;
+show create table articles;
+Table Create Table
+articles CREATE TABLE `articles` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(200) DEFAULT NULL,
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `title` (`title`,`body`)
+) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+5 MySQL vs. YourSQL In the following database comparison ...
+7 test query expansion for database ...
+SELECT COUNT(*) FROM articles
+WHERE MATCH (title,body)
+AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+3
+SELECT * FROM articles
+WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT COUNT(IF(MATCH (title,body)
+AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
+AS count FROM articles;
+count
+3
+SELECT id, body, MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score
+FROM articles;
+id body score
+1 DBMS stands for DataBase ... 0.2734021842479706
+2 After you went through a ... 0
+3 In this tutorial we will show ... 0
+4 1. Never run mysqld as root. 2. ... 0
+5 In the following database comparison ... 0.2734021842479706
+6 When configured properly, MySQL ... 0
+7 for database ... 0.2734021842479706
+8 search, with proximity innodb 0
+9 search, with proximity innodb 0
+10 search, with proximity innodb 0
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('DBMS Security' IN BOOLEAN MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('t*' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+7 test query expansion for database ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('MY*' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('ru*' IN BOOLEAN MODE);
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE);
+id title body
+2 How To Use MySQL Well After you went through a ...
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+ERROR HY000: Table handler out of memory
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
+ IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+ERROR 42000: syntax error, unexpected $end
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+ERROR 42000: syntax error, unexpected $end
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
+id title body
+2 How To Use MySQL Well After you went through a ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
+id title body
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE);
+id title body
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT COUNT(*) FROM articles
+WHERE MATCH (title,body)
+AGAINST ('database' WITH QUERY EXPANSION);
+COUNT(*)
+10
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('test' WITH QUERY EXPANSION);
+id title body
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+7 test query expansion for database ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"following comparison"@3' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"following comparison"@2' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"following database"' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"proximity search"@5' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@1' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@4' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"more test proximity"@4' IN BOOLEAN MODE);
+id title body
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+id title body
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"more test proximity"' IN BOOLEAN MODE);
+id title body
+set global innodb_ft_server_stopword_table= "test/user_stopword";
+SELECT * FROM articles2 WHERE MATCH (title,body)
+AGAINST ('the' IN NATURAL LANGUAGE MODE);
+SELECT * FROM articles2 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+drop index idx on articles2;
+Warnings:
+Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
+create fulltext index idx on articles2(title, body);
+SELECT * FROM articles2 WHERE MATCH (title,body)
+AGAINST ('the' IN NATURAL LANGUAGE MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles2 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+id title body
+# Downgrade test
+alter table articles force;
+Warnings:
+Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
+Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
+flush tables;
+show create table articles;
+Table Create Table
+articles CREATE TABLE `articles` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(200) DEFAULT NULL,
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `title` (`title`,`body`)
+) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+5 MySQL vs. YourSQL In the following database comparison ...
+7 test query expansion for database ...
+SELECT COUNT(*) FROM articles
+WHERE MATCH (title,body)
+AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+3
+SELECT * FROM articles
+WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT COUNT(IF(MATCH (title,body)
+AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
+AS count FROM articles;
+count
+3
+SELECT id, body, MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score
+FROM articles;
+id body score
+1 DBMS stands for DataBase ... 0.2734021842479706
+2 After you went through a ... 0
+3 In this tutorial we will show ... 0
+4 1. Never run mysqld as root. 2. ... 0
+5 In the following database comparison ... 0.2734021842479706
+6 When configured properly, MySQL ... 0
+7 for database ... 0.2734021842479706
+8 search, with proximity innodb 0
+9 search, with proximity innodb 0
+10 search, with proximity innodb 0
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('DBMS Security' IN BOOLEAN MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('t*' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+7 test query expansion for database ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('MY*' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('ru*' IN BOOLEAN MODE);
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE);
+id title body
+2 How To Use MySQL Well After you went through a ...
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+ERROR HY000: Table handler out of memory
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
+ IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+ERROR 42000: syntax error, unexpected $end
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+ERROR 42000: syntax error, unexpected $end
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
+id title body
+2 How To Use MySQL Well After you went through a ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
+id title body
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE);
+id title body
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT COUNT(*) FROM articles
+WHERE MATCH (title,body)
+AGAINST ('database' WITH QUERY EXPANSION);
+COUNT(*)
+10
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('test' WITH QUERY EXPANSION);
+id title body
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+7 test query expansion for database ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"following comparison"@3' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"following comparison"@2' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"following database"' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"proximity search"@5' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@1' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@4' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"more test proximity"@4' IN BOOLEAN MODE);
+id title body
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+id title body
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"more test proximity"' IN BOOLEAN MODE);
+id title body
+set global innodb_ft_server_stopword_table= "test/user_stopword";
+drop index idx on articles2;
+Warnings:
+Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
+Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
+create fulltext index idx on articles2(title, body);
+SELECT * FROM articles2 WHERE MATCH (title,body)
+AGAINST ('the' IN NATURAL LANGUAGE MODE);
+id title body
+SELECT * FROM articles2 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+id title body
+# Cleanup
+drop tables articles, articles2, user_stopword;
+set global innodb_ft_server_stopword_table= default;
diff --git a/mysql-test/suite/innodb_fts/r/versioning.result b/mysql-test/suite/innodb_fts/r/versioning.result
new file mode 100644
index 00000000000..baf25331d0d
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/versioning.result
@@ -0,0 +1,304 @@
+# Upgrade test
+DROP TABLE mysql.innodb_table_stats, mysql.innodb_index_stats;
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+ERROR HY000: Index articles is corrupted
+call mtr.add_suppression("test/articles.? contains 3 indexes inside InnoDB");
+alter table articles force;
+Warnings:
+Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
+flush tables;
+show create table articles;
+Table Create Table
+articles CREATE TABLE `articles` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(200) DEFAULT NULL,
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `title` (`title`,`body`)
+) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+5 MySQL vs. YourSQL In the following database comparison ...
+7 test query expansion for database ...
+SELECT COUNT(*) FROM articles
+WHERE MATCH (title,body)
+AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+3
+SELECT * FROM articles
+WHERE MATCH (title, body)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT COUNT(IF(MATCH (title,body)
+AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
+AS count FROM articles;
+count
+3
+SELECT id, body, MATCH (title,body)
+AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score
+FROM articles;
+id body score
+1 DBMS stands for DataBase ... 0.2734021842479706
+2 After you went through a ... 0
+3 In this tutorial we will show ... 0
+4 1. Never run mysqld as root. 2. ... 0
+5 In the following database comparison ... 0.2734021842479706
+6 When configured properly, MySQL ... 0
+7 for database ... 0.2734021842479706
+8 search, with proximity innodb 0
+9 search, with proximity innodb 0
+10 search, with proximity innodb 0
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('DBMS Security' IN BOOLEAN MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('t*' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+7 test query expansion for database ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('MY*' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('ru*' IN BOOLEAN MODE);
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE);
+id title body
+2 How To Use MySQL Well After you went through a ...
+6 MySQL Security When configured properly, MySQL ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+ERROR HY000: Table handler out of memory
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+id title body
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
+ IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+ERROR 42000: syntax error, unexpected $end
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+ERROR 42000: syntax error, unexpected $end
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
+id title body
+2 How To Use MySQL Well After you went through a ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE);
+id title body
+1 MySQL Tutorial DBMS stands for DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
+id title body
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE);
+id title body
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT COUNT(*) FROM articles
+WHERE MATCH (title,body)
+AGAINST ('database' WITH QUERY EXPANSION);
+COUNT(*)
+10
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('test' WITH QUERY EXPANSION);
+id title body
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+7 test query expansion for database ...
+1 MySQL Tutorial DBMS stands for DataBase ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"following comparison"@3' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"following comparison"@2' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"following database"' IN BOOLEAN MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"proximity search"@5' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@1' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@4' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+id title body
+8 test proximity search, test, proximity and phrase search, with proximity innodb
+9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"more test proximity"@4' IN BOOLEAN MODE);
+id title body
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+id title body
+10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
+SELECT * FROM articles
+WHERE MATCH (title,body)
+AGAINST ('"more test proximity"' IN BOOLEAN MODE);
+id title body
+set global innodb_ft_server_stopword_table= "test/user_stopword";
+SELECT * FROM articles2 WHERE MATCH (title,body)
+AGAINST ('the' IN NATURAL LANGUAGE MODE);
+SELECT * FROM articles2 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+drop index idx on articles2;
+Warnings:
+Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
+create fulltext index idx on articles2(title, body);
+SELECT * FROM articles2 WHERE MATCH (title,body)
+AGAINST ('the' IN NATURAL LANGUAGE MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles2 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+id title body
+# Cleanup
+drop tables articles, articles2, user_stopword;
+set global innodb_ft_server_stopword_table= default;
diff --git a/mysql-test/suite/innodb_fts/t/basic.inc b/mysql-test/suite/innodb_fts/t/basic.inc
new file mode 100644
index 00000000000..fd7d09208bc
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/basic.inc
@@ -0,0 +1,264 @@
+if ($basic_stage == create_table)
+{
+# Create FTS table
+--error ER_INNODB_NO_FT_TEMP_TABLE
+CREATE TEMPORARY TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+--disable_query_log
+eval CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ )$create_options ENGINE=InnoDB;
+--enable_query_log
+}
+
+if ($basic_stage == insert_1)
+{
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+}
+
+if ($basic_stage == select_1)
+{
+# Look for 'Database' in table article
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('Database' IN NATURAL LANGUAGE MODE);
+
+SELECT COUNT(*) FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+SELECT * FROM articles
+ WHERE MATCH (title, body)
+ AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+
+SELECT COUNT(IF(MATCH (title,body)
+ AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
+ AS count FROM articles;
+
+# Select Relevance Ranking
+SELECT id, body, MATCH (title,body)
+ AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score
+ FROM articles;
+
+# 'MySQL' treated as stopword (stopword functionality not yet supported)
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
+
+# Boolean search
+# Select rows contain "MySQL" but not "YourSQL"
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
+
+# Select rows contain at least one of the two words
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('DBMS Security' IN BOOLEAN MODE);
+
+# Select rows contain both "MySQL" and "YourSQL"
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
+
+# Select rows contain "MySQL" but rank rows with "YourSQL" higher
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE);
+
+# Test negation operator. Select rows contain MySQL,
+# if the row contains "YourSQL", rank it lower
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE);
+
+# Test wild card search operator
+# Notice row with "the" will not get fetched due to
+# stopword filtering
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('t*' IN BOOLEAN MODE);
+
+# Test wild card search, notice row 6 with 2 "MySQL" rank first
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('MY*' IN BOOLEAN MODE);
+
+# Another wild card search
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('ru*' IN BOOLEAN MODE);
+
+# Test ">" and "<" Operator, the ">" operator increases
+# the word relevance rank and the "<" operator decreases it
+# Following test puts rows with "Well" on top and rows
+# with "stands" at the bottom
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE);
+
+# Test sub-expression boolean search. Find rows contain
+# "MySQL" but not "Well" or "stands".
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
+
+--error 128
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
+ IN BOOLEAN MODE);
+
+--error ER_PARSE_ERROR
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+--error ER_PARSE_ERROR
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST
+('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
+ IN BOOLEAN MODE);
+
+# Test sub-expression boolean search. Find rows contain
+# "MySQL" and "Well" or "MySQL" and "stands". But rank the
+# doc with "Well" higher, and doc with "stands" lower.
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
+
+# Test nested sub-expression.
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE);
+
+# Find rows with "MySQL" but not "Tricks", "Security" nor "YourSQL"
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE);
+
+# Test non-word delimiter combined with negate "-" operator
+# This should return the same result as 'mysql - (Security DBMS)'
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE);
+
+# Again, the operator sequence should not matter
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
+
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
+
+# Test query expansion
+SELECT COUNT(*) FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('database' WITH QUERY EXPANSION);
+}
+
+if ($basic_stage == insert_2)
+{
+INSERT INTO articles (title,body) VALUES
+ ('test query expansion','for database ...');
+}
+
+if ($basic_stage == select_2)
+{
+# This query will return result containing word "database" as
+# the query expand from "test" to words in document just
+# inserted above
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('test' WITH QUERY EXPANSION);
+
+# This is to test the proximity search, search two word
+# "following" and "comparison" within 19 character space
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"following comparison"@3' IN BOOLEAN MODE);
+
+# This is to test the proximity search, search two word
+# "following" and "comparison" within 19 character space
+# This search should come with no return result
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"following comparison"@2' IN BOOLEAN MODE);
+
+# This is to test the phrase search, searching phrase
+# "following database"
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"following database"' IN BOOLEAN MODE);
+}
+
+if ($basic_stage == insert_3)
+{
+# Insert into table with similar word of different distances
+INSERT INTO articles (title,body) VALUES
+ ('test proximity search, test, proximity and phrase',
+ 'search, with proximity innodb');
+
+INSERT INTO articles (title,body) VALUES
+ ('test my proximity fts new search, test, proximity and phrase',
+ 'search, with proximity innodb');
+
+INSERT INTO articles (title,body) VALUES
+ ('test more of proximity fts search, test, more proximity and phrase',
+ 'search, with proximity innodb');
+}
+
+if ($basic_stage == select_3)
+{
+# This should only return the first document
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
+
+# This would return no document
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
+
+# This give you all three documents
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"proximity search"@5' IN BOOLEAN MODE);
+
+# Similar boundary testing for the words
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
+
+# No document will be returned
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"test proximity"@1' IN BOOLEAN MODE);
+
+# All three documents will be returned
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"test proximity"@4' IN BOOLEAN MODE);
+
+# Only two document will be returned.
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+
+# Test with more word The last document will return, please notice there
+# is no ordering requirement for proximity search.
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"more test proximity"@4' IN BOOLEAN MODE);
+
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+
+# The phrase search will not require exact word ordering
+SELECT * FROM articles
+ WHERE MATCH (title,body)
+ AGAINST ('"more test proximity"' IN BOOLEAN MODE);
+}
diff --git a/mysql-test/suite/innodb_fts/t/basic.test b/mysql-test/suite/innodb_fts/t/basic.test
index 53ad978a5b1..df2e24fae8e 100644
--- a/mysql-test/suite/innodb_fts/t/basic.test
+++ b/mysql-test/suite/innodb_fts/t/basic.test
@@ -1,252 +1,33 @@
# This is the basic function tests for innodb FTS
-- source include/have_innodb.inc
+--let $modify_create_table= 1
+-- source include/maybe_versioning.inc
-# Create FTS table
---error ER_INNODB_NO_FT_TEMP_TABLE
-CREATE TEMPORARY TABLE articles (
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
- title VARCHAR(200),
- body TEXT,
- FULLTEXT (title,body)
- ) ENGINE=InnoDB;
+let $basic_stage= create_table;
+--source basic.inc
-CREATE TABLE articles (
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
- title VARCHAR(200),
- body TEXT,
- FULLTEXT (title,body)
- ) ENGINE=InnoDB;
-
-# Insert six rows
-INSERT INTO articles (title,body) VALUES
- ('MySQL Tutorial','DBMS stands for DataBase ...') ,
- ('How To Use MySQL Well','After you went through a ...'),
- ('Optimizing MySQL','In this tutorial we will show ...'),
- ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
- ('MySQL vs. YourSQL','In the following database comparison ...'),
- ('MySQL Security','When configured properly, MySQL ...');
+let $basic_stage= insert_1;
+--source basic.inc
-- disable_result_log
ANALYZE TABLE articles;
-- enable_result_log
-# Look for 'Database' in table article
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('Database' IN NATURAL LANGUAGE MODE);
-
-SELECT COUNT(*) FROM articles
- WHERE MATCH (title,body)
- AGAINST ('database' IN NATURAL LANGUAGE MODE);
-
-SELECT * FROM articles
- WHERE MATCH (title, body)
- AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
-
-
-SELECT COUNT(IF(MATCH (title,body)
- AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
- AS count FROM articles;
-
-# Select Relevance Ranking
-SELECT id, body, MATCH (title,body)
- AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score
- FROM articles;
-
-# 'MySQL' treated as stopword (stopword functionality not yet supported)
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
-
-# Boolean search
-# Select rows contain "MySQL" but not "YourSQL"
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
-
-# Select rows contain at least one of the two words
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('DBMS Security' IN BOOLEAN MODE);
-
-# Select rows contain both "MySQL" and "YourSQL"
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
-
-# Select rows contain "MySQL" but rank rows with "YourSQL" higher
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE);
-
-# Test negation operator. Select rows contain MySQL,
-# if the row contains "YourSQL", rank it lower
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE);
-
-# Test wild card search operator
-# Notice row with "the" will not get fetched due to
-# stopword filtering
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('t*' IN BOOLEAN MODE);
-
-# Test wild card search, notice row 6 with 2 "MySQL" rank first
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('MY*' IN BOOLEAN MODE);
-
-# Another wild card search
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('ru*' IN BOOLEAN MODE);
-
-# Test ">" and "<" Operator, the ">" operator increases
-# the word relevance rank and the "<" operator decreases it
-# Following test puts rows with "Well" on top and rows
-# with "stands" at the bottom
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE);
-
-# Test sub-expression boolean search. Find rows contain
-# "MySQL" but not "Well" or "stands".
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
-
---error 128
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST
-('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
- IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST
-('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
- IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST
-('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
- IN BOOLEAN MODE);
-
---error ER_PARSE_ERROR
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST
-('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
- IN BOOLEAN MODE);
---error ER_PARSE_ERROR
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST
-('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
- IN BOOLEAN MODE);
-
-# Test sub-expression boolean search. Find rows contain
-# "MySQL" and "Well" or "MySQL" and "stands". But rank the
-# doc with "Well" higher, and doc with "stands" lower.
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
-
-# Test nested sub-expression.
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE);
-
-# Find rows with "MySQL" but not "Tricks", "Security" nor "YourSQL"
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE);
-
-# Test non-word delimiter combined with negate "-" operator
-# This should return the same result as 'mysql - (Security DBMS)'
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE);
-
-# Again, the operator sequence should not matter
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
-
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
-
-# Test query expansion
-SELECT COUNT(*) FROM articles
- WHERE MATCH (title,body)
- AGAINST ('database' WITH QUERY EXPANSION);
-
-INSERT INTO articles (title,body) VALUES
- ('test query expansion','for database ...');
-
-# This query will return result containing word "database" as
-# the query expand from "test" to words in document just
-# inserted above
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('test' WITH QUERY EXPANSION);
-
-# This is to test the proximity search, search two word
-# "following" and "comparison" within 19 character space
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"following comparison"@3' IN BOOLEAN MODE);
-
-# This is to test the proximity search, search two word
-# "following" and "comparison" within 19 character space
-# This search should come with no return result
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"following comparison"@2' IN BOOLEAN MODE);
-
-# This is to test the phrase search, searching phrase
-# "following database"
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"following database"' IN BOOLEAN MODE);
-
-# Insert into table with similar word of different distances
-INSERT INTO articles (title,body) VALUES
- ('test proximity search, test, proximity and phrase',
- 'search, with proximity innodb');
-
-INSERT INTO articles (title,body) VALUES
- ('test my proximity fts new search, test, proximity and phrase',
- 'search, with proximity innodb');
-
-INSERT INTO articles (title,body) VALUES
- ('test more of proximity fts search, test, more proximity and phrase',
- 'search, with proximity innodb');
-
-# This should only return the first document
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
-
-# This would return no document
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
-
-# This give you all three documents
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"proximity search"@5' IN BOOLEAN MODE);
-
-# Similar boundary testing for the words
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
-
-# No document will be returned
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"test proximity"@1' IN BOOLEAN MODE);
-
-# All three documents will be returned
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"test proximity"@4' IN BOOLEAN MODE);
+let $basic_stage= select_1;
+--source basic.inc
-# Only two document will be returned.
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
+let $basic_stage= insert_2;
+--source basic.inc
-# Test with more word The last document will return, please notice there
-# is no ordering requirement for proximity search.
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"more test proximity"@4' IN BOOLEAN MODE);
+let $basic_stage= select_2;
+--source basic.inc
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
+let $basic_stage= insert_3;
+--source basic.inc
-# The phrase search will not require exact word ordering
-SELECT * FROM articles
- WHERE MATCH (title,body)
- AGAINST ('"more test proximity"' IN BOOLEAN MODE);
+let $basic_stage= select_3;
+--source basic.inc
drop table articles;
diff --git a/mysql-test/suite/innodb_fts/t/crash_recovery.test b/mysql-test/suite/innodb_fts/t/crash_recovery.test
index b8da55a8ba6..cb53de4d595 100644
--- a/mysql-test/suite/innodb_fts/t/crash_recovery.test
+++ b/mysql-test/suite/innodb_fts/t/crash_recovery.test
@@ -8,6 +8,7 @@
--source include/not_embedded.inc
--source include/maybe_debug.inc
if ($have_debug) { source include/have_debug_sync.inc; }
+--source include/maybe_versioning.inc
FLUSH TABLES;
# Following are test for crash recovery on FTS index, the first scenario
@@ -23,6 +24,16 @@ CREATE TABLE articles (
FULLTEXT (title,body)
) ENGINE=InnoDB;
+let $vers= $MTR_COMBINATION_VERS + $MTR_COMBINATION_VERS_TRX;
+if ($vers)
+{
+ --disable_query_log
+ INSERT INTO articles (title,body) VALUES
+ ('history','Deleted row ...');
+ DELETE FROM articles;
+ --enable_query_log
+}
+
# Drop the FTS index before more insertion. The FTS_DOC_ID should
# be kept
DROP INDEX title ON articles;
@@ -118,6 +129,13 @@ INSERT INTO articles (title,body) VALUES
# Recreate fulltext index to see if everything is OK
CREATE FULLTEXT INDEX idx ON articles (title,body);
+if ($vers)
+{
+ --disable_query_log
+ UPDATE articles SET id= id - 1;
+ --enable_query_log
+}
+
# Should return 3 rows
SELECT * FROM articles
WHERE MATCH (title,body)
@@ -159,6 +177,13 @@ disconnect dml;
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...');
+if ($vers)
+{
+ --disable_query_log
+ UPDATE articles SET id= id - 1 WHERE id > 8;
+ --enable_query_log
+}
+
# Should return 6 rows
SELECT * FROM articles
WHERE MATCH (title,body)
@@ -195,6 +220,15 @@ BEGIN;
INSERT INTO articles VALUES
(100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');
+if ($vers)
+{
+ --disable_query_log
+ DELETE FROM articles WHERE id = 100;
+ INSERT INTO articles VALUES
+ (100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');
+ --enable_query_log
+}
+
connect(dml2, localhost, root,,);
--echo #
diff --git a/mysql-test/suite/innodb_fts/t/create.test b/mysql-test/suite/innodb_fts/t/create.test
index edecef64589..e6a7e993f84 100644
--- a/mysql-test/suite/innodb_fts/t/create.test
+++ b/mysql-test/suite/innodb_fts/t/create.test
@@ -1,4 +1,5 @@
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
SET NAMES utf8mb4;
--echo #
diff --git a/mysql-test/suite/innodb_fts/t/fulltext2.test b/mysql-test/suite/innodb_fts/t/fulltext2.test
index 25a4d5b24f9..7efd9adeeac 100644
--- a/mysql-test/suite/innodb_fts/t/fulltext2.test
+++ b/mysql-test/suite/innodb_fts/t/fulltext2.test
@@ -7,6 +7,7 @@
#
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
CREATE TABLE t1 (
i int(10) unsigned not null auto_increment primary key,
@@ -212,7 +213,17 @@ delete from t1 limit 1;
#
# BUG#16489: utf8 + fulltext leads to corrupt index file.
#
+if ($MTR_COMBINATION_ORIG)
+{
truncate table t1;
+}
+if (!$MTR_COMBINATION_ORIG)
+{
+--disable_query_log
+delete from t1;
+--enable_query_log
+--echo truncate table t1;
+}
insert into t1 values('ab c d');
update t1 set a='ab c d';
select * from t1 where match a against('ab c' in boolean mode);
diff --git a/mysql-test/suite/innodb_fts/t/fulltext3.test b/mysql-test/suite/innodb_fts/t/fulltext3.test
index 9c7941d7b5c..f28ca2c7d77 100644
--- a/mysql-test/suite/innodb_fts/t/fulltext3.test
+++ b/mysql-test/suite/innodb_fts/t/fulltext3.test
@@ -3,6 +3,7 @@
# test of new fulltext search features
#
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/innodb_fts/t/fulltext_cache.test b/mysql-test/suite/innodb_fts/t/fulltext_cache.test
index fa7ad49e881..37926c1e7f1 100644
--- a/mysql-test/suite/innodb_fts/t/fulltext_cache.test
+++ b/mysql-test/suite/innodb_fts/t/fulltext_cache.test
@@ -2,6 +2,7 @@
# Bugreport due to Roy Nasser <roy@vem.ca>
#
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
--disable_warnings
drop table if exists t1, t2;
diff --git a/mysql-test/suite/innodb_fts/t/fulltext_distinct.test b/mysql-test/suite/innodb_fts/t/fulltext_distinct.test
index f6232704543..bb390a08384 100644
--- a/mysql-test/suite/innodb_fts/t/fulltext_distinct.test
+++ b/mysql-test/suite/innodb_fts/t/fulltext_distinct.test
@@ -3,6 +3,7 @@
# bug reported by Tibor Simko <tibor.simko@cern.ch>
#
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
diff --git a/mysql-test/suite/innodb_fts/t/fulltext_left_join.test b/mysql-test/suite/innodb_fts/t/fulltext_left_join.test
index 23bbd5ddc10..0a1e1748769 100644
--- a/mysql-test/suite/innodb_fts/t/fulltext_left_join.test
+++ b/mysql-test/suite/innodb_fts/t/fulltext_left_join.test
@@ -2,6 +2,7 @@
# Test for bug from Jean-Cédric COSTA <jean-cedric.costa@ensmp.fr>
#
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
--disable_warnings
drop table if exists t1, t2;
diff --git a/mysql-test/suite/innodb_fts/t/fulltext_multi.test b/mysql-test/suite/innodb_fts/t/fulltext_multi.test
index 274027ea10b..81ab7e1b071 100644
--- a/mysql-test/suite/innodb_fts/t/fulltext_multi.test
+++ b/mysql-test/suite/innodb_fts/t/fulltext_multi.test
@@ -1,5 +1,6 @@
# several FULLTEXT indexes in one table test
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/innodb_fts/t/fulltext_order_by.test b/mysql-test/suite/innodb_fts/t/fulltext_order_by.test
index d2194f22e2a..f14681b934d 100644
--- a/mysql-test/suite/innodb_fts/t/fulltext_order_by.test
+++ b/mysql-test/suite/innodb_fts/t/fulltext_order_by.test
@@ -1,5 +1,6 @@
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3;
diff --git a/mysql-test/suite/innodb_fts/t/fulltext_update.test b/mysql-test/suite/innodb_fts/t/fulltext_update.test
index 336e8de1d1b..bda97cd4a21 100644
--- a/mysql-test/suite/innodb_fts/t/fulltext_update.test
+++ b/mysql-test/suite/innodb_fts/t/fulltext_update.test
@@ -2,6 +2,7 @@
# Test for bug by voi@ims.at
#
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
--disable_warnings
drop table if exists test;
diff --git a/mysql-test/suite/innodb_fts/t/fulltext_var.test b/mysql-test/suite/innodb_fts/t/fulltext_var.test
index 2b94aa58424..e8e4bf93303 100644
--- a/mysql-test/suite/innodb_fts/t/fulltext_var.test
+++ b/mysql-test/suite/innodb_fts/t/fulltext_var.test
@@ -2,6 +2,7 @@
# Fulltext configurable parameters
#
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
# Save ft_boolean_syntax variable
let $saved_ft_boolean_syntax=`select @@global.ft_boolean_syntax`;
diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
index 1ed164492d5..31f10399bc2 100644
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
+++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
@@ -1,6 +1,7 @@
# This is the DDL function tests for innodb FTS
-- source include/have_innodb.inc
+-- source include/maybe_versioning.inc
# Create FTS table
CREATE TABLE fts_test (
@@ -54,7 +55,21 @@ SELECT * FROM fts_test WHERE MATCH (title,body)
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
# Truncate table
+let $vers=$MTR_COMBINATION_VERS+$MTR_COMBINATION_VERS_TRX;
+
+if ($vers)
+{
+--disable_query_log
+CREATE TABLE fts_test2 LIKE fts_test;
+DROP TABLE fts_test;
+RENAME TABLE fts_test2 TO fts_test;
+--enable_query_log
+--echo TRUNCATE TABLE fts_test;
+}
+if (!$vers)
+{
TRUNCATE TABLE fts_test;
+}
DROP INDEX idx ON fts_test;
diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test b/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test
index 669aa69e835..2d94c21398c 100644
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test
+++ b/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test
@@ -1,6 +1,7 @@
# This is the basic function tests for innodb FTS
-- source include/have_innodb.inc
+-- source include/maybe_versioning.inc
call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns.");
call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`articles`");
diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.opt b/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.opt
deleted file mode 100644
index 2b0652d08c3..00000000000
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb-ft-default-stopword
diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.test b/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.test
deleted file mode 100644
index 0f29d092541..00000000000
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-stopword.test
+++ /dev/null
@@ -1,664 +0,0 @@
-# This is the basic function tests for innodb FTS
-
--- source include/have_innodb.inc
-
-
-select * from information_schema.innodb_ft_default_stopword;
-
-# Create FTS table
-CREATE TABLE articles (
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
- title VARCHAR(200),
- body TEXT,
- FULLTEXT (title,body)
- ) ENGINE=InnoDB;
-
-# Insert six rows
-INSERT INTO articles (title,body) VALUES
- ('MySQL Tutorial','DBMS stands for DataBase ...') ,
- ('How To Use MySQL Well','After you went through a ...'),
- ('Optimizing MySQL','In this tutorial we will show ...'),
- ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
- ('MySQL vs. YourSQL','In the following database comparison ...'),
- ('MySQL Security','When configured properly, MySQL ...');
-
-# "the" is in the default stopword, it would not be selected
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('the' IN NATURAL LANGUAGE MODE);
-
-let $innodb_ft_server_stopword_table_orig=`select @@innodb_ft_server_stopword_table`;
-let $innodb_ft_enable_stopword_orig=`select @@innodb_ft_enable_stopword`;
-let $innodb_ft_user_stopword_table_orig=`select @@innodb_ft_user_stopword_table`;
-
-select @@innodb_ft_server_stopword_table;
-select @@innodb_ft_enable_stopword;
-select @@innodb_ft_user_stopword_table;
-
-# Provide user defined stopword table, if not (correctly) defined,
-# it will be rejected
---error 1231
-set global innodb_ft_server_stopword_table = "not_defined";
-
-# Define a correct formated user stopword table
-create table user_stopword(value varchar(30)) engine = innodb;
-
-# The set operation should be successful
-set global innodb_ft_server_stopword_table = "test/user_stopword";
-
-drop index title on articles;
-
-create fulltext index idx on articles(title, body);
-
-# Now we should be able to find "the"
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('the' IN NATURAL LANGUAGE MODE);
-
-# Nothing inserted into the default stopword, so essentially
-# nothing get screened. The new stopword could only be
-# effective for table created thereafter
-CREATE TABLE articles_2 (
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
- title VARCHAR(200),
- body TEXT,
- FULLTEXT (title,body)
- ) ENGINE=InnoDB;
-
-INSERT INTO articles_2 (title, body)
- VALUES ('test for stopwords','this is it...');
-
-# Now we can find record with "this"
-SELECT * FROM articles_2 WHERE MATCH (title,body)
- AGAINST ('this' IN NATURAL LANGUAGE MODE);
-
-# Ok, let's instantiate some value into user supplied stop word
-# table
-insert into user_stopword values("this");
-
-# Ok, let's repeat with the new table again.
-CREATE TABLE articles_3 (
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
- title VARCHAR(200),
- body TEXT,
- FULLTEXT (title,body)
- ) ENGINE=InnoDB;
-
-INSERT INTO articles_3 (title, body)
- VALUES ('test for stopwords','this is it...');
-
-# Now we should NOT find record with "this"
-SELECT * FROM articles_3 WHERE MATCH (title,body)
- AGAINST ('this' IN NATURAL LANGUAGE MODE);
-
-# Test session level stopword control "innodb_user_stopword_table"
-create table user_stopword_session(value varchar(30)) engine = innodb;
-
-insert into user_stopword_session values("session");
-
-set session innodb_ft_user_stopword_table="test/user_stopword_session";
-
-CREATE TABLE articles_4 (
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
- title VARCHAR(200),
- body TEXT,
- FULLTEXT (title,body)
- ) ENGINE=InnoDB;
-
-INSERT INTO articles_4 (title, body)
- VALUES ('test for session stopwords','this should also be excluded...');
-
-# "session" is excluded
-SELECT * FROM articles_4 WHERE MATCH (title,body)
- AGAINST ('session' IN NATURAL LANGUAGE MODE);
-
-# But we can find record with "this"
-SELECT * FROM articles_4 WHERE MATCH (title,body)
- AGAINST ('this' IN NATURAL LANGUAGE MODE);
-
---connect (con1,localhost,root,,)
-CREATE TABLE articles_5 (
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
- title VARCHAR(200),
- body TEXT,
- FULLTEXT (title,body)
- ) ENGINE=InnoDB;
-
-INSERT INTO articles_5 (title, body)
- VALUES ('test for session stopwords','this should also be excluded...');
-
-# "session" should be found since the stopword table is session specific
-SELECT * FROM articles_5 WHERE MATCH (title,body)
- AGAINST ('session' IN NATURAL LANGUAGE MODE);
-
---connection default
-drop table articles;
-drop table articles_2;
-drop table articles_3;
-drop table articles_4;
-drop table articles_5;
-drop table user_stopword;
-drop table user_stopword_session;
-
-eval SET GLOBAL innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
-eval SET GLOBAL innodb_ft_server_stopword_table=default;
-
-#---------------------------------------------------------------------------------------
-# Behavior :
-# The stopword is loaded into memory at
-# 1) create fulltext index time,
-# 2) boot server,
-# 3) first time FTs is used
-# So if you already created a FTS index, and then turn off stopword
-# or change stopword table content it won't affect the FTS
-# that already created since the stopword list are already loaded.
-# It will only affect the new FTS index created after you changed
-# the settings.
-
-# Create FTS table
-CREATE TABLE articles (
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
- title VARCHAR(200),
- body TEXT,
- FULLTEXT `idx` (title,body)
- ) ENGINE=InnoDB;
-
-SHOW CREATE TABLE articles;
-
-# Insert six rows
-INSERT INTO articles (title,body) VALUES
- ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
- ('when To Use MySQL Well','After that you went through a ...'),
- ('where will Optimizing MySQL','In what tutorial we will show ...'),
- ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
- ('MySQL vs. YourSQL','In the following database comparison ...'),
- ('MySQL Security','When configured properly, MySQL ...');
-
-# Case : server_stopword=default
-# Try to Search default stopword from innodb, "where", "will", "what"
-# and "when" are all stopwords
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
-# boolean No result expected
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
-# no result expected
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
-# no result expected
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
-
-INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
-# Not going to update as where condition can not find record
-UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
-WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-# Update the record
-UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
-WHERE id = 7;
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-# Delete will not work as where condition do not return
-DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE id = 7;
-DELETE FROM articles WHERE id = 7;
-
-
-
-# Case : Turn OFF stopword list variable and search stopword on OLD index.
-# disable stopword list
-#SET global innodb_ft_server_stopword_table = "";
-SET SESSION innodb_ft_enable_stopword = 0;
-select @@innodb_ft_enable_stopword;
-#SET global innodb_ft_user_stopword_table = "";
-
-# search default stopword with innodb_ft_enable_stopword is OFF.
-# No records expected even though we turned OFF stopwod filtering
-# (refer Behavior (at the top of the test) for explanation )
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
-
-INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
-# Not going to update as where condition can not find record
-UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
-WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-# Update the record
-UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
-WHERE id = 8;
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-SELECT * FROM articles WHERE id = 8;
-# Delete will not work as where condition do not return
-DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE id = 8;
-DELETE FROM articles WHERE id = 8;
-
-# Case : Turn OFF stopword list variable and search stopword on NEW index.
-# Drop index
-ALTER TABLE articles DROP INDEX idx;
-SHOW CREATE TABLE articles;
-
-# Create the FTS index Using Alter Table.
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-
-ANALYZE TABLE articles;
-
-# search default stopword with innodb_ft_enable_stopword is OFF.
-# All records expected as stopwod filtering is OFF and we created
-# new FTS index.
-# (refer Behavior (at the top of the test) for explanation )
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
-
-INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
-# Update will succeed.
-UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
-WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-
-SELECT COUNT(*),max(id) FROM articles;
-# Update the record - uncommet on fix
-#UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
-#WHERE id = 9;
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-# Delete will succeed.
-DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE id = 9;
-
-
-DROP TABLE articles;
-
-eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
-#eval SET GLOBAL innodb_ft_server_stopword_table=$innodb_ft_server_stopword_table_orig;
-eval SET GLOBAL innodb_ft_server_stopword_table=default;
-#eval SET GLOBAL innodb_ft_user_stopword_table=$innodb_ft_user_stopword_table_orig;
-eval SET SESSION innodb_ft_user_stopword_table=default;
-
-#---------------------------------------------------------------------------------------
-
-select @@innodb_ft_server_stopword_table;
-select @@innodb_ft_enable_stopword;
-select @@innodb_ft_user_stopword_table;
-
-# Create FTS table
-CREATE TABLE articles (
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
- title VARCHAR(200),
- body TEXT,
- FULLTEXT `idx` (title,body)
- ) ENGINE=InnoDB;
-
-# Insert six rows
-INSERT INTO articles (title,body) VALUES
- ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
- ('when To Use MySQL Well','After that you went through a ...'),
- ('where will Optimizing MySQL','In what tutorial we will show ...'),
- ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
- ('MySQL vs. YourSQL','In the following database comparison ...'),
- ('MySQL Security','When configured properly, MySQL ...');
-
-# No records expeced for select
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-# Define a correct formated user stopword table
-create table user_stopword(value varchar(30)) engine = innodb;
-# The set operation should be successful
-set session innodb_ft_user_stopword_table = "test/user_stopword";
-# Define a correct formated server stopword table
-create table server_stopword(value varchar(30)) engine = innodb;
-# The set operation should be successful
-set global innodb_ft_server_stopword_table = "test/server_stopword";
-# Add values into user supplied stop word table
-insert into user_stopword values("this"),("will"),("the");
-
-# Drop existing index and create the FTS index Using Alter Table.
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-
-# Add values into server supplied stop word table
-insert into server_stopword values("what"),("where");
-# Follwoing should return result as server stopword list was empty at create index time
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-
-# Delete stopword from user list
-DELETE FROM user_stopword;
-# Drop existing index and create the FTS index Using Alter Table.
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-# Follwoing should return result even though to server stopword list
-# conatin these words. Session level stopword list takes priority
-# Here user_stopword is set using innodb_ft_user_stopword_table
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-
-# Follwoing should return result as user stopword list was empty at create index time
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-
-# Add values into user supplied stop word table
-insert into user_stopword values("this"),("will"),("the");
-
-# Drop existing index and create the FTS index Using Alter Table.
-ALTER TABLE articles DROP INDEX idx;
-SET SESSION innodb_ft_enable_stopword = 0;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-
-# Session level stopword list takes priority
-SET SESSION innodb_ft_enable_stopword = 1;
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-
-# Make user stopword list deafult so as to server stopword list takes priority
-SET SESSION innodb_ft_enable_stopword = 1;
-SET SESSION innodb_ft_user_stopword_table = default;
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-
-
-DROP TABLE articles,user_stopword,server_stopword;
-
-# Restore Defaults
-eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
-eval SET GLOBAL innodb_ft_server_stopword_table=default;
-eval SET SESSION innodb_ft_user_stopword_table=default;
-select @@innodb_ft_server_stopword_table;
-select @@innodb_ft_enable_stopword;
-select @@innodb_ft_user_stopword_table;
-
-#---------------------------------------------------------------------------------------
-# Create FTS table
-CREATE TABLE articles (
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
- title VARCHAR(200),
- body TEXT,
- FULLTEXT `idx` (title,body)
- ) ENGINE=InnoDB;
-
-SHOW CREATE TABLE articles;
-
-# Insert six rows
-INSERT INTO articles (title,body) VALUES
- ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
- ('when To Use MySQL Well','After that you went through a ...'),
- ('where will Optimizing MySQL','In what tutorial we will show ...'),
- ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
- ('MySQL vs. YourSQL','In the following database comparison ...'),
- ('MySQL Security','When configured properly, MySQL ...');
-
-# No records expeced for select
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-# Define a correct formated user stopword table
-create table user_stopword(value varchar(30)) engine = innodb;
-# The set operation should be successful
-set session innodb_ft_user_stopword_table = "test/user_stopword";
-insert into user_stopword values("mysqld"),("DBMS");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
-
-
-# Drop existing index and create the FTS index Using Alter Table.
-# user stopword list will take effect.
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
-
-# set user stopword list empty
-set session innodb_ft_user_stopword_table = default;
-# Define a correct formated user stopword table
-create table server_stopword(value varchar(30)) engine = innodb;
-# The set operation should be successful
-set global innodb_ft_server_stopword_table = "test/server_stopword";
-insert into server_stopword values("root"),("properly");
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
-
-
-# set user stopword list empty
-set session innodb_ft_user_stopword_table = "test/user_stopword";
-# The set operation should be successful
-set global innodb_ft_server_stopword_table = "test/server_stopword";
-# user stopword list take effect as its session level
-# Result expected for select
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
-
-# set user stopword list
-set session innodb_ft_user_stopword_table = "test/user_stopword";
-DELETE FROM user_stopword;
-# The set operation should be successful
-set global innodb_ft_server_stopword_table = "test/server_stopword";
-DELETE FROM server_stopword;
-# user stopword list take affect as its session level
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
-
-DROP TABLE articles,user_stopword,server_stopword;
-
-# Restore Values
-eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
-eval SET GLOBAL innodb_ft_server_stopword_table=default;
-eval SET SESSION innodb_ft_user_stopword_table=default;
-
-
-#------------------------------------------------------------------------------
-# FTS stopword list test - check varaibles across sessions
-
-# Create FTS table
-CREATE TABLE articles (
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
- title VARCHAR(200),
- body TEXT,
- FULLTEXT `idx` (title,body)
- ) ENGINE=InnoDB;
-
-SHOW CREATE TABLE articles;
-
-# Insert six rows
-INSERT INTO articles (title,body) VALUES
- ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
- ('when To Use MySQL Well','After that you went through a ...'),
- ('where will Optimizing MySQL','In what tutorial we will show ...'),
- ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
- ('MySQL vs. YourSQL','In the following database comparison ...'),
- ('MySQL Security','When configured properly, MySQL ...');
-
-# session varaible innodb_ft_enable_stopword=0 will take effect for new FTS index
-SET SESSION innodb_ft_enable_stopword = 0;
-select @@innodb_ft_enable_stopword;
-
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-
-
---connection con1
-select @@innodb_ft_enable_stopword;
-
-ANALYZE TABLE articles;
-
-# result expected as index created before setting innodb_ft_enable_stopword varaible off
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
-
-SET SESSION innodb_ft_enable_stopword = 1;
-select @@innodb_ft_enable_stopword;
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-# no result expected turned innodb_ft_enable_stopword is ON
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
-
-
---connection default
-select @@innodb_ft_enable_stopword;
-# no result expected as word not indexed from connection 1
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
-
-INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
-
-SET SESSION innodb_ft_enable_stopword = 1;
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
-
-
---connection con1
-SET SESSION innodb_ft_enable_stopword = 1;
-# Define a correct formated user stopword table
-create table user_stopword(value varchar(30)) engine = innodb;
-# The set operation should be successful
-set session innodb_ft_user_stopword_table = "test/user_stopword";
-# Add values into user supplied stop word table
-insert into user_stopword values("this"),("will"),("the");
-# Drop existing index and create the FTS index Using Alter Table.
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-# no result expected as innodb_ft_user_stopword_table filter it
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-
-
---connection default
-# no result expected as innodb_ft_user_stopword_table filter it from connection1
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-select @@innodb_ft_user_stopword_table;
-# Define a correct formated user stopword table
-create table user_stopword_1(value varchar(30)) engine = innodb;
-# The set operation should be successful
-set session innodb_ft_user_stopword_table = "test/user_stopword_1";
-insert into user_stopword_1 values("when");
-SET SESSION innodb_ft_enable_stopword = 1;
-# result expected
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
-# Drop existing index and create the FTS index Using Alter Table.
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-# no result expected
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
-
---connection con1
-SET SESSION innodb_ft_enable_stopword = 1;
-SET SESSION innodb_ft_user_stopword_table=default;
-select @@innodb_ft_user_stopword_table;
-select @@innodb_ft_server_stopword_table;
-# Define a correct formated server stopword table
-create table server_stopword(value varchar(30)) engine = innodb;
-# The set operation should be successful
-SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
-select @@innodb_ft_server_stopword_table;
-insert into server_stopword values("when"),("the");
-# Drop existing index and create the FTS index Using Alter Table.
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-# no result expected
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
-
-disconnect con1;
---source include/wait_until_disconnected.inc
-
---connection default
-SET SESSION innodb_ft_enable_stopword = 1;
-SET SESSION innodb_ft_user_stopword_table=default;
-select @@innodb_ft_server_stopword_table;
-# result expected
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
-insert into server_stopword values("where"),("will");
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
-ALTER TABLE articles DROP INDEX idx;
-ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
-# no result expected
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
-SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
-SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
-
-
-DROP TABLE articles,user_stopword,user_stopword_1,server_stopword;
-
-# Restore Values
-eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
-eval SET GLOBAL innodb_ft_server_stopword_table=default;
-eval SET SESSION innodb_ft_user_stopword_table=default;
-
diff --git a/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test b/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test
index 48964aef4fd..f9447aada60 100644
--- a/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test
+++ b/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test
@@ -1,4 +1,5 @@
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
CREATE TABLE t1 (v VARCHAR(100), FULLTEXT INDEX (v)) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test b/mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test
index e200cff6c39..c84cd0685ed 100644
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_large_records.test
@@ -3,6 +3,7 @@
# b) more words across records
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_multiple_index.test b/mysql-test/suite/innodb_fts/t/innodb_fts_multiple_index.test
index c8293655d1b..f9535c729ff 100644
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_multiple_index.test
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_multiple_index.test
@@ -2,6 +2,7 @@
# Test With two FTS index on same table + alter/create/drop index + tnx
#------------------------------------------------------------------------------
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
--disable_warnings
drop table if exists t1;
diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test b/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test
index 20eee3fac23..e3d8eb0c13b 100644
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_proximity.test
@@ -1,4 +1,5 @@
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
# This is the DDL function tests for innodb FTS
# Functional testing with FTS proximity search using '@'
diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_result_cache_limit.test b/mysql-test/suite/innodb_fts/t/innodb_fts_result_cache_limit.test
index 669808edbf6..1ec37532a71 100644
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_result_cache_limit.test
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_result_cache_limit.test
@@ -4,6 +4,7 @@
# Must have debug code to use SET SESSION debug
--source include/have_debug.inc
+--source include/maybe_versioning.inc
# Create FTS table
CREATE TABLE t1 (
diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test b/mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test
index 16ee91c30f4..3fe99dab2c3 100644
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_stopword_charset.test
@@ -4,6 +4,7 @@
# Embedded server tests do not support restarting
--source include/not_embedded.inc
+--source include/maybe_versioning.inc
SELECT @@innodb_ft_server_stopword_table;
SELECT @@innodb_ft_enable_stopword;
diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_transaction.test b/mysql-test/suite/innodb_fts/t/innodb_fts_transaction.test
index 11571f346a2..026aeb635cd 100644
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_transaction.test
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_transaction.test
@@ -5,6 +5,7 @@
# 3) UNCOMMITTED RECORDS CAN BE SEEN WITH QURIES WHICH DO NOT USE FTS INDEX
# this behavior do not break integratity of tables and "select" which do not use FTS still can view them.
--source include/have_innodb.inc
+--source include/maybe_versioning.inc
--disable_warnings
diff --git a/mysql-test/suite/innodb_fts/t/misc_debug.test b/mysql-test/suite/innodb_fts/t/misc_debug.test
index 9246d27a704..08581768eec 100644
--- a/mysql-test/suite/innodb_fts/t/misc_debug.test
+++ b/mysql-test/suite/innodb_fts/t/misc_debug.test
@@ -7,6 +7,7 @@
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc
+--source include/maybe_versioning.inc
# Following test is for Bug 14668777 - ASSERT ON IB_VECTOR_SIZE(
# TABLE->FTS->INDEXES, ALTER TABLE
@@ -91,7 +92,14 @@ SET @saved_debug_dbug= @@debug_dbug;
CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB;
SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
+if ($MTR_COMBINATION_ORIG)
+{
TRUNCATE t1;
+}
+if (!$MTR_COMBINATION_ORIG)
+{
+--echo TRUNCATE t1;
+}
SET debug_dbug=@saved_debug_dbug;
DROP TABLE t1;
--echo # End of 10.3 tests
@@ -100,7 +108,7 @@ DROP TABLE t1;
CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100))ENGINE=InnoDB;
SET DEBUG_DBUG="+d,stats_lock_fail";
---error ER_GET_ERRNO
+--error ER_LOCK_WAIT_TIMEOUT
ALTER TABLE t1 ADD FULLTEXT(f2);
SET debug_dbug=@saved_debug_dbug;
ALTER TABLE t1 DISCARD TABLESPACE;
diff --git a/mysql-test/suite/innodb_fts/t/stopword.inc b/mysql-test/suite/innodb_fts/t/stopword.inc
new file mode 100644
index 00000000000..774501ade85
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/stopword.inc
@@ -0,0 +1,55 @@
+if ($stopword_stage == create_table)
+{
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
+
+select * from information_schema.innodb_ft_default_stopword;
+
+# Create FTS table
+eval CREATE TABLE $stopword_table (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ )$create_options ENGINE=InnoDB;
+
+# Insert six rows
+eval INSERT INTO $stopword_table (title,body) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# "the" is in the default stopword, it would not be selected
+eval SELECT * FROM $stopword_table WHERE MATCH (title,body)
+ AGAINST ('the' IN NATURAL LANGUAGE MODE);
+
+# Provide user defined stopword table, if not (correctly) defined,
+# it will be rejected
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_ft_server_stopword_table = "not_defined";
+set global innodb_ft_server_stopword_table = NULL;
+
+# Define a correct formatted user stopword table
+eval create table user_stopword(value varchar(30))$create_options engine = innodb;
+
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/user_stopword";
+
+eval drop index title on $stopword_table;
+
+eval create fulltext index idx on $stopword_table(title, body);
+}
+
+if ($stopword_stage == select_1)
+{
+--error 0, ER_INDEX_CORRUPT
+eval SELECT * FROM $stopword_table WHERE MATCH (title,body)
+ AGAINST ('the' IN NATURAL LANGUAGE MODE);
+--error 0, ER_INDEX_CORRUPT
+eval SELECT * FROM $stopword_table WHERE MATCH (title,body)
+ AGAINST ('this' IN NATURAL LANGUAGE MODE);
+
+}
diff --git a/mysql-test/suite/innodb_fts/t/stopword.test b/mysql-test/suite/innodb_fts/t/stopword.test
index 5105a6d2fec..9f8bd89b816 100644
--- a/mysql-test/suite/innodb_fts/t/stopword.test
+++ b/mysql-test/suite/innodb_fts/t/stopword.test
@@ -1,52 +1,16 @@
# This is the basic function tests for innodb FTS
-- source include/have_innodb.inc
-
-call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
-call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
-
-select * from information_schema.innodb_ft_default_stopword;
-
-# Create FTS table
-CREATE TABLE articles (
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
- title VARCHAR(200),
- body TEXT,
- FULLTEXT (title,body)
- ) ENGINE=InnoDB;
-
-# Insert six rows
-INSERT INTO articles (title,body) VALUES
- ('MySQL Tutorial','DBMS stands for DataBase ...') ,
- ('How To Use MySQL Well','After you went through a ...'),
- ('Optimizing MySQL','In this tutorial we will show ...'),
- ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
- ('MySQL vs. YourSQL','In the following database comparison ...'),
- ('MySQL Security','When configured properly, MySQL ...');
-
-# "the" is in the default stopword, it would not be selected
-SELECT * FROM articles WHERE MATCH (title,body)
- AGAINST ('the' IN NATURAL LANGUAGE MODE);
+-- let $modify_create_table= 1
+-- source include/maybe_versioning.inc
SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table;
SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword;
SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table;
-# Provide user defined stopword table, if not (correctly) defined,
-# it will be rejected
---error ER_WRONG_VALUE_FOR_VAR
-set global innodb_ft_server_stopword_table = "not_defined";
-set global innodb_ft_server_stopword_table = NULL;
-
-# Define a correct formated user stopword table
-create table user_stopword(value varchar(30)) engine = innodb;
-
-# The set operation should be successful
-set global innodb_ft_server_stopword_table = "test/user_stopword";
-
-drop index title on articles;
-
-create fulltext index idx on articles(title, body);
+let $stopword_table= articles;
+let $stopword_stage= create_table;
+--source stopword.inc
# Now we should be able to find "the"
SELECT * FROM articles WHERE MATCH (title,body)
@@ -55,12 +19,12 @@ SELECT * FROM articles WHERE MATCH (title,body)
# Nothing inserted into the default stopword, so essentially
# nothing get screened. The new stopword could only be
# effective for table created thereafter
-CREATE TABLE articles_2 (
+eval CREATE TABLE articles_2 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title,body)
- ) ENGINE=InnoDB;
+ )$create_options ENGINE=InnoDB;
INSERT INTO articles_2 (title, body)
VALUES ('test for stopwords','this is it...');
@@ -71,15 +35,17 @@ SELECT * FROM articles_2 WHERE MATCH (title,body)
# Ok, let's instantiate some value into user supplied stop word
# table
+insert into user_stopword values("the");
+delete from user_stopword;
insert into user_stopword values("this");
# Ok, let's repeat with the new table again.
-CREATE TABLE articles_3 (
+eval CREATE TABLE articles_3 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title,body)
- ) ENGINE=InnoDB;
+ )$create_options ENGINE=InnoDB;
INSERT INTO articles_3 (title, body)
VALUES ('test for stopwords','this is it...');
@@ -89,18 +55,20 @@ SELECT * FROM articles_3 WHERE MATCH (title,body)
AGAINST ('this' IN NATURAL LANGUAGE MODE);
# Test session level stopword control "innodb_user_stopword_table"
-create table user_stopword_session(value varchar(30)) engine = innodb;
+eval create table user_stopword_session(value varchar(30))$create_options engine = innodb;
+insert into user_stopword values("this");
+delete from user_stopword;
insert into user_stopword_session values("session");
set session innodb_ft_user_stopword_table="test/user_stopword_session";
-CREATE TABLE articles_4 (
+eval CREATE TABLE articles_4 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title,body)
- ) ENGINE=InnoDB;
+ )$create_options ENGINE=InnoDB;
INSERT INTO articles_4 (title, body)
VALUES ('test for session stopwords','this should also be excluded...');
@@ -114,12 +82,12 @@ SELECT * FROM articles_4 WHERE MATCH (title,body)
AGAINST ('this' IN NATURAL LANGUAGE MODE);
--connect (con1,localhost,root,,)
-CREATE TABLE articles_5 (
+eval CREATE TABLE articles_5 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title,body)
- ) ENGINE=InnoDB;
+ )$create_options ENGINE=InnoDB;
INSERT INTO articles_5 (title, body)
VALUES ('test for session stopwords','this should also be excluded...');
@@ -153,12 +121,12 @@ SET GLOBAL innodb_ft_server_stopword_table=default;
# the settings.
# Create FTS table
-CREATE TABLE articles (
+eval CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT `idx` (title,body)
- ) ENGINE=InnoDB;
+ )$create_options ENGINE=InnoDB;
SHOW CREATE TABLE articles;
@@ -292,12 +260,12 @@ SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig;
SET SESSION innodb_ft_user_stopword_table=default;
# Create FTS table
-CREATE TABLE articles (
+eval CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT `idx` (title,body)
- ) ENGINE=InnoDB;
+ )$create_options ENGINE=InnoDB;
# Insert six rows
INSERT INTO articles (title,body) VALUES
@@ -311,15 +279,17 @@ INSERT INTO articles (title,body) VALUES
# No records expeced for select
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-# Define a correct formated user stopword table
-create table user_stopword(value varchar(30)) engine = innodb;
+# Define a correct formatted user stopword table
+eval create table user_stopword(value varchar(30))$create_options engine = innodb;
# The set operation should be successful
set session innodb_ft_user_stopword_table = "test/user_stopword";
-# Define a correct formated server stopword table
-create table server_stopword(value varchar(30)) engine = innodb;
+# Define a correct formatted server stopword table
+eval create table server_stopword(value varchar(30))$create_options engine = innodb;
# The set operation should be successful
set global innodb_ft_server_stopword_table = "test/server_stopword";
# Add values into user supplied stop word table
+insert into user_stopword values("when"),("where");
+delete from user_stopword;
insert into user_stopword values("this"),("will"),("the");
# Drop existing index and create the FTS index Using Alter Table.
@@ -390,12 +360,12 @@ SET SESSION innodb_ft_user_stopword_table=default;
#---------------------------------------------------------------------------------------
# Create FTS table
-CREATE TABLE articles (
+eval CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT `idx` (title,body)
- ) ENGINE=InnoDB;
+ )$create_options ENGINE=InnoDB;
SHOW CREATE TABLE articles;
@@ -411,8 +381,8 @@ INSERT INTO articles (title,body) VALUES
# No records expeced for select
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
-# Define a correct formated user stopword table
-create table user_stopword(value varchar(30)) engine = innodb;
+# Define a correct formatted user stopword table
+eval create table user_stopword(value varchar(30))$create_options engine = innodb;
# The set operation should be successful
set session innodb_ft_user_stopword_table = "test/user_stopword";
insert into user_stopword values("mysqld"),("DBMS");
@@ -433,8 +403,8 @@ SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
# set user stopword list empty
set session innodb_ft_user_stopword_table = default;
-# Define a correct formated user stopword table
-create table server_stopword(value varchar(30)) engine = innodb;
+# Define a correct formatted user stopword table
+eval create table server_stopword(value varchar(30))$create_options engine = innodb;
# The set operation should be successful
set global innodb_ft_server_stopword_table = "test/server_stopword";
insert into server_stopword values("root"),("properly");
@@ -487,12 +457,12 @@ SET SESSION innodb_ft_user_stopword_table=default;
# FTS stopword list test - check varaibles across sessions
# Create FTS table
-CREATE TABLE articles (
+eval CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT `idx` (title,body)
- ) ENGINE=InnoDB;
+ )$create_options ENGINE=InnoDB;
SHOW CREATE TABLE articles;
@@ -572,8 +542,8 @@ SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOL
--echo "In connection 1"
--connection con1
SET SESSION innodb_ft_enable_stopword = 1;
-# Define a correct formated user stopword table
-create table user_stopword(value varchar(30)) engine = innodb;
+# Define a correct formatted user stopword table
+eval create table user_stopword(value varchar(30))$create_options engine = innodb;
# The set operation should be successful
set session innodb_ft_user_stopword_table = "test/user_stopword";
# Add values into user supplied stop word table
@@ -592,8 +562,8 @@ SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
select @@innodb_ft_user_stopword_table;
-# Define a correct formated user stopword table
-create table user_stopword_1(value varchar(30)) engine = innodb;
+# Define a correct formatted user stopword table
+eval create table user_stopword_1(value varchar(30))$create_options engine = innodb;
# The set operation should be successful
set session innodb_ft_user_stopword_table = "test/user_stopword_1";
insert into user_stopword_1 values("when");
@@ -614,8 +584,8 @@ SET SESSION innodb_ft_enable_stopword = 1;
SET SESSION innodb_ft_user_stopword_table=default;
select @@innodb_ft_user_stopword_table;
select @@innodb_ft_server_stopword_table;
-# Define a correct formated server stopword table
-create table server_stopword(value varchar(30)) engine = innodb;
+# Define a correct formatted server stopword table
+eval create table server_stopword(value varchar(30))$create_options engine = innodb;
# The set operation should be successful
SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
select @@innodb_ft_server_stopword_table;
diff --git a/mysql-test/suite/innodb_fts/t/sync.test b/mysql-test/suite/innodb_fts/t/sync.test
index 92c21c9ac83..49663f20b8a 100644
--- a/mysql-test/suite/innodb_fts/t/sync.test
+++ b/mysql-test/suite/innodb_fts/t/sync.test
@@ -7,6 +7,7 @@
--source include/not_valgrind.inc
--source include/not_embedded.inc
--source include/not_crashrep.inc
+--source include/maybe_versioning.inc
connect (con1,localhost,root,,);
connection default;
diff --git a/mysql-test/suite/innodb_fts/t/sync_ddl.test b/mysql-test/suite/innodb_fts/t/sync_ddl.test
index 2950297d5bb..6a16ececa60 100644
--- a/mysql-test/suite/innodb_fts/t/sync_ddl.test
+++ b/mysql-test/suite/innodb_fts/t/sync_ddl.test
@@ -4,6 +4,7 @@
--source include/have_innodb.inc
--source include/have_debug.inc
+--source include/maybe_versioning.inc
#--------------------------------------
# Check FTS_sync vs TRUNCATE (1)
@@ -23,7 +24,16 @@ INSERT INTO t1 (value) VALUES
('By default or with the IN NATURAL LANGUAGE MODE modifier')
;
+let $vers=$MTR_COMBINATION_VERS+$MTR_COMBINATION_VERS_TRX;
+
+if ($vers)
+{
+--echo TRUNCATE TABLE t1;
+}
+if (!$vers)
+{
TRUNCATE TABLE t1;
+}
DROP TABLE t1;
@@ -54,7 +64,14 @@ INSERT INTO t1 (value) VALUES
('collation of latin1_bin to make it case sensitive')
;
+if ($vers)
+{
+--echo TRUNCATE TABLE t1;
+}
+if (!$vers)
+{
TRUNCATE TABLE t1;
+}
DROP TABLE t1;
diff --git a/mysql-test/suite/mariabackup/incremental_backup.test b/mysql-test/suite/mariabackup/incremental_backup.test
index fed2d5e60a9..62e4f9c6875 100644
--- a/mysql-test/suite/mariabackup/incremental_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_backup.test
@@ -34,7 +34,7 @@ INSERT INTO t VALUES(1);
echo # Create full backup , modify table, then create incremental/differential backup;
--disable_result_log
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir --throttle=1000;
--enable_result_log
BEGIN;
INSERT INTO t VALUES(0);
diff --git a/mysql-test/suite/parts/t/partition_repair_myisam.test b/mysql-test/suite/parts/t/partition_repair_myisam.test
index 3f43127a0c8..c4c05cc08d3 100644
--- a/mysql-test/suite/parts/t/partition_repair_myisam.test
+++ b/mysql-test/suite/parts/t/partition_repair_myisam.test
@@ -150,7 +150,7 @@ while ($i)
# 2 - after _mi_mark_file_changed (only marked index as opened)
# 3 - after write_record (updated datafile + not closed/updated index)
# 4 - after flush_cached_blocks (updated index/datafiles, not closed index)
-# 5 - (Not used) after mi_state_info_write (fully uppdated/closed index file)
+# 5 - (Not used) after mi_state_info_write (fully updated/closed index file)
# (this was verified to be a harmless crash, since everything was written)
# 6 - partly updated datafile (insert 6 small records, delete 5,3,1,
# insert one larger record (2.5 X small) and break in gdb before it has
diff --git a/mysql-test/suite/perfschema/t/statement_program_concurrency.test b/mysql-test/suite/perfschema/t/statement_program_concurrency.test
index 75261254c00..8229223caec 100644
--- a/mysql-test/suite/perfschema/t/statement_program_concurrency.test
+++ b/mysql-test/suite/perfschema/t/statement_program_concurrency.test
@@ -91,7 +91,9 @@ connection con3;
--reap;
connection default;
---source include/wait_until_connected_again.inc
+
+--let $wait_condition=select count(*)=3 from information_schema.processlist where command='sleep';
+--source include/wait_condition.inc
SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS
FROM performance_schema.events_statements_summary_by_program
diff --git a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result
index a0f33091297..425aa1b127f 100644
--- a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result
+++ b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result
@@ -191,7 +191,7 @@ create or replace table t1 (a int, b int as (stddev_pop(a)));
ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
# STDDEV_SAMP()
create or replace table t1 (a int, b int as (stddev_samp(a)));
-ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
+ERROR HY000: Function or expression 'stddev_samp()' cannot be used in the GENERATED ALWAYS AS clause of `b`
# STDDEV()
create or replace table t1 (a int, b int as (stddev(a)));
ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result
index f92e530eacf..9751f7c718d 100644
--- a/mysql-test/suite/versioning/r/alter.result
+++ b/mysql-test/suite/versioning/r/alter.result
@@ -377,6 +377,11 @@ a b
2 NULL
3 1
4 2
+alter table t add c int, drop system versioning;
+select * from t;
+a b c
+3 1 NULL
+4 2 NULL
create or replace table t (a int) with system versioning;
insert into t values (1), (2), (3);
delete from t where a<3;
diff --git a/mysql-test/suite/versioning/r/debug.result b/mysql-test/suite/versioning/r/debug.result
index 4ea6c6202bc..3efddd40275 100644
--- a/mysql-test/suite/versioning/r/debug.result
+++ b/mysql-test/suite/versioning/r/debug.result
@@ -19,7 +19,7 @@ show create table tt2;
Table Create Table
tt2 CREATE TEMPORARY TABLE `tt2` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
connect con1, localhost, root;
create table t3 (a int);
show create table t3;
@@ -32,7 +32,7 @@ show create table tt3;
Table Create Table
tt3 CREATE TEMPORARY TABLE `tt3` (
`a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
disconnect con1;
connection default;
set debug_dbug='+d,sysvers_show';
diff --git a/mysql-test/suite/versioning/r/delete.result b/mysql-test/suite/versioning/r/delete.result
index 0f9e2c22130..6f8c8921790 100644
--- a/mysql-test/suite/versioning/r/delete.result
+++ b/mysql-test/suite/versioning/r/delete.result
@@ -146,6 +146,5 @@ delete from t1;
select f1, f3, check_row_ts(row_start, row_end) from t1 for system_time all;
f1 f3 check_row_ts(row_start, row_end)
1 1 HISTORICAL ROW
-1 NULL ERROR: row_end == row_start
1 1 HISTORICAL ROW
drop table t1;
diff --git a/mysql-test/suite/versioning/r/delete_history.result b/mysql-test/suite/versioning/r/delete_history.result
index a44342bd4cd..cf68536d4a6 100644
--- a/mysql-test/suite/versioning/r/delete_history.result
+++ b/mysql-test/suite/versioning/r/delete_history.result
@@ -1,3 +1,5 @@
+set @saved_frequency= @@global.innodb_purge_rseg_truncate_frequency;
+set global innodb_purge_rseg_truncate_frequency= 1;
call mtr.add_suppression("need more HISTORY partitions");
create table t (a int);
delete history from t before system_time now();
@@ -188,6 +190,26 @@ x
drop prepare stmt;
drop table t1;
#
+# MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY
+#
+create table t1 (a integer, c0 varchar(255), fulltext key (c0))
+with system versioning engine innodb;
+set system_versioning_alter_history= keep;
+alter table t1 drop system versioning;
+alter table t1 add system versioning;
+insert into t1 values (1, 'politician');
+update t1 set c0= 'criminal';
+InnoDB 0 transactions not purged
+delete history from t1;
+drop table t1;
+create table t1 (id int primary key, ftx varchar(255))
+with system versioning engine innodb;
+insert into t1 values (1, 'c');
+delete from t1;
+alter table t1 add fulltext key(ftx);
+drop table t1;
+set global innodb_purge_rseg_truncate_frequency= @saved_frequency;
+#
# MDEV-28201 Server crashes upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
#
CREATE TABLE t1 (a INT) WITH SYSTEM VERSIONING;
@@ -199,3 +221,4 @@ DELETE HISTORY FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
DROP TABLE t1;
+# End of 10.4 tests
diff --git a/mysql-test/suite/versioning/r/foreign.result b/mysql-test/suite/versioning/r/foreign.result
index 3c8508507fd..8a779be760a 100644
--- a/mysql-test/suite/versioning/r/foreign.result
+++ b/mysql-test/suite/versioning/r/foreign.result
@@ -445,6 +445,43 @@ pk f1 f2 left(f3, 4) check_row_ts(row_start, row_end)
1 8 8 SHOR HISTORICAL ROW
2 8 8 LONG HISTORICAL ROW
drop table t1;
+# Shorter case for clustered index (MDEV-25004)
+create table t1 (
+y int primary key, r int, f int, key (r),
+foreign key (f) references t1 (r) on delete set null)
+with system versioning engine innodb;
+insert into t1 values (1, 6, 6), (2, 6, 6);
+delete from t1;
+select *, check_row_ts(row_start, row_end) from t1 for system_time all;
+y r f check_row_ts(row_start, row_end)
+1 6 6 HISTORICAL ROW
+2 6 6 HISTORICAL ROW
+drop tables t1;
+# Secondary unique index
+create table t1 (
+y int unique null, r int, f int, key (r),
+foreign key (f) references t1 (r) on delete set null)
+with system versioning engine innodb;
+insert into t1 values (1, 6, 6), (2, 6, 6);
+delete from t1;
+select *, check_row_ts(row_start, row_end) from t1 for system_time all;
+y r f check_row_ts(row_start, row_end)
+1 6 6 HISTORICAL ROW
+2 6 6 HISTORICAL ROW
+drop tables t1;
+# Non-unique index cannot be fixed because it does not trigger duplicate error
+create table t1 (
+y int, r int, f int, key (y), key (r),
+foreign key (f) references t1 (r) on delete set null)
+with system versioning engine innodb;
+insert into t1 values (1, 6, 6), (2, 6, 6);
+delete from t1;
+select *, check_row_ts(row_start, row_end) from t1 for system_time all;
+y r f check_row_ts(row_start, row_end)
+1 6 6 HISTORICAL ROW
+2 6 NULL ERROR: row_end == row_start
+2 6 6 HISTORICAL ROW
+drop tables t1;
#
# MDEV-21555 Assertion secondary index is out of sync on delete from versioned table
#
diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test
index 76185afd523..61653550389 100644
--- a/mysql-test/suite/versioning/t/alter.test
+++ b/mysql-test/suite/versioning/t/alter.test
@@ -266,6 +266,8 @@ select * from t;
select * from t for system_time all;
insert into t values (4, 0);
select * from t for system_time all;
+alter table t add c int, drop system versioning;
+select * from t;
create or replace table t (a int) with system versioning;
insert into t values (1), (2), (3);
diff --git a/mysql-test/suite/versioning/t/delete_history.test b/mysql-test/suite/versioning/t/delete_history.test
index 535e6a0c3fe..042670bcfec 100644
--- a/mysql-test/suite/versioning/t/delete_history.test
+++ b/mysql-test/suite/versioning/t/delete_history.test
@@ -2,6 +2,9 @@
--source include/have_partition.inc
--source suite/versioning/engines.inc
+set @saved_frequency= @@global.innodb_purge_rseg_truncate_frequency;
+set global innodb_purge_rseg_truncate_frequency= 1;
+
call mtr.add_suppression("need more HISTORY partitions");
create table t (a int);
@@ -192,6 +195,29 @@ drop prepare stmt;
drop table t1;
--echo #
+--echo # MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY
+--echo #
+create table t1 (a integer, c0 varchar(255), fulltext key (c0))
+with system versioning engine innodb;
+set system_versioning_alter_history= keep;
+alter table t1 drop system versioning;
+alter table t1 add system versioning;
+insert into t1 values (1, 'politician');
+update t1 set c0= 'criminal';
+--source suite/innodb/include/wait_all_purged.inc
+delete history from t1;
+drop table t1;
+
+create table t1 (id int primary key, ftx varchar(255))
+with system versioning engine innodb;
+insert into t1 values (1, 'c');
+delete from t1;
+alter table t1 add fulltext key(ftx);
+drop table t1;
+
+set global innodb_purge_rseg_truncate_frequency= @saved_frequency;
+
+--echo #
--echo # MDEV-28201 Server crashes upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
--echo #
CREATE TABLE t1 (a INT) WITH SYSTEM VERSIONING;
@@ -204,4 +230,6 @@ DELETE HISTORY FROM v1;
DROP VIEW v1;
DROP TABLE t1;
+--echo # End of 10.4 tests
+
--source suite/versioning/common_finish.inc
diff --git a/mysql-test/suite/versioning/t/foreign.test b/mysql-test/suite/versioning/t/foreign.test
index 934053f83ba..4aa6b21a039 100644
--- a/mysql-test/suite/versioning/t/foreign.test
+++ b/mysql-test/suite/versioning/t/foreign.test
@@ -478,6 +478,39 @@ select pk, f1, f2, left(f3, 4), check_row_ts(row_start, row_end) from t1 for sys
# cleanup
drop table t1;
+--echo # Shorter case for clustered index (MDEV-25004)
+create table t1 (
+ y int primary key, r int, f int, key (r),
+ foreign key (f) references t1 (r) on delete set null)
+with system versioning engine innodb;
+
+insert into t1 values (1, 6, 6), (2, 6, 6);
+delete from t1;
+select *, check_row_ts(row_start, row_end) from t1 for system_time all;
+drop tables t1;
+
+--echo # Secondary unique index
+create table t1 (
+ y int unique null, r int, f int, key (r),
+ foreign key (f) references t1 (r) on delete set null)
+with system versioning engine innodb;
+
+insert into t1 values (1, 6, 6), (2, 6, 6);
+delete from t1;
+select *, check_row_ts(row_start, row_end) from t1 for system_time all;
+drop tables t1;
+
+--echo # Non-unique index cannot be fixed because it does not trigger duplicate error
+create table t1 (
+ y int, r int, f int, key (y), key (r),
+ foreign key (f) references t1 (r) on delete set null)
+with system versioning engine innodb;
+
+insert into t1 values (1, 6, 6), (2, 6, 6);
+delete from t1;
+select *, check_row_ts(row_start, row_end) from t1 for system_time all;
+drop tables t1;
+
--echo #
--echo # MDEV-21555 Assertion secondary index is out of sync on delete from versioned table
--echo #
diff --git a/mysql-test/suite/wsrep/common.pm b/mysql-test/suite/wsrep/common.pm
index 8ac3b3ea94c..54ce8826563 100644
--- a/mysql-test/suite/wsrep/common.pm
+++ b/mysql-test/suite/wsrep/common.pm
@@ -43,10 +43,10 @@ sub check_wsrep_support() {
mtr_error("No SST scripts") unless $spath;
$ENV{PATH}="$spath:$ENV{PATH}";
- # ADD mysql client library path to path so that wsrep_notify_cmd can find mysql
- # client for loading the tables. (Don't assume each machine has mysql install)
- my ($cpath) = grep { -f "$_/mysql"; } "$::bindir/scripts", $::path_client_bindir;
- mtr_error("No scritps") unless $cpath;
+ # ADD mariadb client to path so that wsrep_notify_cmd can find mariadb
+ # client for loading the tables. (Don't assume each machine has mariadb installed)
+ my ($cpath) = grep { -f "$_/mariadb"; } "$::bindir/scripts", $::path_client_bindir;
+ mtr_error("No mariadb client found") unless $cpath;
$ENV{PATH}="$cpath:$ENV{PATH}" unless $cpath eq $spath;
# ADD my_print_defaults script path to path so that SST scripts can find it
diff --git a/mysys/array.c b/mysys/array.c
index aa2f444653f..6e871ee6343 100644
--- a/mysys/array.c
+++ b/mysys/array.c
@@ -23,6 +23,7 @@
SYNOPSIS
init_dynamic_array2()
+ ps_key Key to register instrumented memory
array Pointer to an array
element_size Size of element
init_buffer Initial buffer pointer
diff --git a/mysys/hash.c b/mysys/hash.c
index d9132b28cd7..fccd4a24373 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -60,8 +60,9 @@ my_hash_value_type my_hash_sort(CHARSET_INFO *cs, const uchar *key,
dynamic array that is part of the hash will allocate memory
as required during insertion.
+ @param[in] psi_key The key to register instrumented memory
@param[in,out] hash The hash that is initialized
- @param[in[ growth_size size incrememnt for the underlying dynarray
+ @param[in] growth_size size incrememnt for the underlying dynarray
@param[in] charset The character set information
@param[in] size The hash size
@param[in] key_offest The key offset for the hash
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index 9f230b6bbcb..a5b855f9604 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -120,8 +120,8 @@ static void calculate_block_sizes(MEM_ROOT *mem_root, size_t block_size,
SYNOPSIS
init_alloc_root()
+ key - key to register instrumented memory
mem_root - memory root to initialize
- name - name of memroot (for debugging)
block_size - size of chunks (blocks) used for memory allocation.
Will be updated to next power of 2, minus
internal and system memory management size. This is
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index b2cbb84984d..b8f64de589e 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -59,6 +59,7 @@ void set_malloc_size_cb(MALLOC_SIZE_CB func)
/**
Allocate a sized block of memory.
+ @param key Key to register instrumented memory
@param size The size of the memory block in bytes.
@param flags Failure action modifiers (bitmasks).
@@ -120,7 +121,8 @@ void *my_malloc(PSI_memory_key key, size_t size, myf my_flags)
/**
@brief wrapper around realloc()
- @param old_point pointer to currently allocated area
+ @param key key to register instrumented memory
+ @param old_point pointer to currently allocated area
@param size new size requested, must be >0
@param my_flags flags
diff --git a/plugin/test_sql_service/test_sql_service.c b/plugin/test_sql_service/test_sql_service.c
index c2dbb93bf20..8b326c6fa46 100644
--- a/plugin/test_sql_service/test_sql_service.c
+++ b/plugin/test_sql_service/test_sql_service.c
@@ -129,6 +129,7 @@ void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev)
static int run_test(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save,
struct st_mysql_value *value)
{
+ *(my_bool*) save= 0; /* Set value for sql_service_run_test */
return (test_passed= (do_tests() == 0)) == 0;
}
diff --git a/scripts/galera_recovery.sh b/scripts/galera_recovery.sh
index 8df2abc3fd5..9ff5e4e5f50 100644
--- a/scripts/galera_recovery.sh
+++ b/scripts/galera_recovery.sh
@@ -68,7 +68,7 @@ parse_arguments() {
wsrep_recover_position() {
# Redirect server's error log to the log file.
- eval @sbindir@/mysqld $cmdline_args --user=$user --wsrep_recover \
+ eval @sbindir@/mariadbd $cmdline_args --user=$user --wsrep_recover \
--disable-log-error 2> "$log_file"
ret=$?
if [ $ret -ne 0 ]; then
diff --git a/scripts/mariadb-service-convert b/scripts/mariadb-service-convert
index 38043733554..e43b9b926d5 100755
--- a/scripts/mariadb-service-convert
+++ b/scripts/mariadb-service-convert
@@ -25,7 +25,7 @@
tz_old=$TZ
-. /usr/bin/mysqld_safe --dry-run
+. /usr/bin/mariadbd-safe --dry-run
echo "# converted using $0"
echo "#"
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 6d1471f2543..766c1895bb1 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -151,7 +151,9 @@ parse_arguments()
--builddir=*) builddir=`parse_arg "$arg"` ;;
--srcdir=*) srcdir=`parse_arg "$arg"` ;;
--ldata=*|--datadir=*|--data=*) ldata=`parse_arg "$arg"` ;;
- --log-error=*)
+ --log[-_]error=*)
+ # Keep in the arguments passed to the server
+ args="$args $arg"
log_error=`parse_arg "$arg"` ;;
# Note that the user will be passed to mysqld so that it runs
# as 'user' (crucial e.g. if log-bin=/some_other_path/
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 7a8578234cd..f4bef922119 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -508,7 +508,7 @@ IF(WIN32)
ENDIF(WIN32)
IF(NOT WITH_WSREP)
- SET(EXCL_WSREP "wsrep*.h")
+ SET(EXCL_WSREP "wsrep_[a-np-z]*.h")
ENDIF()
INSTALL(DIRECTORY . DESTINATION ${INSTALL_INCLUDEDIR}/server/private COMPONENT Development
FILES_MATCHING PATTERN "*.h"
diff --git a/sql/handler.cc b/sql/handler.cc
index 0b3d46fc9ad..517a26aedfb 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2022, MariaDB Corporation.
+ Copyright (c) 2009, 2023, 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
@@ -8107,7 +8107,6 @@ static Create_field *vers_init_sys_field(THD *thd, const char *field_name, int f
f->flags= flags | NOT_NULL_FLAG;
if (integer)
{
- DBUG_ASSERT(0); // Not implemented yet
f->set_handler(&type_handler_vers_trx_id);
f->length= MY_INT64_NUM_DECIMAL_DIGITS - 1;
f->flags|= UNSIGNED_FLAG;
@@ -8125,10 +8124,13 @@ static Create_field *vers_init_sys_field(THD *thd, const char *field_name, int f
return f;
}
-static bool vers_create_sys_field(THD *thd, const char *field_name,
- Alter_info *alter_info, int flags)
+bool Vers_parse_info::create_sys_field(THD *thd, const char *field_name,
+ Alter_info *alter_info, int flags)
{
- Create_field *f= vers_init_sys_field(thd, field_name, flags, false);
+ DBUG_ASSERT(can_native >= 0); /* Requires vers_check_native() called */
+ Create_field *f= vers_init_sys_field(thd, field_name, flags,
+ DBUG_IF("sysvers_force_trx") &&
+ can_native);
if (!f)
return true;
@@ -8152,8 +8154,8 @@ bool Vers_parse_info::fix_implicit(THD *thd, Alter_info *alter_info)
period= start_end_t(default_start, default_end);
as_row= period;
- if (vers_create_sys_field(thd, default_start, alter_info, VERS_ROW_START) ||
- vers_create_sys_field(thd, default_end, alter_info, VERS_ROW_END))
+ if (create_sys_field(thd, default_start, alter_info, VERS_ROW_START) ||
+ create_sys_field(thd, default_end, alter_info, VERS_ROW_END))
{
return true;
}
@@ -8161,14 +8163,24 @@ bool Vers_parse_info::fix_implicit(THD *thd, Alter_info *alter_info)
}
+void Table_scope_and_contents_source_st::vers_check_native()
+{
+ vers_info.can_native= (db_type->db_type == DB_TYPE_PARTITION_DB ||
+ ha_check_storage_engine_flag(db_type,
+ HTON_NATIVE_SYS_VERSIONING));
+}
+
+
bool Table_scope_and_contents_source_st::vers_fix_system_fields(
THD *thd, Alter_info *alter_info, const TABLE_LIST &create_table)
{
DBUG_ASSERT(!(alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING));
- DBUG_EXECUTE_IF("sysvers_force", if (!tmp_table()) {
- alter_info->flags|= ALTER_ADD_SYSTEM_VERSIONING;
- options|= HA_VERSIONED_TABLE; });
+ if (DBUG_IF("sysvers_force") || DBUG_IF("sysvers_force_trx"))
+ {
+ alter_info->flags|= ALTER_ADD_SYSTEM_VERSIONING;
+ options|= HA_VERSIONED_TABLE;
+ }
if (!vers_info.need_check(alter_info))
return false;
@@ -8199,7 +8211,9 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields(
{
f->flags|= VERS_UPDATE_UNVERSIONED_FLAG;
}
- } // while (Create_field *f= it++)
+ } // while
+
+ vers_check_native();
if (vers_info.fix_implicit(thd, alter_info))
return true;
@@ -8265,7 +8279,8 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
if (!need_check(alter_info) && !share->versioned)
return false;
- if (!DBUG_IF("sysvers_force") && share->tmp_table)
+ if (share->tmp_table &&
+ !DBUG_IF("sysvers_force") && !DBUG_IF("sysvers_force_trx"))
{
my_error(ER_VERS_NOT_SUPPORTED, MYF(0), "CREATE TEMPORARY TABLE");
return true;
diff --git a/sql/handler.h b/sql/handler.h
index c77bf578981..7bf98e42537 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -2,7 +2,7 @@
#define HANDLER_INCLUDED
/*
Copyright (c) 2000, 2019, Oracle and/or its affiliates.
- Copyright (c) 2009, 2022, MariaDB
+ Copyright (c) 2009, 2023, MariaDB
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -2091,7 +2091,8 @@ struct Vers_parse_info: public Table_period_info
Vers_parse_info() :
Table_period_info(STRING_WITH_LEN("SYSTEM_TIME")),
versioned_fields(false),
- unversioned_fields(false)
+ unversioned_fields(false),
+ can_native(-1)
{}
Table_period_info::start_end_t as_row;
@@ -2120,6 +2121,9 @@ protected:
bool need_check(const Alter_info *alter_info) const;
bool check_conditions(const Lex_table_name &table_name,
const Lex_table_name &db) const;
+ bool create_sys_field(THD *thd, const char *field_name,
+ Alter_info *alter_info, int flags);
+
public:
static const Lex_ident default_start;
static const Lex_ident default_end;
@@ -2137,6 +2141,7 @@ public:
*/
bool versioned_fields : 1;
bool unversioned_fields : 1;
+ int can_native;
};
/**
@@ -2255,6 +2260,7 @@ struct Table_scope_and_contents_source_st:
int select_count= 0);
bool check_period_fields(THD *thd, Alter_info *alter_info);
+ void vers_check_native();
bool vers_fix_system_fields(THD *thd, Alter_info *alter_info,
const TABLE_LIST &create_table);
@@ -2262,7 +2268,6 @@ struct Table_scope_and_contents_source_st:
const Lex_table_name &table_name,
const Lex_table_name &db,
int select_count= 0);
-
};
diff --git a/sql/item.h b/sql/item.h
index 0a8dd5f28e6..1bfd0b529f2 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -7515,7 +7515,7 @@ class Item_cache_row: public Item_cache
bool save_array;
public:
Item_cache_row(THD *thd):
- Item_cache(thd), values(0), item_count(2),
+ Item_cache(thd, &type_handler_row), values(0), item_count(2),
save_array(0) {}
/*
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index d33202d0a42..6fd33fe84b1 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -2373,8 +2373,15 @@ Item *Item_sum_variance::result_item(THD *thd, Field *field)
void Item_sum_min_max::clear()
{
DBUG_ENTER("Item_sum_min_max::clear");
- value->clear();
- null_value= 1;
+ /*
+ We should not clear const items (from SELECT MIN(key) from t1) as then we would loose the
+ value cached in opt_sum_query() where we replace MIN/MAX/COUNT with constants.
+ */
+ if (!const_item())
+ {
+ value->clear();
+ null_value= 1;
+ }
DBUG_VOID_RETURN;
}
@@ -2487,9 +2494,12 @@ void Item_sum_min_max::no_rows_in_result()
/* We may be called here twice in case of ref field in function */
if (was_values)
{
+ bool org_const_item_cache= const_item_cache;
was_values= FALSE;
was_null_value= value->null_value;
+ const_item_cache= 0; // Ensure that clear works on const items
clear();
+ const_item_cache= org_const_item_cache;
}
DBUG_VOID_RETURN;
}
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 82cfe5c72ea..7e89b2bd1d1 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -1,7 +1,7 @@
#ifndef ITEM_SUM_INCLUDED
#define ITEM_SUM_INCLUDED
/* Copyright (c) 2000, 2013 Oracle and/or its affiliates.
- Copyright (c) 2008, 2020, MariaDB Corporation.
+ Copyright (c) 2008, 2023, 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
@@ -1090,8 +1090,9 @@ class Item_sum_std final :public Item_sum_variance
Item *result_item(THD *thd, Field *field) override final;
LEX_CSTRING func_name_cstring() const override
{
- static LEX_CSTRING sum_name= {STRING_WITH_LEN("std(") };
- return sum_name;
+ static LEX_CSTRING std_name= {STRING_WITH_LEN("std(") };
+ static LEX_CSTRING stddev_samp_name= {STRING_WITH_LEN("stddev_samp(") };
+ return sample ? stddev_samp_name : std_name;
}
Item *copy_or_same(THD* thd) override final;
Item *get_copy(THD *thd) override final
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index cc13aa74beb..f8cf2300560 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -8211,12 +8211,6 @@ mysqld_get_one_option(const struct my_option *opt, const char *argument,
case (int) OPT_SKIP_HOST_CACHE:
opt_specialflag|= SPECIAL_NO_HOST_CACHE;
break;
- case (int) OPT_SKIP_RESOLVE:
- if ((opt_skip_name_resolve= (argument != disabled_my_option)))
- opt_specialflag|= SPECIAL_NO_RESOLVE;
- else
- opt_specialflag&= ~SPECIAL_NO_RESOLVE;
- break;
case (int) OPT_WANT_CORE:
test_flags |= TEST_CORE_ON_SIGNAL;
break;
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 3aab2ba0da6..5ef9dc1a9c7 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -822,7 +822,6 @@ enum options_mysqld
OPT_SERVER_ID,
OPT_SILENT,
OPT_SKIP_HOST_CACHE,
- OPT_SKIP_RESOLVE,
OPT_SLAVE_PARALLEL_MODE,
OPT_SSL_CA,
OPT_SSL_CAPATH,
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 6825918cb89..9652e839862 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1890,7 +1890,7 @@ SEL_ARG::SEL_ARG(SEL_ARG &arg) :Sql_alloc()
next= 0;
if (next_key_part)
{
- ++next_key_part->use_count;
+ next_key_part->increment_use_count(1);
weight += next_key_part->weight;
}
}
@@ -10614,8 +10614,7 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
Move on to next range in key2
*/
key2->increment_use_count(-1); // Free not used tree
- key2=key2_next;
- continue;
+ key2= key2_next;
}
else
{
@@ -10629,8 +10628,9 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *key1,SEL_ARG *key2)
tmp: [---------]
*/
key2->copy_max_to_min(tmp);
- continue;
+ key2= key2_next;
}
+ continue;
}
/*
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 10491d9b45b..794ec40fc66 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -438,7 +438,7 @@ int opt_sum_query(THD *thd,
The optimization is not applicable in both cases:
(a) 'expr' is a non-constant expression. Then we can't
replace 'expr' by a constant.
- (b) 'expr' is a costant. According to ANSI, MIN/MAX must return
+ (b) 'expr' is a constant. According to ANSI, MIN/MAX must return
NULL if the query does not return any rows. Thus, if we are not
able to determine if the query returns any rows, we can't apply
the optimization and replace MIN/MAX with a constant.
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index e15e8d6e93d..40121e4e9ac 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
- Copyright (c) 2009, 2022, MariaDB
+ Copyright (c) 2009, 2023, 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
@@ -383,9 +383,9 @@ public:
update_hostname(&host, safe_strdup_root(mem, host_arg));
}
- bool check_validity(bool check_no_resolve)
+ bool check_validity()
{
- if (check_no_resolve &&
+ if (opt_skip_name_resolve &&
(hostname_requires_resolving(host.hostname) ||
hostname_requires_resolving(proxied_host.hostname)))
{
@@ -2529,7 +2529,6 @@ static void push_new_user(const ACL_USER &user)
static bool acl_load(THD *thd, const Grant_tables& tables)
{
READ_RECORD read_record_info;
- bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
char tmp_name[SAFE_NAME_LEN+1];
Sql_mode_save old_mode_save(thd);
DBUG_ENTER("acl_load");
@@ -2572,7 +2571,8 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
host.access= host_table.get_access();
host.access= fix_rights_for_db(host.access);
host.sort= get_magic_sort("hd", host.host.hostname, host.db);
- if (check_no_resolve && hostname_requires_resolving(host.host.hostname))
+ if (opt_skip_name_resolve &&
+ hostname_requires_resolving(host.host.hostname))
{
sql_print_warning("'host' entry '%s|%s' "
"ignored in --skip-name-resolve mode.",
@@ -2643,7 +2643,8 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
}
else
{
- if (check_no_resolve && hostname_requires_resolving(user.host.hostname))
+ if (opt_skip_name_resolve &&
+ hostname_requires_resolving(user.host.hostname))
{
sql_print_warning("'user' entry '%s@%s' "
"ignored in --skip-name-resolve mode.", user.user.str,
@@ -2701,7 +2702,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
sql_print_warning("Found an entry in the 'db' table with empty database name; Skipped");
continue;
}
- if (check_no_resolve && hostname_requires_resolving(db.host.hostname))
+ if (opt_skip_name_resolve && hostname_requires_resolving(db.host.hostname))
{
sql_print_warning("'db' entry '%s %s@%s' "
"ignored in --skip-name-resolve mode.",
@@ -2756,7 +2757,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
{
ACL_PROXY_USER proxy;
proxy.init(proxies_priv_table, &acl_memroot);
- if (proxy.check_validity(check_no_resolve))
+ if (proxy.check_validity())
continue;
if (push_dynamic(&acl_proxy_users, (uchar*) &proxy))
DBUG_RETURN(TRUE);
@@ -7933,7 +7934,6 @@ static bool grant_load(THD *thd,
{
bool return_val= 1;
TABLE *t_table, *c_table, *p_table;
- bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
MEM_ROOT *save_mem_root= thd->mem_root;
DBUG_ENTER("grant_load");
@@ -7980,7 +7980,7 @@ static bool grant_load(THD *thd,
goto end_unlock;
}
- if (check_no_resolve)
+ if (opt_skip_name_resolve)
{
if (hostname_requires_resolving(mem_check->host.hostname))
{
@@ -8024,7 +8024,7 @@ static bool grant_load(THD *thd,
goto end_unlock_p;
}
- if (check_no_resolve)
+ if (opt_skip_name_resolve)
{
if (hostname_requires_resolving(mem_check->host.hostname))
{
@@ -12089,8 +12089,7 @@ void Sql_cmd_grant::warn_hostname_requires_resolving(THD *thd,
List_iterator <LEX_USER> it(users);
while ((user= it++))
{
- if (specialflag & SPECIAL_NO_RESOLVE &&
- hostname_requires_resolving(user->host.str))
+ if (opt_skip_name_resolve && hostname_requires_resolving(user->host.str))
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_HOSTNAME_WONT_WORK,
ER_THD(thd, ER_WARN_HOSTNAME_WONT_WORK));
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 234f0b688ac..6b195ac9fe7 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -892,7 +892,7 @@ int thd_set_peer_addr(THD *thd,
return 1; /* The error is set by my_strdup(). */
}
thd->main_security_ctx.host_or_ip = thd->main_security_ctx.ip;
- if (!(specialflag & SPECIAL_NO_RESOLVE))
+ if (!opt_skip_name_resolve)
{
int rc;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 2b8ea9265de..0a1a359e337 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
- Copyright (c) 2008, 2022, MariaDB
+ Copyright (c) 2008, 2023, 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
@@ -2513,7 +2513,7 @@ void log_slow_statement(THD *thd)
if ((thd->server_status &
(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
!(thd->query_plan_flags & QPLAN_STATUS) &&
- !slow_filter_masked(thd, QPLAN_NOT_USING_INDEX))
+ (thd->variables.log_slow_filter & QPLAN_NOT_USING_INDEX))
{
thd->query_plan_flags|= QPLAN_NOT_USING_INDEX;
/* We are always logging no index queries if enabled in filter */
@@ -2798,9 +2798,10 @@ bool sp_process_definer(THD *thd)
}
else
{
- LEX_USER *d= lex->definer= get_current_user(thd, lex->definer);
+ LEX_USER *d= get_current_user(thd, lex->definer);
if (!d)
DBUG_RETURN(TRUE);
+ thd->change_item_tree((Item**)&lex->definer, (Item*)d);
/*
If the specified definer differs from the current user or role, we
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 82b956fbdad..e5dde6b40c8 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8227,7 +8227,9 @@ best_access_path(JOIN *join,
} /* not ft_key */
if (records < DBL_MAX &&
- (found_part & 1)) // start_key->key can be used for index access
+ (found_part & 1) && // start_key->key can be used for index access
+ (table->file->index_flags(start_key->key,0,1) &
+ HA_DO_RANGE_FILTER_PUSHDOWN))
{
double rows= record_count * records;
@@ -8252,23 +8254,50 @@ best_access_path(JOIN *join,
cost_of_fetching_1_row = tmp/rows
cost_of_fetching_1_key_tuple = keyread_tmp/rows
- Note that access_cost_factor may be greater than 1.0. In this case
- we still can expect a gain of using rowid filter due to smaller number
- of checks for conditions pushed to the joined table.
+ access_cost_factor is the gain we expect for using rowid filter.
+ An access_cost_factor of 1.0 means that keyread_tmp is 0
+ (using key read is infinitely fast) and the gain for each row when
+ using filter is great.
+ An access_cost_factor if 0.0 means that using keyread has the
+ same cost as reading rows, so there is no gain to get with
+ filter.
+ access_cost_factor should never be bigger than 1.0 (if all
+ calculations are correct) as the cost of keyread should always be
+ smaller than the cost of fetching the same number of keys + rows.
+ access_cost_factor should also never be smaller than 0.0.
+ The one exception is if number of records is 1 (eq_ref), then
+ because we are comparing rows to cost of keyread_tmp, keyread_tmp
+ is higher by 1.0. This is a big that will be fixed in a later
+ version.
+
+ If we have limited the cost (=tmp) of reading rows with 'worst_seek'
+ we cannot use filters as the cost calculation below would cause
+ tmp to become negative. The future resultion is to not limit
+ cost with worst_seek.
+
+ We cannot use filter with JT_EQ_REF as in this case 'tmp' is
+ number of rows from prev_record_read() and keyread_tmp is 0. These
+ numbers are not usable with rowid filter code.
*/
- double rows_access_cost= MY_MIN(rows, s->worst_seeks);
- double access_cost_factor= MY_MIN((rows_access_cost - keyread_tmp) /
- rows, 1.0);
- filter=
- table->best_range_rowid_filter_for_partial_join(start_key->key, rows,
- access_cost_factor);
- if (filter)
- {
- filter->get_cmp_gain(rows);
- tmp-= filter->get_adjusted_gain(rows) - filter->get_cmp_gain(rows);
- DBUG_ASSERT(tmp >= 0);
- trace_access_idx.add("rowid_filter_key",
- table->key_info[filter->key_no].name);
+ double access_cost_factor= MY_MIN((rows - keyread_tmp) / rows, 1.0);
+ if (!(records < s->worst_seeks &&
+ records <= thd->variables.max_seeks_for_key))
+ trace_access_idx.add("rowid_filter_skipped", "worst/max seeks clipping");
+ else if (access_cost_factor <= 0.0)
+ trace_access_idx.add("rowid_filter_skipped", "cost_factor <= 0");
+ else if (type != JT_EQ_REF)
+ {
+ filter=
+ table->best_range_rowid_filter_for_partial_join(start_key->key,
+ rows,
+ access_cost_factor);
+ if (filter)
+ {
+ tmp-= filter->get_adjusted_gain(rows) - filter->get_cmp_gain(rows);
+ DBUG_ASSERT(tmp >= 0);
+ trace_access_idx.add("rowid_filter_key",
+ table->key_info[filter->key_no].name);
+ }
}
}
trace_access_idx.add("rows", records).add("cost", tmp);
@@ -8434,7 +8463,7 @@ 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.
*/
- double cmp_time= (s->found_records - rnd_records)/TIME_FOR_COMPARE;
+ double cmp_time= (s->found_records - rnd_records) / TIME_FOR_COMPARE;
tmp= COST_MULT(record_count,
COST_ADD(s->quick->read_time, cmp_time));
@@ -8445,16 +8474,24 @@ best_access_path(JOIN *join,
uint key_no= s->quick->index;
/* See the comment concerning using rowid filter for with ref access */
- keyread_tmp= s->table->opt_range[key_no].index_only_cost;
+ keyread_tmp= s->table->opt_range[key_no].index_only_cost *
+ record_count;
access_cost_factor= MY_MIN((rows - keyread_tmp) / rows, 1.0);
- filter=
- s->table->best_range_rowid_filter_for_partial_join(key_no, rows,
- access_cost_factor);
- if (filter)
+ if (access_cost_factor > 0.0)
{
- tmp-= filter->get_adjusted_gain(rows);
- DBUG_ASSERT(tmp >= 0);
+ filter=
+ s->table->
+ best_range_rowid_filter_for_partial_join(key_no, rows,
+ access_cost_factor);
+ if (filter)
+ {
+ tmp-= filter->get_adjusted_gain(rows);
+ DBUG_ASSERT(tmp >= 0);
+ }
}
+ else
+ trace_access_scan.add("rowid_filter_skipped", "cost_factor <= 0");
+
type= JT_RANGE;
}
else
@@ -20653,6 +20690,8 @@ free_tmp_table(THD *thd, TABLE *entry)
}
entry->file->ha_drop_table(entry->s->path.str);
delete entry->file;
+ entry->file= NULL;
+ entry->reset_created();
}
/* free blobs */
@@ -26222,7 +26261,6 @@ bool JOIN::alloc_func_list()
@param field_list All items
@param send_result_set_metadata Items in select list
@param before_group_by Set to 1 if this is called before GROUP BY handling
- @param recompute Set to TRUE if sum_funcs must be recomputed
@retval
0 ok
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index a2a1c76411c..e8f8772ba2f 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2009, 2022, MariaDB
+ Copyright (c) 2009, 2023, 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
@@ -2452,7 +2452,7 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
add_table_options(thd, table, create_info_arg,
table_list->schema_table != 0, 0, packet);
- if (table->versioned())
+ if (!DBUG_IF("sysvers_hide") && table->versioned())
packet->append(STRING_WITH_LEN(" WITH SYSTEM VERSIONING"));
#ifdef WITH_PARTITION_STORAGE_ENGINE
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 5eff24b28b1..2340fa91b0b 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -10174,6 +10174,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
if (check_engine(thd, alter_ctx.new_db.str, alter_ctx.new_name.str, create_info))
DBUG_RETURN(true);
+ create_info->vers_check_native();
if (create_info->vers_info.fix_alter_info(thd, alter_info, create_info, table))
{
DBUG_RETURN(true);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index e3403b38020..1cc540a321b 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2010, 2022, MariaDB
+ Copyright (c) 2010, 2023, 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
@@ -350,9 +350,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
*/
%ifdef MARIADB
-%expect 71
+%expect 82
%else
-%expect 72
+%expect 83
%endif
/*
@@ -1182,7 +1182,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%left PREC_BELOW_NOT
-%nonassoc NOT_SYM
+%nonassoc LOW_PRIORITY_NOT
%left '=' EQUAL_SYM GE '>' LE '<' NE
%nonassoc IS
%right BETWEEN_SYM
@@ -9099,7 +9099,7 @@ expr:
MYSQL_YYABORT;
}
}
- | NOT_SYM expr %prec NOT_SYM
+ | NOT_SYM expr %prec LOW_PRIORITY_NOT
{
$$= negate_expression(thd, $2);
if (unlikely($$ == NULL))
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 4c789390c2a..95e82ca85ce 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -3042,7 +3042,7 @@ static Sys_var_mybool Sys_skip_name_resolve(
"skip_name_resolve",
"Don't resolve hostnames. All hostnames are IP's or 'localhost'.",
READ_ONLY GLOBAL_VAR(opt_skip_name_resolve),
- CMD_LINE(OPT_ARG, OPT_SKIP_RESOLVE),
+ CMD_LINE(OPT_ARG),
DEFAULT(FALSE));
static Sys_var_mybool Sys_skip_show_database(
diff --git a/sql/table.h b/sql/table.h
index cab0076cf36..2a92a0d05a3 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1657,7 +1657,11 @@ public:
}
/// Return true if table is instantiated, and false otherwise.
- bool is_created() const { return created; }
+ bool is_created() const
+ {
+ DBUG_ASSERT(!created || file != 0);
+ return created;
+ }
/**
Set the table as "created", and enable flags in storage engine
@@ -1672,6 +1676,11 @@ public:
created= true;
}
+ void reset_created()
+ {
+ created= 0;
+ }
+
/*
Returns TRUE if the table is filled at execution phase (and so, the
optimizer must not do anything that depends on the contents of the table,
diff --git a/sql/unireg.h b/sql/unireg.h
index 01c1a5a284e..1eec3585acc 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -62,7 +62,7 @@
#define SPECIAL_WAIT_IF_LOCKED 8 /* Wait if locked database */
#define SPECIAL_SAME_DB_NAME 16 /* form name = file name */
#define SPECIAL_ENGLISH 32 /* English error messages */
-#define SPECIAL_NO_RESOLVE 64 /* Don't use gethostname */
+#define SPECIAL_NO_RESOLVE 64 /* Obsolete */
#define SPECIAL_NO_PRIOR 128 /* Obsolete */
#define SPECIAL_BIG_SELECTS 256 /* Don't use heap tables */
#define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index 9586f834b8f..498ec71a87f 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -1199,7 +1199,7 @@ bool TYPVAL<TYPE>::Compall(PGLOBAL g, PVAL *vp, int np, OPVAL op)
/***********************************************************************/
/* FormatValue: This function set vp (a STRING value) to the string */
-/* constructed from its own value formated using the fmt format. */
+/* constructed from its own value formatted using the fmt format. */
/* This function assumes that the format matches the value type. */
/***********************************************************************/
template <class TYPE>
@@ -1711,7 +1711,7 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
/***********************************************************************/
/* FormatValue: This function set vp (a STRING value) to the string */
-/* constructed from its own value formated using the fmt format. */
+/* constructed from its own value formatted using the fmt format. */
/* This function assumes that the format matches the value type. */
/***********************************************************************/
bool TYPVAL<PSZ>::FormatValue(PVAL vp, PCSZ fmt)
@@ -2325,7 +2325,7 @@ bool BINVAL::IsEqual(PVAL vp, bool chktype)
/***********************************************************************/
/* FormatValue: This function set vp (a STRING value) to the string */
-/* constructed from its own value formated using the fmt format. */
+/* constructed from its own value formatted using the fmt format. */
/* This function assumes that the format matches the value type. */
/***********************************************************************/
bool BINVAL::FormatValue(PVAL vp, PCSZ fmt)
@@ -2865,7 +2865,7 @@ bool DTVAL::WeekNum(PGLOBAL g, int& nval)
/***********************************************************************/
/* FormatValue: This function set vp (a STRING value) to the string */
-/* constructed from its own value formated using the fmt format. */
+/* constructed from its own value formatted using the fmt format. */
/* This function assumes that the format matches the value type. */
/***********************************************************************/
bool DTVAL::FormatValue(PVAL vp, PCSZ fmt)
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index 6e3b0e1fabb..3d8b40830b0 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -1333,6 +1333,20 @@ dict_index_t::vers_history_row(
{
ut_ad(!is_primary());
+ /*
+ Get row_end from clustered index
+
+ TODO (optimization): row_end can be taken from unique secondary index
+ as well. For that dict_index_t::vers_end member should be added and
+ updated at index init (dict_index_build_internal_non_clust()).
+
+ Test case:
+
+ create or replace table t1 (x int unique, y int unique,
+ foreign key r (y) references t1 (x))
+ with system versioning engine innodb;
+ insert into t1 values (1, 1);
+ */
bool error = false;
mem_heap_t* heap = NULL;
dict_index_t* clust_index = NULL;
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index acbe2e453a4..5744283f925 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2021, Oracle and/or its affiliates.
-Copyright (c) 2016, 2022, MariaDB Corporation.
+Copyright (c) 2016, 2023, 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
@@ -386,8 +386,10 @@ fts_read_stopword(
fts_string_t str;
mem_heap_t* heap;
ib_rbt_bound_t parent;
+ dict_table_t* table;
sel_node = static_cast<sel_node_t*>(row);
+ table = sel_node->table_list->table;
stopword_info = static_cast<fts_stopword_t*>(user_arg);
stop_words = stopword_info->cached_stopword;
@@ -402,6 +404,27 @@ fts_read_stopword(
str.f_n_char = 0;
str.f_str = static_cast<byte*>(dfield_get_data(dfield));
str.f_len = dfield_get_len(dfield);
+ exp = que_node_get_next(exp);
+ ut_ad(exp);
+
+ if (table->versioned()) {
+ dfield = que_node_get_val(exp);
+ ut_ad(dfield_get_type(dfield)->vers_sys_end());
+ void* data = dfield_get_data(dfield);
+ ulint len = dfield_get_len(dfield);
+ if (table->versioned_by_id()) {
+ ut_ad(len == sizeof trx_id_max_bytes);
+ if (0 != memcmp(data, trx_id_max_bytes, len)) {
+ return true;
+ }
+ } else {
+ ut_ad(len == sizeof timestamp_max_bytes);
+ if (0 != memcmp(data, timestamp_max_bytes, len)) {
+ return true;
+ }
+ }
+ }
+ ut_ad(!que_node_get_next(exp));
/* Only create new node if it is a value not already existed */
if (str.f_len != UNIV_SQL_NULL
@@ -445,7 +468,9 @@ fts_load_user_stopword(
/* Validate the user table existence in the right format */
bool ret= false;
- stopword_info->charset = fts_valid_stopword_table(stopword_table_name);
+ const char* row_end;
+ stopword_info->charset = fts_valid_stopword_table(stopword_table_name,
+ &row_end);
if (!stopword_info->charset) {
cleanup:
if (!fts->dict_locked) {
@@ -470,6 +495,7 @@ cleanup:
pars_info_t* info = pars_info_create();
pars_info_bind_id(info, "table_stopword", stopword_table_name);
+ pars_info_bind_id(info, "row_end", row_end);
pars_info_bind_function(info, "my_func", fts_read_stopword,
stopword_info);
@@ -479,7 +505,7 @@ cleanup:
"PROCEDURE P() IS\n"
"DECLARE FUNCTION my_func;\n"
"DECLARE CURSOR c IS"
- " SELECT value"
+ " SELECT value, $row_end"
" FROM $table_stopword;\n"
"BEGIN\n"
"\n"
@@ -1920,9 +1946,16 @@ fts_create_common_tables(
goto func_exit;
}
- index = dict_mem_index_create(table, FTS_DOC_ID_INDEX_NAME,
- DICT_UNIQUE, 1);
- dict_mem_index_add_field(index, FTS_DOC_ID_COL_NAME, 0);
+ if (table->versioned()) {
+ index = dict_mem_index_create(table, FTS_DOC_ID_INDEX_NAME,
+ DICT_UNIQUE, 2);
+ dict_mem_index_add_field(index, FTS_DOC_ID_COL_NAME, 0);
+ dict_mem_index_add_field(index, table->cols[table->vers_end].name(*table), 0);
+ } else {
+ index = dict_mem_index_create(table, FTS_DOC_ID_INDEX_NAME,
+ DICT_UNIQUE, 1);
+ dict_mem_index_add_field(index, FTS_DOC_ID_COL_NAME, 0);
+ }
error = row_create_index_for_mysql(index, trx, NULL,
FIL_ENCRYPTION_DEFAULT,
@@ -3350,7 +3383,8 @@ fts_add_doc_by_id(
/* Search based on Doc ID. Here, we'll need to consider the case
when there is no primary index on Doc ID */
- tuple = dtuple_create(heap, 1);
+ const ulint n_uniq = table->fts_n_uniq();
+ tuple = dtuple_create(heap, n_uniq);
dfield = dtuple_get_nth_field(tuple, 0);
dfield->type.mtype = DATA_INT;
dfield->type.prtype = DATA_NOT_NULL | DATA_UNSIGNED | DATA_BINARY_TYPE;
@@ -3359,11 +3393,26 @@ fts_add_doc_by_id(
dfield_set_data(dfield, &temp_doc_id, sizeof(temp_doc_id));
pcur.btr_cur.page_cur.index = fts_id_index;
+ if (n_uniq == 2) {
+ ut_ad(table->versioned());
+ ut_ad(fts_id_index->fields[1].col->vers_sys_end());
+ dfield = dtuple_get_nth_field(tuple, 1);
+ dfield->type.mtype = fts_id_index->fields[1].col->mtype;
+ dfield->type.prtype = fts_id_index->fields[1].col->prtype;
+ if (table->versioned_by_id()) {
+ dfield_set_data(dfield, trx_id_max_bytes,
+ sizeof(trx_id_max_bytes));
+ } else {
+ dfield_set_data(dfield, timestamp_max_bytes,
+ sizeof(timestamp_max_bytes));
+ }
+ }
+
/* If we have a match, add the data to doc structure */
if (btr_pcur_open_with_no_init(tuple, PAGE_CUR_LE,
BTR_SEARCH_LEAF, &pcur, &mtr)
== DB_SUCCESS
- && btr_pcur_get_low_match(&pcur) == 1) {
+ && btr_pcur_get_low_match(&pcur) == n_uniq) {
const rec_t* rec;
btr_pcur_t* doc_pcur;
const rec_t* clust_rec;
@@ -3558,13 +3607,34 @@ fts_get_max_doc_id(
if (pcur.open_leaf(false, index, BTR_SEARCH_LEAF, &mtr) == DB_SUCCESS
&& !page_is_empty(btr_pcur_get_page(&pcur))) {
const rec_t* rec = NULL;
+ constexpr ulint doc_id_len= 8;
do {
rec = btr_pcur_get_rec(&pcur);
- if (page_rec_is_user_rec(rec)) {
+ if (!page_rec_is_user_rec(rec)) {
+ continue;
+ }
+
+ if (index->n_uniq == 1) {
break;
}
+
+ ut_ad(table->versioned());
+ ut_ad(index->n_uniq == 2);
+
+ const byte *data = rec + doc_id_len;
+ if (table->versioned_by_id()) {
+ if (0 == memcmp(data, trx_id_max_bytes,
+ sizeof trx_id_max_bytes)) {
+ break;
+ }
+ } else {
+ if (0 == memcmp(data, timestamp_max_bytes,
+ sizeof timestamp_max_bytes)) {
+ break;
+ }
+ }
} while (btr_pcur_move_to_prev(&pcur, &mtr));
if (!rec || rec_is_metadata(rec, *index)) {
@@ -5533,12 +5603,16 @@ bool fts_check_aux_table(const char *name,
/**********************************************************************//**
Check whether user supplied stopword table is of the right format.
Caller is responsible to hold dictionary locks.
-@return the stopword column charset if qualifies */
+@param stopword_table_name table name
+@param row_end name of the system-versioning end column, or "value"
+@return the stopword column charset
+@retval NULL if the table does not exist or qualify */
CHARSET_INFO*
fts_valid_stopword_table(
/*=====================*/
- const char* stopword_table_name) /*!< in: Stopword table
+ const char* stopword_table_name, /*!< in: Stopword table
name */
+ const char** row_end) /* row_end value of system-versioned table */
{
dict_table_t* table;
dict_col_t* col = NULL;
@@ -5577,6 +5651,13 @@ fts_valid_stopword_table(
}
ut_ad(col);
+ ut_ad(!table->versioned() || col->ind != table->vers_end);
+
+ if (row_end) {
+ *row_end = table->versioned()
+ ? dict_table_get_col_name(table, table->vers_end)
+ : "value"; /* for fts_load_user_stopword() */
+ }
return(fts_get_charset(col->prtype));
}
@@ -5712,18 +5793,20 @@ cleanup:
/**********************************************************************//**
Callback function when we initialize the FTS at the start up
time. It recovers the maximum Doc IDs presented in the current table.
+Tested by innodb_fts.crash_recovery
@return: always returns TRUE */
static
ibool
fts_init_get_doc_id(
/*================*/
void* row, /*!< in: sel_node_t* */
- void* user_arg) /*!< in: fts cache */
+ void* user_arg) /*!< in: table with fts */
{
doc_id_t doc_id = FTS_NULL_DOC_ID;
sel_node_t* node = static_cast<sel_node_t*>(row);
que_node_t* exp = node->select_list;
- fts_cache_t* cache = static_cast<fts_cache_t*>(user_arg);
+ dict_table_t* table = static_cast<dict_table_t *>(user_arg);
+ fts_cache_t* cache = table->fts->cache;
ut_ad(ib_vector_is_empty(cache->get_docs));
@@ -5738,6 +5821,29 @@ fts_init_get_doc_id(
doc_id = static_cast<doc_id_t>(mach_read_from_8(
static_cast<const byte*>(data)));
+ exp = que_node_get_next(que_node_get_next(exp));
+ if (exp) {
+ ut_ad(table->versioned());
+ dfield = que_node_get_val(exp);
+ type = dfield_get_type(dfield);
+ ut_ad(type->vers_sys_end());
+ data = dfield_get_data(dfield);
+ ulint len = dfield_get_len(dfield);
+ if (table->versioned_by_id()) {
+ ut_ad(len == sizeof trx_id_max_bytes);
+ if (0 != memcmp(data, trx_id_max_bytes, len)) {
+ return true;
+ }
+ } else {
+ ut_ad(len == sizeof timestamp_max_bytes);
+ if (0 != memcmp(data, timestamp_max_bytes, len)) {
+ return true;
+ }
+ }
+ ut_ad(!(exp = que_node_get_next(exp)));
+ }
+ ut_ad(!exp);
+
if (doc_id >= cache->next_doc_id) {
cache->next_doc_id = doc_id + 1;
}
@@ -5900,7 +6006,7 @@ fts_init_index(
fts_doc_fetch_by_doc_id(NULL, start_doc, index,
FTS_FETCH_DOC_BY_ID_LARGE,
- fts_init_get_doc_id, cache);
+ fts_init_get_doc_id, table);
} else {
if (table->fts->cache->stopword_info.status
& STOPWORD_NOT_INIT) {
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 0f01a883fcc..ea4e4f6094f 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -4,7 +4,7 @@ Copyright (c) 2000, 2020, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2022, MariaDB Corporation.
+Copyright (c) 2013, 2023, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -8588,6 +8588,10 @@ ha_innobase::update_row(
? VERSIONED_DELETE
: NO_DELETE;
+ if (m_prebuilt->upd_node->is_delete) {
+ trx->fts_next_doc_id = 0;
+ }
+
error = row_update_for_mysql(m_prebuilt);
if (error == DB_SUCCESS && vers_ins_row
@@ -8698,6 +8702,7 @@ ha_innobase::delete_row(
&& trx->id != table->vers_start_id()
? VERSIONED_DELETE
: PLAIN_DELETE;
+ trx->fts_next_doc_id = 0;
error = row_update_for_mysql(m_prebuilt);
@@ -9650,9 +9655,12 @@ ha_innobase::ft_init_ext(
/*****************************************************************//**
Set up search tuple for a query through FTS_DOC_ID_INDEX on
supplied Doc ID. This is used by MySQL to retrieve the documents
-once the search result (Doc IDs) is available */
+once the search result (Doc IDs) is available
+
+@return DB_SUCCESS or DB_INDEX_CORRUPT
+*/
static
-void
+dberr_t
innobase_fts_create_doc_id_key(
/*===========================*/
dtuple_t* tuple, /* in/out: m_prebuilt->search_tuple */
@@ -9664,8 +9672,10 @@ innobase_fts_create_doc_id_key(
{
doc_id_t temp_doc_id;
dfield_t* dfield = dtuple_get_nth_field(tuple, 0);
+ const ulint n_uniq = index->table->fts_n_uniq();
- ut_a(dict_index_get_n_unique(index) == 1);
+ if (dict_index_get_n_unique(index) != n_uniq)
+ return DB_INDEX_CORRUPT;
dtuple_set_n_fields(tuple, index->n_fields);
dict_index_copy_types(tuple, index, index->n_fields);
@@ -9683,12 +9693,25 @@ innobase_fts_create_doc_id_key(
*doc_id = temp_doc_id;
dfield_set_data(dfield, doc_id, sizeof(*doc_id));
- dtuple_set_n_fields_cmp(tuple, 1);
+ if (n_uniq == 2) {
+ ut_ad(index->table->versioned());
+ dfield = dtuple_get_nth_field(tuple, 1);
+ if (index->table->versioned_by_id()) {
+ dfield_set_data(dfield, trx_id_max_bytes,
+ sizeof(trx_id_max_bytes));
+ } else {
+ dfield_set_data(dfield, timestamp_max_bytes,
+ sizeof(timestamp_max_bytes));
+ }
+ }
+
+ dtuple_set_n_fields_cmp(tuple, n_uniq);
- for (ulint i = 1; i < index->n_fields; i++) {
+ for (ulint i = n_uniq; i < index->n_fields; i++) {
dfield = dtuple_get_nth_field(tuple, i);
dfield_set_null(dfield);
}
+ return DB_SUCCESS;
}
/**********************************************************************//**
@@ -9770,13 +9793,18 @@ next_record:
/* We pass a pointer of search_doc_id because it will be
converted to storage byte order used in the search
tuple. */
- innobase_fts_create_doc_id_key(tuple, index, &search_doc_id);
+ dberr_t ret = innobase_fts_create_doc_id_key(
+ tuple, index, &search_doc_id);
+
+ if (ret == DB_SUCCESS) {
+ ret = row_search_mvcc(
+ buf, PAGE_CUR_GE, m_prebuilt,
+ ROW_SEL_EXACT, 0);
+ }
int error;
- switch (dberr_t ret = row_search_mvcc(buf, PAGE_CUR_GE,
- m_prebuilt,
- ROW_SEL_EXACT, 0)) {
+ switch (ret) {
case DB_SUCCESS:
error = 0;
table->status = 0;
@@ -11527,6 +11555,7 @@ bool create_table_info_t::innobase_table_flags()
m_flags2 = 0;
/* Check if there are any FTS indexes defined on this table. */
+ const uint fts_n_uniq= m_form->versioned() ? 2 : 1;
for (uint i = 0; i < m_form->s->keys; i++) {
const KEY* key = &m_form->key_info[i];
@@ -11551,7 +11580,7 @@ bool create_table_info_t::innobase_table_flags()
/* Do a pre-check on FTS DOC ID index */
if (!(key->flags & HA_NOSAME)
- || key->user_defined_key_parts != 1
+ || key->user_defined_key_parts != fts_n_uniq
|| (key->key_part[0].key_part_flag & HA_REVERSE_SORT)
|| strcmp(key->name.str, FTS_DOC_ID_INDEX_NAME)
|| strcmp(key->key_part[0].field->field_name.str,
@@ -17317,7 +17346,7 @@ innodb_stopword_table_validate(
/* Validate the stopword table's (if supplied) existence and
of the right format */
int ret = stopword_table_name && !fts_valid_stopword_table(
- stopword_table_name);
+ stopword_table_name, NULL);
row_mysql_unlock_data_dictionary(trx);
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 9e9c0dc67e8..91c1ff53d2d 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2019, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2022, MariaDB Corporation.
+Copyright (c) 2013, 2023, 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
@@ -2547,6 +2547,11 @@ innodb_instant_alter_column_allowed_reason:
< dict_table_get_n_user_cols(m_prebuilt->table)));
if (fulltext_indexes && m_prebuilt->table->fts) {
+ /* FTS index of versioned table has row_end, need rebuild */
+ if (table->versioned() != altered_table->versioned()) {
+ need_rebuild= true;
+ }
+
/* FULLTEXT indexes are supposed to remain. */
/* Disallow DROP INDEX FTS_DOC_ID_INDEX */
@@ -3959,6 +3964,8 @@ innobase_fts_check_doc_id_index(
/* Check if a unique index with the name of
FTS_DOC_ID_INDEX_NAME is being created. */
+ const ulint fts_n_uniq= altered_table->versioned() ? 2 : 1;
+
for (uint i = 0; i < altered_table->s->keys; i++) {
const KEY& key = altered_table->key_info[i];
@@ -3968,7 +3975,7 @@ innobase_fts_check_doc_id_index(
}
if ((key.flags & HA_NOSAME)
- && key.user_defined_key_parts == 1
+ && key.user_defined_key_parts == fts_n_uniq
&& !(key.key_part[0].key_part_flag
& HA_REVERSE_SORT)
&& !strcmp(key.name.str, FTS_DOC_ID_INDEX_NAME)
@@ -4000,7 +4007,7 @@ innobase_fts_check_doc_id_index(
}
if (!dict_index_is_unique(index)
- || dict_index_get_n_unique(index) != 1
+ || dict_index_get_n_unique(index) != table->fts_n_uniq()
|| strcmp(index->name, FTS_DOC_ID_INDEX_NAME)) {
return(FTS_INCORRECT_DOC_ID_INDEX);
}
@@ -4042,6 +4049,7 @@ innobase_fts_check_doc_id_index_in_def(
{
/* Check whether there is a "FTS_DOC_ID_INDEX" in the to be built index
list */
+ const uint fts_n_uniq= key_info->table->versioned() ? 2 : 1;
for (ulint j = 0; j < n_key; j++) {
const KEY* key = &key_info[j];
@@ -4052,7 +4060,7 @@ innobase_fts_check_doc_id_index_in_def(
/* Do a check on FTS DOC ID_INDEX, it must be unique,
named as "FTS_DOC_ID_INDEX" and on column "FTS_DOC_ID" */
if (!(key->flags & HA_NOSAME)
- || key->user_defined_key_parts != 1
+ || key->user_defined_key_parts != fts_n_uniq
|| (key->key_part[0].key_part_flag & HA_REVERSE_SORT)
|| strcmp(key->name.str, FTS_DOC_ID_INDEX_NAME)
|| strcmp(key->key_part[0].field->field_name.str,
@@ -4245,14 +4253,24 @@ created_clustered:
if (add_fts_doc_idx) {
index_def_t* index = indexdef++;
+ uint nfields = 1;
+ if (altered_table->versioned())
+ ++nfields;
index->fields = static_cast<index_field_t*>(
- mem_heap_alloc(heap, sizeof *index->fields));
- index->n_fields = 1;
- index->fields->col_no = fts_doc_id_col;
- index->fields->prefix_len = 0;
- index->fields->descending = false;
- index->fields->is_v_col = false;
+ mem_heap_alloc(heap, sizeof(*index->fields) * nfields));
+ index->n_fields = nfields;
+ index->fields[0].col_no = fts_doc_id_col;
+ index->fields[0].prefix_len = 0;
+ index->fields[0].descending = false;
+ index->fields[0].is_v_col = false;
+ if (nfields == 2) {
+ index->fields[1].col_no
+ = altered_table->s->vers.end_fieldno;
+ index->fields[1].prefix_len = 0;
+ index->fields[1].descending = false;
+ index->fields[1].is_v_col = false;
+ }
index->ind_type = DICT_UNIQUE;
ut_ad(!rebuild
|| !add_fts_doc_id
@@ -11275,7 +11293,7 @@ err_index:
}
DBUG_EXECUTE_IF("stats_lock_fail",
- error = DB_LOCK_WAIT;);
+ error = DB_LOCK_WAIT_TIMEOUT;);
if (error == DB_SUCCESS) {
error = lock_sys_tables(trx);
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index da4c432e3f9..c76262ff5be 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2022, MariaDB Corporation.
+Copyright (c) 2013, 2023, 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
@@ -2443,6 +2443,9 @@ public:
mysql.innodb_index_stats or mysql.innodb_table_stats */
bool is_stats_table() const;
+ /** @return number of unique columns in FTS_DOC_ID index */
+ unsigned fts_n_uniq() const { return versioned() ? 2 : 1; }
+
/** Create metadata.
@param name table name
@param space tablespace
diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index 043a464dd30..0a821647dab 100644
--- a/storage/innobase/include/fts0fts.h
+++ b/storage/innobase/include/fts0fts.h
@@ -811,15 +811,14 @@ fts_get_max_doc_id(
/*===============*/
dict_table_t* table); /*!< in: user table */
-/******************************************************************//**
-Check whether user supplied stopword table exists and is of
-the right format.
-@return the stopword column charset if qualifies */
-CHARSET_INFO*
-fts_valid_stopword_table(
-/*=====================*/
- const char* stopword_table_name); /*!< in: Stopword table
- name */
+/** Check whether a stopword table is in the right format.
+@param stopword_table_name table name
+@param row_end name of the system-versioning end column, or "value"
+@return the stopword column charset
+@retval NULL if the table does not exist or qualify */
+CHARSET_INFO *fts_valid_stopword_table(const char *stopword_table_name,
+ const char **row_end= NULL);
+
/****************************************************************//**
This function loads specified stopword into FTS cache
@return true if success */
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index c661c52905b..e787d81e8c2 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -71,6 +71,11 @@ extern void (*log_file_op)(uint32_t space_id, int type,
const byte* name, ulint len,
const byte* new_name, ulint new_len);
+/** Report an operation which does undo log tablespace truncation
+during backup
+@param space_id undo tablespace identifier */
+extern void (*undo_space_trunc)(uint32_t space_id);
+
/** Report an operation which does INIT_PAGE for page0 during backup.
@param space_id tablespace identifier */
extern void (*first_page_init)(uint32_t space_id);
diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h
index 1f8af6030d1..517319e5b13 100644
--- a/storage/innobase/include/row0ins.h
+++ b/storage/innobase/include/row0ins.h
@@ -206,7 +206,6 @@ struct ins_node_t
if this is NULL, entry list should be created
and buffers for sys fields in row allocated */
void vers_update_end(row_prebuilt_t *prebuilt, bool history_row);
- bool vers_history_row() const; /* true if 'row' is historical */
};
/** Create an insert object.
diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h
index cc05df395ea..f60fc3595dc 100644
--- a/storage/innobase/include/row0upd.h
+++ b/storage/innobase/include/row0upd.h
@@ -516,17 +516,13 @@ public:
void vers_make_update(const trx_t *trx)
{
vers_update_fields(trx, table->vers_start);
- }
+ }
- /** Only set row_end = CURRENT_TIMESTAMP/trx->id.
- Do not touch other fields at all.
- @param[in] trx transaction */
- void vers_make_delete(const trx_t *trx)
- {
- update->n_fields = 0;
- is_delete = VERSIONED_DELETE;
- vers_update_fields(trx, table->vers_end);
- }
+ /** Prepare update vector for versioned delete.
+ Set row_end to CURRENT_TIMESTAMP or trx->id.
+ Initialize fts_next_doc_id for versioned delete.
+ @param[in] trx transaction */
+ void vers_make_delete(trx_t *trx);
};
#define UPD_NODE_MAGIC_N 1579975
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 41f61567b53..917319efbb7 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -3,7 +3,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2022, MariaDB Corporation.
+Copyright (c) 2013, 2023, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -294,8 +294,6 @@ extern ulint srv_lock_table_size;
/** the value of innodb_checksum_algorithm */
extern ulong srv_checksum_algorithm;
-
-extern uint srv_n_file_io_threads;
extern my_bool srv_random_read_ahead;
extern ulong srv_read_ahead_threshold;
extern uint srv_n_read_io_threads;
@@ -421,8 +419,6 @@ extern bool srv_log_file_created;
extern ulint srv_dml_needed_delay;
-#define SRV_MAX_N_IO_THREADS 130
-
/** innodb_purge_threads; the number of purge tasks to use */
extern uint srv_n_purge_threads;
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index ce17a4e6b9e..7d23001962b 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -1015,6 +1015,8 @@ void (*log_file_op)(uint32_t space_id, int type,
const byte* name, ulint len,
const byte* new_name, ulint new_len);
+void (*undo_space_trunc)(uint32_t space_id);
+
void (*first_page_init)(uint32_t space_id);
/** Information about initializing page contents during redo log processing.
@@ -2570,6 +2572,8 @@ inline recv_sys_t::parse_mtr_result recv_sys_t::parse(store_t store, source &l)
TRX_SYS_MAX_UNDO_SPACES, "compatibility");
truncated_undo_spaces[space_id - srv_undo_space_id_start]=
{ lsn, page_no };
+ if (undo_space_trunc)
+ undo_space_trunc(space_id);
#endif
last_offset= 1; /* the next record must not be same_page */
continue;
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index be67d629569..de58e3896b0 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -2011,6 +2011,61 @@ row_ins_dupl_error_with_rec(
return(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
}
+/** Determine whether a history row was inserted by this transaction
+(row TRX_ID is the same as current TRX_ID).
+@param index secondary index
+@param rec secondary index record
+@param trx transaction
+@return error code
+@retval DB_SUCCESS on success
+@retval DB_FOREIGN_DUPLICATE_KEY if a history row was inserted by trx */
+static dberr_t vers_row_same_trx(dict_index_t* index, const rec_t* rec,
+ const trx_t& trx)
+{
+ mtr_t mtr;
+ dberr_t ret= DB_SUCCESS;
+ dict_index_t *clust_index= dict_table_get_first_index(index->table);
+ ut_ad(index != clust_index);
+
+ mtr.start();
+
+ if (const rec_t *clust_rec=
+ row_get_clust_rec(BTR_SEARCH_LEAF, rec, index, &clust_index, &mtr))
+ {
+ rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
+ rec_offs *clust_offs= offsets_;
+ rec_offs_init(offsets_);
+ mem_heap_t *heap= NULL;
+
+ clust_offs=
+ rec_get_offsets(clust_rec, clust_index, clust_offs,
+ clust_index->n_core_fields, ULINT_UNDEFINED, &heap);
+ if (clust_index->vers_history_row(clust_rec, clust_offs))
+ {
+ ulint trx_id_len;
+ const byte *trx_id= rec_get_nth_field(clust_rec, clust_offs,
+ clust_index->n_uniq, &trx_id_len);
+ ut_ad(trx_id_len == DATA_TRX_ID_LEN);
+
+ if (trx.id == trx_read_trx_id(trx_id))
+ ret= DB_FOREIGN_DUPLICATE_KEY;
+ }
+
+ if (UNIV_LIKELY_NULL(heap))
+ mem_heap_free(heap);
+ }
+ else
+ {
+ ib::error() << "foreign constraints: secondary index " << index->name <<
+ " of table " << index->table->name << " is out of sync";
+ ut_ad("secondary index is out of sync" == 0);
+ ret= DB_TABLE_CORRUPT;
+ }
+
+ mtr.commit();
+ return ret;
+}
+
/***************************************************************//**
Scans a unique non-clustered index at a given index entry to determine
whether a uniqueness violation has occurred for the key value of the entry.
@@ -2061,8 +2116,8 @@ row_ins_scan_sec_index_for_duplicate(
n_fields_cmp = dtuple_get_n_fields_cmp(entry);
dtuple_set_n_fields_cmp(entry, n_unique);
- const auto allow_duplicates = thr_get_trx(thr)->duplicates;
pcur.btr_cur.page_cur.index = index;
+ trx_t* const trx = thr_get_trx(thr);
dberr_t err = btr_pcur_open(entry, PAGE_CUR_GE, BTR_SEARCH_LEAF,
&pcur, 0, mtr);
if (err != DB_SUCCESS) {
@@ -2088,7 +2143,7 @@ row_ins_scan_sec_index_for_duplicate(
if (flags & BTR_NO_LOCKING_FLAG) {
/* Set no locks when applying log
in online table rebuild. */
- } else if (allow_duplicates) {
+ } else if (trx->duplicates) {
/* If the SQL-query will update or replace
duplicate key we will take X-lock for
@@ -2122,9 +2177,18 @@ row_ins_scan_sec_index_for_duplicate(
if (cmp == 0) {
if (row_ins_dupl_error_with_rec(rec, entry,
index, offsets)) {
+
err = DB_DUPLICATE_KEY;
- thr_get_trx(thr)->error_info = index;
+ trx->error_info = index;
+
+ if (!index->table->versioned()) {
+ } else if (dberr_t e =
+ vers_row_same_trx(index, rec,
+ *trx)) {
+ err = e;
+ goto end_scan;
+ }
/* If the duplicate is on hidden FTS_DOC_ID,
state so in the error log */
@@ -3559,16 +3623,6 @@ row_ins_get_row_from_select(
}
}
-inline
-bool ins_node_t::vers_history_row() const
-{
- if (!table->versioned())
- return false;
- dfield_t* row_end = dtuple_get_nth_field(row, table->vers_end);
- return row_end->vers_history_row();
-}
-
-
/***********************************************************//**
Inserts a row to a table.
@return DB_SUCCESS if operation successfully completed, else error
@@ -3607,34 +3661,12 @@ row_ins(
ut_ad(node->state == INS_NODE_INSERT_ENTRIES);
while (dict_index_t *index = node->index) {
- /*
- We do not insert history rows into FTS_DOC_ID_INDEX because
- it is unique by FTS_DOC_ID only and we do not want to add
- row_end to unique key. Fulltext field works the way new
- FTS_DOC_ID is created on every fulltext UPDATE, so holding only
- FTS_DOC_ID for history is enough.
- */
- const unsigned type = index->type;
if (index->type & (DICT_FTS | DICT_CORRUPT)
|| !index->is_committed()) {
- } else if (!(type & DICT_UNIQUE) || index->n_uniq > 1
- || !node->vers_history_row()) {
-
- dberr_t err = row_ins_index_entry_step(node, thr);
-
- if (err != DB_SUCCESS) {
- DBUG_RETURN(err);
- }
- } else {
- /* Unique indexes with system versioning must contain
- the version end column. The only exception is a hidden
- FTS_DOC_ID_INDEX that InnoDB may create on a hidden or
- user-created FTS_DOC_ID column. */
- ut_ad(!strcmp(index->name, FTS_DOC_ID_INDEX_NAME));
- ut_ad(!strcmp(index->fields[0].name, FTS_DOC_ID_COL_NAME));
+ } else if (dberr_t err = row_ins_index_entry_step(node, thr)) {
+ DBUG_RETURN(err);
}
-
- node->index = dict_table_get_next_index(node->index);
+ node->index = dict_table_get_next_index(index);
++node->entry;
}
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index a4edf5672d5..723b4b1d387 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2022, MariaDB Corporation.
+Copyright (c) 2014, 2023, 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
@@ -524,6 +524,8 @@ static ulint row_merge_bulk_buf_add(row_merge_buf_t* buf,
@param[in,out] row table row
@param[in] ext cache of externally stored
column prefixes, or NULL
+@param[in] history_fts row is historical in a system-versioned table
+ on which a FTS_DOC_ID_INDEX(FTS_DOC_ID) exists
@param[in,out] doc_id Doc ID if we are creating
FTS index
@param[in,out] conv_heap memory heap where to allocate data when
@@ -546,6 +548,7 @@ row_merge_buf_add(
fts_psort_t* psort_info,
dtuple_t* row,
const row_ext_t* ext,
+ const bool history_fts,
doc_id_t* doc_id,
mem_heap_t* conv_heap,
dberr_t* err,
@@ -610,7 +613,7 @@ error:
: NULL;
/* Process the Doc ID column */
- if (!v_col && *doc_id
+ if (!v_col && (history_fts || *doc_id)
&& col->ind == index->table->fts->doc_col) {
fts_write_doc_id((byte*) &write_doc_id, *doc_id);
@@ -671,7 +674,7 @@ error:
}
/* Tokenize and process data for FTS */
- if (index->type & DICT_FTS) {
+ if (!history_fts && (index->type & DICT_FTS)) {
fts_doc_item_t* doc_item;
byte* value;
void* ptr;
@@ -1066,7 +1069,7 @@ static dberr_t row_merge_write_blob_to_tmp_file(
uint32_t len= field->len;
dberr_t err= os_file_write(
IORequestWrite, "(bulk insert)", blob_file->fd,
- field->data, blob_file->offset * srv_page_size, len);
+ field->data, blob_file->offset, len);
if (err != DB_SUCCESS)
return err;
@@ -2114,6 +2117,7 @@ corrupted_metadata:
dtuple_t* row;
row_ext_t* ext;
page_cur_t* cur = btr_pcur_get_page_cur(&pcur);
+ bool history_row, history_fts = false;
stage->n_pk_recs_inc();
@@ -2373,6 +2377,11 @@ end_of_index:
row_heap);
ut_ad(row);
+ history_row = new_table->versioned()
+ && dtuple_get_nth_field(row, new_table->vers_end)
+ ->vers_history_row();
+ history_fts = history_row && new_table->fts;
+
for (ulint i = 0; i < n_nonnull; i++) {
dfield_t* field = &row->fields[nonnull[i]];
@@ -2401,7 +2410,7 @@ end_of_index:
}
/* Get the next Doc ID */
- if (add_doc_id) {
+ if (add_doc_id && !history_fts) {
doc_id++;
} else {
doc_id = 0;
@@ -2437,13 +2446,6 @@ end_of_index:
ut_ad(add_autoinc
< dict_table_get_n_user_cols(new_table));
- bool history_row = false;
- if (new_table->versioned()) {
- const dfield_t* dfield = dtuple_get_nth_field(
- row, new_table->vers_end);
- history_row = dfield->vers_history_row();
- }
-
dfield_t* dfield = dtuple_get_nth_field(row,
add_autoinc);
@@ -2564,8 +2566,8 @@ write_buffers:
if (UNIV_LIKELY
(row && (rows_added = row_merge_buf_add(
buf, fts_index, old_table, new_table,
- psort_info, row, ext, &doc_id,
- conv_heap, &err,
+ psort_info, row, ext, history_fts,
+ &doc_id, conv_heap, &err,
&v_heap, eval_table, trx,
col_collate)))) {
@@ -2896,10 +2898,10 @@ write_buffers:
if (UNIV_UNLIKELY
(!(rows_added = row_merge_buf_add(
buf, fts_index, old_table,
- new_table, psort_info, row, ext,
- &doc_id, conv_heap,
- &err, &v_heap, eval_table,
- trx, col_collate)))) {
+ new_table, psort_info,
+ row, ext, history_fts, &doc_id,
+ conv_heap, &err, &v_heap,
+ eval_table, trx, col_collate)))) {
/* An empty buffer should have enough
room for at least one record. */
ut_ad(err == DB_COMPUTE_VALUE_FAILED
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 64f750d0f13..67167f19c70 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -1337,7 +1337,10 @@ error_exit:
return(err);
}
- if (dict_table_has_fts_index(table)) {
+ if (dict_table_has_fts_index(table)
+ && (!table->versioned()
+ || !node->row->fields[table->vers_end].vers_history_row())) {
+
doc_id_t doc_id;
/* Extract the doc id from the hidden FTS column */
@@ -1543,7 +1546,7 @@ row_fts_update_or_delete(
ut_a(dict_table_has_fts_index(prebuilt->table));
/* Deletes are simple; get them out of the way first. */
- if (node->is_delete == PLAIN_DELETE) {
+ if (node->is_delete) {
/* A delete affects all FTS indexes, so we pass NULL */
fts_trx_add_op(trx, table, old_doc_id, FTS_DELETE, NULL);
} else {
@@ -1552,7 +1555,7 @@ row_fts_update_or_delete(
if (new_doc_id == 0) {
ib::error() << "InnoDB FTS: Doc ID cannot be 0";
- return(DB_FTS_INVALID_DOCID);
+ DBUG_RETURN(DB_FTS_INVALID_DOCID);
}
row_fts_do_update(trx, table, old_doc_id, new_doc_id);
}
@@ -1984,7 +1987,7 @@ row_update_cascade_for_mysql(
return(DB_FOREIGN_EXCEED_MAX_CASCADE);
}
- const trx_t* trx = thr_get_trx(thr);
+ trx_t* trx = thr_get_trx(thr);
if (table->versioned()) {
if (node->is_delete == PLAIN_DELETE) {
diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc
index 599033353c5..b998d27d836 100644
--- a/storage/innobase/row/row0row.cc
+++ b/storage/innobase/row/row0row.cc
@@ -1346,7 +1346,7 @@ row_raw_format_int(
ulint buf_size, /*!< in: output buffer size
in bytes */
ibool* format_in_hex) /*!< out: should the data be
- formated in hex */
+ formatted in hex */
{
ulint ret;
@@ -1394,7 +1394,7 @@ row_raw_format_str(
ulint buf_size, /*!< in: output buffer size
in bytes */
ibool* format_in_hex) /*!< out: should the data be
- formated in hex */
+ formatted in hex */
{
ulint charset_coll;
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index b13a727f59f..23100a96ebd 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -5200,12 +5200,11 @@ wrong_offs:
ut_ad(set_also_gap_locks);
#endif /* WITH_WSREP */
- if ((unique_search && !rec_get_deleted_flag(rec, comp))
- || dict_index_is_spatial(index)) {
-
+ /* Set next-key lock both for delete- and non-delete-marked
+ records for unique search, because non-delete-marked record can
+ be marked as deleted while transaction suspends. */
+ if (index->is_spatial()) {
goto no_gap_lock;
- } else {
- lock_type = LOCK_ORDINARY;
}
/* If we are doing a 'greater or equal than a primary key
@@ -5227,6 +5226,8 @@ wrong_offs:
&& !cmp_dtuple_rec(search_tuple, rec, index, offsets)) {
no_gap_lock:
lock_type = LOCK_REC_NOT_GAP;
+ } else {
+ lock_type = LOCK_ORDINARY;
}
err = sel_set_rec_lock(pcur,
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index 3b2fe849bcd..a3f940adff5 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -2987,3 +2987,16 @@ skip_append:
}
}
}
+
+
+/** Prepare update vector for versioned delete.
+Set row_end to CURRENT_TIMESTAMP or trx->id.
+Initialize fts_next_doc_id for versioned delete.
+@param[in] trx transaction */
+void upd_node_t::vers_make_delete(trx_t* trx)
+{
+ update->n_fields= 0;
+ is_delete= VERSIONED_DELETE;
+ vers_update_fields(trx, table->vers_end);
+ trx->fts_next_doc_id= table->fts ? UINT64_UNDEFINED : 0;
+}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 7493eae13c7..3684866770b 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -108,9 +108,6 @@ lsn_t srv_shutdown_lsn;
/** TRUE if a raw partition is in use */
ibool srv_start_raw_disk_in_use;
-/** Number of IO threads to use */
-uint srv_n_file_io_threads;
-
/** UNDO tablespaces starts with space id. */
uint32_t srv_undo_space_id_start;
@@ -1005,18 +1002,11 @@ dberr_t srv_start(bool create_new_db)
return(srv_init_abort(err));
}
- srv_n_file_io_threads = srv_n_read_io_threads + srv_n_write_io_threads;
-
- if (!srv_read_only_mode) {
- /* Add the log and ibuf IO threads. */
- srv_n_file_io_threads += 2;
- } else {
+ if (srv_read_only_mode) {
ib::info() << "Disabling background log and ibuf IO write"
<< " threads.";
}
- ut_a(srv_n_file_io_threads <= SRV_MAX_N_IO_THREADS);
-
if (os_aio_init()) {
ib::error() << "Cannot initialize AIO sub-system";
diff --git a/storage/maria/ma_locking.c b/storage/maria/ma_locking.c
index b14a8ddfdcd..c8e6394179c 100644
--- a/storage/maria/ma_locking.c
+++ b/storage/maria/ma_locking.c
@@ -282,7 +282,7 @@ int _ma_readinfo(register MARIA_HA *info __attribute__ ((unused)),
/*
- Every isam-function that uppdates the isam-database MUST end with this
+ Every isam-function that updates the isam-database MUST end with this
request
NOTES
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 6572ff8e140..8e6426e3aa4 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -957,7 +957,7 @@ char *translog_filename_by_fileno(uint32 file_no, char *path)
DBUG_ENTER("translog_filename_by_fileno");
DBUG_ASSERT(file_no <= 0xfffffff);
- /* log_descriptor.directory is already formated */
+ /* log_descriptor.directory is already formatted */
end= strxmov(path, log_descriptor.directory, "aria_log.0000000", NullS);
length= (uint) (int10_to_str(file_no, buff, 10) - buff);
strmov(end - length +1, buff);
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index 67b253761bc..33a1c86c0d7 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -508,7 +508,7 @@ int _mi_readinfo(register MI_INFO *info, int lock_type, int check_keybuffer)
/*
- Every isam-function that uppdates the isam-database MUST end with this
+ Every isam-function that updates the isam-database MUST end with this
request
*/
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index e951fff1bb1..a492685eb84 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -7716,7 +7716,7 @@ int rdb_split_normalized_tablename(const std::string &fullname,
into MyRocks Data Dictionary
The method is called during create table/partition, truncate table/partition
- @param table_name IN table's name formated as
+ @param table_name IN table's name formatted as
'dbname.tablename'
@param table_arg IN sql table
@param auto_increment_value IN specified table's auto increment value
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index 7309c0499f2..48297a4ae07 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -1,5 +1,5 @@
/* Copyright (C) 2008-2019 Kentoku Shiba
- Copyright (C) 2019-2022 MariaDB corp
+ Copyright (C) 2019-2023 MariaDB corp
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
@@ -10983,6 +10983,16 @@ int ha_spider::create(
sql_command == SQLCOM_DROP_INDEX
)
DBUG_RETURN(0);
+ if (!is_supported_parser_charset(info->default_table_charset))
+ {
+ String charset_option;
+ charset_option.append(STRING_WITH_LEN("CHARSET "));
+ charset_option.append(info->default_table_charset->cs_name);
+ my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0), "SPIDER",
+ charset_option.c_ptr());
+ error_num= ER_ILLEGAL_HA_CREATE_OPTION;
+ goto error_charset;
+ }
if (!(trx = spider_get_trx(thd, TRUE, &error_num)))
goto error_get_trx;
if (
@@ -11157,6 +11167,7 @@ error:
spider_free_share_alloc(&tmp_share);
error_alter_before_unlock:
error_get_trx:
+error_charset:
DBUG_RETURN(error_num);
}
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29562.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29562.result
new file mode 100644
index 00000000000..561ce18a603
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29562.result
@@ -0,0 +1,47 @@
+#
+# MDEV-29562 Spider table with charset utf32/utf16/ucs2 tries to set client charset to unsupported value
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=Spider CHARSET utf32 COMMENT='table "tbl_a", srv "s_2_1"';
+ERROR HY000: Table storage engine 'SPIDER' does not support the create option 'CHARSET utf32'
+ALTER DATABASE auto_test_local CHARSET="ucs2";
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=Spider COMMENT='table "tbl_a", srv "s_2_1"';
+ERROR HY000: Table storage engine 'SPIDER' does not support the create option 'CHARSET ucs2'
+CREATE TABLE tbl_a (
+a INT
+) ENGINE=Spider CHARSET utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+SELECT * FROM tbl_a;
+a
+ALTER TABLE tbl_a CONVERT TO CHARACTER SET utf16;
+ERROR HY000: Table storage engine 'SPIDER' does not support the create option 'CHARSET utf16'
+ALTER TABLE tbl_a CONVERT TO CHARACTER SET utf16le;
+ERROR HY000: Table storage engine 'SPIDER' does not support the create option 'CHARSET utf16le'
+ALTER TABLE tbl_a CONVERT TO CHARACTER SET latin1;
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29653.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29653.result
new file mode 100644
index 00000000000..abbcfcb74cc
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29653.result
@@ -0,0 +1,33 @@
+#
+# MDEV-29653 Assertion `0' failed in Item_cache_row::illegal_method_call on SELECT from Spider table
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE t (
+c INT
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE ts (
+c INT
+) ENGINE=Spider COMMENT='table "t", srv "s_2_1"';
+SELECT 1 FROM ts WHERE ROW(c, c) NOT IN ((0,0),(1,1));
+1
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29562.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_29562.cnf
new file mode 100644
index 00000000000..05dfd8a0bce
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29562.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29562.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29562.test
new file mode 100644
index 00000000000..5ddb2cef492
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29562.test
@@ -0,0 +1,54 @@
+--echo #
+--echo # MDEV-29562 Spider table with charset utf32/utf16/ucs2 tries to set client charset to unsupported value
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+eval CREATE TABLE tbl_a (
+ a INT
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+--error ER_ILLEGAL_HA_CREATE_OPTION
+eval CREATE TABLE tbl_a (
+ a INT
+) $MASTER_1_ENGINE CHARSET utf32 COMMENT='table "tbl_a", srv "s_2_1"';
+
+ALTER DATABASE auto_test_local CHARSET="ucs2";
+--error ER_ILLEGAL_HA_CREATE_OPTION
+eval CREATE TABLE tbl_a (
+ a INT
+) $MASTER_1_ENGINE COMMENT='table "tbl_a", srv "s_2_1"';
+
+eval CREATE TABLE tbl_a (
+ a INT
+) $MASTER_1_ENGINE CHARSET utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+SELECT * FROM tbl_a;
+
+--error ER_ILLEGAL_HA_CREATE_OPTION
+ALTER TABLE tbl_a CONVERT TO CHARACTER SET utf16;
+--error ER_ILLEGAL_HA_CREATE_OPTION
+ALTER TABLE tbl_a CONVERT TO CHARACTER SET utf16le;
+
+ALTER TABLE tbl_a CONVERT TO CHARACTER SET latin1;
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.cnf
new file mode 100644
index 00000000000..05dfd8a0bce
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.test
new file mode 100644
index 00000000000..6accaed38fe
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29653.test
@@ -0,0 +1,37 @@
+--echo #
+--echo # MDEV-29653 Assertion `0' failed in Item_cache_row::illegal_method_call on SELECT from Spider table
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+eval CREATE TABLE t (
+ c INT
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+eval CREATE TABLE ts (
+ c INT
+) $MASTER_1_ENGINE COMMENT='table "t", srv "s_2_1"';
+
+SELECT 1 FROM ts WHERE ROW(c, c) NOT IN ((0,0),(1,1));
+
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+
+--connection child2_1
+DROP DATABASE IF EXISTS auto_test_remote;
+
+--disable_query_log
+--disable_result_log
+--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log