summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysqltest.cc4
-rw-r--r--cmake/FindLZ4.cmake6
-rw-r--r--cmake/FindZSTD.cmake (renamed from cmake/Findzstd.cmake)6
-rw-r--r--cmake/configure.pl2
-rw-r--r--cmake/dtrace.cmake3
-rw-r--r--dbug/dbug.c4
-rwxr-xr-xdbug/dbug_add_tags.pl2
-rwxr-xr-xdbug/remove_function_from_trace.pl2
-rwxr-xr-xdebian/additions/mysqlreport2
-rw-r--r--extra/mariabackup/xtrabackup.cc6
-rw-r--r--include/ilist.h103
-rw-r--r--include/my_sys.h2
-rw-r--r--include/my_valgrind.h71
-rw-r--r--libmysqld/libmysql.c3
-rwxr-xr-xmysql-test/lib/process-purecov-annotations.pl2
-rwxr-xr-xmysql-test/lib/t/SafeProcessStress.pl2
-rw-r--r--mysql-test/lib/t/copytree.t2
-rw-r--r--mysql-test/lib/t/dummyd.pl2
-rw-r--r--mysql-test/lib/t/rmtree.t2
-rwxr-xr-xmysql-test/lib/t/testMyConfig.t2
-rwxr-xr-xmysql-test/lib/t/testMyConfigFactory.t2
-rwxr-xr-xmysql-test/lib/t/test_child.pl2
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl2
-rw-r--r--mysql-test/main/func_json.result13
-rw-r--r--mysql-test/main/func_json.test13
-rw-r--r--mysql-test/main/information_schema.result10
-rw-r--r--mysql-test/main/information_schema.test12
-rw-r--r--mysql-test/main/join_outer.result31
-rw-r--r--mysql-test/main/join_outer.test35
-rw-r--r--mysql-test/main/join_outer_jcl6.result31
-rw-r--r--mysql-test/main/log_tables.result6
-rw-r--r--mysql-test/main/log_tables.test8
-rw-r--r--mysql-test/main/mysql_upgrade.test2
-rw-r--r--mysql-test/main/nested_profiling.result20
-rw-r--r--mysql-test/main/nested_profiling.test42
-rw-r--r--mysql-test/main/opt_trace.result31
-rw-r--r--mysql-test/main/opt_trace.test11
-rw-r--r--mysql-test/main/rowid_filter_myisam.result21
-rw-r--r--mysql-test/main/rowid_filter_myisam.test1625
-rw-r--r--mysql-test/main/sp-big.result4
-rw-r--r--mysql-test/main/sp-big.test13
-rw-r--r--mysql-test/main/subselect4.result31
-rw-r--r--mysql-test/main/subselect4.test27
-rw-r--r--mysql-test/main/temp_table.result18
-rw-r--r--mysql-test/main/temp_table.test19
-rw-r--r--mysql-test/main/type_temporal_innodb.result3
-rw-r--r--mysql-test/main/type_temporal_innodb.test4
-rw-r--r--mysql-test/main/upgrade_MDEV-19650.test4
-rw-r--r--mysql-test/main/upgrade_MDEV-23102-1.result286
-rw-r--r--mysql-test/main/upgrade_MDEV-23102-1.test163
-rw-r--r--mysql-test/main/upgrade_MDEV-23102-2.result262
-rw-r--r--mysql-test/main/upgrade_MDEV-23102-2.test141
-rw-r--r--mysql-test/main/win.result10
-rw-r--r--mysql-test/main/win.test13
-rw-r--r--mysql-test/mtr.out-of-source2
-rwxr-xr-xmysql-test/mysql-stress-test.pl2
-rwxr-xr-xmysql-test/mysql-test-run.pl38
-rwxr-xr-xmysql-test/std_data/checkDBI_DBD-mysql.pl2
-rw-r--r--mysql-test/suite/csv/read_only.test1
-rwxr-xr-xmysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl2
-rwxr-xr-xmysql-test/suite/funcs_1/lib/DataGen_local.pl2
-rwxr-xr-xmysql-test/suite/funcs_1/lib/DataGen_modify.pl2
-rwxr-xr-xmysql-test/suite/funcs_2/lib/gen_charset_utf8.pl2
-rw-r--r--mysql-test/suite/galera/disabled.def1
-rw-r--r--mysql-test/suite/galera/galera_3nodes_as_slave.cnf3
-rw-r--r--mysql-test/suite/galera/r/galera_drop_database.result25
-rw-r--r--mysql-test/suite/galera/r/galera_lock_tables_in_transaction.result12
-rw-r--r--mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result18
-rw-r--r--mysql-test/suite/galera/t/MW-388.test2
-rw-r--r--mysql-test/suite/galera/t/MW-86-wait1.test2
-rw-r--r--mysql-test/suite/galera/t/MW-86-wait8.test3
-rw-r--r--mysql-test/suite/galera/t/galera_drop_database.test20
-rw-r--r--mysql-test/suite/galera/t/galera_lock_tables_in_transaction.test21
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache_sync_wait.test2
-rw-r--r--mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test24
-rw-r--r--mysql-test/suite/galera/t/galera_var_retry_autocommit.test2
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result40
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result50
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result55
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test262
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test273
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test299
-rw-r--r--mysql-test/suite/innodb/r/information_schema_grants.result4
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result7
-rw-r--r--mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test8
-rw-r--r--mysql-test/suite/mariabackup/incremental_backup.test5
-rw-r--r--mysql-test/suite/mariabackup/options_check.result1
-rw-r--r--mysql-test/suite/mariabackup/options_check.test7
-rw-r--r--mysql-test/suite/rpl/disabled.def1
-rwxr-xr-xmysql-test/suite/rpl/extension/checksum.pl2
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result47
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test121
-rw-r--r--mysql-test/suite/versioning/r/sysvars.result30
-rw-r--r--mysql-test/suite/versioning/t/sysvars.test26
-rw-r--r--mysys/my_alloc.c2
-rw-r--r--plugin/auth_gssapi/CMakeLists.txt6
-rw-r--r--plugin/auth_gssapi/gssapi_server.cc2
-rw-r--r--plugin/auth_pam/auth_pam.c27
-rwxr-xr-xplugin/handler_socket/client/hspool_test.pl2
-rwxr-xr-xplugin/handler_socket/client/hstest.pl2
-rwxr-xr-xplugin/handler_socket/perl-Net-HandlerSocket/lib/Net/HandlerSocket/Pool.pm2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test01.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test02.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test03.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test04.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test05.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test06.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test07.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test08.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test09.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test10.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test11.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test12.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test13.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test14.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test15.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test16.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test17.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test18.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test19.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test20.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test21.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test22.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test23.pl2
-rw-r--r--plugin/handler_socket/regtest/test_01_lib/test24.pl2
-rwxr-xr-xscripts/convert-debug-for-diff.sh2
-rw-r--r--scripts/mysql_system_tables.sql10
-rw-r--r--scripts/mytop.sh2
-rw-r--r--scripts/wsrep_sst_rsync.sh4
-rw-r--r--sql-bench/as3ap.sh2
-rw-r--r--sql-bench/bench-count-distinct.sh2
-rw-r--r--sql-bench/bench-init.pl.sh2
-rw-r--r--sql-bench/compare-results.sh2
-rw-r--r--sql-bench/copy-db.sh2
-rw-r--r--sql-bench/crash-me.sh2
-rwxr-xr-xsql-bench/graph-compare-results.sh2
-rw-r--r--sql-bench/innotest1.sh2
-rw-r--r--sql-bench/innotest1a.sh2
-rw-r--r--sql-bench/innotest1b.sh2
-rw-r--r--sql-bench/innotest2.sh2
-rw-r--r--sql-bench/innotest2a.sh2
-rw-r--r--sql-bench/innotest2b.sh2
-rw-r--r--sql-bench/run-all-tests.sh2
-rw-r--r--sql-bench/server-cfg.sh2
-rw-r--r--sql-bench/test-ATIS.sh2
-rw-r--r--sql-bench/test-alter-table.sh2
-rw-r--r--sql-bench/test-big-tables.sh2
-rw-r--r--sql-bench/test-connect.sh2
-rw-r--r--sql-bench/test-create.sh2
-rw-r--r--sql-bench/test-insert.sh2
-rw-r--r--sql-bench/test-select.sh2
-rwxr-xr-xsql-bench/test-table-elimination.sh2
-rw-r--r--sql-bench/test-transactions.sh2
-rw-r--r--sql-bench/test-wisconsin.sh2
-rw-r--r--sql/field.cc13
-rw-r--r--sql/field.h11
-rw-r--r--sql/filesort.cc9
-rw-r--r--sql/ha_partition.cc2
-rw-r--r--sql/handler.h3
-rw-r--r--sql/item_jsonfunc.cc35
-rw-r--r--sql/item_jsonfunc.h1
-rw-r--r--sql/item_subselect.cc4
-rw-r--r--sql/item_windowfunc.cc4
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/opt_range.cc6
-rw-r--r--sql/rpl_rli.cc8
-rw-r--r--sql/session_tracker.cc14
-rw-r--r--sql/signal_handler.cc2
-rw-r--r--sql/sql_load.cc4
-rw-r--r--sql/sql_parse.cc14
-rw-r--r--sql/sql_prepare.cc5
-rw-r--r--sql/sql_repl.cc8
-rw-r--r--sql/sql_select.cc76
-rw-r--r--sql/sql_show.cc42
-rw-r--r--sql/sql_table.cc7
-rw-r--r--sql/table.cc19
-rw-r--r--sql/table.h6
-rw-r--r--sql/unireg.cc4
-rw-r--r--sql/winservice.c44
-rw-r--r--storage/innobase/btr/btr0cur.cc30
-rw-r--r--storage/innobase/btr/btr0sea.cc21
-rw-r--r--storage/innobase/buf/buf0buddy.cc37
-rw-r--r--storage/innobase/buf/buf0buf.cc41
-rw-r--r--storage/innobase/buf/buf0dblwr.cc5
-rw-r--r--storage/innobase/buf/buf0flu.cc6
-rw-r--r--storage/innobase/buf/buf0lru.cc39
-rw-r--r--storage/innobase/data/data0data.cc48
-rw-r--r--storage/innobase/dict/dict0stats.cc59
-rw-r--r--storage/innobase/fil/fil0fil.cc38
-rw-r--r--storage/innobase/fsp/fsp0sysspace.cc13
-rw-r--r--storage/innobase/fts/fts0fts.cc51
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
-rw-r--r--storage/innobase/handler/handler0alter.cc1
-rw-r--r--storage/innobase/handler/i_s.cc2
-rw-r--r--storage/innobase/include/buf0buf.h2
-rw-r--r--storage/innobase/include/buf0buf.ic2
-rw-r--r--storage/innobase/include/data0data.ic20
-rw-r--r--storage/innobase/include/dict0stats.ic43
-rw-r--r--storage/innobase/include/fts0fts.h6
-rw-r--r--storage/innobase/include/mem0mem.ic6
-rw-r--r--storage/innobase/include/page0zip.ic4
-rw-r--r--storage/innobase/include/rem0rec.h18
-rw-r--r--storage/innobase/include/rem0rec.ic2
-rw-r--r--storage/innobase/include/srv0mon.h10
-rw-r--r--storage/innobase/include/univ.i57
-rw-r--r--storage/innobase/include/ut0pool.h23
-rw-r--r--storage/innobase/log/log0recv.cc8
-rw-r--r--storage/innobase/mem/mem0mem.cc5
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc2
-rw-r--r--storage/innobase/os/os0proc.cc12
-rw-r--r--storage/innobase/page/page0cur.cc26
-rw-r--r--storage/innobase/page/page0zip.cc124
-rw-r--r--storage/innobase/row/row0ext.cc2
-rw-r--r--storage/innobase/row/row0ftsort.cc10
-rw-r--r--storage/innobase/row/row0ins.cc4
-rw-r--r--storage/innobase/row/row0log.cc26
-rw-r--r--storage/innobase/row/row0merge.cc33
-rw-r--r--storage/innobase/row/row0mysql.cc4
-rw-r--r--storage/innobase/row/row0sel.cc28
-rw-r--r--storage/innobase/row/row0upd.cc2
-rw-r--r--storage/innobase/sync/sync0arr.cc4
-rw-r--r--storage/innobase/trx/trx0trx.cc19
-rw-r--r--storage/innobase/ut/ut0crc32.cc27
-rw-r--r--storage/innobase/ut/ut0ut.cc6
-rw-r--r--storage/maria/ha_maria.cc2
-rwxr-xr-xstorage/myisam/ftbench/Ecompare.pl2
-rwxr-xr-xstorage/myisam/ftbench/Ecreate.pl2
-rwxr-xr-xstorage/myisam/ftbench/Ereport.pl2
-rw-r--r--storage/myisam/ha_myisam.cc5
-rw-r--r--storage/myisam/mi_key.c10
-rw-r--r--storage/rocksdb/CMakeLists.txt10
-rw-r--r--storage/rocksdb/build_rocksdb.cmake81
-rw-r--r--storage/tokudb/ha_tokudb.cc5
-rw-r--r--strings/my_vsnprintf.c8
-rwxr-xr-xtests/big_record.pl2
-rwxr-xr-xtests/drop_test.pl2
-rwxr-xr-xtests/export.pl2
-rwxr-xr-xtests/fork2_test.pl2
-rwxr-xr-xtests/fork_big.pl2
-rw-r--r--tests/fork_big2.pl2
-rwxr-xr-xtests/grant.pl2
-rwxr-xr-xtests/index_corrupt.pl2
-rwxr-xr-xtests/insert_and_repair.pl2
-rwxr-xr-xtests/lock_test.pl2
-rwxr-xr-xtests/mail_to_db.pl2
-rw-r--r--tests/mysql_client_test.c56
-rwxr-xr-xtests/pmail.pl2
-rwxr-xr-xtests/rename_test.pl2
-rwxr-xr-xtests/table_types.pl2
-rwxr-xr-xtests/test_delayed_insert.pl2
-rwxr-xr-xtests/truncate.pl2
-rw-r--r--unittest/unit.pl2
252 files changed, 5309 insertions, 909 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 84a3875f308..33e4d04527f 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -10126,7 +10126,7 @@ void append_replace_regex(char* expr, char *expr_end, struct st_replace_regex* r
/* Allow variable for the *entire* list of replacements */
if (*p == '$')
{
- const char *v_end;
+ const char *v_end= 0;
VAR *val= var_get(p, &v_end, 0, 1);
if (val)
@@ -10767,7 +10767,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
for (i=1 ; i <= found_sets ; i++)
{
pos=from[found_set[i-1].table_offset];
- rep_str[i].found= !memcmp(pos, "\\^", 3) ? 2 : 1;
+ rep_str[i].found= !strncmp(pos, "\\^", 3) ? 2 : 1;
rep_str[i].replace_string=to_array[found_set[i-1].table_offset];
rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos);
rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+
diff --git a/cmake/FindLZ4.cmake b/cmake/FindLZ4.cmake
index e97dd63e2b0..46c1fdc1b9f 100644
--- a/cmake/FindLZ4.cmake
+++ b/cmake/FindLZ4.cmake
@@ -1,9 +1,9 @@
find_path(LZ4_INCLUDE_DIR NAMES lz4.h)
-find_library(LZ4_LIBRARY NAMES lz4)
+find_library(LZ4_LIBRARIES NAMES lz4)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
LZ4 DEFAULT_MSG
- LZ4_LIBRARY LZ4_INCLUDE_DIR)
+ LZ4_LIBRARIES LZ4_INCLUDE_DIR)
-mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY)
+mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARIES)
diff --git a/cmake/Findzstd.cmake b/cmake/FindZSTD.cmake
index 8cd4c248145..ede59010742 100644
--- a/cmake/Findzstd.cmake
+++ b/cmake/FindZSTD.cmake
@@ -5,10 +5,6 @@
# ZSTD_LIBRARIES - List of libraries when using zstd.
# ZSTD_FOUND - True if zstd found.
-if (DEFINED ZSTD_LIBRARIES)
- return()
-endif()
-
find_path(ZSTD_INCLUDE_DIR
NAMES zstd.h
HINTS ${ZSTD_ROOT_DIR}/include)
@@ -18,7 +14,7 @@ find_library(ZSTD_LIBRARIES
HINTS ${ZSTD_ROOT_DIR}/lib)
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(zstd DEFAULT_MSG ZSTD_LIBRARIES ZSTD_INCLUDE_DIR)
+find_package_handle_standard_args(ZSTD DEFAULT_MSG ZSTD_LIBRARIES ZSTD_INCLUDE_DIR)
mark_as_advanced(
ZSTD_LIBRARIES
diff --git a/cmake/configure.pl b/cmake/configure.pl
index a63ce5a483e..c296c5ba4b8 100644
--- a/cmake/configure.pl
+++ b/cmake/configure.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
#
diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake
index 1e29ba685e0..dae3b56b584 100644
--- a/cmake/dtrace.cmake
+++ b/cmake/dtrace.cmake
@@ -43,7 +43,8 @@ MACRO(CHECK_DTRACE)
IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
AND NOT BUGGY_GCC_NO_DTRACE_MODULES
AND NOT BUGGY_LINUX_DTRACE
- AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS"
+ AND NOT WIN32)
SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace")
ENDIF()
# On GNU/Hurd, dtrace is not supported
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 847a8cc2b5d..011b932a721 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -490,6 +490,7 @@ static int DbugParse(CODE_STATE *cs, const char *control)
rel= control[0] == '+' || control[0] == '-';
if ((!rel || (!stack->out_file && !stack->next)))
{
+ LockIfInitSettings(cs);
FreeState(cs, 0);
stack->flags= 0;
stack->delay= 0;
@@ -497,10 +498,9 @@ static int DbugParse(CODE_STATE *cs, const char *control)
stack->sub_level= 0;
stack->out_file= sstderr;
stack->functions= NULL;
- LockIfInitSettings(cs);
stack->keywords= NULL;
- UnlockIfInitSettings(cs);
stack->processes= NULL;
+ UnlockIfInitSettings(cs);
}
else if (!stack->out_file)
{
diff --git a/dbug/dbug_add_tags.pl b/dbug/dbug_add_tags.pl
index 7be8fb9b18d..f117bdcd65b 100755
--- a/dbug/dbug_add_tags.pl
+++ b/dbug/dbug_add_tags.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2002 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
diff --git a/dbug/remove_function_from_trace.pl b/dbug/remove_function_from_trace.pl
index 380df168caf..67d7fa54b6a 100755
--- a/dbug/remove_function_from_trace.pl
+++ b/dbug/remove_function_from_trace.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
die <<EEE unless @ARGV;
Usage: $0 func1 [func2 [ ...] ]
diff --git a/debian/additions/mysqlreport b/debian/additions/mysqlreport
index 6588b17f808..0c7688abed0 100755
--- a/debian/additions/mysqlreport
+++ b/debian/additions/mysqlreport
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
# mysqlreport v4.0 Oct 23 2015
# http://hackmysql.com/mysqlreport
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 3946879415d..0f30e02fb7b 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -119,6 +119,7 @@ my_bool xtrabackup_move_back;
my_bool xtrabackup_decrypt_decompress;
my_bool xtrabackup_print_param;
my_bool xtrabackup_mysqld_args;
+my_bool xtrabackup_help;
my_bool xtrabackup_export;
@@ -1458,6 +1459,11 @@ struct my_option xb_server_options[] =
(G_PTR *) &xtrabackup_mysqld_args, (G_PTR *) &xtrabackup_mysqld_args, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"help", '?',
+ "Display this help and exit.",
+ (G_PTR *) &xtrabackup_help, (G_PTR *) &xtrabackup_help, 0,
+ GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
diff --git a/include/ilist.h b/include/ilist.h
index 74cb472cd4e..822f0334022 100644
--- a/include/ilist.h
+++ b/include/ilist.h
@@ -16,7 +16,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
*/
-#pragma once
+#ifndef ILIST_H
+#define ILIST_H
#include <cstddef>
#include <iterator>
@@ -24,15 +25,17 @@
// Derive your class from this struct to insert to a linked list.
template <class Tag= void> struct ilist_node
{
- ilist_node()
+ ilist_node() noexcept
#ifndef DBUG_OFF
- :
- next(NULL), prev(NULL)
+ : next(NULL), prev(NULL)
#endif
{
}
- ilist_node(ilist_node *next, ilist_node *prev) : next(next), prev(prev) {}
+ ilist_node(ilist_node *next, ilist_node *prev) noexcept
+ : next(next), prev(prev)
+ {
+ }
ilist_node *next;
ilist_node *prev;
@@ -70,40 +73,40 @@ public:
typedef T *pointer;
typedef T &reference;
- Iterator(ListNode *node) : node_(node) {}
+ Iterator(ListNode *node) noexcept : node_(node) {}
- Iterator &operator++()
+ Iterator &operator++() noexcept
{
node_= node_->next;
return *this;
}
- Iterator operator++(int)
+ Iterator operator++(int) noexcept
{
Iterator tmp(*this);
operator++();
return tmp;
}
- Iterator &operator--()
+ Iterator &operator--() noexcept
{
node_= node_->prev;
return *this;
}
- Iterator operator--(int)
+ Iterator operator--(int) noexcept
{
Iterator tmp(*this);
operator--();
return tmp;
}
- reference operator*() { return *static_cast<pointer>(node_); }
- pointer operator->() { return static_cast<pointer>(node_); }
+ reference operator*() noexcept { return *static_cast<pointer>(node_); }
+ pointer operator->() noexcept { return static_cast<pointer>(node_); }
- friend bool operator==(const Iterator &lhs, const Iterator &rhs)
+ friend bool operator==(const Iterator &lhs, const Iterator &rhs) noexcept
{
return lhs.node_ == rhs.node_;
}
- friend bool operator!=(const Iterator &lhs, const Iterator &rhs)
+ friend bool operator!=(const Iterator &lhs, const Iterator &rhs) noexcept
{
return !(lhs == rhs);
}
@@ -114,30 +117,36 @@ public:
friend class ilist;
};
- ilist() : sentinel_(&sentinel_, &sentinel_) {}
+ ilist() noexcept : sentinel_(&sentinel_, &sentinel_) {}
- reference front() { return *begin(); }
- reference back() { return *--end(); }
- const_reference front() const { return *begin(); }
- const_reference back() const { return *--end(); }
+ reference front() noexcept { return *begin(); }
+ reference back() noexcept { return *--end(); }
+ const_reference front() const noexcept { return *begin(); }
+ const_reference back() const noexcept { return *--end(); }
- iterator begin() { return iterator(sentinel_.next); }
- const_iterator begin() const
+ iterator begin() noexcept { return iterator(sentinel_.next); }
+ const_iterator begin() const noexcept
{
return iterator(const_cast<ListNode *>(sentinel_.next));
}
- iterator end() { return iterator(&sentinel_); }
- const_iterator end() const
+ iterator end() noexcept { return iterator(&sentinel_); }
+ const_iterator end() const noexcept
{
return iterator(const_cast<ListNode *>(&sentinel_));
}
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const { return reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const { return reverse_iterator(begin()); }
+ reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const noexcept
+ {
+ return reverse_iterator(end());
+ }
+ reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
+ const_reverse_iterator rend() const noexcept
+ {
+ return reverse_iterator(begin());
+ }
- bool empty() const { return sentinel_.next == &sentinel_; }
+ bool empty() const noexcept { return sentinel_.next == &sentinel_; }
// Not implemented because it's O(N)
// size_type size() const
@@ -145,13 +154,13 @@ public:
// return static_cast<size_type>(std::distance(begin(), end()));
// }
- void clear()
+ void clear() noexcept
{
sentinel_.next= &sentinel_;
sentinel_.prev= &sentinel_;
}
- iterator insert(iterator pos, reference value)
+ iterator insert(iterator pos, reference value) noexcept
{
ListNode *curr= pos.node_;
ListNode *prev= pos.node_->prev;
@@ -165,7 +174,7 @@ public:
return iterator(&value);
}
- iterator erase(iterator pos)
+ iterator erase(iterator pos) noexcept
{
ListNode *prev= pos.node_->prev;
ListNode *next= pos.node_->next;
@@ -182,15 +191,15 @@ public:
return next;
}
- void push_back(reference value) { insert(end(), value); }
- void pop_back() { erase(end()); }
+ void push_back(reference value) noexcept { insert(end(), value); }
+ void pop_back() noexcept { erase(end()); }
- void push_front(reference value) { insert(begin(), value); }
- void pop_front() { erase(begin()); }
+ void push_front(reference value) noexcept { insert(begin(), value); }
+ void pop_front() noexcept { erase(begin()); }
// STL version is O(n) but this is O(1) because an element can't be inserted
// several times in the same ilist.
- void remove(reference value) { erase(iterator(&value)); }
+ void remove(reference value) noexcept { erase(iterator(&value)); }
private:
ListNode sentinel_;
@@ -216,36 +225,38 @@ public:
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const iterator> const_reverse_iterator;
- sized_ilist() : size_(0) {}
+ sized_ilist() noexcept : size_(0) {}
- size_type size() const { return size_; }
+ size_type size() const noexcept { return size_; }
- void clear()
+ void clear() noexcept
{
BASE::clear();
size_= 0;
}
- iterator insert(iterator pos, reference value)
+ iterator insert(iterator pos, reference value) noexcept
{
++size_;
return BASE::insert(pos, value);
}
- iterator erase(iterator pos)
+ iterator erase(iterator pos) noexcept
{
--size_;
return BASE::erase(pos);
}
- void push_back(reference value) { insert(BASE::end(), value); }
- void pop_back() { erase(BASE::end()); }
+ void push_back(reference value) noexcept { insert(BASE::end(), value); }
+ void pop_back() noexcept { erase(BASE::end()); }
- void push_front(reference value) { insert(BASE::begin(), value); }
- void pop_front() { erase(BASE::begin()); }
+ void push_front(reference value) noexcept { insert(BASE::begin(), value); }
+ void pop_front() noexcept { erase(BASE::begin()); }
- void remove(reference value) { erase(iterator(&value)); }
+ void remove(reference value) noexcept { erase(iterator(&value)); }
private:
size_type size_;
};
+
+#endif
diff --git a/include/my_sys.h b/include/my_sys.h
index 71ec7f917c6..d3fdc3657a9 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -534,6 +534,7 @@ static inline int my_b_read(IO_CACHE *info, uchar *Buffer, size_t Count)
static inline int my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
{
+ MEM_CHECK_DEFINED(Buffer, Count);
if (info->write_pos + Count <= info->write_end)
{
memcpy(info->write_pos, Buffer, Count);
@@ -555,6 +556,7 @@ static inline int my_b_get(IO_CACHE *info)
static inline my_bool my_b_write_byte(IO_CACHE *info, uchar chr)
{
+ MEM_CHECK_DEFINED(&chr, 1);
if (info->write_pos >= info->write_end)
if (my_b_flush_io_cache(info, 1))
return 1;
diff --git a/include/my_valgrind.h b/include/my_valgrind.h
index 8aaa261fd5b..62794a2d70c 100644
--- a/include/my_valgrind.h
+++ b/include/my_valgrind.h
@@ -24,66 +24,77 @@
# define __SANITIZE_ADDRESS__ 1
#endif
-#ifdef HAVE_valgrind
-#define IF_VALGRIND(A,B) A
-#else
-#define IF_VALGRIND(A,B) B
-#endif
-
-#if defined(HAVE_VALGRIND_MEMCHECK_H) && defined(HAVE_valgrind)
+#if __has_feature(memory_sanitizer)
+# include <sanitizer/msan_interface.h>
+# define HAVE_valgrind
+# define MEM_UNDEFINED(a,len) __msan_allocated_memory(a,len)
+# define MEM_MAKE_ADDRESSABLE(a,len) MEM_UNDEFINED(a,len)
+# define MEM_MAKE_DEFINED(a,len) __msan_unpoison(a,len)
+# define MEM_NOACCESS(a,len) ((void) 0)
+# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
+# define MEM_CHECK_DEFINED(a,len) __msan_check_mem_is_initialized(a,len)
+# define MEM_GET_VBITS(a,b,len) __msan_copy_shadow(b,a,len)
+# define MEM_SET_VBITS(a,b,len) __msan_copy_shadow(a,b,len)
+# define REDZONE_SIZE 8
+#elif defined(HAVE_VALGRIND_MEMCHECK_H) && defined(HAVE_valgrind)
# include <valgrind/memcheck.h>
-# define HAVE_valgrind_or_MSAN
# define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
+# define MEM_MAKE_ADDRESSABLE(a,len) MEM_UNDEFINED(a,len)
# define MEM_MAKE_DEFINED(a,len) VALGRIND_MAKE_MEM_DEFINED(a,len)
# define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
# define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len)
# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
+# define MEM_GET_VBITS(a,b,len) VALGRIND_GET_VBITS(a,b,len)
+# define MEM_SET_VBITS(a,b,len) VALGRIND_SET_VBITS(a,b,len)
# define REDZONE_SIZE 8
#elif defined(__SANITIZE_ADDRESS__)
# include <sanitizer/asan_interface.h>
/* How to do manual poisoning:
https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
-# define MEM_UNDEFINED(a,len) ASAN_UNPOISON_MEMORY_REGION(a,len)
+# define MEM_UNDEFINED(a,len) ((void) 0)
+# define MEM_MAKE_ADDRESSABLE(a,len) ASAN_UNPOISON_MEMORY_REGION(a,len)
# define MEM_MAKE_DEFINED(a,len) ((void) 0)
# define MEM_NOACCESS(a,len) ASAN_POISON_MEMORY_REGION(a,len)
-# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
+# define MEM_CHECK_ADDRESSABLE(a,len) \
+ assert(!__asan_region_is_poisoned((void*) a,len))
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
-# define REDZONE_SIZE 8
-#elif __has_feature(memory_sanitizer)
-# include <sanitizer/msan_interface.h>
-# define HAVE_valgrind_or_MSAN
-# define MEM_UNDEFINED(a,len) __msan_allocated_memory(a,len)
-# define MEM_MAKE_DEFINED(a,len) __msan_unpoison(a,len)
-# define MEM_NOACCESS(a,len) ((void) 0)
-# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
-# define MEM_CHECK_DEFINED(a,len) __msan_check_mem_is_initialized(a,len)
+# define MEM_GET_VBITS(a,b,len) ((void) 0)
+# define MEM_SET_VBITS(a,b,len) ((void) 0)
# define REDZONE_SIZE 8
#else
-# define MEM_UNDEFINED(a,len) ((void) (a), (void) (len))
+# define MEM_UNDEFINED(a,len) ((void) 0)
+# define MEM_MAKE_ADDRESSABLE(a,len) ((void) 0)
# define MEM_MAKE_DEFINED(a,len) ((void) 0)
# define MEM_NOACCESS(a,len) ((void) 0)
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
+# define MEM_GET_VBITS(a,b,len) ((void) 0)
+# define MEM_SET_VBITS(a,b,len) ((void) 0)
# define REDZONE_SIZE 0
-#endif /* HAVE_VALGRIND_MEMCHECK_H */
+#endif /* __has_feature(memory_sanitizer) */
+
+#ifdef HAVE_valgrind
+#define IF_VALGRIND(A,B) A
+#else
+#define IF_VALGRIND(A,B) B
+#endif
#ifdef TRASH_FREED_MEMORY
/*
- TRASH_FILL() has to call MEM_UNDEFINED() to cancel any effect of TRASH_FREE().
+ _TRASH_FILL() has to call MEM_MAKE_ADDRESSABLE() to cancel any effect of
+ TRASH_FREE().
This can happen in the case one does
TRASH_ALLOC(A,B) ; TRASH_FREE(A,B) ; TRASH_ALLOC(A,B)
to reuse the same memory in an internal memory allocator like MEM_ROOT.
- For my_malloc() and safemalloc() the extra MEM_UNDEFINED is bit of an
- overkill.
- TRASH_FILL() is an internal function and should not be used externally.
+ _TRASH_FILL() is an internal function and should not be used externally.
*/
-#define TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); MEM_UNDEFINED(A, trash_tmp); memset(A, C, trash_tmp); } while (0)
+#define _TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); MEM_MAKE_ADDRESSABLE(A, trash_tmp); memset(A, C, trash_tmp); } while (0)
#else
-#define TRASH_FILL(A,B,C) do { MEM_UNDEFINED((A), (B)); } while (0)
+#define _TRASH_FILL(A,B,C) do { MEM_UNDEFINED((A), (B)); } while (0)
#endif
-/** Note that some memory became allocated or uninitialized. */
-#define TRASH_ALLOC(A,B) do { TRASH_FILL(A,B,0xA5); MEM_UNDEFINED(A,B); } while(0)
+/** Note that some memory became allocated and/or uninitialized. */
+#define TRASH_ALLOC(A,B) do { _TRASH_FILL(A,B,0xA5); MEM_MAKE_ADDRESSABLE(A,B); } while(0)
/** Note that some memory became freed. (Prohibit further access to it.) */
-#define TRASH_FREE(A,B) do { TRASH_FILL(A,B,0x8F); MEM_NOACCESS(A,B); } while(0)
+#define TRASH_FREE(A,B) do { _TRASH_FILL(A,B,0x8F); MEM_NOACCESS(A,B); } while(0)
#endif /* MY_VALGRIND_INCLUDED */
diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c
index bd5176566d6..52e6a08d2f8 100644
--- a/libmysqld/libmysql.c
+++ b/libmysqld/libmysql.c
@@ -154,8 +154,10 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
*/
#if MYSQL_PORT_DEFAULT == 0
+# if !__has_feature(memory_sanitizer) // Work around MSAN deficiency
if ((serv_ptr= getservbyname("mysql", "tcp")))
mysql_port= (uint) ntohs((ushort) serv_ptr->s_port);
+# endif
#endif
if ((env= getenv("MYSQL_TCP_PORT")))
mysql_port=(uint) atoi(env);
@@ -1139,6 +1141,7 @@ my_bool STDCALL mysql_embedded(void)
void my_net_local_init(NET *net)
{
net->max_packet= (uint) net_buffer_length;
+ net->read_timeout= net->write_timeout= 0;
my_net_set_read_timeout(net, CLIENT_NET_READ_TIMEOUT);
my_net_set_write_timeout(net, CLIENT_NET_WRITE_TIMEOUT);
net->retry_count= 1;
diff --git a/mysql-test/lib/process-purecov-annotations.pl b/mysql-test/lib/process-purecov-annotations.pl
index d533bd02fd6..4381aae4c64 100755
--- a/mysql-test/lib/process-purecov-annotations.pl
+++ b/mysql-test/lib/process-purecov-annotations.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# This script processes a .gcov coverage report to honor purecov
diff --git a/mysql-test/lib/t/SafeProcessStress.pl b/mysql-test/lib/t/SafeProcessStress.pl
index f591e9665dd..352b956d803 100755
--- a/mysql-test/lib/t/SafeProcessStress.pl
+++ b/mysql-test/lib/t/SafeProcessStress.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007, 2008 MySQL AB
diff --git a/mysql-test/lib/t/copytree.t b/mysql-test/lib/t/copytree.t
index 15a41081b24..76a3d644751 100644
--- a/mysql-test/lib/t/copytree.t
+++ b/mysql-test/lib/t/copytree.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007 MySQL AB
diff --git a/mysql-test/lib/t/dummyd.pl b/mysql-test/lib/t/dummyd.pl
index 15164428b95..e78648cfacf 100644
--- a/mysql-test/lib/t/dummyd.pl
+++ b/mysql-test/lib/t/dummyd.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007 MySQL AB
diff --git a/mysql-test/lib/t/rmtree.t b/mysql-test/lib/t/rmtree.t
index 40c9e96eabd..033bc59ad21 100644
--- a/mysql-test/lib/t/rmtree.t
+++ b/mysql-test/lib/t/rmtree.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007 MySQL AB
diff --git a/mysql-test/lib/t/testMyConfig.t b/mysql-test/lib/t/testMyConfig.t
index cd0a3a41b7a..99647c14ba1 100755
--- a/mysql-test/lib/t/testMyConfig.t
+++ b/mysql-test/lib/t/testMyConfig.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007 MySQL AB
diff --git a/mysql-test/lib/t/testMyConfigFactory.t b/mysql-test/lib/t/testMyConfigFactory.t
index f38f660e85a..5ba63b3d823 100755
--- a/mysql-test/lib/t/testMyConfigFactory.t
+++ b/mysql-test/lib/t/testMyConfigFactory.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007 MySQL AB, 2009 Sun Microsystems, Inc.
diff --git a/mysql-test/lib/t/test_child.pl b/mysql-test/lib/t/test_child.pl
index efbec4a9620..8a23c3d7541 100755
--- a/mysql-test/lib/t/test_child.pl
+++ b/mysql-test/lib/t/test_child.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2007 MySQL AB
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
index af95ecbaa58..6fe5f66fbfc 100755
--- a/mysql-test/lib/v1/mysql-test-run.pl
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result
index 3343771c218..e2d8468899d 100644
--- a/mysql-test/main/func_json.result
+++ b/mysql-test/main/func_json.result
@@ -916,6 +916,19 @@ NULL
Warnings:
Warning 4037 Unexpected end of JSON text in argument 2 to function 'json_merge_patch'
#
+# MDEV-22976 CAST(JSON_EXTRACT() AS DECIMAL) does not handle boolean values
+#
+SELECT
+CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DOUBLE) AS cf,
+CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DECIMAL) AS cd;
+cf cd
+1 1
+SELECT
+CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DOUBLE) AS cf,
+CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DECIMAL) AS cd;
+cf cd
+0 0
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test
index 1ac47d4f329..2d4ad107250 100644
--- a/mysql-test/main/func_json.test
+++ b/mysql-test/main/func_json.test
@@ -538,6 +538,19 @@ SELECT JSON_MERGE_PATCH('{', '[1,2,3]');
SELECT JSON_MERGE_PATCH('{"a":"b"}', '[1,');
--echo #
+--echo # MDEV-22976 CAST(JSON_EXTRACT() AS DECIMAL) does not handle boolean values
+--echo #
+
+SELECT
+ CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DOUBLE) AS cf,
+ CAST(JSON_EXTRACT('{"x":true}', '$.x') AS DECIMAL) AS cd;
+
+SELECT
+ CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DOUBLE) AS cf,
+ CAST(JSON_EXTRACT('{"x":false}', '$.x') AS DECIMAL) AS cd;
+
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result
index 43e15abb7ee..697e00635eb 100644
--- a/mysql-test/main/information_schema.result
+++ b/mysql-test/main/information_schema.result
@@ -2209,3 +2209,13 @@ column_name
c1
c2
DROP TABLE tt1, tt2;
+#
+# MDEV-13242 Wrong results for queries with row constructors and information_schema
+#
+SELECT SCHEMA_NAME from information_schema.schemata where schema_name='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
+SCHEMA_NAME
+SELECT SCHEMA_NAME from information_schema.schemata where schema_name=REPEAT('a',193);
+SCHEMA_NAME
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/main/information_schema.test b/mysql-test/main/information_schema.test
index dc0ad5cff59..55a36614d61 100644
--- a/mysql-test/main/information_schema.test
+++ b/mysql-test/main/information_schema.test
@@ -1911,3 +1911,15 @@ SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (t
SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name='tt1' AND column_name='c1') OR (table_name='tt2' AND column_name='c2');
SELECT column_name FROM information_schema.columns WHERE (table_name, column_name) IN (('tt1','c1'),('tt2', 'c2')) ORDER BY column_name;
DROP TABLE tt1, tt2;
+
+--echo #
+--echo # MDEV-13242 Wrong results for queries with row constructors and information_schema
+--echo #
+
+SELECT SCHEMA_NAME from information_schema.schemata where schema_name='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
+SELECT SCHEMA_NAME from information_schema.schemata where schema_name=REPEAT('a',193);
+
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --git a/mysql-test/main/join_outer.result b/mysql-test/main/join_outer.result
index 676eb53f830..c92b8e6115b 100644
--- a/mysql-test/main/join_outer.result
+++ b/mysql-test/main/join_outer.result
@@ -2755,3 +2755,34 @@ WHERE t3.pk IN (2);
drop view v4;
drop table t1,t2,t3,t4;
SET optimizer_switch=@org_optimizer_switch;
+#
+# MDEV-22866: Crash in join optimizer with constant outer join nest
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (c INT, KEY(c)) ENGINE=MyISAM;
+CREATE TABLE t4 (d INT, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (5),(6);
+CREATE TABLE t5 (e INT) ENGINE=MyISAM;
+INSERT INTO t5 VALUES (7),(8);
+CREATE TABLE t6 (f INT) ENGINE=MyISAM;
+INSERT INTO t6 VALUES (9),(10);
+SELECT *
+FROM
+t1
+LEFT JOIN (
+t2 LEFT JOIN (
+t3 JOIN
+t4 ON t3.c = t4.d and t3.c >2 and t3.c<0
+) ON t2.b >= t4.d
+) ON t1.a <= t2.b
+LEFT JOIN t5 ON t2.b = t5.e
+LEFT JOIN t6 ON t3.c = t6.f;
+a b c d e f
+1 3 NULL NULL NULL NULL
+2 3 NULL NULL NULL NULL
+1 4 NULL NULL NULL NULL
+2 4 NULL NULL NULL NULL
+drop table t1,t2,t3,t4,t5,t6;
diff --git a/mysql-test/main/join_outer.test b/mysql-test/main/join_outer.test
index 2e5fc65ebb6..f835d8af5a8 100644
--- a/mysql-test/main/join_outer.test
+++ b/mysql-test/main/join_outer.test
@@ -2252,3 +2252,38 @@ drop view v4;
drop table t1,t2,t3,t4;
SET optimizer_switch=@org_optimizer_switch;
+
+--echo #
+--echo # MDEV-22866: Crash in join optimizer with constant outer join nest
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+
+CREATE TABLE t3 (c INT, KEY(c)) ENGINE=MyISAM;
+
+CREATE TABLE t4 (d INT, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (5),(6);
+
+CREATE TABLE t5 (e INT) ENGINE=MyISAM;
+INSERT INTO t5 VALUES (7),(8);
+
+CREATE TABLE t6 (f INT) ENGINE=MyISAM;
+INSERT INTO t6 VALUES (9),(10);
+
+SELECT *
+FROM
+ t1
+ LEFT JOIN (
+ t2 LEFT JOIN (
+ t3 JOIN
+ t4 ON t3.c = t4.d and t3.c >2 and t3.c<0
+ ) ON t2.b >= t4.d
+ ) ON t1.a <= t2.b
+ LEFT JOIN t5 ON t2.b = t5.e
+ LEFT JOIN t6 ON t3.c = t6.f;
+
+drop table t1,t2,t3,t4,t5,t6;
diff --git a/mysql-test/main/join_outer_jcl6.result b/mysql-test/main/join_outer_jcl6.result
index f34078ceeb2..2c7dc7b85bb 100644
--- a/mysql-test/main/join_outer_jcl6.result
+++ b/mysql-test/main/join_outer_jcl6.result
@@ -2762,3 +2762,34 @@ WHERE t3.pk IN (2);
drop view v4;
drop table t1,t2,t3,t4;
SET optimizer_switch=@org_optimizer_switch;
+#
+# MDEV-22866: Crash in join optimizer with constant outer join nest
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (c INT, KEY(c)) ENGINE=MyISAM;
+CREATE TABLE t4 (d INT, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (5),(6);
+CREATE TABLE t5 (e INT) ENGINE=MyISAM;
+INSERT INTO t5 VALUES (7),(8);
+CREATE TABLE t6 (f INT) ENGINE=MyISAM;
+INSERT INTO t6 VALUES (9),(10);
+SELECT *
+FROM
+t1
+LEFT JOIN (
+t2 LEFT JOIN (
+t3 JOIN
+t4 ON t3.c = t4.d and t3.c >2 and t3.c<0
+) ON t2.b >= t4.d
+) ON t1.a <= t2.b
+LEFT JOIN t5 ON t2.b = t5.e
+LEFT JOIN t6 ON t3.c = t6.f;
+a b c d e f
+1 3 NULL NULL NULL NULL
+2 3 NULL NULL NULL NULL
+1 4 NULL NULL NULL NULL
+2 4 NULL NULL NULL NULL
+drop table t1,t2,t3,t4,t5,t6;
diff --git a/mysql-test/main/log_tables.result b/mysql-test/main/log_tables.result
index aed5dbfba3d..6059afc6631 100644
--- a/mysql-test/main/log_tables.result
+++ b/mysql-test/main/log_tables.result
@@ -259,6 +259,12 @@ Warning 1286 Unknown storage engine 'NonExistentEngine'
alter table mysql.slow_log engine=memory;
ERROR HY000: Storage engine MEMORY cannot be used for log tables
set storage_engine= @save_storage_engine;
+ALTER TABLE mysql.general_log ENGINE=Aria;
+ERROR HY000: Storage engine Aria cannot be used for log tables
+ALTER TABLE mysql.general_log ENGINE=Aria transactional = 0;
+ALTER TABLE mysql.slow_log ENGINE=Aria;
+ERROR HY000: Storage engine Aria cannot be used for log tables
+ALTER TABLE mysql.slow_log ENGINE=Aria transactional = 0;
drop table mysql.slow_log;
drop table mysql.general_log;
drop table mysql.general_log;
diff --git a/mysql-test/main/log_tables.test b/mysql-test/main/log_tables.test
index 4ea8a7639ef..0823b3e0eb4 100644
--- a/mysql-test/main/log_tables.test
+++ b/mysql-test/main/log_tables.test
@@ -269,6 +269,14 @@ alter table mysql.slow_log engine=memory;
#alter table mysql.slow_log engine=blackhole;
set storage_engine= @save_storage_engine;
+# Make sure only non-transactional Aria table can be used for logging
+--error ER_UNSUPORTED_LOG_ENGINE
+ALTER TABLE mysql.general_log ENGINE=Aria;
+ALTER TABLE mysql.general_log ENGINE=Aria transactional = 0;
+--error ER_UNSUPORTED_LOG_ENGINE
+ALTER TABLE mysql.slow_log ENGINE=Aria;
+ALTER TABLE mysql.slow_log ENGINE=Aria transactional = 0;
+
drop table mysql.slow_log;
drop table mysql.general_log;
diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test
index 0dad53f8881..451148049f5 100644
--- a/mysql-test/main/mysql_upgrade.test
+++ b/mysql-test/main/mysql_upgrade.test
@@ -17,7 +17,7 @@ let $MYSQLD_DATADIR= `select @@datadir`;
file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
--echo Run it again - should say already completed
---replace_result $MYSQL_SERVER_VERSION VERSION
+--replace_regex /upgraded to .*, use/upgraded to VERSION, use/
--exec $MYSQL_UPGRADE 2>&1
# It should have created a file in the MySQL Servers datadir
diff --git a/mysql-test/main/nested_profiling.result b/mysql-test/main/nested_profiling.result
new file mode 100644
index 00000000000..b8bceba480a
--- /dev/null
+++ b/mysql-test/main/nested_profiling.result
@@ -0,0 +1,20 @@
+SET @saved_profiling=@@GLOBAL.profiling;
+SET @saved_init_connect=@@GLOBAL.init_connect;
+SET GLOBAL init_connect="set @a=2;set @b=3";
+SET GLOBAL profiling=on;
+create user mysqltest1@localhost;
+connect con1,localhost,mysqltest1,,;
+connection con1;
+SELECT @a, @b;
+@a @b
+2 3
+SHOW PROFILES;
+Query_ID Duration Query
+1 # set @a=2;set @b=3
+2 # set @b=3
+3 # SELECT @a, @b
+connection default;
+disconnect con1;
+DROP USER mysqltest1@localhost;
+SET GLOBAL profiling=@saved_profiling;
+SET GLOBAL init_connect=@saved_init_connect;
diff --git a/mysql-test/main/nested_profiling.test b/mysql-test/main/nested_profiling.test
new file mode 100644
index 00000000000..ba89aefc647
--- /dev/null
+++ b/mysql-test/main/nested_profiling.test
@@ -0,0 +1,42 @@
+# ==== Purpose ====
+#
+# Test verifies that "init_connect" and "init_slave" system variables work
+# fine when "profiling=on".
+#
+# ==== Implementation ====
+#
+# Steps:
+# 0 - Create regular user without super privilege so that "init_connect"
+# variable is effective.
+# 1 - Enable profiling.
+# 2 - Start a new connection which will try to execute the statements
+# specified in "init_connect". No assert should be reported.
+# 3 - Execute SHOW PROFILES to verify that statements specified in
+# "init_connect" are displayed as part of profiling.
+#
+# ==== References ====
+#
+# MDEV-22706: Assertion `!current' failed in PROFILING::start_new_query
+#
+--source include/not_embedded.inc
+--source include/have_profiling.inc
+
+SET @saved_profiling=@@GLOBAL.profiling;
+SET @saved_init_connect=@@GLOBAL.init_connect;
+SET GLOBAL init_connect="set @a=2;set @b=3";
+SET GLOBAL profiling=on;
+
+create user mysqltest1@localhost;
+connect (con1,localhost,mysqltest1,,);
+connection con1;
+SELECT @a, @b;
+--replace_column 2 #
+SHOW PROFILES;
+
+#========== Clean up ===========
+connection default;
+disconnect con1;
+DROP USER mysqltest1@localhost;
+
+SET GLOBAL profiling=@saved_profiling;
+SET GLOBAL init_connect=@saved_init_connect;
diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result
index 6da22802cca..ee1273decf6 100644
--- a/mysql-test/main/opt_trace.result
+++ b/mysql-test/main/opt_trace.result
@@ -8559,5 +8559,36 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns'))
]
]
drop table t1;
+#
+# MDEV-22910:SIGSEGV in Opt_trace_context::is_started & SIGSEGV in Json_writer::add_table_name
+# (on optimized builds)
+#
+CREATE TABLE t1( a INT, b INT, PRIMARY KEY( a ) );
+SELECT sum(b), row_number() OVER (order by b) FROM t1 WHERE a = 101;
+sum(b) row_number() OVER (order by b)
+NULL 1
+UPDATE t1 SET b=10 WHERE a=1;
+SELECT JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives'))
+[
+
+ [
+
+ {
+ "index": "PRIMARY",
+ "ranges":
+ [
+ "(1) <= (a) <= (1)"
+ ],
+ "rowid_ordered": true,
+ "using_mrr": false,
+ "index_only": false,
+ "rows": 0,
+ "cost": 1.125,
+ "chosen": true
+ }
+ ]
+]
+DROP TABLE t1;
set optimizer_trace='enabled=off';
# End of 10.4 tests
diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test
index 8633ed5b020..9040b5a54d0 100644
--- a/mysql-test/main/opt_trace.test
+++ b/mysql-test/main/opt_trace.test
@@ -611,5 +611,16 @@ EXPLAIN EXTENDED SELECT * from t1 WHERE b >= 10 and b < 25;
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_columns')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
drop table t1;
+--echo #
+--echo # MDEV-22910:SIGSEGV in Opt_trace_context::is_started & SIGSEGV in Json_writer::add_table_name
+--echo # (on optimized builds)
+--echo #
+
+CREATE TABLE t1( a INT, b INT, PRIMARY KEY( a ) );
+SELECT sum(b), row_number() OVER (order by b) FROM t1 WHERE a = 101;
+UPDATE t1 SET b=10 WHERE a=1;
+SELECT JSON_DETAILED(JSON_EXTRACT(trace, '$**.range_scan_alternatives')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+DROP TABLE t1;
+
set optimizer_trace='enabled=off';
--echo # End of 10.4 tests
diff --git a/mysql-test/main/rowid_filter_myisam.result b/mysql-test/main/rowid_filter_myisam.result
new file mode 100644
index 00000000000..927257d2cc7
--- /dev/null
+++ b/mysql-test/main/rowid_filter_myisam.result
@@ -0,0 +1,21 @@
+#
+# MDEV-22553: Assertion `info->lastpos == (~ (my_off_t) 0)' failed in mi_rkey with rowid_filer=on
+#
+CREATE TABLE t1 (
+a smallint(6) DEFAULT NULL,
+b bigint(20) DEFAULT NULL,
+c varchar(64) DEFAULT NULL,
+d varchar(64) DEFAULT NULL,
+e smallint(6) DEFAULT NULL,
+f bigint(20) DEFAULT NULL,
+KEY a (a),
+KEY d (d),
+KEY f (f)
+) ENGINE=MyISAM;
+ALTER TABLE t1 DISABLE KEYS;
+# Insert a lot of rows
+ALTER TABLE t1 ENABLE KEYS;
+# Must not crash:
+SELECT * FROM t1 WHERE ( a BETWEEN 255 AND 270 OR f = 200 ) AND f IN ( 1, 4, 112, 143 ) AND d IN ('Montana', 'South Dakota');
+a b c d e f
+DROP TABLE t1;
diff --git a/mysql-test/main/rowid_filter_myisam.test b/mysql-test/main/rowid_filter_myisam.test
new file mode 100644
index 00000000000..3ea4dc26ea0
--- /dev/null
+++ b/mysql-test/main/rowid_filter_myisam.test
@@ -0,0 +1,1625 @@
+--echo #
+--echo # MDEV-22553: Assertion `info->lastpos == (~ (my_off_t) 0)' failed in mi_rkey with rowid_filer=on
+--echo #
+
+CREATE TABLE t1 (
+ a smallint(6) DEFAULT NULL,
+ b bigint(20) DEFAULT NULL,
+ c varchar(64) DEFAULT NULL,
+ d varchar(64) DEFAULT NULL,
+ e smallint(6) DEFAULT NULL,
+ f bigint(20) DEFAULT NULL,
+ KEY a (a),
+ KEY d (d),
+ KEY f (f)
+) ENGINE=MyISAM;
+
+ALTER TABLE t1 DISABLE KEYS;
+--echo # Insert a lot of rows
+--disable_query_log
+INSERT INTO t1 VALUES (13954,0,NULL,'c',NULL,0);
+INSERT INTO t1 VALUES (124,0,NULL,'j',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'h',NULL,9);
+INSERT INTO t1 VALUES (4,0,NULL,'New Hampshire',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'q',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'f',NULL,NULL);
+INSERT INTO t1 VALUES (2,0,NULL,'b',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'y',NULL,0);
+INSERT INTO t1 VALUES (106,0,NULL,'Hawaii',NULL,-480);
+INSERT INTO t1 VALUES (10534,0,NULL,'South Carolina',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'Iowa',NULL,0);
+INSERT INTO t1 VALUES (6,0,NULL,'g',NULL,9);
+INSERT INTO t1 VALUES (0,0,NULL,'Arkansas',NULL,116);
+INSERT INTO t1 VALUES (0,0,NULL,'b',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'release',NULL,-624);
+INSERT INTO t1 VALUES (169,0,NULL,'s',NULL,664);
+INSERT INTO t1 VALUES (20060,0,NULL,'l',NULL,672);
+INSERT INTO t1 VALUES (NULL,0,NULL,'q',NULL,235);
+INSERT INTO t1 VALUES (1,0,NULL,'Tennessee',NULL,8);
+INSERT INTO t1 VALUES (687,0,NULL,'j',NULL,21);
+INSERT INTO t1 VALUES (-19736,0,NULL,'s',NULL,NULL);
+INSERT INTO t1 VALUES (81,0,NULL,'p',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'festival',NULL,97);
+INSERT INTO t1 VALUES (NULL,0,NULL,'c',NULL,264);
+INSERT INTO t1 VALUES (0,0,NULL,'o',NULL,NULL);
+INSERT INTO t1 VALUES (-30578,0,NULL,'exam',NULL,NULL);
+INSERT INTO t1 VALUES (30751,0,NULL,'Nebraska',NULL,0);
+INSERT INTO t1 VALUES (8,0,NULL,'d',NULL,0);
+INSERT INTO t1 VALUES (29585,0,NULL,'California',NULL,585);
+INSERT INTO t1 VALUES (15376,0,NULL,'Indiana',NULL,768);
+INSERT INTO t1 VALUES (7162,0,NULL,'gifted',NULL,NULL);
+INSERT INTO t1 VALUES (28102,0,NULL,'w',NULL,616);
+INSERT INTO t1 VALUES (NULL,0,NULL,'b',NULL,NULL);
+INSERT INTO t1 VALUES (80,0,NULL,'p',NULL,NULL);
+INSERT INTO t1 VALUES (4,0,NULL,'o',NULL,282);
+INSERT INTO t1 VALUES (32767,0,NULL,'p',NULL,2);
+INSERT INTO t1 VALUES (255,0,NULL,'b',NULL,0);
+INSERT INTO t1 VALUES (202,0,NULL,'Mississippi',NULL,0);
+INSERT INTO t1 VALUES (16253,0,NULL,'Alaska',NULL,872);
+INSERT INTO t1 VALUES (5,0,NULL,'q',NULL,-656);
+INSERT INTO t1 VALUES (32767,0,NULL,'q',NULL,3);
+INSERT INTO t1 VALUES (7,0,NULL,'Rhode Island',NULL,250);
+INSERT INTO t1 VALUES (0,0,NULL,'b',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'s',NULL,885);
+INSERT INTO t1 VALUES (NULL,0,NULL,'i',NULL,-56);
+INSERT INTO t1 VALUES (201,0,NULL,'ridiculous',NULL,-704);
+INSERT INTO t1 VALUES (5,0,NULL,'teenage',NULL,82);
+INSERT INTO t1 VALUES (0,0,NULL,'Alabama',NULL,NULL);
+INSERT INTO t1 VALUES (4,0,NULL,'i',NULL,1);
+INSERT INTO t1 VALUES (-9774,0,NULL,'v',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'y',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Alabama',NULL,NULL);
+INSERT INTO t1 VALUES (7,0,NULL,'e',NULL,8);
+INSERT INTO t1 VALUES (3,0,NULL,'l',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'drift',NULL,6);
+INSERT INTO t1 VALUES (0,0,NULL,'v',NULL,230);
+INSERT INTO t1 VALUES (5926,0,NULL,'Colorado',NULL,254);
+INSERT INTO t1 VALUES (NULL,0,NULL,'South Carolina',NULL,512);
+INSERT INTO t1 VALUES (9,0,NULL,'othapwsr',NULL,NULL);
+INSERT INTO t1 VALUES (23437,0,NULL,'h',NULL,0);
+INSERT INTO t1 VALUES (18863,0,NULL,'guideline',NULL,-80);
+INSERT INTO t1 VALUES (NULL,0,NULL,'s',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'New Mexico',NULL,272);
+INSERT INTO t1 VALUES (79,0,NULL,'partnership',NULL,5);
+INSERT INTO t1 VALUES (0,0,NULL,'e',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'r',NULL,128);
+INSERT INTO t1 VALUES (42,0,NULL,'tz',NULL,NULL);
+INSERT INTO t1 VALUES (228,0,NULL,'Utah',NULL,3);
+INSERT INTO t1 VALUES (NULL,0,NULL,'i',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'Alaska',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'wo',NULL,177);
+INSERT INTO t1 VALUES (0,0,NULL,'Maryland',NULL,487);
+INSERT INTO t1 VALUES (-8186,0,NULL,'Colorado',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'uj',NULL,328);
+INSERT INTO t1 VALUES (4,0,NULL,'fork',NULL,0);
+INSERT INTO t1 VALUES (3,0,NULL,'w',NULL,NULL);
+INSERT INTO t1 VALUES (248,0,NULL,'i',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'dmkbqswrmtyabvlfylaxhnqij',NULL,24);
+INSERT INTO t1 VALUES (32767,0,NULL,'achieve',NULL,1);
+INSERT INTO t1 VALUES (32767,0,NULL,'existing',NULL,5);
+INSERT INTO t1 VALUES (6,0,NULL,'master',NULL,-312);
+INSERT INTO t1 VALUES (214,0,NULL,'b',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Michigan',NULL,42);
+INSERT INTO t1 VALUES (NULL,0,NULL,'simply',NULL,109);
+INSERT INTO t1 VALUES (NULL,0,NULL,'sw',NULL,86);
+INSERT INTO t1 VALUES (20697,0,NULL,'m',NULL,5);
+INSERT INTO t1 VALUES (-11693,0,NULL,'mt',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'South Dakota',NULL,NULL);
+INSERT INTO t1 VALUES (14825,0,NULL,'b',NULL,0);
+INSERT INTO t1 VALUES (-9378,0,NULL,'Washington',NULL,593);
+INSERT INTO t1 VALUES (NULL,0,NULL,'New Jersey',NULL,246);
+INSERT INTO t1 VALUES (32767,0,NULL,'q',NULL,-816);
+INSERT INTO t1 VALUES (0,0,NULL,'vl',NULL,232);
+INSERT INTO t1 VALUES (25257,0,NULL,'Nevada',NULL,-24);
+INSERT INTO t1 VALUES (0,0,NULL,'Wisconsin',NULL,9);
+INSERT INTO t1 VALUES (1536,0,NULL,'x',NULL,NULL);
+INSERT INTO t1 VALUES (5895,0,NULL,'Washington',NULL,170);
+INSERT INTO t1 VALUES (28123,0,NULL,'h',NULL,176);
+INSERT INTO t1 VALUES (9,0,NULL,'Tennessee',NULL,948);
+INSERT INTO t1 VALUES (0,0,NULL,'qi',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'Tennessee',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Oklahoma',NULL,132);
+INSERT INTO t1 VALUES (-21476,0,NULL,'Montana',NULL,947);
+INSERT INTO t1 VALUES (6,0,NULL,'aevevozlwbltcvzjptgbxw',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'v',NULL,4);
+INSERT INTO t1 VALUES (1,0,NULL,'vo',NULL,73);
+INSERT INTO t1 VALUES (3,0,NULL,'oz',NULL,328);
+INSERT INTO t1 VALUES (17939,0,NULL,'exclude',NULL,175);
+INSERT INTO t1 VALUES (-26579,0,NULL,'bl',NULL,32);
+INSERT INTO t1 VALUES (9,0,NULL,'c',NULL,130);
+INSERT INTO t1 VALUES (-26118,0,NULL,'asian',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'r',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'personal',NULL,8);
+INSERT INTO t1 VALUES (26919,0,NULL,'i',NULL,550);
+INSERT INTO t1 VALUES (NULL,0,NULL,'n',NULL,456);
+INSERT INTO t1 VALUES (NULL,0,NULL,'tg',NULL,-40);
+INSERT INTO t1 VALUES (0,0,NULL,'g',NULL,-720);
+INSERT INTO t1 VALUES (5,0,NULL,'bxwggltplrozn',NULL,92);
+INSERT INTO t1 VALUES (5,0,NULL,'w',NULL,-904);
+INSERT INTO t1 VALUES (-5704,0,NULL,'Idaho',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'t',NULL,2);
+INSERT INTO t1 VALUES (3,0,NULL,'lroznxbayvsjotzfqwye',NULL,-544);
+INSERT INTO t1 VALUES (-32545,0,NULL,'oz',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'x',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'virtually',NULL,38);
+INSERT INTO t1 VALUES (1,0,NULL,'beautiful',NULL,7);
+INSERT INTO t1 VALUES (223,0,NULL,'vs',NULL,9);
+INSERT INTO t1 VALUES (13865,0,NULL,'Arkansas',NULL,1);
+INSERT INTO t1 VALUES (0,0,NULL,'h',NULL,0);
+INSERT INTO t1 VALUES (-24982,0,NULL,'e',NULL,206);
+INSERT INTO t1 VALUES (27039,0,NULL,'rape',NULL,-184);
+INSERT INTO t1 VALUES (NULL,0,NULL,'v',NULL,74);
+INSERT INTO t1 VALUES (NULL,0,NULL,'wyec',NULL,2);
+INSERT INTO t1 VALUES (0,0,NULL,'cook',NULL,59);
+INSERT INTO t1 VALUES (0,0,NULL,'Iowa',NULL,NULL);
+INSERT INTO t1 VALUES (231,0,NULL,'ecfsb',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'p',NULL,370);
+INSERT INTO t1 VALUES (-24801,0,NULL,'New Mexico',NULL,NULL);
+INSERT INTO t1 VALUES (50,0,NULL,'kelhcq',NULL,104);
+INSERT INTO t1 VALUES (NULL,0,NULL,'el',NULL,402);
+INSERT INTO t1 VALUES (15730,0,NULL,'h',NULL,376);
+INSERT INTO t1 VALUES (8,0,NULL,'p',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'h',NULL,4);
+INSERT INTO t1 VALUES (32767,0,NULL,'South Carolina',NULL,382);
+INSERT INTO t1 VALUES (NULL,0,NULL,'invite',NULL,816);
+INSERT INTO t1 VALUES (NULL,0,NULL,'ft',NULL,538);
+INSERT INTO t1 VALUES (8159,0,NULL,'q',NULL,11);
+INSERT INTO t1 VALUES (0,0,NULL,'a',NULL,103);
+INSERT INTO t1 VALUES (7,0,NULL,'n',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'New Jersey',NULL,146);
+INSERT INTO t1 VALUES (32767,0,NULL,'odlwznvezd',NULL,295);
+INSERT INTO t1 VALUES (9,0,NULL,'any',NULL,480);
+INSERT INTO t1 VALUES (7,0,NULL,'znvezdlrwfvhpghujmnvqun',NULL,720);
+INSERT INTO t1 VALUES (12792,0,NULL,'Iowa',NULL,NULL);
+INSERT INTO t1 VALUES (148,0,NULL,'Ohio',NULL,89);
+INSERT INTO t1 VALUES (NULL,0,NULL,'lr',NULL,-680);
+INSERT INTO t1 VALUES (-14898,0,NULL,'fv',NULL,736);
+INSERT INTO t1 VALUES (32767,0,NULL,'v',NULL,9);
+INSERT INTO t1 VALUES (5808,0,NULL,'Florida',NULL,112);
+INSERT INTO t1 VALUES (0,0,NULL,'gh',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'u',NULL,NULL);
+INSERT INTO t1 VALUES (4,0,NULL,'mnvqunepbp',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'enemy',NULL,272);
+INSERT INTO t1 VALUES (32767,0,NULL,'unhappy',NULL,8);
+INSERT INTO t1 VALUES (1460,0,NULL,'Connecticut',NULL,780);
+INSERT INTO t1 VALUES (0,0,NULL,'epbpabcgxxmaozb',NULL,230);
+INSERT INTO t1 VALUES (NULL,0,NULL,'banana',NULL,620);
+INSERT INTO t1 VALUES (0,0,NULL,'pabcgxxmaozbofwby',NULL,212);
+INSERT INTO t1 VALUES (32767,0,NULL,'afterward',NULL,0);
+INSERT INTO t1 VALUES (-15421,0,NULL,'important',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'Washington',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'m',NULL,3);
+INSERT INTO t1 VALUES (0,0,NULL,'zb',NULL,1);
+INSERT INTO t1 VALUES (0,0,NULL,'position',NULL,-632);
+INSERT INTO t1 VALUES (17,0,NULL,'bofwbypkykzkbnayqfeuzxlyt',NULL,63);
+INSERT INTO t1 VALUES (NULL,0,NULL,'of',NULL,488);
+INSERT INTO t1 VALUES (0,0,NULL,'wbypkykzkbnayqfeuzxlyts',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'insight',NULL,632);
+INSERT INTO t1 VALUES (0,0,NULL,'Arizona',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'pk',NULL,0);
+INSERT INTO t1 VALUES (174,0,NULL,'yk',NULL,194);
+INSERT INTO t1 VALUES (4,0,NULL,'h',NULL,NULL);
+INSERT INTO t1 VALUES (19871,0,NULL,'zkbna',NULL,7);
+INSERT INTO t1 VALUES (NULL,0,NULL,'l',NULL,0);
+INSERT INTO t1 VALUES (-18596,0,NULL,'New York',NULL,488);
+INSERT INTO t1 VALUES (18464,0,NULL,'qfeuzxlyts',NULL,3);
+INSERT INTO t1 VALUES (-21912,0,NULL,'doctor',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'eu',NULL,4);
+INSERT INTO t1 VALUES (0,0,NULL,'xl',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'New York',NULL,394);
+INSERT INTO t1 VALUES (NULL,0,NULL,'closest',NULL,928);
+INSERT INTO t1 VALUES (7,0,NULL,'jx',NULL,0);
+INSERT INTO t1 VALUES (8,0,NULL,'Mississippi',NULL,236);
+INSERT INTO t1 VALUES (8238,0,NULL,'n',NULL,2);
+INSERT INTO t1 VALUES (137,0,NULL,'nf',NULL,3);
+INSERT INTO t1 VALUES (7,0,NULL,'mm',NULL,824);
+INSERT INTO t1 VALUES (-13059,0,NULL,'nfojpim',NULL,-40);
+INSERT INTO t1 VALUES (NULL,0,NULL,'i',NULL,224);
+INSERT INTO t1 VALUES (NULL,0,NULL,'blind',NULL,-296);
+INSERT INTO t1 VALUES (0,0,NULL,'Maryland',NULL,8);
+INSERT INTO t1 VALUES (0,0,NULL,'im',NULL,0);
+INSERT INTO t1 VALUES (88,0,NULL,'Colorado',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'u',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'glove',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'qg',NULL,952);
+INSERT INTO t1 VALUES (14297,0,NULL,'level',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'v',NULL,0);
+INSERT INTO t1 VALUES (46,0,NULL,'suspicion',NULL,0);
+INSERT INTO t1 VALUES (7,0,NULL,'Connecticut',NULL,NULL);
+INSERT INTO t1 VALUES (32672,0,NULL,'master',NULL,224);
+INSERT INTO t1 VALUES (255,0,NULL,'suffering',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'bweyg',NULL,343);
+INSERT INTO t1 VALUES (32,0,NULL,'Maine',NULL,-224);
+INSERT INTO t1 VALUES (2888,0,NULL,'rear',NULL,74);
+INSERT INTO t1 VALUES (218,0,NULL,'New Hampshire',NULL,-416);
+INSERT INTO t1 VALUES (NULL,0,NULL,'m',NULL,5);
+INSERT INTO t1 VALUES (7,0,NULL,'compel',NULL,592);
+INSERT INTO t1 VALUES (3,0,NULL,'Vermont',NULL,-424);
+INSERT INTO t1 VALUES (0,0,NULL,'natural',NULL,6);
+INSERT INTO t1 VALUES (4,0,NULL,'f',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'Maryland',NULL,0);
+INSERT INTO t1 VALUES (4128,0,NULL,'lm',NULL,-128);
+INSERT INTO t1 VALUES (0,0,NULL,'circuit',NULL,NULL);
+INSERT INTO t1 VALUES (-23553,0,NULL,'appearance',NULL,9);
+INSERT INTO t1 VALUES (32767,0,NULL,'qr',NULL,0);
+INSERT INTO t1 VALUES (9700,0,NULL,'g',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'hr',NULL,9);
+INSERT INTO t1 VALUES (229,0,NULL,'West Virginia',NULL,244);
+INSERT INTO t1 VALUES (10379,0,NULL,'i',NULL,211);
+INSERT INTO t1 VALUES (0,0,NULL,'personal',NULL,5);
+INSERT INTO t1 VALUES (4298,0,NULL,'z',NULL,985);
+INSERT INTO t1 VALUES (157,0,NULL,'e',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'p',NULL,5);
+INSERT INTO t1 VALUES (32767,0,NULL,'lg',NULL,527);
+INSERT INTO t1 VALUES (1,0,NULL,'t',NULL,208);
+INSERT INTO t1 VALUES (5,0,NULL,'Kansas',NULL,587);
+INSERT INTO t1 VALUES (-31188,0,NULL,'e',NULL,408);
+INSERT INTO t1 VALUES (NULL,0,NULL,'v',NULL,146);
+INSERT INTO t1 VALUES (15527,0,NULL,'vd',NULL,-200);
+INSERT INTO t1 VALUES (11164,0,NULL,'pthiwwamjdavik',NULL,117);
+INSERT INTO t1 VALUES (46,0,NULL,'iw',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'a',NULL,9);
+INSERT INTO t1 VALUES (NULL,0,NULL,'gradually',NULL,0);
+INSERT INTO t1 VALUES (-21366,0,NULL,'refer',NULL,146);
+INSERT INTO t1 VALUES (20927,0,NULL,'c',NULL,0);
+INSERT INTO t1 VALUES (43,0,NULL,'Florida',NULL,968);
+INSERT INTO t1 VALUES (NULL,0,NULL,'ko',NULL,NULL);
+INSERT INTO t1 VALUES (242,0,NULL,'jrydpgfyxhfqsu',NULL,-800);
+INSERT INTO t1 VALUES (-12797,0,NULL,'ry',NULL,7);
+INSERT INTO t1 VALUES (6,0,NULL,'x',NULL,228);
+INSERT INTO t1 VALUES (9,0,NULL,'y',NULL,1);
+INSERT INTO t1 VALUES (0,0,NULL,'w',NULL,4);
+INSERT INTO t1 VALUES (127,0,NULL,'Maryland',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'h',NULL,NULL);
+INSERT INTO t1 VALUES (7,0,NULL,'qs',NULL,512);
+INSERT INTO t1 VALUES (30910,0,NULL,'disturb',NULL,960);
+INSERT INTO t1 VALUES (NULL,0,NULL,'lx',NULL,4);
+INSERT INTO t1 VALUES (94,0,NULL,'dhc',NULL,0);
+INSERT INTO t1 VALUES (247,0,NULL,'ca',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'fi',NULL,-488);
+INSERT INTO t1 VALUES (NULL,0,NULL,'i',NULL,3);
+INSERT INTO t1 VALUES (9,0,NULL,'Connecticut',NULL,552);
+INSERT INTO t1 VALUES (0,0,NULL,'register',NULL,0);
+INSERT INTO t1 VALUES (-8679,0,NULL,'bk',NULL,-760);
+INSERT INTO t1 VALUES (32767,0,NULL,'orbit',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'kvm',NULL,7);
+INSERT INTO t1 VALUES (0,0,NULL,'mdqbjxjh',NULL,680);
+INSERT INTO t1 VALUES (32767,0,NULL,'m',NULL,-272);
+INSERT INTO t1 VALUES (0,0,NULL,'bj',NULL,0);
+INSERT INTO t1 VALUES (22547,0,NULL,'xj',NULL,194);
+INSERT INTO t1 VALUES (-32403,0,NULL,'gj',NULL,240);
+INSERT INTO t1 VALUES (6394,0,NULL,'Arizona',NULL,16);
+INSERT INTO t1 VALUES (4,0,NULL,'z',NULL,488);
+INSERT INTO t1 VALUES (114,0,NULL,'i',NULL,0);
+INSERT INTO t1 VALUES (3710,0,NULL,'p',NULL,291);
+INSERT INTO t1 VALUES (28654,0,NULL,'empty',NULL,245);
+INSERT INTO t1 VALUES (9849,0,NULL,'Pennsylvania',NULL,0);
+INSERT INTO t1 VALUES (185,0,NULL,'j',NULL,320);
+INSERT INTO t1 VALUES (5,0,NULL,'Tennessee',NULL,7);
+INSERT INTO t1 VALUES (154,0,NULL,'hl',NULL,157);
+INSERT INTO t1 VALUES (NULL,0,NULL,'lo',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'hc',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'must',NULL,755);
+INSERT INTO t1 VALUES (132,0,NULL,'m',NULL,95);
+INSERT INTO t1 VALUES (193,0,NULL,'poke',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'o',NULL,-656);
+INSERT INTO t1 VALUES (172,0,NULL,'e',NULL,0);
+INSERT INTO t1 VALUES (7642,0,NULL,'feeling',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'cwmtpp',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'e',NULL,115);
+INSERT INTO t1 VALUES (32767,0,NULL,'Florida',NULL,505);
+INSERT INTO t1 VALUES (3,0,NULL,'Maryland',NULL,97);
+INSERT INTO t1 VALUES (NULL,0,NULL,'kill',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'qf',NULL,623);
+INSERT INTO t1 VALUES (0,0,NULL,'fz',NULL,812);
+INSERT INTO t1 VALUES (NULL,0,NULL,'greek',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'kglhiuodplizizzobpcq',NULL,6);
+INSERT INTO t1 VALUES (NULL,0,NULL,'l',NULL,0);
+INSERT INTO t1 VALUES (159,0,NULL,'s',NULL,7);
+INSERT INTO t1 VALUES (-25560,0,NULL,'z',NULL,656);
+INSERT INTO t1 VALUES (189,0,NULL,'u',NULL,0);
+INSERT INTO t1 VALUES (27110,0,NULL,'leather',NULL,9);
+INSERT INTO t1 VALUES (NULL,0,NULL,'li',NULL,944);
+INSERT INTO t1 VALUES (0,0,NULL,'attract',NULL,NULL);
+INSERT INTO t1 VALUES (9,0,NULL,'structural',NULL,71);
+INSERT INTO t1 VALUES (NULL,0,NULL,'settlement',NULL,4);
+INSERT INTO t1 VALUES (-15549,0,NULL,'n',NULL,564);
+INSERT INTO t1 VALUES (30391,0,NULL,'k',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'ob',NULL,NULL);
+INSERT INTO t1 VALUES (224,0,NULL,'bpcqqji',NULL,413);
+INSERT INTO t1 VALUES (32767,0,NULL,'nowhere',NULL,8);
+INSERT INTO t1 VALUES (15281,0,NULL,'Arkansas',NULL,-912);
+INSERT INTO t1 VALUES (-9327,0,NULL,'d',NULL,-904);
+INSERT INTO t1 VALUES (14055,0,NULL,'i',NULL,293);
+INSERT INTO t1 VALUES (3,0,NULL,'Louisiana',NULL,224);
+INSERT INTO t1 VALUES (NULL,0,NULL,'pw',NULL,-624);
+INSERT INTO t1 VALUES (32767,0,NULL,'nevertheless',NULL,208);
+INSERT INTO t1 VALUES (NULL,0,NULL,'z',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'spectacular',NULL,104);
+INSERT INTO t1 VALUES (0,0,NULL,'digital',NULL,89);
+INSERT INTO t1 VALUES (5,0,NULL,'aq',NULL,40);
+INSERT INTO t1 VALUES (NULL,0,NULL,'tm',NULL,411);
+INSERT INTO t1 VALUES (11726,0,NULL,'p',NULL,0);
+INSERT INTO t1 VALUES (3188,0,NULL,'knykleafajkq',NULL,0);
+INSERT INTO t1 VALUES (1,0,NULL,'technology',NULL,6);
+INSERT INTO t1 VALUES (NULL,0,NULL,'y',NULL,58);
+INSERT INTO t1 VALUES (67,0,NULL,'a',NULL,0);
+INSERT INTO t1 VALUES (-6719,0,NULL,'n',NULL,136);
+INSERT INTO t1 VALUES (8000,0,NULL,'j',NULL,-248);
+INSERT INTO t1 VALUES (32767,0,NULL,'snow',NULL,8);
+INSERT INTO t1 VALUES (-3623,0,NULL,'d',NULL,920);
+INSERT INTO t1 VALUES (NULL,0,NULL,'i',NULL,NULL);
+INSERT INTO t1 VALUES (3239,0,NULL,'Kansas',NULL,102);
+INSERT INTO t1 VALUES (7132,0,NULL,'zt',NULL,88);
+INSERT INTO t1 VALUES (-21941,0,NULL,'Tennessee',NULL,77);
+INSERT INTO t1 VALUES (45,0,NULL,'Virginia',NULL,3);
+INSERT INTO t1 VALUES (166,0,NULL,'m',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'l',NULL,-880);
+INSERT INTO t1 VALUES (205,0,NULL,'Idaho',NULL,NULL);
+INSERT INTO t1 VALUES (10679,0,NULL,'f',NULL,2);
+INSERT INTO t1 VALUES (172,0,NULL,'North Dakota',NULL,NULL);
+INSERT INTO t1 VALUES (30942,0,NULL,'Indiana',NULL,832);
+INSERT INTO t1 VALUES (1824,0,NULL,'m',NULL,NULL);
+INSERT INTO t1 VALUES (34,0,NULL,'stumble',NULL,440);
+INSERT INTO t1 VALUES (12955,0,NULL,'juror',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'South Dakota',NULL,5);
+INSERT INTO t1 VALUES (25891,0,NULL,'j',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'clerk',NULL,39);
+INSERT INTO t1 VALUES (13187,0,NULL,'gw',NULL,811);
+INSERT INTO t1 VALUES (0,0,NULL,'x',NULL,583);
+INSERT INTO t1 VALUES (6,0,NULL,'fb',NULL,140);
+INSERT INTO t1 VALUES (32767,0,NULL,'vp',NULL,781);
+INSERT INTO t1 VALUES (0,0,NULL,'if',NULL,NULL);
+INSERT INTO t1 VALUES (7497,0,NULL,'New Hampshire',NULL,233);
+INSERT INTO t1 VALUES (155,0,NULL,'e',NULL,NULL);
+INSERT INTO t1 VALUES (-18830,0,NULL,'q',NULL,84);
+INSERT INTO t1 VALUES (3815,0,NULL,'yy',NULL,8);
+INSERT INTO t1 VALUES (0,0,NULL,'Kansas',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'yqspnupv',NULL,0);
+INSERT INTO t1 VALUES (1,0,NULL,'hers',NULL,688);
+INSERT INTO t1 VALUES (32767,0,NULL,'pnupvmuqjaojhylsrbqichox',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'x',NULL,8);
+INSERT INTO t1 VALUES (3,0,NULL,'North Carolina',NULL,-88);
+INSERT INTO t1 VALUES (92,0,NULL,'u',NULL,0);
+INSERT INTO t1 VALUES (32126,0,NULL,'sensation',NULL,226);
+INSERT INTO t1 VALUES (4,0,NULL,'muqjao',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'aojhylsrbqichoxl',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'tribe',NULL,0);
+INSERT INTO t1 VALUES (142,0,NULL,'jhy',NULL,6);
+INSERT INTO t1 VALUES (0,0,NULL,'w',NULL,622);
+INSERT INTO t1 VALUES (NULL,0,NULL,'New York',NULL,-56);
+INSERT INTO t1 VALUES (-24954,0,NULL,'bqichoxlxsarzbqouvscstrtpofjbbjrci',NULL,8);
+INSERT INTO t1 VALUES (4105,0,NULL,'New Hampshire',NULL,247);
+INSERT INTO t1 VALUES (0,0,NULL,'k',NULL,0);
+INSERT INTO t1 VALUES (46,0,NULL,'reader',NULL,400);
+INSERT INTO t1 VALUES (-29286,0,NULL,'ho',NULL,NULL);
+INSERT INTO t1 VALUES (169,0,NULL,'mr',NULL,0);
+INSERT INTO t1 VALUES (9,0,NULL,'y',NULL,333);
+INSERT INTO t1 VALUES (25168,0,NULL,'New Jersey',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'queen',NULL,2);
+INSERT INTO t1 VALUES (9,0,NULL,'bow',NULL,NULL);
+INSERT INTO t1 VALUES (7,0,NULL,'satellite',NULL,NULL);
+INSERT INTO t1 VALUES (1,0,NULL,'u',NULL,31);
+INSERT INTO t1 VALUES (NULL,0,NULL,'scstrtpofjbbjrcijlkzoyh',NULL,70);
+INSERT INTO t1 VALUES (26275,0,NULL,'b',NULL,7);
+INSERT INTO t1 VALUES (227,0,NULL,'card',NULL,6);
+INSERT INTO t1 VALUES (0,0,NULL,'p',NULL,140);
+INSERT INTO t1 VALUES (4,0,NULL,'Oregon',NULL,556);
+INSERT INTO t1 VALUES (-12170,0,NULL,'Missouri',NULL,292);
+INSERT INTO t1 VALUES (NULL,0,NULL,'bjrcijlkzoyhy',NULL,251);
+INSERT INTO t1 VALUES (NULL,0,NULL,'ci',NULL,NULL);
+INSERT INTO t1 VALUES (69,0,NULL,'g',NULL,-456);
+INSERT INTO t1 VALUES (NULL,0,NULL,'f',NULL,9);
+INSERT INTO t1 VALUES (NULL,0,NULL,'hynudnmi',NULL,45);
+INSERT INTO t1 VALUES (-30445,0,NULL,'widespread',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Maryland',NULL,407);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Delaware',NULL,-40);
+INSERT INTO t1 VALUES (30059,0,NULL,'n',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'u',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'znwacpbwghlegvykaobxv',NULL,7);
+INSERT INTO t1 VALUES (174,0,NULL,'r',NULL,9);
+INSERT INTO t1 VALUES (NULL,0,NULL,'West Virginia',NULL,71);
+INSERT INTO t1 VALUES (2593,0,NULL,'z',NULL,2);
+INSERT INTO t1 VALUES (-28371,0,NULL,'v',NULL,89);
+INSERT INTO t1 VALUES (23749,0,NULL,'e',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'w',NULL,183);
+INSERT INTO t1 VALUES (NULL,0,NULL,'ghl',NULL,776);
+INSERT INTO t1 VALUES (4,0,NULL,'Mississippi',NULL,8);
+INSERT INTO t1 VALUES (9210,0,NULL,'z',NULL,246);
+INSERT INTO t1 VALUES (12724,0,NULL,'South Dakota',NULL,222);
+INSERT INTO t1 VALUES (NULL,0,NULL,'outlet',NULL,790);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Indiana',NULL,-8);
+INSERT INTO t1 VALUES (NULL,0,NULL,'aob',NULL,0);
+INSERT INTO t1 VALUES (7,0,NULL,'tell',NULL,-648);
+INSERT INTO t1 VALUES (0,0,NULL,'u',NULL,381);
+INSERT INTO t1 VALUES (7,0,NULL,'vqhhtakqoppfcrb',NULL,747);
+INSERT INTO t1 VALUES (4,0,NULL,'Arkansas',NULL,816);
+INSERT INTO t1 VALUES (0,0,NULL,'slight',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'upset',NULL,4);
+INSERT INTO t1 VALUES (-17416,0,NULL,'Nebraska',NULL,9);
+INSERT INTO t1 VALUES (137,0,NULL,'takqoppfcrbangizjeqc',NULL,672);
+INSERT INTO t1 VALUES (-326,0,NULL,'spill',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'w',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'crb',NULL,166);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Mississippi',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'ba',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'a',NULL,1);
+INSERT INTO t1 VALUES (61,0,NULL,'izj',NULL,-744);
+INSERT INTO t1 VALUES (-26413,0,NULL,'Nevada',NULL,NULL);
+INSERT INTO t1 VALUES (6,0,NULL,'Mississippi',NULL,416);
+INSERT INTO t1 VALUES (0,0,NULL,'Nevada',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'b',NULL,470);
+INSERT INTO t1 VALUES (2864,0,NULL,'x',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Montana',NULL,248);
+INSERT INTO t1 VALUES (32767,0,NULL,'y',NULL,2);
+INSERT INTO t1 VALUES (0,0,NULL,'Arkansas',NULL,107);
+INSERT INTO t1 VALUES (243,0,NULL,'bb',NULL,NULL);
+INSERT INTO t1 VALUES (-7006,0,NULL,'y',NULL,262);
+INSERT INTO t1 VALUES (29170,0,NULL,'data',NULL,257);
+INSERT INTO t1 VALUES (NULL,0,NULL,'procedure',NULL,5);
+INSERT INTO t1 VALUES (NULL,0,NULL,'u',NULL,182);
+INSERT INTO t1 VALUES (0,0,NULL,'lczldnxhwgkrabptlqda',NULL,158);
+INSERT INTO t1 VALUES (10754,0,NULL,'cream',NULL,0);
+INSERT INTO t1 VALUES (31943,0,NULL,'open',NULL,4);
+INSERT INTO t1 VALUES (NULL,0,NULL,'hwg',NULL,NULL);
+INSERT INTO t1 VALUES (5,0,NULL,'Wyoming',NULL,NULL);
+INSERT INTO t1 VALUES (-27782,0,NULL,'r',NULL,187);
+INSERT INTO t1 VALUES (32767,0,NULL,'ab',NULL,0);
+INSERT INTO t1 VALUES (3,0,NULL,'ptlqda',NULL,-288);
+INSERT INTO t1 VALUES (32767,0,NULL,'q',NULL,72);
+INSERT INTO t1 VALUES (-22284,0,NULL,'e',NULL,664);
+INSERT INTO t1 VALUES (7,0,NULL,'Florida',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'movfyh',NULL,-784);
+INSERT INTO t1 VALUES (NULL,0,NULL,'vfy',NULL,784);
+INSERT INTO t1 VALUES (37,0,NULL,'h',NULL,105);
+INSERT INTO t1 VALUES (32767,0,NULL,'r',NULL,0);
+INSERT INTO t1 VALUES (145,0,NULL,'Hawaii',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'Minnesota',NULL,0);
+INSERT INTO t1 VALUES (4,0,NULL,'ov',NULL,181);
+INSERT INTO t1 VALUES (0,0,NULL,'coming',NULL,5);
+INSERT INTO t1 VALUES (32767,0,NULL,'mnry',NULL,946);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Arizona',NULL,NULL);
+INSERT INTO t1 VALUES (-2368,0,NULL,'c',NULL,0);
+INSERT INTO t1 VALUES (-21715,0,NULL,'ljfxl',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'Wyoming',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'fxlxhdnief',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'MariaDB is a community-developed, commercially',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'Mississippi',NULL,624);
+INSERT INTO t1 VALUES (6,0,NULL,'h',NULL,198);
+INSERT INTO t1 VALUES (-11442,0,NULL,'Massachusetts',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'i',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'draw',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'k',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'ztabdvhywbflylhukxqufevtdhnfzpccsuyvzargiogjfsnofsruoqac',NULL,53);
+INSERT INTO t1 VALUES (0,0,NULL,'all',NULL,994);
+INSERT INTO t1 VALUES (-18287,0,NULL,'abdvhywbflylhukxqu',NULL,878);
+INSERT INTO t1 VALUES (0,0,NULL,'Wyoming',NULL,847);
+INSERT INTO t1 VALUES (6,0,NULL,'dv',NULL,204);
+INSERT INTO t1 VALUES (246,0,NULL,'ywbflylhukxqufevtdhnfzpccsuyvzargiogjfsnofsruo',NULL,183);
+INSERT INTO t1 VALUES (20335,0,NULL,'f',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'l',NULL,223);
+INSERT INTO t1 VALUES (NULL,0,NULL,'hukxqufevtdhnfzpccsuyvzargiogjfsnofsruoqacwwy',NULL,577);
+INSERT INTO t1 VALUES (180,0,NULL,'qu',NULL,6);
+INSERT INTO t1 VALUES (9,0,NULL,'f',NULL,8);
+INSERT INTO t1 VALUES (27881,0,NULL,'vt',NULL,2);
+INSERT INTO t1 VALUES (3,0,NULL,'tdhnfzpccsuyvzargiogjfsnofsr',NULL,6);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Alabama',NULL,200);
+INSERT INTO t1 VALUES (32767,0,NULL,'fzpccsuyv',NULL,20);
+INSERT INTO t1 VALUES (7,0,NULL,'p',NULL,180);
+INSERT INTO t1 VALUES (32767,0,NULL,'South Dakota',NULL,496);
+INSERT INTO t1 VALUES (23704,0,NULL,'uyvzargiogjfsnofsruoqacwwygpgvfsciovxyvstsktvbpcoliqfqjmavyv',NULL,744);
+INSERT INTO t1 VALUES (7,0,NULL,'za',NULL,4);
+INSERT INTO t1 VALUES (0,0,NULL,'straighten',NULL,198);
+INSERT INTO t1 VALUES (1200,0,NULL,'iogjfsnofsruoqacwwygpgv',NULL,NULL);
+INSERT INTO t1 VALUES (8559,0,NULL,'j',NULL,NULL);
+INSERT INTO t1 VALUES (-11567,0,NULL,'n',NULL,39);
+INSERT INTO t1 VALUES (0,0,NULL,'New Jersey',NULL,723);
+INSERT INTO t1 VALUES (NULL,0,NULL,'sruoqacwwygpgvfsciovxyv',NULL,150);
+INSERT INTO t1 VALUES (0,0,NULL,'Massachusetts',NULL,157);
+INSERT INTO t1 VALUES (10891,0,NULL,'scared',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'q',NULL,952);
+INSERT INTO t1 VALUES (10180,0,NULL,'a',NULL,322);
+INSERT INTO t1 VALUES (-32693,0,NULL,'hunt',NULL,-728);
+INSERT INTO t1 VALUES (0,0,NULL,'f',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'yg',NULL,83);
+INSERT INTO t1 VALUES (13866,0,NULL,'gp',NULL,277);
+INSERT INTO t1 VALUES (32767,0,NULL,'Maine',NULL,822);
+INSERT INTO t1 VALUES (19051,0,NULL,'quickly',NULL,2);
+INSERT INTO t1 VALUES (14284,0,NULL,'fsciovxyvstsktvbpcoliqfqjmavyvpmtdrynjkbhcxfvua',NULL,NULL);
+INSERT INTO t1 VALUES (10873,0,NULL,'Utah',NULL,0);
+INSERT INTO t1 VALUES (125,0,NULL,'q',NULL,NULL);
+INSERT INTO t1 VALUES (29916,0,NULL,'xyvstsktvbpcoliqfqjmavyvpmtdrynjkbhcxfv',NULL,547);
+INSERT INTO t1 VALUES (0,0,NULL,'Arizona',NULL,NULL);
+INSERT INTO t1 VALUES (212,0,NULL,'Kansas',NULL,650);
+INSERT INTO t1 VALUES (NULL,0,NULL,'trick',NULL,87);
+INSERT INTO t1 VALUES (1,0,NULL,'assign',NULL,135);
+INSERT INTO t1 VALUES (0,0,NULL,'tsktvbpcoliqfqjmavyvpmtdrynjkbhcxfvuaaupgnpusgz',NULL,237);
+INSERT INTO t1 VALUES (8,0,NULL,'o',NULL,NULL);
+INSERT INTO t1 VALUES (-31777,0,NULL,'t',NULL,1);
+INSERT INTO t1 VALUES (-10171,0,NULL,'pcoliqfqjmavyvpmtdrynjkbhcxfvuaaupgnpusgzncwf',NULL,0);
+INSERT INTO t1 VALUES (7826,0,NULL,'council',NULL,273);
+INSERT INTO t1 VALUES (20426,0,NULL,'r',NULL,9);
+INSERT INTO t1 VALUES (32767,0,NULL,'qf',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'qjmavyvpmtdrynjkbhcxfvuaaupg',NULL,440);
+INSERT INTO t1 VALUES (NULL,0,NULL,'s',NULL,-608);
+INSERT INTO t1 VALUES (0,0,NULL,'vyv',NULL,111);
+INSERT INTO t1 VALUES (225,0,NULL,'Michigan',NULL,NULL);
+INSERT INTO t1 VALUES (10391,0,NULL,'p',NULL,2);
+INSERT INTO t1 VALUES (3,0,NULL,'td',NULL,-480);
+INSERT INTO t1 VALUES (0,0,NULL,'z',NULL,587);
+INSERT INTO t1 VALUES (2180,0,NULL,'r',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'njkbhcxfvuaaupgnpusgzncwf',NULL,-984);
+INSERT INTO t1 VALUES (81,0,NULL,'bhcxfvuaaupgnpusgzncw',NULL,146);
+INSERT INTO t1 VALUES (165,0,NULL,'u',NULL,201);
+INSERT INTO t1 VALUES (11251,0,NULL,'c',NULL,NULL);
+INSERT INTO t1 VALUES (11703,0,NULL,'u',NULL,NULL);
+INSERT INTO t1 VALUES (236,0,NULL,'opinion',NULL,207);
+INSERT INTO t1 VALUES (32767,0,NULL,'Louisiana',NULL,-744);
+INSERT INTO t1 VALUES (-29220,0,NULL,'Massachusetts',NULL,409);
+INSERT INTO t1 VALUES (NULL,0,NULL,'up',NULL,169);
+INSERT INTO t1 VALUES (18778,0,NULL,'Alabama',NULL,241);
+INSERT INTO t1 VALUES (11959,0,NULL,'npusgzncwfwwbhfynsnzhmkxgjtfjjc',NULL,66);
+INSERT INTO t1 VALUES (30179,0,NULL,'Hawaii',NULL,7);
+INSERT INTO t1 VALUES (NULL,0,NULL,'s',NULL,100);
+INSERT INTO t1 VALUES (214,0,NULL,'New Hampshire',NULL,984);
+INSERT INTO t1 VALUES (5,0,NULL,'remove',NULL,NULL);
+INSERT INTO t1 VALUES (143,0,NULL,'w',NULL,0);
+INSERT INTO t1 VALUES (3,0,NULL,'Pennsylvania',NULL,696);
+INSERT INTO t1 VALUES (191,0,NULL,'b',NULL,816);
+INSERT INTO t1 VALUES (NULL,0,NULL,'hfynsnzhmkxgjtfjjcwggesvfockyauicjqw',NULL,3);
+INSERT INTO t1 VALUES (0,0,NULL,'m',NULL,NULL);
+INSERT INTO t1 VALUES (4,0,NULL,'Arkansas',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'s',NULL,6);
+INSERT INTO t1 VALUES (1,0,NULL,'mk',NULL,36);
+INSERT INTO t1 VALUES (8215,0,NULL,'xg',NULL,320);
+INSERT INTO t1 VALUES (32767,0,NULL,'g',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'South Dakota',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'object',NULL,NULL);
+INSERT INTO t1 VALUES (26142,0,NULL,'magnetic',NULL,-936);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Idaho',NULL,376);
+INSERT INTO t1 VALUES (NULL,0,NULL,'g',NULL,0);
+INSERT INTO t1 VALUES (-14759,0,NULL,'n',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'svfockyauic',NULL,197);
+INSERT INTO t1 VALUES (25,0,NULL,'v',NULL,440);
+INSERT INTO t1 VALUES (239,0,NULL,'c',NULL,642);
+INSERT INTO t1 VALUES (189,0,NULL,'yauicjqwkwedvcvhsbvsgtjvqul',NULL,38);
+INSERT INTO t1 VALUES (-5515,0,NULL,'auicjqwkwedvcvhsbvsgtjvqulz',NULL,NULL);
+INSERT INTO t1 VALUES (25879,0,NULL,'i',NULL,416);
+INSERT INTO t1 VALUES (0,0,NULL,'s',NULL,-760);
+INSERT INTO t1 VALUES (1,0,NULL,'Delaware',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'w',NULL,250);
+INSERT INTO t1 VALUES (0,0,NULL,'s',NULL,232);
+INSERT INTO t1 VALUES (99,0,NULL,'j',NULL,-552);
+INSERT INTO t1 VALUES (0,0,NULL,'full-time',NULL,10);
+INSERT INTO t1 VALUES (NULL,0,NULL,'suffer',NULL,185);
+INSERT INTO t1 VALUES (19461,0,NULL,'recognize',NULL,8);
+INSERT INTO t1 VALUES (130,0,NULL,'learning',NULL,559);
+INSERT INTO t1 VALUES (4,0,NULL,'grain',NULL,336);
+INSERT INTO t1 VALUES (6,0,NULL,'correspondent',NULL,71);
+INSERT INTO t1 VALUES (9,0,NULL,'b',NULL,5);
+INSERT INTO t1 VALUES (18778,0,NULL,'practitioner',NULL,6);
+INSERT INTO t1 VALUES (2291,0,NULL,'California',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'vq',NULL,0);
+INSERT INTO t1 VALUES (34,0,NULL,'ul',NULL,81);
+INSERT INTO t1 VALUES (-21757,0,NULL,'k',NULL,587);
+INSERT INTO t1 VALUES (NULL,0,NULL,'New Hampshire',NULL,739);
+INSERT INTO t1 VALUES (24,0,NULL,'o',NULL,NULL);
+INSERT INTO t1 VALUES (26917,0,NULL,'m',NULL,102);
+INSERT INTO t1 VALUES (55,0,NULL,'djvzvjevgpptiurzrjvnxsfvylicylrpwhdxky',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'k',NULL,537);
+INSERT INTO t1 VALUES (-10683,0,NULL,'Nevada',NULL,6);
+INSERT INTO t1 VALUES (-30580,0,NULL,'fall',NULL,432);
+INSERT INTO t1 VALUES (0,0,NULL,'Pennsylvania',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'e',NULL,0);
+INSERT INTO t1 VALUES (8,0,NULL,'Massachusetts',NULL,959);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Hawaii',NULL,NULL);
+INSERT INTO t1 VALUES (11119,0,NULL,'weaken',NULL,560);
+INSERT INTO t1 VALUES (-7660,0,NULL,'Massachusetts',NULL,752);
+INSERT INTO t1 VALUES (38,0,NULL,'c',NULL,0);
+INSERT INTO t1 VALUES (23593,0,NULL,'rzrjvnx',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'zr',NULL,7);
+INSERT INTO t1 VALUES (32767,0,NULL,'vn',NULL,0);
+INSERT INTO t1 VALUES (5,0,NULL,'sfv',NULL,0);
+INSERT INTO t1 VALUES (2,0,NULL,'v',NULL,242);
+INSERT INTO t1 VALUES (0,0,NULL,'o',NULL,2);
+INSERT INTO t1 VALUES (24986,0,NULL,'Delaware',NULL,9);
+INSERT INTO t1 VALUES (32767,0,NULL,'r',NULL,968);
+INSERT INTO t1 VALUES (-17056,0,NULL,'human',NULL,245);
+INSERT INTO t1 VALUES (0,0,NULL,'New Hampshire',NULL,4);
+INSERT INTO t1 VALUES (2,0,NULL,'rpwhdxkyahrnbjkssbbgjdtkk',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'g',NULL,NULL);
+INSERT INTO t1 VALUES (2,0,NULL,'hdxkyahrnbjkssbbgjdt',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'xk',NULL,840);
+INSERT INTO t1 VALUES (145,0,NULL,'picture',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'h',NULL,713);
+INSERT INTO t1 VALUES (-22009,0,NULL,'New Hampshire',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'x',NULL,225);
+INSERT INTO t1 VALUES (0,0,NULL,'accomplish',NULL,0);
+INSERT INTO t1 VALUES (166,0,NULL,'j',NULL,4);
+INSERT INTO t1 VALUES (24484,0,NULL,'South Dakota',NULL,117);
+INSERT INTO t1 VALUES (0,0,NULL,'Ohio',NULL,1);
+INSERT INTO t1 VALUES (149,0,NULL,'prepare',NULL,958);
+INSERT INTO t1 VALUES (9,0,NULL,'i',NULL,496);
+INSERT INTO t1 VALUES (0,0,NULL,'she',NULL,328);
+INSERT INTO t1 VALUES (0,0,NULL,'bbgjdtkkkntfogehrocicikzsxdkdefzskjbcdqkaawqmtxnpefrdshgm',NULL,NULL);
+INSERT INTO t1 VALUES (206,0,NULL,'gjdtkkkntfogehrocicikzsxdkdefzskjbcdqkaawqmtxnpefrdshgmyujlf',NULL,678);
+INSERT INTO t1 VALUES (83,0,NULL,'teenager',NULL,290);
+INSERT INTO t1 VALUES (32767,0,NULL,'tkkkntfogehrocicikzsxdkdefzskjbcdqkaawqmtxnpefrdshgmyujlfbpksd',NULL,12);
+INSERT INTO t1 VALUES (0,0,NULL,'kntfogehrocicikzsxdkdefzskjbcdqkaawqmtxnpefrdshgmyujlfbpksd',NULL,79);
+INSERT INTO t1 VALUES (-1536,0,NULL,'n',NULL,192);
+INSERT INTO t1 VALUES (0,0,NULL,'ignore',NULL,0);
+INSERT INTO t1 VALUES (28936,0,NULL,'gehrocicikzsxdkdefzskjbcd',NULL,191);
+INSERT INTO t1 VALUES (2,0,NULL,'rocicikzsxdkdefzskjbcdqkaawqmtxnpefrdshgmyujlfbpksdqbcozg',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'southwest',NULL,0);
+INSERT INTO t1 VALUES (-14649,0,NULL,'icikzsxdkdefzskjbcdqkaawqmtxnp',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'i',NULL,144);
+INSERT INTO t1 VALUES (54,0,NULL,'investigation',NULL,NULL);
+INSERT INTO t1 VALUES (1,0,NULL,'Missouri',NULL,-880);
+INSERT INTO t1 VALUES (0,0,NULL,'Minnesota',NULL,-144);
+INSERT INTO t1 VALUES (NULL,0,NULL,'seek',NULL,NULL);
+INSERT INTO t1 VALUES (92,0,NULL,'critical',NULL,NULL);
+INSERT INTO t1 VALUES (-19917,0,NULL,'dancing',NULL,11);
+INSERT INTO t1 VALUES (32767,0,NULL,'k',NULL,9);
+INSERT INTO t1 VALUES (5,0,NULL,'efzskjbcd',NULL,520);
+INSERT INTO t1 VALUES (NULL,0,NULL,'l',NULL,9);
+INSERT INTO t1 VALUES (-18309,0,NULL,'x',NULL,0);
+INSERT INTO t1 VALUES (30791,0,NULL,'v',NULL,883);
+INSERT INTO t1 VALUES (17054,0,NULL,'quite',NULL,199);
+INSERT INTO t1 VALUES (0,0,NULL,'Illinois',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'thought',NULL,6);
+INSERT INTO t1 VALUES (32767,0,NULL,'aa',NULL,240);
+INSERT INTO t1 VALUES (1,0,NULL,'builder',NULL,0);
+INSERT INTO t1 VALUES (2,0,NULL,'bread',NULL,478);
+INSERT INTO t1 VALUES (9,0,NULL,'mt',NULL,464);
+INSERT INTO t1 VALUES (0,0,NULL,'t',NULL,471);
+INSERT INTO t1 VALUES (249,0,NULL,'npefrdshgmyujlfbpksdqbcozgqnzxeuyjrdnutvbnf',NULL,272);
+INSERT INTO t1 VALUES (-5659,0,NULL,'ef',NULL,845);
+INSERT INTO t1 VALUES (32767,0,NULL,'Maine',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'project',NULL,-880);
+INSERT INTO t1 VALUES (203,0,NULL,'f',NULL,569);
+INSERT INTO t1 VALUES (6615,0,NULL,'z',NULL,820);
+INSERT INTO t1 VALUES (0,0,NULL,'highlight',NULL,0);
+INSERT INTO t1 VALUES (28099,0,NULL,'Louisiana',NULL,-528);
+INSERT INTO t1 VALUES (NULL,0,NULL,'j',NULL,NULL);
+INSERT INTO t1 VALUES (244,0,NULL,'f',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'mutter',NULL,3);
+INSERT INTO t1 VALUES (32767,0,NULL,'i',NULL,4);
+INSERT INTO t1 VALUES (-11010,0,NULL,'e',NULL,294);
+INSERT INTO t1 VALUES (214,0,NULL,'c',NULL,-32);
+INSERT INTO t1 VALUES (8,0,NULL,'ozgqnzxeuyjrdnutvbnfsjye',NULL,275);
+INSERT INTO t1 VALUES (0,0,NULL,'m',NULL,808);
+INSERT INTO t1 VALUES (-17980,0,NULL,'dip',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'Virginia',NULL,222);
+INSERT INTO t1 VALUES (218,0,NULL,'opponent',NULL,8);
+INSERT INTO t1 VALUES (32767,0,NULL,'xeuyjrdnutvbnfsjyeke',NULL,3);
+INSERT INTO t1 VALUES (1,0,NULL,'jrdnutvbnfsjyekezjixrjdkyqgpokqquixax',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'s',NULL,NULL);
+INSERT INTO t1 VALUES (234,0,NULL,'g',NULL,99);
+INSERT INTO t1 VALUES (172,0,NULL,'appointment',NULL,821);
+INSERT INTO t1 VALUES (NULL,0,NULL,'k',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'vbnfsjyekezjixrjdkyqgpokqquixaxjoyffwcfggsaoysceuzohfq',NULL,6);
+INSERT INTO t1 VALUES (0,0,NULL,'nfsjyekezjixrjdkyqgpokqquixaxjoy',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'f',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'n',NULL,66);
+INSERT INTO t1 VALUES (32767,0,NULL,'South Carolina',NULL,32);
+INSERT INTO t1 VALUES (0,0,NULL,'ek',NULL,22);
+INSERT INTO t1 VALUES (4,0,NULL,'Mississippi',NULL,132);
+INSERT INTO t1 VALUES (26606,0,NULL,'p',NULL,0);
+INSERT INTO t1 VALUES (26043,0,NULL,'center',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'b',NULL,1);
+INSERT INTO t1 VALUES (8,0,NULL,'dk',NULL,NULL);
+INSERT INTO t1 VALUES (24031,0,NULL,'l',NULL,4);
+INSERT INTO t1 VALUES (79,0,NULL,'po',NULL,7);
+INSERT INTO t1 VALUES (5,0,NULL,'Massachusetts',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'k',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'quixaxjoyf',NULL,213);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Arkansas',NULL,-160);
+INSERT INTO t1 VALUES (-30994,0,NULL,'Kansas',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'wheat',NULL,-808);
+INSERT INTO t1 VALUES (231,0,NULL,'less',NULL,912);
+INSERT INTO t1 VALUES (NULL,0,NULL,'a',NULL,107);
+INSERT INTO t1 VALUES (4,0,NULL,'ix',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'within',NULL,2);
+INSERT INTO t1 VALUES (17,0,NULL,'style',NULL,19);
+INSERT INTO t1 VALUES (32767,0,NULL,'o',NULL,840);
+INSERT INTO t1 VALUES (-12239,0,NULL,'marker',NULL,152);
+INSERT INTO t1 VALUES (9,0,NULL,'wcfggsaoysceuzohfq',NULL,160);
+INSERT INTO t1 VALUES (212,0,NULL,'fggsaoysceuzohfqhhrnnxkuwsbefbdefxucxqiowgsrsq',NULL,521);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Pennsylvania',NULL,0);
+INSERT INTO t1 VALUES (4,0,NULL,'North Dakota',NULL,67);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Minnesota',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'l',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'known',NULL,0);
+INSERT INTO t1 VALUES (-3384,0,NULL,'uzohfqhhrnnxkuwsbefbdef',NULL,401);
+INSERT INTO t1 VALUES (0,0,NULL,'f',NULL,5);
+INSERT INTO t1 VALUES (210,0,NULL,'conclusion',NULL,110);
+INSERT INTO t1 VALUES (17237,0,NULL,'h',NULL,NULL);
+INSERT INTO t1 VALUES (21561,0,NULL,'examine',NULL,699);
+INSERT INTO t1 VALUES (32767,0,NULL,'xkuwsbefbdefxucx',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'Virginia',NULL,47);
+INSERT INTO t1 VALUES (3,0,NULL,'g',NULL,NULL);
+INSERT INTO t1 VALUES (111,0,NULL,'correctly',NULL,0);
+INSERT INTO t1 VALUES (-588,0,NULL,'j',NULL,180);
+INSERT INTO t1 VALUES (10747,0,NULL,'be',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'e',NULL,8);
+INSERT INTO t1 VALUES (NULL,0,NULL,'defxucxqiowgsrsqg',NULL,NULL);
+INSERT INTO t1 VALUES (214,0,NULL,'v',NULL,183);
+INSERT INTO t1 VALUES (0,0,NULL,'xqiowgsrsqghqvetkcthoaigpdmsltmfepvjynircsyhydh',NULL,442);
+INSERT INTO t1 VALUES (21,0,NULL,'q',NULL,212);
+INSERT INTO t1 VALUES (6,0,NULL,'w',NULL,474);
+INSERT INTO t1 VALUES (0,0,NULL,'portfolio',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'s',NULL,NULL);
+INSERT INTO t1 VALUES (-2945,0,NULL,'g',NULL,536);
+INSERT INTO t1 VALUES (NULL,0,NULL,'slam',NULL,3);
+INSERT INTO t1 VALUES (172,0,NULL,'South Carolina',NULL,0);
+INSERT INTO t1 VALUES (-15771,0,NULL,'u',NULL,105);
+INSERT INTO t1 VALUES (0,0,NULL,'New Mexico',NULL,3);
+INSERT INTO t1 VALUES (-27986,0,NULL,'ho',NULL,NULL);
+INSERT INTO t1 VALUES (21055,0,NULL,'igpdmsltmfepvjynircsyhydhsmudplhhmhanqhwqrvpvcwltaxycuccy',NULL,360);
+INSERT INTO t1 VALUES (8,0,NULL,'q',NULL,12);
+INSERT INTO t1 VALUES (235,0,NULL,'msltmfepvjynircsyhydhsmudplh',NULL,764);
+INSERT INTO t1 VALUES (32767,0,NULL,'Florida',NULL,932);
+INSERT INTO t1 VALUES (184,0,NULL,'vision',NULL,183);
+INSERT INTO t1 VALUES (4,0,NULL,'c',NULL,776);
+INSERT INTO t1 VALUES (6,0,NULL,'pv',NULL,0);
+INSERT INTO t1 VALUES (-27554,0,NULL,'conference',NULL,79);
+INSERT INTO t1 VALUES (32767,0,NULL,'jy',NULL,0);
+INSERT INTO t1 VALUES (5,0,NULL,'ircsyhydhsmudplhhmhanqhwq',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'Washington',NULL,8);
+INSERT INTO t1 VALUES (7,0,NULL,'syhydhs',NULL,387);
+INSERT INTO t1 VALUES (32767,0,NULL,'z',NULL,0);
+INSERT INTO t1 VALUES (3,0,NULL,'ydhsmudplhhmhanqhwqrvpvcwltaxycuccywdujpabzv',NULL,707);
+INSERT INTO t1 VALUES (NULL,0,NULL,'hsmudplhhmhanqhwqrvpvcwltaxycuccywdujpabzvtngapa',NULL,6);
+INSERT INTO t1 VALUES (0,0,NULL,'udplhhmhanqhwqrvpvcwltaxy',NULL,769);
+INSERT INTO t1 VALUES (2,0,NULL,'plhhmh',NULL,7);
+INSERT INTO t1 VALUES (39,0,NULL,'h',NULL,0);
+INSERT INTO t1 VALUES (-10547,0,NULL,'devote',NULL,0);
+INSERT INTO t1 VALUES (5,0,NULL,'Louisiana',NULL,49);
+INSERT INTO t1 VALUES (122,0,NULL,'nqhwqrvpvcwltaxycuccywdujpabzvtngapaidsrppccpnychu',NULL,8);
+INSERT INTO t1 VALUES (6778,0,NULL,'required',NULL,595);
+INSERT INTO t1 VALUES (0,0,NULL,'s',NULL,800);
+INSERT INTO t1 VALUES (NULL,0,NULL,'election',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'n',NULL,-360);
+INSERT INTO t1 VALUES (9,0,NULL,'doorway',NULL,146);
+INSERT INTO t1 VALUES (4025,0,NULL,'vpvcwltaxycuccywdujpabzvtngapaidsrppccpnychuzvzaxa',NULL,440);
+INSERT INTO t1 VALUES (25553,0,NULL,'classroom',NULL,116);
+INSERT INTO t1 VALUES (0,0,NULL,'duck',NULL,0);
+INSERT INTO t1 VALUES (7,0,NULL,'belly',NULL,176);
+INSERT INTO t1 VALUES (11217,0,NULL,'o',NULL,928);
+INSERT INTO t1 VALUES (30374,0,NULL,'j',NULL,32);
+INSERT INTO t1 VALUES (32767,0,NULL,'cu',NULL,-280);
+INSERT INTO t1 VALUES (3292,0,NULL,'ywdujpabzvtngapaidsrppccpnychuzvzaxajyizsnovyzqqimibnvz',NULL,NULL);
+INSERT INTO t1 VALUES (5,0,NULL,'uj',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'v',NULL,NULL);
+INSERT INTO t1 VALUES (31072,0,NULL,'adjustment',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'vt',NULL,NULL);
+INSERT INTO t1 VALUES (11282,0,NULL,'e',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'a',NULL,0);
+INSERT INTO t1 VALUES (30,0,NULL,'i',NULL,5);
+INSERT INTO t1 VALUES (1,0,NULL,'Maryland',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'rppccpnychuzvzaxajyizsnovyzqq',NULL,688);
+INSERT INTO t1 VALUES (4426,0,NULL,'ppccpnychuzvzaxajyizsnovyzqqimibnvzudcicgutp',NULL,3);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Iowa',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'x',NULL,928);
+INSERT INTO t1 VALUES (1,0,NULL,'k',NULL,-88);
+INSERT INTO t1 VALUES (30550,0,NULL,'p',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'huzvzaxajyizsnovyzqqimibnvzudcicgutpkrnsuqdzqjvnnesqq',NULL,577);
+INSERT INTO t1 VALUES (22824,0,NULL,'uzvzaxajyizsnovyzqqimibnvzudcicgutpkrnsuqdz',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'z',NULL,0);
+INSERT INTO t1 VALUES (9,0,NULL,'Rhode Island',NULL,120);
+INSERT INTO t1 VALUES (5,0,NULL,'zaxajyizsnovyzqqimibnvzudcicgutpkrnsuqdzqjvnnesqqprogbfwnjvym',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'xajyizsnovyzqqimibnvzudcicg',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'certainly',NULL,0);
+INSERT INTO t1 VALUES (-32548,0,NULL,'zs',NULL,-232);
+INSERT INTO t1 VALUES (32767,0,NULL,'vy',NULL,5);
+INSERT INTO t1 VALUES (151,0,NULL,'Vermont',NULL,171);
+INSERT INTO t1 VALUES (32767,0,NULL,'Virginia',NULL,0);
+INSERT INTO t1 VALUES (9,0,NULL,'h',NULL,719);
+INSERT INTO t1 VALUES (19723,0,NULL,'Oregon',NULL,96);
+INSERT INTO t1 VALUES (0,0,NULL,'Utah',NULL,2);
+INSERT INTO t1 VALUES (73,0,NULL,'qimibnvz',NULL,-160);
+INSERT INTO t1 VALUES (NULL,0,NULL,'i',NULL,NULL);
+INSERT INTO t1 VALUES (29652,0,NULL,'vzudcicgutpkrnsuq',NULL,117);
+INSERT INTO t1 VALUES (-8160,0,NULL,'Alabama',NULL,380);
+INSERT INTO t1 VALUES (28910,0,NULL,'slow',NULL,-720);
+INSERT INTO t1 VALUES (23824,0,NULL,'d',NULL,0);
+INSERT INTO t1 VALUES (12,0,NULL,'wake',NULL,-328);
+INSERT INTO t1 VALUES (9,0,NULL,'p',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'tpkrnsuqdzqjvnnesqqprogbfwnjvymzpewbtuefqwbjzvynkwcko',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'krnsuqdzqjvnnesqq',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'r',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'nsuqdzqjvnnesqqprogbfwnjvymzpewb',NULL,264);
+INSERT INTO t1 VALUES (30,0,NULL,'qdzqjvnnesqqprogbfw',NULL,749);
+INSERT INTO t1 VALUES (NULL,0,NULL,'t',NULL,NULL);
+INSERT INTO t1 VALUES (250,0,NULL,'qj',NULL,736);
+INSERT INTO t1 VALUES (0,0,NULL,'South Carolina',NULL,113);
+INSERT INTO t1 VALUES (NULL,0,NULL,'l',NULL,532);
+INSERT INTO t1 VALUES (29641,0,NULL,'sqqprogbfwnjvymzpewbtuefqwbjzvynkwckorhjvecyethcprwnxptf',NULL,9);
+INSERT INTO t1 VALUES (0,0,NULL,'qprogbfwnjvymzpewbtuefqwbjzvynkwckor',NULL,491);
+INSERT INTO t1 VALUES (4,0,NULL,'ogbfwnjvymzpewbtuefqwbjzvynkwckorhjvecyethcprwnxpt',NULL,987);
+INSERT INTO t1 VALUES (-164,0,NULL,'i',NULL,2);
+INSERT INTO t1 VALUES (18056,0,NULL,'pair',NULL,3);
+INSERT INTO t1 VALUES (7,0,NULL,'appointment',NULL,5);
+INSERT INTO t1 VALUES (6,0,NULL,'n',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'Massachusetts',NULL,-832);
+INSERT INTO t1 VALUES (32767,0,NULL,'m',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'zpewbtuefqwbjzvynkwckorh',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'announcement',NULL,3);
+INSERT INTO t1 VALUES (9,0,NULL,'e',NULL,864);
+INSERT INTO t1 VALUES (54,0,NULL,'f',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'beard',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'jungle',NULL,5);
+INSERT INTO t1 VALUES (32767,0,NULL,'South Dakota',NULL,8);
+INSERT INTO t1 VALUES (23375,0,NULL,'s',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Idaho',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'b',NULL,0);
+INSERT INTO t1 VALUES (28335,0,NULL,'qw',NULL,NULL);
+INSERT INTO t1 VALUES (147,0,NULL,'jzvynkwckorhjvecyethcprwnxptfrrcftpelmjjhwzgdgqxaeqgknlz',NULL,16);
+INSERT INTO t1 VALUES (32767,0,NULL,'Texas',NULL,184);
+INSERT INTO t1 VALUES (NULL,0,NULL,'amazing',NULL,0);
+INSERT INTO t1 VALUES (176,0,NULL,'ckorhjvecyethcprwnxptfrrcftpelmjjhwzgdgqxaeqgknlzzhcl',NULL,219);
+INSERT INTO t1 VALUES (5824,0,NULL,'rhjvecyethcprwnxptfrrcftpelmjjhwzgdgqxaeqgknlzz',NULL,8);
+INSERT INTO t1 VALUES (7,0,NULL,'jvecyethcprwnxp',NULL,NULL);
+INSERT INTO t1 VALUES (31315,0,NULL,'k',NULL,0);
+INSERT INTO t1 VALUES (6,0,NULL,'y',NULL,-472);
+INSERT INTO t1 VALUES (1,0,NULL,'Wisconsin',NULL,-208);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Louisiana',NULL,928);
+INSERT INTO t1 VALUES (9,0,NULL,'d',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'giant',NULL,505);
+INSERT INTO t1 VALUES (NULL,0,NULL,'xptfrrcftpelmjjhwzgdgqxaeqgknlzzhclsosqpyoeakxhqnjaa',NULL,941);
+INSERT INTO t1 VALUES (NULL,0,NULL,'w',NULL,0);
+INSERT INTO t1 VALUES (6693,0,NULL,'Ohio',NULL,3);
+INSERT INTO t1 VALUES (182,0,NULL,'Delaware',NULL,119);
+INSERT INTO t1 VALUES (26419,0,NULL,'tp',NULL,0);
+INSERT INTO t1 VALUES (77,0,NULL,'elmjjhwzgdgqxaeqgknlzzhc',NULL,227);
+INSERT INTO t1 VALUES (NULL,0,NULL,'m',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'f',NULL,653);
+INSERT INTO t1 VALUES (5,0,NULL,'how',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'pick',NULL,-128);
+INSERT INTO t1 VALUES (21683,0,NULL,'Missouri',NULL,135);
+INSERT INTO t1 VALUES (27244,0,NULL,'q',NULL,155);
+INSERT INTO t1 VALUES (0,0,NULL,'Delaware',NULL,309);
+INSERT INTO t1 VALUES (0,0,NULL,'eqgknlzzhclsosqpyoeakxhqnjaagzutblkgqduiopczwkjkkzjqg',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'failure',NULL,800);
+INSERT INTO t1 VALUES (0,0,NULL,'Rhode Island',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'h',NULL,NULL);
+INSERT INTO t1 VALUES (10453,0,NULL,'Oregon',NULL,0);
+INSERT INTO t1 VALUES (4,0,NULL,'b',NULL,-648);
+INSERT INTO t1 VALUES (0,0,NULL,'s',NULL,104);
+INSERT INTO t1 VALUES (8,0,NULL,'qp',NULL,344);
+INSERT INTO t1 VALUES (4200,0,NULL,'pyoeakxhqnjaagzutblkgqduiopczwkjkkzjqgcnzxrfvzsgcobwhzif',NULL,86);
+INSERT INTO t1 VALUES (NULL,0,NULL,'property',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'akxhqnjaag',NULL,213);
+INSERT INTO t1 VALUES (131,0,NULL,'New Mexico',NULL,207);
+INSERT INTO t1 VALUES (NULL,0,NULL,'contest',NULL,184);
+INSERT INTO t1 VALUES (-13903,0,NULL,'decade',NULL,-96);
+INSERT INTO t1 VALUES (32767,0,NULL,'aagzutbl',NULL,395);
+INSERT INTO t1 VALUES (7,0,NULL,'like',NULL,324);
+INSERT INTO t1 VALUES (137,0,NULL,'u',NULL,0);
+INSERT INTO t1 VALUES (1,0,NULL,'b',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'g',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'duiopczwkjkkzjqgcnzxrfvzsgcobwhzifhnulqzxdrmpoeyfsifyi',NULL,-960);
+INSERT INTO t1 VALUES (86,0,NULL,'s',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'op',NULL,889);
+INSERT INTO t1 VALUES (5,0,NULL,'g',NULL,NULL);
+INSERT INTO t1 VALUES (6,0,NULL,'czwkjkkzjq',NULL,48);
+INSERT INTO t1 VALUES (195,0,NULL,'w',NULL,86);
+INSERT INTO t1 VALUES (15,0,NULL,'kkzjqgcnzxrfvzsgcobwhzifhnulqzxdrmpoeyfsifyiiycarluqadgl',NULL,0);
+INSERT INTO t1 VALUES (7366,0,NULL,'e',NULL,8);
+INSERT INTO t1 VALUES (29558,0,NULL,'j',NULL,NULL);
+INSERT INTO t1 VALUES (2268,0,NULL,'cn',NULL,9);
+INSERT INTO t1 VALUES (32767,0,NULL,'nzxrfvzsgcobwhzifhnulqzxdrmpoeyfsifyiiycarluqadgldl',NULL,866);
+INSERT INTO t1 VALUES (0,0,NULL,'zx',NULL,172);
+INSERT INTO t1 VALUES (3,0,NULL,'xrfvzsgcobwhzifhnulqzxdrmpoeyfsify',NULL,8);
+INSERT INTO t1 VALUES (NULL,0,NULL,'South Dakota',NULL,584);
+INSERT INTO t1 VALUES (32767,0,NULL,'z',NULL,0);
+INSERT INTO t1 VALUES (-7091,0,NULL,'g',NULL,5);
+INSERT INTO t1 VALUES (32767,0,NULL,'o',NULL,311);
+INSERT INTO t1 VALUES (4,0,NULL,'f',NULL,432);
+INSERT INTO t1 VALUES (116,0,NULL,'Indiana',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'boundary',NULL,2);
+INSERT INTO t1 VALUES (219,0,NULL,'n',NULL,626);
+INSERT INTO t1 VALUES (70,0,NULL,'u',NULL,7);
+INSERT INTO t1 VALUES (NULL,0,NULL,'lqz',NULL,935);
+INSERT INTO t1 VALUES (9,0,NULL,'coat',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'y',NULL,0);
+INSERT INTO t1 VALUES (6631,0,NULL,'master',NULL,6);
+INSERT INTO t1 VALUES (0,0,NULL,'rmpoeyfsifyii',NULL,654);
+INSERT INTO t1 VALUES (6,0,NULL,'p',NULL,24);
+INSERT INTO t1 VALUES (-30502,0,NULL,'eyfsifyiiycarluqadgldleafqwtnqxbjccqnslyksq',NULL,6);
+INSERT INTO t1 VALUES (32767,0,NULL,'r',NULL,0);
+INSERT INTO t1 VALUES (22650,0,NULL,'Ohio',NULL,152);
+INSERT INTO t1 VALUES (21205,0,NULL,'burning',NULL,14);
+INSERT INTO t1 VALUES (65,0,NULL,'condemn',NULL,200);
+INSERT INTO t1 VALUES (7,0,NULL,'fyiiycarluqadgldleafqwtnq',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'iy',NULL,242);
+INSERT INTO t1 VALUES (NULL,0,NULL,'ca',NULL,796);
+INSERT INTO t1 VALUES (8,0,NULL,'r',NULL,8);
+INSERT INTO t1 VALUES (184,0,NULL,'u',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'Georgia',NULL,752);
+INSERT INTO t1 VALUES (81,0,NULL,'North Carolina',NULL,0);
+INSERT INTO t1 VALUES (-15767,0,NULL,'u',NULL,656);
+INSERT INTO t1 VALUES (3,0,NULL,'Texas',NULL,784);
+INSERT INTO t1 VALUES (12921,0,NULL,'girlfriend',NULL,49);
+INSERT INTO t1 VALUES (69,0,NULL,'n',NULL,7);
+INSERT INTO t1 VALUES (5823,0,NULL,'a',NULL,929);
+INSERT INTO t1 VALUES (245,0,NULL,'fqwtnq',NULL,100);
+INSERT INTO t1 VALUES (0,0,NULL,'w',NULL,-328);
+INSERT INTO t1 VALUES (32767,0,NULL,'tn',NULL,256);
+INSERT INTO t1 VALUES (0,0,NULL,'q',NULL,-192);
+INSERT INTO t1 VALUES (19430,0,NULL,'o',NULL,NULL);
+INSERT INTO t1 VALUES (21086,0,NULL,'producer',NULL,0);
+INSERT INTO t1 VALUES (6,0,NULL,'cq',NULL,568);
+INSERT INTO t1 VALUES (0,0,NULL,'South Dakota',NULL,253);
+INSERT INTO t1 VALUES (32767,0,NULL,'kill',NULL,129);
+INSERT INTO t1 VALUES (NULL,0,NULL,'u',NULL,NULL);
+INSERT INTO t1 VALUES (18210,0,NULL,'seal',NULL,29);
+INSERT INTO t1 VALUES (102,0,NULL,'jmxngcvwlwuvtuwmyxzulbiys',NULL,0);
+INSERT INTO t1 VALUES (29116,0,NULL,'ngcvwlwuvtuwmyxzulbiysrlgjzzendrgndm',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'vw',NULL,9);
+INSERT INTO t1 VALUES (0,0,NULL,'West Virginia',NULL,258);
+INSERT INTO t1 VALUES (32767,0,NULL,'wuvtuwmyxz',NULL,67);
+INSERT INTO t1 VALUES (32767,0,NULL,'New Hampshire',NULL,113);
+INSERT INTO t1 VALUES (0,0,NULL,'a',NULL,NULL);
+INSERT INTO t1 VALUES (7,0,NULL,'p',NULL,24);
+INSERT INTO t1 VALUES (251,0,NULL,'m',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'y',NULL,0);
+INSERT INTO t1 VALUES (31980,0,NULL,'s',NULL,989);
+INSERT INTO t1 VALUES (32767,0,NULL,'encounter',NULL,NULL);
+INSERT INTO t1 VALUES (10072,0,NULL,'laboratory',NULL,110);
+INSERT INTO t1 VALUES (64,0,NULL,'ysrlgjzzendrgndmbuqakniwwuvhdkzkpviuzhjcaeovskckoeqzaydcn',NULL,711);
+INSERT INTO t1 VALUES (33,0,NULL,'a',NULL,0);
+INSERT INTO t1 VALUES (9768,0,NULL,'rl',NULL,4);
+INSERT INTO t1 VALUES (32767,0,NULL,'Massachusetts',NULL,0);
+INSERT INTO t1 VALUES (-27608,0,NULL,'zzendrg',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'narrative',NULL,0);
+INSERT INTO t1 VALUES (32652,0,NULL,'nd',NULL,758);
+INSERT INTO t1 VALUES (-27421,0,NULL,'gndmbuqakniwwuvhdkzkp',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'Michigan',NULL,672);
+INSERT INTO t1 VALUES (63,0,NULL,'Washington',NULL,177);
+INSERT INTO t1 VALUES (32767,0,NULL,'South Dakota',NULL,NULL);
+INSERT INTO t1 VALUES (89,0,NULL,'road',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'a',NULL,161);
+INSERT INTO t1 VALUES (NULL,0,NULL,'breathing',NULL,4);
+INSERT INTO t1 VALUES (-3678,0,NULL,'Georgia',NULL,0);
+INSERT INTO t1 VALUES (20068,0,NULL,'Minnesota',NULL,199);
+INSERT INTO t1 VALUES (2,0,NULL,'v',NULL,6);
+INSERT INTO t1 VALUES (0,0,NULL,'Pennsylvania',NULL,177);
+INSERT INTO t1 VALUES (5,0,NULL,'commonly',NULL,0);
+INSERT INTO t1 VALUES (1,0,NULL,'iuzhjcaeovskckoeqzaydc',NULL,NULL);
+INSERT INTO t1 VALUES (-28253,0,NULL,'c',NULL,362);
+INSERT INTO t1 VALUES (NULL,0,NULL,'cook',NULL,NULL);
+INSERT INTO t1 VALUES (68,0,NULL,'standard',NULL,212);
+INSERT INTO t1 VALUES (71,0,NULL,'Illinois',NULL,0);
+INSERT INTO t1 VALUES (25059,0,NULL,'d',NULL,952);
+INSERT INTO t1 VALUES (-17615,0,NULL,'d',NULL,19);
+INSERT INTO t1 VALUES (0,0,NULL,'butt',NULL,-112);
+INSERT INTO t1 VALUES (32767,0,NULL,'v',NULL,-264);
+INSERT INTO t1 VALUES (NULL,0,NULL,'missing',NULL,250);
+INSERT INTO t1 VALUES (-17641,0,NULL,'kc',NULL,105);
+INSERT INTO t1 VALUES (30903,0,NULL,'once',NULL,595);
+INSERT INTO t1 VALUES (113,0,NULL,'m',NULL,-616);
+INSERT INTO t1 VALUES (NULL,0,NULL,'za',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Alaska',NULL,318);
+INSERT INTO t1 VALUES (32767,0,NULL,'Oregon',NULL,NULL);
+INSERT INTO t1 VALUES (21013,0,NULL,'dear',NULL,0);
+INSERT INTO t1 VALUES (23803,0,NULL,'a',NULL,936);
+INSERT INTO t1 VALUES (6861,0,NULL,'c',NULL,244);
+INSERT INTO t1 VALUES (1,0,NULL,'ri',NULL,9);
+INSERT INTO t1 VALUES (NULL,0,NULL,'New Mexico',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'xupthytmhktihnxeysankgnfqmmf',NULL,84);
+INSERT INTO t1 VALUES (59,0,NULL,'d',NULL,4);
+INSERT INTO t1 VALUES (NULL,0,NULL,'suddenly',NULL,162);
+INSERT INTO t1 VALUES (0,0,NULL,'share',NULL,202);
+INSERT INTO t1 VALUES (NULL,0,NULL,'h',NULL,0);
+INSERT INTO t1 VALUES (12334,0,NULL,'kt',NULL,0);
+INSERT INTO t1 VALUES (18729,0,NULL,'hn',NULL,311);
+INSERT INTO t1 VALUES (0,0,NULL,'ey',NULL,1);
+INSERT INTO t1 VALUES (10,0,NULL,'Virginia',NULL,0);
+INSERT INTO t1 VALUES (1167,0,NULL,'Nevada',NULL,1);
+INSERT INTO t1 VALUES (11065,0,NULL,'v',NULL,30);
+INSERT INTO t1 VALUES (32767,0,NULL,'Mississippi',NULL,96);
+INSERT INTO t1 VALUES (5376,0,NULL,'g',NULL,6);
+INSERT INTO t1 VALUES (0,0,NULL,'q',NULL,161);
+INSERT INTO t1 VALUES (NULL,0,NULL,'hozhvbkimrkwyfogyxqgovowrlzdlkn',NULL,145);
+INSERT INTO t1 VALUES (53,0,NULL,'z',NULL,NULL);
+INSERT INTO t1 VALUES (3,0,NULL,'Connecticut',NULL,0);
+INSERT INTO t1 VALUES (-1242,0,NULL,'v',NULL,711);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Kansas',NULL,NULL);
+INSERT INTO t1 VALUES (3,0,NULL,'q',NULL,0);
+INSERT INTO t1 VALUES (-7994,0,NULL,'rkwyfogyxqgovowrlzdlkngplowqyzdunpamanuewqasgpjuajeyvbeqhywn',NULL,426);
+INSERT INTO t1 VALUES (NULL,0,NULL,'yfogyxqgovowrlzdlkngplowqyzdunpamanuewqasgpjuajeyv',NULL,6);
+INSERT INTO t1 VALUES (55,0,NULL,'o',NULL,73);
+INSERT INTO t1 VALUES (NULL,0,NULL,'qgovowrlzdlk',NULL,89);
+INSERT INTO t1 VALUES (32767,0,NULL,'ovowrlzdlkngp',NULL,1);
+INSERT INTO t1 VALUES (0,0,NULL,'poll',NULL,73);
+INSERT INTO t1 VALUES (15368,0,NULL,'Kansas',NULL,0);
+INSERT INTO t1 VALUES (-11422,0,NULL,'zdlkngplow',NULL,9);
+INSERT INTO t1 VALUES (-8890,0,NULL,'kngplowqyzdunpamanuewqasgpjuajeyvbeqhywnkzbtgviyukxz',NULL,685);
+INSERT INTO t1 VALUES (2184,0,NULL,'ng',NULL,3);
+INSERT INTO t1 VALUES (0,0,NULL,'rider',NULL,-448);
+INSERT INTO t1 VALUES (3,0,NULL,'s',NULL,227);
+INSERT INTO t1 VALUES (NULL,0,NULL,'true',NULL,1);
+INSERT INTO t1 VALUES (0,0,NULL,'d',NULL,274);
+INSERT INTO t1 VALUES (9689,0,NULL,'suite',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'Michigan',NULL,2);
+INSERT INTO t1 VALUES (-30937,0,NULL,'n',NULL,202);
+INSERT INTO t1 VALUES (NULL,0,NULL,'g',NULL,22);
+INSERT INTO t1 VALUES (32767,0,NULL,'w',NULL,147);
+INSERT INTO t1 VALUES (217,0,NULL,'d',NULL,461);
+INSERT INTO t1 VALUES (6058,0,NULL,'a',NULL,432);
+INSERT INTO t1 VALUES (-2853,0,NULL,'sg',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'n',NULL,196);
+INSERT INTO t1 VALUES (8,0,NULL,'j',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'j',NULL,974);
+INSERT INTO t1 VALUES (0,0,NULL,'industry',NULL,0);
+INSERT INTO t1 VALUES (-8236,0,NULL,'d',NULL,24);
+INSERT INTO t1 VALUES (NULL,0,NULL,'qh',NULL,NULL);
+INSERT INTO t1 VALUES (26313,0,NULL,'California',NULL,836);
+INSERT INTO t1 VALUES (0,0,NULL,'ywnkzbtgviyukxzdxkwj',NULL,NULL);
+INSERT INTO t1 VALUES (22547,0,NULL,'zbtgviyukxzdxkwjxmyiszwsexxwhejgdbsainxfsu',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'Wyoming',NULL,-696);
+INSERT INTO t1 VALUES (411,0,NULL,'credit',NULL,798);
+INSERT INTO t1 VALUES (1,0,NULL,'v',NULL,231);
+INSERT INTO t1 VALUES (4,0,NULL,'there',NULL,156);
+INSERT INTO t1 VALUES (-2887,0,NULL,'Illinois',NULL,889);
+INSERT INTO t1 VALUES (4,0,NULL,'yukxzdxkwjxmyiszwsexxwhejgdbsainxfsuurwwueiuzlljraimezc',NULL,-128);
+INSERT INTO t1 VALUES (0,0,NULL,'q',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'xz',NULL,296);
+INSERT INTO t1 VALUES (8,0,NULL,'d',NULL,2);
+INSERT INTO t1 VALUES (19143,0,NULL,'ysuamdortdfpeqhchat',NULL,1);
+INSERT INTO t1 VALUES (128,0,NULL,'unknown',NULL,-864);
+INSERT INTO t1 VALUES (49,0,NULL,'ortdfpeqhchatthkorvzlyvcemotaanbknuuoisfyggsebeowudp',NULL,1);
+INSERT INTO t1 VALUES (NULL,0,NULL,'North Carolina',NULL,8);
+INSERT INTO t1 VALUES (-17574,0,NULL,'tdfpeqhchatthkorvzlyvcemotaanbknuuoisfyggsebeowudpihwiusfzabegk',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'f',NULL,137);
+INSERT INTO t1 VALUES (-13055,0,NULL,'qh',NULL,209);
+INSERT INTO t1 VALUES (NULL,0,NULL,'a',NULL,165);
+INSERT INTO t1 VALUES (127,0,NULL,'hatthkorvzlyvcemotaanbkn',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'casualty',NULL,-824);
+INSERT INTO t1 VALUES (189,0,NULL,'w',NULL,850);
+INSERT INTO t1 VALUES (0,0,NULL,'th',NULL,872);
+INSERT INTO t1 VALUES (7,0,NULL,'b',NULL,103);
+INSERT INTO t1 VALUES (11552,0,NULL,'r',NULL,584);
+INSERT INTO t1 VALUES (7,0,NULL,'halfway',NULL,-544);
+INSERT INTO t1 VALUES (246,0,NULL,'peak',NULL,0);
+INSERT INTO t1 VALUES (2218,0,NULL,'d',NULL,0);
+INSERT INTO t1 VALUES (26017,0,NULL,'emotaanbknuuoisfyggsebeowudpihwiusfzabegktdhkddnhpuliqiao',NULL,3);
+INSERT INTO t1 VALUES (32767,0,NULL,'killing',NULL,NULL);
+INSERT INTO t1 VALUES (-18822,0,NULL,'Hawaii',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'New Jersey',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'Oklahoma',NULL,344);
+INSERT INTO t1 VALUES (NULL,0,NULL,'nuuoisfyggsebeowudpihwiusfzabegktdhkddnhpul',NULL,896);
+INSERT INTO t1 VALUES (2,0,NULL,'approval',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'v',NULL,117);
+INSERT INTO t1 VALUES (0,0,NULL,'w',NULL,525);
+INSERT INTO t1 VALUES (8,0,NULL,'uoisfyggseb',NULL,231);
+INSERT INTO t1 VALUES (0,0,NULL,'Oklahoma',NULL,36);
+INSERT INTO t1 VALUES (NULL,0,NULL,'p',NULL,-312);
+INSERT INTO t1 VALUES (0,0,NULL,'South Carolina',NULL,5);
+INSERT INTO t1 VALUES (127,0,NULL,'n',NULL,198);
+INSERT INTO t1 VALUES (175,0,NULL,'ebeowudpihwiusfzabegktdhkddnhpuliq',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'beowudpihwiusfzabegktdhkddnhp',NULL,0);
+INSERT INTO t1 VALUES (145,0,NULL,'e',NULL,888);
+INSERT INTO t1 VALUES (-26393,0,NULL,'recall',NULL,172);
+INSERT INTO t1 VALUES (32767,0,NULL,'Massachusetts',NULL,210);
+INSERT INTO t1 VALUES (125,0,NULL,'hwiusfzabegktdhkddnhpuliqiaocxuasqfm',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'wi',NULL,132);
+INSERT INTO t1 VALUES (208,0,NULL,'b',NULL,174);
+INSERT INTO t1 VALUES (-2811,0,NULL,'Michigan',NULL,35);
+INSERT INTO t1 VALUES (31649,0,NULL,'fz',NULL,817);
+INSERT INTO t1 VALUES (NULL,0,NULL,'b',NULL,100);
+INSERT INTO t1 VALUES (32767,0,NULL,'k',NULL,224);
+INSERT INTO t1 VALUES (119,0,NULL,'t',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'be',NULL,NULL);
+INSERT INTO t1 VALUES (9,0,NULL,'communication',NULL,960);
+INSERT INTO t1 VALUES (3,0,NULL,'concrete',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'z',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'uliqiaocxuasqfmrtqzapk',NULL,115);
+INSERT INTO t1 VALUES (10801,0,NULL,'Utah',NULL,473);
+INSERT INTO t1 VALUES (0,0,NULL,'i',NULL,6);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Delaware',NULL,0);
+INSERT INTO t1 VALUES (20394,0,NULL,'input',NULL,0);
+INSERT INTO t1 VALUES (-7220,0,NULL,'Minnesota',NULL,214);
+INSERT INTO t1 VALUES (11769,0,NULL,'o',NULL,176);
+INSERT INTO t1 VALUES (0,0,NULL,'a',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'q',NULL,330);
+INSERT INTO t1 VALUES (NULL,0,NULL,'loyal',NULL,4);
+INSERT INTO t1 VALUES (28380,0,NULL,'p',NULL,721);
+INSERT INTO t1 VALUES (0,0,NULL,'zapkkyoihc',NULL,NULL);
+INSERT INTO t1 VALUES (141,0,NULL,'kkyoihcjkajdhiiuoamcqdozgdlrctoxousgtwbkorqhjxntnwvkmnpma',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'ky',NULL,-784);
+INSERT INTO t1 VALUES (25414,0,NULL,'yoihcjkajdhiiuoamcqdozgdl',NULL,NULL);
+INSERT INTO t1 VALUES (-23163,0,NULL,'h',NULL,720);
+INSERT INTO t1 VALUES (7,0,NULL,'n',NULL,928);
+INSERT INTO t1 VALUES (3,0,NULL,'kaj',NULL,NULL);
+INSERT INTO t1 VALUES (145,0,NULL,'draft',NULL,88);
+INSERT INTO t1 VALUES (5,0,NULL,'b',NULL,49);
+INSERT INTO t1 VALUES (4,0,NULL,'dhiiuoamcqdozgdlrctoxou',NULL,0);
+INSERT INTO t1 VALUES (171,0,NULL,'iu',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'mc',NULL,384);
+INSERT INTO t1 VALUES (4,0,NULL,'Illinois',NULL,0);
+INSERT INTO t1 VALUES (6,0,NULL,'etc',NULL,104);
+INSERT INTO t1 VALUES (NULL,0,NULL,'v',NULL,968);
+INSERT INTO t1 VALUES (7,0,NULL,'rctoxousgtwbkorqhjxntnwvkmnpmazmeyarrywowwntwuedjsu',NULL,NULL);
+INSERT INTO t1 VALUES (57,0,NULL,'voting',NULL,9);
+INSERT INTO t1 VALUES (26320,0,NULL,'u',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'x',NULL,5);
+INSERT INTO t1 VALUES (7,0,NULL,'us',NULL,251);
+INSERT INTO t1 VALUES (3,0,NULL,'twbkorqhjxn',NULL,334);
+INSERT INTO t1 VALUES (9,0,NULL,'copy',NULL,563);
+INSERT INTO t1 VALUES (0,0,NULL,'North Carolina',NULL,0);
+INSERT INTO t1 VALUES (249,0,NULL,'Arkansas',NULL,114);
+INSERT INTO t1 VALUES (152,0,NULL,'hjxntnwvkmnpmazmeyarrywowwntwuedjs',NULL,7);
+INSERT INTO t1 VALUES (0,0,NULL,'xntnwvkmnpmazmeyarrywowwntwue',NULL,23);
+INSERT INTO t1 VALUES (28399,0,NULL,'tnwvkmnpmazmeyarr',NULL,914);
+INSERT INTO t1 VALUES (32767,0,NULL,'Iowa',NULL,0);
+INSERT INTO t1 VALUES (43,0,NULL,'n',NULL,8);
+INSERT INTO t1 VALUES (-18416,0,NULL,'maximum',NULL,190);
+INSERT INTO t1 VALUES (169,0,NULL,'Louisiana',NULL,0);
+INSERT INTO t1 VALUES (14,0,NULL,'q',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'n',NULL,86);
+INSERT INTO t1 VALUES (0,0,NULL,'k',NULL,-912);
+INSERT INTO t1 VALUES (NULL,0,NULL,'rr',NULL,368);
+INSERT INTO t1 VALUES (32767,0,NULL,'g',NULL,768);
+INSERT INTO t1 VALUES (3,0,NULL,'pickup',NULL,8);
+INSERT INTO t1 VALUES (0,0,NULL,'honest',NULL,34);
+INSERT INTO t1 VALUES (16895,0,NULL,'so',NULL,888);
+INSERT INTO t1 VALUES (32767,0,NULL,'e',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'play',NULL,82);
+INSERT INTO t1 VALUES (12622,0,NULL,'m',NULL,42);
+INSERT INTO t1 VALUES (0,0,NULL,'ue',NULL,0);
+INSERT INTO t1 VALUES (2,0,NULL,'djsuvvuntfauimqchxjgbzfiambcxhvmtltykjwu',NULL,NULL);
+INSERT INTO t1 VALUES (210,0,NULL,'su',NULL,77);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Florida',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'Arkansas',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'untfauimqchxjgbzfia',NULL,3);
+INSERT INTO t1 VALUES (29576,0,NULL,'Arkansas',NULL,980);
+INSERT INTO t1 VALUES (227,0,NULL,'u',NULL,520);
+INSERT INTO t1 VALUES (3,0,NULL,'imqchxjgbzfiambcxhvmtltykjwulfefqfiykyhqozcnbtzpxonitsw',NULL,-136);
+INSERT INTO t1 VALUES (NULL,0,NULL,'chx',NULL,1);
+INSERT INTO t1 VALUES (5537,0,NULL,'Mississippi',NULL,872);
+INSERT INTO t1 VALUES (0,0,NULL,'jgbzfiambcxhvmtl',NULL,-728);
+INSERT INTO t1 VALUES (229,0,NULL,'bzfiambcxhvmtltykjwulfefqfiykyhqozcnbtzpxonits',NULL,211);
+INSERT INTO t1 VALUES (-16943,0,NULL,'f',NULL,641);
+INSERT INTO t1 VALUES (6,0,NULL,'q',NULL,7);
+INSERT INTO t1 VALUES (1066,0,NULL,'buy',NULL,NULL);
+INSERT INTO t1 VALUES (9,0,NULL,'k',NULL,952);
+INSERT INTO t1 VALUES (11079,0,NULL,'g',NULL,0);
+INSERT INTO t1 VALUES (2,0,NULL,'xh',NULL,NULL);
+INSERT INTO t1 VALUES (5,0,NULL,'mtltykjwulfefqfiykyhqozcn',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'w',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'a',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'influential',NULL,8);
+INSERT INTO t1 VALUES (-26136,0,NULL,'u',NULL,460);
+INSERT INTO t1 VALUES (10308,0,NULL,'lfefqfiykyhqozcnbtzpxonitswxmkoaagmmpxhyefkvhynit',NULL,383);
+INSERT INTO t1 VALUES (6,0,NULL,'fq',NULL,800);
+INSERT INTO t1 VALUES (9,0,NULL,'x',NULL,19);
+INSERT INTO t1 VALUES (0,0,NULL,'y',NULL,0);
+INSERT INTO t1 VALUES (197,0,NULL,'yhqozcnbtzpxonitswxmkoaagmmpxhyefkvhynitxebnkuj',NULL,28);
+INSERT INTO t1 VALUES (0,0,NULL,'Nevada',NULL,746);
+INSERT INTO t1 VALUES (233,0,NULL,'Vermont',NULL,0);
+INSERT INTO t1 VALUES (34,0,NULL,'s',NULL,2);
+INSERT INTO t1 VALUES (32767,0,NULL,'cnbtzpxonitswxmkoaagmmpxhyefkvhynitxebnkujdffizkgzsobnkapdhsgi',NULL,NULL);
+INSERT INTO t1 VALUES (27288,0,NULL,'btzpxonitswxmkoaagmmpxhyefkvhynitxebnkujdffizkgzsobnkapd',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'m',NULL,4);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Nebraska',NULL,NULL);
+INSERT INTO t1 VALUES (-27150,0,NULL,'o',NULL,242);
+INSERT INTO t1 VALUES (0,0,NULL,'explain',NULL,15);
+INSERT INTO t1 VALUES (26756,0,NULL,'x',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'than',NULL,9);
+INSERT INTO t1 VALUES (NULL,0,NULL,'session',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'tswxmkoaagmmpxhyefkvhynitxebnkujdffizkgzsobnkapdhsgiyimagniglns',NULL,587);
+INSERT INTO t1 VALUES (45,0,NULL,'pursue',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'m',NULL,132);
+INSERT INTO t1 VALUES (9,0,NULL,'Idaho',NULL,4);
+INSERT INTO t1 VALUES (1,0,NULL,'flavor',NULL,139);
+INSERT INTO t1 VALUES (0,0,NULL,'offender',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'gmmpxhyefkvhynitxebnkujdffizkgzsobnkapdhsgiyimagnigl',NULL,-544);
+INSERT INTO t1 VALUES (87,0,NULL,'mmpxhyefkvhyn',NULL,4);
+INSERT INTO t1 VALUES (159,0,NULL,'pxhyefkvhynitxebnkujdffizkgzsobnkapdhsgi',NULL,0);
+INSERT INTO t1 VALUES (242,0,NULL,'hy',NULL,113);
+INSERT INTO t1 VALUES (30,0,NULL,'e',NULL,325);
+INSERT INTO t1 VALUES (NULL,0,NULL,'kv',NULL,-624);
+INSERT INTO t1 VALUES (0,0,NULL,'ynitxebnkujdffizkgzsobnkapdhsgiyimagniglnsaocuagnv',NULL,708);
+INSERT INTO t1 VALUES (227,0,NULL,'Utah',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'Kentucky',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'hard',NULL,3);
+INSERT INTO t1 VALUES (8,0,NULL,'c',NULL,NULL);
+INSERT INTO t1 VALUES (4,0,NULL,'i',NULL,0);
+INSERT INTO t1 VALUES (174,0,NULL,'nk',NULL,188);
+INSERT INTO t1 VALUES (106,0,NULL,'spectacular',NULL,2);
+INSERT INTO t1 VALUES (0,0,NULL,'quiet',NULL,586);
+INSERT INTO t1 VALUES (155,0,NULL,'chop',NULL,237);
+INSERT INTO t1 VALUES (1,0,NULL,'undergraduate',NULL,464);
+INSERT INTO t1 VALUES (NULL,0,NULL,'iz',NULL,-224);
+INSERT INTO t1 VALUES (32767,0,NULL,'Maryland',NULL,619);
+INSERT INTO t1 VALUES (NULL,0,NULL,'kgzsobnkapdhsgiyimagniglnsaocuagnvqciwxiiquuzmfzfffty',NULL,-200);
+INSERT INTO t1 VALUES (8,0,NULL,'so',NULL,581);
+INSERT INTO t1 VALUES (1,0,NULL,'nkapdhsgiyimagniglnsaocuagnvqciwxiiquuzmfzffft',NULL,NULL);
+INSERT INTO t1 VALUES (2,0,NULL,'b',NULL,0);
+INSERT INTO t1 VALUES (-22001,0,NULL,'corridor',NULL,NULL);
+INSERT INTO t1 VALUES (4,0,NULL,'sgiyimagniglnsaocuagnvqciwxiiquuzmfzffftyxvxxv',NULL,-24);
+INSERT INTO t1 VALUES (122,0,NULL,'g',NULL,624);
+INSERT INTO t1 VALUES (0,0,NULL,'makeup',NULL,NULL);
+INSERT INTO t1 VALUES (32,0,NULL,'chest',NULL,-680);
+INSERT INTO t1 VALUES (3,0,NULL,'w',NULL,63);
+INSERT INTO t1 VALUES (224,0,NULL,'Utah',NULL,800);
+INSERT INTO t1 VALUES (194,0,NULL,'ni',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'i',NULL,3);
+INSERT INTO t1 VALUES (28,0,NULL,'ln',NULL,NULL);
+INSERT INTO t1 VALUES (-27045,0,NULL,'protection',NULL,349);
+INSERT INTO t1 VALUES (4,0,NULL,'ns',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'Tennessee',NULL,0);
+INSERT INTO t1 VALUES (-21629,0,NULL,'c',NULL,4);
+INSERT INTO t1 VALUES (28847,0,NULL,'g',NULL,46);
+INSERT INTO t1 VALUES (44,0,NULL,'nvqciwxiiquuzmfzffftyxvxxvnsfpxpqdny',NULL,220);
+INSERT INTO t1 VALUES (4,0,NULL,'s',NULL,26);
+INSERT INTO t1 VALUES (77,0,NULL,'abandon',NULL,-848);
+INSERT INTO t1 VALUES (-27160,0,NULL,'m',NULL,2);
+INSERT INTO t1 VALUES (0,0,NULL,'qciwxiiquuzmfzffftyxvxxvnsfpxpqdnyzusaefncvuyxnqbwedgpprpgf',NULL,55);
+INSERT INTO t1 VALUES (32767,0,NULL,'w',NULL,192);
+INSERT INTO t1 VALUES (0,0,NULL,'could',NULL,0);
+INSERT INTO t1 VALUES (6,0,NULL,'charge',NULL,-408);
+INSERT INTO t1 VALUES (-22785,0,NULL,'North Dakota',NULL,-320);
+INSERT INTO t1 VALUES (11582,0,NULL,'d',NULL,945);
+INSERT INTO t1 VALUES (NULL,0,NULL,'mf',NULL,0);
+INSERT INTO t1 VALUES (126,0,NULL,'routine',NULL,1);
+INSERT INTO t1 VALUES (0,0,NULL,'zffftyxvxxvnsfpxpqdnyzu',NULL,928);
+INSERT INTO t1 VALUES (16638,0,NULL,'necessity',NULL,3);
+INSERT INTO t1 VALUES (32431,0,NULL,'fty',NULL,9);
+INSERT INTO t1 VALUES (0,0,NULL,'Maryland',NULL,136);
+INSERT INTO t1 VALUES (NULL,0,NULL,'yxvxxvnsfpxpqdnyzusaefncvuyxnqbwedgpp',NULL,3);
+INSERT INTO t1 VALUES (0,0,NULL,'vxxvnsfpxpqdnyzusaefncvuyxnqbwedgpprpgfqyh',NULL,3);
+INSERT INTO t1 VALUES (32767,0,NULL,'anxiety',NULL,580);
+INSERT INTO t1 VALUES (32767,0,NULL,'defensive',NULL,27);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Pennsylvania',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'l',NULL,2);
+INSERT INTO t1 VALUES (143,0,NULL,'b',NULL,31);
+INSERT INTO t1 VALUES (0,0,NULL,'f',NULL,NULL);
+INSERT INTO t1 VALUES (9,0,NULL,'x',NULL,-528);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Oklahoma',NULL,0);
+INSERT INTO t1 VALUES (42,0,NULL,'p',NULL,67);
+INSERT INTO t1 VALUES (3,0,NULL,'Vermont',NULL,9);
+INSERT INTO t1 VALUES (58,0,NULL,'ny',NULL,0);
+INSERT INTO t1 VALUES (135,0,NULL,'saefncvuyxnqbwedgpprpgfqyhmoqdmwmiwrgehdnteyvlymyccrdlobsqnvuhm',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'West Virginia',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'efncvuyxnqbwedgpprpgfqyhmoqdmwmiwrgehdnteyvlymyccrdlobs',NULL,568);
+INSERT INTO t1 VALUES (1,0,NULL,'l',NULL,6);
+INSERT INTO t1 VALUES (46,0,NULL,'cvuyxnqbwedgpprpgfqyhmoq',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'uyxnqbwed',NULL,928);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Minnesota',NULL,0);
+INSERT INTO t1 VALUES (31825,0,NULL,'Illinois',NULL,NULL);
+INSERT INTO t1 VALUES (9,0,NULL,'South Dakota',NULL,0);
+INSERT INTO t1 VALUES (162,0,NULL,'t',NULL,74);
+INSERT INTO t1 VALUES (99,0,NULL,'dg',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'pr',NULL,0);
+INSERT INTO t1 VALUES (7,0,NULL,'officially',NULL,-712);
+INSERT INTO t1 VALUES (12140,0,NULL,'p',NULL,0);
+INSERT INTO t1 VALUES (1291,0,NULL,'yh',NULL,6);
+INSERT INTO t1 VALUES (0,0,NULL,'h',NULL,115);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Colorado',NULL,2);
+INSERT INTO t1 VALUES (32767,0,NULL,'k',NULL,3);
+INSERT INTO t1 VALUES (0,0,NULL,'miwrgehdnteyvlymyccrdlobsqnvuhmgyvukmp',NULL,386);
+INSERT INTO t1 VALUES (NULL,0,NULL,'North Dakota',NULL,0);
+INSERT INTO t1 VALUES (-20852,0,NULL,'g',NULL,912);
+INSERT INTO t1 VALUES (0,0,NULL,'dnteyvl',NULL,54);
+INSERT INTO t1 VALUES (7,0,NULL,'tey',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'yvlymyccrdlobsqnvuhmg',NULL,88);
+INSERT INTO t1 VALUES (0,0,NULL,'y',NULL,NULL);
+INSERT INTO t1 VALUES (156,0,NULL,'my',NULL,361);
+INSERT INTO t1 VALUES (32767,0,NULL,'f',NULL,227);
+INSERT INTO t1 VALUES (NULL,0,NULL,'California',NULL,915);
+INSERT INTO t1 VALUES (179,0,NULL,'Ohio',NULL,-968);
+INSERT INTO t1 VALUES (117,0,NULL,'lobsqnvuhmgyvukmprhonjoiawllmhf',NULL,201);
+INSERT INTO t1 VALUES (-27545,0,NULL,'m',NULL,109);
+INSERT INTO t1 VALUES (251,0,NULL,'q',NULL,762);
+INSERT INTO t1 VALUES (NULL,0,NULL,'royal',NULL,0);
+INSERT INTO t1 VALUES (31557,0,NULL,'Montana',NULL,398);
+INSERT INTO t1 VALUES (6,0,NULL,'gyvukmprhonjoiawllmhfdjzwfflnops',NULL,100);
+INSERT INTO t1 VALUES (27311,0,NULL,'vu',NULL,990);
+INSERT INTO t1 VALUES (0,0,NULL,'North Carolina',NULL,992);
+INSERT INTO t1 VALUES (790,0,NULL,'mprhonjoiawllmhfdjzwfflnopswkconfvcfgxnaubjgqaouxnruacblp',NULL,911);
+INSERT INTO t1 VALUES (99,0,NULL,'glass',NULL,874);
+INSERT INTO t1 VALUES (3,0,NULL,'roman',NULL,821);
+INSERT INTO t1 VALUES (6,0,NULL,'rhonjoiawllmhfdjzwfflnopswkconfvcfgxnaubjgqaouxn',NULL,-8);
+INSERT INTO t1 VALUES (94,0,NULL,'Wisconsin',NULL,207);
+INSERT INTO t1 VALUES (0,0,NULL,'Alabama',NULL,2);
+INSERT INTO t1 VALUES (6,0,NULL,'suspect',NULL,6);
+INSERT INTO t1 VALUES (NULL,0,NULL,'aw',NULL,-520);
+INSERT INTO t1 VALUES (9,0,NULL,'lmhfdjzwfflnopswkconfvcfgxnaubjgqaouxnruacblpwurbz',NULL,3);
+INSERT INTO t1 VALUES (9568,0,NULL,'g',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'djzwfflnopswkconfvcfgxnaubjgqaouxnruacblpwurbzdlpncouones',NULL,880);
+INSERT INTO t1 VALUES (7001,0,NULL,'m',NULL,306);
+INSERT INTO t1 VALUES (23109,0,NULL,'s',NULL,448);
+INSERT INTO t1 VALUES (32767,0,NULL,'introduce',NULL,8);
+INSERT INTO t1 VALUES (1,0,NULL,'fflnopswkconfvcfgxnaubjgqaouxnru',NULL,-544);
+INSERT INTO t1 VALUES (214,0,NULL,'l',NULL,56);
+INSERT INTO t1 VALUES (5,0,NULL,'Kentucky',NULL,259);
+INSERT INTO t1 VALUES (-757,0,NULL,'p',NULL,192);
+INSERT INTO t1 VALUES (NULL,0,NULL,'wkconfvcfgxnaubjgqaouxnruacblpwurbzdlpncouonesd',NULL,8);
+INSERT INTO t1 VALUES (0,0,NULL,'confvcfgxnaubjgqaouxnruacblpwurb',NULL,0);
+INSERT INTO t1 VALUES (-31049,0,NULL,'longtime',NULL,65);
+INSERT INTO t1 VALUES (25,0,NULL,'walking',NULL,NULL);
+INSERT INTO t1 VALUES (2393,0,NULL,'f',NULL,20);
+INSERT INTO t1 VALUES (1,0,NULL,'Oregon',NULL,438);
+INSERT INTO t1 VALUES (14610,0,NULL,'Maryland',NULL,NULL);
+INSERT INTO t1 VALUES (13039,0,NULL,'New Mexico',NULL,0);
+INSERT INTO t1 VALUES (24175,0,NULL,'naubjgqaouxnruacblpwurbzdlpncouonesdoepwzafzqjbxvwo',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'u',NULL,7);
+INSERT INTO t1 VALUES (9,0,NULL,'gqaouxnruacblpwurbzdlpncouonesdoepwza',NULL,498);
+INSERT INTO t1 VALUES (8,0,NULL,'observation',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'ouxn',NULL,132);
+INSERT INTO t1 VALUES (13366,0,NULL,'nruacblpwurbzdlpncouonesdoepwzafzqjbxvwo',NULL,287);
+INSERT INTO t1 VALUES (145,0,NULL,'uacblpwurbzdlpncouonesdoepwzafzqjbxvwoe',NULL,0);
+INSERT INTO t1 VALUES (14293,0,NULL,'c',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'institution',NULL,8);
+INSERT INTO t1 VALUES (147,0,NULL,'Maryland',NULL,0);
+INSERT INTO t1 VALUES (-31412,0,NULL,'c',NULL,-440);
+INSERT INTO t1 VALUES (0,0,NULL,'rbz',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'achieve',NULL,472);
+INSERT INTO t1 VALUES (31,0,NULL,'s',NULL,8);
+INSERT INTO t1 VALUES (5,0,NULL,'g',NULL,7);
+INSERT INTO t1 VALUES (NULL,0,NULL,'North Carolina',NULL,380);
+INSERT INTO t1 VALUES (32767,0,NULL,'t',NULL,-336);
+INSERT INTO t1 VALUES (0,0,NULL,'lpncouonesdoepwzafzqjbxvwoekkivtce',NULL,33);
+INSERT INTO t1 VALUES (0,0,NULL,'Montana',NULL,NULL);
+INSERT INTO t1 VALUES (3,0,NULL,'pncouonesdoepwzafzqjbxvwoekkivtcesl',NULL,723);
+INSERT INTO t1 VALUES (NULL,0,NULL,'u',NULL,0);
+INSERT INTO t1 VALUES (63,0,NULL,'on',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'frustrate',NULL,83);
+INSERT INTO t1 VALUES (NULL,0,NULL,'klcvzuvzzhvxqjupfbbocyvbgiwysnfjiojwzzfvdgaregnglbhd',NULL,128);
+INSERT INTO t1 VALUES (25809,0,NULL,'z',NULL,NULL);
+INSERT INTO t1 VALUES (34,0,NULL,'bonus',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'discover',NULL,NULL);
+INSERT INTO t1 VALUES (191,0,NULL,'shorts',NULL,245);
+INSERT INTO t1 VALUES (32767,0,NULL,'hungry',NULL,-944);
+INSERT INTO t1 VALUES (2,0,NULL,'o',NULL,958);
+INSERT INTO t1 VALUES (209,0,NULL,'ju',NULL,4);
+INSERT INTO t1 VALUES (-14598,0,NULL,'spot',NULL,190);
+INSERT INTO t1 VALUES (2077,0,NULL,'West Virginia',NULL,NULL);
+INSERT INTO t1 VALUES (4,0,NULL,'e',NULL,350);
+INSERT INTO t1 VALUES (-19212,0,NULL,'Louisiana',NULL,6);
+INSERT INTO t1 VALUES (NULL,0,NULL,'North Carolina',NULL,0);
+INSERT INTO t1 VALUES (60,0,NULL,'w',NULL,6);
+INSERT INTO t1 VALUES (2496,0,NULL,'Alabama',NULL,NULL);
+INSERT INTO t1 VALUES (30994,0,NULL,'s',NULL,6);
+INSERT INTO t1 VALUES (0,0,NULL,'h',NULL,2);
+INSERT INTO t1 VALUES (148,0,NULL,'w',NULL,87);
+INSERT INTO t1 VALUES (-28993,0,NULL,'Nebraska',NULL,5);
+INSERT INTO t1 VALUES (NULL,0,NULL,'solar',NULL,NULL);
+INSERT INTO t1 VALUES (6,0,NULL,'Delaware',NULL,440);
+INSERT INTO t1 VALUES (0,0,NULL,'io',NULL,-456);
+INSERT INTO t1 VALUES (0,0,NULL,'nonprofit',NULL,3);
+INSERT INTO t1 VALUES (94,0,NULL,'p',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'New Jersey',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'badly',NULL,-976);
+INSERT INTO t1 VALUES (0,0,NULL,'vdgaregnglbhdyuz',NULL,-512);
+INSERT INTO t1 VALUES (53,0,NULL,'y',NULL,3);
+INSERT INTO t1 VALUES (1334,0,NULL,'re',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'gnglbhdyuzefxyqyvzgqengmivoxdyeps',NULL,91);
+INSERT INTO t1 VALUES (32767,0,NULL,'r',NULL,170);
+INSERT INTO t1 VALUES (0,0,NULL,'Delaware',NULL,255);
+INSERT INTO t1 VALUES (83,0,NULL,'hd',NULL,811);
+INSERT INTO t1 VALUES (-3048,0,NULL,'Maryland',NULL,-704);
+INSERT INTO t1 VALUES (32767,0,NULL,'resist',NULL,80);
+INSERT INTO t1 VALUES (32767,0,NULL,'u',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'uzefxyqyvzgqengmivoxdyepsuxvtphayypszsnjuol',NULL,496);
+INSERT INTO t1 VALUES (32767,0,NULL,'Hawaii',NULL,812);
+INSERT INTO t1 VALUES (32767,0,NULL,'Missouri',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'yvzgqengmivoxdyepsuxv',NULL,0);
+INSERT INTO t1 VALUES (-14971,0,NULL,'Iowa',NULL,158);
+INSERT INTO t1 VALUES (5,0,NULL,'zgqengmivoxdyepsuxvtphayypszsnjuoldxekhknxplp',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'gqengmivoxdyepsuxvtphayypszsnjuoldx',NULL,652);
+INSERT INTO t1 VALUES (0,0,NULL,'t',NULL,649);
+INSERT INTO t1 VALUES (0,0,NULL,'m',NULL,40);
+INSERT INTO t1 VALUES (6,0,NULL,'oxdyepsuxvtphayypszsnjuold',NULL,NULL);
+INSERT INTO t1 VALUES (4374,0,NULL,'e',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'t',NULL,168);
+INSERT INTO t1 VALUES (250,0,NULL,'yepsuxvtphayypszsnjuo',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'New York',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'complete',NULL,871);
+INSERT INTO t1 VALUES (9,0,NULL,'uxvtphayy',NULL,-144);
+INSERT INTO t1 VALUES (56,0,NULL,'nod',NULL,-504);
+INSERT INTO t1 VALUES (0,0,NULL,'v',NULL,680);
+INSERT INTO t1 VALUES (181,0,NULL,'Massachusetts',NULL,322);
+INSERT INTO t1 VALUES (32767,0,NULL,'nuclear',NULL,664);
+INSERT INTO t1 VALUES (163,0,NULL,'u',NULL,117);
+INSERT INTO t1 VALUES (32767,0,NULL,'ay',NULL,-280);
+INSERT INTO t1 VALUES (11214,0,NULL,'z',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'y',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'m',NULL,822);
+INSERT INTO t1 VALUES (0,0,NULL,'California',NULL,91);
+INSERT INTO t1 VALUES (-26918,0,NULL,'date',NULL,343);
+INSERT INTO t1 VALUES (-25243,0,NULL,'reception',NULL,NULL);
+INSERT INTO t1 VALUES (210,0,NULL,'comment',NULL,4);
+INSERT INTO t1 VALUES (73,0,NULL,'w',NULL,734);
+INSERT INTO t1 VALUES (-7394,0,NULL,'j',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'j',NULL,5);
+INSERT INTO t1 VALUES (-4137,0,NULL,'Georgia',NULL,0);
+INSERT INTO t1 VALUES (140,0,NULL,'l',NULL,-880);
+INSERT INTO t1 VALUES (-12829,0,NULL,'Nebraska',NULL,0);
+INSERT INTO t1 VALUES (16211,0,NULL,'hknxplpjbfdlgldb',NULL,NULL);
+INSERT INTO t1 VALUES (14906,0,NULL,'d',NULL,218);
+INSERT INTO t1 VALUES (148,0,NULL,'x',NULL,-736);
+INSERT INTO t1 VALUES (0,0,NULL,'pl',NULL,59);
+INSERT INTO t1 VALUES (NULL,0,NULL,'x',NULL,183);
+INSERT INTO t1 VALUES (0,0,NULL,'fd',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'possibility',NULL,3);
+INSERT INTO t1 VALUES (-7506,0,NULL,'Washington',NULL,512);
+INSERT INTO t1 VALUES (32767,0,NULL,'Illinois',NULL,6);
+INSERT INTO t1 VALUES (NULL,0,NULL,'bhmxtau',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Colorado',NULL,0);
+INSERT INTO t1 VALUES (1,0,NULL,'mxta',NULL,NULL);
+INSERT INTO t1 VALUES (6,0,NULL,'m',NULL,994);
+INSERT INTO t1 VALUES (0,0,NULL,'Massachusetts',NULL,16);
+INSERT INTO t1 VALUES (-17799,0,NULL,'Massachusetts',NULL,91);
+INSERT INTO t1 VALUES (32767,0,NULL,'motion',NULL,139);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Utah',NULL,-160);
+INSERT INTO t1 VALUES (6,0,NULL,'tolerate',NULL,144);
+INSERT INTO t1 VALUES (0,0,NULL,'Florida',NULL,0);
+INSERT INTO t1 VALUES (9,0,NULL,'Vermont',NULL,178);
+INSERT INTO t1 VALUES (13228,0,NULL,'g',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'s',NULL,0);
+INSERT INTO t1 VALUES (18675,0,NULL,'dcuzmmvrllxwkmcyemoriwjoyrkbhssjesnylouaiygiodldcgwktzumjpot',NULL,130);
+INSERT INTO t1 VALUES (7,0,NULL,'Indiana',NULL,0);
+INSERT INTO t1 VALUES (1,0,NULL,'entertainment',NULL,-736);
+INSERT INTO t1 VALUES (-15594,0,NULL,'zmmvrllxwkmcyemoriwjoyrkbhssj',NULL,728);
+INSERT INTO t1 VALUES (0,0,NULL,'mvrllxwkmcyemoriwjoyrk',NULL,295);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Virginia',NULL,23);
+INSERT INTO t1 VALUES (NULL,0,NULL,'llxwkmcyemoriwjoyrkbhssjesnylouaiygiodldcgwktzumjpotwry',NULL,NULL);
+INSERT INTO t1 VALUES (840,0,NULL,'tiny',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'b',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'v',NULL,0);
+INSERT INTO t1 VALUES (4,0,NULL,'Pennsylvania',NULL,133);
+INSERT INTO t1 VALUES (0,0,NULL,'i',NULL,34);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Tennessee',NULL,157);
+INSERT INTO t1 VALUES (7375,0,NULL,'New York',NULL,124);
+INSERT INTO t1 VALUES (8,0,NULL,'e',NULL,0);
+INSERT INTO t1 VALUES (201,0,NULL,'Maine',NULL,597);
+INSERT INTO t1 VALUES (22036,0,NULL,'forty',NULL,168);
+INSERT INTO t1 VALUES (3,0,NULL,'jo',NULL,0);
+INSERT INTO t1 VALUES (16007,0,NULL,'yr',NULL,906);
+INSERT INTO t1 VALUES (NULL,0,NULL,'universe',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'jesnylouaiygiodldcgwktzumjpotwrysvhzzsophhfh',NULL,120);
+INSERT INTO t1 VALUES (0,0,NULL,'Ohio',NULL,4);
+INSERT INTO t1 VALUES (NULL,0,NULL,'sn',NULL,3);
+INSERT INTO t1 VALUES (0,0,NULL,'nylouaiygiodldcgwktzumjpotwrysvhzzsophhfhw',NULL,48);
+INSERT INTO t1 VALUES (233,0,NULL,'dissolve',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'z',NULL,45);
+INSERT INTO t1 VALUES (0,0,NULL,'u',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'mentally',NULL,5);
+INSERT INTO t1 VALUES (32767,0,NULL,'b',NULL,185);
+INSERT INTO t1 VALUES (32767,0,NULL,'poor',NULL,104);
+INSERT INTO t1 VALUES (0,0,NULL,'l',NULL,2);
+INSERT INTO t1 VALUES (20709,0,NULL,'West Virginia',NULL,31);
+INSERT INTO t1 VALUES (196,0,NULL,'ie',NULL,237);
+INSERT INTO t1 VALUES (1,0,NULL,'tz',NULL,NULL);
+INSERT INTO t1 VALUES (214,0,NULL,'mj',NULL,224);
+INSERT INTO t1 VALUES (5,0,NULL,'interpretation',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'q',NULL,1);
+INSERT INTO t1 VALUES (2,0,NULL,'Colorado',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'ry',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'s',NULL,8);
+INSERT INTO t1 VALUES (1,0,NULL,'vhzzsophhfhwxrajsnelqegm',NULL,730);
+INSERT INTO t1 VALUES (-12909,0,NULL,'web',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'zz',NULL,138);
+INSERT INTO t1 VALUES (NULL,0,NULL,'New Hampshire',NULL,NULL);
+INSERT INTO t1 VALUES (56,0,NULL,'u',NULL,297);
+INSERT INTO t1 VALUES (0,0,NULL,'o',NULL,5);
+INSERT INTO t1 VALUES (32767,0,NULL,'consume',NULL,7);
+INSERT INTO t1 VALUES (21901,0,NULL,'g',NULL,0);
+INSERT INTO t1 VALUES (4,0,NULL,'f',NULL,230);
+INSERT INTO t1 VALUES (240,0,NULL,'tension',NULL,1);
+INSERT INTO t1 VALUES (0,0,NULL,'xr',NULL,3);
+INSERT INTO t1 VALUES (0,0,NULL,'h',NULL,679);
+INSERT INTO t1 VALUES (5996,0,NULL,'js',NULL,197);
+INSERT INTO t1 VALUES (-22204,0,NULL,'snelqegmghyhblwpwxfwdt',NULL,0);
+INSERT INTO t1 VALUES (29005,0,NULL,'lqegmghyhblwpwx',NULL,329);
+INSERT INTO t1 VALUES (NULL,0,NULL,'c',NULL,0);
+INSERT INTO t1 VALUES (92,0,NULL,'gm',NULL,NULL);
+INSERT INTO t1 VALUES (5022,0,NULL,'u',NULL,7);
+INSERT INTO t1 VALUES (1,0,NULL,'gh',NULL,-336);
+INSERT INTO t1 VALUES (58,0,NULL,'hyhblwpwxfwdtkjqznxsfkdilpdqhjnyyvkqbqlbighvqntgezzqyfncjcdc',NULL,NULL);
+INSERT INTO t1 VALUES (18629,0,NULL,'bl',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'availability',NULL,-968);
+INSERT INTO t1 VALUES (-17586,0,NULL,'f',NULL,347);
+INSERT INTO t1 VALUES (0,0,NULL,'d',NULL,0);
+INSERT INTO t1 VALUES (6,0,NULL,'consumer',NULL,7);
+INSERT INTO t1 VALUES (2,0,NULL,'jqznxsfkd',NULL,0);
+INSERT INTO t1 VALUES (2,0,NULL,'amazing',NULL,2);
+INSERT INTO t1 VALUES (0,0,NULL,'accompany',NULL,-720);
+INSERT INTO t1 VALUES (NULL,0,NULL,'nxsfkdilpd',NULL,92);
+INSERT INTO t1 VALUES (96,0,NULL,'f',NULL,9);
+INSERT INTO t1 VALUES (NULL,0,NULL,'dilpdqhjnyyvkqbqlbi',NULL,208);
+INSERT INTO t1 VALUES (19,0,NULL,'ribbon',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'Oklahoma',NULL,9);
+INSERT INTO t1 VALUES (22507,0,NULL,'j',NULL,NULL);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Rhode Island',NULL,473);
+INSERT INTO t1 VALUES (167,0,NULL,'Oklahoma',NULL,0);
+INSERT INTO t1 VALUES (65,0,NULL,'y',NULL,42);
+INSERT INTO t1 VALUES (NULL,0,NULL,'container',NULL,0);
+INSERT INTO t1 VALUES (NULL,0,NULL,'ql',NULL,5);
+INSERT INTO t1 VALUES (3,0,NULL,'lbighvqntgezzqyfncjcdcedujseoodxdgibhgrvxgviemzgn',NULL,NULL);
+INSERT INTO t1 VALUES (-18007,0,NULL,'suggest',NULL,0);
+INSERT INTO t1 VALUES (32767,0,NULL,'g',NULL,-88);
+INSERT INTO t1 VALUES (32767,0,NULL,'hvqntgezzqyfncjcdcedujseoodxdgibhgrvxgviemz',NULL,85);
+INSERT INTO t1 VALUES (0,0,NULL,'Oregon',NULL,584);
+INSERT INTO t1 VALUES (32767,0,NULL,'tg',NULL,128);
+INSERT INTO t1 VALUES (57,0,NULL,'ez',NULL,0);
+INSERT INTO t1 VALUES (25235,0,NULL,'Florida',NULL,0);
+INSERT INTO t1 VALUES (245,0,NULL,'Kentucky',NULL,4);
+INSERT INTO t1 VALUES (202,0,NULL,'u',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'fn',NULL,9);
+INSERT INTO t1 VALUES (30016,0,NULL,'d',NULL,0);
+INSERT INTO t1 VALUES (21837,0,NULL,'cd',NULL,6);
+INSERT INTO t1 VALUES (NULL,0,NULL,'cedujseoodxdgibhgrvxgviemzgngjtolxd',NULL,-648);
+INSERT INTO t1 VALUES (NULL,0,NULL,'jseoodxdgibhgrvxgviemzgngjtolxdrc',NULL,154);
+INSERT INTO t1 VALUES (0,0,NULL,'v',NULL,-160);
+INSERT INTO t1 VALUES (32767,0,NULL,'Oklahoma',NULL,27);
+INSERT INTO t1 VALUES (189,0,NULL,'v',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'solar',NULL,5);
+INSERT INTO t1 VALUES (3423,0,NULL,'dg',NULL,880);
+INSERT INTO t1 VALUES (10026,0,NULL,'g',NULL,68);
+INSERT INTO t1 VALUES (2786,0,NULL,'argue',NULL,NULL);
+INSERT INTO t1 VALUES (32767,0,NULL,'i',NULL,NULL);
+INSERT INTO t1 VALUES (18620,0,NULL,'Florida',NULL,197);
+INSERT INTO t1 VALUES (169,0,NULL,'Michigan',NULL,584);
+INSERT INTO t1 VALUES (NULL,0,NULL,'x',NULL,9);
+INSERT INTO t1 VALUES (-21070,0,NULL,'cemetery',NULL,NULL);
+INSERT INTO t1 VALUES (-26771,0,NULL,'Ohio',NULL,2);
+INSERT INTO t1 VALUES (9937,0,NULL,'m',NULL,321);
+INSERT INTO t1 VALUES (4659,0,NULL,'z',NULL,116);
+INSERT INTO t1 VALUES (15502,0,NULL,'n',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'y',NULL,57);
+INSERT INTO t1 VALUES (1,0,NULL,'l',NULL,70);
+INSERT INTO t1 VALUES (52,0,NULL,'y',NULL,-552);
+INSERT INTO t1 VALUES (0,0,NULL,'deem',NULL,544);
+INSERT INTO t1 VALUES (0,0,NULL,'f',NULL,9);
+INSERT INTO t1 VALUES (32767,0,NULL,'r',NULL,52);
+INSERT INTO t1 VALUES (NULL,0,NULL,'o',NULL,154);
+INSERT INTO t1 VALUES (11,0,NULL,'Rhode Island',NULL,176);
+INSERT INTO t1 VALUES (32767,0,NULL,'South Carolina',NULL,1);
+INSERT INTO t1 VALUES (32767,0,NULL,'p',NULL,672);
+INSERT INTO t1 VALUES (0,0,NULL,'u',NULL,4);
+INSERT INTO t1 VALUES (NULL,0,NULL,'positive',NULL,218);
+INSERT INTO t1 VALUES (NULL,0,NULL,'tomorrow',NULL,-48);
+INSERT INTO t1 VALUES (-30122,0,NULL,'rh',NULL,261);
+INSERT INTO t1 VALUES (4,0,NULL,'tap',NULL,NULL);
+INSERT INTO t1 VALUES (0,0,NULL,'overall',NULL,5);
+INSERT INTO t1 VALUES (0,0,NULL,'n',NULL,146);
+INSERT INTO t1 VALUES (32767,0,NULL,'sometimes',NULL,6);
+INSERT INTO t1 VALUES (0,0,NULL,'n',NULL,488);
+INSERT INTO t1 VALUES (NULL,0,NULL,'hw',NULL,NULL);
+INSERT INTO t1 VALUES (2179,0,NULL,'o',NULL,-176);
+INSERT INTO t1 VALUES (NULL,0,NULL,'Pennsylvania',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'dd',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'d',NULL,0);
+INSERT INTO t1 VALUES (160,0,NULL,'h',NULL,633);
+INSERT INTO t1 VALUES (228,0,NULL,'r',NULL,54);
+INSERT INTO t1 VALUES (0,0,NULL,'p',NULL,7);
+INSERT INTO t1 VALUES (0,0,NULL,'jr',NULL,NULL);
+INSERT INTO t1 VALUES (2,0,NULL,'q',NULL,0);
+INSERT INTO t1 VALUES (29,0,NULL,'w',NULL,184);
+INSERT INTO t1 VALUES (14801,0,NULL,'q',NULL,0);
+INSERT INTO t1 VALUES (-24663,0,NULL,'progress',NULL,270);
+INSERT INTO t1 VALUES (0,0,NULL,'w',NULL,-912);
+INSERT INTO t1 VALUES (27423,0,NULL,'ok',NULL,8);
+INSERT INTO t1 VALUES (NULL,0,NULL,'re',NULL,NULL);
+INSERT INTO t1 VALUES (29082,0,NULL,'d',NULL,2);
+INSERT INTO t1 VALUES (32767,0,NULL,'name',NULL,162);
+INSERT INTO t1 VALUES (NULL,0,NULL,'p',NULL,219);
+INSERT INTO t1 VALUES (4801,0,NULL,'wixljp',NULL,266);
+INSERT INTO t1 VALUES (36,0,NULL,'xl',NULL,NULL);
+INSERT INTO t1 VALUES (1,0,NULL,'l',NULL,0);
+INSERT INTO t1 VALUES (0,0,NULL,'i',NULL,584);
+INSERT INTO t1 VALUES (160,0,NULL,'w',NULL,0);
+INSERT INTO t1 VALUES (4,0,NULL,'s',NULL,0);
+INSERT INTO t1 VALUES (20,0,NULL,'d',NULL,NULL);
+INSERT INTO t1 VALUES (31136,0,NULL,'god',NULL,4);
+--enable_query_log
+ALTER TABLE t1 ENABLE KEYS;
+
+--echo # Must not crash:
+SELECT * FROM t1 WHERE ( a BETWEEN 255 AND 270 OR f = 200 ) AND f IN ( 1, 4, 112, 143 ) AND d IN ('Montana', 'South Dakota');
+DROP TABLE t1;
diff --git a/mysql-test/main/sp-big.result b/mysql-test/main/sp-big.result
index 0a07a3aa7a8..ea93f2cac60 100644
--- a/mysql-test/main/sp-big.result
+++ b/mysql-test/main/sp-big.result
@@ -82,8 +82,8 @@ Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be
insert t1 select seq, seq, 1, 1, seq, seq, seq from seq_1_to_2000;
set @before=unix_timestamp();
call select_test();
-select unix_timestamp() - @before < 60;
-unix_timestamp() - @before < 60
+select unix_timestamp() - @before < @time;
+unix_timestamp() - @before < @time
1
drop procedure select_test;
drop table t1;
diff --git a/mysql-test/main/sp-big.test b/mysql-test/main/sp-big.test
index 4220541697e..043e737105a 100644
--- a/mysql-test/main/sp-big.test
+++ b/mysql-test/main/sp-big.test
@@ -112,6 +112,17 @@ delimiter ;//
insert t1 select seq, seq, 1, 1, seq, seq, seq from seq_1_to_2000;
set @before=unix_timestamp();
call select_test();
-select unix_timestamp() - @before < 60;
+
+--let $time=60
+if ($VALGRIND_TEST)
+{
+ --let $time=600
+}
+
+--disable_query_log
+--eval set @time=$time;
+--enable_query_log
+
+select unix_timestamp() - @before < @time;
drop procedure select_test;
drop table t1;
diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result
index 89499b32fa8..34a484f3b18 100644
--- a/mysql-test/main/subselect4.result
+++ b/mysql-test/main/subselect4.result
@@ -2567,6 +2567,37 @@ sum(a) a b
6 1 1
DROP TABLE t1,t2;
#
+# MDEV-17606: Query returns wrong results (while using CHARACTER SET utf8)
+#
+CREATE TABLE t1(l1 varchar(10), i2 int);
+INSERT INTO t1 VALUES ('e',2),('o',6),('x',4);
+CREATE TABLE t2 (v1 varchar(10) CHARACTER SET utf8, KEY v1 (v1(3)));
+INSERT INTO t2 VALUES ('k'),('rid'),('f'),('x');
+EXPLAIN EXTENDED SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t2));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`l1` AS `l1`,`test`.`t1`.`i2` AS `i2` from `test`.`t1` where <nop>(<in_optimizer>(`test`.`t1`.`l1`,<max>(/* select#2 */ select max(`test`.`t2`.`v1`) from `test`.`t2`) > convert(<cache>(`test`.`t1`.`l1`) using utf8)))
+SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t2));
+l1 i2
+e 2
+o 6
+DROP TABLE t1, t2;
+#
+# MDEV-22852: SIGSEGV in sortlength (optimized builds)
+#
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='subquery_cache=off';
+CREATE TABLE t1 (a INT,b INT);
+INSERT INTO t1 VALUES (0,0),(0,0);
+SELECT (SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b)) FROM t1 AS t1o;
+(SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b))
+0
+SET @@optimizer_switch= @save_optimizer_switch;
+DROP TABLE t1;
+# End of 10.2 tests
+#
# MDEV-19134: EXISTS() slower if ORDER BY is defined
#
create table t0 (a int);
diff --git a/mysql-test/main/subselect4.test b/mysql-test/main/subselect4.test
index 6dc8736b64c..36490c340e1 100644
--- a/mysql-test/main/subselect4.test
+++ b/mysql-test/main/subselect4.test
@@ -2103,6 +2103,33 @@ eval $query;
DROP TABLE t1,t2;
--echo #
+--echo # MDEV-17606: Query returns wrong results (while using CHARACTER SET utf8)
+--echo #
+
+CREATE TABLE t1(l1 varchar(10), i2 int);
+INSERT INTO t1 VALUES ('e',2),('o',6),('x',4);
+CREATE TABLE t2 (v1 varchar(10) CHARACTER SET utf8, KEY v1 (v1(3)));
+INSERT INTO t2 VALUES ('k'),('rid'),('f'),('x');
+
+EXPLAIN EXTENDED SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t2));
+SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t2));
+DROP TABLE t1, t2;
+
+--echo #
+--echo # MDEV-22852: SIGSEGV in sortlength (optimized builds)
+--echo #
+
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='subquery_cache=off';
+CREATE TABLE t1 (a INT,b INT);
+INSERT INTO t1 VALUES (0,0),(0,0);
+SELECT (SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b)) FROM t1 AS t1o;
+SET @@optimizer_switch= @save_optimizer_switch;
+DROP TABLE t1;
+
+--echo # End of 10.2 tests
+
+--echo #
--echo # MDEV-19134: EXISTS() slower if ORDER BY is defined
--echo #
create table t0 (a int);
diff --git a/mysql-test/main/temp_table.result b/mysql-test/main/temp_table.result
index 69f3b8e5155..293b6d5cd77 100644
--- a/mysql-test/main/temp_table.result
+++ b/mysql-test/main/temp_table.result
@@ -584,3 +584,21 @@ ALTER TABLE t1 CHANGE no_such_col1 col1 BIGINT NULL;
ERROR 42S22: Unknown column 'no_such_col1' in 't1'
TRUNCATE TABLE t1;
DROP TEMPORARY TABLE t1;
+#
+# MDEV-21695 Server crashes in TABLE::evaluate_update_default_function upon UPDATE on temporary table
+#
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
+CREATE TEMPORARY TABLE t1 (a DATETIME ON UPDATE CURRENT_TIMESTAMP);
+ALTER TABLE t1 ADD b INT;
+INSERT INTO t1 (b) VALUES (1),(2);
+ALTER TABLE t1 CHANGE COLUMN x xx INT;
+ERROR 42S22: Unknown column 'x' in 't1'
+UPDATE t1 SET b = 3;
+SELECT * FROM t1;
+a b
+2001-01-01 10:20:30 3
+2001-01-01 10:20:30 3
+DROP TEMPORARY TABLE t1;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/main/temp_table.test b/mysql-test/main/temp_table.test
index bd3bba34f89..dc5fe7f3cd0 100644
--- a/mysql-test/main/temp_table.test
+++ b/mysql-test/main/temp_table.test
@@ -639,3 +639,22 @@ ALTER TABLE t1 CHANGE no_such_col1 col1 BIGINT NULL;
# was not dropped during the first TRUNCATE due to extra table handles.
TRUNCATE TABLE t1;
DROP TEMPORARY TABLE t1;
+
+--echo #
+--echo # MDEV-21695 Server crashes in TABLE::evaluate_update_default_function upon UPDATE on temporary table
+--echo #
+
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
+CREATE TEMPORARY TABLE t1 (a DATETIME ON UPDATE CURRENT_TIMESTAMP);
+ALTER TABLE t1 ADD b INT;
+INSERT INTO t1 (b) VALUES (1),(2);
+--error ER_BAD_FIELD_ERROR
+ALTER TABLE t1 CHANGE COLUMN x xx INT;
+UPDATE t1 SET b = 3;
+SELECT * FROM t1;
+DROP TEMPORARY TABLE t1;
+
+
+--echo #
+--echo # End of 10.2 tests
+--echo #
diff --git a/mysql-test/main/type_temporal_innodb.result b/mysql-test/main/type_temporal_innodb.result
index 2aad1e02d02..b11ea8476bd 100644
--- a/mysql-test/main/type_temporal_innodb.result
+++ b/mysql-test/main/type_temporal_innodb.result
@@ -173,6 +173,9 @@ ERROR 22007: Truncated incorrect datetime value: '0000-00-00 00:00:00'
DROP TABLE t1,t2;
SET sql_mode=DEFAULT;
#
+# End of 10.3 tests
+#
+#
# MDEV-19166 Assertion `!is_zero_datetime()' failed in Timestamp_or_zero_datetime::tv
#
CREATE TABLE t1 (f TIMESTAMP DEFAULT 0) ENGINE=InnoDB;
diff --git a/mysql-test/main/type_temporal_innodb.test b/mysql-test/main/type_temporal_innodb.test
index b8c7720f8b6..4adaa483ca2 100644
--- a/mysql-test/main/type_temporal_innodb.test
+++ b/mysql-test/main/type_temporal_innodb.test
@@ -82,6 +82,9 @@ CREATE TABLE tbl SELECT * FROM t1 WHERE t1.c1 = (SELECT c2 FROM t2 WHERE pk = 6)
DROP TABLE t1,t2;
SET sql_mode=DEFAULT;
+--echo #
+--echo # End of 10.3 tests
+--echo #
--echo #
--echo # MDEV-19166 Assertion `!is_zero_datetime()' failed in Timestamp_or_zero_datetime::tv
@@ -92,7 +95,6 @@ INSERT INTO t1 VALUES ('2024-02-29');
SELECT * FROM t1 WHERE SUBSTR(1 FROM BIT_LENGTH(f) FOR DEFAULT(f));
DROP TABLE t1;
-
--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/upgrade_MDEV-19650.test b/mysql-test/main/upgrade_MDEV-19650.test
index 89cbfc8c7aa..a2f9fee705f 100644
--- a/mysql-test/main/upgrade_MDEV-19650.test
+++ b/mysql-test/main/upgrade_MDEV-19650.test
@@ -70,11 +70,11 @@ CREATE DEFINER='root'@'localhost' SQL SECURITY DEFINER VIEW IF NOT EXISTS user A
SET sql_mode='';
-delimiter |;
-
DROP PROCEDURE IF EXISTS mysql.AddGeometryColumn;
DROP PROCEDURE IF EXISTS mysql.DropGeometryColumn;
+delimiter |;
+
CREATE DEFINER=`root`@`localhost` PROCEDURE AddGeometryColumn(catalog varchar(64), t_schema varchar(64),
t_name varchar(64), geometry_column varchar(64), t_srid int) SQL SECURITY INVOKER
begin
diff --git a/mysql-test/main/upgrade_MDEV-23102-1.result b/mysql-test/main/upgrade_MDEV-23102-1.result
new file mode 100644
index 00000000000..8caa49180ee
--- /dev/null
+++ b/mysql-test/main/upgrade_MDEV-23102-1.result
@@ -0,0 +1,286 @@
+#
+# MDEV-23102: 10.4 create mariadb.sys user on each update even
+# is the user is not needed
+#
+# part 1: reassigning mysql.user and gis procedures to other user
+call mtr.add_suppression("Cannot load from mysql.proc. The table is probably corrupted");
+create database mysqltest1;
+use mysqltest1;
+create table save_global_priv as select * from mysql.global_priv;
+create table save_tables_priv as select * from mysql.tables_priv;
+create table save_proxies_priv as select * from mysql.proxies_priv;
+create table mysql.save_proc like mysql.proc;
+insert into mysql.save_proc select * from mysql.proc;
+set @save_sql_mode= @@sql_mode;
+use mysql;
+# make changed definition of gis procedures and user view
+create user superuser@localhost;
+grant all privileges on mysql.* to superuser@localhost;
+drop view user;
+CREATE DEFINER='superuser'@'localhost' SQL SECURITY DEFINER VIEW IF NOT EXISTS user AS SELECT
+Host,
+User,
+IF(JSON_VALUE(Priv, '$.plugin') IN ('mysql_native_password', 'mysql_old_password'), IFNULL(JSON_VALUE(Priv, '$.authentication_string'), ''), '') AS Password,
+IF(JSON_VALUE(Priv, '$.access') & 1, 'Y', 'N') AS Select_priv,
+IF(JSON_VALUE(Priv, '$.access') & 2, 'Y', 'N') AS Insert_priv,
+IF(JSON_VALUE(Priv, '$.access') & 4, 'Y', 'N') AS Update_priv,
+IF(JSON_VALUE(Priv, '$.access') & 8, 'Y', 'N') AS Delete_priv,
+IF(JSON_VALUE(Priv, '$.access') & 16, 'Y', 'N') AS Create_priv,
+IF(JSON_VALUE(Priv, '$.access') & 32, 'Y', 'N') AS Drop_priv,
+IF(JSON_VALUE(Priv, '$.access') & 64, 'Y', 'N') AS Reload_priv,
+IF(JSON_VALUE(Priv, '$.access') & 128, 'Y', 'N') AS Shutdown_priv,
+IF(JSON_VALUE(Priv, '$.access') & 256, 'Y', 'N') AS Process_priv,
+IF(JSON_VALUE(Priv, '$.access') & 512, 'Y', 'N') AS File_priv,
+IF(JSON_VALUE(Priv, '$.access') & 1024, 'Y', 'N') AS Grant_priv,
+IF(JSON_VALUE(Priv, '$.access') & 2048, 'Y', 'N') AS References_priv,
+IF(JSON_VALUE(Priv, '$.access') & 4096, 'Y', 'N') AS Index_priv,
+IF(JSON_VALUE(Priv, '$.access') & 8192, 'Y', 'N') AS Alter_priv,
+IF(JSON_VALUE(Priv, '$.access') & 16384, 'Y', 'N') AS Show_db_priv,
+IF(JSON_VALUE(Priv, '$.access') & 32768, 'Y', 'N') AS Super_priv,
+IF(JSON_VALUE(Priv, '$.access') & 65536, 'Y', 'N') AS Create_tmp_table_priv,
+IF(JSON_VALUE(Priv, '$.access') & 131072, 'Y', 'N') AS Lock_tables_priv,
+IF(JSON_VALUE(Priv, '$.access') & 262144, 'Y', 'N') AS Execute_priv,
+IF(JSON_VALUE(Priv, '$.access') & 524288, 'Y', 'N') AS Repl_slave_priv,
+IF(JSON_VALUE(Priv, '$.access') & 1048576, 'Y', 'N') AS Repl_client_priv,
+IF(JSON_VALUE(Priv, '$.access') & 2097152, 'Y', 'N') AS Create_view_priv,
+IF(JSON_VALUE(Priv, '$.access') & 4194304, 'Y', 'N') AS Show_view_priv,
+IF(JSON_VALUE(Priv, '$.access') & 8388608, 'Y', 'N') AS Create_routine_priv,
+IF(JSON_VALUE(Priv, '$.access') & 16777216, 'Y', 'N') AS Alter_routine_priv,
+IF(JSON_VALUE(Priv, '$.access') & 33554432, 'Y', 'N') AS Create_user_priv,
+IF(JSON_VALUE(Priv, '$.access') & 67108864, 'Y', 'N') AS Event_priv,
+IF(JSON_VALUE(Priv, '$.access') & 134217728, 'Y', 'N') AS Trigger_priv,
+IF(JSON_VALUE(Priv, '$.access') & 268435456, 'Y', 'N') AS Create_tablespace_priv,
+IF(JSON_VALUE(Priv, '$.access') & 536870912, 'Y', 'N') AS Delete_history_priv,
+ELT(IFNULL(JSON_VALUE(Priv, '$.ssl_type'), 0) + 1, '', 'ANY','X509', 'SPECIFIED') AS ssl_type,
+IFNULL(JSON_VALUE(Priv, '$.ssl_cipher'), '') AS ssl_cipher,
+IFNULL(JSON_VALUE(Priv, '$.x509_issuer'), '') AS x509_issuer,
+IFNULL(JSON_VALUE(Priv, '$.x509_subject'), '') AS x509_subject,
+CAST(IFNULL(JSON_VALUE(Priv, '$.max_questions'), 0) AS UNSIGNED) AS max_questions,
+CAST(IFNULL(JSON_VALUE(Priv, '$.max_updates'), 0) AS UNSIGNED) AS max_updates,
+CAST(IFNULL(JSON_VALUE(Priv, '$.max_connections'), 0) AS UNSIGNED) AS max_connections,
+CAST(IFNULL(JSON_VALUE(Priv, '$.max_user_connections'), 0) AS SIGNED) AS max_user_connections,
+IFNULL(JSON_VALUE(Priv, '$.plugin'), '') AS plugin,
+IFNULL(JSON_VALUE(Priv, '$.authentication_string'), '') AS authentication_string,
+'N' AS password_expired,
+ELT(IFNULL(JSON_VALUE(Priv, '$.is_role'), 0) + 1, 'N', 'Y') AS is_role,
+IFNULL(JSON_VALUE(Priv, '$.default_role'), '') AS default_role,
+CAST(IFNULL(JSON_VALUE(Priv, '$.max_statement_time'), 0.0) AS DECIMAL(12,6)) AS max_statement_time
+FROM global_priv;
+SET sql_mode='';
+DROP PROCEDURE IF EXISTS mysql.AddGeometryColumn;
+DROP PROCEDURE IF EXISTS mysql.DropGeometryColumn;
+CREATE DEFINER=`superuser`@`localhost` PROCEDURE AddGeometryColumn(catalog varchar(64), t_schema varchar(64),
+t_name varchar(64), geometry_column varchar(64), t_srid int) SQL SECURITY INVOKER
+begin
+set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end |
+CREATE DEFINER=`superuser`@`localhost` PROCEDURE DropGeometryColumn(catalog varchar(64), t_schema varchar(64),
+t_name varchar(64), geometry_column varchar(64)) SQL SECURITY INVOKER
+begin
+set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end |
+set @@sql_mode= @save_sql_mode;
+drop user 'mariadb.sys'@'localhost';
+# check changed definitions mysql_upgrade
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def'
+and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'superuser@localhost';
+count(*)
+1
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'mariadb.sys@localhost';
+count(*)
+0
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='AddGeometryColumn' and DEFINER = 'superuser@localhost';
+count(*)
+1
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='AddGeometryColumn' and DEFINER = 'mariadb.sys@localhost';
+count(*)
+0
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='DropGeometryColumn' and DEFINER = 'superuser@localhost';
+count(*)
+1
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='DropGeometryColumn' and DEFINER = 'mariadb.sys@localhost';
+count(*)
+0
+SELECT * FROM information_schema.USER_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'";
+GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
+SELECT * FROM information_schema.TABLE_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'";
+GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
+# Run mysql_upgrade
+Phase 1/7: Checking and upgrading mysql database
+Processing databases
+mysql
+mysql.column_stats OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.global_priv OK
+mysql.gtid_slave_pos OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.index_stats OK
+mysql.innodb_index_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.innodb_table_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.roles_mapping OK
+mysql.save_proc OK
+mysql.servers OK
+mysql.table_stats OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.transaction_registry
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+
+Repairing tables
+mysql.innodb_index_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.innodb_table_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.transaction_registry
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+mysql.user OK
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+mysqltest1
+mysqltest1.save_global_priv OK
+mysqltest1.save_proxies_priv OK
+mysqltest1.save_tables_priv OK
+performance_schema
+test
+Phase 7/7: Running 'FLUSH PRIVILEGES'
+OK
+# check new definitions mysql_upgrade
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def'
+and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'superuser@localhost';
+count(*)
+1
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'mariadb.sys@localhost';
+count(*)
+0
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='AddGeometryColumn' and DEFINER = 'superuser@localhost';
+count(*)
+1
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='AddGeometryColumn' and DEFINER = 'mariadb.sys@localhost';
+count(*)
+0
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='DropGeometryColumn' and DEFINER = 'superuser@localhost';
+count(*)
+1
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='DropGeometryColumn' and DEFINER = 'mariadb.sys@localhost';
+count(*)
+0
+select count(*) from global_priv where user='mariadb.sys' and host='localhost';
+count(*)
+0
+# above should be 0 (no mariadb.sys@localhost user)
+# restore environment
+DROP USER 'superuser'@'localhost';
+DROP VIEW mysql.user;
+DROP PROCEDURE AddGeometryColumn;
+DROP PROCEDURE DropGeometryColumn;
+Phase 1/7: Checking and upgrading mysql database
+Processing databases
+mysql
+mysql.column_stats OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.global_priv OK
+mysql.gtid_slave_pos OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.index_stats OK
+mysql.innodb_index_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.innodb_table_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.roles_mapping OK
+mysql.save_proc OK
+mysql.servers OK
+mysql.table_stats OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.transaction_registry
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+
+Repairing tables
+mysql.innodb_index_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.innodb_table_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.transaction_registry
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+mysqltest1
+mysqltest1.save_global_priv OK
+mysqltest1.save_proxies_priv OK
+mysqltest1.save_tables_priv OK
+performance_schema
+test
+Phase 7/7: Running 'FLUSH PRIVILEGES'
+OK
+delete from global_priv;
+delete from tables_priv;
+delete from proxies_priv;
+delete from proc;
+insert into mysql.global_priv select * from mysqltest1.save_global_priv;
+insert into mysql.tables_priv select * from mysqltest1.save_tables_priv;
+insert into mysql.proxies_priv select * from mysqltest1.save_proxies_priv;
+rename table proc to bad_proc;
+rename table save_proc to proc;
+drop table bad_proc;
+flush privileges;
+disconnect default;
+connect default,localhost,root,,;
+connection default;
+drop database mysqltest1;
+# End of 10.4 tests (but better do not add other tests here)
diff --git a/mysql-test/main/upgrade_MDEV-23102-1.test b/mysql-test/main/upgrade_MDEV-23102-1.test
new file mode 100644
index 00000000000..8491ddfffe4
--- /dev/null
+++ b/mysql-test/main/upgrade_MDEV-23102-1.test
@@ -0,0 +1,163 @@
+--echo #
+--echo # MDEV-23102: 10.4 create mariadb.sys user on each update even
+--echo # is the user is not needed
+--echo #
+--echo # part 1: reassigning mysql.user and gis procedures to other user
+
+--source include/mysql_upgrade_preparation.inc
+
+call mtr.add_suppression("Cannot load from mysql.proc. The table is probably corrupted");
+create database mysqltest1;
+use mysqltest1;
+create table save_global_priv as select * from mysql.global_priv;
+create table save_tables_priv as select * from mysql.tables_priv;
+create table save_proxies_priv as select * from mysql.proxies_priv;
+create table mysql.save_proc like mysql.proc;
+insert into mysql.save_proc select * from mysql.proc;
+set @save_sql_mode= @@sql_mode;
+
+use mysql;
+
+--echo # make changed definition of gis procedures and user view
+
+create user superuser@localhost;
+grant all privileges on mysql.* to superuser@localhost;
+
+drop view user;
+
+CREATE DEFINER='superuser'@'localhost' SQL SECURITY DEFINER VIEW IF NOT EXISTS user AS SELECT
+ Host,
+ User,
+ IF(JSON_VALUE(Priv, '$.plugin') IN ('mysql_native_password', 'mysql_old_password'), IFNULL(JSON_VALUE(Priv, '$.authentication_string'), ''), '') AS Password,
+ IF(JSON_VALUE(Priv, '$.access') & 1, 'Y', 'N') AS Select_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 2, 'Y', 'N') AS Insert_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 4, 'Y', 'N') AS Update_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 8, 'Y', 'N') AS Delete_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 16, 'Y', 'N') AS Create_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 32, 'Y', 'N') AS Drop_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 64, 'Y', 'N') AS Reload_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 128, 'Y', 'N') AS Shutdown_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 256, 'Y', 'N') AS Process_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 512, 'Y', 'N') AS File_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 1024, 'Y', 'N') AS Grant_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 2048, 'Y', 'N') AS References_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 4096, 'Y', 'N') AS Index_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 8192, 'Y', 'N') AS Alter_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 16384, 'Y', 'N') AS Show_db_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 32768, 'Y', 'N') AS Super_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 65536, 'Y', 'N') AS Create_tmp_table_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 131072, 'Y', 'N') AS Lock_tables_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 262144, 'Y', 'N') AS Execute_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 524288, 'Y', 'N') AS Repl_slave_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 1048576, 'Y', 'N') AS Repl_client_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 2097152, 'Y', 'N') AS Create_view_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 4194304, 'Y', 'N') AS Show_view_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 8388608, 'Y', 'N') AS Create_routine_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 16777216, 'Y', 'N') AS Alter_routine_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 33554432, 'Y', 'N') AS Create_user_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 67108864, 'Y', 'N') AS Event_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 134217728, 'Y', 'N') AS Trigger_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 268435456, 'Y', 'N') AS Create_tablespace_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 536870912, 'Y', 'N') AS Delete_history_priv,
+ ELT(IFNULL(JSON_VALUE(Priv, '$.ssl_type'), 0) + 1, '', 'ANY','X509', 'SPECIFIED') AS ssl_type,
+ IFNULL(JSON_VALUE(Priv, '$.ssl_cipher'), '') AS ssl_cipher,
+ IFNULL(JSON_VALUE(Priv, '$.x509_issuer'), '') AS x509_issuer,
+ IFNULL(JSON_VALUE(Priv, '$.x509_subject'), '') AS x509_subject,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_questions'), 0) AS UNSIGNED) AS max_questions,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_updates'), 0) AS UNSIGNED) AS max_updates,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_connections'), 0) AS UNSIGNED) AS max_connections,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_user_connections'), 0) AS SIGNED) AS max_user_connections,
+ IFNULL(JSON_VALUE(Priv, '$.plugin'), '') AS plugin,
+ IFNULL(JSON_VALUE(Priv, '$.authentication_string'), '') AS authentication_string,
+ 'N' AS password_expired,
+ ELT(IFNULL(JSON_VALUE(Priv, '$.is_role'), 0) + 1, 'N', 'Y') AS is_role,
+ IFNULL(JSON_VALUE(Priv, '$.default_role'), '') AS default_role,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_statement_time'), 0.0) AS DECIMAL(12,6)) AS max_statement_time
+ FROM global_priv;
+
+
+SET sql_mode='';
+
+DROP PROCEDURE IF EXISTS mysql.AddGeometryColumn;
+DROP PROCEDURE IF EXISTS mysql.DropGeometryColumn;
+
+delimiter |;
+
+CREATE DEFINER=`superuser`@`localhost` PROCEDURE AddGeometryColumn(catalog varchar(64), t_schema varchar(64),
+ t_name varchar(64), geometry_column varchar(64), t_srid int) SQL SECURITY INVOKER
+begin
+ set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end |
+
+CREATE DEFINER=`superuser`@`localhost` PROCEDURE DropGeometryColumn(catalog varchar(64), t_schema varchar(64),
+ t_name varchar(64), geometry_column varchar(64)) SQL SECURITY INVOKER
+begin
+ set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end |
+
+delimiter ;|
+
+set @@sql_mode= @save_sql_mode;
+
+drop user 'mariadb.sys'@'localhost';
+
+--echo # check changed definitions mysql_upgrade
+
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def'
+and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'superuser@localhost';
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'mariadb.sys@localhost';
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='AddGeometryColumn' and DEFINER = 'superuser@localhost';
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='AddGeometryColumn' and DEFINER = 'mariadb.sys@localhost';
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='DropGeometryColumn' and DEFINER = 'superuser@localhost';
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='DropGeometryColumn' and DEFINER = 'mariadb.sys@localhost';
+
+SELECT * FROM information_schema.USER_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'";
+SELECT * FROM information_schema.TABLE_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'";
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--echo # Run mysql_upgrade
+--exec $MYSQL_UPGRADE 2>&1
+--file_exists $MYSQLD_DATADIR/mysql_upgrade_info
+--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
+
+--echo # check new definitions mysql_upgrade
+
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def'
+and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'superuser@localhost';
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'mariadb.sys@localhost';
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='AddGeometryColumn' and DEFINER = 'superuser@localhost';
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='AddGeometryColumn' and DEFINER = 'mariadb.sys@localhost';
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='DropGeometryColumn' and DEFINER = 'superuser@localhost';
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='DropGeometryColumn' and DEFINER = 'mariadb.sys@localhost';
+
+select count(*) from global_priv where user='mariadb.sys' and host='localhost';
+--echo # above should be 0 (no mariadb.sys@localhost user)
+
+--echo # restore environment
+
+DROP USER 'superuser'@'localhost';
+DROP VIEW mysql.user;
+DROP PROCEDURE AddGeometryColumn;
+DROP PROCEDURE DropGeometryColumn;
+--exec $MYSQL_UPGRADE 2>&1
+--file_exists $MYSQLD_DATADIR/mysql_upgrade_info
+--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
+
+delete from global_priv;
+delete from tables_priv;
+delete from proxies_priv;
+delete from proc;
+insert into mysql.global_priv select * from mysqltest1.save_global_priv;
+insert into mysql.tables_priv select * from mysqltest1.save_tables_priv;
+insert into mysql.proxies_priv select * from mysqltest1.save_proxies_priv;
+rename table proc to bad_proc;
+rename table save_proc to proc;
+drop table bad_proc;
+flush privileges;
+
+disconnect default;
+connect default,localhost,root,,;
+connection default;
+
+drop database mysqltest1;
+
+--echo # End of 10.4 tests (but better do not add other tests here)
diff --git a/mysql-test/main/upgrade_MDEV-23102-2.result b/mysql-test/main/upgrade_MDEV-23102-2.result
new file mode 100644
index 00000000000..4702fae812f
--- /dev/null
+++ b/mysql-test/main/upgrade_MDEV-23102-2.result
@@ -0,0 +1,262 @@
+#
+# MDEV-23102: 10.4 create mariadb.sys user on each update even
+# is the user is not needed
+#
+# part 2: reassigning mysql.user and deleting gis procedures
+call mtr.add_suppression("Cannot load from mysql.proc. The table is probably corrupted");
+create database mysqltest1;
+use mysqltest1;
+create table save_global_priv as select * from mysql.global_priv;
+create table save_tables_priv as select * from mysql.tables_priv;
+create table save_proxies_priv as select * from mysql.proxies_priv;
+create table mysql.save_proc like mysql.proc;
+insert into mysql.save_proc select * from mysql.proc;
+set @save_sql_mode= @@sql_mode;
+use mysql;
+# make changed definition of gis procedures and user view
+create user superuser@localhost;
+grant all privileges on mysql.* to superuser@localhost;
+drop view user;
+CREATE DEFINER='superuser'@'localhost' SQL SECURITY DEFINER VIEW IF NOT EXISTS user AS SELECT
+Host,
+User,
+IF(JSON_VALUE(Priv, '$.plugin') IN ('mysql_native_password', 'mysql_old_password'), IFNULL(JSON_VALUE(Priv, '$.authentication_string'), ''), '') AS Password,
+IF(JSON_VALUE(Priv, '$.access') & 1, 'Y', 'N') AS Select_priv,
+IF(JSON_VALUE(Priv, '$.access') & 2, 'Y', 'N') AS Insert_priv,
+IF(JSON_VALUE(Priv, '$.access') & 4, 'Y', 'N') AS Update_priv,
+IF(JSON_VALUE(Priv, '$.access') & 8, 'Y', 'N') AS Delete_priv,
+IF(JSON_VALUE(Priv, '$.access') & 16, 'Y', 'N') AS Create_priv,
+IF(JSON_VALUE(Priv, '$.access') & 32, 'Y', 'N') AS Drop_priv,
+IF(JSON_VALUE(Priv, '$.access') & 64, 'Y', 'N') AS Reload_priv,
+IF(JSON_VALUE(Priv, '$.access') & 128, 'Y', 'N') AS Shutdown_priv,
+IF(JSON_VALUE(Priv, '$.access') & 256, 'Y', 'N') AS Process_priv,
+IF(JSON_VALUE(Priv, '$.access') & 512, 'Y', 'N') AS File_priv,
+IF(JSON_VALUE(Priv, '$.access') & 1024, 'Y', 'N') AS Grant_priv,
+IF(JSON_VALUE(Priv, '$.access') & 2048, 'Y', 'N') AS References_priv,
+IF(JSON_VALUE(Priv, '$.access') & 4096, 'Y', 'N') AS Index_priv,
+IF(JSON_VALUE(Priv, '$.access') & 8192, 'Y', 'N') AS Alter_priv,
+IF(JSON_VALUE(Priv, '$.access') & 16384, 'Y', 'N') AS Show_db_priv,
+IF(JSON_VALUE(Priv, '$.access') & 32768, 'Y', 'N') AS Super_priv,
+IF(JSON_VALUE(Priv, '$.access') & 65536, 'Y', 'N') AS Create_tmp_table_priv,
+IF(JSON_VALUE(Priv, '$.access') & 131072, 'Y', 'N') AS Lock_tables_priv,
+IF(JSON_VALUE(Priv, '$.access') & 262144, 'Y', 'N') AS Execute_priv,
+IF(JSON_VALUE(Priv, '$.access') & 524288, 'Y', 'N') AS Repl_slave_priv,
+IF(JSON_VALUE(Priv, '$.access') & 1048576, 'Y', 'N') AS Repl_client_priv,
+IF(JSON_VALUE(Priv, '$.access') & 2097152, 'Y', 'N') AS Create_view_priv,
+IF(JSON_VALUE(Priv, '$.access') & 4194304, 'Y', 'N') AS Show_view_priv,
+IF(JSON_VALUE(Priv, '$.access') & 8388608, 'Y', 'N') AS Create_routine_priv,
+IF(JSON_VALUE(Priv, '$.access') & 16777216, 'Y', 'N') AS Alter_routine_priv,
+IF(JSON_VALUE(Priv, '$.access') & 33554432, 'Y', 'N') AS Create_user_priv,
+IF(JSON_VALUE(Priv, '$.access') & 67108864, 'Y', 'N') AS Event_priv,
+IF(JSON_VALUE(Priv, '$.access') & 134217728, 'Y', 'N') AS Trigger_priv,
+IF(JSON_VALUE(Priv, '$.access') & 268435456, 'Y', 'N') AS Create_tablespace_priv,
+IF(JSON_VALUE(Priv, '$.access') & 536870912, 'Y', 'N') AS Delete_history_priv,
+ELT(IFNULL(JSON_VALUE(Priv, '$.ssl_type'), 0) + 1, '', 'ANY','X509', 'SPECIFIED') AS ssl_type,
+IFNULL(JSON_VALUE(Priv, '$.ssl_cipher'), '') AS ssl_cipher,
+IFNULL(JSON_VALUE(Priv, '$.x509_issuer'), '') AS x509_issuer,
+IFNULL(JSON_VALUE(Priv, '$.x509_subject'), '') AS x509_subject,
+CAST(IFNULL(JSON_VALUE(Priv, '$.max_questions'), 0) AS UNSIGNED) AS max_questions,
+CAST(IFNULL(JSON_VALUE(Priv, '$.max_updates'), 0) AS UNSIGNED) AS max_updates,
+CAST(IFNULL(JSON_VALUE(Priv, '$.max_connections'), 0) AS UNSIGNED) AS max_connections,
+CAST(IFNULL(JSON_VALUE(Priv, '$.max_user_connections'), 0) AS SIGNED) AS max_user_connections,
+IFNULL(JSON_VALUE(Priv, '$.plugin'), '') AS plugin,
+IFNULL(JSON_VALUE(Priv, '$.authentication_string'), '') AS authentication_string,
+'N' AS password_expired,
+ELT(IFNULL(JSON_VALUE(Priv, '$.is_role'), 0) + 1, 'N', 'Y') AS is_role,
+IFNULL(JSON_VALUE(Priv, '$.default_role'), '') AS default_role,
+CAST(IFNULL(JSON_VALUE(Priv, '$.max_statement_time'), 0.0) AS DECIMAL(12,6)) AS max_statement_time
+FROM global_priv;
+DROP PROCEDURE IF EXISTS mysql.AddGeometryColumn;
+DROP PROCEDURE IF EXISTS mysql.DropGeometryColumn;
+drop user 'mariadb.sys'@'localhost';
+# check changed definitions mysql_upgrade
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def'
+and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'superuser@localhost';
+count(*)
+1
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'mariadb.sys@localhost';
+count(*)
+0
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='AddGeometryColumn';
+count(*)
+0
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='DropGeometryColumn';
+count(*)
+0
+SELECT * FROM information_schema.USER_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'";
+GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
+SELECT * FROM information_schema.TABLE_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'";
+GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
+# Run mysql_upgrade
+Phase 1/7: Checking and upgrading mysql database
+Processing databases
+mysql
+mysql.column_stats OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.global_priv OK
+mysql.gtid_slave_pos OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.index_stats OK
+mysql.innodb_index_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.innodb_table_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.roles_mapping OK
+mysql.save_proc OK
+mysql.servers OK
+mysql.table_stats OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.transaction_registry
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+
+Repairing tables
+mysql.innodb_index_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.innodb_table_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.transaction_registry
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+mysql.user OK
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+mysqltest1
+mysqltest1.save_global_priv OK
+mysqltest1.save_proxies_priv OK
+mysqltest1.save_tables_priv OK
+performance_schema
+test
+Phase 7/7: Running 'FLUSH PRIVILEGES'
+OK
+# check new definitions mysql_upgrade
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def'
+and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'superuser@localhost';
+count(*)
+1
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'mariadb.sys@localhost';
+count(*)
+0
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='AddGeometryColumn';
+count(*)
+0
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='DropGeometryColumn';
+count(*)
+0
+select count(*) from global_priv where user='mariadb.sys' and host='localhost';
+count(*)
+0
+# above should be 0 (no mariadb.sys@localhost user)
+# restore environment
+DROP USER 'superuser'@'localhost';
+DROP VIEW mysql.user;
+Phase 1/7: Checking and upgrading mysql database
+Processing databases
+mysql
+mysql.column_stats OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.global_priv OK
+mysql.gtid_slave_pos OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.index_stats OK
+mysql.innodb_index_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.innodb_table_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.proxies_priv OK
+mysql.roles_mapping OK
+mysql.save_proc OK
+mysql.servers OK
+mysql.table_stats OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.transaction_registry
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+
+Repairing tables
+mysql.innodb_index_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.innodb_table_stats
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+mysql.transaction_registry
+Error : Unknown storage engine 'InnoDB'
+error : Corrupt
+Phase 2/7: Installing used storage engines... Skipped
+Phase 3/7: Fixing views
+Phase 4/7: Running 'mysql_fix_privilege_tables'
+Phase 5/7: Fixing table and database names
+Phase 6/7: Checking and upgrading tables
+Processing databases
+information_schema
+mtr
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+mysqltest1
+mysqltest1.save_global_priv OK
+mysqltest1.save_proxies_priv OK
+mysqltest1.save_tables_priv OK
+performance_schema
+test
+Phase 7/7: Running 'FLUSH PRIVILEGES'
+OK
+delete from global_priv;
+delete from tables_priv;
+delete from proxies_priv;
+delete from proc;
+insert into mysql.global_priv select * from mysqltest1.save_global_priv;
+insert into mysql.tables_priv select * from mysqltest1.save_tables_priv;
+insert into mysql.proxies_priv select * from mysqltest1.save_proxies_priv;
+rename table proc to bad_proc;
+rename table save_proc to proc;
+drop table bad_proc;
+flush privileges;
+disconnect default;
+connect default,localhost,root,,;
+connection default;
+drop database mysqltest1;
+# End of 10.4 tests (but better do not add other tests here)
diff --git a/mysql-test/main/upgrade_MDEV-23102-2.test b/mysql-test/main/upgrade_MDEV-23102-2.test
new file mode 100644
index 00000000000..5ce7682fea6
--- /dev/null
+++ b/mysql-test/main/upgrade_MDEV-23102-2.test
@@ -0,0 +1,141 @@
+--echo #
+--echo # MDEV-23102: 10.4 create mariadb.sys user on each update even
+--echo # is the user is not needed
+--echo #
+--echo # part 2: reassigning mysql.user and deleting gis procedures
+
+--source include/mysql_upgrade_preparation.inc
+
+call mtr.add_suppression("Cannot load from mysql.proc. The table is probably corrupted");
+create database mysqltest1;
+use mysqltest1;
+create table save_global_priv as select * from mysql.global_priv;
+create table save_tables_priv as select * from mysql.tables_priv;
+create table save_proxies_priv as select * from mysql.proxies_priv;
+create table mysql.save_proc like mysql.proc;
+insert into mysql.save_proc select * from mysql.proc;
+set @save_sql_mode= @@sql_mode;
+
+use mysql;
+
+--echo # make changed definition of gis procedures and user view
+
+create user superuser@localhost;
+grant all privileges on mysql.* to superuser@localhost;
+
+drop view user;
+
+CREATE DEFINER='superuser'@'localhost' SQL SECURITY DEFINER VIEW IF NOT EXISTS user AS SELECT
+ Host,
+ User,
+ IF(JSON_VALUE(Priv, '$.plugin') IN ('mysql_native_password', 'mysql_old_password'), IFNULL(JSON_VALUE(Priv, '$.authentication_string'), ''), '') AS Password,
+ IF(JSON_VALUE(Priv, '$.access') & 1, 'Y', 'N') AS Select_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 2, 'Y', 'N') AS Insert_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 4, 'Y', 'N') AS Update_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 8, 'Y', 'N') AS Delete_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 16, 'Y', 'N') AS Create_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 32, 'Y', 'N') AS Drop_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 64, 'Y', 'N') AS Reload_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 128, 'Y', 'N') AS Shutdown_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 256, 'Y', 'N') AS Process_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 512, 'Y', 'N') AS File_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 1024, 'Y', 'N') AS Grant_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 2048, 'Y', 'N') AS References_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 4096, 'Y', 'N') AS Index_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 8192, 'Y', 'N') AS Alter_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 16384, 'Y', 'N') AS Show_db_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 32768, 'Y', 'N') AS Super_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 65536, 'Y', 'N') AS Create_tmp_table_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 131072, 'Y', 'N') AS Lock_tables_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 262144, 'Y', 'N') AS Execute_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 524288, 'Y', 'N') AS Repl_slave_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 1048576, 'Y', 'N') AS Repl_client_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 2097152, 'Y', 'N') AS Create_view_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 4194304, 'Y', 'N') AS Show_view_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 8388608, 'Y', 'N') AS Create_routine_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 16777216, 'Y', 'N') AS Alter_routine_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 33554432, 'Y', 'N') AS Create_user_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 67108864, 'Y', 'N') AS Event_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 134217728, 'Y', 'N') AS Trigger_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 268435456, 'Y', 'N') AS Create_tablespace_priv,
+ IF(JSON_VALUE(Priv, '$.access') & 536870912, 'Y', 'N') AS Delete_history_priv,
+ ELT(IFNULL(JSON_VALUE(Priv, '$.ssl_type'), 0) + 1, '', 'ANY','X509', 'SPECIFIED') AS ssl_type,
+ IFNULL(JSON_VALUE(Priv, '$.ssl_cipher'), '') AS ssl_cipher,
+ IFNULL(JSON_VALUE(Priv, '$.x509_issuer'), '') AS x509_issuer,
+ IFNULL(JSON_VALUE(Priv, '$.x509_subject'), '') AS x509_subject,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_questions'), 0) AS UNSIGNED) AS max_questions,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_updates'), 0) AS UNSIGNED) AS max_updates,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_connections'), 0) AS UNSIGNED) AS max_connections,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_user_connections'), 0) AS SIGNED) AS max_user_connections,
+ IFNULL(JSON_VALUE(Priv, '$.plugin'), '') AS plugin,
+ IFNULL(JSON_VALUE(Priv, '$.authentication_string'), '') AS authentication_string,
+ 'N' AS password_expired,
+ ELT(IFNULL(JSON_VALUE(Priv, '$.is_role'), 0) + 1, 'N', 'Y') AS is_role,
+ IFNULL(JSON_VALUE(Priv, '$.default_role'), '') AS default_role,
+ CAST(IFNULL(JSON_VALUE(Priv, '$.max_statement_time'), 0.0) AS DECIMAL(12,6)) AS max_statement_time
+ FROM global_priv;
+
+
+DROP PROCEDURE IF EXISTS mysql.AddGeometryColumn;
+DROP PROCEDURE IF EXISTS mysql.DropGeometryColumn;
+
+
+drop user 'mariadb.sys'@'localhost';
+
+--echo # check changed definitions mysql_upgrade
+
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def'
+and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'superuser@localhost';
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'mariadb.sys@localhost';
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='AddGeometryColumn';
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='DropGeometryColumn';
+
+SELECT * FROM information_schema.USER_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'";
+SELECT * FROM information_schema.TABLE_PRIVILEGES WHERE GRANTEE="'mariadb.sys'@'localhost'";
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--echo # Run mysql_upgrade
+--exec $MYSQL_UPGRADE 2>&1
+--file_exists $MYSQLD_DATADIR/mysql_upgrade_info
+--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
+
+--echo # check new definitions mysql_upgrade
+
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def'
+and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'superuser@localhost';
+SELECT count(*) FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'mariadb.sys@localhost';
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='AddGeometryColumn';
+SELECT count(*) FROM information_schema.ROUTINES WHERE ROUTINE_CATALOG = 'def' and ROUTINE_SCHEMA = 'mysql' and ROUTINE_NAME='DropGeometryColumn';
+
+
+select count(*) from global_priv where user='mariadb.sys' and host='localhost';
+--echo # above should be 0 (no mariadb.sys@localhost user)
+
+--echo # restore environment
+
+DROP USER 'superuser'@'localhost';
+DROP VIEW mysql.user;
+--exec $MYSQL_UPGRADE 2>&1
+--file_exists $MYSQLD_DATADIR/mysql_upgrade_info
+--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
+
+delete from global_priv;
+delete from tables_priv;
+delete from proxies_priv;
+delete from proc;
+insert into mysql.global_priv select * from mysqltest1.save_global_priv;
+insert into mysql.tables_priv select * from mysqltest1.save_tables_priv;
+insert into mysql.proxies_priv select * from mysqltest1.save_proxies_priv;
+rename table proc to bad_proc;
+rename table save_proc to proc;
+drop table bad_proc;
+flush privileges;
+
+disconnect default;
+connect default,localhost,root,,;
+connection default;
+
+drop database mysqltest1;
+
+--echo # End of 10.4 tests (but better do not add other tests here)
diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result
index 6ef3a10966a..c522c8b9e82 100644
--- a/mysql-test/main/win.result
+++ b/mysql-test/main/win.result
@@ -3788,6 +3788,16 @@ row_number() OVER()
3
DROP TABLE t1;
#
+# MDEV-22984: Throw an error when arguments to window functions are window functions
+#
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+SELECT NTILE(MAX(a) OVER (PARTITION BY a)) OVER (PARTITION BY a ORDER BY b) FROM t1;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+SELECT FIRST_VALUE(MAX(a) OVER (PARTITION BY a)) OVER (ORDER BY a) AS x FROM t1 GROUP BY a;
+ERROR HY000: Window functions can not be used as arguments to group functions.
+DROP TABLE t1;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test
index 824c5f9fa56..a4b816e7136 100644
--- a/mysql-test/main/win.test
+++ b/mysql-test/main/win.test
@@ -2460,6 +2460,19 @@ SELECT row_number() OVER() FROM t1;
DROP TABLE t1;
--echo #
+--echo # MDEV-22984: Throw an error when arguments to window functions are window functions
+--echo #
+
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+
+--error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
+SELECT NTILE(MAX(a) OVER (PARTITION BY a)) OVER (PARTITION BY a ORDER BY b) FROM t1;
+--error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
+SELECT FIRST_VALUE(MAX(a) OVER (PARTITION BY a)) OVER (ORDER BY a) AS x FROM t1 GROUP BY a;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/mtr.out-of-source b/mysql-test/mtr.out-of-source
index 51713517ae1..30e2e65c569 100644
--- a/mysql-test/mtr.out-of-source
+++ b/mysql-test/mtr.out-of-source
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Call mtr in out-of-source build
$ENV{MTR_BINDIR} = '@CMAKE_BINARY_DIR@';
chdir('@CMAKE_SOURCE_DIR@/mysql-test');
diff --git a/mysql-test/mysql-stress-test.pl b/mysql-test/mysql-stress-test.pl
index ef7d97453a3..3ccf965024d 100755
--- a/mysql-test/mysql-stress-test.pl
+++ b/mysql-test/mysql-stress-test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
#
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index afd07ec55ba..4cedfa61cce 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- cperl -*-
# Copyright (c) 2004, 2014, Oracle and/or its affiliates.
@@ -263,8 +263,12 @@ our %gprof_dirs;
our $glob_debugger= 0;
our $opt_gdb;
+my $opt_rr;
+my $opt_rr_dir;
+my @rr_record_args;
our $opt_client_gdb;
my $opt_boot_gdb;
+my $opt_boot_rr;
our $opt_dbx;
our $opt_client_dbx;
my $opt_boot_dbx;
@@ -1155,10 +1159,14 @@ sub command_line_setup {
'debug-common' => \$opt_debug_common,
'debug-server' => \$opt_debug_server,
'gdb=s' => \$opt_gdb,
+ 'rr' => \$opt_rr,
+ 'rr-arg=s' => \@rr_record_args,
+ 'rr-dir=s' => \$opt_rr_dir,
'client-gdb' => \$opt_client_gdb,
'manual-gdb' => \$opt_manual_gdb,
'manual-lldb' => \$opt_manual_lldb,
'boot-gdb' => \$opt_boot_gdb,
+ 'boot-rr' => \$opt_boot_rr,
'manual-debug' => \$opt_manual_debug,
'ddd' => \$opt_ddd,
'client-ddd' => \$opt_client_ddd,
@@ -1622,8 +1630,8 @@ sub command_line_setup {
# --------------------------------------------------------------------------
# Check debug related options
# --------------------------------------------------------------------------
- if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
- $opt_manual_gdb || $opt_manual_lldb || $opt_manual_ddd ||
+ if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd || $opt_rr ||
+ $opt_manual_gdb || $opt_manual_lldb || $opt_manual_ddd ||
$opt_manual_debug || $opt_dbx || $opt_client_dbx || $opt_manual_dbx ||
$opt_debugger || $opt_client_debugger )
{
@@ -3253,6 +3261,13 @@ sub mysql_install_db {
ddd_arguments(\$args, \$exe_mysqld_bootstrap, $mysqld->name(),
$bootstrap_sql_file);
}
+ if ($opt_boot_rr) {
+ $args= ["record", @rr_record_args, $exe_mysqld_bootstrap, @$args];
+ $exe_mysqld_bootstrap= "rr";
+ my $rr_dir= $opt_rr_dir ? $opt_rr_dir : "$opt_vardir/rr.boot";
+ $ENV{'_RR_TRACE_DIR'}= $rr_dir;
+ mkpath($rr_dir);
+ }
my $path_sql= my_find_file($install_basedir,
["mysql", "sql/share", "share/mariadb",
@@ -5249,6 +5264,14 @@ sub mysqld_start ($$) {
# Indicate the exe should not be started
$exe= undef;
}
+ elsif ( $opt_rr )
+ {
+ $args= ["record", @rr_record_args, "$exe", @$args];
+ $exe= "rr";
+ my $rr_dir= $opt_rr_dir ? $opt_rr_dir : "$opt_vardir/rr". $mysqld->after('mysqld');
+ $ENV{'_RR_TRACE_DIR'}= $rr_dir;
+ mkpath($rr_dir);
+ }
else
{
# Default to not wait until pid file has been created
@@ -6433,6 +6456,15 @@ Options for strace
stracer=<EXE> Specify name and path to the trace program to use.
Default is "strace". Example: $0 --stracer=ktrace.
+Options for rr (Record and Replay)
+ rr Run the "mysqld" executables using rr. Default run
+ option is "rr record mysqld mysqld_options"
+ boot-rr Start bootstrap server in rr
+ rr-arg=ARG Option to give rr record, can be specified more then once
+ rr-dir=DIR The directory where rr recordings are stored. Defaults
+ to 'vardir'/rr.0 (rr.boot for bootstrap instance and
+ rr.1, ..., rr.N for slave instances).
+
Misc options
user=USER User for connecting to mysqld(default: $opt_user)
comment=STR Write STR to the output
diff --git a/mysql-test/std_data/checkDBI_DBD-mysql.pl b/mysql-test/std_data/checkDBI_DBD-mysql.pl
index 328a7ad774f..0c26325b715 100755
--- a/mysql-test/std_data/checkDBI_DBD-mysql.pl
+++ b/mysql-test/std_data/checkDBI_DBD-mysql.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2011, Oracle and/or its affiliates
#
diff --git a/mysql-test/suite/csv/read_only.test b/mysql-test/suite/csv/read_only.test
index 2af209182d0..a3c851a6a70 100644
--- a/mysql-test/suite/csv/read_only.test
+++ b/mysql-test/suite/csv/read_only.test
@@ -1,3 +1,4 @@
+--source include/not_as_root.inc
#
# MDEV-11883 MariaDB crashes with out-of-memory when query information_schema
#
diff --git a/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl b/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl
index f277bce018e..e997f479466 100755
--- a/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl
+++ b/mysql-test/suite/engines/rr_trx/run_stress_tx_rr.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
################################################################################
#
# This script runs the transactional stress test "stress_tx_rr" against the
diff --git a/mysql-test/suite/funcs_1/lib/DataGen_local.pl b/mysql-test/suite/funcs_1/lib/DataGen_local.pl
index 738a73e0fd5..8ca74407141 100755
--- a/mysql-test/suite/funcs_1/lib/DataGen_local.pl
+++ b/mysql-test/suite/funcs_1/lib/DataGen_local.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
if ( (scalar(@ARGV) != 1 ) || ($ARGV[0] =~ /[^0-9]/i ) )
diff --git a/mysql-test/suite/funcs_1/lib/DataGen_modify.pl b/mysql-test/suite/funcs_1/lib/DataGen_modify.pl
index 4675049ff0d..8ad8e619a20 100755
--- a/mysql-test/suite/funcs_1/lib/DataGen_modify.pl
+++ b/mysql-test/suite/funcs_1/lib/DataGen_modify.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
if ( (scalar(@ARGV) != 2 ) || ($ARGV[0] =~ /[^0-9]/i ) )
diff --git a/mysql-test/suite/funcs_2/lib/gen_charset_utf8.pl b/mysql-test/suite/funcs_2/lib/gen_charset_utf8.pl
index 3b85ed02f5b..c0973a10950 100755
--- a/mysql-test/suite/funcs_2/lib/gen_charset_utf8.pl
+++ b/mysql-test/suite/funcs_2/lib/gen_charset_utf8.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
#################################################################################
# Author: Serge Kozlov #
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 302180b16bd..e4244c63297 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -38,7 +38,6 @@ galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade
galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key
galera_toi_ddl_nonconflicting : MDEV-21518 galera.galera_toi_ddl_nonconflicting
galera_toi_truncate : MDEV-22996 Hang on galera_toi_truncate test case
-galera_var_innodb_disallow_writes : MDEV-20928 galera.galera_var_innodb_disallow_writes
galera_var_node_address : MDEV-20485 Galera test failure
galera_var_notify_cmd : MDEV-21905 Galera test galera_var_notify_cmd causes hang
galera_var_reject_queries : assertion in inline_mysql_socket_send
diff --git a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf
index c84c4b25d2a..4181ee13ebc 100644
--- a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf
+++ b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf
@@ -19,6 +19,7 @@ innodb_lock_schedule_algorithm=FCFS
wsrep-on=1
log-slave-updates
+wsrep-on=1
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
@@ -44,6 +45,7 @@ innodb_lock_schedule_algorithm=FCFS
wsrep-on=1
log-slave-updates
+wsrep-on=1
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
@@ -69,6 +71,7 @@ innodb_lock_schedule_algorithm=FCFS
wsrep-on=1
log-slave-updates
+wsrep-on=1
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
diff --git a/mysql-test/suite/galera/r/galera_drop_database.result b/mysql-test/suite/galera/r/galera_drop_database.result
index ac76683cb25..6ab4b3d0c7b 100644
--- a/mysql-test/suite/galera/r/galera_drop_database.result
+++ b/mysql-test/suite/galera/r/galera_drop_database.result
@@ -13,9 +13,33 @@ INSERT INTO fts_t2 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
DROP TABLE ten;
UPDATE fts_t1 SET f2 = 'abcd';
UPDATE fts_t2 SET f2 = 'efjh';
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1;
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2;
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1 where f2 = 'abcd';
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2 where f2 = 'efjh';
+EXPECT_1000
+1000
connection node_2;
connection node_1;
connection node_2;
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1;
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2;
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1 where f2 = 'abcd';
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2 where f2 = 'efjh';
+EXPECT_1000
+1000
connection node_1;
USE fts;
DROP TABLE fts_t1;
@@ -23,3 +47,4 @@ DROP TABLE fts_t2;
SHOW TABLES;
Tables_in_fts
DROP DATABASE fts;
+connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_lock_tables_in_transaction.result b/mysql-test/suite/galera/r/galera_lock_tables_in_transaction.result
new file mode 100644
index 00000000000..68691a4efd2
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_lock_tables_in_transaction.result
@@ -0,0 +1,12 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+LOCK TABLES t2 READ;
+ERROR 42S02: Table 'test.t2' doesn't exist
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+LOCK TABLES t1 READ;
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result b/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result
index f5ec473fea4..3eb56d1a48d 100644
--- a/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result
+++ b/mysql-test/suite/galera/r/galera_var_innodb_disallow_writes.result
@@ -1,5 +1,6 @@
connection node_2;
connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
SET SESSION wsrep_sync_wait = 0;
connection node_1;
@@ -7,19 +8,20 @@ CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
SET GLOBAL innodb_disallow_writes=ON;
INSERT INTO t1 VALUES (1);;
connection node_1a;
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
0
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
0
SET GLOBAL innodb_disallow_writes=OFF;
connection node_1;
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
1
connection node_2;
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
1
DROP TABLE t1;
+disconnect node_1a;
diff --git a/mysql-test/suite/galera/t/MW-388.test b/mysql-test/suite/galera/t/MW-388.test
index 09fc8a8bfc9..b88f53ca8d9 100644
--- a/mysql-test/suite/galera/t/MW-388.test
+++ b/mysql-test/suite/galera/t/MW-388.test
@@ -1,5 +1,7 @@
--source include/galera_cluster.inc
+--source include/have_debug.inc
--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
diff --git a/mysql-test/suite/galera/t/MW-86-wait1.test b/mysql-test/suite/galera/t/MW-86-wait1.test
index 4e99872bf4d..7ebd3ba95a0 100644
--- a/mysql-test/suite/galera/t/MW-86-wait1.test
+++ b/mysql-test/suite/galera/t/MW-86-wait1.test
@@ -7,6 +7,8 @@
--source include/have_binlog_format_row.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
+
SET @orig_debug=@@debug_dbug;
--connection node_2
diff --git a/mysql-test/suite/galera/t/MW-86-wait8.test b/mysql-test/suite/galera/t/MW-86-wait8.test
index 7d9e54a16ba..1b3f355eb25 100644
--- a/mysql-test/suite/galera/t/MW-86-wait8.test
+++ b/mysql-test/suite/galera/t/MW-86-wait8.test
@@ -3,7 +3,10 @@
#
--source include/galera_cluster.inc
--source include/have_binlog_format_row.inc
+--source include/have_debug.inc
--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
+
SET @orig_debug=@@debug_dbug;
--connection node_2
diff --git a/mysql-test/suite/galera/t/galera_drop_database.test b/mysql-test/suite/galera/t/galera_drop_database.test
index 12d9efea2f9..8dc73c1ce38 100644
--- a/mysql-test/suite/galera/t/galera_drop_database.test
+++ b/mysql-test/suite/galera/t/galera_drop_database.test
@@ -23,6 +23,10 @@ INSERT INTO fts_t2 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
DROP TABLE ten;
UPDATE fts_t1 SET f2 = 'abcd';
UPDATE fts_t2 SET f2 = 'efjh';
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1;
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2;
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1 where f2 = 'abcd';
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2 where f2 = 'efjh';
# Restart the second node:
--connection node_2
@@ -34,6 +38,14 @@ UPDATE fts_t2 SET f2 = 'efjh';
--connection node_2
--source include/wait_until_ready.inc
+--let $wait_condition = SELECT COUNT(*) = 1000 FROM fts_t1 where f2 = 'abcd';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1000 FROM fts_t2 where f2 = 'efjh';
+--source include/wait_condition.inc
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1;
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2;
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1 where f2 = 'abcd';
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2 where f2 = 'efjh';
# Drop the tables and database after nodes restarted:
--connection node_1
@@ -43,5 +55,13 @@ DROP TABLE fts_t2;
SHOW TABLES;
DROP DATABASE fts;
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'fts_t1';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'fts_t2';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'fts';
+--source include/wait_condition.inc
+
# Restore original auto_increment_offset values.
--source include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/galera/t/galera_lock_tables_in_transaction.test b/mysql-test/suite/galera/t/galera_lock_tables_in_transaction.test
new file mode 100644
index 00000000000..5cb7347639c
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_lock_tables_in_transaction.test
@@ -0,0 +1,21 @@
+#
+# Check `LOCK TABLES` command with or without existing table in database.
+# Test case for MDEV-22222 / MDEV-22223
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+--error ER_NO_SUCH_TABLE
+LOCK TABLES t2 READ;
+
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+LOCK TABLES t1 READ;
+UNLOCK TABLES;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test
index e13e7f1f748..6d1e21fd94d 100644
--- a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test
+++ b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.test
@@ -1,6 +1,8 @@
--source include/galera_cluster.inc
+--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_query_cache.inc
+--source include/galera_have_debug_sync.inc
CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
diff --git a/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test b/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test
index 9ccecc5a61d..37469d8a5fb 100644
--- a/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test
+++ b/mysql-test/suite/galera/t/galera_var_innodb_disallow_writes.test
@@ -11,13 +11,10 @@
#
--source include/galera_cluster.inc
---source include/have_innodb.inc
--source include/have_log_bin.inc
# Open a separate connection to be used to run SHOW PROCESSLIST
---let $galera_connection_name = node_1a
---let $galera_server_number = 1
---source include/galera_connect.inc
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1a
SET SESSION wsrep_sync_wait = 0;
@@ -27,18 +24,27 @@ SET GLOBAL innodb_disallow_writes=ON;
--send INSERT INTO t1 VALUES (1);
--connection node_1a
-SELECT COUNT(*) = 1 FROM t1;
-let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'INSERT INTO t1 VALUES (1)' AND State = 'Commit';
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
-SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'INSERT INTO t1 VALUES (1)';
+--source include/wait_condition.inc
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
SET GLOBAL innodb_disallow_writes=OFF;
--connection node_1
--reap
-SELECT COUNT(*) = 1 FROM t1;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
--connection node_2
-SELECT COUNT(*) = 1 FROM t1;
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
DROP TABLE t1;
+
+--disconnect node_1a
+
diff --git a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
index df541b774a4..6bed1b0120f 100644
--- a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
+++ b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
@@ -4,7 +4,9 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--source include/have_debug.inc
--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result
new file mode 100644
index 00000000000..0461f1f1feb
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result
@@ -0,0 +1,40 @@
+CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 1);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (2, 3);
+SET wsrep_sync_wait = 0;
+SET wsrep_on = OFF;
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining';
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (3, 2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (4, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (5, 2);
+SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request';
+SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (6, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (7, 2);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (8, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration';
+SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+INSERT INTO t1 VALUES (9, 2);
+SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+DROP TABLE t1;
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result
new file mode 100644
index 00000000000..d878f60ca6b
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result
@@ -0,0 +1,50 @@
+CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 1);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (2, 3);
+SET wsrep_sync_wait = 0;
+SET wsrep_on = OFF;
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining';
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (3, 2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (4, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (5, 2);
+SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request';
+SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
+VARIABLE_NAME VARIABLE_VALUE
+WSREP_DEBUG_SYNC_WAITERS after_shift_to_joining
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (6, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (7, 2);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (8, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration';
+SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+INSERT INTO t1 VALUES (9, 2);
+SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
+VARIABLE_NAME VARIABLE_VALUE
+WSREP_DEBUG_SYNC_WAITERS process_primary_configuration
+SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+DROP TABLE t1;
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result
new file mode 100644
index 00000000000..df0a924029c
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result
@@ -0,0 +1,55 @@
+CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 1);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (2, 3);
+SET wsrep_sync_wait = 0;
+SET wsrep_on = OFF;
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining';
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (3, 2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (4, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (5, 2);
+SET GLOBAL wsrep_provider_options = 'dbug=d,before_send_state_request';
+SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_shift_to_joining';
+SET GLOBAL wsrep_provider_options = 'signal=before_send_state_request';
+4
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
+VARIABLE_NAME VARIABLE_VALUE
+WSREP_DEBUG_SYNC_WAITERS
+INSERT INTO t1 VALUES (6, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+INSERT INTO t1 VALUES (7, 2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,process_primary_configuration';
+SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+INSERT INTO t1 VALUES (8, 3);
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+INSERT INTO t1 VALUES (9, 2);
+SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining';
+DROP TABLE t1;
+call mtr.add_suppression("WSREP: Send action {\(.*\), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test
new file mode 100644
index 00000000000..2248ff5014a
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test
@@ -0,0 +1,262 @@
+#
+# Tests handling of several configuration changes while a joiner gets
+# state transfer
+#
+# Variant A: sending of state transfer request delayed until two more
+# primary configuration changes happen
+#
+# Refs codersihp/galera-bugs#454
+#
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+--source include/galera_have_debug_sync.inc
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 1);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Isolate node_1 and update cluster state to force node 1 into joiner mode
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (2, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now reconnect node_1 but first make it block before sending state transfer
+# request
+#
+# THIS IS PC1
+#
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET wsrep_sync_wait = 0;
+SET wsrep_on = OFF;
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (3, 2);
+
+--connection node_1a
+--source include/galera_wait_sync_point.inc
+#
+# At this point every node thinks that node_1 is in a JOINER state
+#
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now that node_1 sent state request and became JOINER isolate node_1 again
+# and commit one more action, so that node_1 loses JOINER state
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (4, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Reconnect node_1 again
+#
+# THIS IS PC2
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+#
+# After this point node_1 is no longer JOINER and is required to start the
+# whole procedure over because it missed some actions (4th insert into t1)
+#
+
+INSERT INTO t1 VALUES (5, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now let node_1 continue with IST and finish processing PC1, but make it
+# block when processing PC2 just before sending state transfer request
+#
+--connection node_1a
+--let $galera_sync_point = before_send_state_request
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = before_send_state_request
+--source include/galera_wait_sync_point.inc
+
+# since PC1 has been processed node_1 must have 3 rows in t1
+# 2 were there before PC1 and one was added while in PC1
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now disconnect and reconnect node_1 again to get PC3
+# It still is blocked before sending state transfer request in PC2.
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (6, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+#
+# This is PC3
+#
+
+INSERT INTO t1 VALUES (7, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now disconnect and reconnect node_1 again to get PC4 and allow node_1
+# to send state transfer request to be delivered in PC4 (and thus get
+# updated to PC4 seqno in state transfer.
+# Note that node_1 still processes PC2.
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (8, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+#
+# This is PC4. node_1 is still processing PC2, waiting to send state trasfer
+# request
+#
+--connection node_1a
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = before_send_state_request
+--source include/galera_signal_sync_point.inc
+# sent STR from PC2 into PC4
+
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_wait_sync_point.inc
+#
+# Now node_1 is processing PC3, but should have completed state transfer from
+# PC4 and thus must have 8 rows in t1
+#
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_2
+INSERT INTO t1 VALUES (9, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1a
+#--let $galera_sync_point = process_primary_configuration
+--source include/galera_signal_sync_point.inc
+--source include/galera_wait_sync_point.inc
+#
+# Now node_1 is processing PC4, still must have 8 rows in t1
+#
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
+--source include/wait_condition.inc
+
+#--let $galera_sync_point = process_primary_configuration
+--source include/galera_signal_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+
+DROP TABLE t1;
+
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+
+--connection node_2
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+
+--connection node_3
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test
new file mode 100644
index 00000000000..2fb0e78c759
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test
@@ -0,0 +1,273 @@
+#
+# Tests handling of several configuration changes while a joiner gets
+# state transfer
+#
+# Variant B: sending of state transfer request is immediate but completion
+# of IST delayed until two more primary configuration changes happen
+#
+# Refs codersihp/galera-bugs#454
+#
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+--source include/galera_have_debug_sync.inc
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 1);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Isolate node_1 and update cluster state to force node 1 into joiner mode
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (2, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now reconnect node_1 but first make it block before sending state transfer
+# request
+#
+# THIS IS PC1
+#
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET wsrep_sync_wait = 0;
+SET wsrep_on = OFF;
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (3, 2);
+
+--connection node_1a
+--source include/galera_wait_sync_point.inc
+#
+# At this point every node thinks that node_1 is in a JOINER state
+#
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now that node_1 sent state request and became JOINER isolate node_1 again
+# and commit one more action, so that node_1 loses JOINER state
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (4, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Reconnect node_1 again
+#
+# THIS IS PC2
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+#
+# After this point node_1 is no longer JOINER and is required to start the
+# whole procedure over because it missed some actions (4th insert into t1)
+#
+
+INSERT INTO t1 VALUES (5, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now let node_1 continue with IST and finish processing PC1, but make it
+# block when processing PC2 right after progressing to JOINER state and
+# before IST happens.
+#
+--connection node_1a
+--let $galera_sync_point = before_send_state_request
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = before_send_state_request
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+# Here node_1 is processing PC2 just before sending state request
+
+# since PC1 has been processed node_1 must have 3 rows in t1
+# 2 were there before PC1 and one was added while in PC1
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+# Proceed to sending state transfer request and block right after
+--source include/galera_signal_sync_point.inc # before_send_state_request
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_wait_sync_point.inc
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
+
+#
+# Now disconnect and reconnect node_1 again to get PC3
+# It is blocked right after shifting to JOINING state.
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (6, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+#
+# This is PC3
+#
+
+INSERT INTO t1 VALUES (7, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now disconnect and reconnect node_1 again to get PC4 and allow node_1
+# to continue with IST.
+# Note that node_1 still processes PC2 and is joining.
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (8, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+#
+# This is PC4. node_1 is still processing PC2, waiting to send state trasfer
+# request
+#
+--connection node_1a
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_signal_sync_point.inc
+# continue with IST prepared for in PC2
+
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_wait_sync_point.inc
+#
+# Now node_1 is processing PC3, and should have finished state transfer
+# State tranfer request was dilivered before PC3, so node_1 should have
+# received IST up to 4 rows in t1 (what was there before PC2) plus one more
+# INSERT while in PC2.
+#
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_2
+INSERT INTO t1 VALUES (9, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1a
+#--let $galera_sync_point = process_primary_configuration
+--source include/galera_signal_sync_point.inc
+--source include/galera_wait_sync_point.inc
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
+#
+# Now node_1 is processing PC4, still must have 8 rows in t1
+#
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
+--source include/wait_condition.inc
+
+#--let $galera_sync_point = process_primary_configuration
+--source include/galera_signal_sync_point.inc
+--source include/galera_clear_sync_point.inc
+
+--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+
+DROP TABLE t1;
+
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+
+--connection node_2
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+
+--connection node_3
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test
new file mode 100644
index 00000000000..133903d7cbf
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test
@@ -0,0 +1,299 @@
+#
+# Tests handling of several configuration changes while a joiner gets
+# state transfer
+#
+# Variant C: sending of state transfer request is scheduled while in non-PRIM
+#
+# Refs codersihp/galera-bugs#454
+#
+--source include/have_innodb.inc
+--source include/galera_cluster.inc
+--source include/galera_have_debug_sync.inc
+
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 1);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Isolate node_1 and update cluster state to force node 1 into joiner mode
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (2, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now reconnect node_1 but first make it block before sending state transfer
+# request
+#
+# THIS IS PC1
+#
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+SET wsrep_sync_wait = 0;
+SET wsrep_on = OFF;
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_set_sync_point.inc
+
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (3, 2);
+
+--connection node_1a
+--source include/galera_wait_sync_point.inc
+#
+# At this point every node thinks that node_1 is in a JOINER state
+#
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now that node_1 sent state request and became JOINER isolate node_1 again
+# and commit one more action, so that node_1 loses JOINER state
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (4, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Reconnect node_1 again
+#
+# THIS IS PC2
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+#
+# After this point node_1 is no longer JOINER and is required to start the
+# whole procedure over because it missed some actions (4th insert into t1)
+#
+
+INSERT INTO t1 VALUES (5, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now let node_1 continue with IST and finish processing PC1, but make it
+# block when processing PC2 right after progressing to JOINER state and
+# before IST happens.
+#
+--connection node_1a
+--let $galera_sync_point = before_send_state_request
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = before_send_state_request
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+# Here we are processing PC2 just before sending state request
+
+# since PC1 has been processed node_1 must have 3 rows in t1
+# 2 were there before PC1 and one was added while in PC1
+--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
+--source include/wait_condition.inc
+
+#
+# Now disconnect and reconnect node_1 again to get PC3
+# It still is blocked before sending state transfer request in PC2.
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+# Proceed to sending state transfer request
+--connection node_1a
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = before_send_state_request
+--source include/galera_signal_sync_point.inc # before_send_state_request
+#
+# node_1 proceeds to sending state transfer request, it will be delivered only
+# in the next PC which is PC3. Only then the node will shift to JOINING
+#
+--echo 4
+SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
+
+--connection node_3
+INSERT INTO t1 VALUES (6, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+#
+# This is PC3
+#
+
+INSERT INTO t1 VALUES (7, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
+--source include/wait_condition.inc
+
+# node_1 is stiil processing PC2, it was let to send state transfer request
+# while in non-PRIM. Now it should be able to complete it and shift to
+# JOINING. Make it block on next PC(3) and continue to receive IST
+--connection node_1a
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc # won't need it any more
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_set_sync_point.inc
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_signal_sync_point.inc
+# continue with IST while still processing PC2
+
+#
+# Now disconnect and reconnect node_1 again to generate PC4.
+#
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (8, 3);
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+#
+# This is PC4. node_1 should complete IST, complete PC2, and continue
+# with the next item in queue
+#
+--connection node_1a
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_wait_sync_point.inc
+
+#
+# Now node_1 is blocked before processing PC3, and should have finished state
+# transfer started while in PC2.
+# State tranfer request was dilivered in PC3 to donor, so node_1 should have
+# received IST up to 6 rows in t1 (what was there before PC3).
+#
+--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_2
+INSERT INTO t1 VALUES (9, 2);
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1a
+# continue with processing PC3
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_signal_sync_point.inc
+
+# wait for row that follows PC3
+--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
+--source include/wait_condition.inc
+
+# wait till PC4
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_wait_sync_point.inc
+#
+# Now node_1 is processing PC4, still must have 7 rows in t1
+#
+--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
+--source include/wait_condition.inc
+
+# Continue with PC4
+--let $galera_sync_point = process_primary_configuration
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+--let $galera_sync_point = after_shift_to_joining
+--source include/galera_wait_sync_point.inc
+--source include/galera_clear_sync_point.inc
+--source include/galera_signal_sync_point.inc
+
+--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
+--source include/wait_condition.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+
+DROP TABLE t1;
+
+call mtr.add_suppression("WSREP: Send action {\(.*\), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)");
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+
+--connection node_2
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
+
+--connection node_3
+call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");
diff --git a/mysql-test/suite/innodb/r/information_schema_grants.result b/mysql-test/suite/innodb/r/information_schema_grants.result
index 6ef1ce170cd..04550bfa114 100644
--- a/mysql-test/suite/innodb/r/information_schema_grants.result
+++ b/mysql-test/suite/innodb/r/information_schema_grants.result
@@ -278,9 +278,9 @@ select count(*) > -1 from d_sys_virtual;
count(*) > -1
1
select count(*) > -1 from information_schema.innodb_tablespaces_encryption;
-ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
select count(*) > -1 from i_tablespaces_encryption;
-ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
select count(*) > -1 from d_tablespaces_encryption;
count(*) > -1
1
diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
index 1382457debf..7d98aba7fc3 100644
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
+++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result
@@ -225,6 +225,13 @@ id title body
1 MySQL Tutorial DBMS stands for DataBase ...
3 Optimizing MySQL In this tutorial we will show ...
DROP TABLE articles;
+#
+# MDEV-22811 DDL fails to drop and re-create FTS index
+#
+CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY,
+f1 VARCHAR(200),FULLTEXT fidx(f1))engine=innodb;
+ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1);
+DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB;
ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b);
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
index c81ec18a4e6..cca110f3550 100644
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
+++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test
@@ -270,6 +270,14 @@ SELECT * FROM articles WHERE MATCH (title, body)
DROP TABLE articles;
+--echo #
+--echo # MDEV-22811 DDL fails to drop and re-create FTS index
+--echo #
+CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY,
+ f1 VARCHAR(200),FULLTEXT fidx(f1))engine=innodb;
+ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1);
+DROP TABLE t1;
+
# Add more than one FTS index
CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB;
ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b);
diff --git a/mysql-test/suite/mariabackup/incremental_backup.test b/mysql-test/suite/mariabackup/incremental_backup.test
index 3e877af1398..88e277fd95a 100644
--- a/mysql-test/suite/mariabackup/incremental_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_backup.test
@@ -1,6 +1,11 @@
--source include/have_aria.inc
--source include/innodb_page_size.inc
+# see suite.pm "check for exact values, in case the default changes to be small everywhere"
+if (`select @@max_binlog_stmt_cache_size = 4294963200 and @@innodb_page_size = 65536`) {
+ skip skipped on 32bit; # tries to allocate 1GB of memory
+ }
+
call mtr.add_suppression("InnoDB: New log files created");
let basedir=$MYSQLTEST_VARDIR/tmp/backup;
diff --git a/mysql-test/suite/mariabackup/options_check.result b/mysql-test/suite/mariabackup/options_check.result
index 6b9925a0a8e..59666754f04 100644
--- a/mysql-test/suite/mariabackup/options_check.result
+++ b/mysql-test/suite/mariabackup/options_check.result
@@ -5,3 +5,4 @@
# Check for options overwriting
# Check if uknown options that follow --mysqld-args are ingored
# Check if [mariadb-client] group is not loaded (MDEV-22894)
+# Check if --help presents
diff --git a/mysql-test/suite/mariabackup/options_check.test b/mysql-test/suite/mariabackup/options_check.test
index 7483453d19b..022bcbd5d10 100644
--- a/mysql-test/suite/mariabackup/options_check.test
+++ b/mysql-test/suite/mariabackup/options_check.test
@@ -7,7 +7,6 @@
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --unknown-option=xxx --target-dir=$targetdir;
--error 2
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --unknown-option --target-dir=$targetdir;
---enable_result_log
--echo # Check for unknown options in "mariabackup" group
--write_file $custom_cnf
@@ -62,3 +61,9 @@ EOF
exec $XTRABACKUP --defaults-file=$custom_cnf --backup --target-dir=$targetdir;
--remove_file $custom_cnf
--rmdir $targetdir
+
+--echo # Check if --help presents
+exec $XTRABACKUP --help;
+exec $XTRABACKUP -?;
+--enable_result_log
+
diff --git a/mysql-test/suite/rpl/disabled.def b/mysql-test/suite/rpl/disabled.def
index 67e710f2637..9e52c277726 100644
--- a/mysql-test/suite/rpl/disabled.def
+++ b/mysql-test/suite/rpl/disabled.def
@@ -15,7 +15,6 @@ rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fa
rpl_partition_archive : MDEV-5077 2013-09-27 svoj Cannot exchange partition with archive table
rpl_row_binlog_max_cache_size : MDEV-11092
rpl_row_index_choice : MDEV-11666
-rpl_parallel2 : fails after MDEV-16172
rpl_semi_sync_after_sync : fails after MDEV-16172
rpl_slave_grp_exec: MDEV-10514
rpl_auto_increment_update_failure : disabled for now
diff --git a/mysql-test/suite/rpl/extension/checksum.pl b/mysql-test/suite/rpl/extension/checksum.pl
index f94341446cd..8369d1bbdce 100755
--- a/mysql-test/suite/rpl/extension/checksum.pl
+++ b/mysql-test/suite/rpl/extension/checksum.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
#
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result b/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
new file mode 100644
index 00000000000..98688df7273
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
@@ -0,0 +1,47 @@
+include/master-slave.inc
+[connection master]
+connection master;
+SET GLOBAL LOG_WARNINGS=2;
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=current_pos;
+include/start_slave.inc
+connection master;
+"Test Case 1: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('')"
+FOUND 1 /using_gtid\(1\), gtid\(\'\'\).*/ in mysqld.1.err
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=no;
+include/start_slave.inc
+connection master;
+"Test Case 2: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(0), gtid('')"
+FOUND 1 /using_gtid\(0\), gtid\(\'\'\).*/ in mysqld.1.err
+CREATE TABLE t (f INT) ENGINE=INNODB;
+INSERT INTO t VALUES(10);
+connection slave;
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+include/start_slave.inc
+connection master;
+"Test Case 3: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2')"
+FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2\'\).*/ in mysqld.1.err
+SET @@SESSION.gtid_domain_id=10;
+INSERT INTO t VALUES(20);
+connection slave;
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+include/start_slave.inc
+connection master;
+"Test Case 4: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2,10-1-1')"
+FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*/ in mysqld.1.err
+"===== Clean up ====="
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=no;
+include/start_slave.inc
+connection master;
+DROP TABLE t;
+SET GLOBAL LOG_WARNINGS=default;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test b/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test
new file mode 100644
index 00000000000..f26e9565671
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_binlog_dump_slave_gtid_state_info.test
@@ -0,0 +1,121 @@
+# ==== Purpose ====
+#
+# Test verifies that Start binlog_dump message will report GTID position
+# requested by slave when log_warnings > 1.
+#
+# ==== Implementation ====
+#
+# Steps:
+# 0 - Have LOG_WARNINGS=2
+# 1 - On a fresh slave server which has not replicated any GTIDs execute
+# "CHANGE MASTER TO MASTER_USE_GTID=current_pos;" command. Start the
+# slave.
+# 2 - In Master error log verify that pattern "using_gtid(1), gtid('')" is
+# present.
+# 3 - On slave server do STOP SLAVE and execute "CHANGE MASTER TO
+# MASTER_USE_GTID=no;" command. Start the slave threads.
+# 4 - In Master error log verify that pattern "using_gtid(0), gtid('')" is
+# present.
+# 5- Execute a DDL and DML on master server. This will generated two GTIDs
+# on the master server ('0-1-2'). Sync the slave server with master.
+# 6 - On slave do STOP SLAVE and execute "CHANGE MASTER TO
+# MASTER_USE_GTID=slave_pos;" command. Start slave threads.
+# 7 - In Master error verify that pattern "using_gtid(1), gtid('0-1-2')" is
+# present.
+# 8 - On Master change domain ID to 10 and execute a DML operation. It will
+# generate a GTID 10-1-1.
+# 9 - On slave do STOP SLAVE and execute "CHANGE MASTER TO
+# MASTER_USE_GTID=slave_pos;" command. Start slave threads.
+# 10 -In Master error verify that pattern "using_gtid(1),
+# gtid('0-1-2,10-1-1')" is present.
+#
+# ==== References ====
+#
+# MDEV-20428: "Start binlog_dump" message doesn't indicate GTID position
+#
+
+--source include/have_binlog_format_mixed.inc
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+--connection master
+SET GLOBAL LOG_WARNINGS=2;
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=current_pos;
+--source include/start_slave.inc
+
+--connection master
+# Check error log for correct messages.
+let $log_error_= `SELECT @@GLOBAL.log_error`;
+if(!$log_error_)
+{
+ # MySQL Server on windows is started with --console and thus
+ # does not know the location of its .err log, use default location
+ let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
+}
+--echo "Test Case 1: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('')"
+--let SEARCH_FILE=$log_error_
+--let SEARCH_RANGE=-50000
+--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'\'\).*
+--source include/search_pattern_in_file.inc
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=no;
+--source include/start_slave.inc
+
+--connection master
+--echo "Test Case 2: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(0), gtid('')"
+--let SEARCH_FILE=$log_error_
+--let SEARCH_RANGE=-50000
+--let SEARCH_PATTERN=using_gtid\(0\), gtid\(\'\'\).*
+--source include/search_pattern_in_file.inc
+CREATE TABLE t (f INT) ENGINE=INNODB;
+INSERT INTO t VALUES(10);
+save_master_pos;
+
+--connection slave
+sync_with_master;
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+--source include/start_slave.inc
+
+--connection master
+--echo "Test Case 3: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2')"
+--let SEARCH_FILE=$log_error_
+--let SEARCH_RANGE=-50000
+--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2\'\).*
+--source include/search_pattern_in_file.inc
+SET @@SESSION.gtid_domain_id=10;
+INSERT INTO t VALUES(20);
+save_master_pos;
+
+--connection slave
+sync_with_master;
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+--source include/start_slave.inc
+
+--connection master
+--echo "Test Case 4: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2,10-1-1')"
+--let SEARCH_FILE=$log_error_
+--let SEARCH_RANGE=-50000
+--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*
+--source include/search_pattern_in_file.inc
+
+--echo "===== Clean up ====="
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=no;
+--source include/start_slave.inc
+
+--connection master
+DROP TABLE t;
+SET GLOBAL LOG_WARNINGS=default;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/versioning/r/sysvars.result b/mysql-test/suite/versioning/r/sysvars.result
index 93d99273a40..ac0a1237902 100644
--- a/mysql-test/suite/versioning/r/sysvars.result
+++ b/mysql-test/suite/versioning/r/sysvars.result
@@ -147,6 +147,35 @@ Variable_name Value
Feature_system_versioning 2
drop table t;
#
+# MDEV-22906 Disallow system_versioning_asof in DML
+#
+create or replace table t1 (x int) with system versioning;
+create or replace table t2 (y int);
+insert into t1 values (1);
+insert into t2 values (1);
+set system_versioning_asof= '1970-01-01 00:00:00';
+delete t1, t2 from t1 join t2 where t1.x = t2.y;
+select * from t1 for system_time as of timestamp now(6);
+x
+insert into t1 values (1);
+insert into t2 values (1);
+update t1, t2 set x= 2, y= 2 where x = y;
+select * from t1 for system_time as of timestamp now(6);
+x
+2
+replace t2 select x + 1 from t1;
+select * from t2;
+y
+2
+3
+insert t2 select x + 2 from t1;
+select * from t2;
+y
+2
+3
+4
+drop tables t1, t2;
+#
# MDEV-16991 Rounding vs truncation for TIME, DATETIME, TIMESTAMP
#
SET sql_mode=TIME_ROUND_FRACTIONAL;
@@ -157,3 +186,4 @@ SELECT @@global.system_versioning_asof;
@@global.system_versioning_asof
2002-01-01 00:00:00.000000
SET @@global.system_versioning_asof= DEFAULT;
+# End of 10.4 tests
diff --git a/mysql-test/suite/versioning/t/sysvars.test b/mysql-test/suite/versioning/t/sysvars.test
index ef5d97ad262..7c5e818ec81 100644
--- a/mysql-test/suite/versioning/t/sysvars.test
+++ b/mysql-test/suite/versioning/t/sysvars.test
@@ -104,6 +104,30 @@ show status like "Feature_system_versioning";
drop table t;
+--echo #
+--echo # MDEV-22906 Disallow system_versioning_asof in DML
+--echo #
+create or replace table t1 (x int) with system versioning;
+create or replace table t2 (y int);
+insert into t1 values (1);
+insert into t2 values (1);
+set system_versioning_asof= '1970-01-01 00:00:00';
+delete t1, t2 from t1 join t2 where t1.x = t2.y;
+select * from t1 for system_time as of timestamp now(6);
+
+insert into t1 values (1);
+insert into t2 values (1);
+update t1, t2 set x= 2, y= 2 where x = y;
+select * from t1 for system_time as of timestamp now(6);
+
+replace t2 select x + 1 from t1;
+select * from t2;
+
+insert t2 select x + 2 from t1;
+select * from t2;
+
+drop tables t1, t2;
+
--echo #
--echo # MDEV-16991 Rounding vs truncation for TIME, DATETIME, TIMESTAMP
@@ -113,3 +137,5 @@ SET sql_mode=TIME_ROUND_FRACTIONAL;
SET @@global.system_versioning_asof= timestamp'2001-12-31 23:59:59.9999999';
SELECT @@global.system_versioning_asof;
SET @@global.system_versioning_asof= DEFAULT;
+
+--echo # End of 10.4 tests
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index 79e4ba9d563..19de166b1d5 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -212,7 +212,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length)
uchar* point;
reg1 USED_MEM *next= 0;
reg2 USED_MEM **prev;
- size_t original_length = length;
+ size_t original_length __attribute__((unused)) = length;
DBUG_ENTER("alloc_root");
DBUG_PRINT("enter",("root: %p name: %s", mem_root, mem_root->name));
DBUG_ASSERT(alloc_root_inited(mem_root));
diff --git a/plugin/auth_gssapi/CMakeLists.txt b/plugin/auth_gssapi/CMakeLists.txt
index d2f854c2918..bca4f5af3a1 100644
--- a/plugin/auth_gssapi/CMakeLists.txt
+++ b/plugin/auth_gssapi/CMakeLists.txt
@@ -21,9 +21,9 @@ ELSE()
SET(CMAKE_REQUIRED_INCLUDES ${GSSAPI_INCS})
SET(CMAKE_REQUIRED_LIBRARIES ${GSSAPI_LIBS})
INCLUDE(CheckCXXSymbolExists)
- CHECK_CXX_SYMBOL_EXISTS(krb5_free_unparsed_name "krb5.h" HAVE_KRB5_FREE_UNPARSED_NAME)
- IF(HAVE_KRB5_FREE_UNPARSED_NAME)
- ADD_DEFINITIONS(-DHAVE_KRB5_FREE_UNPARSED_NAME=1)
+ CHECK_CXX_SYMBOL_EXISTS(krb5_xfree "krb5.h" HAVE_KRB5_XFREE)
+ IF(HAVE_KRB5_XFREE)
+ ADD_DEFINITIONS(-DHAVE_KRB5_XFREE=1)
ENDIF()
ELSE()
diff --git a/plugin/auth_gssapi/gssapi_server.cc b/plugin/auth_gssapi/gssapi_server.cc
index 8aa13aac6c9..1d3cbb7a130 100644
--- a/plugin/auth_gssapi/gssapi_server.cc
+++ b/plugin/auth_gssapi/gssapi_server.cc
@@ -30,7 +30,7 @@ static void log_error( OM_uint32 major, OM_uint32 minor, const char *msg)
Generate default principal service name formatted as principal name "mariadb/server.fqdn@REALM"
*/
#include <krb5.h>
-#ifndef HAVE_KRB5_FREE_UNPARSED_NAME
+#ifdef HAVE_KRB5_XFREE
#define krb5_free_unparsed_name(a,b) krb5_xfree(b)
#endif
static char* get_default_principal_name()
diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c
index 4275b7d6750..c1c05bba216 100644
--- a/plugin/auth_pam/auth_pam.c
+++ b/plugin/auth_pam/auth_pam.c
@@ -36,12 +36,20 @@ static char *opt_plugin_dir; /* To be dynamically linked. */
static const char *tool_name= "auth_pam_tool_dir/auth_pam_tool";
static const int tool_name_len= 31;
+/*
+ sleep_limit is now 5 meaning up to 1 second sleep.
+ each step means 10 times longer sleep, so 6 would mean 10 seconds.
+*/
+static const unsigned int sleep_limit= 5;
+
static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
{
int p_to_c[2], c_to_p[2]; /* Parent-to-child and child-to-parent pipes. */
pid_t proc_id;
int result= CR_ERROR, pkt_len= 0;
unsigned char field, *pkt;
+ unsigned int n_sleep= 0;
+ useconds_t sleep_time= 100;
PAM_DEBUG((stderr, "PAM: opening pipes.\n"));
if (pipe(p_to_c) < 0 || pipe(c_to_p) < 0)
@@ -190,7 +198,24 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
error_ret:
close(p_to_c[1]);
close(c_to_p[0]);
- waitpid(proc_id, NULL, WNOHANG);
+ while (waitpid(proc_id, NULL, WNOHANG) != (int) proc_id)
+ {
+ if (n_sleep++ == sleep_limit)
+ {
+ /*
+ The auth_pam_tool application doesn't terminate.
+ Means something wrong happened there like pam_xxx.so hanged.
+ */
+ kill(proc_id, SIGKILL);
+ sleep_time= 1000000; /* 1 second wait should be enough. */
+ PAM_DEBUG((stderr, "PAM: auth_pam_tool doesn't terminate,"
+ " have to kill it.\n"));
+ }
+ else if (n_sleep > sleep_limit)
+ break;
+ usleep(sleep_time);
+ sleep_time*= 10;
+ }
PAM_DEBUG((stderr, "PAM: auth result %d.\n", result));
return result;
diff --git a/plugin/handler_socket/client/hspool_test.pl b/plugin/handler_socket/client/hspool_test.pl
index 7fe073301b1..973913d4ee9 100755
--- a/plugin/handler_socket/client/hspool_test.pl
+++ b/plugin/handler_socket/client/hspool_test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/plugin/handler_socket/client/hstest.pl b/plugin/handler_socket/client/hstest.pl
index 4d177b6cdc8..7651dddbc63 100755
--- a/plugin/handler_socket/client/hstest.pl
+++ b/plugin/handler_socket/client/hstest.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=8:ai:ts=8
diff --git a/plugin/handler_socket/perl-Net-HandlerSocket/lib/Net/HandlerSocket/Pool.pm b/plugin/handler_socket/perl-Net-HandlerSocket/lib/Net/HandlerSocket/Pool.pm
index c51fe60d591..b6ea62651a3 100755
--- a/plugin/handler_socket/perl-Net-HandlerSocket/lib/Net/HandlerSocket/Pool.pm
+++ b/plugin/handler_socket/perl-Net-HandlerSocket/lib/Net/HandlerSocket/Pool.pm
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
package Net::HandlerSocket::HSPool;
diff --git a/plugin/handler_socket/regtest/test_01_lib/test01.pl b/plugin/handler_socket/regtest/test_01_lib/test01.pl
index d3a072fb3cc..0a3ad9e9b25 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test01.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test01.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test02.pl b/plugin/handler_socket/regtest/test_01_lib/test02.pl
index c69515d76e9..f9bdc8b6738 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test02.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test02.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test03.pl b/plugin/handler_socket/regtest/test_01_lib/test03.pl
index a081786c132..a51aaf3b257 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test03.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test03.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test04.pl b/plugin/handler_socket/regtest/test_01_lib/test04.pl
index 52fe11364c8..d922b713271 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test04.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test04.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test05.pl b/plugin/handler_socket/regtest/test_01_lib/test05.pl
index 10b1a0805a0..2993e7a9680 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test05.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test05.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test06.pl b/plugin/handler_socket/regtest/test_01_lib/test06.pl
index fb0549f2295..69dd107e1ff 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test06.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test06.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test07.pl b/plugin/handler_socket/regtest/test_01_lib/test07.pl
index fa9802366d8..2286aeba9fe 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test07.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test07.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test08.pl b/plugin/handler_socket/regtest/test_01_lib/test08.pl
index c33bf190d29..da736ef34c3 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test08.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test08.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test09.pl b/plugin/handler_socket/regtest/test_01_lib/test09.pl
index 14fd9c26641..7d6165ece1e 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test09.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test09.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test10.pl b/plugin/handler_socket/regtest/test_01_lib/test10.pl
index fd294fe8b78..560976ba9b2 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test10.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test10.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test11.pl b/plugin/handler_socket/regtest/test_01_lib/test11.pl
index 5cfe3e83614..cfaa940572c 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test11.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test11.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test12.pl b/plugin/handler_socket/regtest/test_01_lib/test12.pl
index 100a779de4e..0cae3798372 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test12.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test12.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test13.pl b/plugin/handler_socket/regtest/test_01_lib/test13.pl
index 1e1104d2a07..2068c4bc9b6 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test13.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test13.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test14.pl b/plugin/handler_socket/regtest/test_01_lib/test14.pl
index ff4e433ae8f..ab89073370b 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test14.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test14.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test15.pl b/plugin/handler_socket/regtest/test_01_lib/test15.pl
index 4c56d355708..2205be5b363 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test15.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test15.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test16.pl b/plugin/handler_socket/regtest/test_01_lib/test16.pl
index 6db8c576d7a..c0c3fc556ff 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test16.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test16.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test17.pl b/plugin/handler_socket/regtest/test_01_lib/test17.pl
index 1ffd7fa1242..7c150dab746 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test17.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test17.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test18.pl b/plugin/handler_socket/regtest/test_01_lib/test18.pl
index 87047bc9cba..7854642af15 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test18.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test18.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test19.pl b/plugin/handler_socket/regtest/test_01_lib/test19.pl
index 9870199c1a7..2e5363c8137 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test19.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test19.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test20.pl b/plugin/handler_socket/regtest/test_01_lib/test20.pl
index 139bbf9aba1..96307e0a5f0 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test20.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test20.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test21.pl b/plugin/handler_socket/regtest/test_01_lib/test21.pl
index 413ea636400..34e9d43972b 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test21.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test21.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test22.pl b/plugin/handler_socket/regtest/test_01_lib/test22.pl
index cf029944292..370d16d6027 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test22.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test22.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test23.pl b/plugin/handler_socket/regtest/test_01_lib/test23.pl
index 83c2194bfa6..d9bd0381251 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test23.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test23.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/plugin/handler_socket/regtest/test_01_lib/test24.pl b/plugin/handler_socket/regtest/test_01_lib/test24.pl
index 6cd95a995e5..f4e3bb3f10c 100644
--- a/plugin/handler_socket/regtest/test_01_lib/test24.pl
+++ b/plugin/handler_socket/regtest/test_01_lib/test24.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# vim:sw=2:ai
diff --git a/scripts/convert-debug-for-diff.sh b/scripts/convert-debug-for-diff.sh
index 5b3ce05b815..60b328d946b 100755
--- a/scripts/convert-debug-for-diff.sh
+++ b/scripts/convert-debug-for-diff.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -i
+#!/usr/bin/env perl -i
#
# This script converts all numbers that look like addresses or memory sizes,
# in a debug files generated by --debug (like mysqld --debug-dbug), to #.
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index 6e1377660e9..f81aa290100 100644
--- a/scripts/mysql_system_tables.sql
+++ b/scripts/mysql_system_tables.sql
@@ -37,9 +37,15 @@ CREATE TABLE IF NOT EXISTS global_priv (Host char(60) binary DEFAULT '', User ch
set @had_sys_user= 0 <> (select count(*) from mysql.global_priv where Host="localhost" and User="mariadb.sys");
+set @exists_user_view= EXISTS (SELECT * FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user');
+
+set @exists_user_view_by_root= EXISTS (SELECT * FROM information_schema.VIEWS WHERE TABLE_CATALOG = 'def' and TABLE_SCHEMA = 'mysql' and TABLE_NAME='user' and DEFINER = 'mariadb.sys@localhost');
+
+set @need_sys_user_creation= (NOT @had_sys_user) AND (( NOT @exists_user_view) OR @exists_user_view_by_root);
+
CREATE TEMPORARY TABLE tmp_user_sys LIKE global_priv;
INSERT INTO tmp_user_sys (Host,User,Priv) VALUES ('localhost','mariadb.sys','{"access":0,"plugin":"mysql_native_password","authentication_string":"","account_locked":true,"password_last_changed":0}');
-INSERT INTO global_priv SELECT * FROM tmp_user_sys WHERE NOT @had_sys_user;
+INSERT INTO global_priv SELECT * FROM tmp_user_sys WHERE 0 <> @need_sys_user_creation;
DROP TABLE tmp_user_sys;
@@ -111,7 +117,7 @@ CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NUL
CREATE TEMPORARY TABLE tmp_user_sys LIKE tables_priv;
INSERT INTO tmp_user_sys (Host,Db,User,Table_name,Grantor,Timestamp,Table_priv) VALUES ('localhost','mysql','mariadb.sys','global_priv','root@localhost','0','Select,Update,Delete');
-INSERT INTO tables_priv SELECT * FROM tmp_user_sys WHERE NOT @had_sys_user;
+INSERT INTO tables_priv SELECT * FROM tmp_user_sys WHERE 0 <> @need_sys_user_creation;
DROP TABLE tmp_user_sys;
CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
diff --git a/scripts/mytop.sh b/scripts/mytop.sh
index 3ef0a59f27f..e985d518c01 100644
--- a/scripts/mytop.sh
+++ b/scripts/mytop.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
#
# $Id: mytop,v 1.91 2012/01/18 16:49:12 mgrennan Exp $
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index 5403b9e8505..96e542ce844 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -200,6 +200,7 @@ fi
# New filter - exclude everything except dirs (schemas) and innodb files
FILTER="-f '- /lost+found'
+ -f '- /.zfs'
-f '- /.fseventsd'
-f '- /.Trashes'
-f '+ /wsrep_sst_binlog.tar'
@@ -357,7 +358,7 @@ EOF
[ "$OS" = "Linux" ] && count=$(grep -c processor /proc/cpuinfo)
[ "$OS" = "Darwin" -o "$OS" = "FreeBSD" ] && count=$(sysctl -n hw.ncpu)
- find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" \
+ find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" -not -name ".zfs" \
-print0 | xargs -I{} -0 -P $count \
rsync ${STUNNEL:+--rsh="$STUNNEL"} \
--owner --group --perms --links --specials \
@@ -440,6 +441,7 @@ timeout = 300
$SILENT
[$MODULE]
path = $WSREP_SST_OPT_DATA
+ exclude = .zfs
[$MODULE-log_dir]
path = $WSREP_LOG_DIR
[$MODULE-data_dir]
diff --git a/sql-bench/as3ap.sh b/sql-bench/as3ap.sh
index fd2b6ba3b25..8e4b3167429 100644
--- a/sql-bench/as3ap.sh
+++ b/sql-bench/as3ap.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/bench-count-distinct.sh b/sql-bench/bench-count-distinct.sh
index 9ce9b2fb168..b6465d0635f 100644
--- a/sql-bench/bench-count-distinct.sh
+++ b/sql-bench/bench-count-distinct.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/bench-init.pl.sh b/sql-bench/bench-init.pl.sh
index a6a12603e6d..f23ef6f5949 100644
--- a/sql-bench/bench-init.pl.sh
+++ b/sql-bench/bench-init.pl.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000-2003, 2005-2007 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/compare-results.sh b/sql-bench/compare-results.sh
index f0658160db2..06e247bae8a 100644
--- a/sql-bench/compare-results.sh
+++ b/sql-bench/compare-results.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/copy-db.sh b/sql-bench/copy-db.sh
index 38a010e52ab..d70472feaff 100644
--- a/sql-bench/copy-db.sh
+++ b/sql-bench/copy-db.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh
index a7298c5f9a1..26f66f94735 100644
--- a/sql-bench/crash-me.sh
+++ b/sql-bench/crash-me.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- perl -*-
# Copyright (c) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
diff --git a/sql-bench/graph-compare-results.sh b/sql-bench/graph-compare-results.sh
index ddc9080acd6..d43f722cb14 100755
--- a/sql-bench/graph-compare-results.sh
+++ b/sql-bench/graph-compare-results.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
####
#### Hello ... this is a heavily hacked script by Luuk
#### instead of printing the result it makes a nice gif
diff --git a/sql-bench/innotest1.sh b/sql-bench/innotest1.sh
index 9e1ed32c273..1b99f601f42 100644
--- a/sql-bench/innotest1.sh
+++ b/sql-bench/innotest1.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
############################################################################
# Stress test for MySQL/InnoDB combined database
# (c) 2002 Innobase Oy & MySQL AB
diff --git a/sql-bench/innotest1a.sh b/sql-bench/innotest1a.sh
index 1e428e33dcf..7183c901831 100644
--- a/sql-bench/innotest1a.sh
+++ b/sql-bench/innotest1a.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
############################################################################
# Stress test for MySQL/InnoDB combined database
# (c) 2002 Innobase Oy & MySQL AB
diff --git a/sql-bench/innotest1b.sh b/sql-bench/innotest1b.sh
index 524a6e0e145..0a909d1a8f6 100644
--- a/sql-bench/innotest1b.sh
+++ b/sql-bench/innotest1b.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
############################################################################
# Stress test for MySQL/InnoDB combined database
# (c) 2002 Innobase Oy & MySQL AB
diff --git a/sql-bench/innotest2.sh b/sql-bench/innotest2.sh
index fa0fd418968..941b0ac8b59 100644
--- a/sql-bench/innotest2.sh
+++ b/sql-bench/innotest2.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
############################################################################
# Stress test for MySQL/InnoDB combined database
# (c) 2002 Innobase Oy & MySQL AB
diff --git a/sql-bench/innotest2a.sh b/sql-bench/innotest2a.sh
index 4a6e4b20a9a..e873d2b458c 100644
--- a/sql-bench/innotest2a.sh
+++ b/sql-bench/innotest2a.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
############################################################################
# Stress test for MySQL/Innobase combined database
# (c) 2000 Innobase Oy & MySQL AB
diff --git a/sql-bench/innotest2b.sh b/sql-bench/innotest2b.sh
index b94325ff39e..56b44eda561 100644
--- a/sql-bench/innotest2b.sh
+++ b/sql-bench/innotest2b.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
############################################################################
# Stress test for MySQL/Innobase combined database
# (c) 2000 Innobase Oy & MySQL AB
diff --git a/sql-bench/run-all-tests.sh b/sql-bench/run-all-tests.sh
index 5d77c8c388d..ecab48e88fe 100644
--- a/sql-bench/run-all-tests.sh
+++ b/sql-bench/run-all-tests.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh
index 3991d16c6b1..e7fd613c50b 100644
--- a/sql-bench/server-cfg.sh
+++ b/sql-bench/server-cfg.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# -*- perl -*-
# Copyright (c) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
diff --git a/sql-bench/test-ATIS.sh b/sql-bench/test-ATIS.sh
index d7ef5dca476..c51688de0c2 100644
--- a/sql-bench/test-ATIS.sh
+++ b/sql-bench/test-ATIS.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-alter-table.sh b/sql-bench/test-alter-table.sh
index e092453b16a..350c6fae2c6 100644
--- a/sql-bench/test-alter-table.sh
+++ b/sql-bench/test-alter-table.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-big-tables.sh b/sql-bench/test-big-tables.sh
index e2cf983de1c..6be907d0ee6 100644
--- a/sql-bench/test-big-tables.sh
+++ b/sql-bench/test-big-tables.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-connect.sh b/sql-bench/test-connect.sh
index 1226301df9b..e3acb453a30 100644
--- a/sql-bench/test-connect.sh
+++ b/sql-bench/test-connect.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-create.sh b/sql-bench/test-create.sh
index 7af6fa13562..09961f0d698 100644
--- a/sql-bench/test-create.sh
+++ b/sql-bench/test-create.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000-2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-insert.sh b/sql-bench/test-insert.sh
index 3e35ac5ff5c..dbdc58fdcca 100644
--- a/sql-bench/test-insert.sh
+++ b/sql-bench/test-insert.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000-2003, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-select.sh b/sql-bench/test-select.sh
index 4c7147b57a4..e3020698cb8 100644
--- a/sql-bench/test-select.sh
+++ b/sql-bench/test-select.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-table-elimination.sh b/sql-bench/test-table-elimination.sh
index de440fc0633..c3a264492a4 100755
--- a/sql-bench/test-table-elimination.sh
+++ b/sql-bench/test-table-elimination.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Test of table elimination feature
use Cwd;
diff --git a/sql-bench/test-transactions.sh b/sql-bench/test-transactions.sh
index 4732658c529..334a6f0a385 100644
--- a/sql-bench/test-transactions.sh
+++ b/sql-bench/test-transactions.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql-bench/test-wisconsin.sh b/sql-bench/test-wisconsin.sh
index 47c9e050304..581db89712e 100644
--- a/sql-bench/test-wisconsin.sh
+++ b/sql-bench/test-wisconsin.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
#
diff --git a/sql/field.cc b/sql/field.cc
index 21145cdf32a..15356274864 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -7647,6 +7647,17 @@ int Field_varstring::save_field_metadata(uchar *metadata_ptr)
return 2;
}
+
+bool Field_varstring::memcpy_field_possible(const Field *from) const
+{
+ return (Field_str::memcpy_field_possible(from) &&
+ !compression_method() == !from->compression_method() &&
+ length_bytes == ((Field_varstring*) from)->length_bytes &&
+ (table->file && !(table->file->ha_table_flags() &
+ HA_RECORD_MUST_BE_CLEAN_ON_WRITE)));
+}
+
+
int Field_varstring::store(const char *from,size_t length,CHARSET_INFO *cs)
{
DBUG_ASSERT(marked_for_write_or_computed());
@@ -7709,7 +7720,7 @@ my_decimal *Field_varstring::val_decimal(my_decimal *decimal_value)
}
-#ifdef HAVE_valgrind_or_MSAN
+#ifdef HAVE_valgrind
void Field_varstring::mark_unused_memory_as_defined()
{
uint used_length= get_length();
diff --git a/sql/field.h b/sql/field.h
index 1d421abe880..25d7ad4cff0 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -826,7 +826,7 @@ public:
return store(ls.str, (uint) ls.length, cs);
}
-#ifdef HAVE_valgrind_or_MSAN
+#ifdef HAVE_valgrind
/**
Mark unused memory in the field as defined. Mainly used to ensure
that if we write full field to disk (for example in
@@ -3692,15 +3692,10 @@ public:
length_bytes : 0);
}
Copy_func *get_copy_func(const Field *from) const;
- bool memcpy_field_possible(const Field *from) const
- {
- return Field_str::memcpy_field_possible(from) &&
- !compression_method() == !from->compression_method() &&
- length_bytes == ((Field_varstring*) from)->length_bytes;
- }
+ bool memcpy_field_possible(const Field *from) const;
int store(const char *to,size_t length,CHARSET_INFO *charset);
using Field_str::store;
-#ifdef HAVE_valgrind_or_MSAN
+#ifdef HAVE_valgrind
void mark_unused_memory_as_defined();
#endif
double val_real(void);
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 2e06905a48e..c586b3fabff 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -471,7 +471,14 @@ uint Filesort::make_sortorder(THD *thd, JOIN *join, table_map first_table_bit)
if (item->type() == Item::FIELD_ITEM)
pos->field= ((Item_field*) item)->field;
else if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item())
- pos->field= ((Item_sum*) item)->get_tmp_table_field();
+ {
+ // Aggregate, or Item_aggregate_ref
+ DBUG_ASSERT(first->type() == Item::SUM_FUNC_ITEM ||
+ (first->type() == Item::REF_ITEM &&
+ static_cast<Item_ref*>(first)->ref_type() ==
+ Item_ref::AGGREGATE_REF));
+ pos->field= first->get_tmp_table_field();
+ }
else if (item->type() == Item::COPY_STR_ITEM)
{ // Blob patch
pos->item= ((Item_copy*) item)->get_item();
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index b9342a327e2..60a249399f2 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -2548,7 +2548,7 @@ register_query_cache_dependant_tables(THD *thd,
sub_elem= subpart_it++;
part= i * num_subparts + j;
/* we store the end \0 as part of the key */
- end= strmov(engine_pos, sub_elem->partition_name);
+ end= strmov(engine_pos, sub_elem->partition_name) + 1;
length= (uint)(end - engine_key);
/* Copy the suffix also to query cache key */
memcpy(query_cache_key_end, engine_key_end, (end - engine_key_end));
diff --git a/sql/handler.h b/sql/handler.h
index cdcb117da97..e514fcfd60c 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -213,7 +213,8 @@ enum enum_alter_inplace_result {
#define HA_HAS_NEW_CHECKSUM (1ULL << 38)
#define HA_CAN_VIRTUAL_COLUMNS (1ULL << 39)
#define HA_MRR_CANT_SORT (1ULL << 40)
-#define HA_RECORD_MUST_BE_CLEAN_ON_WRITE (1ULL << 41) /* unused */
+/* All of VARCHAR is stored, including bytes after real varchar data */
+#define HA_RECORD_MUST_BE_CLEAN_ON_WRITE (1ULL << 41)
/*
This storage engine supports condition pushdown
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index a90e7fb3a1a..e86ee5f68ad 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -956,6 +956,41 @@ double Item_func_json_extract::val_real()
}
+my_decimal *Item_func_json_extract::val_decimal(my_decimal *to)
+{
+ json_value_types type;
+ char *value;
+ int value_len;
+
+ if (read_json(NULL, &type, &value, &value_len) != NULL)
+ {
+ switch (type)
+ {
+ case JSON_VALUE_STRING:
+ case JSON_VALUE_NUMBER:
+ {
+ my_decimal *res= decimal_from_string_with_check(to, collation.collation,
+ value,
+ value + value_len);
+ null_value= res == NULL;
+ return res;
+ }
+ case JSON_VALUE_TRUE:
+ int2my_decimal(E_DEC_FATAL_ERROR, 1, false/*unsigned_flag*/, to);
+ return to;
+ case JSON_VALUE_OBJECT:
+ case JSON_VALUE_ARRAY:
+ case JSON_VALUE_FALSE:
+ case JSON_VALUE_NULL:
+ break;
+ };
+ }
+ int2my_decimal(E_DEC_FATAL_ERROR, 0, false/*unsigned_flag*/, to);
+ return to;
+}
+
+
+
bool Item_func_json_contains::fix_length_and_dec()
{
a2_constant= args[1]->const_item();
diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h
index e9b77502e80..c703533f799 100644
--- a/sql/item_jsonfunc.h
+++ b/sql/item_jsonfunc.h
@@ -169,6 +169,7 @@ public:
String *val_str(String *);
longlong val_int();
double val_real();
+ my_decimal *val_decimal(my_decimal *);
uint get_n_paths() const { return arg_count - 1; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_json_extract>(thd, this); }
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index c50f87c8f1c..889f9902e12 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -727,7 +727,7 @@ bool Item_subselect::exec()
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_UNKNOWN_ERROR, "DBUG: Item_subselect::exec %.*s",
- print.length(),print.c_ptr());
+ print.length(),print.ptr());
);
/*
Do not execute subselect in case of a fatal error
@@ -2068,7 +2068,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
The swap is needed for expressions of type 'f1 < ALL ( SELECT ....)'
where we want to evaluate the sub query even if f1 would be null.
*/
- subs= func->create_swap(thd, *(optimizer->get_cache()), subs);
+ subs= func->create_swap(thd, expr, subs);
thd->change_item_tree(place, subs);
if (subs->fix_fields(thd, &subs))
DBUG_RETURN(true);
diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc
index 5ecb9510940..1724174343f 100644
--- a/sql/item_windowfunc.cc
+++ b/sql/item_windowfunc.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2016,2017 MariaDB
+ Copyright (c) 2016, 2020, 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
@@ -348,9 +348,9 @@ bool Item_sum_hybrid_simple::fix_fields(THD *thd, Item **ref)
for (uint i= 0; i < arg_count; i++)
{
- // 'item' can be changed during fix_fields
if (args[i]->fix_fields_if_needed_for_scalar(thd, &args[i]))
return TRUE;
+ with_window_func|= args[i]->with_window_func;
}
for (uint i= 0; i < arg_count && !m_with_subquery; i++)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 99b8457cf20..81f3b7f7c9d 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2179,9 +2179,11 @@ static void set_ports()
*/
#if MYSQL_PORT_DEFAULT == 0
+# if !__has_feature(memory_sanitizer) // Work around MSAN deficiency
struct servent *serv_ptr;
if ((serv_ptr= getservbyname("mysql", "tcp")))
SYSVAR_AUTOSIZE(mysqld_port, ntohs((u_short) serv_ptr->s_port));
+# endif
#endif
if ((env = getenv("MYSQL_TCP_PORT")))
{
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index ecbf5d6afcb..86935f3ef27 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2690,10 +2690,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
DBUG_PRINT("info",("Time to scan table: %g", read_time));
Json_writer_object table_records(thd);
- if (head->reginfo.join_tab)
- table_records.add_table_name(head->reginfo.join_tab);
- else
- table_records.add_table_name(head);
+ table_records.add_table_name(head);
+
Json_writer_object trace_range(thd, "range_analysis");
{
Json_writer_object table_rec(thd, "table_scan");
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 2c3e3d5a838..3a2fd5fc123 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2006, 2017, Oracle and/or its affiliates.
- Copyright (c) 2010, 2017, MariaDB Corporation
+ Copyright (c) 2010, 2020, 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
@@ -1471,8 +1471,14 @@ bool Relay_log_info::stmt_done(my_off_t event_master_log_pos, THD *thd,
}
DBUG_EXECUTE_IF("inject_crash_before_flush_rli", DBUG_SUICIDE(););
if (mi->using_gtid == Master_info::USE_GTID_NO)
+ {
+ if (rgi->is_parallel_exec)
+ mysql_mutex_lock(&data_lock);
if (flush())
error= 1;
+ if (rgi->is_parallel_exec)
+ mysql_mutex_unlock(&data_lock);
+ }
DBUG_EXECUTE_IF("inject_crash_after_flush_rli", DBUG_SUICIDE(););
}
DBUG_RETURN(error);
diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc
index ae9eda628a8..c37cdb46fc9 100644
--- a/sql/session_tracker.cc
+++ b/sql/session_tracker.cc
@@ -380,16 +380,12 @@ bool Session_sysvars_tracker::enable(THD *thd)
bool Session_sysvars_tracker::update(THD *thd, set_var *var)
{
vars_list tool_list;
- void *copy;
size_t length= 1;
-
- if (var->save_result.string_value.str)
- copy= my_memdup(var->save_result.string_value.str,
- (length= var->save_result.string_value.length + 1),
- MYF(MY_WME | MY_THREAD_SPECIFIC));
- else
- copy= my_strdup("", MYF(MY_WME | MY_THREAD_SPECIFIC));
-
+ void *copy= var->save_result.string_value.str ?
+ my_memdup(var->save_result.string_value.str,
+ (length= var->save_result.string_value.length + 1),
+ MYF(MY_WME | MY_THREAD_SPECIFIC)) :
+ my_strdup("", MYF(MY_WME | MY_THREAD_SPECIFIC));
if (!copy)
return true;
diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc
index 51b9d7a2c51..5439f13b3f4 100644
--- a/sql/signal_handler.cc
+++ b/sql/signal_handler.cc
@@ -277,7 +277,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
}
my_safe_printf_stderr("%s",
"The manual page at "
- "http://dev.mysql.com/doc/mysql/en/crashing.html contains\n"
+ "https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains\n"
"information that should help you find out what is causing the crash.\n");
#endif /* HAVE_STACKTRACE */
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 89cc3f8da64..afc2f121167 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -2021,8 +2021,8 @@ int READ_INFO::read_xml(THD *thd)
case '=': /* attribute name end - read the value */
//check for tag field and attribute name
- if(!memcmp(tag.c_ptr_safe(), STRING_WITH_LEN("field")) &&
- !memcmp(attribute.c_ptr_safe(), STRING_WITH_LEN("name")))
+ if(!strcmp(tag.c_ptr_safe(), "field") &&
+ !strcmp(attribute.c_ptr_safe(), "name"))
{
/*
this is format <field name="xx">xx</field>
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index a7f2f472b0a..8fa7aa61386 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -947,11 +947,6 @@ void execute_init_command(THD *thd, LEX_STRING *init_command,
char *buf= thd->strmake(init_command->str, len);
mysql_rwlock_unlock(var_lock);
-#if defined(ENABLED_PROFILING)
- thd->profiling.start_new_query();
- thd->profiling.set_query_source(buf, len);
-#endif
-
THD_STAGE_INFO(thd, stage_execution_of_init_command);
save_client_capabilities= thd->client_capabilities;
thd->client_capabilities|= CLIENT_MULTI_QUERIES;
@@ -966,9 +961,6 @@ void execute_init_command(THD *thd, LEX_STRING *init_command,
thd->client_capabilities= save_client_capabilities;
thd->net.vio= save_vio;
-#if defined(ENABLED_PROFILING)
- thd->profiling.finish_current_query();
-#endif
}
@@ -4998,6 +4990,12 @@ mysql_execute_command(THD *thd)
if (res)
goto error;
+#ifdef WITH_WSREP
+ /* Clean up the previous transaction on implicit commit. */
+ if (wsrep_on(thd) && !wsrep_not_committed(thd) && wsrep_after_statement(thd))
+ goto error;
+#endif
+
/* We can't have any kind of table locks while backup is active */
if (thd->current_backup_stage != BACKUP_FINISHED)
{
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 3f8a9df1efe..8ec6ef96511 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -850,6 +850,8 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array,
if (param->convert_str_value(thd))
DBUG_RETURN(1); /* out of memory */
+
+ param->sync_clones();
}
if (acc.finalize())
DBUG_RETURN(1);
@@ -3110,7 +3112,10 @@ static void reset_stmt_params(Prepared_statement *stmt)
Item_param **item= stmt->param_array;
Item_param **end= item + stmt->param_count;
for (;item < end ; ++item)
+ {
(**item).reset();
+ (**item).sync_clones();
+ }
}
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 74ddd981a4b..1080018b84d 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -2120,9 +2120,13 @@ static int init_binlog_sender(binlog_send_info *info,
});
if (global_system_variables.log_warnings > 1)
+ {
sql_print_information(
- "Start binlog_dump to slave_server(%lu), pos(%s, %lu)",
- thd->variables.server_id, log_ident, (ulong)*pos);
+ "Start binlog_dump to slave_server(%lu), pos(%s, %lu), "
+ "using_gtid(%d), gtid('%s')", thd->variables.server_id,
+ log_ident, (ulong)*pos, info->using_gtid_state,
+ connect_gtid_state.c_ptr_quick());
+ }
#ifndef DBUG_OFF
if (opt_sporadic_binlog_dump_fail && (binlog_dump_count++ % 2))
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 0ca5ab23288..326c27eff0a 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -975,9 +975,12 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables)
}
bool is_select= false;
+ bool use_sysvar= false;
switch (thd->lex->sql_command)
{
case SQLCOM_SELECT:
+ use_sysvar= true;
+ /* fall through */
case SQLCOM_INSERT_SELECT:
case SQLCOM_REPLACE_SELECT:
case SQLCOM_DELETE_MULTI:
@@ -1021,7 +1024,7 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables)
}
// propagate system_time from sysvar
- if (!vers_conditions.is_set() && is_select)
+ if (!vers_conditions.is_set() && use_sysvar)
{
if (vers_conditions.init_from_sysvar(thd))
DBUG_RETURN(-1);
@@ -6582,6 +6585,7 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
keyuse.keypart= FT_KEYPART;
keyuse.used_tables=cond_func->key_item()->used_tables();
keyuse.optimize= 0;
+ keyuse.ref_table_rows= 0;
keyuse.keypart_map= 0;
keyuse.sj_pred_no= UINT_MAX;
keyuse.validity_ref= 0;
@@ -6965,6 +6969,7 @@ void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array)
uint n_tables= my_count_bits(map);
if (n_tables == 1) // Only one table
{
+ DBUG_ASSERT(!(map & PSEUDO_TABLE_BITS)); // Must be a real table
Table_map_iterator it(map);
int tablenr= it.next_bit();
DBUG_ASSERT(tablenr != Table_map_iterator::BITMAP_END);
@@ -9150,7 +9155,7 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
/*
Check if we have a prefix of key=const that matches a quick select.
*/
- if (!is_hash_join_key_no(key))
+ if (!is_hash_join_key_no(key) && table->quick_keys.is_set(key))
{
key_part_map quick_key_map= (key_part_map(1) << table->quick_key_parts[key]) - 1;
if (table->quick_rows[key] &&
@@ -16560,10 +16565,15 @@ static uint build_bitmap_for_nested_joins(List<TABLE_LIST> *join_list,
/**
- Set NESTED_JOIN::counter=0 in all nested joins in passed list.
+ Set NESTED_JOIN::counter and n_tables in all nested joins in passed list.
+
+ For all nested joins contained in the passed join_list (including its
+ children), set:
+ - nested_join->counter=0
+ - nested_join->n_tables= {number of non-degenerate direct children}.
- Recursively set NESTED_JOIN::counter=0 for all nested joins contained in
- the passed join_list.
+ Non-degenerate means non-const base table or a join nest that has a
+ non-degenerate child.
@param join_list List of nested joins to process. It may also contain base
tables which will be ignored.
@@ -16586,8 +16596,11 @@ static uint reset_nj_counters(JOIN *join, List<TABLE_LIST> *join_list)
if (!nested_join->n_tables)
is_eliminated_nest= TRUE;
}
- if ((table->nested_join && !is_eliminated_nest) ||
- (!table->nested_join && (table->table->map & ~join->eliminated_tables)))
+ const table_map removed_tables= join->eliminated_tables |
+ join->const_table_map;
+
+ if ((table->nested_join && !is_eliminated_nest) ||
+ (!table->nested_join && (table->table->map & ~removed_tables)))
n++;
}
DBUG_RETURN(n);
@@ -18138,6 +18151,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
bool using_unique_constraint= false;
bool use_packed_rows= false;
bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS);
+ bool save_abort_on_warning;
char *tmpname,path[FN_REFLEN];
uchar *pos, *group_buff, *bitmaps;
uchar *null_flags;
@@ -18605,6 +18619,11 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
}
null_count= (blob_count == 0) ? 1 : 0;
hidden_field_count=param->hidden_field_count;
+
+ /* Protect against warnings in field_conv() in the next loop*/
+ save_abort_on_warning= thd->abort_on_warning;
+ thd->abort_on_warning= 0;
+
for (i=0,reg_field=table->field; i < field_count; i++,reg_field++,recinfo++)
{
Field *field= *reg_field;
@@ -18641,25 +18660,31 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
inherit the default value that is defined for the field referred
by the Item_field object from which 'field' has been created.
*/
- const Field *orig_field= default_field[i];
+ Field *orig_field= default_field[i];
/* Get the value from default_values */
if (orig_field->is_null_in_record(orig_field->table->s->default_values))
field->set_null();
else
{
+ /*
+ Copy default value. We have to use field_conv() for copy, instead of
+ memcpy(), because bit_fields may be stored differently
+ */
+ my_ptrdiff_t ptr_diff= (orig_field->table->s->default_values -
+ orig_field->table->record[0]);
field->set_notnull();
- memcpy(field->ptr,
- orig_field->ptr_in_record(orig_field->table->s->default_values),
- field->pack_length_in_rec());
+ orig_field->move_field_offset(ptr_diff);
+ field_conv(field, orig_field);
+ orig_field->move_field_offset(-ptr_diff);
}
- }
+ }
if (from_field[i])
{ /* Not a table Item */
copy->set(field,from_field[i],save_sum_fields);
copy++;
}
- length=field->pack_length();
+ length=field->pack_length_in_rec();
pos+= length;
/* Make entry for create table */
@@ -18681,7 +18706,11 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
// fix table name in field entry
field->set_table_name(&table->alias);
}
+ /* Handle group_null_items */
+ bzero(pos, table->s->reclength - (pos - table->record[0]));
+ MEM_CHECK_DEFINED(table->record[0], table->s->reclength);
+ thd->abort_on_warning= save_abort_on_warning;
param->copy_field_end=copy;
param->recinfo= recinfo; // Pointer to after last field
store_record(table,s->default_values); // Make empty default record
@@ -18950,8 +18979,9 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
goto err;
}
- // Make empty record so random data is not written to disk
- empty_record(table);
+ /* record[0] and share->default_values should now have been set up */
+ MEM_CHECK_DEFINED(table->record[0], table->s->reclength);
+ MEM_CHECK_DEFINED(share->default_values, table->s->reclength);
thd->mem_root= mem_root_save;
@@ -19244,7 +19274,11 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
(*recinfo)->type= FIELD_CHECK;
(*recinfo)->length= MARIA_UNIQUE_HASH_LENGTH;
(*recinfo)++;
- share->reclength+= MARIA_UNIQUE_HASH_LENGTH;
+
+ /* Avoid warnings from valgrind */
+ bzero(table->record[0]+ share->reclength, MARIA_UNIQUE_HASH_LENGTH);
+ bzero(share->default_values+ share->reclength, MARIA_UNIQUE_HASH_LENGTH);
+ share->reclength+= MARIA_UNIQUE_HASH_LENGTH;
}
else
{
@@ -19438,7 +19472,10 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
(*recinfo)->type= FIELD_CHECK;
(*recinfo)->length=MI_UNIQUE_HASH_LENGTH;
(*recinfo)++;
- share->reclength+=MI_UNIQUE_HASH_LENGTH;
+ /* Avoid warnings from valgrind */
+ bzero(table->record[0]+ share->reclength, MI_UNIQUE_HASH_LENGTH);
+ bzero(share->default_values+ share->reclength, MI_UNIQUE_HASH_LENGTH);
+ share->reclength+= MI_UNIQUE_HASH_LENGTH;
}
else
{
@@ -20030,11 +20067,11 @@ bool instantiate_tmp_table(TABLE *table, KEY *keyinfo,
If it is not heap (in-memory) table then convert index to unique
constrain.
*/
+ MEM_CHECK_DEFINED(table->record[0], table->s->reclength);
if (create_internal_tmp_table(table, keyinfo, start_recinfo, recinfo,
options))
return TRUE;
- // Make empty record so random data is not written to disk
- empty_record(table);
+ MEM_CHECK_DEFINED(table->record[0], table->s->reclength);
}
if (open_tmp_table(table))
return TRUE;
@@ -28589,7 +28626,6 @@ AGGR_OP::prepare_tmp_table()
join->select_options))
return true;
(void) table->file->extra(HA_EXTRA_WRITE_CACHE);
- empty_record(table);
}
/* If it wasn't already, start index scan for grouping using table index. */
if (!table->file->inited && table->group &&
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 3d739f6147a..7ef9d072282 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, 2019, MariaDB
+ Copyright (c) 2009, 2020, 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
@@ -5331,6 +5331,29 @@ bool store_schema_shemata(THD* thd, TABLE *table, LEX_CSTRING *db_name,
}
+/*
+ Check if the specified database exists on disk.
+
+ @param dbname - the database name
+ @retval true - on error, the database directory does not exists
+ @retval false - on success, the database directory exists
+*/
+static bool verify_database_directory_exists(const LEX_CSTRING &dbname)
+{
+ DBUG_ENTER("verify_database_directory_exists");
+ char path[FN_REFLEN + 16];
+ uint path_len;
+ MY_STAT stat_info;
+ if (!dbname.str[0])
+ DBUG_RETURN(true); // Empty database name: does not exist.
+ path_len= build_table_filename(path, sizeof(path) - 1, dbname.str, "", "", 0);
+ path[path_len - 1]= 0;
+ if (!mysql_file_stat(key_file_misc, path, &stat_info, MYF(0)))
+ DBUG_RETURN(true); // The database directory was not found: does not exist.
+ DBUG_RETURN(false); // The database directory was found.
+}
+
+
int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
{
/*
@@ -5359,19 +5382,10 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
If we have lookup db value we should check that the database exists
*/
if(lookup_field_vals.db_value.str && !lookup_field_vals.wild_db_value &&
- db_names.at(0) != &INFORMATION_SCHEMA_NAME)
- {
- char path[FN_REFLEN+16];
- uint path_len;
- MY_STAT stat_info;
- if (!lookup_field_vals.db_value.str[0])
- DBUG_RETURN(0);
- path_len= build_table_filename(path, sizeof(path) - 1,
- lookup_field_vals.db_value.str, "", "", 0);
- path[path_len-1]= 0;
- if (!mysql_file_stat(key_file_misc, path, &stat_info, MYF(0)))
- DBUG_RETURN(0);
- }
+ (!db_names.elements() /* The database name was too long */||
+ (db_names.at(0) != &INFORMATION_SCHEMA_NAME &&
+ verify_database_directory_exists(lookup_field_vals.db_value))))
+ DBUG_RETURN(0);
for (size_t i=0; i < db_names.elements(); i++)
{
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index def29d78203..949f86297a4 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -9449,11 +9449,16 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
(!create_info->db_type || /* unknown engine */
!(create_info->db_type->flags & HTON_SUPPORT_LOG_TABLES)))
{
+ unsupported:
my_error(ER_UNSUPORTED_LOG_ENGINE, MYF(0),
hton_name(create_info->db_type)->str);
DBUG_RETURN(true);
}
+ if (create_info->db_type == maria_hton &&
+ create_info->transactional != HA_CHOICE_NO)
+ goto unsupported;
+
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (alter_info->partition_flags & ALTER_PARTITION_INFO)
{
@@ -10604,6 +10609,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
sql_mode_t save_sql_mode= thd->variables.sql_mode;
ulonglong prev_insert_id, time_to_report_progress;
Field **dfield_ptr= to->default_field;
+ uint save_to_s_default_fields= to->s->default_fields;
bool make_versioned= !from->versioned() && to->versioned();
bool make_unversioned= from->versioned() && !to->versioned();
bool keep_versioned= from->versioned() && to->versioned();
@@ -10931,6 +10937,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
*copied= found_count;
*deleted=delete_count;
to->file->ha_release_auto_increment();
+ to->s->default_fields= save_to_s_default_fields;
if (!cleanup_done)
{
diff --git a/sql/table.cc b/sql/table.cc
index 648b1794582..138f39e294d 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1962,8 +1962,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
share->rec_buff_length= rec_buff_length;
if (!(record= (uchar *) alloc_root(&share->mem_root, rec_buff_length)))
goto err; /* purecov: inspected */
- MEM_NOACCESS(record, rec_buff_length);
- MEM_UNDEFINED(record, share->reclength);
+ /* Mark bytes after record as not accessable to catch overrun bugs */
+ MEM_NOACCESS(record + share->reclength, rec_buff_length - share->reclength);
share->default_values= record;
memcpy(record, frm_image + record_offset, share->reclength);
@@ -3690,7 +3690,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
if (!(record= (uchar*) alloc_root(&outparam->mem_root,
share->rec_buff_length * records)))
goto err; /* purecov: inspected */
- MEM_NOACCESS(record, share->rec_buff_length * records);
}
for (i= 0; i < 3;)
@@ -3699,8 +3698,10 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
if (++i < records)
record+= share->rec_buff_length;
}
+ /* Mark bytes between records as not accessable to catch overrun bugs */
for (i= 0; i < records; i++)
- MEM_UNDEFINED(outparam->record[i], share->reclength);
+ MEM_NOACCESS(outparam->record[i] + share->reclength,
+ share->rec_buff_length - share->reclength);
if (!(field_ptr = (Field **) alloc_root(&outparam->mem_root,
(uint) ((share->fields+1)*
@@ -5160,6 +5161,8 @@ void TABLE::init(THD *thd, TABLE_LIST *tl)
fulltext_searched= 0;
file->ft_handler= 0;
reginfo.impossible_range= 0;
+ reginfo.join_tab= NULL;
+ reginfo.not_exists_optimize= FALSE;
created= TRUE;
cond_selectivity= 1.0;
cond_selectivity_sampling_explain= NULL;
@@ -9698,10 +9701,10 @@ bool TABLE::export_structure(THD *thd, Row_definition_list *defs)
void TABLE::initialize_quick_structures()
{
- bzero(quick_rows, sizeof(quick_rows));
- bzero(quick_key_parts, sizeof(quick_key_parts));
- bzero(quick_costs, sizeof(quick_costs));
- bzero(quick_n_ranges, sizeof(quick_n_ranges));
+ TRASH_ALLOC(quick_rows, sizeof(quick_rows));
+ TRASH_ALLOC(quick_key_parts, sizeof(quick_key_parts));
+ TRASH_ALLOC(quick_costs, sizeof(quick_costs));
+ TRASH_ALLOC(quick_n_ranges, sizeof(quick_n_ranges));
}
/*
diff --git a/sql/table.h b/sql/table.h
index bd8f88e47fa..ea9f87b65ed 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -3032,9 +3032,11 @@ typedef struct st_nested_join
Before each use the counters are zeroed by reset_nj_counters.
*/
uint counter;
+
/*
- Number of elements in join_list that were not (or contain table(s) that
- weren't) removed by table elimination.
+ Number of elements in join_list that participate in the join plan choice:
+ - Base tables that were not removed by table elimination
+ - Join nests that were not removed by mark_join_nest_as_const
*/
uint n_tables;
nested_join_map nj_map; /* Bit used to identify this nested join*/
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 7990a67081e..beb754ed852 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -477,8 +477,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table,
pos+= create_info->comment.length;
}
- memcpy(frm_ptr + filepos, forminfo, 288);
- pos= frm_ptr + filepos + 288;
+ memcpy(frm_ptr + filepos, forminfo, FRM_FORMINFO_SIZE);
+ pos= frm_ptr + filepos + FRM_FORMINFO_SIZE;
if (pack_fields(&pos, create_fields, create_info, data_offset))
goto err;
diff --git a/sql/winservice.c b/sql/winservice.c
index 3c9d07822be..c275e6d99c8 100644
--- a/sql/winservice.c
+++ b/sql/winservice.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2011, 2012, Monty Program Ab
+ Copyright (c) 2011, 2020, 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
@@ -148,13 +148,10 @@ int get_mysql_service_properties(const wchar_t *bin_path,
{
/*
There are rare cases where service config does not have
- --defaults-file in the binary parth . There services were
+ --defaults-file in the binary path . There services were
registered with plain mysqld --install, the data directory is
- next to "bin" in this case. Service name (second parameter)
- must be MySQL.
+ next to "bin" in this case.
*/
- if (wcscmp(args[1], L"MySQL") != 0)
- goto end;
have_inifile= FALSE;
}
else if(numargs == 3)
@@ -212,7 +209,7 @@ int get_mysql_service_properties(const wchar_t *bin_path,
}
}
- if(!have_inifile)
+ if(!have_inifile || props->datadir[0] == 0)
{
/*
Hard, although a rare case, we're guessing datadir and defaults-file.
@@ -236,22 +233,25 @@ int get_mysql_service_properties(const wchar_t *bin_path,
*p= 0;
}
- /* Look for my.ini, my.cnf in the install root */
- sprintf_s(props->inifile, MAX_PATH, "%s\\my.ini", install_root);
- if (GetFileAttributes(props->inifile) == INVALID_FILE_ATTRIBUTES)
- {
- sprintf_s(props->inifile, MAX_PATH, "%s\\my.cnf", install_root);
- }
- if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES)
- {
- /* Ini file found, get datadir from there */
- GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir,
- MAX_PATH, props->inifile);
- }
- else
+ if (!have_inifile)
{
- /* No ini file */
- props->inifile[0]= 0;
+ /* Look for my.ini, my.cnf in the install root */
+ sprintf_s(props->inifile, MAX_PATH, "%s\\my.ini", install_root);
+ if (GetFileAttributes(props->inifile) == INVALID_FILE_ATTRIBUTES)
+ {
+ sprintf_s(props->inifile, MAX_PATH, "%s\\my.cnf", install_root);
+ }
+ if (GetFileAttributes(props->inifile) != INVALID_FILE_ATTRIBUTES)
+ {
+ /* Ini file found, get datadir from there */
+ GetPrivateProfileString("mysqld", "datadir", NULL, props->datadir,
+ MAX_PATH, props->inifile);
+ }
+ else
+ {
+ /* No ini file */
+ props->inifile[0]= 0;
+ }
}
/* Try datadir in install directory.*/
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 97dac17a158..8c657bc341b 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -1314,10 +1314,10 @@ btr_cur_search_to_nth_level_func(
ut_ad(!(index->type & DICT_FTS));
ut_ad(index->page != FIL_NULL);
- UNIV_MEM_INVALID(&cursor->up_match, sizeof cursor->up_match);
- UNIV_MEM_INVALID(&cursor->up_bytes, sizeof cursor->up_bytes);
- UNIV_MEM_INVALID(&cursor->low_match, sizeof cursor->low_match);
- UNIV_MEM_INVALID(&cursor->low_bytes, sizeof cursor->low_bytes);
+ MEM_UNDEFINED(&cursor->up_match, sizeof cursor->up_match);
+ MEM_UNDEFINED(&cursor->up_bytes, sizeof cursor->up_bytes);
+ MEM_UNDEFINED(&cursor->low_match, sizeof cursor->low_match);
+ MEM_UNDEFINED(&cursor->low_bytes, sizeof cursor->low_bytes);
#ifdef UNIV_DEBUG
cursor->up_match = ULINT_UNDEFINED;
cursor->low_match = ULINT_UNDEFINED;
@@ -3424,13 +3424,12 @@ btr_cur_optimistic_insert(
|| (flags & BTR_CREATE_FLAG));
ut_ad(dtuple_check_typed(entry));
-#ifdef UNIV_DEBUG_VALGRIND
+#ifdef HAVE_valgrind
if (block->page.zip.data) {
- UNIV_MEM_ASSERT_RW(page, srv_page_size);
- UNIV_MEM_ASSERT_RW(block->page.zip.data,
- block->zip_size());
+ MEM_CHECK_DEFINED(page, srv_page_size);
+ MEM_CHECK_DEFINED(block->page.zip.data, block->zip_size());
}
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* HAVE_valgrind */
leaf = page_is_leaf(page);
@@ -5092,6 +5091,11 @@ btr_cur_pessimistic_update(
btr_page_reorganize(page_cursor, index, mtr);
rec = page_cursor->rec;
rec_offs_make_valid(rec, index, true, *offsets);
+ if (page_cursor->block->page.id.page_no()
+ == index->page) {
+ btr_set_instant(page_cursor->block, *index,
+ mtr);
+ }
} else if (!dict_table_is_locking_disabled(index->table)) {
lock_rec_restore_from_page_infimum(
btr_cur_get_block(cursor), rec, block);
@@ -7583,9 +7587,7 @@ btr_store_big_rec_extern_fields(
BTR_EXTERN_FIELD_REF_SIZE));
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
extern_len = big_rec_vec->fields[i].len;
- UNIV_MEM_ASSERT_RW(big_rec_vec->fields[i].data,
- extern_len);
-
+ MEM_CHECK_DEFINED(big_rec_vec->fields[i].data, extern_len);
ut_a(extern_len > 0);
prev_page_no = FIL_NULL;
@@ -8256,7 +8258,7 @@ btr_copy_blob_prefix(
mtr_commit(&mtr);
if (page_no == FIL_NULL || copy_len != part_len) {
- UNIV_MEM_ASSERT_RW(buf, copied_len);
+ MEM_CHECK_DEFINED(buf, copied_len);
return(copied_len);
}
@@ -8412,7 +8414,7 @@ end_of_blob:
func_exit:
inflateEnd(&d_stream);
mem_heap_free(heap);
- UNIV_MEM_ASSERT_RW(buf, d_stream.total_out);
+ MEM_CHECK_DEFINED(buf, d_stream.total_out);
return(d_stream.total_out);
}
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index 27b5eb33c61..c92659e9d71 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -1341,7 +1341,6 @@ btr_search_build_page_hash_index(
ulint n_recs;
ulint* folds;
const rec_t** recs;
- ulint i;
mem_heap_t* heap = NULL;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
@@ -1478,20 +1477,12 @@ btr_search_build_page_hash_index(
btr_search_check_free_space_in_heap(index);
- hash_table_t* table = btr_get_search_table(index);
rw_lock_x_lock(ahi_latch);
if (!btr_search_enabled) {
goto exit_func;
}
- table = btr_get_search_table(index);
- if (block->index && ((block->curr_n_fields != n_fields)
- || (block->curr_n_bytes != n_bytes)
- || (block->curr_left_side != left_side))) {
- goto exit_func;
- }
-
/* This counter is decremented every time we drop page
hash index entries and is incremented here. Since we can
rebuild hash index for a page that is already hashed, we
@@ -1500,6 +1491,10 @@ btr_search_build_page_hash_index(
if (!block->index) {
assert_block_ahi_empty(block);
index->search_info->ref_count++;
+ } else if (block->curr_n_fields != n_fields
+ || block->curr_n_bytes != n_bytes
+ || block->curr_left_side != left_side) {
+ goto exit_func;
}
block->n_hash_helps = 0;
@@ -1509,9 +1504,11 @@ btr_search_build_page_hash_index(
block->curr_left_side = unsigned(left_side);
block->index = index;
- for (i = 0; i < n_cached; i++) {
-
- ha_insert_for_fold(table, folds[i], block, recs[i]);
+ {
+ hash_table_t* table = btr_get_search_table(index);
+ for (ulint i = 0; i < n_cached; i++) {
+ ha_insert_for_fold(table, folds[i], block, recs[i]);
+ }
}
MONITOR_INC(MONITOR_ADAPTIVE_HASH_PAGE_ADDED);
diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc
index 7a7c3189add..65ef42ef13e 100644
--- a/storage/innobase/buf/buf0buddy.cc
+++ b/storage/innobase/buf/buf0buddy.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2018, 2019, MariaDB Corporation.
+Copyright (c) 2018, 2020, 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
@@ -81,7 +81,6 @@ enum buf_buddy_state_t {
are in use */
};
-#ifdef UNIV_DEBUG_VALGRIND
/**********************************************************************//**
Invalidate memory area that we won't access while page is free */
UNIV_INLINE
@@ -91,15 +90,11 @@ buf_buddy_mem_invalid(
buf_buddy_free_t* buf, /*!< in: block to check */
ulint i) /*!< in: index of zip_free[] */
{
- const size_t size = BUF_BUDDY_LOW << i;
- ut_ad(i <= BUF_BUDDY_SIZES);
+ ut_ad(i <= BUF_BUDDY_SIZES);
- UNIV_MEM_ASSERT_W(buf, size);
- UNIV_MEM_INVALID(buf, size);
+ MEM_CHECK_ADDRESSABLE(buf, BUF_BUDDY_LOW << i);
+ MEM_UNDEFINED(buf, BUF_BUDDY_LOW << i);
}
-#else /* UNIV_DEBUG_VALGRIND */
-# define buf_buddy_mem_invalid(buf, i) ut_ad((i) <= BUF_BUDDY_SIZES)
-#endif /* UNIV_DEBUG_VALGRIND */
/**********************************************************************//**
Check if a buddy is stamped free.
@@ -357,11 +352,10 @@ buf_buddy_alloc_zip(
if (buf) {
/* Trash the page other than the BUF_BUDDY_STAMP_NONFREE. */
- UNIV_MEM_TRASH((void*) buf, ~i, BUF_BUDDY_STAMP_OFFSET);
- UNIV_MEM_TRASH(BUF_BUDDY_STAMP_OFFSET + 4
- + buf->stamp.bytes, ~i,
- (BUF_BUDDY_LOW << i)
- - (BUF_BUDDY_STAMP_OFFSET + 4));
+ MEM_UNDEFINED(buf, BUF_BUDDY_STAMP_OFFSET);
+ MEM_UNDEFINED(BUF_BUDDY_STAMP_OFFSET + 4 + buf->stamp.bytes,
+ (BUF_BUDDY_LOW << i)
+ - (BUF_BUDDY_STAMP_OFFSET + 4));
ut_ad(mach_read_from_4(buf->stamp.bytes
+ BUF_BUDDY_STAMP_OFFSET)
== BUF_BUDDY_STAMP_NONFREE);
@@ -399,7 +393,7 @@ buf_buddy_block_free(
HASH_DELETE(buf_page_t, hash, buf_pool->zip_hash, fold, bpage);
ut_d(memset(buf, 0, srv_page_size));
- UNIV_MEM_INVALID(buf, srv_page_size);
+ MEM_UNDEFINED(buf, srv_page_size);
block = (buf_block_t*) bpage;
buf_page_mutex_enter(block);
@@ -555,17 +549,16 @@ buf_buddy_relocate(
ut_ad(!ut_align_offset(src, size));
ut_ad(!ut_align_offset(dst, size));
ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN));
- UNIV_MEM_ASSERT_W(dst, size);
+ MEM_CHECK_ADDRESSABLE(dst, size);
space = mach_read_from_4((const byte*) src
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
offset = mach_read_from_4((const byte*) src
+ FIL_PAGE_OFFSET);
- /* Suppress Valgrind warnings about conditional jump
- on uninitialized value. */
- UNIV_MEM_VALID(&space, sizeof space);
- UNIV_MEM_VALID(&offset, sizeof offset);
+ /* Suppress Valgrind or MSAN warnings. */
+ MEM_MAKE_DEFINED(&space, sizeof space);
+ MEM_MAKE_DEFINED(&offset, sizeof offset);
ut_ad(space != BUF_BUDDY_STAMP_FREE);
@@ -627,7 +620,7 @@ buf_buddy_relocate(
/* The block must have been allocated, but it may
contain uninitialized data. */
- UNIV_MEM_ASSERT_W(src, size);
+ MEM_CHECK_ADDRESSABLE(src, size);
BPageMutex* block_mutex = buf_page_get_mutex(bpage);
@@ -682,7 +675,7 @@ buf_buddy_free_low(
buf_pool->buddy_stat[i].used--;
recombine:
- UNIV_MEM_ALLOC(buf, BUF_BUDDY_LOW << i);
+ MEM_UNDEFINED(buf, BUF_BUDDY_LOW << i);
if (i == BUF_BUDDY_SIZES) {
buf_buddy_block_free(buf_pool, buf);
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index e44110e1387..3bdc6f3eecf 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -1531,8 +1531,6 @@ buf_block_init(
buf_block_t* block, /*!< in: pointer to control block */
byte* frame) /*!< in: pointer to buffer frame */
{
- UNIV_MEM_DESC(frame, srv_page_size);
-
/* This function should only be executed at database startup or by
buf_pool_resize(). Either way, adaptive hash index must not exist. */
assert_block_ahi_empty_on_init(block);
@@ -1624,6 +1622,8 @@ buf_chunk_init(
return(NULL);
}
+ MEM_MAKE_ADDRESSABLE(chunk->mem, chunk->mem_size());
+
#ifdef HAVE_LIBNUMA
if (srv_numa_interleave) {
struct bitmask *numa_mems_allowed = numa_get_mems_allowed();
@@ -1676,7 +1676,7 @@ buf_chunk_init(
for (i = chunk->size; i--; ) {
buf_block_init(buf_pool, block, frame);
- UNIV_MEM_INVALID(block->frame, srv_page_size);
+ MEM_UNDEFINED(block->frame, srv_page_size);
/* Add the block to the free list */
UT_LIST_ADD_LAST(buf_pool->free, &block->page);
@@ -2202,8 +2202,6 @@ buf_page_realloc(
if (block->page.zip.data != NULL) {
ut_ad(block->in_unzip_LRU_list);
ut_d(new_block->in_unzip_LRU_list = TRUE);
- UNIV_MEM_DESC(&new_block->page.zip.data,
- page_zip_get_size(&new_block->page.zip));
buf_block_t* prev_block = UT_LIST_GET_PREV(unzip_LRU, block);
UT_LIST_REMOVE(buf_pool->unzip_LRU, block);
@@ -2237,7 +2235,7 @@ buf_page_realloc(
buf_block_modify_clock_inc(block);
memset(block->frame + FIL_PAGE_OFFSET, 0xff, 4);
memset(block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xff, 4);
- UNIV_MEM_INVALID(block->frame, srv_page_size);
+ MEM_UNDEFINED(block->frame, srv_page_size);
buf_block_set_state(block, BUF_BLOCK_REMOVE_HASH);
block->page.id
= page_id_t(ULINT32_UNDEFINED, ULINT32_UNDEFINED);
@@ -2892,6 +2890,22 @@ withdraw_retry:
while (chunk < echunk) {
buf_block_t* block = chunk->blocks;
+ /* buf_LRU_block_free_non_file_page()
+ invokes MEM_NOACCESS() on any blocks
+ that are in free_list. We must
+ cancel the effect of that. In MemorySanitizer,
+ MEM_NOACCESS() is no-op, so we must not do
+ anything special for it here. */
+#ifdef HAVE_valgrind
+# if !__has_feature(memory_sanitizer)
+ MEM_MAKE_DEFINED(chunk->mem,
+ chunk->mem_size());
+# endif
+#else
+ MEM_MAKE_ADDRESSABLE(chunk->mem,
+ chunk->mem_size());
+#endif
+
for (ulint j = chunk->size;
j--; block++) {
buf_block_free_mutexes(block);
@@ -4640,9 +4654,6 @@ evict_from_pool:
block->lock_hash_val = lock_rec_hash(page_id.space(),
page_id.page_no());
- UNIV_MEM_DESC(&block->page.zip.data,
- page_zip_get_size(&block->page.zip));
-
if (buf_page_get_state(&block->page) == BUF_BLOCK_ZIP_PAGE) {
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
UT_LIST_REMOVE(buf_pool->zip_clean, &block->page);
@@ -4664,7 +4675,7 @@ evict_from_pool:
buf_block_set_io_fix(block, BUF_IO_READ);
rw_lock_x_lock_inline(&block->lock, 0, file, line);
- UNIV_MEM_INVALID(bpage, sizeof *bpage);
+ MEM_UNDEFINED(bpage, sizeof *bpage);
rw_lock_x_unlock(hash_lock);
buf_pool->n_pend_unzip++;
@@ -5283,15 +5294,6 @@ buf_page_init(
/* Set the state of the block */
buf_block_set_file_page(block, page_id);
-#ifdef UNIV_DEBUG_VALGRIND
- if (is_system_tablespace(page_id.space())) {
- /* Silence valid Valgrind warnings about uninitialized
- data being written to data files. There are some unused
- bytes on some pages that InnoDB does not initialize. */
- UNIV_MEM_VALID(block->frame, srv_page_size);
- }
-#endif /* UNIV_DEBUG_VALGRIND */
-
buf_block_init_low(block);
block->lock_hash_val = lock_rec_hash(page_id.space(),
@@ -5512,7 +5514,6 @@ buf_page_init_for_read(
bpage->zip.data = (page_zip_t*) data;
mutex_enter(&buf_pool->zip_mutex);
- UNIV_MEM_DESC(bpage->zip.data, zip_size);
buf_page_init_low(bpage);
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index 55400136c4a..9c1b305fb6a 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -1149,14 +1149,13 @@ try_again:
void * frame = buf_page_get_frame(bpage);
if (auto zip_size = bpage->zip_size()) {
- UNIV_MEM_ASSERT_RW(bpage->zip.data, zip_size);
+ MEM_CHECK_DEFINED(bpage->zip.data, zip_size);
/* Copy the compressed page and clear the rest. */
memcpy(p, frame, zip_size);
memset(p + zip_size, 0x0, srv_page_size - zip_size);
} else {
ut_a(buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
-
- UNIV_MEM_ASSERT_RW(frame, srv_page_size);
+ MEM_CHECK_DEFINED(frame, srv_page_size);
memcpy(p, frame, srv_page_size);
}
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 77cb4517807..616885ed863 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -431,9 +431,9 @@ buf_flush_insert_into_flush_list(
ut_d(block->page.in_flush_list = TRUE);
ut_ad(!block->page.oldest_modification);
block->page.oldest_modification = lsn;
- UNIV_MEM_ASSERT_RW(block->page.zip.data
- ? block->page.zip.data : block->frame,
- block->physical_size());
+ MEM_CHECK_DEFINED(block->page.zip.data
+ ? block->page.zip.data : block->frame,
+ block->physical_size());
incr_flush_list_size_in_bytes(block, buf_pool);
if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) {
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc
index 59986fbca00..fd49fa2f761 100644
--- a/storage/innobase/buf/buf0lru.cc
+++ b/storage/innobase/buf/buf0lru.cc
@@ -806,7 +806,7 @@ buf_LRU_get_free_only(
assert_block_ahi_empty(block);
buf_block_set_state(block, BUF_BLOCK_READY_FOR_USE);
- UNIV_MEM_ALLOC(block->frame, srv_page_size);
+ MEM_MAKE_ADDRESSABLE(block->frame, srv_page_size);
ut_ad(buf_pool_from_block(block) == buf_pool);
@@ -1503,8 +1503,6 @@ func_exit:
ut_ad(b->zip_size());
- UNIV_MEM_DESC(b->zip.data, b->zip_size());
-
/* The fields in_page_hash and in_LRU_list of
the to-be-freed block descriptor should have
been cleared in
@@ -1604,17 +1602,16 @@ func_exit:
The page was declared uninitialized by
buf_LRU_block_remove_hashed(). We need to flag
the contents of the page valid (which it still is) in
- order to avoid bogus Valgrind warnings.*/
+ order to avoid bogus Valgrind or MSAN warnings.*/
+ buf_block_t* block = reinterpret_cast<buf_block_t*>(bpage);
- UNIV_MEM_VALID(((buf_block_t*) bpage)->frame,
- srv_page_size);
- btr_search_drop_page_hash_index((buf_block_t*) bpage);
- UNIV_MEM_INVALID(((buf_block_t*) bpage)->frame,
- srv_page_size);
+ MEM_MAKE_DEFINED(block->frame, srv_page_size);
+ btr_search_drop_page_hash_index(block);
+ MEM_UNDEFINED(block->frame, srv_page_size);
buf_pool_mutex_enter(buf_pool);
- if (b != NULL) {
+ if (b) {
mutex_enter(block_mutex);
buf_page_unset_sticky(b);
@@ -1622,7 +1619,7 @@ func_exit:
mutex_exit(block_mutex);
}
- buf_LRU_block_free_hashed_page((buf_block_t*) bpage);
+ buf_LRU_block_free_hashed_page(block);
return(true);
}
@@ -1655,15 +1652,10 @@ buf_LRU_block_free_non_file_page(
buf_block_set_state(block, BUF_BLOCK_NOT_USED);
- UNIV_MEM_ALLOC(block->frame, srv_page_size);
-#ifdef UNIV_DEBUG
- /* Wipe contents of page to reveal possible stale pointers to it */
- memset(block->frame, '\0', srv_page_size);
-#else
+ MEM_UNDEFINED(block->frame, srv_page_size);
/* Wipe page_no and space_id */
memset(block->frame + FIL_PAGE_OFFSET, 0xfe, 4);
memset(block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xfe, 4);
-#endif /* UNIV_DEBUG */
data = block->page.zip.data;
if (data != NULL) {
@@ -1694,7 +1686,7 @@ buf_LRU_block_free_non_file_page(
ut_d(block->page.in_free_list = TRUE);
}
- UNIV_MEM_FREE(block->frame, srv_page_size);
+ MEM_NOACCESS(block->frame, srv_page_size);
}
/******************************************************************//**
@@ -1741,9 +1733,9 @@ buf_LRU_block_remove_hashed(
switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_FILE_PAGE:
- UNIV_MEM_ASSERT_W(bpage, sizeof(buf_block_t));
- UNIV_MEM_ASSERT_W(((buf_block_t*) bpage)->frame,
- srv_page_size);
+ MEM_CHECK_ADDRESSABLE(bpage, sizeof(buf_block_t));
+ MEM_CHECK_ADDRESSABLE(((buf_block_t*) bpage)->frame,
+ srv_page_size);
buf_block_modify_clock_inc((buf_block_t*) bpage);
if (bpage->zip.data) {
const page_t* page = ((buf_block_t*) bpage)->frame;
@@ -1797,7 +1789,7 @@ buf_LRU_block_remove_hashed(
/* fall through */
case BUF_BLOCK_ZIP_PAGE:
ut_a(bpage->oldest_modification == 0);
- UNIV_MEM_ASSERT_W(bpage->zip.data, bpage->zip_size());
+ MEM_CHECK_ADDRESSABLE(bpage->zip.data, bpage->zip_size());
break;
case BUF_BLOCK_POOL_WATCH:
case BUF_BLOCK_ZIP_DIRTY:
@@ -1849,8 +1841,7 @@ buf_LRU_block_remove_hashed(
+ FIL_PAGE_OFFSET, 0xff, 4);
memset(((buf_block_t*) bpage)->frame
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xff, 4);
- UNIV_MEM_INVALID(((buf_block_t*) bpage)->frame,
- srv_page_size);
+ MEM_UNDEFINED(((buf_block_t*) bpage)->frame, srv_page_size);
buf_page_set_state(bpage, BUF_BLOCK_REMOVE_HASH);
/* Question: If we release bpage and hash mutex here
diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc
index 7cc9c2bc09e..03c471c35fb 100644
--- a/storage/innobase/data/data0data.cc
+++ b/storage/innobase/data/data0data.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -233,41 +233,20 @@ dtuple_validate(
/*============*/
const dtuple_t* tuple) /*!< in: tuple */
{
- const dfield_t* field;
- ulint n_fields;
- ulint len;
- ulint i;
-
ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N);
+#ifdef HAVE_valgrind
+ const ulint n_fields = dtuple_get_n_fields(tuple);
- n_fields = dtuple_get_n_fields(tuple);
-
- /* We dereference all the data of each field to test
- for memory traps */
-
- for (i = 0; i < n_fields; i++) {
-
- field = dtuple_get_nth_field(tuple, i);
- len = dfield_get_len(field);
+ for (ulint i = 0; i < n_fields; i++) {
+ const dfield_t* field = dtuple_get_nth_field(tuple, i);
if (!dfield_is_null(field)) {
-
- const byte* data;
-
- data = static_cast<const byte*>(dfield_get_data(field));
-#ifndef UNIV_DEBUG_VALGRIND
- ulint j;
-
- for (j = 0; j < len; j++) {
- data++;
- }
-#endif /* !UNIV_DEBUG_VALGRIND */
-
- UNIV_MEM_ASSERT_RW(data, len);
+ MEM_CHECK_DEFINED(dfield_get_data(field),
+ dfield_get_len(field));
}
}
-
- ut_a(dtuple_check_typed(tuple));
+#endif /* HAVE_valgrind */
+ ut_ad(dtuple_check_typed(tuple));
return(TRUE);
}
@@ -746,14 +725,7 @@ ext_write:
memcpy(data, dfield_get_data(dfield), local_prefix_len);
/* Clear the extern field reference (BLOB pointer). */
memset(data + local_prefix_len, 0, BTR_EXTERN_FIELD_REF_SIZE);
-#if 0
- /* The following would fail the Valgrind checks in
- page_cur_insert_rec_low() and page_cur_insert_rec_zip().
- The BLOB pointers in the record will be initialized after
- the record and the BLOBs have been written. */
- UNIV_MEM_ALLOC(data + local_prefix_len,
- BTR_EXTERN_FIELD_REF_SIZE);
-#endif
+
dfield_set_data(dfield, data, local_len);
dfield_set_ext(dfield);
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index bd60ceb48bb..3a4730f0d2c 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -409,7 +409,7 @@ dict_stats_table_clone_create(
t = (dict_table_t*) mem_heap_alloc(heap, sizeof(*t));
- UNIV_MEM_ASSERT_RW_ABORT(&table->id, sizeof(table->id));
+ MEM_CHECK_DEFINED(&table->id, sizeof(table->id));
t->id = table->id;
t->heap = heap;
@@ -437,7 +437,7 @@ dict_stats_table_clone_create(
idx = (dict_index_t*) mem_heap_alloc(heap, sizeof(*idx));
- UNIV_MEM_ASSERT_RW_ABORT(&index->id, sizeof(index->id));
+ MEM_CHECK_DEFINED(&index->id, sizeof(index->id));
idx->id = index->id;
idx->name = mem_heap_strdup(heap, index->name);
@@ -583,23 +583,23 @@ dict_stats_assert_initialized_index(
/*================================*/
const dict_index_t* index) /*!< in: index */
{
- UNIV_MEM_ASSERT_RW_ABORT(
+ MEM_CHECK_DEFINED(
index->stat_n_diff_key_vals,
index->n_uniq * sizeof(index->stat_n_diff_key_vals[0]));
- UNIV_MEM_ASSERT_RW_ABORT(
+ MEM_CHECK_DEFINED(
index->stat_n_sample_sizes,
index->n_uniq * sizeof(index->stat_n_sample_sizes[0]));
- UNIV_MEM_ASSERT_RW_ABORT(
+ MEM_CHECK_DEFINED(
index->stat_n_non_null_key_vals,
index->n_uniq * sizeof(index->stat_n_non_null_key_vals[0]));
- UNIV_MEM_ASSERT_RW_ABORT(
+ MEM_CHECK_DEFINED(
&index->stat_index_size,
sizeof(index->stat_index_size));
- UNIV_MEM_ASSERT_RW_ABORT(
+ MEM_CHECK_DEFINED(
&index->stat_n_leaf_pages,
sizeof(index->stat_n_leaf_pages));
}
@@ -614,32 +614,32 @@ dict_stats_assert_initialized(
{
ut_a(table->stat_initialized);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stats_last_recalc,
- sizeof(table->stats_last_recalc));
+ MEM_CHECK_DEFINED(&table->stats_last_recalc,
+ sizeof table->stats_last_recalc);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stat_persistent,
- sizeof(table->stat_persistent));
+ MEM_CHECK_DEFINED(&table->stat_persistent,
+ sizeof table->stat_persistent);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stats_auto_recalc,
- sizeof(table->stats_auto_recalc));
+ MEM_CHECK_DEFINED(&table->stats_auto_recalc,
+ sizeof table->stats_auto_recalc);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stats_sample_pages,
- sizeof(table->stats_sample_pages));
+ MEM_CHECK_DEFINED(&table->stats_sample_pages,
+ sizeof table->stats_sample_pages);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stat_n_rows,
- sizeof(table->stat_n_rows));
+ MEM_CHECK_DEFINED(&table->stat_n_rows,
+ sizeof table->stat_n_rows);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stat_clustered_index_size,
- sizeof(table->stat_clustered_index_size));
+ MEM_CHECK_DEFINED(&table->stat_clustered_index_size,
+ sizeof table->stat_clustered_index_size);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stat_sum_of_other_index_sizes,
- sizeof(table->stat_sum_of_other_index_sizes));
+ MEM_CHECK_DEFINED(&table->stat_sum_of_other_index_sizes,
+ sizeof table->stat_sum_of_other_index_sizes);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stat_modified_counter,
- sizeof(table->stat_modified_counter));
+ MEM_CHECK_DEFINED(&table->stat_modified_counter,
+ sizeof table->stat_modified_counter);
- UNIV_MEM_ASSERT_RW_ABORT(&table->stats_bg_flag,
- sizeof(table->stats_bg_flag));
+ MEM_CHECK_DEFINED(&table->stats_bg_flag,
+ sizeof table->stats_bg_flag);
for (dict_index_t* index = dict_table_get_first_index(table);
index != NULL;
@@ -2303,20 +2303,19 @@ dict_stats_save_index_stat(
pars_info_add_str_literal(pinfo, "database_name", db_utf8);
pars_info_add_str_literal(pinfo, "table_name", table_utf8);
pars_info_add_str_literal(pinfo, "index_name", index->name);
- UNIV_MEM_ASSERT_RW_ABORT(&last_update, 4);
+ MEM_CHECK_DEFINED(&last_update, 4);
pars_info_add_int4_literal(pinfo, "last_update", uint32(last_update));
- UNIV_MEM_ASSERT_RW_ABORT(stat_name, strlen(stat_name));
+ MEM_CHECK_DEFINED(stat_name, strlen(stat_name));
pars_info_add_str_literal(pinfo, "stat_name", stat_name);
- UNIV_MEM_ASSERT_RW_ABORT(&stat_value, 8);
+ MEM_CHECK_DEFINED(&stat_value, 8);
pars_info_add_ull_literal(pinfo, "stat_value", stat_value);
if (sample_size != NULL) {
- UNIV_MEM_ASSERT_RW_ABORT(sample_size, 8);
+ MEM_CHECK_DEFINED(sample_size, 8);
pars_info_add_ull_literal(pinfo, "sample_size", *sample_size);
} else {
pars_info_add_literal(pinfo, "sample_size", NULL,
UNIV_SQL_NULL, DATA_FIXBINARY, 0);
}
- UNIV_MEM_ASSERT_RW_ABORT(stat_description, strlen(stat_description));
pars_info_add_str_literal(pinfo, "stat_description",
stat_description);
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 88a1e175dd5..90a6a49a006 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -2212,7 +2212,8 @@ static ulint fil_check_pending_ops(const fil_space_t* space, ulint count)
if (ulint n_pending_ops = space->n_pending_ops) {
- if (count > 5000) {
+ /* Give a warning every 10 second, starting after 1 second */
+ if ((count % 500) == 50) {
ib::warn() << "Trying to delete"
" tablespace '" << space->name
<< "' but there are " << n_pending_ops
@@ -4559,10 +4560,20 @@ struct Check {
Check check;
ut_list_validate(space->chain, check);
ut_a(space->size == check.size);
- ut_ad(space->id != TRX_SYS_SPACE
- || space == fil_system.sys_space);
- ut_ad(space->id != SRV_TMP_SPACE_ID
- || space == fil_system.temp_space);
+
+ switch (space->id) {
+ case TRX_SYS_SPACE:
+ ut_ad(fil_system.sys_space == NULL
+ || fil_system.sys_space == space);
+ break;
+ case SRV_TMP_SPACE_ID:
+ ut_ad(fil_system.temp_space == NULL
+ || fil_system.temp_space == space);
+ break;
+ default:
+ break;
+ }
+
return(check.n_open);
}
};
@@ -4574,24 +4585,15 @@ bool
fil_validate(void)
/*==============*/
{
- fil_space_t* space;
fil_node_t* fil_node;
ulint n_open = 0;
mutex_enter(&fil_system.mutex);
- /* Look for spaces in the hash table */
-
- for (ulint i = 0; i < hash_get_n_cells(fil_system.spaces); i++) {
-
- for (space = static_cast<fil_space_t*>(
- HASH_GET_FIRST(fil_system.spaces, i));
- space != 0;
- space = static_cast<fil_space_t*>(
- HASH_GET_NEXT(hash, space))) {
-
- n_open += Check::validate(space);
- }
+ for (fil_space_t *space = UT_LIST_GET_FIRST(fil_system.space_list);
+ space != NULL;
+ space = UT_LIST_GET_NEXT(space_list, space)) {
+ n_open += Check::validate(space);
}
ut_a(fil_system.n_open == n_open);
diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc
index c1772c359ea..fd5ac3c368f 100644
--- a/storage/innobase/fsp/fsp0sysspace.cc
+++ b/storage/innobase/fsp/fsp0sysspace.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2016, 2020, 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
@@ -904,18 +905,26 @@ SysTablespace::open_or_create(
} else if (is_temp) {
ut_ad(!fil_system.temp_space);
ut_ad(space_id() == SRV_TMP_SPACE_ID);
- space = fil_system.temp_space = fil_space_create(
+ space = fil_space_create(
name(), SRV_TMP_SPACE_ID, flags(),
FIL_TYPE_TEMPORARY, NULL);
+
+ mutex_enter(&fil_system.mutex);
+ fil_system.temp_space = space;
+ mutex_exit(&fil_system.mutex);
if (!space) {
return DB_ERROR;
}
} else {
ut_ad(!fil_system.sys_space);
ut_ad(space_id() == TRX_SYS_SPACE);
- space = fil_system.sys_space = fil_space_create(
+ space = fil_space_create(
name(), TRX_SYS_SPACE, it->flags(),
FIL_TYPE_TABLESPACE, NULL);
+
+ mutex_enter(&fil_system.mutex);
+ fil_system.sys_space = space;
+ mutex_exit(&fil_system.mutex);
if (!space) {
return DB_ERROR;
}
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 6963ab4f007..199941e71f8 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -804,6 +804,29 @@ fts_check_cached_index(
return(TRUE);
}
+/** Clear all fts resources when there is no internal DOC_ID
+and there are no new fts index to add.
+@param[in,out] table table where fts is to be freed
+@param[in] trx transaction to drop all fts tables */
+void fts_clear_all(dict_table_t *table, trx_t *trx)
+{
+ if (DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID) ||
+ !table->fts ||
+ !ib_vector_is_empty(table->fts->indexes))
+ return;
+
+ for (const dict_index_t *index= dict_table_get_first_index(table);
+ index; index= dict_table_get_next_index(index))
+ if (index->type & DICT_FTS)
+ return;
+
+ fts_optimize_remove_table(table);
+
+ fts_drop_tables(trx, table);
+ fts_free(table);
+ DICT_TF2_FLAG_UNSET(table, DICT_TF2_FTS);
+}
+
/*******************************************************************//**
Drop auxiliary tables related to an FTS index
@return DB_SUCCESS or error number */
@@ -820,9 +843,10 @@ fts_drop_index(
ut_a(indexes);
if ((ib_vector_size(indexes) == 1
- && (index == static_cast<dict_index_t*>(
- ib_vector_getp(table->fts->indexes, 0))))
- || ib_vector_is_empty(indexes)) {
+ && (index == static_cast<dict_index_t*>(
+ ib_vector_getp(table->fts->indexes, 0)))
+ && DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID))
+ || ib_vector_is_empty(indexes)) {
doc_id_t current_doc_id;
doc_id_t first_doc_id;
@@ -832,27 +856,6 @@ fts_drop_index(
DICT_TF2_FLAG_UNSET(table, DICT_TF2_FTS);
- /* If Doc ID column is not added internally by FTS index,
- we can drop all FTS auxiliary tables. Otherwise, we will
- need to keep some common table such as CONFIG table, so
- as to keep track of incrementing Doc IDs */
- if (!DICT_TF2_FLAG_IS_SET(
- table, DICT_TF2_FTS_HAS_DOC_ID)) {
-
- err = fts_drop_tables(trx, table);
-
- err = fts_drop_index_tables(trx, index);
-
- while (index->index_fts_syncing
- && !trx_is_interrupted(trx)) {
- DICT_BG_YIELD(trx);
- }
-
- fts_free(table);
-
- return(err);
- }
-
while (index->index_fts_syncing
&& !trx_is_interrupted(trx)) {
DICT_BG_YIELD(trx);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 06d63fbe84a..6056a863f8b 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -7333,7 +7333,7 @@ build_template_field(
ut_ad(clust_index->table == index->table);
templ = prebuilt->mysql_template + prebuilt->n_template++;
- UNIV_MEM_INVALID(templ, sizeof *templ);
+ MEM_UNDEFINED(templ, sizeof *templ);
templ->is_virtual = !field->stored_in_db();
if (!templ->is_virtual) {
@@ -8443,7 +8443,7 @@ calc_row_difference(
/* The field has changed */
ufield = uvect->fields + n_changed;
- UNIV_MEM_INVALID(ufield, sizeof *ufield);
+ MEM_UNDEFINED(ufield, sizeof *ufield);
/* Let us use a dummy dfield to make the conversion
from the MySQL column format to the InnoDB format */
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index bfb5aa3e66f..a217a6cfcac 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -10449,6 +10449,7 @@ commit_cache_norebuild(
dict_index_remove_from_cache(index->table, index);
}
+ fts_clear_all(ctx->old_table, trx);
trx_commit_for_mysql(trx);
}
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 9bc06ddc086..749e5102ad9 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -8563,7 +8563,7 @@ i_s_tablespaces_encryption_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
/* deny access to user without PROCESS_ACL privilege */
- if (check_global_access(thd, SUPER_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL)) {
DBUG_RETURN(0);
}
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index fdf1980df36..89d7c71b734 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -1783,7 +1783,7 @@ struct buf_block_t{
# define assert_block_ahi_empty(block) \
ut_a((block)->n_pointers == 0)
# define assert_block_ahi_empty_on_init(block) do { \
- UNIV_MEM_VALID(&(block)->n_pointers, sizeof (block)->n_pointers); \
+ MEM_MAKE_DEFINED(&(block)->n_pointers, sizeof (block)->n_pointers); \
assert_block_ahi_empty(block); \
} while (0)
# define assert_block_ahi_valid(block) \
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 31137ebf124..7d11e2b4cc0 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -824,7 +824,7 @@ buf_page_alloc_descriptor(void)
bpage = (buf_page_t*) ut_zalloc_nokey(sizeof *bpage);
ut_ad(bpage);
- UNIV_MEM_ALLOC(bpage, sizeof *bpage);
+ MEM_UNDEFINED(bpage, sizeof *bpage);
return(bpage);
}
diff --git a/storage/innobase/include/data0data.ic b/storage/innobase/include/data0data.ic
index 92be8f8c589..39ade7b1e09 100644
--- a/storage/innobase/include/data0data.ic
+++ b/storage/innobase/include/data0data.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -51,10 +51,6 @@ dfield_set_len(
ulint len) /*!< in: length or UNIV_SQL_NULL */
{
ut_ad(len != UNIV_SQL_DEFAULT);
-#ifdef UNIV_VALGRIND_DEBUG
- if (len != UNIV_SQL_NULL) UNIV_MEM_ASSERT_RW(field->data, len);
-#endif /* UNIV_VALGRIND_DEBUG */
-
field->ext = 0;
field->len = static_cast<unsigned int>(len);
}
@@ -97,9 +93,6 @@ dfield_set_data(
const void* data, /*!< in: data */
ulint len) /*!< in: length or UNIV_SQL_NULL */
{
-#ifdef UNIV_VALGRIND_DEBUG
- if (len != UNIV_SQL_NULL) UNIV_MEM_ASSERT_RW(data, len);
-#endif /* UNIV_VALGRIND_DEBUG */
field->data = (void*) data;
field->ext = 0;
field->len = static_cast<unsigned int>(len);
@@ -114,9 +107,7 @@ dfield_write_mbr(
dfield_t* field, /*!< in: field */
const double* mbr) /*!< in: data */
{
-#ifdef UNIV_VALGRIND_DEBUG
- if (len != UNIV_SQL_NULL) UNIV_MEM_ASSERT_RW(data, len);
-#endif /* UNIV_VALGRIND_DEBUG */
+ MEM_CHECK_DEFINED(mbr, sizeof *mbr);
field->ext = 0;
for (unsigned i = 0; i < SPDIMS * 2; i++) {
@@ -178,7 +169,7 @@ dfield_dup(
mem_heap_t* heap) /*!< in: memory heap where allocated */
{
if (!dfield_is_null(field)) {
- UNIV_MEM_ASSERT_RW(field->data, field->len);
+ MEM_CHECK_DEFINED(field->data, field->len);
field->data = mem_heap_dup(heap, field->data, field->len);
}
}
@@ -336,8 +327,9 @@ dtuple_create_from_mem(
}
}
#endif
- UNIV_MEM_ASSERT_W(tuple->fields, n_t_fields * sizeof *tuple->fields);
- UNIV_MEM_INVALID(tuple->fields, n_t_fields * sizeof *tuple->fields);
+ MEM_CHECK_ADDRESSABLE(tuple->fields, n_t_fields
+ * sizeof *tuple->fields);
+ MEM_UNDEFINED(tuple->fields, n_t_fields * sizeof *tuple->fields);
return(tuple);
}
diff --git a/storage/innobase/include/dict0stats.ic b/storage/innobase/include/dict0stats.ic
index 446d91f4c04..34e5aedb127 100644
--- a/storage/innobase/include/dict0stats.ic
+++ b/storage/innobase/include/dict0stats.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -187,41 +187,40 @@ dict_stats_deinit(
table->stat_initialized = FALSE;
-#ifdef UNIV_DEBUG_VALGRIND
- UNIV_MEM_INVALID(&table->stat_n_rows,
- sizeof(table->stat_n_rows));
- UNIV_MEM_INVALID(&table->stat_clustered_index_size,
- sizeof(table->stat_clustered_index_size));
- UNIV_MEM_INVALID(&table->stat_sum_of_other_index_sizes,
- sizeof(table->stat_sum_of_other_index_sizes));
- UNIV_MEM_INVALID(&table->stat_modified_counter,
- sizeof(table->stat_modified_counter));
+#ifdef HAVE_valgrind
+ MEM_UNDEFINED(&table->stat_n_rows, sizeof table->stat_n_rows);
+ MEM_UNDEFINED(&table->stat_clustered_index_size,
+ sizeof table->stat_clustered_index_size);
+ MEM_UNDEFINED(&table->stat_sum_of_other_index_sizes,
+ sizeof table->stat_sum_of_other_index_sizes);
+ MEM_UNDEFINED(&table->stat_modified_counter,
+ sizeof table->stat_modified_counter);
dict_index_t* index;
for (index = dict_table_get_first_index(table);
index != NULL;
index = dict_table_get_next_index(index)) {
-
- ulint n_uniq = dict_index_get_n_unique(index);
-
- UNIV_MEM_INVALID(
+ MEM_UNDEFINED(
index->stat_n_diff_key_vals,
- n_uniq * sizeof(index->stat_n_diff_key_vals[0]));
- UNIV_MEM_INVALID(
+ index->n_uniq
+ * sizeof(index->stat_n_diff_key_vals[0]));
+ MEM_UNDEFINED(
index->stat_n_sample_sizes,
- n_uniq * sizeof(index->stat_n_sample_sizes[0]));
- UNIV_MEM_INVALID(
+ index->n_uniq
+ * sizeof(index->stat_n_sample_sizes[0]));
+ MEM_UNDEFINED(
index->stat_n_non_null_key_vals,
- n_uniq * sizeof(index->stat_n_non_null_key_vals[0]));
- UNIV_MEM_INVALID(
+ index->n_uniq
+ * sizeof(index->stat_n_non_null_key_vals[0]));
+ MEM_UNDEFINED(
&index->stat_index_size,
sizeof(index->stat_index_size));
- UNIV_MEM_INVALID(
+ MEM_UNDEFINED(
&index->stat_n_leaf_pages,
sizeof(index->stat_n_leaf_pages));
}
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* HAVE_valgrind */
rw_lock_x_unlock(&table->stats_latch);
}
diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index 680a55d2447..950d978e073 100644
--- a/storage/innobase/include/fts0fts.h
+++ b/storage/innobase/include/fts0fts.h
@@ -982,4 +982,10 @@ fts_trx_t*
fts_trx_create(
trx_t* trx);
+/** Clear all fts resources when there is no internal DOC_ID
+and there are no new fts index to add.
+@param[in,out] table table where fts is to be freed
+@param[in] trx transaction to drop all fts tables */
+void fts_clear_all(dict_table_t *table, trx_t *trx);
+
#endif /*!< fts0fts.h */
diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic
index 2a88c0f1065..9236bbef05d 100644
--- a/storage/innobase/include/mem0mem.ic
+++ b/storage/innobase/include/mem0mem.ic
@@ -203,7 +203,7 @@ mem_heap_alloc(
mem_block_set_free(block, free + MEM_SPACE_NEEDED(n));
buf = buf + REDZONE_SIZE;
- UNIV_MEM_ALLOC(buf, n - REDZONE_SIZE);
+ MEM_MAKE_ADDRESSABLE(buf, n - REDZONE_SIZE);
return(buf);
}
@@ -268,7 +268,7 @@ mem_heap_free_heap_top(
ulint(old_top - reinterpret_cast<byte*>(block)));
ut_ad(mem_block_get_start(block) <= mem_block_get_free(block));
- UNIV_MEM_FREE(old_top, (byte*) block + block->len - old_top);
+ MEM_NOACCESS(old_top, (byte*) block + block->len - old_top);
/* If free == start, we may free the block if it is not the first
one */
@@ -342,7 +342,7 @@ mem_heap_free_top(
== mem_block_get_start(block))) {
mem_heap_block_free(heap, block);
} else {
- UNIV_MEM_FREE((byte*) block + mem_block_get_free(block), n);
+ MEM_NOACCESS((byte*) block + mem_block_get_free(block), n);
}
}
diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic
index 8bd382e7872..337debd30e9 100644
--- a/storage/innobase/include/page0zip.ic
+++ b/storage/innobase/include/page0zip.ic
@@ -221,7 +221,7 @@ page_zip_get_trailer_len(
ulint uncompressed_size;
ut_ad(page_zip_simple_validate(page_zip));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
if (!page_is_leaf(page_zip->data)) {
uncompressed_size = PAGE_ZIP_DIR_SLOT_SIZE
@@ -346,7 +346,7 @@ page_zip_write_header(
ulint pos;
ut_ad(page_zip_simple_validate(page_zip));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
pos = page_offset(str);
diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h
index 797e945acbd..23c25f76362 100644
--- a/storage/innobase/include/rem0rec.h
+++ b/storage/innobase/include/rem0rec.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2020, 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
@@ -678,19 +678,17 @@ rec_offs_make_nth_extern(
rec_offs* offsets,
const ulint n);
+MY_ATTRIBUTE((nonnull))
/** Determine the number of allocated elements for an array of offsets.
@param[in] offsets offsets after rec_offs_set_n_alloc()
@return number of elements */
-inline
-ulint
-rec_offs_get_n_alloc(const rec_offs* offsets)
+inline ulint rec_offs_get_n_alloc(const rec_offs *offsets)
{
- ulint n_alloc;
- ut_ad(offsets);
- n_alloc = offsets[0];
- ut_ad(n_alloc > REC_OFFS_HEADER_SIZE);
- UNIV_MEM_ASSERT_W(offsets, n_alloc * sizeof *offsets);
- return(n_alloc);
+ ut_ad(offsets);
+ ulint n_alloc= offsets[0];
+ ut_ad(n_alloc > REC_OFFS_HEADER_SIZE);
+ MEM_CHECK_ADDRESSABLE(offsets, n_alloc * sizeof *offsets);
+ return n_alloc;
}
/** Determine the number of fields for which offsets have been initialized.
diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic
index cfc1791a5b8..6cecd9f1f08 100644
--- a/storage/innobase/include/rem0rec.ic
+++ b/storage/innobase/include/rem0rec.ic
@@ -857,7 +857,7 @@ rec_offs_set_n_alloc(
ulint n_alloc) /*!< in: number of elements */
{
ut_ad(n_alloc > REC_OFFS_HEADER_SIZE);
- UNIV_MEM_ALLOC(offsets, n_alloc * sizeof *offsets);
+ MEM_UNDEFINED(offsets, n_alloc * sizeof *offsets);
offsets[0] = static_cast<rec_offs>(n_alloc);
}
diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h
index b370e31d8af..45f9ae3d5e9 100644
--- a/storage/innobase/include/srv0mon.h
+++ b/storage/innobase/include/srv0mon.h
@@ -2,7 +2,7 @@
Copyright (c) 2010, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2020, 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
@@ -654,14 +654,14 @@ Use MONITOR_DEC if appropriate mutex protection exists.
} \
}
-#ifdef UNIV_DEBUG_VALGRIND
+#ifdef HAVE_valgrind
# define MONITOR_CHECK_DEFINED(value) do { \
mon_type_t m = value; \
- UNIV_MEM_ASSERT_RW(&m, sizeof m); \
+ MEM_CHECK_DEFINED(&m, sizeof m); \
} while (0)
-#else /* UNIV_DEBUG_VALGRIND */
+#else /* HAVE_valgrind */
# define MONITOR_CHECK_DEFINED(value) (void) 0
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* HAVE_valgrind */
#define MONITOR_INC_VALUE(monitor, value) \
MONITOR_CHECK_DEFINED(value); \
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index e9d427e04c0..99e493acfb4 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -173,10 +173,6 @@ using the call command. */
#define UNIV_ENABLE_UNIT_TEST_ROW_RAW_FORMAT_INT
*/
-#if defined HAVE_valgrind && defined HAVE_VALGRIND_MEMCHECK_H
-# define UNIV_DEBUG_VALGRIND
-#endif
-
#ifdef DBUG_OFF
# undef UNIV_DEBUG
#elif !defined UNIV_DEBUG
@@ -184,8 +180,6 @@ using the call command. */
#endif
#if 0
-#define UNIV_DEBUG_VALGRIND /* Enable extra
- Valgrind instrumentation */
#define UNIV_DEBUG_PRINT /* Enable the compilation of
some debug print functions */
#define UNIV_AHI_DEBUG /* Enable adaptive hash index
@@ -581,57 +575,6 @@ typedef void* os_thread_ret_t;
#include "ut0ut.h"
#include "sync0types.h"
-#include <my_valgrind.h>
-/* define UNIV macros in terms of my_valgrind.h */
-#define UNIV_MEM_INVALID(addr, size) MEM_UNDEFINED(addr, size)
-#define UNIV_MEM_FREE(addr, size) MEM_NOACCESS(addr, size)
-#define UNIV_MEM_ALLOC(addr, size) UNIV_MEM_INVALID(addr, size)
-#ifdef UNIV_DEBUG_VALGRIND
-# include <valgrind/memcheck.h>
-# define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size)
-# define UNIV_MEM_DESC(addr, size) VALGRIND_CREATE_BLOCK(addr, size, #addr)
-# define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b)
-# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \
- const void* _p = (const void*) (ulint) \
- VALGRIND_CHECK_MEM_IS_DEFINED(addr, size); \
- if (UNIV_LIKELY_NULL(_p)) { \
- fprintf(stderr, "%s:%d: %p[%u] undefined at %ld\n", \
- __FILE__, __LINE__, \
- (const void*) (addr), (unsigned) (size), (long) \
- (((const char*) _p) - ((const char*) (addr)))); \
- if (should_abort) { \
- ut_error; \
- } \
- } \
-} while (0)
-# define UNIV_MEM_ASSERT_RW(addr, size) \
- UNIV_MEM_ASSERT_RW_LOW(addr, size, false)
-# define UNIV_MEM_ASSERT_RW_ABORT(addr, size) \
- UNIV_MEM_ASSERT_RW_LOW(addr, size, true)
-# define UNIV_MEM_ASSERT_W(addr, size) do { \
- const void* _p = (const void*) (ulint) \
- VALGRIND_CHECK_MEM_IS_ADDRESSABLE(addr, size); \
- if (UNIV_LIKELY_NULL(_p)) \
- fprintf(stderr, "%s:%d: %p[%u] unwritable at %ld\n", \
- __FILE__, __LINE__, \
- (const void*) (addr), (unsigned) (size), (long) \
- (((const char*) _p) - ((const char*) (addr)))); \
- } while (0)
-# define UNIV_MEM_TRASH(addr, c, size) do { \
- ut_d(memset(addr, c, size)); \
- UNIV_MEM_INVALID(addr, size); \
- } while (0)
-#else
-# define UNIV_MEM_VALID(addr, size) do {} while(0)
-# define UNIV_MEM_DESC(addr, size) do {} while(0)
-# define UNIV_MEM_UNDESC(b) do {} while(0)
-# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0)
-# define UNIV_MEM_ASSERT_RW(addr, size) do {} while(0)
-# define UNIV_MEM_ASSERT_RW_ABORT(addr, size) do {} while(0)
-# define UNIV_MEM_ASSERT_W(addr, size) do {} while(0)
-# define UNIV_MEM_TRASH(addr, c, size) do {} while(0)
-#endif
-
extern ulong srv_page_size_shift;
extern ulong srv_page_size;
diff --git a/storage/innobase/include/ut0pool.h b/storage/innobase/include/ut0pool.h
index f6006144dc4..4a5f58f6fae 100644
--- a/storage/innobase/include/ut0pool.h
+++ b/storage/innobase/include/ut0pool.h
@@ -89,13 +89,12 @@ struct Pool {
ut_ad(elem->m_pool == this);
#ifdef __SANITIZE_ADDRESS__
/* Unpoison the memory for AddressSanitizer */
- MEM_UNDEFINED(&elem->m_type, sizeof elem->m_type);
+ MEM_MAKE_ADDRESSABLE(&elem->m_type,
+ sizeof elem->m_type);
#endif
-#ifdef HAVE_valgrind
- /* Declare the contents as initialized for Valgrind;
+ /* Declare the contents initialized;
we checked this in mem_free(). */
- UNIV_MEM_VALID(&elem->m_type, sizeof elem->m_type);
-#endif
+ MEM_MAKE_DEFINED(&elem->m_type, sizeof elem->m_type);
Factory::destroy(&elem->m_type);
}
@@ -134,16 +133,14 @@ struct Pool {
if (elem) {
# ifdef __SANITIZE_ADDRESS__
/* Unpoison the memory for AddressSanitizer */
- MEM_UNDEFINED(&elem->m_type, sizeof elem->m_type);
+ MEM_MAKE_ADDRESSABLE(&elem->m_type,
+ sizeof elem->m_type);
# endif
-# ifdef HAVE_valgrind
-
- /* Declare the memory initialized for Valgrind.
+ /* Declare the memory initialized.
The trx_t that are released to the pool are
actually initialized; we checked that by
- UNIV_MEM_ASSERT_RW() in mem_free() below. */
- UNIV_MEM_VALID(&elem->m_type, sizeof elem->m_type);
-# endif
+ MEM_CHECK_DEFINED() in mem_free() below. */
+ MEM_MAKE_DEFINED(&elem->m_type, sizeof elem->m_type);
}
#endif
@@ -159,7 +156,7 @@ struct Pool {
byte* p = reinterpret_cast<byte*>(ptr + 1);
elem = reinterpret_cast<Element*>(p - sizeof(*elem));
- UNIV_MEM_ASSERT_RW(&elem->m_type, sizeof elem->m_type);
+ MEM_CHECK_DEFINED(&elem->m_type, sizeof elem->m_type);
elem->m_pool->m_lock_strategy.enter();
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 15f12be09f6..705e39c40dd 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -2465,10 +2465,10 @@ recv_parse_log_rec(
*body = NULL;
- UNIV_MEM_INVALID(type, sizeof *type);
- UNIV_MEM_INVALID(space, sizeof *space);
- UNIV_MEM_INVALID(page_no, sizeof *page_no);
- UNIV_MEM_INVALID(body, sizeof *body);
+ MEM_UNDEFINED(type, sizeof *type);
+ MEM_UNDEFINED(space, sizeof *space);
+ MEM_UNDEFINED(page_no, sizeof *page_no);
+ MEM_UNDEFINED(body, sizeof *body);
if (ptr == end_ptr) {
diff --git a/storage/innobase/mem/mem0mem.cc b/storage/innobase/mem/mem0mem.cc
index 15dee37cc1f..03ab4a89f77 100644
--- a/storage/innobase/mem/mem0mem.cc
+++ b/storage/innobase/mem/mem0mem.cc
@@ -322,8 +322,7 @@ mem_heap_create_block_func(
/* Not the first allocation for the heap. This block's
total_length field should be set to undefined. */
ut_d(block->total_size = ULINT_UNDEFINED);
- UNIV_MEM_INVALID(&block->total_size,
- sizeof block->total_size);
+ MEM_UNDEFINED(&block->total_size, sizeof block->total_size);
heap->total_size += len;
}
@@ -331,7 +330,7 @@ mem_heap_create_block_func(
/* Poison all available memory. Individual chunks will be unpoisoned on
every mem_heap_alloc() call. */
compile_time_assert(MEM_BLOCK_HEADER_SIZE >= sizeof *block);
- UNIV_MEM_FREE(block + 1, len - sizeof *block);
+ MEM_NOACCESS(block + 1, len - sizeof *block);
ut_ad((ulint)MEM_BLOCK_HEADER_SIZE < len);
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index 9918d0bbc21..cb861c03b2d 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -378,7 +378,7 @@ mtr_write_log(
/** Start a mini-transaction. */
void mtr_t::start()
{
- UNIV_MEM_INVALID(this, sizeof *this);
+ MEM_UNDEFINED(this, sizeof *this);
new(&m_memo) mtr_buf_t();
new(&m_log) mtr_buf_t();
diff --git a/storage/innobase/os/os0proc.cc b/storage/innobase/os/os0proc.cc
index 32067297a24..65ca1458b52 100644
--- a/storage/innobase/os/os0proc.cc
+++ b/storage/innobase/os/os0proc.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2019, MariaDB Corporation.
+Copyright (c) 2019, 2020, 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
@@ -99,7 +99,7 @@ os_mem_alloc_large(
if (ptr) {
*n = size;
os_total_large_mem_allocated += size;
- UNIV_MEM_ALLOC(ptr, size);
+ MEM_UNDEFINED(ptr, size);
return(ptr);
}
@@ -122,7 +122,7 @@ skip:
" Windows error " << GetLastError();
} else {
os_total_large_mem_allocated += size;
- UNIV_MEM_ALLOC(ptr, size);
+ MEM_UNDEFINED(ptr, size);
}
#else
size = getpagesize();
@@ -137,7 +137,7 @@ skip:
ptr = NULL;
} else {
os_total_large_mem_allocated += size;
- UNIV_MEM_ALLOC(ptr, size);
+ MEM_UNDEFINED(ptr, size);
}
#endif
return(ptr);
@@ -153,11 +153,13 @@ os_mem_free_large(
{
ut_a(os_total_large_mem_allocated >= size);
+#ifdef __SANITIZE_ADDRESS__
// We could have manually poisoned that memory for ASAN.
// And we must unpoison it by ourself as specified in documentation
// for __asan_poison_memory_region() in sanitizer/asan_interface.h
// munmap() doesn't do it for us automatically.
- UNIV_MEM_ALLOC(ptr, size);
+ MEM_MAKE_ADDRESSABLE(ptr, size);
+#endif /* __SANITIZE_ADDRESS__ */
#ifdef HAVE_LINUX_LARGE_PAGES
if (my_use_large_pages && opt_large_page_size && !shmdt(ptr)) {
diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc
index ccc1e97e109..c984d60a419 100644
--- a/storage/innobase/page/page0cur.cc
+++ b/storage/innobase/page/page0cur.cc
@@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2018, 2019, MariaDB Corporation.
+Copyright (c) 2018, 2020, 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
@@ -1248,7 +1248,7 @@ page_cur_insert_rec_low(
/* 1. Get the size of the physical record in the page */
rec_size = rec_offs_size(offsets);
-#ifdef UNIV_DEBUG_VALGRIND
+#ifdef HAVE_valgrind
{
const void* rec_start
= rec - rec_offs_extra_size(offsets);
@@ -1259,11 +1259,11 @@ page_cur_insert_rec_low(
: REC_N_OLD_EXTRA_BYTES);
/* All data bytes of the record must be valid. */
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
/* The variable-length header must be valid. */
- UNIV_MEM_ASSERT_RW(rec_start, extra_size);
+ MEM_CHECK_DEFINED(rec_start, extra_size);
}
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* HAVE_valgrind */
/* 2. Try to find suitable space from page memory management */
@@ -1365,8 +1365,8 @@ use_heap:
rec_set_heap_no_old(insert_rec, heap_no);
}
- UNIV_MEM_ASSERT_RW(rec_get_start(insert_rec, offsets),
- rec_offs_size(offsets));
+ MEM_CHECK_DEFINED(rec_get_start(insert_rec, offsets),
+ rec_offs_size(offsets));
/* 6. Update the last insertion info in page header */
last_insert = page_header_get_ptr(page, PAGE_LAST_INSERT);
@@ -1478,7 +1478,7 @@ page_cur_insert_rec_zip(
/* 1. Get the size of the physical record in the page */
rec_size = rec_offs_size(offsets);
-#ifdef UNIV_DEBUG_VALGRIND
+#ifdef HAVE_valgrind
{
const void* rec_start
= rec - rec_offs_extra_size(offsets);
@@ -1489,11 +1489,11 @@ page_cur_insert_rec_zip(
: REC_N_OLD_EXTRA_BYTES);
/* All data bytes of the record must be valid. */
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
/* The variable-length header must be valid. */
- UNIV_MEM_ASSERT_RW(rec_start, extra_size);
+ MEM_CHECK_DEFINED(rec_start, extra_size);
}
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* HAVE_valgrind */
const bool reorg_before_insert = page_has_garbage(page)
&& rec_size > page_get_max_insert_size(page, 1)
@@ -1815,8 +1815,8 @@ use_heap:
rec_set_n_owned_new(insert_rec, NULL, 0);
rec_set_heap_no_new(insert_rec, heap_no);
- UNIV_MEM_ASSERT_RW(rec_get_start(insert_rec, offsets),
- rec_offs_size(offsets));
+ MEM_CHECK_DEFINED(rec_get_start(insert_rec, offsets),
+ rec_offs_size(offsets));
page_zip_dir_insert(page_zip, cursor->rec, free_rec, insert_rec);
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index 6a97f8d4810..95832e3e147 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -882,9 +882,9 @@ page_zip_compress_node_ptrs(
/* Only leaf nodes may contain externally stored columns. */
ut_ad(!rec_offs_any_extern(offsets));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
/* Compress the extra bytes. */
c_stream->avail_in = static_cast<uInt>(
@@ -947,8 +947,8 @@ page_zip_compress_sec(
- c_stream->next_in);
if (UNIV_LIKELY(c_stream->avail_in != 0)) {
- UNIV_MEM_ASSERT_RW(c_stream->next_in,
- c_stream->avail_in);
+ MEM_CHECK_DEFINED(c_stream->next_in,
+ c_stream->avail_in);
err = deflate(c_stream, Z_NO_FLUSH);
if (UNIV_UNLIKELY(err != Z_OK)) {
break;
@@ -990,9 +990,9 @@ page_zip_compress_clust_ext(
int err;
ulint i;
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
for (i = 0; i < rec_offs_n_fields(offsets); i++) {
ulint len;
@@ -1130,9 +1130,9 @@ page_zip_compress_clust(
ULINT_UNDEFINED, &heap);
ut_ad(rec_offs_n_fields(offsets)
== dict_index_get_n_fields(index));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
/* Compress the extra bytes. */
c_stream->avail_in = static_cast<uInt>(
@@ -1179,9 +1179,9 @@ page_zip_compress_clust(
== rec_get_nth_field(rec, offsets,
trx_id_col + 1, &len));
ut_ad(len == DATA_ROLL_PTR_LEN);
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
/* Compress any preceding bytes. */
c_stream->avail_in = static_cast<uInt>(
@@ -1278,7 +1278,7 @@ page_zip_compress(
ut_ad(dict_table_is_comp(index->table));
ut_ad(!dict_index_is_ibuf(index));
- UNIV_MEM_ASSERT_RW(page, srv_page_size);
+ MEM_CHECK_DEFINED(page, srv_page_size);
/* Check the data that will be omitted. */
ut_a(!memcmp(page + (PAGE_NEW_INFIMUM - REC_N_NEW_EXTRA_BYTES),
@@ -1441,7 +1441,7 @@ page_zip_compress(
trx_id_col = ULINT_UNDEFINED;
}
- UNIV_MEM_ASSERT_RW(c_stream.next_in, c_stream.avail_in);
+ MEM_CHECK_DEFINED(c_stream.next_in, c_stream.avail_in);
err = deflate(&c_stream, Z_FULL_FLUSH);
if (err != Z_OK) {
goto zlib_error;
@@ -1495,7 +1495,7 @@ page_zip_compress(
- (c_stream.next_in - page));
ut_a(c_stream.avail_in <= srv_page_size - PAGE_ZIP_START - PAGE_DIR);
- UNIV_MEM_ASSERT_RW(c_stream.next_in, c_stream.avail_in);
+ MEM_CHECK_DEFINED(c_stream.next_in, c_stream.avail_in);
err = deflate(&c_stream, Z_FINISH);
if (UNIV_UNLIKELY(err != Z_STREAM_END)) {
@@ -1530,9 +1530,11 @@ err_exit:
ut_ad(buf + c_stream.total_out == c_stream.next_out);
ut_ad((ulint) (storage - c_stream.next_out) >= c_stream.avail_out);
+#if defined HAVE_valgrind && !__has_feature(memory_sanitizer)
/* Valgrind believes that zlib does not initialize some bits
in the last 7 or 8 bytes of the stream. Make Valgrind happy. */
- UNIV_MEM_VALID(buf, c_stream.total_out);
+ MEM_MAKE_DEFINED(buf, c_stream.total_out);
+#endif /* HAVE_valgrind && !memory_sanitizer */
/* Zero out the area reserved for the modification log.
Space for the end marker of the modification log is not
@@ -1564,7 +1566,7 @@ err_exit:
page_zip_compress_write_log(page_zip, page, index, mtr);
}
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
#ifdef PAGE_ZIP_COMPRESS_DBG
if (logfile) {
@@ -3004,8 +3006,8 @@ page_zip_decompress_low(
rec_offs* offsets;
ut_ad(page_zip_simple_validate(page_zip));
- UNIV_MEM_ASSERT_W(page, srv_page_size);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_ADDRESSABLE(page, srv_page_size);
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
/* The dense directory excludes the infimum and supremum records. */
n_dense = page_dir_get_n_heap(page_zip->data) - PAGE_HEAP_NO_USER_LOW;
@@ -3051,7 +3053,7 @@ page_zip_decompress_low(
/* Clear the uncompressed page, except the header. */
memset(PAGE_DATA + page, 0x55, srv_page_size - PAGE_DATA);
#endif /* UNIV_ZIP_DEBUG */
- UNIV_MEM_INVALID(PAGE_DATA + page, srv_page_size - PAGE_DATA);
+ MEM_UNDEFINED(PAGE_DATA + page, srv_page_size - PAGE_DATA);
/* Copy the page directory. */
if (UNIV_UNLIKELY(!page_zip_dir_decode(page_zip, page, recs,
@@ -3181,7 +3183,7 @@ err_exit:
}
ut_a(page_is_comp(page));
- UNIV_MEM_ASSERT_RW(page, srv_page_size);
+ MEM_CHECK_DEFINED(page, srv_page_size);
page_zip_fields_free(index);
mem_heap_free(heap);
@@ -3325,8 +3327,8 @@ page_zip_validate_low(
ut_malloc_nokey(2 << srv_page_size_shift));
temp_page = static_cast<byte*>(ut_align(temp_page_buf, srv_page_size));
- UNIV_MEM_ASSERT_RW(page, srv_page_size);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page, srv_page_size);
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
temp_page_zip = *page_zip;
valid = page_zip_decompress_low(&temp_page_zip, temp_page, TRUE);
@@ -3547,9 +3549,9 @@ page_zip_write_rec_ext(
ulint n_ext = rec_offs_n_extern(offsets);
ut_ad(rec_offs_validate(rec, index, offsets));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
externs -= (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN)
* (page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW);
@@ -3674,10 +3676,10 @@ page_zip_write_rec(
ut_ad(page_zip_header_cmp(page_zip, page));
ut_ad(page_simple_validate_new((page_t*) page));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
slot = page_zip_dir_find(page_zip, page_offset(rec));
ut_a(slot);
@@ -3926,10 +3928,10 @@ page_zip_write_blob_ptr(
ut_ad(page_is_leaf(page));
ut_ad(dict_index_is_clust(index));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
blob_no = page_zip_get_n_prev_extern(page_zip, rec, index)
+ rec_get_n_extern_new(rec, index, n);
@@ -4072,8 +4074,8 @@ page_zip_write_node_ptr(
ut_ad(!page_is_leaf(page));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
- UNIV_MEM_ASSERT_RW(rec, size);
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(rec, size);
storage = page_zip_dir_start(page_zip)
- (rec_get_heap_no_new(rec) - 1) * REC_NODE_PTR_SIZE;
@@ -4142,7 +4144,7 @@ page_zip_write_trx_id_and_roll_ptr(
ut_ad(page_is_leaf(page));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
storage = page_zip_dir_start(page_zip)
- (rec_get_heap_no_new(rec) - 1)
@@ -4163,10 +4165,10 @@ page_zip_write_trx_id_and_roll_ptr(
mach_write_to_7(field + DATA_TRX_ID_LEN, roll_ptr);
memcpy(storage, field, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
if (mtr) {
byte* log_ptr = mlog_open(
@@ -4273,10 +4275,10 @@ page_zip_clear_rec(
heap_no = rec_get_heap_no_new(rec);
ut_ad(heap_no >= PAGE_HEAP_NO_USER_LOW);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
if (!page_is_leaf(page)) {
/* Clear node_ptr. On the compressed page,
@@ -4345,7 +4347,7 @@ page_zip_rec_set_deleted(
{
byte* slot = page_zip_dir_find(page_zip, page_offset(rec));
ut_a(slot);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
if (flag) {
*slot |= (PAGE_ZIP_DIR_SLOT_DEL >> 8);
} else {
@@ -4368,7 +4370,7 @@ page_zip_rec_set_owned(
{
byte* slot = page_zip_dir_find(page_zip, page_offset(rec));
ut_a(slot);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
if (flag) {
*slot |= (PAGE_ZIP_DIR_SLOT_OWNED >> 8);
} else {
@@ -4395,7 +4397,7 @@ page_zip_dir_insert(
ut_ad(page_rec_get_next((rec_t*) prev_rec) == rec);
ut_ad(page_zip_simple_validate(page_zip));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
if (page_rec_is_infimum(prev_rec)) {
/* Use the first slot. */
@@ -4474,10 +4476,10 @@ page_zip_dir_delete(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(rec_offs_comp(offsets));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
- UNIV_MEM_ASSERT_RW(rec, rec_offs_data_size(offsets));
- UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
- rec_offs_extra_size(offsets));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(rec, rec_offs_data_size(offsets));
+ MEM_CHECK_DEFINED(rec - rec_offs_extra_size(offsets),
+ rec_offs_extra_size(offsets));
slot_rec = page_zip_dir_find(page_zip, page_offset(rec));
@@ -4566,7 +4568,7 @@ page_zip_dir_add_slot(
byte* stored;
ut_ad(page_is_comp(page_zip->data));
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
/* Read the old n_dense (n_heap has already been incremented). */
n_dense = page_dir_get_n_heap(page_zip->data)
@@ -4726,8 +4728,8 @@ page_zip_reorganize(
ut_ad(!dict_index_is_ibuf(index));
ut_ad(!index->table->is_temporary());
/* Note that page_zip_validate(page_zip, page, index) may fail here. */
- UNIV_MEM_ASSERT_RW(page, srv_page_size);
- UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(page, srv_page_size);
+ MEM_CHECK_DEFINED(page_zip->data, page_zip_get_size(page_zip));
/* Disable logging */
mtr_log_t log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
@@ -4812,10 +4814,10 @@ page_zip_copy_recs(
ut_a(dict_index_is_clust(index));
}
- UNIV_MEM_ASSERT_W(page, srv_page_size);
- UNIV_MEM_ASSERT_W(page_zip->data, page_zip_get_size(page_zip));
- UNIV_MEM_ASSERT_RW(src, srv_page_size);
- UNIV_MEM_ASSERT_RW(src_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_ADDRESSABLE(page, srv_page_size);
+ MEM_CHECK_ADDRESSABLE(page_zip->data, page_zip_get_size(page_zip));
+ MEM_CHECK_DEFINED(src, srv_page_size);
+ MEM_CHECK_DEFINED(src_zip->data, page_zip_get_size(page_zip));
/* Copy those B-tree page header fields that are related to
the records stored in the page. Also copy the field
diff --git a/storage/innobase/row/row0ext.cc b/storage/innobase/row/row0ext.cc
index 9b07727d058..b7a627603d9 100644
--- a/storage/innobase/row/row0ext.cc
+++ b/storage/innobase/row/row0ext.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2019, MariaDB Corporation.
+Copyright (c) 2019, 2020, 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
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index 3597d42fac3..0bd1e9cf977 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -904,7 +904,7 @@ loop:
goto func_exit;
}
- UNIV_MEM_INVALID(block[t_ctx.buf_used], srv_sort_buf_size);
+ MEM_UNDEFINED(block[t_ctx.buf_used], srv_sort_buf_size);
buf[t_ctx.buf_used] = row_merge_buf_empty(buf[t_ctx.buf_used]);
mycount[t_ctx.buf_used] += t_ctx.rows_added[t_ctx.buf_used];
t_ctx.rows_added[t_ctx.buf_used] = 0;
@@ -998,12 +998,14 @@ exit:
goto func_exit;
}
- UNIV_MEM_INVALID(block[i], srv_sort_buf_size);
+#ifdef HAVE_valgrind
+ MEM_UNDEFINED(block[i], srv_sort_buf_size);
if (crypt_block[i]) {
- UNIV_MEM_INVALID(crypt_block[i],
- srv_sort_buf_size);
+ MEM_UNDEFINED(crypt_block[i],
+ srv_sort_buf_size);
}
+#endif /* HAVE_valgrind */
}
buf[i] = row_merge_buf_empty(buf[i]);
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index f5fe5b66002..ca4b64c94b7 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -1242,8 +1242,8 @@ row_ins_foreign_check_on_constraint(
update->info_bits = 0;
update->n_fields = foreign->n_fields;
- UNIV_MEM_INVALID(update->fields,
- update->n_fields * sizeof *update->fields);
+ MEM_UNDEFINED(update->fields,
+ update->n_fields * sizeof *update->fields);
bool affects_fulltext = false;
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index eece00fc267..afbfcd11823 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -374,7 +374,7 @@ row_log_online_op(
goto err_exit;
}
- UNIV_MEM_INVALID(log->tail.buf, sizeof log->tail.buf);
+ MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf);
ut_ad(log->tail.bytes < srv_sort_buf_size);
avail_size = srv_sort_buf_size - log->tail.bytes;
@@ -424,7 +424,7 @@ row_log_online_op(
log->tail.buf, avail_size);
}
- UNIV_MEM_ASSERT_RW(buf, srv_sort_buf_size);
+ MEM_CHECK_DEFINED(buf, srv_sort_buf_size);
if (row_log_tmpfile(log) == OS_FILE_CLOSED) {
log->error = DB_OUT_OF_MEMORY;
@@ -459,8 +459,8 @@ write_failed:
index->type |= DICT_CORRUPT;
}
- UNIV_MEM_INVALID(log->tail.block, srv_sort_buf_size);
- UNIV_MEM_INVALID(buf, srv_sort_buf_size);
+ MEM_UNDEFINED(log->tail.block, srv_sort_buf_size);
+ MEM_UNDEFINED(buf, srv_sort_buf_size);
memcpy(log->tail.block, log->tail.buf + avail_size,
mrec_size - avail_size);
@@ -470,7 +470,7 @@ write_failed:
ut_ad(b == log->tail.block + log->tail.bytes);
}
- UNIV_MEM_INVALID(log->tail.buf, sizeof log->tail.buf);
+ MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf);
err_exit:
mutex_exit(&log->mutex);
}
@@ -502,7 +502,7 @@ row_log_table_open(
{
mutex_enter(&log->mutex);
- UNIV_MEM_INVALID(log->tail.buf, sizeof log->tail.buf);
+ MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf);
if (log->error != DB_SUCCESS) {
err_exit:
@@ -562,7 +562,7 @@ row_log_table_close_func(
memcpy(buf + log->tail.bytes, log->tail.buf, avail);
}
- UNIV_MEM_ASSERT_RW(buf, srv_sort_buf_size);
+ MEM_CHECK_DEFINED(buf, srv_sort_buf_size);
if (row_log_tmpfile(log) == OS_FILE_CLOSED) {
log->error = DB_OUT_OF_MEMORY;
@@ -594,8 +594,9 @@ row_log_table_close_func(
write_failed:
log->error = DB_ONLINE_LOG_TOO_BIG;
}
- UNIV_MEM_INVALID(log->tail.block, srv_sort_buf_size);
- UNIV_MEM_INVALID(buf, srv_sort_buf_size);
+
+ MEM_UNDEFINED(log->tail.block, srv_sort_buf_size);
+ MEM_UNDEFINED(buf, srv_sort_buf_size);
memcpy(log->tail.block, log->tail.buf + avail, size - avail);
log->tail.bytes = size - avail;
} else {
@@ -604,7 +605,7 @@ write_failed:
}
log->tail.total += size;
- UNIV_MEM_INVALID(log->tail.buf, sizeof log->tail.buf);
+ MEM_UNDEFINED(log->tail.buf, sizeof log->tail.buf);
err_exit:
mutex_exit(&log->mutex);
@@ -2777,7 +2778,7 @@ row_log_table_apply_ops(
ut_ad(new_trx_id_col > 0);
ut_ad(new_trx_id_col != ULINT_UNDEFINED);
- UNIV_MEM_INVALID(&mrec_end, sizeof mrec_end);
+ MEM_UNDEFINED(&mrec_end, sizeof mrec_end);
offsets = static_cast<rec_offs*>(ut_malloc_nokey(i * sizeof *offsets));
rec_offs_set_n_alloc(offsets, i);
@@ -3687,7 +3688,8 @@ row_log_apply_ops(
ut_ad(!index->is_committed());
ut_ad(rw_lock_own(dict_index_get_lock(index), RW_LOCK_X));
ut_ad(index->online_log);
- UNIV_MEM_INVALID(&mrec_end, sizeof mrec_end);
+
+ MEM_UNDEFINED(&mrec_end, sizeof mrec_end);
offsets = static_cast<rec_offs*>(ut_malloc_nokey(i * sizeof *offsets));
rec_offs_set_n_alloc(offsets, i);
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 9da8e2e75a3..7c6896d1f33 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1027,11 +1027,11 @@ row_merge_buf_write(
ut_a(b < &block[srv_sort_buf_size]);
ut_a(b == &block[0] + buf->total_size);
*b++ = 0;
-#ifdef UNIV_DEBUG_VALGRIND
+#ifdef HAVE_valgrind
/* The rest of the block is uninitialized. Initialize it
to avoid bogus warnings. */
memset(b, 0xff, &block[srv_sort_buf_size] - b);
-#endif /* UNIV_DEBUG_VALGRIND */
+#endif /* HAVE_valgrind */
DBUG_LOG("ib_merge_sort",
"write " << reinterpret_cast<const void*>(b) << ','
<< of->fd << ',' << of->offset << " EOF");
@@ -1424,7 +1424,7 @@ row_merge_write_rec(
return(NULL);
}
- UNIV_MEM_INVALID(&block[0], srv_sort_buf_size);
+ MEM_UNDEFINED(&block[0], srv_sort_buf_size);
/* Copy the rest. */
b = &block[0];
@@ -1465,20 +1465,17 @@ row_merge_write_eof(
",fd=" << fd << ',' << *foffs);
*b++ = 0;
- UNIV_MEM_ASSERT_RW(&block[0], b - &block[0]);
- UNIV_MEM_ASSERT_W(&block[0], srv_sort_buf_size);
+ MEM_CHECK_DEFINED(&block[0], b - &block[0]);
+ MEM_CHECK_ADDRESSABLE(&block[0], srv_sort_buf_size);
-#ifdef UNIV_DEBUG_VALGRIND
- /* The rest of the block is uninitialized. Initialize it
- to avoid bogus warnings. */
- memset(b, 0xff, ulint(&block[srv_sort_buf_size] - b));
-#endif /* UNIV_DEBUG_VALGRIND */
+ /* The rest of the block is uninitialized. Silence warnings. */
+ MEM_MAKE_DEFINED(b, &block[srv_sort_buf_size] - b);
if (!row_merge_write(fd, (*foffs)++, block, crypt_block, space)) {
DBUG_RETURN(NULL);
}
- UNIV_MEM_INVALID(&block[0], srv_sort_buf_size);
+ MEM_UNDEFINED(&block[0], srv_sort_buf_size);
DBUG_RETURN(&block[0]);
}
@@ -2678,7 +2675,7 @@ write_buffers:
break;
}
- UNIV_MEM_INVALID(
+ MEM_UNDEFINED(
&block[0], srv_sort_buf_size);
}
}
@@ -3175,10 +3172,10 @@ row_merge(
ulint n_run = 0;
/*!< num of runs generated from this merge */
- UNIV_MEM_ASSERT_W(&block[0], 3 * srv_sort_buf_size);
+ MEM_CHECK_ADDRESSABLE(&block[0], 3 * srv_sort_buf_size);
if (crypt_block) {
- UNIV_MEM_ASSERT_W(&crypt_block[0], 3 * srv_sort_buf_size);
+ MEM_CHECK_ADDRESSABLE(&crypt_block[0], 3 * srv_sort_buf_size);
}
ut_ad(ihalf < file->offset);
@@ -3199,7 +3196,7 @@ row_merge(
foffs0 = 0;
foffs1 = ihalf;
- UNIV_MEM_INVALID(run_offset, *num_run * sizeof *run_offset);
+ MEM_UNDEFINED(run_offset, *num_run * sizeof *run_offset);
for (; foffs0 < ihalf && foffs1 < file->offset; foffs0++, foffs1++) {
@@ -3280,7 +3277,7 @@ row_merge(
*tmpfd = file->fd;
*file = of;
- UNIV_MEM_INVALID(&block[0], 3 * srv_sort_buf_size);
+ MEM_UNDEFINED(&block[0], 3 * srv_sort_buf_size);
return(DB_SUCCESS);
}
@@ -3393,7 +3390,7 @@ row_merge_sort(
break;
}
- UNIV_MEM_ASSERT_RW(run_offset, num_runs * sizeof *run_offset);
+ MEM_CHECK_DEFINED(run_offset, num_runs * sizeof *run_offset);
} while (num_runs > 1);
ut_free(run_offset);
@@ -3952,6 +3949,7 @@ row_merge_drop_indexes(
ut_error;
}
+ fts_clear_all(table, trx);
return;
}
@@ -4004,6 +4002,7 @@ row_merge_drop_indexes(
}
}
+ fts_clear_all(table, trx);
table->drop_aborted = FALSE;
ut_d(dict_table_check_for_dup_indexes(table, CHECK_ALL_COMPLETE));
}
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index d94e1eabe65..a8b83ad65b0 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -295,9 +295,7 @@ row_mysql_store_geometry(
{
/* MySQL might assume the field is set to zero except the length and
the pointer fields */
- UNIV_MEM_ASSERT_RW(src, src_len);
- UNIV_MEM_ASSERT_W(dest, dest_len);
- UNIV_MEM_INVALID(dest, dest_len);
+ MEM_CHECK_DEFINED(src, src_len);
memset(dest, '\0', dest_len);
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 71ead387e5e..6dc5f106c40 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -984,9 +984,9 @@ row_sel_get_clust_rec(
switch (err) {
case DB_SUCCESS:
case DB_SUCCESS_LOCKED_REC:
- /* Declare the variable uninitialized in Valgrind.
+ /* Declare the variable uninitialized.
It should be set to DB_SUCCESS at func_exit. */
- UNIV_MEM_INVALID(&err, sizeof err);
+ MEM_UNDEFINED(&err, sizeof err);
break;
default:
goto err_exit;
@@ -2701,9 +2701,9 @@ row_sel_field_store_in_mysql_format_func(
#endif /* UNIV_DEBUG */
ut_ad(len != UNIV_SQL_NULL);
- UNIV_MEM_ASSERT_RW(data, len);
- UNIV_MEM_ASSERT_W(dest, templ->mysql_col_len);
- UNIV_MEM_INVALID(dest, templ->mysql_col_len);
+ MEM_CHECK_DEFINED(data, len);
+ MEM_CHECK_ADDRESSABLE(dest, templ->mysql_col_len);
+ MEM_UNDEFINED(dest, templ->mysql_col_len);
byte* pad = dest + len;
@@ -2951,9 +2951,9 @@ row_sel_store_mysql_field(
NULL value is set to the default value. */
ut_ad(templ->mysql_null_bit_mask);
- UNIV_MEM_ASSERT_RW(prebuilt->default_rec
- + templ->mysql_col_offset,
- templ->mysql_col_len);
+ MEM_CHECK_DEFINED(prebuilt->default_rec
+ + templ->mysql_col_offset,
+ templ->mysql_col_len);
mysql_rec[templ->mysql_null_byte_offset]
|= (byte) templ->mysql_null_bit_mask;
memcpy(mysql_rec + templ->mysql_col_offset,
@@ -3598,7 +3598,7 @@ row_sel_copy_cached_field_for_mysql(
buf += templ->mysql_col_offset;
cache += templ->mysql_col_offset;
- UNIV_MEM_ASSERT_W(buf, templ->mysql_col_len);
+ MEM_CHECK_ADDRESSABLE(buf, templ->mysql_col_len);
if (templ->mysql_type == DATA_MYSQL_TRUE_VARCHAR
&& (templ->type != DATA_INT)) {
@@ -3608,7 +3608,7 @@ row_sel_copy_cached_field_for_mysql(
row_mysql_read_true_varchar(
&len, cache, templ->mysql_length_bytes);
len += templ->mysql_length_bytes;
- UNIV_MEM_INVALID(buf, templ->mysql_col_len);
+ MEM_UNDEFINED(buf, templ->mysql_col_len);
} else {
len = templ->mysql_col_len;
}
@@ -3667,7 +3667,7 @@ row_sel_dequeue_cached_row_for_mysql(
ut_ad(prebuilt->n_fetch_cached > 0);
ut_ad(prebuilt->mysql_prefix_len <= prebuilt->mysql_row_len);
- UNIV_MEM_ASSERT_W(buf, prebuilt->mysql_row_len);
+ MEM_CHECK_ADDRESSABLE(buf, prebuilt->mysql_row_len);
cached_rec = prebuilt->fetch_cache[prebuilt->fetch_cache_first];
@@ -3677,7 +3677,7 @@ row_sel_dequeue_cached_row_for_mysql(
/* The record is long. Copy it field by field, in case
there are some long VARCHAR column of which only a
small length is being used. */
- UNIV_MEM_INVALID(buf, prebuilt->mysql_prefix_len);
+ MEM_UNDEFINED(buf, prebuilt->mysql_prefix_len);
/* First copy the NULL bits. */
ut_memcpy(buf, cached_rec, prebuilt->null_bitmap_len);
@@ -3761,8 +3761,8 @@ row_sel_fetch_last_buf(
}
ut_ad(prebuilt->fetch_cache_first == 0);
- UNIV_MEM_INVALID(prebuilt->fetch_cache[prebuilt->n_fetch_cached],
- prebuilt->mysql_row_len);
+ MEM_UNDEFINED(prebuilt->fetch_cache[prebuilt->n_fetch_cached],
+ prebuilt->mysql_row_len);
return(prebuilt->fetch_cache[prebuilt->n_fetch_cached]);
}
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index 046727267d5..0116bfb1c6f 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -1849,7 +1849,7 @@ row_upd_changes_ord_field_binary_func(
/* Silence a compiler warning without
silencing a Valgrind error. */
dfield_len = 0;
- UNIV_MEM_INVALID(&dfield_len, sizeof dfield_len);
+ MEM_UNDEFINED(&dfield_len, sizeof dfield_len);
/* See if the column is stored externally. */
buf = row_ext_lookup(ext, col_no, &dfield_len);
diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc
index 5dc9be4b8b8..0c7d103d25c 100644
--- a/storage/innobase/sync/sync0arr.cc
+++ b/storage/innobase/sync/sync0arr.cc
@@ -976,9 +976,9 @@ sync_array_print_long_waits_low(
return(false);
}
-#ifdef UNIV_DEBUG_VALGRIND
+#if defined HAVE_valgrind && !__has_feature(memory_sanitizer)
/* Increase the timeouts if running under valgrind because it executes
- extremely slowly. UNIV_DEBUG_VALGRIND does not necessary mean that
+ extremely slowly. HAVE_valgrind does not necessary mean that
we are running under valgrind but we have no better way to tell.
See Bug#58432 innodb.innodb_bug56143 fails under valgrind
for an example */
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 1741ae37cb4..c93ec9c1112 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -457,27 +457,22 @@ void trx_free(trx_t*& trx)
#ifdef __SANITIZE_ADDRESS__
/* Unpoison the memory for innodb_monitor_set_option;
it is operating also on the freed transaction objects. */
- MEM_UNDEFINED(&trx->mutex, sizeof trx->mutex);
+ MEM_MAKE_ADDRESSABLE(&trx->mutex, sizeof trx->mutex);
/* For innobase_kill_connection() */
-# ifdef WITH_WSREP
- MEM_UNDEFINED(&trx->wsrep, sizeof trx->wsrep);
-# endif
- MEM_UNDEFINED(&trx->state, sizeof trx->state);
- MEM_UNDEFINED(&trx->mysql_thd, sizeof trx->mysql_thd);
+ MEM_MAKE_ADDRESSABLE(&trx->state, sizeof trx->state);
+ MEM_MAKE_ADDRESSABLE(&trx->mysql_thd, sizeof trx->mysql_thd);
#endif
-#ifdef HAVE_valgrind
/* Unpoison the memory for innodb_monitor_set_option;
it is operating also on the freed transaction objects.
We checked that these were initialized in
trx_pools->mem_free(trx). */
- UNIV_MEM_VALID(&trx->mutex, sizeof trx->mutex);
+ MEM_MAKE_DEFINED(&trx->mutex, sizeof trx->mutex);
/* For innobase_kill_connection() */
# ifdef WITH_WSREP
- UNIV_MEM_VALID(&trx->wsrep, sizeof trx->wsrep);
+ MEM_MAKE_DEFINED(&trx->wsrep, sizeof trx->wsrep);
# endif
- UNIV_MEM_VALID(&trx->state, sizeof trx->state);
- UNIV_MEM_VALID(&trx->mysql_thd, sizeof trx->mysql_thd);
-#endif
+ MEM_MAKE_DEFINED(&trx->state, sizeof trx->state);
+ MEM_MAKE_DEFINED(&trx->mysql_thd, sizeof trx->mysql_thd);
trx = NULL;
}
diff --git a/storage/innobase/ut/ut0crc32.cc b/storage/innobase/ut/ut0crc32.cc
index 5ccd15dd5ca..bb2c530a174 100644
--- a/storage/innobase/ut/ut0crc32.cc
+++ b/storage/innobase/ut/ut0crc32.cc
@@ -84,6 +84,7 @@ mysys/my_perf.c, contributed by Facebook under the following license.
#include <string.h>
#include "ut0crc32.h"
+#include "my_valgrind.h"
#ifdef _MSC_VER
#include <intrin.h>
@@ -195,15 +196,17 @@ ut_crc32_8_hw(
const byte** data,
ulint* len)
{
-#ifdef _MSC_VER
+# ifdef _MSC_VER
*crc = _mm_crc32_u8(*crc, (*data)[0]);
-#else
+# elif __has_feature(memory_sanitizer)
+ *crc = __builtin_ia32_crc32qi(*crc, (*data)[0]);
+# else
asm("crc32b %1, %0"
/* output operands */
: "+r" (*crc)
/* input operands */
: "rm" ((*data)[0]));
-#endif
+# endif
(*data)++;
(*len)--;
@@ -220,22 +223,24 @@ ut_crc32_64_low_hw(
uint64_t data)
{
uint64_t crc_64bit = crc;
-#ifdef _MSC_VER
-#ifdef _M_X64
+# ifdef _MSC_VER
+# ifdef _M_X64
crc_64bit = _mm_crc32_u64(crc_64bit, data);
-#elif defined(_M_IX86)
+# elif defined(_M_IX86)
crc = _mm_crc32_u32(crc, static_cast<uint32_t>(data));
crc_64bit = _mm_crc32_u32(crc, static_cast<uint32_t>(data >> 32));
-#else
-#error Not Supported processors type.
-#endif
-#else
+# else
+# error Not Supported processors type.
+# endif
+# elif __has_feature(memory_sanitizer)
+ crc_64bit = __builtin_ia32_crc32di(crc_64bit, data);
+# else
asm("crc32q %1, %0"
/* output operands */
: "+r" (crc_64bit)
/* input operands */
: "rm" (data));
-#endif
+# endif
return(static_cast<uint32_t>(crc_64bit));
}
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc
index c6db344b388..fc2fbb7f240 100644
--- a/storage/innobase/ut/ut0ut.cc
+++ b/storage/innobase/ut/ut0ut.cc
@@ -148,8 +148,6 @@ ut_print_buf(
const byte* data;
ulint i;
- UNIV_MEM_ASSERT_RW(buf, len);
-
fprintf(file, " len " ULINTPF "; hex ", len);
for (data = (const byte*) buf, i = 0; i < len; i++) {
@@ -184,8 +182,6 @@ ut_print_buf_hex(
'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
};
- UNIV_MEM_ASSERT_RW(buf, len);
-
o << "(0x";
for (data = static_cast<const byte*>(buf), i = 0; i < len; i++) {
@@ -208,8 +204,6 @@ ut_print_buf(
const byte* data;
ulint i;
- UNIV_MEM_ASSERT_RW(buf, len);
-
for (data = static_cast<const byte*>(buf), i = 0; i < len; i++) {
int c = static_cast<int>(*data++);
o << (isprint(c) ? static_cast<char>(c) : ' ');
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 75566351b27..35edfc31914 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -1201,7 +1201,7 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
that all bytes in the row is properly reset.
*/
if (file->s->data_file_type == STATIC_RECORD &&
- (file->s->has_varchar_fields | file->s->has_null_fields))
+ (file->s->has_varchar_fields || file->s->has_null_fields))
int_table_flags|= HA_RECORD_MUST_BE_CLEAN_ON_WRITE;
for (i= 0; i < table->s->keys; i++)
diff --git a/storage/myisam/ftbench/Ecompare.pl b/storage/myisam/ftbench/Ecompare.pl
index 07132ef9001..a97f126e64e 100755
--- a/storage/myisam/ftbench/Ecompare.pl
+++ b/storage/myisam/ftbench/Ecompare.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2003, 2005 MySQL AB
# Use is subject to license terms
diff --git a/storage/myisam/ftbench/Ecreate.pl b/storage/myisam/ftbench/Ecreate.pl
index 86af9f9c0a5..78962466c80 100755
--- a/storage/myisam/ftbench/Ecreate.pl
+++ b/storage/myisam/ftbench/Ecreate.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2003, 2005 MySQL AB
# Use is subject to license terms
diff --git a/storage/myisam/ftbench/Ereport.pl b/storage/myisam/ftbench/Ereport.pl
index d3f8961ec85..a8c7c57e1be 100755
--- a/storage/myisam/ftbench/Ereport.pl
+++ b/storage/myisam/ftbench/Ereport.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2003, 2005 MySQL AB
# Use is subject to license terms
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index f5f36266347..1cc396fe2cd 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -887,8 +887,9 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked)
the full row to ensure we don't get any errors from valgrind and
that all bytes in the row is properly reset.
*/
- if ((file->s->options & HA_OPTION_PACK_RECORD) &&
- (file->s->has_varchar_fields | file->s->has_null_fields))
+ if (!(file->s->options &
+ (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) &&
+ (file->s->has_varchar_fields || file->s->has_null_fields))
int_table_flags|= HA_RECORD_MUST_BE_CLEAN_ON_WRITE;
for (i= 0; i < table->s->keys; i++)
diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c
index d17eef06969..2909f5998e1 100644
--- a/storage/myisam/mi_key.c
+++ b/storage/myisam/mi_key.c
@@ -561,7 +561,15 @@ check_result_t mi_check_index_tuple(MI_INFO *info, uint keynr, uchar *record)
if (need_unpack && mi_unpack_index_tuple(info, keynr, record))
res= CHECK_ERROR;
else
- res= info->rowid_filter_func(info->rowid_filter_func_arg);
+ {
+ if ((res= info->rowid_filter_func(info->rowid_filter_func_arg)) ==
+ CHECK_OUT_OF_RANGE)
+ {
+ /* We got beyond the end of scanned range */
+ info->lastpos= HA_OFFSET_ERROR; /* No active record */
+ my_errno= HA_ERR_END_OF_FILE;
+ }
+ }
}
return res;
}
diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt
index f4f23ff08c6..2ba887b3fae 100644
--- a/storage/rocksdb/CMakeLists.txt
+++ b/storage/rocksdb/CMakeLists.txt
@@ -188,9 +188,6 @@ endif()
TARGET_LINK_LIBRARIES(rocksdb rocksdb_aux_lib)
- FIND_LIBRARY(LZ4_LIBRARY
- NAMES liblz4${PIC_EXT}.a lz4
- HINTS ${WITH_LZ4}/lib)
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
IF(HAVE_SCHED_GETCPU)
@@ -252,13 +249,6 @@ ELSEIF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Cla
SET_TARGET_PROPERTIES(rocksdb_tools sst_dump mysql_ldb PROPERTIES COMPILE_FLAGS "-Wno-error")
ENDIF()
-# Enable ZSTD if available. Upstream rocksdb cmake will use WITH_ZSTD and set
-# defines within their code.
-FIND_PACKAGE(zstd)
-IF (ZSTD_FOUND)
- SET(WITH_ZSTD ON)
-ENDIF()
-
IF(GIT_EXECUTABLE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/.git)
EXECUTE_PROCESS(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake
index 2e939587811..f7b2170978d 100644
--- a/storage/rocksdb/build_rocksdb.cmake
+++ b/storage/rocksdb/build_rocksdb.cmake
@@ -35,52 +35,47 @@ endif()
# Optional compression libraries.
-foreach(compression_lib LZ4 BZip2 ZSTD snappy)
- FIND_PACKAGE(${compression_lib} QUIET)
-
- SET(WITH_ROCKSDB_${compression_lib} AUTO CACHE STRING
- "Build RocksDB with ${compression_lib} compression. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
-
- if(${WITH_ROCKSDB_${compression_lib}} STREQUAL "ON" AND NOT ${${compression_lib}_FOUND})
- MESSAGE(FATAL_ERROR
- "${compression_lib} library was not found, but WITH_ROCKSDB${compression_lib} option is ON.\
- Either set WITH_ROCKSDB${compression_lib} to OFF, or make sure ${compression_lib} is installed")
- endif()
-endforeach()
-
-if(LZ4_FOUND AND (NOT WITH_ROCKSDB_LZ4 STREQUAL "OFF"))
- add_definitions(-DLZ4)
- include_directories(${LZ4_INCLUDE_DIR})
- list(APPEND THIRDPARTY_LIBS ${LZ4_LIBRARY})
-endif()
-
-if(BZIP2_FOUND AND (NOT WITH_ROCKSDB_BZip2 STREQUAL "OFF"))
- add_definitions(-DBZIP2)
- include_directories(${BZIP2_INCLUDE_DIR})
- list(APPEND THIRDPARTY_LIBS ${BZIP2_LIBRARIES})
-endif()
-
-if(SNAPPY_FOUND AND (NOT WITH_ROCKSDB_snappy STREQUAL "OFF"))
- add_definitions(-DSNAPPY)
- include_directories(${snappy_INCLUDE_DIR})
- list(APPEND THIRDPARTY_LIBS ${snappy_LIBRARIES})
-endif()
-
include(CheckFunctionExists)
-if(ZSTD_FOUND AND (NOT WITH_ROCKSDB_ZSTD STREQUAL "OFF"))
- SET(CMAKE_REQUIRED_LIBRARIES zstd)
- CHECK_FUNCTION_EXISTS(ZDICT_trainFromBuffer ZSTD_VALID)
- UNSET(CMAKE_REQUIRED_LIBRARIES)
- if (WITH_ROCKSDB_ZSTD STREQUAL "ON" AND NOT ZSTD_VALID)
+macro(check_lib package var)
+ STRING(TOUPPER ${package} PACKAGE_NAME)
+ SET(WITH_ROCKSDB_${package} AUTO CACHE STRING
+ "Build RocksDB with ${package} compression. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
+
+ IF (NOT ${WITH_ROCKSDB_${package}} STREQUAL "OFF")
+ FIND_PACKAGE(${package} QUIET)
+ IF (${${PACKAGE_NAME}_FOUND})
+ IF(${ARGC} GREATER 2)
+ SET(CMAKE_REQUIRED_LIBRARIES ${${var}_LIBRARIES})
+ CHECK_FUNCTION_EXISTS(${ARGV2} ${var}_VALID)
+ UNSET(CMAKE_REQUIRED_LIBRARIES)
+ ELSE()
+ SET(${var}_VALID TRUE)
+ ENDIF()
+ ENDIF()
+ ENDIF()
+
+ IF(${${var}_VALID})
+ MESSAGE_ONCE(rocksdb_${var} "Found ${package}: ${${var}_LIBRARIES}")
+ add_definitions(-D${PACKAGE_NAME})
+ include_directories(${${var}_INCLUDE_DIR})
+ list(APPEND THIRDPARTY_LIBS ${${var}_LIBRARIES})
+ ELSEIF(${${PACKAGE_NAME}_FOUND})
+ MESSAGE_ONCE(rocksdb_${var} "Found unusable ${package}: ${${var}_LIBRARIES} [${ARGV2}]")
+ ELSE()
+ MESSAGE_ONCE(rocksdb_${var} "Could NOT find ${package}")
+ ENDIF()
+
+ IF (${WITH_ROCKSDB_${package}} STREQUAL "ON" AND NOT ${${PACKAGE_NAME}_FOUND})
MESSAGE(FATAL_ERROR
- "WITH_ROCKSDB_ZSTD is ON and ZSTD library was found, but the version needs to be >= 1.1.3")
+ "${package} library was not found, but WITH_ROCKSDB_${package} option is ON.\
+ Either set WITH_ROCKSDB_${package} to OFF, or make sure ${package} is installed")
endif()
- if (ZSTD_VALID)
- add_definitions(-DZSTD)
- include_directories(${ZSTD_INCLUDE_DIR})
- list(APPEND THIRDPARTY_LIBS ${ZSTD_LIBRARIES})
- endif()
-endif()
+endmacro()
+
+check_lib(LZ4 LZ4)
+check_lib(BZip2 BZIP2)
+check_lib(snappy snappy) # rocksdb/cmake/modules/Findsnappy.cmake violates the convention
+check_lib(ZSTD ZSTD ZDICT_trainFromBuffer)
add_definitions(-DZLIB)
list(APPEND THIRDPARTY_LIBS ${ZLIB_LIBRARY})
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index b8b4d86ce1c..3734233552d 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -6123,6 +6123,11 @@ void ha_tokudb::position(const uchar * record) {
//
memcpy(ref, &key.size, sizeof(uint32_t));
}
+ /*
+ tokudb doesn't always write the last byte. Don't that cause problems with
+ MariaDB
+ */
+ MEM_MAKE_DEFINED(ref, ref_length);
TOKUDB_HANDLER_DBUG_VOID_RETURN;
}
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index 312e56bd383..56e86f1bbc8 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009-2011, Monty Program Ab
+ Copyright (c) 2009, 2020, 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
@@ -704,7 +704,13 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
}
else if (*fmt == 'f' || *fmt == 'g')
{
+#if __has_feature(memory_sanitizer) /* QQ: MSAN has double trouble? */
+ __msan_check_mem_is_initialized(ap, sizeof(double));
+#endif
double d= va_arg(ap, double);
+#if __has_feature(memory_sanitizer) /* QQ: MSAN has double trouble? */
+ __msan_unpoison(&d, sizeof(double));
+#endif
to= process_dbl_arg(to, end, width, d, *fmt);
continue;
}
diff --git a/tests/big_record.pl b/tests/big_record.pl
index cb1f8998468..b08f7ea60e2 100755
--- a/tests/big_record.pl
+++ b/tests/big_record.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
#
diff --git a/tests/drop_test.pl b/tests/drop_test.pl
index 329f65eb65d..e4ae5a2671f 100755
--- a/tests/drop_test.pl
+++ b/tests/drop_test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
# Copyright (C) 2000 MySQL AB
# Use is subject to license terms
diff --git a/tests/export.pl b/tests/export.pl
index f99798ecac8..dace79feb30 100755
--- a/tests/export.pl
+++ b/tests/export.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2000, 2001 MySQL AB
# Use is subject to license terms
diff --git a/tests/fork2_test.pl b/tests/fork2_test.pl
index 356055733fa..a05a9b96679 100755
--- a/tests/fork2_test.pl
+++ b/tests/fork2_test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
# Copyright (C) 2000, 2001 MySQL AB
# Use is subject to license terms
diff --git a/tests/fork_big.pl b/tests/fork_big.pl
index 623377ab5cd..b5f8770c903 100755
--- a/tests/fork_big.pl
+++ b/tests/fork_big.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
use strict;
# Copyright (c) 2001, 2006 MySQL AB
diff --git a/tests/fork_big2.pl b/tests/fork_big2.pl
index c844d290834..7f055609108 100644
--- a/tests/fork_big2.pl
+++ b/tests/fork_big2.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
# Copyright (c) 2002, 2003, 2005, 2006 MySQL AB
# Use is subject to license terms
diff --git a/tests/grant.pl b/tests/grant.pl
index cd651643316..b50481a93fc 100755
--- a/tests/grant.pl
+++ b/tests/grant.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2000, 2005 MySQL AB, 2009 Sun Microsystems, Inc.
# Use is subject to license terms.
diff --git a/tests/index_corrupt.pl b/tests/index_corrupt.pl
index 6b04ce8a59c..8194982755a 100755
--- a/tests/index_corrupt.pl
+++ b/tests/index_corrupt.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
# Copyright (C) 2005 MySQL AB
# Use is subject to license terms
diff --git a/tests/insert_and_repair.pl b/tests/insert_and_repair.pl
index 18091c92718..91333746e79 100755
--- a/tests/insert_and_repair.pl
+++ b/tests/insert_and_repair.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
# Copyright (C) 2000, 2001 MySQL AB
# Use is subject to license terms
diff --git a/tests/lock_test.pl b/tests/lock_test.pl
index 98c4ad6377d..8a8a0322467 100755
--- a/tests/lock_test.pl
+++ b/tests/lock_test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2000 MySQL AB
# Use is subject to license terms
diff --git a/tests/mail_to_db.pl b/tests/mail_to_db.pl
index e50415d96f3..6e5c115f543 100755
--- a/tests/mail_to_db.pl
+++ b/tests/mail_to_db.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
# Copyright Abandoned 1998 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
#
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 923e4d01ca2..9435e434ff8 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2014, Oracle and/or its affiliates.
- Copyright (c) 2008, 2019, MariaDB
+ Copyright (c) 2008, 2020, 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
@@ -20548,6 +20548,59 @@ static void test_bulk_replace()
}
#endif
+
+static void test_ps_params_in_ctes()
+{
+ int rc;
+ const char *query;
+ MYSQL_BIND ps_params[1];
+ int int_data[1];
+ MYSQL_STMT *stmt;
+
+ rc= mysql_query(mysql, "create table t1(a int, b int, key(a))");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "insert into t1 (a) values "
+ "(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)");
+ myquery(rc);
+
+ query=
+ "explain "
+ "with T as "
+ "( "
+ " select * from t1 where t1.a=? limit 2 "
+ ") "
+ "select * from T as TA, T as TB;";
+
+ stmt= mysql_stmt_init(mysql);
+ check_stmt(stmt);
+
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
+ check_execute(stmt, rc);
+
+ int_data[0]=2;
+
+ ps_params[0].buffer_type= MYSQL_TYPE_LONG;
+ ps_params[0].buffer= (char *) &int_data[0];
+ ps_params[0].length= 0;
+ ps_params[0].is_null= 0;
+
+ rc= mysql_stmt_bind_param(stmt, ps_params);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_store_result(stmt);
+ check_execute(stmt, rc);
+
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "drop table t1");
+ myquery(rc);
+}
+
+
static void print_metadata(MYSQL_RES *rs_metadata, int num_fields)
{
int i;
@@ -21224,6 +21277,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bulk_delete", test_bulk_delete },
{ "test_bulk_replace", test_bulk_replace },
#endif
+ { "test_ps_params_in_ctes", test_ps_params_in_ctes },
{ "test_explain_meta", test_explain_meta },
{ "test_mdev18408", test_mdev18408 },
{ "test_mdev20261", test_mdev20261 },
diff --git a/tests/pmail.pl b/tests/pmail.pl
index 359256c25b3..97e5914f794 100755
--- a/tests/pmail.pl
+++ b/tests/pmail.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
# Copyright (C) 2000, 2005 MySQL AB
# Use is subject to license terms
diff --git a/tests/rename_test.pl b/tests/rename_test.pl
index d7097df1e4e..ec7254a4cf6 100755
--- a/tests/rename_test.pl
+++ b/tests/rename_test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
# Copyright (C) 2000, 2001 MySQL AB
# Use is subject to license terms
diff --git a/tests/table_types.pl b/tests/table_types.pl
index c633a153098..782b8f254bf 100755
--- a/tests/table_types.pl
+++ b/tests/table_types.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2000, 2003 MySQL AB
# Use is subject to license terms
diff --git a/tests/test_delayed_insert.pl b/tests/test_delayed_insert.pl
index cb5b86a228d..2f8f97b25c6 100755
--- a/tests/test_delayed_insert.pl
+++ b/tests/test_delayed_insert.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
# Copyright (C) 2000, 2001 MySQL AB
# Use is subject to license terms
diff --git a/tests/truncate.pl b/tests/truncate.pl
index 98791a15b2c..e83ebab9291 100755
--- a/tests/truncate.pl
+++ b/tests/truncate.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w
# Copyright (C) 2002 MySQL AB
# Use is subject to license terms
diff --git a/unittest/unit.pl b/unittest/unit.pl
index fb9a16fbe49..dc72a57d20c 100644
--- a/unittest/unit.pl
+++ b/unittest/unit.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2006 MySQL AB, 2009, 2010 Sun Microsystems, Inc.
# Use is subject to license terms.
#