[Commits] bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (monty:2892)

#At lp:maria based on revid:monty@askmonty.org-20100806074953-yb8u6d053s24shbm 2892 Michael Widenius 2010-08-27 [merge] Automerge removed: include/atomic/gcc_builtins.h include/atomic/nolock.h include/atomic/rwlock.h include/atomic/x86-gcc.h include/my_atomic.h mysql-test/include/have_exampledb.inc mysql-test/r/exampledb.result mysql-test/suite/federated/federated_innodb-slave.opt mysql-test/suite/federated/federated_transactions-slave.opt mysql-test/suite/pbxt/t/suite.opt mysql-test/t/exampledb.test mysys/my_atomic.c strings/bcmp.c strings/bzero.c unittest/mysys/my_atomic-t.c added: BUILD/compile-amd64-debug-all BUILD/compile-pentium-debug-all BUILD/compile-pentium64-debug-all config/ac-macros/maintainer.m4 include/atomic/gcc_builtins.h include/atomic/nolock.h include/atomic/rwlock.h include/atomic/x86-gcc.h include/my_atomic.h include/my_compiler.h mysql-test/README.suites mysql-test/include/have_archive.opt mysql-test/include/have_binlog_format_mixed.opt mysql-test/include/have_binlog_format_row.opt mysql-test/include/have_binlog_format_statement.opt mysql-test/include/have_blackhole.opt mysql-test/include/have_innodb.opt mysql-test/include/have_log_bin-master.opt mysql-test/include/have_log_bin-slave.opt mysql-test/include/have_pbxt.opt mysql-test/include/rpl_diff_tables.inc mysql-test/lib/My/Suite.pm mysql-test/suite/federated/federated_bug_32426.result mysql-test/suite/federated/federated_bug_32426.test mysql-test/suite/federated/suite.opt mysql-test/suite/innodb/r/innodb_bug53756.result mysql-test/suite/innodb/t/innodb_bug53756-master.opt mysql-test/suite/innodb/t/innodb_bug53756.test mysql-test/suite/innodb_plugin/combinations mysql-test/suite/innodb_plugin/r/innodb_bug54453.result mysql-test/suite/innodb_plugin/suite.pm mysql-test/suite/innodb_plugin/t/innodb_bug54453.test mysql-test/suite/pbxt/t/skip_name_resolve-master.opt mysql-test/suite/rpl/r/rpl_conditional_comments.result mysql-test/suite/rpl/r/rpl_current_user.result mysql-test/suite/rpl/t/rpl_conditional_comments.test mysql-test/suite/rpl/t/rpl_current_user.cnf mysql-test/suite/rpl/t/rpl_current_user.test mysql-test/suite/rpl/t/rpl_ddl-slave.opt mysql-test/t/ssl_8k_key-master.opt mysys/my_atomic.c scripts/convert-debug-for-diff.sh strings/bcmp.c strings/bzero.c unittest/mysys/my_atomic-t.c unittest/strings/ unittest/strings/Makefile.am unittest/strings/strings-t.c modified: .bzrignore BUILD/Makefile.am BUILD/SETUP.sh BUILD/check-cpu Docs/Makefile.am Makefile.am client/Makefile.am client/mysql.cc client/mysqlcheck.c client/mysqldump.c client/mysqlimport.c client/mysqlshow.c client/mysqlslap.c client/mysqltest.cc cmd-line-utils/Makefile.am cmd-line-utils/readline/Makefile.am cmd-line-utils/readline/input.c configure.in dbug/Makefile.am extra/Makefile.am extra/comp_err.c extra/my_print_defaults.c extra/replace.c extra/yassl/src/yassl_imp.cpp extra/yassl/taocrypt/include/blowfish.hpp extra/yassl/taocrypt/include/runtime.hpp extra/yassl/taocrypt/src/algebra.cpp extra/yassl/taocrypt/src/coding.cpp extra/yassl/taocrypt/src/integer.cpp extra/yassl/taocrypt/src/misc.cpp extra/yassl/testsuite/test.hpp include/Makefile.am include/m_string.h include/my_bitmap.h include/my_global.h include/my_pthread.h include/my_sys.h include/mysql.h include/mysql.h.pp include/mysys_err.h libmysql/Makefile.am libmysql/libmysql.c libmysql_r/Makefile.am libmysqld/Makefile.am libmysqld/examples/Makefile.am man/Makefile.am mysql-test/Makefile.am mysql-test/README mysql-test/include/commit.inc mysql-test/include/default_my.cnf mysql-test/include/default_mysqld.cnf mysql-test/include/diff_tables.inc mysql-test/include/have_archive.inc mysql-test/include/have_innodb.inc mysql-test/include/have_innodb_plugin.inc mysql-test/include/have_log_bin.inc mysql-test/include/have_pbxt.inc mysql-test/lib/My/Config.pm mysql-test/lib/My/ConfigFactory.pm mysql-test/lib/My/Handles.pm* mysql-test/lib/My/SafeProcess.pm mysql-test/lib/My/SafeProcess/safe_process.cc mysql-test/lib/My/Test.pm mysql-test/lib/mtr_cases.pm mysql-test/lib/mtr_report.pm mysql-test/mysql-test-run.pl mysql-test/r/commit_1innodb.result mysql-test/r/func_gconcat.result mysql-test/r/func_misc.result mysql-test/r/group_by.result mysql-test/r/having.result mysql-test/r/information_schema.result mysql-test/r/loaddata.result mysql-test/r/lowercase_table2.result mysql-test/r/lowercase_view.result mysql-test/r/mysql_client_test.result mysql-test/r/mysql_upgrade.result mysql-test/r/subselect4.result mysql-test/r/update.result mysql-test/r/warnings_engine_disabled.result mysql-test/std_data/server8k-cert.pem mysql-test/std_data/server8k-key.pem mysql-test/suite/binlog/t/binlog_base64_flag.test mysql-test/suite/binlog/t/binlog_old_versions.test mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt mysql-test/suite/federated/federated_server.result mysql-test/suite/federated/my.cnf mysql-test/suite/funcs_1/r/is_basics_mixed.result mysql-test/suite/funcs_1/r/is_columns_innodb.result mysql-test/suite/funcs_1/r/is_columns_is.result mysql-test/suite/funcs_1/r/is_columns_memory.result mysql-test/suite/funcs_1/r/is_columns_myisam.result mysql-test/suite/funcs_1/r/is_columns_mysql.result mysql-test/suite/funcs_1/t/is_columns_is.test mysql-test/suite/innodb/r/innodb_mysql.result mysql-test/suite/innodb/t/disabled.def mysql-test/suite/innodb/t/innodb-master.opt mysql-test/suite/innodb/t/innodb-semi-consistent-master.opt mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero-master.opt mysql-test/suite/innodb/t/innodb_bug30919-master.opt mysql-test/suite/innodb/t/innodb_bug39438-master.opt mysql-test/suite/innodb/t/innodb_bug52663-master.opt mysql-test/suite/innodb/t/innodb_bug53674-master.opt mysql-test/suite/innodb/t/innodb_bug53674.test mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1-master.opt mysql-test/suite/innodb/t/innodb_misc1-master.opt mysql-test/suite/innodb/t/innodb_mysql-master.opt mysql-test/suite/innodb/t/innodb_mysql.test mysql-test/suite/innodb/t/innodb_mysql_rbk-master.opt mysql-test/suite/innodb/t/innodb_timeout_rollback-master.opt mysql-test/suite/innodb_plugin/t/innodb-autoinc-44030.test mysql-test/suite/innodb_plugin/t/innodb-autoinc.test mysql-test/suite/innodb_plugin/t/innodb-consistent-master.opt mysql-test/suite/innodb_plugin/t/innodb-master.opt mysql-test/suite/innodb_plugin/t/innodb-semi-consistent-master.opt mysql-test/suite/innodb_plugin/t/innodb-use-sys-malloc-master.opt mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt mysql-test/suite/innodb_plugin/t/innodb_bug39438-master.opt mysql-test/suite/innodb_plugin/t/innodb_bug42101-nonzero-master.opt mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt mysql-test/suite/maria/r/maria.result mysql-test/suite/maria/r/maria3.result mysql-test/suite/maria/t/maria.test mysql-test/suite/ndb_team/t/rpl_ndb_mix_innodb-master.opt mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt mysql-test/suite/parts/t/partition_special_innodb-master.opt mysql-test/suite/pbxt/my.cnf mysql-test/suite/pbxt/r/range.result mysql-test/suite/pbxt/t/range.test mysql-test/suite/percona/percona_innodb_doublewrite_file-master.opt mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test mysql-test/suite/percona/percona_log_slow_slave_statements.test mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test mysql-test/suite/percona/percona_slow_query_log-long_query_time.test mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test mysql-test/suite/rpl/r/rpl_drop.result mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result mysql-test/suite/rpl/r/rpl_packet.result mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt mysql-test/suite/rpl/rpl_1slave_base.cnf mysql-test/suite/rpl/t/rpl_begin_commit_rollback-master.opt mysql-test/suite/rpl/t/rpl_begin_commit_rollback-slave.opt mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf mysql-test/suite/rpl/t/rpl_concurrency_error-master.opt mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt mysql-test/suite/rpl/t/rpl_drop.test mysql-test/suite/rpl/t/rpl_innodb-master.opt mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt mysql-test/suite/rpl/t/rpl_packet.test mysql-test/suite/rpl/t/rpl_start_stop_slave-slave.opt mysql-test/suite/rpl/t/rpl_trigger.test mysql-test/suite/rpl/t/rpl_typeconv-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_2other-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-master.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-master.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-master.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb-master.opt mysql-test/suite/sys_vars/t/autocommit_func-master.opt mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt mysql-test/suite/sys_vars/t/identity_func-master.opt mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt mysql-test/suite/sys_vars/t/max_binlog_cache_size_func-master.opt mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt mysql-test/t/bug46760-master.opt mysql-test/t/concurrent_innodb_safelog-master.opt mysql-test/t/concurrent_innodb_unsafelog-master.opt mysql-test/t/connect.cnf mysql-test/t/ctype_filesystem.test mysql-test/t/disabled.def mysql-test/t/events_time_zone.test mysql-test/t/func_gconcat.test mysql-test/t/func_misc.test mysql-test/t/group_by.test mysql-test/t/having.test mysql-test/t/information_schema.test mysql-test/t/loaddata.test mysql-test/t/lowercase_view.test mysql-test/t/mysql_client_test.test mysql-test/t/mysql_upgrade.test mysql-test/t/mysqltest_ps.test mysql-test/t/partition_innodb-master.opt mysql-test/t/partition_innodb_semi_consistent-master.opt mysql-test/t/pool_of_threads.cnf mysql-test/t/show_check-master.opt mysql-test/t/sp_trans_log.test mysql-test/t/subselect4.test mysql-test/t/unsafe_binlog_innodb-master.opt mysql-test/t/update.test mysql-test/t/warnings_engine_disabled.test mysys/Makefile.am mysys/errors.c mysys/mf_iocache.c mysys/mf_pack.c mysys/my_bitmap.c mysys/my_copy.c mysys/my_gethwaddr.c mysys/my_getopt.c mysys/my_getwd.c mysys/my_handler.c mysys/my_redel.c mysys/my_static.c mysys/my_sync.c mysys/stacktrace.c mysys/thr_lock.c netware/Makefile.am plugin/Makefile.am plugin/daemon_example/Makefile.am pstack/Makefile.am regex/Makefile.am regex/engine.c regex/regcomp.c scripts/Makefile.am scripts/mysql_secure_installation.pl.in scripts/mysql_secure_installation.sh scripts/mysql_system_tables_fix.sql server-tools/Makefile.am server-tools/instance-manager/instance_options.cc sql-bench/Makefile.am sql-common/Makefile.am sql/Makefile.am sql/field.cc sql/ha_partition.cc sql/ha_partition.h sql/handler.cc sql/handler.h sql/item.cc sql/item.h sql/item_buff.cc sql/item_create.cc sql/item_func.cc sql/item_func.h sql/item_sum.cc sql/item_sum.h sql/item_timefunc.cc sql/log.cc sql/log.h sql/log_event.cc sql/log_event.h sql/log_event_old.cc sql/mysql_priv.h sql/mysqld.cc sql/opt_range.cc sql/partition_info.cc sql/protocol.cc sql/rpl_rli.cc sql/set_var.cc sql/set_var.h sql/slave.cc sql/spatial.cc sql/spatial.h sql/sql_acl.cc sql/sql_base.cc sql/sql_cache.cc sql/sql_class.cc sql/sql_class.h sql/sql_cursor.cc sql/sql_insert.cc sql/sql_lex.cc sql/sql_lex.h sql/sql_list.h sql/sql_load.cc sql/sql_parse.cc sql/sql_partition.cc sql/sql_partition.h sql/sql_prepare.cc sql/sql_repl.cc sql/sql_select.cc sql/sql_select.h sql/sql_show.cc sql/sql_table.cc sql/sql_update.cc sql/table.h sql/udf_example.c sql/unireg.h storage/Makefile.am storage/archive/Makefile.am storage/blackhole/Makefile.am storage/csv/Makefile.am storage/csv/ha_tina.cc storage/example/Makefile.am storage/example/ha_example.cc storage/federated/Makefile.am storage/federated/ha_federated.cc storage/federatedx/federatedx_io_mysql.cc storage/federatedx/federatedx_io_null.cc storage/federatedx/ha_federatedx.cc storage/federatedx/ha_federatedx.h storage/heap/hp_test2.c storage/ibmdb2i/Makefile.am storage/ibmdb2i/db2i_file.h storage/innobase/Makefile.am storage/innobase/dict/dict0load.c storage/innobase/os/os0file.c storage/innodb_plugin/ChangeLog storage/innodb_plugin/Makefile.am storage/innodb_plugin/btr/btr0cur.c storage/innodb_plugin/btr/btr0sea.c storage/innodb_plugin/ha/ha0ha.c storage/innodb_plugin/handler/ha_innodb.cc storage/innodb_plugin/include/btr0cur.h storage/innodb_plugin/include/btr0sea.h storage/innodb_plugin/include/mem0pool.h storage/innodb_plugin/include/row0mysql.h storage/innodb_plugin/include/univ.i storage/innodb_plugin/mem/mem0mem.c storage/innodb_plugin/mem/mem0pool.c storage/innodb_plugin/row/row0merge.c storage/innodb_plugin/row/row0row.c storage/innodb_plugin/row/row0sel.c storage/innodb_plugin/row/row0undo.c storage/innodb_plugin/row/row0upd.c storage/innodb_plugin/srv/srv0start.c storage/maria/ha_maria.cc storage/maria/ma_bitmap.c storage/maria/ma_blockrec.c storage/maria/ma_check.c storage/maria/ma_checkpoint.c storage/maria/ma_control_file.c storage/maria/ma_key_recover.c storage/maria/ma_key_recover.h storage/maria/ma_loghandler.h storage/maria/ma_recovery.c storage/maria/ma_rt_index.c storage/maria/ma_state.c storage/maria/ma_static.c storage/maria/ma_test2.c storage/maria/ma_write.c storage/maria/maria_chk.c storage/maria/maria_def.h storage/maria/maria_pack.c storage/maria/maria_read_log.c storage/maria/trnman.c storage/maria/unittest/ma_test_recovery.pl storage/myisam/mi_dynrec.c storage/myisam/mi_locking.c storage/myisam/mi_open.c storage/myisam/mi_page.c storage/myisam/mi_search.c storage/myisam/mi_test2.c storage/myisam/mi_unique.c storage/myisam/rt_split.c storage/myisammrg/ha_myisammrg.cc storage/myisammrg/myrg_open.c storage/ndb/src/common/portlib/NdbMutex.c storage/ndb/src/ndbapi/DictCache.cpp storage/xtradb/buf/buf0lru.c storage/xtradb/fil/fil0fil.c storage/xtradb/handler/i_s.cc storage/xtradb/include/univ.i storage/xtradb/srv/srv0srv.c strings/CMakeLists.txt strings/Makefile.am strings/ctype-big5.c strings/ctype-cp932.c strings/ctype-euc_kr.c strings/ctype-eucjpms.c strings/ctype-gb2312.c strings/ctype-gbk.c strings/ctype-mb.c strings/ctype-sjis.c strings/ctype-ujis.c strings/decimal.c strings/make-ccc strings/strxmov.c support-files/Makefile.am support-files/compiler_warnings.supp tests/Makefile.am tests/mysql_client_test.c unittest/Makefile.am unittest/mysys/Makefile.am unittest/mytap/tap.h vio/Makefile.am win/Makefile.am zlib/Makefile.am === modified file '.bzrignore' --- a/.bzrignore 2010-05-13 11:00:53 +0000 +++ b/.bzrignore 2010-08-18 07:52:57 +0000 @@ -1928,3 +1928,5 @@ libmysqld/ha_federatedx.cc tmp libmysqld/debug_sync.cc storage/pbxt/bin/xtstat +mysql-test/mtr_command +scripts/convert-debug-for-diff === modified file 'BUILD/Makefile.am' --- a/BUILD/Makefile.am 2010-01-07 13:03:54 +0000 +++ b/BUILD/Makefile.am 2010-08-27 14:12:44 +0000 @@ -83,6 +83,3 @@ EXTRA_DIST = FINISH.sh \ compile-solaris-x86-32-debug-forte \ compile-solaris-x86-forte-32 \ util.sh - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'BUILD/SETUP.sh' --- a/BUILD/SETUP.sh 2010-08-02 09:01:24 +0000 +++ b/BUILD/SETUP.sh 2010-08-27 14:12:44 +0000 @@ -91,29 +91,26 @@ path=`dirname $0` get_make_parallel_flag # SSL library to use.--with-ssl will select our bundled yaSSL -# implementation of SSL. To use openSSl you will nee too point out -# the location of openSSL headers and lbs on your system. +# implementation of SSL. To use OpenSSL you will need to specify +# the location of OpenSSL headers and libs on your system. # Ex --with-ssl=/usr SSL_LIBRARY=--with-ssl if [ "x$warning_mode" != "xpedantic" ]; then # Both C and C++ warnings - warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W" - warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare" - warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable" + warnings="-Wall -Wextra -Wunused -Wwrite-strings" # For more warnings, uncomment the following line -# warnings="$global_warnings -Wshadow" +# warnings="$warnings -Wshadow" # C warnings - c_warnings="$warnings -Wunused-parameter" + c_warnings="$warnings" # C++ warnings - cxx_warnings="$warnings" + cxx_warnings="$warnings -Wno-unused-parameter" # cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo" - cxx_warnings="$cxx_warnings -Wreorder" cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor" # Added unless --with-debug=full - debug_extra_cflags="-O0 -g3 -gdwarf-2" #1 -Wuninitialized" + debug_extra_cflags="-O0 -g3 -gdwarf-2" else warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE" c_warnings="$warnings" @@ -182,8 +179,7 @@ max_no_embedded_configs="$SSL_LIBRARY -- max_no_qc_configs="$SSL_LIBRARY --with-plugins=max --without-query-cache" max_no_ndb_configs="$SSL_LIBRARY --with-plugins=max-no-ndb --with-embedded-server --with-libevent" max_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server --with-libevent" -# Disable NDB in maria max builds -max_configs=$max_no_ndb_configs +all_configs="$SSL_LIBRARY --with-plugins=max --with-plugin-ndbcluster --with-embedded-server --with-libevent" # # CPU and platform specific compilation flags. === modified file 'BUILD/check-cpu' --- a/BUILD/check-cpu 2009-09-01 13:39:13 +0000 +++ b/BUILD/check-cpu 2010-07-02 18:30:47 +0000 @@ -181,14 +181,17 @@ check_cpu () { cc=$CC fi - cc_ver=`$cc --version | sed 1q` - cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'` - set -- `echo $cc_verno | tr '.' ' '` - cc_major=$1 - cc_minor=$2 - cc_patch=$3 - cc_comp=`expr $cc_major '*' 100 '+' $cc_minor` - + # check if compiler is gcc and dump its version + cc_verno=`$cc -dumpversion 2>/dev/null` + if test "x$?" = "x0" ; then + set -- `echo $cc_verno | tr '.' ' '` + cc_ver="GCC" + cc_major=$1 + cc_minor=$2 + cc_patch=$3 + cc_comp=`expr $cc_major '*' 100 '+' $cc_minor` + fi + case "$cc_ver--$cc_verno" in *GCC*) # different gcc backends (and versions) have different CPU flags @@ -229,7 +232,7 @@ check_cpu () { fi while [ "$cpu_arg" ] ; do printf "testing $cpu_arg ... " >&2 - + # compile check eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null if test "x$?" = "x0" ; then @@ -243,5 +246,5 @@ check_cpu () { done rm __test.* } - + check_cpu === added file 'BUILD/compile-amd64-debug-all' --- a/BUILD/compile-amd64-debug-all 1970-01-01 00:00:00 +0000 +++ b/BUILD/compile-amd64-debug-all 2010-08-10 14:36:04 +0000 @@ -0,0 +1,7 @@ +#! /bin/sh +path=`dirname $0` +. "$path/SETUP.sh" +extra_flags="$amd64_cflags $debug_cflags" +extra_configs="$amd64_configs $debug_configs $all_configs" + +. "$path/FINISH.sh" === added file 'BUILD/compile-pentium-debug-all' --- a/BUILD/compile-pentium-debug-all 1970-01-01 00:00:00 +0000 +++ b/BUILD/compile-pentium-debug-all 2010-08-10 14:36:04 +0000 @@ -0,0 +1,10 @@ +#! /bin/sh + +path=`dirname $0` +set -- "$@" --with-debug=full +. "$path/SETUP.sh" + +extra_flags="$pentium_cflags $debug_cflags" +extra_configs="$pentium_configs $debug_configs $all_configs $error_inject --with-experimental-collations" + +. "$path/FINISH.sh" === added file 'BUILD/compile-pentium64-debug-all' --- a/BUILD/compile-pentium64-debug-all 1970-01-01 00:00:00 +0000 +++ b/BUILD/compile-pentium64-debug-all 2010-08-10 14:36:04 +0000 @@ -0,0 +1,12 @@ +#! /bin/sh + +path=`dirname $0` +set -- "$@" --with-debug=full +. "$path/SETUP.sh" + +extra_flags="$pentium64_cflags $debug_cflags" +extra_configs="$pentium_configs $debug_configs $all_configs" + +extra_configs="$extra_configs " +CC="$CC --pipe" +. "$path/FINISH.sh" === modified file 'Docs/Makefile.am' --- a/Docs/Makefile.am 2008-04-08 09:44:18 +0000 +++ b/Docs/Makefile.am 2010-08-27 14:12:44 +0000 @@ -37,6 +37,3 @@ uninstall-local: @RM@ -f $(DESTDIR)$(infodir)/mysql.info ; \ @RM@ -f $(DESTDIR)$(pkgdatadir)/ChangeLog ; \ fi - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'Makefile.am' --- a/Makefile.am 2010-08-02 09:01:24 +0000 +++ b/Makefile.am 2010-08-27 14:12:44 +0000 @@ -324,7 +324,7 @@ abi_check_all: $(TEST_PREPROCESSOR_HEADE do_abi_check: set -ex; \ for file in $(abi_headers); do \ - @CC@ -E -nostdinc -dI \ + @CC@ -E -nostdinc -dI -DMYSQL_ABI_CHECK \ -I$(top_srcdir)/include \ -I$(top_srcdir)/include/mysql \ -I$(top_srcdir)/sql \ @@ -340,6 +340,3 @@ do_abi_check: @DIFF@ -w $$file.pp $(top_builddir)/abi_check.out; \ @RM@ $(top_builddir)/abi_check.out; \ done - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'client/Makefile.am' --- a/client/Makefile.am 2009-09-03 12:29:25 +0000 +++ b/client/Makefile.am 2010-08-27 14:12:44 +0000 @@ -122,6 +122,3 @@ link_sources: rm -f $(srcdir)/my_user.c; \ @LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c; echo timestamp > link_sources; - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'client/mysql.cc' --- a/client/mysql.cc 2010-08-02 09:01:24 +0000 +++ b/client/mysql.cc 2010-08-27 14:12:44 +0000 @@ -156,6 +156,7 @@ static my_bool ignore_errors=0,wait_flag static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error; static my_bool column_types_flag; static my_bool preserve_comments= 0; +static my_bool in_com_source, aborted= 0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0; static uint my_end_arg; @@ -1087,6 +1088,7 @@ int main(int argc,char *argv[]) "\\N [\\d]> ",MYF(MY_WME)); current_prompt = my_strdup(default_prompt,MYF(MY_WME)); prompt_counter=0; + aborted= 0; outfile[0]=0; // no (default) outfile strmov(pager, "stdout"); // the default, if --pager wasn't given @@ -1281,8 +1283,10 @@ sig_handler mysql_end(int sig) /* This function handles sigint calls If query is in process, kill query + If 'source' is executed, abort source command no query in process, terminate like previous behavior */ + sig_handler handle_sigint(int sig) { char kill_buffer[40]; @@ -1321,7 +1325,8 @@ sig_handler handle_sigint(int sig) mysql_close(kill_mysql); tee_fprintf(stdout, "Ctrl-C -- query killed. Continuing normally.\n"); interrupted_query= 0; - + if (in_com_source) + aborted= 1; // Abort source command return; err: @@ -1878,7 +1883,7 @@ static int read_and_execute(bool interac String buffer; #endif - char *line; + char *line= 0; char in_string=0; ulong line_number=0; bool ml_comment= 0; @@ -1886,7 +1891,7 @@ static int read_and_execute(bool interac bool truncated= 0; status.exit_status=1; - for (;;) + while (!aborted) { if (!interactive) { @@ -3650,7 +3655,7 @@ xmlencode_print(const char *src, uint le tee_fputs("NULL", PAGER); else { - for (const char *p = src; length; *p++, length--) + for (const char *p = src; length; p++, length--) { const char *t; if ((t = array_value(xmlmeta, *p))) @@ -4066,17 +4071,19 @@ static int com_source(String *buffer, ch status.file_name=source_name; glob_buffer.length(0); // Empty command buffer ignore_errors= !batch_abort_on_error; + in_com_source= 1; error= read_and_execute(false); ignore_errors= save_ignore_errors; status=old_status; // Continue as before + in_com_source= aborted= 0; my_fclose(sql_file,MYF(0)); batch_readline_end(line_buff); /* If we got an error during source operation, don't abort the client if ignore_errors is set */ - if (error && batch_abort_on_error && ignore_errors) - error= -1; + if (error && !batch_abort_on_error && ignore_errors) + error= -1; // Ignore error return error; } @@ -4760,7 +4767,7 @@ static const char *construct_prompt() struct tm *t = localtime(&lclock); /* parse thru the settings for the prompt */ - for (char *c = current_prompt; *c ; *c++) + for (char *c = current_prompt; *c ; c++) { if (*c != PROMPT_CHAR) processed_prompt.append(*c); === modified file 'client/mysqlcheck.c' --- a/client/mysqlcheck.c 2010-08-02 09:01:24 +0000 +++ b/client/mysqlcheck.c 2010-08-27 14:12:44 +0000 @@ -71,8 +71,8 @@ static struct my_option my_long_options[ &opt_auto_repair, &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR, - "Directory for character set files.", &charsets_dir, - &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "Directory for character set files.", (char**) &charsets_dir, + (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"check", 'c', "Check table for errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"check-only-changed", 'C', === modified file 'client/mysqldump.c' --- a/client/mysqldump.c 2010-08-02 09:01:24 +0000 +++ b/client/mysqldump.c 2010-08-11 10:55:54 +0000 @@ -211,8 +211,8 @@ static struct my_option my_long_options[ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"character-sets-dir", OPT_CHARSETS_DIR, - "Directory for character set files.", &charsets_dir, - &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "Directory for character set files.", (char**) &charsets_dir, + (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"comments", 'i', "Write additional information.", &opt_comments, &opt_comments, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, @@ -242,8 +242,8 @@ static struct my_option my_long_options[ {"debug", '#', "This is a non-debug version. Catch this and exit.", 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else - {"debug", '#', "Output debug log.", &default_dbug_option, - &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"debug", '#', "Output debug log.", (char**) &default_dbug_option, + (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", &debug_check_flag, &debug_check_flag, 0, === modified file 'client/mysqlimport.c' --- a/client/mysqlimport.c 2010-06-10 20:16:43 +0000 +++ b/client/mysqlimport.c 2010-08-11 10:55:54 +0000 @@ -73,8 +73,8 @@ static struct my_option my_long_options[ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"character-sets-dir", OPT_CHARSETS_DIR, - "Directory for character set files.", &charsets_dir, - &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "Directory for character set files.", (char**) &charsets_dir, + (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"default-character-set", OPT_DEFAULT_CHARSET, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, === modified file 'client/mysqlshow.c' --- a/client/mysqlshow.c 2010-06-10 20:16:43 +0000 +++ b/client/mysqlshow.c 2010-08-27 14:12:44 +0000 @@ -164,7 +164,7 @@ static struct my_option my_long_options[ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"character-sets-dir", 'c', "Directory for character set files.", - &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, + (char**) &charsets_dir, (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"default-character-set", OPT_DEFAULT_CHARSET, "Set the default character set.", &default_charset, @@ -669,8 +669,7 @@ list_fields(MYSQL *mysql,const char *db, char query[1024],*end; MYSQL_RES *result; MYSQL_ROW row; - ulong rows; - LINT_INIT(rows); + ulong UNINIT_VAR(rows); if (mysql_select_db(mysql,db)) { === modified file 'client/mysqlslap.c' --- a/client/mysqlslap.c 2010-08-02 09:01:24 +0000 +++ b/client/mysqlslap.c 2010-08-07 14:42:30 +0000 @@ -543,7 +543,7 @@ static struct my_option my_long_options[ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"auto-generate-sql-load-type", OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, "Specify test load type: mixed, update, write, key, or read; default is mixed.", - &auto_generate_sql_type, &auto_generate_sql_type, + (char**) &auto_generate_sql_type, (char**) &auto_generate_sql_type, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"auto-generate-sql-secondary-indexes", OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES, @@ -574,13 +574,13 @@ static struct my_option my_long_options[ &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"concurrency", 'c', "Number of clients to simulate for query to run.", - &concurrency_str, &concurrency_str, 0, GET_STR, + (char**) &concurrency_str, (char**) &concurrency_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"create", OPT_SLAP_CREATE_STRING, "File or string to use create tables.", &create_string, &create_string, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"create-schema", OPT_CREATE_SLAP_SCHEMA, "Schema to run tests in.", - &create_schema_string, &create_schema_string, 0, GET_STR, + (char**) &create_schema_string, (char**) &create_schema_string, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"csv", OPT_SLAP_CSV, "Generate CSV output to named file or to stdout if no file is named.", @@ -590,7 +590,7 @@ static struct my_option my_long_options[ 0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", - &default_dbug_option, &default_dbug_option, 0, GET_STR, + (char**) &default_dbug_option, (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", @@ -600,7 +600,7 @@ static struct my_option my_long_options[ &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"delimiter", 'F', "Delimiter to use in SQL statements supplied in file or command line.", - &delimiter, &delimiter, 0, GET_STR, REQUIRED_ARG, + (char**) &delimiter, (char**) &delimiter, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"detach", OPT_SLAP_DETACH, "Detach (close and reopen) connections after X number of requests.", @@ -618,11 +618,11 @@ static struct my_option my_long_options[ &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0}, {"number-char-cols", 'x', "Number of VARCHAR columns to create in table if specifying --auto-generate-sql.", - &num_char_cols_opt, &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG, + (char**) &num_char_cols_opt, (char**) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"number-int-cols", 'y', "Number of INT columns to create in table if specifying --auto-generate-sql.", - &num_int_cols_opt, &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG, + (char**) &num_int_cols_opt, (char**) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"number-of-queries", OPT_MYSQL_NUMBER_OF_QUERY, "Limit each client to this number of queries (this is not exact).", === modified file 'client/mysqltest.cc' --- a/client/mysqltest.cc 2010-08-02 09:01:24 +0000 +++ b/client/mysqltest.cc 2010-08-27 14:12:44 +0000 @@ -5825,7 +5825,7 @@ int read_command(struct st_command** com (struct st_command*) my_malloc(sizeof(*command), MYF(MY_WME|MY_ZEROFILL))) || insert_dynamic(&q_lines, (uchar*) &command)) - die(NullS); + die("Out of memory"); command->type= Q_UNKNOWN; read_command_buf[0]= 0; @@ -6322,7 +6322,7 @@ void init_win_path_patterns() } if (insert_dynamic(&patterns, (uchar*) &p)) - die(NullS); + die("Out of memory"); DBUG_PRINT("info", ("p: %s", p)); while (*p) @@ -9402,8 +9402,7 @@ REPLACE *init_replace(char * *from, char for (i=1 ; i <= found_sets ; i++) { pos=from[found_set[i-1].table_offset]; - rep_str[i].found= !bcmp((const uchar*) pos, - (const uchar*) "\\^", 3) ? 2 : 1; + rep_str[i].found= !memcmp(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)+ @@ -9531,8 +9530,8 @@ void copy_bits(REP_SET *to,REP_SET *from int cmp_bits(REP_SET *set1,REP_SET *set2) { - return bcmp((uchar*) set1->bits,(uchar*) set2->bits, - sizeof(uint) * set1->size_of_bits); + return memcmp(set1->bits, set2->bits, + sizeof(uint) * set1->size_of_bits); } @@ -9601,17 +9600,15 @@ int find_found(FOUND_SET *found_set,uint uint start_at_word(char * pos) { - return (((!bcmp((const uchar*) pos, (const uchar*) "\\b",2) && pos[2]) || - !bcmp((const uchar*) pos, (const uchar*) "\\^", 2)) ? 1 : 0); + return (((!memcmp(pos, "\\b",2) && pos[2]) || + !memcmp(pos, "\\^", 2)) ? 1 : 0); } uint end_of_word(char * pos) { char * end=strend(pos); - return ((end > pos+2 && !bcmp((const uchar*) end-2, - (const uchar*) "\\b", 2)) || - (end >= pos+2 && !bcmp((const uchar*) end-2, - (const uchar*) "\\$",2))) ? 1 : 0; + return ((end > pos+2 && !memcmp(end-2, "\\b", 2)) || + (end >= pos+2 && !memcmp(end-2, "\\$",2))) ? 1 : 0; } /**************************************************************************** === modified file 'cmd-line-utils/Makefile.am' --- a/cmd-line-utils/Makefile.am 2006-12-23 19:17:15 +0000 +++ b/cmd-line-utils/Makefile.am 2010-08-27 14:12:44 +0000 @@ -19,6 +19,3 @@ SUBDIRS= @readline_basedir@ DIST_SUBDIRS= libedit readline - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'cmd-line-utils/readline/Makefile.am' --- a/cmd-line-utils/readline/Makefile.am 2009-07-08 14:49:45 +0000 +++ b/cmd-line-utils/readline/Makefile.am 2010-07-02 18:30:47 +0000 @@ -31,7 +31,7 @@ noinst_HEADERS = readline.h chardefs.h k EXTRA_DIST= emacs_keymap.c vi_keymap.c -DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR +DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR -D_GNU_SOURCE=1 # Don't update the files from bitkeeper %::SCCS/s.% === modified file 'cmd-line-utils/readline/input.c' --- a/cmd-line-utils/readline/input.c 2009-06-29 13:17:01 +0000 +++ b/cmd-line-utils/readline/input.c 2010-07-02 18:30:47 +0000 @@ -318,7 +318,9 @@ _rl_input_available () return (_kbhit ()); #endif +#if !defined (HAVE_SELECT) return 0; +#endif } int === added file 'config/ac-macros/maintainer.m4' --- a/config/ac-macros/maintainer.m4 1970-01-01 00:00:00 +0000 +++ b/config/ac-macros/maintainer.m4 2010-07-09 12:51:21 +0000 @@ -0,0 +1,64 @@ +# +# Control aspects of the development environment which are +# specific to MySQL maintainers and developers. +# +AC_DEFUN([MY_MAINTAINER_MODE], [ + AC_MSG_CHECKING([whether to enable the maintainer-specific development environment]) + AC_ARG_ENABLE([mysql-maintainer-mode], + [AS_HELP_STRING([--enable-mysql-maintainer-mode], + [Enable a MySQL maintainer-specific development environment])], + [USE_MYSQL_MAINTAINER_MODE=$enableval], + [USE_MYSQL_MAINTAINER_MODE=no]) + AC_MSG_RESULT([$USE_MYSQL_MAINTAINER_MODE]) +]) + +# Set warning options required under maintainer mode. +AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [ + # Setup GCC warning options. + AS_IF([test "$GCC" = "yes"], [ + C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror" + CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter" + ]) + + # Test whether the warning options work. + # Test C options + AS_IF([test -n "$C_WARNINGS"], [ + save_CFLAGS="$CFLAGS" + AC_MSG_CHECKING([whether to use C warning options ${C_WARNINGS}]) + AC_LANG_PUSH(C) + CFLAGS="$CFLAGS ${C_WARNINGS}" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_c_warning_flags=yes], + [myac_c_warning_flags=no]) + AC_LANG_POP() + AC_MSG_RESULT([$myac_c_warning_flags]) + CFLAGS="$save_CFLAGS" + ]) + + # Test C++ options + AS_IF([test -n "$CXX_WARNINGS"], [ + save_CXXFLAGS="$CXXFLAGS" + AC_MSG_CHECKING([whether to use C++ warning options ${CXX_WARNINGS}]) + AC_LANG_PUSH(C++) + CXXFLAGS="$CXXFLAGS ${CXX_WARNINGS}" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_cxx_warning_flags=yes], + [myac_cxx_warning_flags=no]) + AC_LANG_POP() + AC_MSG_RESULT([$myac_cxx_warning_flags]) + CXXFLAGS="$save_CXXFLAGS" + ]) + + # Set compile flag variables. + AS_IF([test "$myac_c_warning_flags" = "yes"], [ + AM_CFLAGS="${AM_CFLAGS} ${C_WARNINGS}" + AC_SUBST([AM_CFLAGS])]) + AS_IF([test "$myac_cxx_warning_flags" = "yes"], [ + AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS}" + AC_SUBST([AM_CXXFLAGS])]) +]) + + +# Set compiler flags required under maintainer mode. +AC_DEFUN([MY_MAINTAINER_MODE_SETUP], [ + AS_IF([test "$USE_MYSQL_MAINTAINER_MODE" = "yes"], + [MY_MAINTAINER_MODE_WARNINGS]) +]) === modified file 'configure.in' --- a/configure.in 2010-08-06 07:49:53 +0000 +++ b/configure.in 2010-08-27 14:12:44 +0000 @@ -12,7 +12,7 @@ dnl dnl When changing the major version number please also check the switch dnl statement in mysqlbinlog::check_master_version(). You may also need dnl to update version.c in ndb. -AC_INIT([MariaDB Server], [5.1.49-MariaDB], [], [mysql]) +AC_INIT([MariaDB Server], [5.1.50-MariaDB], [], [mysql]) AC_CONFIG_SRCDIR([sql/mysqld.cc]) AC_CANONICAL_SYSTEM @@ -65,6 +65,7 @@ MYSQL_TCP_PORT_DEFAULT=3306 MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock" dnl Include m4 +sinclude(config/ac-macros/maintainer.m4) sinclude(config/ac-macros/alloca.m4) sinclude(config/ac-macros/check_cpu.m4) sinclude(config/ac-macros/character_sets.m4) @@ -103,6 +104,8 @@ AC_SUBST(SHARED_LIB_MAJOR_VERSION) AC_SUBST(SHARED_LIB_VERSION) AC_SUBST(AVAILABLE_LANGUAGES) +# Whether the maintainer mode should be enabled. +MY_MAINTAINER_MODE # Canonicalize the configuration name. @@ -2892,7 +2895,13 @@ do done AC_SUBST(sql_union_dirs) -# Some useful subst +# +# Setup maintainer mode options by the end to not disturb +# system and other checks. +# +MY_MAINTAINER_MODE_SETUP + +# Some usefull subst AC_SUBST(CC) AC_SUBST(GXX) @@ -2917,7 +2926,8 @@ fi AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl unittest/Makefile unittest/mytap/Makefile unittest/mytap/t/Makefile dnl - unittest/mysys/Makefile unittest/examples/Makefile dnl + unittest/mysys/Makefile unittest/strings/Makefile dnl + unittest/examples/Makefile dnl strings/Makefile regex/Makefile storage/Makefile dnl man/Makefile BUILD/Makefile vio/Makefile dnl libmysql/Makefile libmysql_r/Makefile client/Makefile dnl === modified file 'dbug/Makefile.am' --- a/dbug/Makefile.am 2008-02-06 20:33:25 +0000 +++ b/dbug/Makefile.am 2010-08-27 14:12:44 +0000 @@ -65,6 +65,3 @@ output5.r: factorial # a hack to have executable in builddir, not in srcdir tests-t: tests-t.pl cp -f $(srcdir)/tests-t.pl ./tests-t - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'extra/Makefile.am' --- a/extra/Makefile.am 2009-03-12 22:27:35 +0000 +++ b/extra/Makefile.am 2010-08-27 14:12:44 +0000 @@ -55,6 +55,3 @@ EXTRA_DIST = CMakeLists.txt perror.o: perror.c $(COMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'extra/comp_err.c' --- a/extra/comp_err.c 2010-08-04 18:36:11 +0000 +++ b/extra/comp_err.c 2010-08-27 14:12:44 +0000 @@ -640,9 +640,9 @@ static struct message *find_message(stru static ha_checksum checksum_format_specifier(const char* msg) { ha_checksum chksum= 0; - const char* p= msg; - const char* start= 0; - int num_format_specifiers= 0; + const uchar* p= (const uchar*) msg; + const uchar* start= NULL; + uint32 num_format_specifiers= 0; while (*p) { @@ -832,7 +832,6 @@ static struct message *parse_message_str static struct errors *parse_error_string(char *str, int er_count) { struct errors *new_error; - char *start; DBUG_ENTER("parse_error_string"); DBUG_PRINT("enter", ("str: %s", str)); @@ -843,7 +842,6 @@ static struct errors *parse_error_string DBUG_RETURN(0); /* OOM: Fatal error */ /* getting the error name */ - start= str; str= skip_delimiters(str); if (!(new_error->er_name= get_word(&str))) === modified file 'extra/my_print_defaults.c' --- a/extra/my_print_defaults.c 2010-08-04 18:36:11 +0000 +++ b/extra/my_print_defaults.c 2010-08-11 10:55:54 +0000 @@ -55,8 +55,8 @@ static struct my_option my_long_options[ {"debug", '#', "This is a non-debug version. Catch this and exit", 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else - {"debug", '#', "Output debug log", &default_dbug_option, - &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"debug", '#', "Output debug log", (char**) &default_dbug_option, + (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif {"defaults-file", 'c', "Like --config-file, except: if first option, " "then read this file only, do not read global or per-user config " === modified file 'extra/replace.c' --- a/extra/replace.c 2008-02-18 22:35:17 +0000 +++ b/extra/replace.c 2010-08-27 14:12:44 +0000 @@ -649,7 +649,7 @@ static REPLACE *init_replace(char * *fro for (i=1 ; i <= found_sets ; i++) { pos=from[found_set[i-1].table_offset]; - rep_str[i].found= (my_bool) (!bcmp(pos,"\\^",3) ? 2 : 1); + rep_str[i].found= (my_bool) (!memcmp(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)+ @@ -777,8 +777,8 @@ static void copy_bits(REP_SET *to,REP_SE static int cmp_bits(REP_SET *set1,REP_SET *set2) { - return bcmp((uchar*) set1->bits,(uchar*) set2->bits, - sizeof(uint) * set1->size_of_bits); + return memcmp(set1->bits, set2->bits, + sizeof(uint) * set1->size_of_bits); } @@ -850,14 +850,14 @@ static short find_found(FOUND_SET *found static uint start_at_word(char * pos) { - return (((!bcmp(pos,"\\b",2) && pos[2]) || !bcmp(pos,"\\^",2)) ? 1 : 0); + return (((!memcmp(pos,"\\b",2) && pos[2]) || !memcmp(pos,"\\^",2)) ? 1 : 0); } static uint end_of_word(char * pos) { char * end=strend(pos); - return ((end > pos+2 && !bcmp(end-2,"\\b",2)) || - (end >= pos+2 && !bcmp(end-2,"\\$",2))) ? + return ((end > pos+2 && !memcmp(end-2,"\\b",2)) || + (end >= pos+2 && !memcmp(end-2,"\\$",2))) ? 1 : 0; } === modified file 'extra/yassl/src/yassl_imp.cpp' --- a/extra/yassl/src/yassl_imp.cpp 2009-09-15 11:22:39 +0000 +++ b/extra/yassl/src/yassl_imp.cpp 2010-08-27 14:12:44 +0000 @@ -884,21 +884,19 @@ void Alert::Process(input_buffer& input, else hmac(ssl, verify, data, aSz, alert, true); - // read mac and fill + // read mac and skip fill int digestSz = ssl.getCrypto().get_digest().get_digestSize(); opaque mac[SHA_LEN]; input.read(mac, digestSz); if (ssl.getSecurity().get_parms().cipher_type_ == block) { int ivExtra = 0; - opaque fill; if (ssl.isTLSv1_1()) ivExtra = ssl.getCrypto().get_cipher().get_blockSize(); int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra - aSz - digestSz; - for (int i = 0; i < padSz; i++) - fill = input[AUTO]; + input.set_current(input.get_current() + padSz); } // verify @@ -981,17 +979,17 @@ output_buffer& operator<<(output_buffer& void Data::Process(input_buffer& input, SSL& ssl) { int msgSz = ssl.getSecurity().get_parms().encrypt_size_; - int pad = 0, padByte = 0; + int pad = 0, padSz = 0; int ivExtra = 0; if (ssl.getSecurity().get_parms().cipher_type_ == block) { if (ssl.isTLSv1_1()) // IV ivExtra = ssl.getCrypto().get_cipher().get_blockSize(); pad = *(input.get_buffer() + input.get_current() + msgSz -ivExtra - 1); - padByte = 1; + padSz = 1; } int digestSz = ssl.getCrypto().get_digest().get_digestSize(); - int dataSz = msgSz - ivExtra - digestSz - pad - padByte; + int dataSz = msgSz - ivExtra - digestSz - pad - padSz; opaque verify[SHA_LEN]; const byte* rawData = input.get_buffer() + input.get_current(); @@ -1020,14 +1018,10 @@ void Data::Process(input_buffer& input, hmac(ssl, verify, rawData, dataSz, application_data, true); } - // read mac and fill + // read mac and skip fill opaque mac[SHA_LEN]; - opaque fill; input.read(mac, digestSz); - for (int i = 0; i < pad; i++) - fill = input[AUTO]; - if (padByte) - fill = input[AUTO]; + input.set_current(input.get_current() + pad + padSz); // verify if (dataSz) { @@ -2072,11 +2066,9 @@ void Finished::Process(input_buffer& inp if (ssl.isTLSv1_1()) ivExtra = ssl.getCrypto().get_cipher().get_blockSize(); - opaque fill; int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra - HANDSHAKE_HEADER - finishedSz - digestSz; - for (int i = 0; i < padSz; i++) - fill = input[AUTO]; + input.set_current(input.get_current() + padSz); // verify mac if (memcmp(mac, verifyMAC, digestSz)) { === modified file 'extra/yassl/taocrypt/include/blowfish.hpp' --- a/extra/yassl/taocrypt/include/blowfish.hpp 2007-01-29 15:54:40 +0000 +++ b/extra/yassl/taocrypt/include/blowfish.hpp 2010-07-02 18:30:47 +0000 @@ -51,7 +51,7 @@ public: enum { BLOCK_SIZE = BLOWFISH_BLOCK_SIZE, ROUNDS = 16 }; Blowfish(CipherDir DIR, Mode MODE) - : Mode_BASE(BLOCK_SIZE, DIR, MODE) {} + : Mode_BASE(BLOCK_SIZE, DIR, MODE), sbox_(pbox_ + ROUNDS + 2) {} #ifdef DO_BLOWFISH_ASM void Process(byte*, const byte*, word32); @@ -62,8 +62,8 @@ private: static const word32 p_init_[ROUNDS + 2]; static const word32 s_init_[4 * 256]; - word32 pbox_[ROUNDS + 2]; - word32 sbox_[4 * 256]; + word32 pbox_[ROUNDS + 2 + 4 * 256]; + word32* sbox_; void crypt_block(const word32 in[2], word32 out[2]) const; void AsmProcess(const byte* in, byte* out) const; === modified file 'extra/yassl/taocrypt/include/runtime.hpp' --- a/extra/yassl/taocrypt/include/runtime.hpp 2007-01-29 15:54:40 +0000 +++ b/extra/yassl/taocrypt/include/runtime.hpp 2010-07-02 18:30:47 +0000 @@ -35,10 +35,7 @@ // Handler for pure virtual functions namespace __Crun { - static void pure_error(void) - { - assert("Pure virtual method called." == "Aborted"); - } + void pure_error(void); } // namespace __Crun #endif // __sun @@ -54,16 +51,7 @@ extern "C" { #else #include "kernelc.hpp" #endif - -/* Disallow inline __cxa_pure_virtual() */ -static int __cxa_pure_virtual() __attribute__((noinline, used)); -static int __cxa_pure_virtual() -{ - // oops, pure virtual called! - assert("Pure virtual method called." == "Aborted"); - return 0; -} - + int __cxa_pure_virtual () __attribute__ ((weak)); } // extern "C" #endif // __GNUC__ > 2 === modified file 'extra/yassl/taocrypt/src/algebra.cpp' --- a/extra/yassl/taocrypt/src/algebra.cpp 2010-04-21 00:25:59 +0000 +++ b/extra/yassl/taocrypt/src/algebra.cpp 2010-08-27 14:12:44 +0000 @@ -185,10 +185,10 @@ Integer AbstractGroup::CascadeScalarMult struct WindowSlider { - WindowSlider(const Integer &exp, bool fastNegate, + WindowSlider(const Integer &expIn, bool fastNegateIn, unsigned int windowSizeIn=0) - : exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn), - windowBegin(0), fastNegate(fastNegate), firstTime(true), + : exp(expIn), windowModulus(Integer::One()), windowSize(windowSizeIn), + windowBegin(0), fastNegate(fastNegateIn), firstTime(true), finished(false) { if (windowSize == 0) === modified file 'extra/yassl/taocrypt/src/coding.cpp' --- a/extra/yassl/taocrypt/src/coding.cpp 2007-08-28 08:35:55 +0000 +++ b/extra/yassl/taocrypt/src/coding.cpp 2010-07-28 15:59:19 +0000 @@ -185,7 +185,7 @@ void Base64Decoder::Decode() { word32 bytes = coded_.size(); word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz); - plainSz = (plainSz * 3 + 3) / 4; + plainSz = ((plainSz * 3) / 4) + 3; decoded_.New(plainSz); word32 i = 0; === modified file 'extra/yassl/taocrypt/src/integer.cpp' --- a/extra/yassl/taocrypt/src/integer.cpp 2007-03-23 16:15:44 +0000 +++ b/extra/yassl/taocrypt/src/integer.cpp 2010-07-02 18:30:47 +0000 @@ -283,21 +283,23 @@ DWord() {} word GetHighHalfAsBorrow() const {return 0-halfs_.high;} private: + struct dword_struct + { + #ifdef LITTLE_ENDIAN_ORDER + word low; + word high; + #else + word high; + word low; + #endif + }; + union { #ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE dword whole_; #endif - struct - { - #ifdef LITTLE_ENDIAN_ORDER - word low; - word high; - #else - word high; - word low; - #endif - } halfs_; + struct dword_struct halfs_; }; }; @@ -1214,20 +1216,24 @@ public: #define AS1(x) #x ";" #define AS2(x, y) #x ", " #y ";" #define AddPrologue \ + word res; \ __asm__ __volatile__ \ ( \ "push %%ebx;" /* save this manually, in case of -fPIC */ \ - "mov %2, %%ebx;" \ + "mov %3, %%ebx;" \ ".intel_syntax noprefix;" \ "push ebp;" #define AddEpilogue \ "pop ebp;" \ ".att_syntax prefix;" \ "pop %%ebx;" \ - : \ + "mov %%eax, %0;" \ + : "=g" (res) \ : "c" (C), "d" (A), "m" (B), "S" (N) \ : "%edi", "memory", "cc" \ - ); + ); \ + return res; + #define MulPrologue \ __asm__ __volatile__ \ ( \ === modified file 'extra/yassl/taocrypt/src/misc.cpp' --- a/extra/yassl/taocrypt/src/misc.cpp 2009-10-26 11:35:42 +0000 +++ b/extra/yassl/taocrypt/src/misc.cpp 2010-08-27 14:12:44 +0000 @@ -84,12 +84,23 @@ namespace STL = STL_NAMESPACE; } -#if defined(__ICC) || defined(__INTEL_COMPILER) +#ifdef __sun + +// Handler for pure virtual functions +namespace __Crun { + void pure_error() { + assert(!"Aborted: pure virtual method called."); + } +} + +#endif + +#if defined(__ICC) || defined(__INTEL_COMPILER) || (__GNUC__ > 2) extern "C" { int __cxa_pure_virtual() { - assert("Pure virtual method called." == "Aborted"); + assert(!"Aborted: pure virtual method called."); return 0; } @@ -176,7 +187,6 @@ word Crop(word value, unsigned int size) #endif #endif - bool HaveCpuId() { #ifdef _MSC_VER === modified file 'extra/yassl/testsuite/test.hpp' --- a/extra/yassl/testsuite/test.hpp 2007-01-22 11:34:39 +0000 +++ b/extra/yassl/testsuite/test.hpp 2010-07-02 18:30:47 +0000 @@ -160,6 +160,11 @@ inline void err_sys(const char* msg) } +extern "C" { + static int PasswordCallBack(char*, int, int, void*); +} + + static int PasswordCallBack(char* passwd, int sz, int rw, void* userdata) { strncpy(passwd, "12345678", sz); === modified file 'include/Makefile.am' --- a/include/Makefile.am 2010-05-26 19:27:01 +0000 +++ b/include/Makefile.am 2010-08-27 14:12:44 +0000 @@ -40,7 +40,8 @@ noinst_HEADERS = config-win.h config-net my_vle.h my_user.h my_atomic.h atomic/nolock.h \ atomic/rwlock.h atomic/x86-gcc.h atomic/generic-msvc.h \ atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h \ - wqueue.h waiting_threads.h + wqueue.h waiting_threads.h my_compiler.h + EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp # Remove built files and the symlinked directories @@ -68,6 +69,3 @@ my_config.h: config.h # generated by configure from the .h.in files dist-hook: $(RM) -f $(distdir)/mysql_version.h $(distdir)/my_config.h - -# Don't update the files from bitkeeper -%::SCCS/s.% === removed file 'include/atomic/gcc_builtins.h' --- a/include/atomic/gcc_builtins.h 2008-02-06 16:55:04 +0000 +++ b/include/atomic/gcc_builtins.h 1970-01-01 00:00:00 +0000 @@ -1,36 +0,0 @@ -/* Copyright (C) 2008 MySQL AB - - 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 Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#define make_atomic_add_body(S) \ - v= __sync_fetch_and_add(a, v); -#define make_atomic_swap_body(S) \ - v= __sync_lock_test_and_set(a, v); -#define make_atomic_cas_body(S) \ - int ## S sav; \ - sav= __sync_val_compare_and_swap(a, *cmp, set); \ - if (!(ret= (sav == *cmp))) *cmp= sav; - -#ifdef MY_ATOMIC_MODE_DUMMY -#define make_atomic_load_body(S) ret= *a -#define make_atomic_store_body(S) *a= v -#define MY_ATOMIC_MODE "gcc-builtins-up" - -#else -#define MY_ATOMIC_MODE "gcc-builtins-smp" -#define make_atomic_load_body(S) \ - ret= __sync_fetch_and_or(a, 0); -#define make_atomic_store_body(S) \ - (void) __sync_lock_test_and_set(a, v); -#endif === added file 'include/atomic/gcc_builtins.h' --- a/include/atomic/gcc_builtins.h 1970-01-01 00:00:00 +0000 +++ b/include/atomic/gcc_builtins.h 2010-08-27 14:12:44 +0000 @@ -0,0 +1,36 @@ +/* Copyright (C) 2008 MySQL AB + + 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 Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#define make_atomic_add_body(S) \ + v= __sync_fetch_and_add(a, v); +#define make_atomic_swap_body(S) \ + v= __sync_lock_test_and_set(a, v); +#define make_atomic_cas_body(S) \ + int ## S sav; \ + sav= __sync_val_compare_and_swap(a, *cmp, set); \ + if (!(ret= (sav == *cmp))) *cmp= sav; + +#ifdef MY_ATOMIC_MODE_DUMMY +#define make_atomic_load_body(S) ret= *a +#define make_atomic_store_body(S) *a= v +#define MY_ATOMIC_MODE "gcc-builtins-up" + +#else +#define MY_ATOMIC_MODE "gcc-builtins-smp" +#define make_atomic_load_body(S) \ + ret= __sync_fetch_and_or(a, 0); +#define make_atomic_store_body(S) \ + (void) __sync_lock_test_and_set(a, v); +#endif === added file 'include/atomic/nolock.h' --- a/include/atomic/nolock.h 1970-01-01 00:00:00 +0000 +++ b/include/atomic/nolock.h 2010-08-27 14:12:44 +0000 @@ -0,0 +1,45 @@ +/* Copyright (C) 2006 MySQL AB + + 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 Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#if defined(__i386__) || defined(_MSC_VER) || \ + defined(__x86_64__) || defined(MY_ATOMIC_MODE_GCC_BUILTINS) + +# ifdef MY_ATOMIC_MODE_DUMMY +# define LOCK_prefix "" +# else +# define LOCK_prefix "lock" +# endif + +# ifdef MY_ATOMIC_MODE_GCC_BUILTINS +# include "gcc_builtins.h" +# elif __GNUC__ +# include "x86-gcc.h" +# elif defined(_MSC_VER) +# include "generic-msvc.h" +# endif +#endif + +#ifdef make_atomic_cas_body + +typedef char my_atomic_rwlock_t __attribute__ ((unused)); +#define my_atomic_rwlock_destroy(name) +#define my_atomic_rwlock_init(name) +#define my_atomic_rwlock_rdlock(name) +#define my_atomic_rwlock_wrlock(name) +#define my_atomic_rwlock_rdunlock(name) +#define my_atomic_rwlock_wrunlock(name) + +#endif + === removed file 'include/atomic/nolock.h' --- a/include/atomic/nolock.h 2009-06-10 09:13:53 +0000 +++ b/include/atomic/nolock.h 1970-01-01 00:00:00 +0000 @@ -1,45 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - - 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 Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#if defined(__i386__) || defined(_MSC_VER) || \ - defined(__x86_64__) || defined(MY_ATOMIC_MODE_GCC_BUILTINS) - -# ifdef MY_ATOMIC_MODE_DUMMY -# define LOCK_prefix "" -# else -# define LOCK_prefix "lock" -# endif - -# ifdef MY_ATOMIC_MODE_GCC_BUILTINS -# include "gcc_builtins.h" -# elif __GNUC__ -# include "x86-gcc.h" -# elif defined(_MSC_VER) -# include "generic-msvc.h" -# endif -#endif - -#ifdef make_atomic_cas_body - -typedef char my_atomic_rwlock_t __attribute__ ((unused)); -#define my_atomic_rwlock_destroy(name) -#define my_atomic_rwlock_init(name) -#define my_atomic_rwlock_rdlock(name) -#define my_atomic_rwlock_wrlock(name) -#define my_atomic_rwlock_rdunlock(name) -#define my_atomic_rwlock_wrunlock(name) - -#endif - === removed file 'include/atomic/rwlock.h' --- a/include/atomic/rwlock.h 2008-02-13 17:25:56 +0000 +++ b/include/atomic/rwlock.h 1970-01-01 00:00:00 +0000 @@ -1,54 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - - 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 Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -typedef struct {pthread_mutex_t rw;} my_atomic_rwlock_t; -#define MY_ATOMIC_MODE_RWLOCKS 1 - -#ifdef MY_ATOMIC_MODE_DUMMY -/* - the following can never be enabled by ./configure, one need to put #define in - a source to trigger the following warning. The resulting code will be broken, - it only makes sense to do it to see now test_atomic detects broken - implementations (another way is to run a UP build on an SMP box). -*/ -#warning MY_ATOMIC_MODE_DUMMY and MY_ATOMIC_MODE_RWLOCKS are incompatible -#define my_atomic_rwlock_destroy(name) -#define my_atomic_rwlock_init(name) -#define my_atomic_rwlock_rdlock(name) -#define my_atomic_rwlock_wrlock(name) -#define my_atomic_rwlock_rdunlock(name) -#define my_atomic_rwlock_wrunlock(name) -#define MY_ATOMIC_MODE "dummy (non-atomic)" -#else -/* - we're using read-write lock macros but map them to mutex locks, and they're - faster. Still, having semantically rich API we can change the - underlying implementation, if necessary. -*/ -#define my_atomic_rwlock_destroy(name) pthread_mutex_destroy(& (name)->rw) -#define my_atomic_rwlock_init(name) pthread_mutex_init(& (name)->rw, 0) -#define my_atomic_rwlock_rdlock(name) pthread_mutex_lock(& (name)->rw) -#define my_atomic_rwlock_wrlock(name) pthread_mutex_lock(& (name)->rw) -#define my_atomic_rwlock_rdunlock(name) pthread_mutex_unlock(& (name)->rw) -#define my_atomic_rwlock_wrunlock(name) pthread_mutex_unlock(& (name)->rw) -#define MY_ATOMIC_MODE "mutex" -#endif - -#define make_atomic_add_body(S) int ## S sav; sav= *a; *a+= v; v=sav; -#define make_atomic_fas_body(S) int ## S sav; sav= *a; *a= v; v=sav; -#define make_atomic_cas_body(S) if ((ret= (*a == *cmp))) *a= set; else *cmp=*a; -#define make_atomic_load_body(S) ret= *a; -#define make_atomic_store_body(S) *a= v; - === added file 'include/atomic/rwlock.h' --- a/include/atomic/rwlock.h 1970-01-01 00:00:00 +0000 +++ b/include/atomic/rwlock.h 2010-08-27 14:12:44 +0000 @@ -0,0 +1,54 @@ +/* Copyright (C) 2006 MySQL AB + + 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 Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +typedef struct {pthread_mutex_t rw;} my_atomic_rwlock_t; +#define MY_ATOMIC_MODE_RWLOCKS 1 + +#ifdef MY_ATOMIC_MODE_DUMMY +/* + the following can never be enabled by ./configure, one need to put #define in + a source to trigger the following warning. The resulting code will be broken, + it only makes sense to do it to see now test_atomic detects broken + implementations (another way is to run a UP build on an SMP box). +*/ +#warning MY_ATOMIC_MODE_DUMMY and MY_ATOMIC_MODE_RWLOCKS are incompatible +#define my_atomic_rwlock_destroy(name) +#define my_atomic_rwlock_init(name) +#define my_atomic_rwlock_rdlock(name) +#define my_atomic_rwlock_wrlock(name) +#define my_atomic_rwlock_rdunlock(name) +#define my_atomic_rwlock_wrunlock(name) +#define MY_ATOMIC_MODE "dummy (non-atomic)" +#else +/* + we're using read-write lock macros but map them to mutex locks, and they're + faster. Still, having semantically rich API we can change the + underlying implementation, if necessary. +*/ +#define my_atomic_rwlock_destroy(name) pthread_mutex_destroy(& (name)->rw) +#define my_atomic_rwlock_init(name) pthread_mutex_init(& (name)->rw, 0) +#define my_atomic_rwlock_rdlock(name) pthread_mutex_lock(& (name)->rw) +#define my_atomic_rwlock_wrlock(name) pthread_mutex_lock(& (name)->rw) +#define my_atomic_rwlock_rdunlock(name) pthread_mutex_unlock(& (name)->rw) +#define my_atomic_rwlock_wrunlock(name) pthread_mutex_unlock(& (name)->rw) +#define MY_ATOMIC_MODE "mutex" +#endif + +#define make_atomic_add_body(S) int ## S sav; sav= *a; *a+= v; v=sav; +#define make_atomic_fas_body(S) int ## S sav; sav= *a; *a= v; v=sav; +#define make_atomic_cas_body(S) if ((ret= (*a == *cmp))) *a= set; else *cmp=*a; +#define make_atomic_load_body(S) ret= *a; +#define make_atomic_store_body(S) *a= v; + === added file 'include/atomic/x86-gcc.h' --- a/include/atomic/x86-gcc.h 1970-01-01 00:00:00 +0000 +++ b/include/atomic/x86-gcc.h 2010-08-27 14:12:44 +0000 @@ -0,0 +1,69 @@ +/* Copyright (C) 2006 MySQL AB + + 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 Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + XXX 64-bit atomic operations can be implemented using + cmpxchg8b, if necessary. Though I've heard that not all 64-bit + architectures support double-word (128-bit) cas. +*/ + +#ifdef __x86_64__ +# ifdef MY_ATOMIC_NO_XADD +# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix "-no-xadd" +# else +# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix +# endif +#else +# ifdef MY_ATOMIC_NO_XADD +# define MY_ATOMIC_MODE "gcc-x86" LOCK_prefix "-no-xadd" +# else +# define MY_ATOMIC_MODE "gcc-x86" LOCK_prefix +# endif +#endif + +/* fix -ansi errors while maintaining readability */ +#ifndef asm +#define asm __asm__ +#endif + +#ifndef MY_ATOMIC_NO_XADD +#define make_atomic_add_body(S) \ + asm volatile (LOCK_prefix "; xadd %0, %1;" : "+r" (v) , "+m" (*a)) +#endif +#define make_atomic_fas_body(S) \ + asm volatile ("xchg %0, %1;" : "+r" (v) , "+m" (*a)) +#define make_atomic_cas_body(S) \ + asm volatile (LOCK_prefix "; cmpxchg %3, %0; setz %2;" \ + : "+m" (*a), "+a" (*cmp), "=q" (ret): "r" (set)) + +#ifdef MY_ATOMIC_MODE_DUMMY +#define make_atomic_load_body(S) ret=*a +#define make_atomic_store_body(S) *a=v +#else +/* + Actually 32-bit reads/writes are always atomic on x86 + But we add LOCK_prefix here anyway to force memory barriers +*/ +#define make_atomic_load_body(S) \ + ret=0; \ + asm volatile (LOCK_prefix "; cmpxchg %2, %0" \ + : "+m" (*a), "+a" (ret): "r" (ret)) +#define make_atomic_store_body(S) \ + asm volatile ("; xchg %0, %1;" : "+m" (*a), "+r" (v)) +#endif + +/* TODO test on intel whether the below helps. on AMD it makes no difference */ +//#define LF_BACKOFF ({asm volatile ("rep; nop"); 1; }) + === removed file 'include/atomic/x86-gcc.h' --- a/include/atomic/x86-gcc.h 2007-02-28 16:50:51 +0000 +++ b/include/atomic/x86-gcc.h 1970-01-01 00:00:00 +0000 @@ -1,69 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - - 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 Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - XXX 64-bit atomic operations can be implemented using - cmpxchg8b, if necessary. Though I've heard that not all 64-bit - architectures support double-word (128-bit) cas. -*/ - -#ifdef __x86_64__ -# ifdef MY_ATOMIC_NO_XADD -# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix "-no-xadd" -# else -# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix -# endif -#else -# ifdef MY_ATOMIC_NO_XADD -# define MY_ATOMIC_MODE "gcc-x86" LOCK_prefix "-no-xadd" -# else -# define MY_ATOMIC_MODE "gcc-x86" LOCK_prefix -# endif -#endif - -/* fix -ansi errors while maintaining readability */ -#ifndef asm -#define asm __asm__ -#endif - -#ifndef MY_ATOMIC_NO_XADD -#define make_atomic_add_body(S) \ - asm volatile (LOCK_prefix "; xadd %0, %1;" : "+r" (v) , "+m" (*a)) -#endif -#define make_atomic_fas_body(S) \ - asm volatile ("xchg %0, %1;" : "+r" (v) , "+m" (*a)) -#define make_atomic_cas_body(S) \ - asm volatile (LOCK_prefix "; cmpxchg %3, %0; setz %2;" \ - : "+m" (*a), "+a" (*cmp), "=q" (ret): "r" (set)) - -#ifdef MY_ATOMIC_MODE_DUMMY -#define make_atomic_load_body(S) ret=*a -#define make_atomic_store_body(S) *a=v -#else -/* - Actually 32-bit reads/writes are always atomic on x86 - But we add LOCK_prefix here anyway to force memory barriers -*/ -#define make_atomic_load_body(S) \ - ret=0; \ - asm volatile (LOCK_prefix "; cmpxchg %2, %0" \ - : "+m" (*a), "+a" (ret): "r" (ret)) -#define make_atomic_store_body(S) \ - asm volatile ("; xchg %0, %1;" : "+m" (*a), "+r" (v)) -#endif - -/* TODO test on intel whether the below helps. on AMD it makes no difference */ -//#define LF_BACKOFF ({asm volatile ("rep; nop"); 1; }) - === modified file 'include/m_string.h' --- a/include/m_string.h 2010-08-02 09:01:24 +0000 +++ b/include/m_string.h 2010-08-27 14:12:44 +0000 @@ -33,10 +33,6 @@ /* need by my_vsnprintf */ #include <stdarg.h> -#ifdef _AIX -#undef HAVE_BCMP -#endif - /* This is needed for the definitions of bzero... on solaris */ #if defined(HAVE_STRINGS_H) #include <strings.h> @@ -114,7 +110,7 @@ extern void bfill(uchar *dst,size_t len, #endif #if !defined(bzero) && !defined(HAVE_BZERO) -extern void bzero(uchar * dst,size_t len); +extern void bzero(void * dst,size_t len); #endif #if !defined(bcmp) && !defined(HAVE_BCMP) === removed file 'include/my_atomic.h' --- a/include/my_atomic.h 2008-04-28 16:24:05 +0000 +++ b/include/my_atomic.h 1970-01-01 00:00:00 +0000 @@ -1,260 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - - 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 Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - This header defines five atomic operations: - - my_atomic_add#(&var, what) - add 'what' to *var, and return the old value of *var - - my_atomic_fas#(&var, what) - 'Fetch And Store' - store 'what' in *var, and return the old value of *var - - my_atomic_cas#(&var, &old, new) - 'Compare And Swap' - if *var is equal to *old, then store 'new' in *var, and return TRUE - otherwise store *var in *old, and return FALSE - - my_atomic_load#(&var) - return *var - - my_atomic_store#(&var, what) - store 'what' in *var - - '#' is substituted by a size suffix - 8, 16, 32, or ptr - (e.g. my_atomic_add8, my_atomic_fas32, my_atomic_casptr). - - NOTE This operations are not always atomic, so they always must be - enclosed in my_atomic_rwlock_rdlock(lock)/my_atomic_rwlock_rdunlock(lock) - or my_atomic_rwlock_wrlock(lock)/my_atomic_rwlock_wrunlock(lock). - Hint: if a code block makes intensive use of atomic ops, it make sense - to take/release rwlock once for the whole block, not for every statement. - - On architectures where these operations are really atomic, rwlocks will - be optimized away. - 8- and 16-bit atomics aren't implemented for windows (see generic-msvc.h), - but can be added, if necessary. -*/ - -#ifndef my_atomic_rwlock_init - -#define intptr void * - -#ifndef MY_ATOMIC_MODE_RWLOCKS -#include "atomic/nolock.h" -#endif - -#ifndef make_atomic_cas_body -/* nolock.h was not able to generate even a CAS function, fall back */ -#include "atomic/rwlock.h" -#else -/* define missing functions by using the already generated ones */ -#ifndef make_atomic_add_body -#define make_atomic_add_body(S) \ - int ## S tmp=*a; \ - while (!my_atomic_cas ## S(a, &tmp, tmp+v)); \ - v=tmp; -#endif -#ifndef make_atomic_fas_body -#define make_atomic_fas_body(S) \ - int ## S tmp=*a; \ - while (!my_atomic_cas ## S(a, &tmp, v)); \ - v=tmp; -#endif -#ifndef make_atomic_load_body -#define make_atomic_load_body(S) \ - ret= 0; /* avoid compiler warning */ \ - (void)(my_atomic_cas ## S(a, &ret, ret)); -#endif -#ifndef make_atomic_store_body -#define make_atomic_store_body(S) \ - (void)(my_atomic_fas ## S (a, v)); -#endif -#endif - -/* - transparent_union doesn't work in g++ - Bug ? - - Darwin's gcc doesn't want to put pointers in a transparent_union - when built with -arch ppc64. Complains: - warning: 'transparent_union' attribute ignored -*/ -#if defined(__GNUC__) && !defined(__cplusplus) && \ - ! (defined(__APPLE__) && defined(_ARCH_PPC64)) -/* - we want to be able to use my_atomic_xxx functions with - both signed and unsigned integers. But gcc will issue a warning - "passing arg N of `my_atomic_XXX' as [un]signed due to prototype" - if the signedness of the argument doesn't match the prototype, or - "pointer targets in passing argument N of my_atomic_XXX differ in signedness" - if int* is used where uint* is expected (or vice versa). - Let's shut these warnings up -*/ -#define make_transparent_unions(S) \ - typedef union { \ - int ## S i; \ - uint ## S u; \ - } U_ ## S __attribute__ ((transparent_union)); \ - typedef union { \ - int ## S volatile *i; \ - uint ## S volatile *u; \ - } Uv_ ## S __attribute__ ((transparent_union)); -#define uintptr intptr -make_transparent_unions(8) -make_transparent_unions(16) -make_transparent_unions(32) -make_transparent_unions(ptr) -#undef uintptr -#undef make_transparent_unions -#define a U_a.i -#define cmp U_cmp.i -#define v U_v.i -#define set U_set.i -#else -#define U_8 int8 -#define U_16 int16 -#define U_32 int32 -#define U_ptr intptr -#define Uv_8 int8 -#define Uv_16 int16 -#define Uv_32 int32 -#define Uv_ptr intptr -#define U_a volatile *a -#define U_cmp *cmp -#define U_v v -#define U_set set -#endif /* __GCC__ transparent_union magic */ - -#ifdef HAVE_INLINE - -#define make_atomic_cas(S) \ -STATIC_INLINE int my_atomic_cas ## S(Uv_ ## S U_a, \ - Uv_ ## S U_cmp, U_ ## S U_set) \ -{ \ - int8 ret; \ - make_atomic_cas_body(S); \ - return ret; \ -} - -#define make_atomic_add(S) \ -STATIC_INLINE int ## S my_atomic_add ## S( \ - Uv_ ## S U_a, U_ ## S U_v) \ -{ \ - make_atomic_add_body(S); \ - return v; \ -} - -#define make_atomic_fas(S) \ -STATIC_INLINE int ## S my_atomic_fas ## S( \ - Uv_ ## S U_a, U_ ## S U_v) \ -{ \ - make_atomic_fas_body(S); \ - return v; \ -} - -#define make_atomic_load(S) \ -STATIC_INLINE int ## S my_atomic_load ## S(Uv_ ## S U_a) \ -{ \ - int ## S ret; \ - make_atomic_load_body(S); \ - return ret; \ -} - -#define make_atomic_store(S) \ -STATIC_INLINE void my_atomic_store ## S( \ - Uv_ ## S U_a, U_ ## S U_v) \ -{ \ - make_atomic_store_body(S); \ -} - -#else /* no inline functions */ - -#define make_atomic_add(S) \ -extern int ## S my_atomic_add ## S(Uv_ ## S U_a, U_ ## S U_v); - -#define make_atomic_fas(S) \ -extern int ## S my_atomic_fas ## S(Uv_ ## S U_a, U_ ## S U_v); - -#define make_atomic_cas(S) \ -extern int my_atomic_cas ## S(Uv_ ## S U_a, Uv_ ## S U_cmp, U_ ## S U_set); - -#define make_atomic_load(S) \ -extern int ## S my_atomic_load ## S(Uv_ ## S U_a); - -#define make_atomic_store(S) \ -extern void my_atomic_store ## S(Uv_ ## S U_a, U_ ## S U_v); - -#endif - -make_atomic_cas(32) -make_atomic_cas(ptr) - -make_atomic_add(32) - -make_atomic_load(32) -make_atomic_load(ptr) - -make_atomic_fas(32) -make_atomic_fas(ptr) - -make_atomic_store(32) -make_atomic_store(ptr) - -#ifdef _atomic_h_cleanup_ -#include _atomic_h_cleanup_ -#undef _atomic_h_cleanup_ -#endif - -#undef U_8 -#undef U_16 -#undef U_32 -#undef U_ptr -#undef a -#undef cmp -#undef v -#undef set -#undef U_a -#undef U_cmp -#undef U_v -#undef U_set -#undef make_atomic_add -#undef make_atomic_cas -#undef make_atomic_load -#undef make_atomic_store -#undef make_atomic_fas -#undef make_atomic_add_body -#undef make_atomic_cas_body -#undef make_atomic_load_body -#undef make_atomic_store_body -#undef make_atomic_fas_body -#undef intptr - -/* - the macro below defines (as an expression) the code that - will be run in spin-loops. Intel manuals recummend to have PAUSE there. - It is expected to be defined in include/atomic/ *.h files -*/ -#ifndef LF_BACKOFF -#define LF_BACKOFF (1) -#endif - -#define MY_ATOMIC_OK 0 -#define MY_ATOMIC_NOT_1CPU 1 -extern int my_atomic_initialize(); - -#endif - === added file 'include/my_atomic.h' --- a/include/my_atomic.h 1970-01-01 00:00:00 +0000 +++ b/include/my_atomic.h 2010-08-27 14:12:44 +0000 @@ -0,0 +1,260 @@ +/* Copyright (C) 2006 MySQL AB + + 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 Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + This header defines five atomic operations: + + my_atomic_add#(&var, what) + add 'what' to *var, and return the old value of *var + + my_atomic_fas#(&var, what) + 'Fetch And Store' + store 'what' in *var, and return the old value of *var + + my_atomic_cas#(&var, &old, new) + 'Compare And Swap' + if *var is equal to *old, then store 'new' in *var, and return TRUE + otherwise store *var in *old, and return FALSE + + my_atomic_load#(&var) + return *var + + my_atomic_store#(&var, what) + store 'what' in *var + + '#' is substituted by a size suffix - 8, 16, 32, or ptr + (e.g. my_atomic_add8, my_atomic_fas32, my_atomic_casptr). + + NOTE This operations are not always atomic, so they always must be + enclosed in my_atomic_rwlock_rdlock(lock)/my_atomic_rwlock_rdunlock(lock) + or my_atomic_rwlock_wrlock(lock)/my_atomic_rwlock_wrunlock(lock). + Hint: if a code block makes intensive use of atomic ops, it make sense + to take/release rwlock once for the whole block, not for every statement. + + On architectures where these operations are really atomic, rwlocks will + be optimized away. + 8- and 16-bit atomics aren't implemented for windows (see generic-msvc.h), + but can be added, if necessary. +*/ + +#ifndef my_atomic_rwlock_init + +#define intptr void * + +#ifndef MY_ATOMIC_MODE_RWLOCKS +#include "atomic/nolock.h" +#endif + +#ifndef make_atomic_cas_body +/* nolock.h was not able to generate even a CAS function, fall back */ +#include "atomic/rwlock.h" +#else +/* define missing functions by using the already generated ones */ +#ifndef make_atomic_add_body +#define make_atomic_add_body(S) \ + int ## S tmp=*a; \ + while (!my_atomic_cas ## S(a, &tmp, tmp+v)); \ + v=tmp; +#endif +#ifndef make_atomic_fas_body +#define make_atomic_fas_body(S) \ + int ## S tmp=*a; \ + while (!my_atomic_cas ## S(a, &tmp, v)); \ + v=tmp; +#endif +#ifndef make_atomic_load_body +#define make_atomic_load_body(S) \ + ret= 0; /* avoid compiler warning */ \ + (void)(my_atomic_cas ## S(a, &ret, ret)); +#endif +#ifndef make_atomic_store_body +#define make_atomic_store_body(S) \ + (void)(my_atomic_fas ## S (a, v)); +#endif +#endif + +/* + transparent_union doesn't work in g++ + Bug ? + + Darwin's gcc doesn't want to put pointers in a transparent_union + when built with -arch ppc64. Complains: + warning: 'transparent_union' attribute ignored +*/ +#if defined(__GNUC__) && !defined(__cplusplus) && \ + ! (defined(__APPLE__) && defined(_ARCH_PPC64)) +/* + we want to be able to use my_atomic_xxx functions with + both signed and unsigned integers. But gcc will issue a warning + "passing arg N of `my_atomic_XXX' as [un]signed due to prototype" + if the signedness of the argument doesn't match the prototype, or + "pointer targets in passing argument N of my_atomic_XXX differ in signedness" + if int* is used where uint* is expected (or vice versa). + Let's shut these warnings up +*/ +#define make_transparent_unions(S) \ + typedef union { \ + int ## S i; \ + uint ## S u; \ + } U_ ## S __attribute__ ((transparent_union)); \ + typedef union { \ + int ## S volatile *i; \ + uint ## S volatile *u; \ + } Uv_ ## S __attribute__ ((transparent_union)); +#define uintptr intptr +make_transparent_unions(8) +make_transparent_unions(16) +make_transparent_unions(32) +make_transparent_unions(ptr) +#undef uintptr +#undef make_transparent_unions +#define a U_a.i +#define cmp U_cmp.i +#define v U_v.i +#define set U_set.i +#else +#define U_8 int8 +#define U_16 int16 +#define U_32 int32 +#define U_ptr intptr +#define Uv_8 int8 +#define Uv_16 int16 +#define Uv_32 int32 +#define Uv_ptr intptr +#define U_a volatile *a +#define U_cmp *cmp +#define U_v v +#define U_set set +#endif /* __GCC__ transparent_union magic */ + +#ifdef HAVE_INLINE + +#define make_atomic_cas(S) \ +STATIC_INLINE int my_atomic_cas ## S(Uv_ ## S U_a, \ + Uv_ ## S U_cmp, U_ ## S U_set) \ +{ \ + int8 ret; \ + make_atomic_cas_body(S); \ + return ret; \ +} + +#define make_atomic_add(S) \ +STATIC_INLINE int ## S my_atomic_add ## S( \ + Uv_ ## S U_a, U_ ## S U_v) \ +{ \ + make_atomic_add_body(S); \ + return v; \ +} + +#define make_atomic_fas(S) \ +STATIC_INLINE int ## S my_atomic_fas ## S( \ + Uv_ ## S U_a, U_ ## S U_v) \ +{ \ + make_atomic_fas_body(S); \ + return v; \ +} + +#define make_atomic_load(S) \ +STATIC_INLINE int ## S my_atomic_load ## S(Uv_ ## S U_a) \ +{ \ + int ## S ret; \ + make_atomic_load_body(S); \ + return ret; \ +} + +#define make_atomic_store(S) \ +STATIC_INLINE void my_atomic_store ## S( \ + Uv_ ## S U_a, U_ ## S U_v) \ +{ \ + make_atomic_store_body(S); \ +} + +#else /* no inline functions */ + +#define make_atomic_add(S) \ +extern int ## S my_atomic_add ## S(Uv_ ## S U_a, U_ ## S U_v); + +#define make_atomic_fas(S) \ +extern int ## S my_atomic_fas ## S(Uv_ ## S U_a, U_ ## S U_v); + +#define make_atomic_cas(S) \ +extern int my_atomic_cas ## S(Uv_ ## S U_a, Uv_ ## S U_cmp, U_ ## S U_set); + +#define make_atomic_load(S) \ +extern int ## S my_atomic_load ## S(Uv_ ## S U_a); + +#define make_atomic_store(S) \ +extern void my_atomic_store ## S(Uv_ ## S U_a, U_ ## S U_v); + +#endif + +make_atomic_cas(32) +make_atomic_cas(ptr) + +make_atomic_add(32) + +make_atomic_load(32) +make_atomic_load(ptr) + +make_atomic_fas(32) +make_atomic_fas(ptr) + +make_atomic_store(32) +make_atomic_store(ptr) + +#ifdef _atomic_h_cleanup_ +#include _atomic_h_cleanup_ +#undef _atomic_h_cleanup_ +#endif + +#undef U_8 +#undef U_16 +#undef U_32 +#undef U_ptr +#undef a +#undef cmp +#undef v +#undef set +#undef U_a +#undef U_cmp +#undef U_v +#undef U_set +#undef make_atomic_add +#undef make_atomic_cas +#undef make_atomic_load +#undef make_atomic_store +#undef make_atomic_fas +#undef make_atomic_add_body +#undef make_atomic_cas_body +#undef make_atomic_load_body +#undef make_atomic_store_body +#undef make_atomic_fas_body +#undef intptr + +/* + the macro below defines (as an expression) the code that + will be run in spin-loops. Intel manuals recummend to have PAUSE there. + It is expected to be defined in include/atomic/ *.h files +*/ +#ifndef LF_BACKOFF +#define LF_BACKOFF (1) +#endif + +#define MY_ATOMIC_OK 0 +#define MY_ATOMIC_NOT_1CPU 1 +extern int my_atomic_initialize(); + +#endif + === modified file 'include/my_bitmap.h' --- a/include/my_bitmap.h 2010-08-04 13:01:13 +0000 +++ b/include/my_bitmap.h 2010-08-27 14:12:44 +0000 @@ -161,22 +161,6 @@ static inline my_bool bitmap_cmp(const M #define bitmap_set_all(MAP) \ (memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP)))) -/** - check, set and clear a bit of interest of an integer. - - If the bit is out of range @retval -1. Otherwise - bit_is_set @return 0 or 1 reflecting the bit is set or not; - bit_do_set @return 1 (bit is set 1) - bit_do_clear @return 0 (bit is cleared to 0) -*/ - -#define bit_is_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ - (((I) & (ULL(1) << (B))) == 0 ? 0 : 1) : -1) -#define bit_do_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ - ((I) |= (ULL(1) << (B)), 1) : -1) -#define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ? \ - ((I) &= ~(ULL(1) << (B)), 0) : -1) - #ifdef __cplusplus } #endif === added file 'include/my_compiler.h' --- a/include/my_compiler.h 1970-01-01 00:00:00 +0000 +++ b/include/my_compiler.h 2010-07-14 19:39:40 +0000 @@ -0,0 +1,129 @@ +#ifndef MY_COMPILER_INCLUDED +#define MY_COMPILER_INCLUDED + +/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/** + Header for compiler-dependent features. + + Intended to contain a set of reusable wrappers for preprocessor + macros, attributes, pragmas, and any other features that are + specific to a target compiler. +*/ + +#include <my_global.h> /* stddef.h offsetof */ + +/** + Compiler-dependent internal convenience macros. +*/ + +/* GNU C/C++ */ +#if defined __GNUC__ +/* Any after 2.95... */ +# define MY_ALIGN_EXT + +/* Microsoft Visual C++ */ +#elif defined _MSC_VER +# define MY_ALIGNOF(type) __alignof(type) +# define MY_ALIGNED(n) __declspec(align(n)) + +/* Oracle Solaris Studio */ +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# if __SUNPRO_C >= 0x590 +# define MY_ALIGN_EXT +# endif + +/* IBM XL C/C++ */ +#elif defined __xlC__ +# if __xlC__ >= 0x0600 +# define MY_ALIGN_EXT +# endif + +/* HP aCC */ +#elif defined(__HP_aCC) || defined(__HP_cc) +# if (__HP_aCC >= 60000) || (__HP_cc >= 60000) +# define MY_ALIGN_EXT +# endif +#endif + +#ifdef MY_ALIGN_EXT +/** Specifies the minimum alignment of a type. */ +# define MY_ALIGNOF(type) __alignof__(type) +/** Determine the alignment requirement of a type. */ +# define MY_ALIGNED(n) __attribute__((__aligned__((n)))) +#endif + +/** + Generic compiler-dependent features. +*/ +#ifndef MY_ALIGNOF +# ifdef __cplusplus + template<typename type> struct my_alignof_helper { char m1; type m2; }; + /* Invalid for non-POD types, but most compilers give the right answer. */ +# define MY_ALIGNOF(type) offsetof(my_alignof_helper<type>, m2) +# else +# define MY_ALIGNOF(type) offsetof(struct { char m1; type m2; }, m2) +# endif +#endif + +/** + C++ Type Traits +*/ + +#ifdef __cplusplus + +/** + Opaque storage with a particular alignment. +*/ +# if defined(MY_ALIGNED) +/* Partial specialization used due to MSVC++. */ +template<size_t alignment> struct my_alignment_imp; +template<> struct MY_ALIGNED(1) my_alignment_imp<1> {}; +template<> struct MY_ALIGNED(2) my_alignment_imp<2> {}; +template<> struct MY_ALIGNED(4) my_alignment_imp<4> {}; +template<> struct MY_ALIGNED(8) my_alignment_imp<8> {}; +template<> struct MY_ALIGNED(16) my_alignment_imp<16> {}; +/* ... expand as necessary. */ +# else +template<size_t alignment> +struct my_alignment_imp { double m1; }; +# endif + +/** + A POD type with a given size and alignment. + + @remark If the compiler does not support a alignment attribute + (MY_ALIGN macro), the default alignment of a double is + used instead. + + @tparam size The minimum size. + @tparam alignment The desired alignment: 1, 2, 4, 8 or 16. +*/ +template <size_t size, size_t alignment> +struct my_aligned_storage +{ + union + { + char data[size]; + my_alignment_imp<alignment> align; + }; +}; + +#endif /* __cplusplus */ + +#include <my_attribute.h> + +#endif /* MY_COMPILER_INCLUDED */ === modified file 'include/my_global.h' --- a/include/my_global.h 2010-08-02 09:01:24 +0000 +++ b/include/my_global.h 2010-08-27 14:12:44 +0000 @@ -567,31 +567,43 @@ int __void__; #endif #endif /* DONT_DEFINE_VOID */ -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) -#define LINT_INIT(var) var=0 /* No uninitialize-warning */ -#else -#define LINT_INIT(var) -#endif +/* + Try to suppress warning for not initialized variables. -#include <my_valgrind.h> + With gcc when using C, we suppress the uninitialized variable warning + without generating code. We can't do this with C++ + for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). +*/ -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_valgrind) -#define VALGRIND_OR_LINT_INIT(var) var=0 +#if defined(FORCE_INIT_OF_VARS) +#define LINT_INIT(var) var= 0 +#if defined(__cplusplus) || !defined(__GNUC__) +#define UNINIT_VAR(x) x= 0 #else -#define VALGRIND_OR_LINT_INIT(var) +/* GCC specific self-initialization which inhibits the warning. */ +#define UNINIT_VAR(x) x= x #endif +#else /* !FORCE_INIT_OF_VARS */ +#define LINT_INIT(var) +#if !defined(__cplusplus) && !defined(__GNUC__) +/* GCC specific self-initialization which inhibits the warning. */ +#define UNINIT_VAR(x) x= x +#else +#define UNINIT_VAR(x) x +#endif +#endif /* FORCE_INIT_OF_VARS */ -/* - Suppress uninitialized variable warning without generating code. +#include <my_valgrind.h> - The _cplusplus is a temporary workaround for C++ code pending a fix - for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772). +/* + The following is to force some unitialized variables to 0 if we are + running valgrind. This is needed when the compiler may access the variable + even if the value of it is never used. */ -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \ - !defined(__GNUC__) -#define UNINIT_VAR(x) x= 0 +#if defined(HAVE_valgrind) +#define VALGRIND_OR_LINT_INIT(var) var=0 #else -#define UNINIT_VAR(x) x= x +#define VALGRIND_OR_LINT_INIT(var) LINT_INIT(var) #endif /* Define some useful general macros */ @@ -613,8 +625,8 @@ typedef unsigned short ushort; #define test(a) ((a) ? 1 : 0) #define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) #define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0) -#define test_all_bits(a,b) (((a) & (b)) == (b)) #define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1)) +#define test_all_bits(a,b) (((a) & (b)) == (b)) #define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0]))) /* Define some general constants */ @@ -635,7 +647,7 @@ typedef unsigned short ushort; #define my_const_cast(A) (A) #endif -#include <my_attribute.h> +#include <my_compiler.h> /* Wen using the embedded library, users might run into link problems, @@ -671,7 +683,7 @@ C_MODE_END # endif #endif -typedef char my_bool; /* Small bool */ +typedef char my_bool; /* Small bool; Needed by my_dbug.h */ #include <my_dbug.h> #define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/ @@ -799,10 +811,10 @@ typedef SOCKET_SIZE_TYPE size_socket; #endif /* get memory in huncs */ #define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD) - /* Typical record cash */ -#define RECORD_CACHE_SIZE (uint) (64*1024-MALLOC_OVERHEAD) - /* Typical key cash */ -#define KEY_CACHE_SIZE (uint) (8*1024*1024-MALLOC_OVERHEAD) + /* Typical record cache */ +#define RECORD_CACHE_SIZE (uint) (128*1024-MALLOC_OVERHEAD) + /* Typical key cache */ +#define KEY_CACHE_SIZE (uint) (128L*1024L*1024L-MALLOC_OVERHEAD) /* Default size of a key cache block */ #define KEY_CACHE_BLOCK_SIZE (uint) 1024 @@ -950,13 +962,11 @@ typedef long long my_ptrdiff_t; #define ALIGN_MAX_UNIT (sizeof(double)) /* Size to make adressable obj. */ #define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A), sizeof(double))) +/* Offset of field f in structure t */ #define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f) #define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size) #define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B)) -#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B)) -#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))] - /* Custom version of standard offsetof() macro which can be used to get offsets of members in class for non-POD types (according to the current === modified file 'include/my_pthread.h' --- a/include/my_pthread.h 2010-03-04 08:03:07 +0000 +++ b/include/my_pthread.h 2010-08-27 14:12:44 +0000 @@ -274,13 +274,14 @@ int sigwait(sigset_t *setp, int *sigp); we want to make sure that no such flags are set. */ #if defined(HAVE_SIGACTION) && !defined(my_sigset) -#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \ +#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; \ + IF_DBUG(int l_rc); \ DBUG_ASSERT((A) != 0); \ sigemptyset(&l_set); \ l_s.sa_handler = (B); \ l_s.sa_mask = l_set; \ l_s.sa_flags = 0; \ - l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\ + IF_DBUG(l_rc=) sigaction((A), &l_s, NULL); \ DBUG_ASSERT(l_rc == 0); \ } while (0) #elif defined(HAVE_SIGSET) && !defined(my_sigset) @@ -755,7 +756,7 @@ extern uint thd_lib_detected; The implementation is guaranteed to be thread safe, on all platforms. Note that the calling code should *not* assume the counter is protected by the mutex given, as the implementation of these helpers may change - to use my_atomic operations instead. + to use atomic operations instead. */ /* === modified file 'include/my_sys.h' --- a/include/my_sys.h 2010-08-02 09:01:24 +0000 +++ b/include/my_sys.h 2010-08-09 17:05:42 +0000 @@ -266,6 +266,7 @@ extern size_t sf_malloc_cur_memory, sf_m extern ulong my_default_record_cache_size; extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io, NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks; +extern my_bool my_disable_sync; extern char wild_many,wild_one,wild_prefix; extern const char *charsets_dir; /* from default.c */ === modified file 'include/mysql.h' --- a/include/mysql.h 2010-01-15 15:27:55 +0000 +++ b/include/mysql.h 2010-08-27 14:12:44 +0000 @@ -44,7 +44,9 @@ extern "C" { #endif #ifndef _global_h /* If not standard header */ +#ifndef MYSQL_ABI_CHECK #include <sys/types.h> +#endif #ifdef __LCC__ #include <winsock2.h> /* For windows */ #endif === modified file 'include/mysql.h.pp' --- a/include/mysql.h.pp 2010-02-23 12:04:58 +0000 +++ b/include/mysql.h.pp 2010-08-27 14:12:44 +0000 @@ -1,4 +1,3 @@ -#include <sys/types.h> typedef char my_bool; typedef int my_socket; #include "mysql_version.h" === modified file 'include/mysys_err.h' --- a/include/mysys_err.h 2009-11-07 10:34:19 +0000 +++ b/include/mysys_err.h 2010-08-27 14:12:44 +0000 @@ -62,10 +62,12 @@ extern const char * NEAR globerrs[]; /* #define EE_UNKNOWN_COLLATION 28 #define EE_FILENOTFOUND 29 #define EE_FILE_NOT_CLOSED 30 -#define EE_CANT_CHMOD 31 -#define EE_CANT_SEEK 32 -#define EE_CANT_COPY_OWNERSHIP 33 -#define EE_ERROR_LAST 33 /* Copy last error nr */ +#define EE_CHANGE_OWNERSHIP 31 +#define EE_CHANGE_PERMISSIONS 32 +#define EE_CANT_CHMOD 33 +#define EE_CANT_SEEK 34 +#define EE_CANT_COPY_OWNERSHIP 35 +#define EE_ERROR_LAST 35 /* Copy last error nr */ /* Add error numbers before EE_ERROR_LAST and change it accordingly. */ /* exit codes for all MySQL programs */ === modified file 'libmysql/Makefile.am' --- a/libmysql/Makefile.am 2009-07-08 14:49:45 +0000 +++ b/libmysql/Makefile.am 2010-08-27 14:12:44 +0000 @@ -111,6 +111,3 @@ do-lib-dist: echo ' $$(AR) r $$@ $$?' >>$$dir/Makefile; \ gtar cvzf $$dir.tar.gz $$dir; \ cd $$dir; gmake - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'libmysql/libmysql.c' --- a/libmysql/libmysql.c 2010-08-02 09:01:24 +0000 +++ b/libmysql/libmysql.c 2010-08-27 14:12:44 +0000 @@ -4434,6 +4434,7 @@ static my_bool setup_one_fetch_function( case MYSQL_TYPE_TIME: field->max_length= 15; /* 19:23:48.123456 */ param->skip_result= skip_result_with_length; + break; case MYSQL_TYPE_DATE: field->max_length= 10; /* 2003-11-11 */ param->skip_result= skip_result_with_length; === modified file 'libmysql_r/Makefile.am' --- a/libmysql_r/Makefile.am 2007-10-08 18:55:44 +0000 +++ b/libmysql_r/Makefile.am 2010-08-27 14:12:44 +0000 @@ -42,6 +42,3 @@ link_sources: done; \ done echo timestamp > link_sources - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'libmysqld/Makefile.am' --- a/libmysqld/Makefile.am 2009-12-03 11:19:05 +0000 +++ b/libmysqld/Makefile.am 2010-08-27 14:12:44 +0000 @@ -232,6 +232,3 @@ link_sources: clean-local: rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlstoragesources) $(storagesources) | sed "s;\.lo;.c;g"`; \ rm -f client_settings.h - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'libmysqld/examples/Makefile.am' --- a/libmysqld/examples/Makefile.am 2008-08-04 19:54:44 +0000 +++ b/libmysqld/examples/Makefile.am 2010-07-16 07:15:22 +0000 @@ -42,7 +42,8 @@ LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmy mysqltest_embedded_LINK = $(CXXLINK) nodist_mysqltest_embedded_SOURCES = mysqltest.cc -mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a +mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a \ + @MYSQLD_EXTRA_LDFLAGS@ nodist_mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \ my_readline.h sql_string.h completion_hash.h === modified file 'man/Makefile.am' --- a/man/Makefile.am 2009-08-20 19:41:12 +0000 +++ b/man/Makefile.am 2010-08-27 14:12:44 +0000 @@ -24,6 +24,3 @@ EXTRA_DIST = $(man1_MANS) $(man8_MANS) # "make_win_*" are not needed in Unix binary packages, install-data-hook: rm -f $(DESTDIR)$(mandir)/man1/make_win_* - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'mysql-test/Makefile.am' --- a/mysql-test/Makefile.am 2010-08-04 10:17:44 +0000 +++ b/mysql-test/Makefile.am 2010-08-27 14:12:44 +0000 @@ -63,13 +63,14 @@ nobase_test_DATA = \ lib/My/SafeProcess.pm \ lib/My/File/Path.pm \ lib/My/SysInfo.pm \ + lib/My/Suite.pm \ lib/My/CoreDump.pm \ lib/My/SafeProcess/Base.pm \ lib/My/SafeProcess/safe_process.pl SUBDIRS = lib/My/SafeProcess -EXTRA_DIST = README \ +EXTRA_DIST = README README.suites \ $(test_SCRIPTS) \ $(nobase_test_DATA) @@ -101,9 +102,10 @@ TEST_DIRS = t r include std_data std_dat suite/ndb suite/ndb/t suite/ndb/r \ suite/rpl_ndb suite/rpl_ndb/t suite/rpl_ndb/r \ suite/parts suite/parts/t suite/parts/r suite/parts/inc \ - suite/pbxt/t suite/pbxt/r \ + suite/pbxt/t suite/pbxt/r suite/pbxt \ suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include \ - suite/innodb_plugin suite/innodb_plugin/t suite/innodb_plugin/r suite/innodb_plugin/include \ + suite/innodb_plugin suite/innodb_plugin/t suite/innodb_plugin/r \ + suite/innodb_plugin/include \ suite/percona \ suite/engines suite/engines/funcs suite/engines/iuds suite/engines/rr_trx \ suite/engines/funcs/r suite/engines/funcs/t suite/engines/iuds/r \ @@ -145,6 +147,3 @@ mtr: mysql-test-run: $(RM) -f mysql-test-run $(LN_S) mysql-test-run.pl mysql-test-run - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'mysql-test/README' --- a/mysql-test/README 2006-03-02 00:51:33 +0000 +++ b/mysql-test/README 2010-08-18 07:52:57 +0000 @@ -18,7 +18,7 @@ the test suite expects you to provide th For example, here is the command to run the "alias" and "analyze" tests with an external server: -mysql-test-run --extern alias analyze +mysql-test-run --extern socket=/tmp/mysql.sock alias analyze To match your setup, you might also need to provide --socket, --user, and other relevant options. === added file 'mysql-test/README.suites' --- a/mysql-test/README.suites 1970-01-01 00:00:00 +0000 +++ b/mysql-test/README.suites 2010-08-25 20:22:33 +0000 @@ -0,0 +1,145 @@ +These are the assorted notes that will be turned into a manual eventually. + +========================== +Tests are organized in suites. +A "suite" is a subdirectory inside, one of, + + <basedir>/mysql-test/suite + <basedir>/mysql-test + <basedir>/share/mysql-test/suite + <basedir>/share/mysql-test + <basedir>/share/mysql/mysql-test/suite + <basedir>/share/mysql/mysql-test + <basedir>/storage/*/mysql-test-suites + +This is supposed to cover running mtr from a source directory and installed. + +========================== +A suite contains *.test and *.result files. They can be in the t/ and r/ +subdirectories under the suitedir or directly in the suitedir +(that is suitedir/t/*.test or suitedir/*.test, same for *.result)) + +========================== +A suite can contain a suite.opt file - at the same location where .test files +are or in the suite directory. As usual, the .opt file can use $-substitutions +for the environment variables. + +Usually, using my.cnf template (see below) is preferrable. + +But command line options (.opt files and combinations file) get special +treatment - they can have special options that affect mtr behavior. cnf +files cannot. Special options are + --timezone, --plugin-load, --result-file, --config-file-template, + --default-time-zone, --force-restart + +========================== +A suite can have suite.pm file in the suitedir. It must declare a +package that inherits from My::Suite. + +The suite.pm needs to have @ISA=qw(My::Suite) and it must end +with bless {}; - that is it must return an object of that class. +It can also return a string - in this case all tests in the suite +will be skipped, with this string being printed as a reason. + +A suite class can define config_files() and servers() methods. + +A config_files method returns a list of additional config files (besides +my.cnf), that this suite needs to be created. For every file it specifies +a function that will create it, when given a My::Config object. For example: + + sub config_files { ( 'config.ini' => \&write_ini, + 'new.conf' => \&do_new_conf ) } + +A servers method returns a list of processes that needs to be started for +this suite. A process is specified as a pair (regex, hash). A regex must +match a section in the my.cnf template (for example, qr/mysqld\./ corresponds +to all mysqld processes), a hash contains these options: + + SORT => a number, processes are started in the order of increasing SORT + values (and stopped in the reverse order). mysqld has number 300. + START => a function to start a process. It takes two arguments, + My::Config::Group and My::Test. If START is undefined the process + will not be started. + WAIT => a function waits for the process to be started. It takes + My::Config::Group as an argument. Internallys mtr first invokes + START for all processes, then WAIT for all started processes. + +example: sub servers { ( qr/^foo$/ => { SORT => 200, + START => \&start_foo, + WAIT => \&wait_foo } ) } + +See sphinx suite for an example. + +========================== +A suite can have my.cnf template file in the suitedir. +A my.cnf template uses a normal my.cnf syntax - groups, options, +and values - with templating extensions. They are + +* There can be groups with non-standard names, not used by mysqld. + These groups may be used by the suite.pm file somehow. + For example, they can be written to the additional config files. + See sphinx suite for an example. + +* There can be ENV group. It sets values for the environment variables. + +* Values can refer to each other - they will be expanded as needed. + A reference to a value of an option looks like @groupname.optionname. + For example + + [mysqld.2] + master-port= @mysqld.1.port + + it sets the master-port in the mysqld.2 group to the value of + port in the mysqld.1 group. + +* An option name may start from '#'. In the resulting my.cnf it will look + like a comment, but it still can be referred to. For example: + + [example] + #foo = localhost:@mysqld.1.port + bar = http://@example.#foo/index.html + +* There are two special - in this regard - groups. + + Via the ENV group one can refer to any environment variable, not only + to values in the [ENV] group of my.cnf file. + + Via the OPT group one can refer to special values: + @OPT.vardir - a path to vardir + @OPT.port - a new port number is reserved out of the pool. It will not + match any other port number used by this test run. + See sphinx suite for an example. + +Most probably a suite my.cnf will need to start from + + !include include/default_my.cnf + +and then modify the configuration as necessary. + +========================== +A suite can have combinations file in the suitedir. It uses my.cnf syntax +but it cannot use @-substitutions. Instead, it can use $-substitutions for +the environment variables. Because the combination options will not be +merged to a my.cnf, but will be added to the command line. Example: + + [conf1] + opt1=val1 + + [conf2] + opt1=val2 + opt2=$HAVE_SOMETHING + +Such a file will cause every test from the suite to be run twice - once +with mysqld using --opt1=val1 and the other one with mysqld using +--opt1=val2 --opt2=$HAVE_SOMETHING + +One can limit mtr run to a subset of combinations by setting environment +variable SUITENAME_COMBINATIONS to the ':'-separated set of combination +names. E.g. + + RPL_COMBINATIONS=mix:row ./mtr --suite rpl + +See innodb_plugin suite for an example of how suite.pm may set this variable +to exclude unsupported configurations. +========================== + === modified file 'mysql-test/include/commit.inc' --- a/mysql-test/include/commit.inc 2009-08-26 23:13:03 +0000 +++ b/mysql-test/include/commit.inc 2010-07-20 17:36:15 +0000 @@ -725,9 +725,9 @@ call p_verify_status_increment(4, 4, 4, alter table t3 add column (b int); call p_verify_status_increment(2, 0, 2, 0); alter table t3 rename t4; -call p_verify_status_increment(2, 2, 2, 2); +call p_verify_status_increment(1, 0, 1, 0); rename table t4 to t3; -call p_verify_status_increment(2, 2, 2, 2); +call p_verify_status_increment(1, 0, 1, 0); truncate table t3; call p_verify_status_increment(4, 4, 4, 4); create view v1 as select * from t2; === modified file 'mysql-test/include/default_my.cnf' --- a/mysql-test/include/default_my.cnf 2007-12-12 17:19:24 +0000 +++ b/mysql-test/include/default_my.cnf 2010-08-17 07:14:46 +0000 @@ -6,9 +6,6 @@ # Run the master.sh script before starting this process #!run-master-sh -log-bin= master-bin - - [mysqlbinlog] disable-force-if-open === modified file 'mysql-test/include/default_mysqld.cnf' --- a/mysql-test/include/default_mysqld.cnf 2010-03-28 18:10:00 +0000 +++ b/mysql-test/include/default_mysqld.cnf 2010-08-17 07:14:46 +0000 @@ -13,9 +13,10 @@ key_buffer_size= 1M sort_buffer= 256K max_heap_table_size= 1M +loose-skip-innodb +loose-skip-pbxt + loose-innodb_data_file_path= ibdata1:10M:autoextend slave-net-timeout=120 -log-bin=mysqld-bin - === modified file 'mysql-test/include/diff_tables.inc' --- a/mysql-test/include/diff_tables.inc 2010-06-28 20:59:41 +0000 +++ b/mysql-test/include/diff_tables.inc 2010-07-04 08:17:53 +0000 @@ -64,17 +64,13 @@ let $_diff_table=$diff_table_2; let $_diff_i=2; while ($_diff_i) { - # Parse out any leading "master:" or "slave:" from the table - # specification and connect the appropriate server. - let $_diff_conn_master=`SELECT SUBSTR('$_diff_table', 1, 7) = 'master:'`; - if ($_diff_conn_master) { - let $_diff_table=`SELECT SUBSTR('$_diff_table', 8)`; - connection master; - } - let $_diff_conn_slave=`SELECT SUBSTR('$_diff_table', 1, 6) = 'slave:'`; - if ($_diff_conn_slave) { - let $_diff_table=`SELECT SUBSTR('$_diff_table', 7)`; - connection slave; + # Parse out any leading "master:" or "slave:" from the table specification +# and connect the appropriate server. + let $_pos= `SELECT LOCATE(':', '$_diff_table')`; + let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`; + if (`SELECT 'XX$_diff_conn' <> 'XX'`) { + let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`; + connection $_diff_conn; } # Sanity-check the input. === modified file 'mysql-test/include/have_archive.inc' --- a/mysql-test/include/have_archive.inc 2008-07-04 18:48:25 +0000 +++ b/mysql-test/include/have_archive.inc 2010-08-25 20:22:33 +0000 @@ -1,4 +1,5 @@ ---disable_query_log ---require r/true.require -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'archive'; ---enable_query_log +if (!`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = 'archive'`){ + skip Need archive engine; +} === added file 'mysql-test/include/have_archive.opt' --- a/mysql-test/include/have_archive.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/include/have_archive.opt 2010-08-25 20:22:33 +0000 @@ -0,0 +1,2 @@ +--loose-archive +--plugin-load=$HA_ARCHIVE_SO === added file 'mysql-test/include/have_binlog_format_mixed.opt' --- a/mysql-test/include/have_binlog_format_mixed.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/include/have_binlog_format_mixed.opt 2010-08-17 07:14:46 +0000 @@ -0,0 +1 @@ +--binlog-format=mixed === added file 'mysql-test/include/have_binlog_format_row.opt' --- a/mysql-test/include/have_binlog_format_row.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/include/have_binlog_format_row.opt 2010-08-17 07:14:46 +0000 @@ -0,0 +1 @@ +--binlog-format=row === added file 'mysql-test/include/have_binlog_format_statement.opt' --- a/mysql-test/include/have_binlog_format_statement.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/include/have_binlog_format_statement.opt 2010-08-17 07:14:46 +0000 @@ -0,0 +1,2 @@ +--binlog-format=statement + === added file 'mysql-test/include/have_blackhole.opt' --- a/mysql-test/include/have_blackhole.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/include/have_blackhole.opt 2010-08-25 20:22:33 +0000 @@ -0,0 +1,2 @@ +--loose-blackhole +--plugin-load=$HA_BLACKHOLE_SO === removed file 'mysql-test/include/have_exampledb.inc' --- a/mysql-test/include/have_exampledb.inc 2008-07-04 18:48:25 +0000 +++ b/mysql-test/include/have_exampledb.inc 1970-01-01 00:00:00 +0000 @@ -1,4 +0,0 @@ -disable_query_log; ---require r/true.require -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'example'; -enable_query_log; === modified file 'mysql-test/include/have_innodb.inc' --- a/mysql-test/include/have_innodb.inc 2010-03-31 13:04:40 +0000 +++ b/mysql-test/include/have_innodb.inc 2010-08-17 07:14:46 +0000 @@ -1,4 +1,5 @@ -disable_query_log; ---require r/true.require -select (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` from information_schema.engines where engine = 'innodb'; -enable_query_log; +if (!`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = 'innodb'`){ + skip Needs innodb engine; +} === added file 'mysql-test/include/have_innodb.opt' --- a/mysql-test/include/have_innodb.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/include/have_innodb.opt 2010-08-25 20:22:33 +0000 @@ -0,0 +1,2 @@ +--loose-innodb +--plugin-load=$HA_XTRADB_SO === modified file 'mysql-test/include/have_innodb_plugin.inc' --- a/mysql-test/include/have_innodb_plugin.inc 2010-08-03 21:26:17 +0000 +++ b/mysql-test/include/have_innodb_plugin.inc 2010-08-27 14:12:44 +0000 @@ -1,4 +1,5 @@ -disable_query_log; ---require r/true.require -SELECT (plugin_library LIKE 'ha_innodb_plugin%' OR plugin_description LIKE '%xtradb%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active'; -enable_query_log; +if (!`SELECT COUNT(*) FROM INFORMATION_SCHEMA.PLUGINS + WHERE PLUGIN_NAME = 'innodb' AND PLUGIN_STATUS = 'active' AND + (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%' OR PLUGIN_DESCRIPTION LIKE '%xtradb%')`) { + skip Need InnoDB plugin or XtraDB; +} === added file 'mysql-test/include/have_log_bin-master.opt' --- a/mysql-test/include/have_log_bin-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/include/have_log_bin-master.opt 2010-08-17 07:14:46 +0000 @@ -0,0 +1 @@ +--log-bin=master-bin === added file 'mysql-test/include/have_log_bin-slave.opt' --- a/mysql-test/include/have_log_bin-slave.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/include/have_log_bin-slave.opt 2010-08-17 07:14:46 +0000 @@ -0,0 +1 @@ +--log-bin=slave-bin === modified file 'mysql-test/include/have_log_bin.inc' --- a/mysql-test/include/have_log_bin.inc 2008-08-04 05:04:47 +0000 +++ b/mysql-test/include/have_log_bin.inc 2010-08-17 07:14:46 +0000 @@ -6,6 +6,8 @@ # # source include/have_log_bin.inc; +source include/not_embedded.inc; + -- require r/have_log_bin.require disable_query_log; show variables like 'log_bin'; === modified file 'mysql-test/include/have_pbxt.inc' --- a/mysql-test/include/have_pbxt.inc 2009-04-08 16:55:26 +0000 +++ b/mysql-test/include/have_pbxt.inc 2010-08-25 20:22:33 +0000 @@ -1,4 +1,5 @@ -disable_query_log; ---require r/true.require -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'pbxt'; -enable_query_log; +if (!`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = 'pbxt'`){ + skip Need PBXT engine; +} === added file 'mysql-test/include/have_pbxt.opt' --- a/mysql-test/include/have_pbxt.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/include/have_pbxt.opt 2010-08-17 07:14:46 +0000 @@ -0,0 +1 @@ +--loose-pbxt === added file 'mysql-test/include/rpl_diff_tables.inc' --- a/mysql-test/include/rpl_diff_tables.inc 1970-01-01 00:00:00 +0000 +++ b/mysql-test/include/rpl_diff_tables.inc 2010-07-04 04:02:49 +0000 @@ -0,0 +1,35 @@ +# ############################################################################# +# Check whether the given table is consistent between different master and +# slaves +# +# Usage: +# --let $diff_table= test.t1 +# --let $diff_server_list= master, slave, slave2 +# --source include/rpl_diff_tables.inc +# ############################################################################# + +if (`SELECT "XX$diff_table" = "XX"`) +{ + --die diff_table is null. +} + +--let $_servers= master, slave +if (`SELECT "XX$diff_server_list" <> "XX"`) +{ + --let $_servers= $diff_server_list +} + +--let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` +--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))` +connection $_master; +while (`SELECT "XX$_servers" <> "XX"`) +{ + --let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` + --let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))` + + --sync_slave_with_master $_slave + --let $diff_table_1= $_master:$diff_table + --let $diff_table_2= $_slave:$diff_table + --source include/diff_tables.inc + connection $_slave; +} === modified file 'mysql-test/lib/My/Config.pm' --- a/mysql-test/lib/My/Config.pm 2008-09-05 13:31:09 +0000 +++ b/mysql-test/lib/My/Config.pm 2010-08-17 07:14:46 +0000 @@ -6,7 +6,6 @@ use strict; use warnings; use Carp; - sub new { my ($class, $option_name, $option_value)= @_; my $self= bless { name => $option_name, @@ -61,7 +60,7 @@ sub insert { $option->{value}= $value; } else { - my $option= My::Config::Option->new($option_name, $value); + $option= My::Config::Option->new($option_name, $value); # Insert option in list push(@{$self->{options}}, $option); # Insert option in hash @@ -163,6 +162,62 @@ sub if_exist { return $option->value(); } +package My::Config::Group::ENV; +our @ISA=qw(My::Config::Group); + +use strict; +use warnings; +use Carp; + +sub new { + my ($class, $group_name)= @_; + bless My::Config::Group->new($group_name), $class; +} + +# +# Return value for an option in the group, fail if it does not exist +# +sub value { + my ($self, $option_name)= @_; + my $option= $self->option($option_name); + + if (! defined($option) and defined $ENV{$option_name}) { + my $value= $ENV{$option_name}; + $option= My::Config::Option->new($option_name, $value); + } + + croak "No option named '$option_name' in group '$self->{name}'" + if ! defined($option); + + return $option->value(); +} + +package My::Config::Group::OPT; +our @ISA=qw(My::Config::Group); + +use strict; +use warnings; +use Carp; + +sub new { + my ($class, $group_name)= @_; + bless My::Config::Group->new($group_name), $class; +} + +sub options { + my ($self)= @_; + () +} + +sub value { + my ($self, $option_name)= @_; + my $option= $self->option($option_name); + + croak "No option named '$option_name' in group '$self->{name}'" + if ! defined($option); + + return $option->value()->(); +} package My::Config; @@ -182,7 +237,10 @@ sub new { my ($class, $path)= @_; my $group_name= undef; - my $self= bless { groups => [] }, $class; + my $self= bless { groups => [ + My::Config::Group::ENV->new('ENV'), + My::Config::Group::OPT->new('OPT'), + ] }, $class; my $F= IO::File->new($path, "<") or croak "Could not open '$path': $!"; @@ -199,19 +257,13 @@ sub new { } # Magic #! comments - elsif ( $line =~ /^#\!/) { - my $magic= $line; + elsif ( $line =~ /^(#\!\S+)(?:\s*(.*?)\s*)?$/) { + my ($magic, $arg)= ($1, $2); croak "Found magic comment '$magic' outside of group" unless $group_name; #print "$magic\n"; - $self->insert($group_name, $magic, undef); - } - - # Comments - elsif ( $line =~ /^#/ || $line =~ /^;/) { - # Skip comment - next; + $self->insert($group_name, $magic, $arg); } # Empty lines @@ -236,7 +288,7 @@ sub new { } # <option> - elsif ( $line =~ /^([\@\w-]+)\s*$/ ) { + elsif ( $line =~ /^(#?[\w-]+)\s*$/ ) { my $option= $1; croak "Found option '$option' outside of group" @@ -247,7 +299,7 @@ sub new { } # <option>=<value> - elsif ( $line =~ /^([\@\w-]+)\s*=\s*(.*?)\s*$/ ) { + elsif ( $line =~ /^(#?[\w-]+)\s*=\s*(.*?)\s*$/ ) { my $option= $1; my $value= $2; @@ -256,10 +308,17 @@ sub new { #print "$option=$value\n"; $self->insert($group_name, $option, $value); - } else { - croak "Unexpected line '$line' found in '$path'"; } + # Comments + elsif ( $line =~ /^#/ || $line =~ /^;/) { + # Skip comment + next; + } + + else { + croak "Unexpected line '$line' found in '$path'"; + } } undef $F; # Close the file @@ -437,44 +496,4 @@ sub exists { return defined($option); } - -# Overload "to string"-operator with 'stringify' -use overload - '""' => \&stringify; - -# -# Return the config as a string in my.cnf file format -# -sub stringify { - my ($self)= @_; - my $res; - - foreach my $group ($self->groups()) { - $res .= "[$group->{name}]\n"; - - foreach my $option ($group->options()) { - $res .= $option->name(); - my $value= $option->value(); - if (defined $value) { - $res .= "=$value"; - } - $res .= "\n"; - } - $res .= "\n"; - } - return $res; -} - - -# -# Save the config to named file -# -sub save { - my ($self, $path)= @_; - my $F= IO::File->new($path, ">") - or croak "Could not open '$path': $!"; - print $F $self; - undef $F; # Close the file -} - 1; === modified file 'mysql-test/lib/My/ConfigFactory.pm' --- a/mysql-test/lib/My/ConfigFactory.pm 2010-04-28 12:52:24 +0000 +++ b/mysql-test/lib/My/ConfigFactory.pm 2010-08-17 07:14:46 +0000 @@ -57,16 +57,12 @@ sub fix_pidfile { sub fix_port { my ($self, $config, $group_name, $group)= @_; - my $hostname= $group->value('#host'); - return $self->{HOSTS}->{$hostname}++; + return $self->{PORT}++; } sub fix_host { my ($self)= @_; - # Get next host from HOSTS array - my @hosts= keys(%{$self->{HOSTS}});; - my $host_no= $self->{NEXT_HOST}++ % @hosts; - return $hosts[$host_no]; + 'localhost' } sub is_unique { @@ -229,7 +225,7 @@ if (IS_WINDOWS) sub fix_ndb_mgmd_port { my ($self, $config, $group_name, $group)= @_; my $hostname= $group->value('HostName'); - return $self->{HOSTS}->{$hostname}++; + return $self->{PORT}++; } @@ -428,20 +424,24 @@ sub post_check_embedded_group { sub resolve_at_variable { my ($self, $config, $group, $option)= @_; + local $_ = $option->value(); + my ($res, $after); - # Split the options value on last . - my @parts= split(/\./, $option->value()); - my $option_name= pop(@parts); - my $group_name= join('.', @parts); - - $group_name =~ s/^\@//; # Remove at - - my $from_group= $config->group($group_name) - or croak "There is no group named '$group_name' that ", - "can be used to resolve '$option_name'"; + while (m/(.*?)\@((?:\w+\.)+)(#?[-\w]+)/g) { + my ($before, $group_name, $option_name)= ($1, $2, $3); + $after = $'; + chop($group_name); - my $from= $from_group->value($option_name); - $config->insert($group->name(), $option->name(), $from) + my $from_group= $config->group($group_name) + or croak "There is no group named '$group_name' that ", + "can be used to resolve '$option_name'"; + + my $value= $from_group->value($option_name); + $res .= $before.$value; + } + $res .= $after; + + $config->insert($group->name(), $option->name(), $res) } @@ -453,7 +453,7 @@ sub post_fix_resolve_at_variables { next unless defined $option->value(); $self->resolve_at_variable($config, $group, $option) - if ($option->value() =~ /^\@/); + if ($option->value() =~ /\@/); } } } @@ -595,28 +595,18 @@ sub new_config { croak "you must pass '$required'" unless defined $args->{$required}; } - # Fill in hosts/port hash - my $hosts= {}; - my $baseport= $args->{baseport}; - $args->{hosts}= [ 'localhost' ] unless exists($args->{hosts}); - foreach my $host ( @{$args->{hosts}} ) { - $hosts->{$host}= $baseport; - } - # Open the config template my $config= My::Config->new($args->{'template_path'}); - my $extra_template_path= $args->{'extra_template_path'}; - if ($extra_template_path){ - $config->append(My::Config->new($extra_template_path)); - } my $self= bless { CONFIG => $config, ARGS => $args, - HOSTS => $hosts, - NEXT_HOST => 0, + PORT => $args->{baseport}, SERVER_ID => 1, }, $class; + # add auto-options + $config->insert('OPT', 'port' => sub { fix_port($self, $config) }); + $config->insert('OPT', 'vardir' => sub { shift->{ARGS}->{vardir} }); { # Run pre rules === modified file 'mysql-test/lib/My/Handles.pm' (properties changed: +x to -x) === modified file 'mysql-test/lib/My/SafeProcess.pm' --- a/mysql-test/lib/My/SafeProcess.pm 2010-04-28 12:52:24 +0000 +++ b/mysql-test/lib/My/SafeProcess.pm 2010-08-17 07:14:46 +0000 @@ -120,7 +120,7 @@ sub new { my $input = delete($opts{'input'}); my $output = delete($opts{'output'}); my $error = delete($opts{'error'}); - my $verbose = delete($opts{'verbose'}); + my $verbose = delete($opts{'verbose'}) || $::opt_verbose; my $nocore = delete($opts{'nocore'}); my $host = delete($opts{'host'}); my $shutdown = delete($opts{'shutdown'}); === modified file 'mysql-test/lib/My/SafeProcess/safe_process.cc' --- a/mysql-test/lib/My/SafeProcess/safe_process.cc 2010-04-08 11:56:57 +0000 +++ b/mysql-test/lib/My/SafeProcess/safe_process.cc 2010-08-27 14:12:44 +0000 @@ -160,7 +160,7 @@ int main(int argc, char* const argv[] ) signal(SIGCHLD, handle_signal); signal(SIGABRT, handle_abort); - sprintf(safe_process_name, "safe_process[%d]", (int) own_pid); + sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid); message("Started"); === added file 'mysql-test/lib/My/Suite.pm' --- a/mysql-test/lib/My/Suite.pm 1970-01-01 00:00:00 +0000 +++ b/mysql-test/lib/My/Suite.pm 2010-08-17 07:14:46 +0000 @@ -0,0 +1,10 @@ +# A default suite class that is used for all suites without their owns suite.pm +# see README.suites for a description + +package My::Suite; + +sub config_files { () } +sub servers { () } + +bless { }; + === modified file 'mysql-test/lib/My/Test.pm' --- a/mysql-test/lib/My/Test.pm 2009-03-20 14:18:22 +0000 +++ b/mysql-test/lib/My/Test.pm 2010-08-17 07:14:46 +0000 @@ -20,6 +20,12 @@ sub new { return $self; } +sub fullname { + my ($self)= @_; + $self->{name} . (defined $self->{combination} + ? " '$self->{combination}'" + : "") +} # # Return a unique key that can be used to === modified file 'mysql-test/lib/mtr_cases.pm' --- a/mysql-test/lib/mtr_cases.pm 2010-08-03 21:26:17 +0000 +++ b/mysql-test/lib/mtr_cases.pm 2010-08-25 20:22:33 +0000 @@ -39,7 +39,6 @@ our $enable_disabled; our $default_storage_engine; our $opt_with_ndbcluster_only; our $defaults_file; -our $defaults_extra_file; our $quick_collect; sub collect_option { @@ -68,21 +67,10 @@ require "mtr_misc.pl"; my $do_test_reg; my $skip_test_reg; -# Related to adding InnoDB plugin combinations -my $lib_innodb_plugin; - # If "Quick collect", set to 1 once a test to run has been found. my $some_test_found; -sub find_innodb_plugin { - $lib_innodb_plugin= - my_find_file($::basedir, - ["storage/innodb_plugin", "storage/innodb_plugin/.libs", - "lib/mysql/plugin", "lib/plugin"], - ["ha_innodb_plugin.dll", "ha_innodb_plugin.so", - "ha_innodb_plugin.sl"], - NOT_REQUIRED); -} +my $default_suite_object = do 'My/Suite.pm'; sub init_pattern { my ($from, $what)= @_; @@ -116,8 +104,6 @@ sub collect_test_cases ($$$) { $do_test_reg= init_pattern($do_test, "--do-test"); $skip_test_reg= init_pattern($skip_test, "--skip-test"); - &find_innodb_plugin; - # If not reordering, we also shouldn't group by suites, unless # no test cases were named. # This also effects some logic in the loop following this. @@ -188,17 +174,17 @@ sub collect_test_cases ($$$) { my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : []; push(@criteria, join("!", sort @{$opts}) . "~"); - $sort_criteria{$tinfo->{name}} = join(" ", @criteria); + $sort_criteria{$tinfo->fullname()} = join(" ", @criteria); } @$cases = sort { - $sort_criteria{$a->{'name'}} . $a->{'name'} cmp - $sort_criteria{$b->{'name'}} . $b->{'name'}; } @$cases; + $sort_criteria{$a->fullname()} . $a->fullname() cmp + $sort_criteria{$b->fullname()} . $b->fullname() } @$cases; # For debugging the sort-order # foreach my $tinfo (@$cases) # { - # print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n"); + # print $sort_criteria{$tinfo->fullname()}," -> \t",$tinfo->fullname(),"\n"; # } } @@ -310,6 +296,17 @@ sub collect_one_suite mtr_verbose("testdir: $testdir"); mtr_verbose("resdir: $resdir"); + # + # Load the Suite object + # + unless ($::suites{$suite}) { + if (-f "$suitedir/suite.pm") { + $::suites{$suite} = do "$suitedir/suite.pm"; + } else { + $::suites{$suite} = $default_suite_object; + } + } + # ---------------------------------------------------------------------- # Build a hash of disabled testcases for this suite # ---------------------------------------------------------------------- @@ -328,12 +325,8 @@ sub collect_one_suite } # Read suite.opt file - my $suite_opt_file= "$testdir/suite.opt"; - my $suite_opts= []; - if ( -f $suite_opt_file ) - { - $suite_opts= opts_from_file($suite_opt_file); - } + my $suite_opts= [ opts_from_file("$testdir/suite.opt") ]; + $suite_opts = [ opts_from_file("$suitedir/suite.opt") ] unless @$suite_opts; if ( @$opt_cases ) { @@ -438,14 +431,16 @@ sub collect_one_suite { # Read combinations file in my.cnf format mtr_verbose("Read combinations file"); + my %env_filter = map { $_ => 1 } split /:/, $ENV{"\U${suite}_COMBINATIONS"}; my $config= My::Config->new($combination_file); foreach my $group ($config->groups()) { my $comb= {}; $comb->{name}= $group->name(); + next if %env_filter and not $env_filter{$comb->{name}}; foreach my $option ( $group->options() ) { push(@{$comb->{comb_opt}}, $option->option()); } - push(@combinations, $comb); + push(@combinations, $comb) if $comb->{comb_opt}; } } @@ -539,28 +534,7 @@ sub optimize_cases { # support it # ======================================================= #print "binlog_format: $binlog_format\n"; - if (defined $binlog_format ) - { - # ======================================================= - # Fixed --binlog-format=x specified on command line - # ======================================================= - if ( defined $tinfo->{'binlog_formats'} ) - { - #print "binlog_formats: ". join(", ", @{$tinfo->{binlog_formats}})."\n"; - - # The test supports different binlog formats - # check if the selected one is ok - my $supported= - grep { $_ eq $binlog_format } @{$tinfo->{'binlog_formats'}}; - if ( !$supported ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= - "Doesn't support --binlog-format='$binlog_format'"; - } - } - } - else + if (not defined $binlog_format ) { # ======================================================= # Use dynamic switching of binlog format @@ -623,10 +597,6 @@ sub optimize_cases { $tinfo->{'ndb_test'}= 1 if ( $default_engine =~ /^ndb/i ); - $tinfo->{'innodb_test'}= 1 - if ( $default_engine =~ /^innodb/i ); - $tinfo->{'pbxt_test'}= 1 - if ( $default_engine =~ /^pbxt/i ); } } @@ -644,67 +614,78 @@ sub optimize_cases { # Read options from the given opt file and append them as an array # to $tinfo->{$opt_name} # -sub process_opts_file { - my ($tinfo, $opt_file, $opt_name)= @_; +sub process_opts { + my ($tinfo, $opt_name)= @_; + + my @opts= @{$tinfo->{$opt_name}}; + $tinfo->{$opt_name} = []; - if ( -f $opt_file ) + my @plugins; + + foreach my $opt (@opts) { - my $opts= opts_from_file($opt_file); + my $value; + + # The opt file is used both to send special options to the mysqld + # as well as pass special test case specific options to this + # script - foreach my $opt ( @$opts ) + $value= mtr_match_prefix($opt, "--timezone="); + if ( defined $value ) { - my $value; + $tinfo->{'timezone'}= $value; + next; + } - # The opt file is used both to send special options to the mysqld - # as well as pass special test case specific options to this - # script + $value= mtr_match_prefix($opt, "--plugin-load="); + if (defined $value) + { + push @plugins, $value; + next; + } - $value= mtr_match_prefix($opt, "--timezone="); - if ( defined $value ) - { - $tinfo->{'timezone'}= $value; - next; - } + $value= mtr_match_prefix($opt, "--result-file="); + if ( defined $value ) + { + # Specifies the file mysqltest should compare + # output against + $tinfo->{'result_file'}= "r/$value.result"; + next; + } - $value= mtr_match_prefix($opt, "--result-file="); - if ( defined $value ) - { - # Specifies the file mysqltest should compare - # output against - $tinfo->{'result_file'}= "r/$value.result"; - next; - } + $value= mtr_match_prefix($opt, "--config-file-template="); + if ( defined $value) + { + # Specifies the configuration file to use for this test + $tinfo->{'template_path'}= dirname($tinfo->{path})."/$value"; + next; + } - $value= mtr_match_prefix($opt, "--config-file-template="); - if ( defined $value) - { - # Specifies the configuration file to use for this test - $tinfo->{'template_path'}= dirname($tinfo->{path})."/$value"; - next; - } + # If we set default time zone, remove the one we have + $value= mtr_match_prefix($opt, "--default-time-zone="); + if ( defined $value ) + { + # Set timezone for this test case to something different + $tinfo->{'timezone'}= "GMT-8"; + # Fallthrough, add the --default-time-zone option + } - # If we set default time zone, remove the one we have - $value= mtr_match_prefix($opt, "--default-time-zone="); - if ( defined $value ) - { - # Set timezone for this test case to something different - $tinfo->{'timezone'}= "GMT-8"; - # Fallthrough, add the --default-time-zone option - } + # The --restart option forces a restart even if no special + # option is set. If the options are the same as next testcase + # there is no need to restart after the testcase + # has completed + if ( $opt eq "--force-restart" ) + { + $tinfo->{'force_restart'}= 1; + next; + } - # The --restart option forces a restart even if no special - # option is set. If the options are the same as next testcase - # there is no need to restart after the testcase - # has completed - if ( $opt eq "--force-restart" ) - { - $tinfo->{'force_restart'}= 1; - next; - } + # Ok, this was a real option, add it + push(@{$tinfo->{$opt_name}}, $opt); + } - # Ok, this was a real option, add it - push(@{$tinfo->{$opt_name}}, $opt); - } + if (@plugins) { + push @{$tinfo->{$opt_name}}, "--plugin-load=" . join(':', @plugins); } } @@ -758,7 +739,7 @@ sub collect_one_test_case { name => "$suitename.$tname", shortname => $tname, path => "$testdir/$filename", - + suite => $suitename, ); my $result_file= "$resdir/$tname.result"; @@ -880,7 +861,7 @@ sub collect_one_test_case { if ( -f "$testdir/$tname.slave-mi"); - tags_from_test_file($tinfo,"$testdir/${tname}.test"); + my @source_files = tags_from_test_file($tinfo,"$testdir/${tname}.test"); # Get default storage engine from suite.opt file @@ -897,12 +878,6 @@ sub collect_one_test_case { $tinfo->{'ndb_test'}= 1 if ( $local_default_storage_engine =~ /^ndb/i ); - $tinfo->{'innodb_test'}= 1 - if ( $local_default_storage_engine =~ /^innodb/i ); - - $tinfo->{'pbxt_test'}= 1 - if ( $local_default_storage_engine =~ /^pbxt/i ); - } if ( $tinfo->{'big_test'} and ! $::opt_big_test ) @@ -949,72 +924,6 @@ sub collect_one_test_case { } } - if ($tinfo->{'federated_test'}) - { - # This is a test that needs federated, enable it - push(@{$tinfo->{'master_opt'}}, "--loose-federated"); - push(@{$tinfo->{'slave_opt'}}, "--loose-federated"); - } - - if ( $tinfo->{'innodb_test'} ) - { - # This is a test that needs innodb - if ( $::mysqld_variables{'innodb'} eq "OFF" || - ! exists $::mysqld_variables{'innodb'} ) - { - # innodb is not supported, skip it - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No innodb support"; - return $tinfo; - } - } - elsif ( $tinfo->{'innodb_plugin_test'} ) - { - # This is a test that needs the innodb plugin - if (&find_innodb_plugin) - { - my $sep= (IS_WINDOWS) ? ';' : ':'; - my $plugin_filename= basename($lib_innodb_plugin); - my $plugin_list= - "innodb=$plugin_filename$sep" . - "innodb_trx=$plugin_filename$sep" . - "innodb_locks=$plugin_filename$sep" . - "innodb_lock_waits=$plugin_filename$sep" . - "innodb_cmp=$plugin_filename$sep" . - "innodb_cmp_reset=$plugin_filename$sep" . - "innodb_cmpmem=$plugin_filename$sep" . - "innodb_cmpmem_reset=$plugin_filename"; - - foreach my $k ('master_opt', 'slave_opt') { - push(@{$tinfo->{$k}}, '--ignore-builtin-innodb'); - push(@{$tinfo->{$k}}, '--plugin-dir=' . dirname($lib_innodb_plugin)); - push(@{$tinfo->{$k}}, "--plugin-load=$plugin_list"); - } - } - } - else - { - push(@{$tinfo->{'master_opt'}}, "--loose-skip-innodb"); - push(@{$tinfo->{'slave_opt'}}, "--loose-skip-innodb"); - } - - if ( $tinfo->{'need_binlog'} ) - { - if (grep(/^--skip-log-bin/, @::opt_extra_mysqld_opt) ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test needs binlog"; - return $tinfo; - } - } - else - { - # Test does not need binlog, add --skip-binlog to - # the options used when starting - push(@{$tinfo->{'master_opt'}}, "--loose-skip-log-bin"); - push(@{$tinfo->{'slave_opt'}}, "--loose-skip-log-bin"); - } - if ( $tinfo->{'rpl_test'} ) { if ( $skip_rpl ) @@ -1085,28 +994,6 @@ sub collect_one_test_case { $tinfo->{template_path}= $config; } - if ( $tinfo->{'pbxt_test'} ) - { - # This is a test that needs pbxt - if ( $::mysqld_variables{'pbxt'} eq "OFF" || - ! exists $::mysqld_variables{'pbxt'} ) - { - # Engine is not supported, skip it - $tinfo->{'skip'}= 1; - return $tinfo; - } - } - else - { - # Only disable engine if it's on by default (to avoid warnings about - # not existing loose options - if ( $::mysqld_variables{'pbxt'} eq "ON") - { - push(@{$tinfo->{'master_opt'}}, "--loose-skip-pbxt"); - push(@{$tinfo->{'slave_opt'}}, "--loose-skip-pbxt"); - } - } - if ( $tinfo->{'example_plugin_test'} ) { if ( !$ENV{'HA_EXAMPLE_SO'} ) @@ -1117,27 +1004,29 @@ sub collect_one_test_case { } } - - # Set extra config file to use - if (defined $defaults_extra_file) { - $tinfo->{extra_template_path}= $defaults_extra_file; + if (not ref $::suites{$tinfo->{suite}}) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= $::suites{$tinfo->{suite}}; + return $tinfo; } # ---------------------------------------------------------------------- - # Append mysqld extra options to both master and slave + # Append mysqld extra options to master and slave, as appropriate # ---------------------------------------------------------------------- + for (@source_files) { + s/\.\w+$//; + push @{$tinfo->{master_opt}}, opts_from_file("$_.opt"); + push @{$tinfo->{slave_opt}}, opts_from_file("$_.opt"); + push @{$tinfo->{master_opt}}, opts_from_file("$_-master.opt"); + push @{$tinfo->{slave_opt}}, opts_from_file("$_-slave.opt"); + } + push(@{$tinfo->{'master_opt'}}, @::opt_extra_mysqld_opt); push(@{$tinfo->{'slave_opt'}}, @::opt_extra_mysqld_opt); - # ---------------------------------------------------------------------- - # Add master opts, extra options only for master - # ---------------------------------------------------------------------- - process_opts_file($tinfo, "$testdir/$tname-master.opt", 'master_opt'); - - # ---------------------------------------------------------------------- - # Add slave opts, list of extra option only for slave - # ---------------------------------------------------------------------- - process_opts_file($tinfo, "$testdir/$tname-slave.opt", 'slave_opt'); + process_opts($tinfo, 'master_opt'); + process_opts($tinfo, 'slave_opt'); return $tinfo; } @@ -1147,24 +1036,6 @@ sub collect_one_test_case { # the specified value in "tinfo" my @tags= ( - ["include/have_binlog_format_row.inc", "binlog_formats", ["row"]], - ["include/have_binlog_format_statement.inc", "binlog_formats", ["statement"]], - ["include/have_binlog_format_mixed.inc", "binlog_formats", ["mixed"]], - ["include/have_binlog_format_mixed_or_row.inc", - "binlog_formats", ["mixed", "row"]], - ["include/have_binlog_format_mixed_or_statement.inc", - "binlog_formats", ["mixed", "statement"]], - ["include/have_binlog_format_row_or_statement.inc", - "binlog_formats", ["row", "statement"]], - - ["include/have_log_bin.inc", "need_binlog", 1], - - ["include/have_innodb.inc", "innodb_test", 1], - ["include/have_innodb_plugin.inc", "innodb_plugin_test", 1], - ["include/have_real.inc", "innodb_test", 1], - ["include/have_real_innodb_plugin.inc", "innodb_plugin_test", 1], - ["include/have_xtradb.inc", "innodb_test", 1], - ["include/have_pbxt.inc", "pbxt_test", 1], ["include/big_test.inc", "big_test", 1], ["include/have_debug.inc", "need_debug", 1], ["include/have_ndb.inc", "ndb_test", 1], @@ -1172,7 +1043,6 @@ my @tags= ["include/master-slave.inc", "rpl_test", 1], ["include/ndb_master-slave.inc", "rpl_test", 1], ["include/ndb_master-slave.inc", "ndb_test", 1], - ["federated.inc", "federated_test", 1], ["include/not_embedded.inc", "not_embedded", 1], ["include/not_valgrind.inc", "not_valgrind", 1], ["include/have_example_plugin.inc", "example_plugin_test", 1], @@ -1185,6 +1055,7 @@ sub tags_from_test_file { my $file= shift; #mtr_verbose("$file"); my $F= IO::File->new($file) or mtr_error("can't open file \"$file\": $!"); + my @all_files=($file); while ( my $line= <$F> ) { @@ -1220,13 +1091,13 @@ sub tags_from_test_file { # Only source the file if it exists, we may get # false positives in the regexes above if someone # writes "source nnnn;" in a test case(such as mysqltest.test) - tags_from_test_file($tinfo, $sourced_file); + unshift @all_files, tags_from_test_file($tinfo, $sourced_file); last; } } } - } + @all_files; } sub unspace { @@ -1239,6 +1110,9 @@ sub unspace { sub opts_from_file ($) { my $file= shift; + local $_; + + return () unless -f $file; open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!"); my @args; @@ -1280,7 +1154,7 @@ sub opts_from_file ($) { } } close FILE; - return \@args; + return @args; } sub print_testcases { === modified file 'mysql-test/lib/mtr_report.pm' --- a/mysql-test/lib/mtr_report.pm 2010-04-28 12:52:24 +0000 +++ b/mysql-test/lib/mtr_report.pm 2010-08-17 07:14:46 +0000 @@ -61,14 +61,10 @@ sub _name { sub _mtr_report_test_name ($) { my $tinfo= shift; - my $tname= $tinfo->{name}; + my $tname= $tinfo->fullname(); return unless defined $verbose; - # Add combination name if any - $tname.= " '$tinfo->{combination}'" - if defined $tinfo->{combination}; - print _name(). _timestamp(); printf "%-40s ", $tname; my $worker = $tinfo->{worker}; === modified file 'mysql-test/mysql-test-run.pl' --- a/mysql-test/mysql-test-run.pl 2010-08-05 11:40:54 +0000 +++ b/mysql-test/mysql-test-run.pl 2010-08-25 20:22:33 +0000 @@ -130,7 +130,7 @@ my $path_config_file; # The ge # executables will be used by the test suite. our $opt_vs_config = $ENV{'MTR_VS_CONFIG'}; -my $DEFAULT_SUITES= "main,binlog,federated,rpl,maria,parts,innodb,innodb_plugin,percona"; +my $DEFAULT_SUITES= "main,binlog,federated,rpl,maria,parts,innodb,innodb_plugin,percona,ndb"; my $opt_suites; our $opt_verbose= 0; # Verbose output, enable with --verbose @@ -257,6 +257,8 @@ our $debug_compiled_binaries; our %mysqld_variables; +our %suites; + my $source_dist= 0; my $opt_max_save_core= env_or_val(MTR_MAX_SAVE_CORE => 5); @@ -711,6 +713,8 @@ sub run_test_server ($$$) { $next= splice(@$tests, $second_best, 1); } + xterm_stat(scalar(@$tests)); + if ($next) { #$next->print_test(); $next->write_test($sock, 'TESTCASE'); @@ -807,7 +811,7 @@ sub run_worker ($) { # We need to gracefully shut down the servers to see any # Valgrind memory leak errors etc. since last server restart. if ($opt_warnings) { - stop_servers(all_servers()); + stop_servers(reverse all_servers()); if(check_warnings_post_shutdown($server)) { # Warnings appeared in log file(s) during final server shutdown. exit(1); @@ -1595,7 +1599,7 @@ sub collect_mysqld_features { my $cmd= join(" ", $exe_mysqld, @$args); my $list= `$cmd`; - print "cmd: $cmd\n"; + mtr_verbose("cmd: $cmd"); foreach my $line (split('\n', $list)) { @@ -1802,6 +1806,7 @@ sub mysql_fix_arguments () { mtr_add_arg($args, "--basedir=%s", $basedir); mtr_add_arg($args, "--bindir=%s", $path_client_bindir); mtr_add_arg($args, "--verbose"); + mtr_add_arg($args, "--sync-sys=0"); # Speed up test suite return mtr_args2str($exe, @$args); } @@ -2492,7 +2497,7 @@ sub check_ndbcluster_support ($) { } -sub ndbcluster_wait_started($$){ +sub ndbcluster_wait_started { my $cluster= shift; my $ndb_waiter_extra_opt= shift; my $path_waitlog= join('/', $opt_vardir, $cluster->name(), "ndb_waiter.log"); @@ -2660,7 +2665,7 @@ sub ndbd_start { sub ndbcluster_start ($) { - my $cluster= shift; + my ($cluster) = @_; mtr_verbose("ndbcluster_start '".$cluster->name()."'"); @@ -2680,6 +2685,109 @@ sub ndbcluster_start ($) { } +sub mysql_server_start($) { + my ($mysqld, $tinfo) = @_; + + if ( $mysqld->{proc} ) + { + # Already started + + # Write start of testcase to log file + mark_log($mysqld->value('#log-error'), $tinfo); + + return; + } + + my $datadir= $mysqld->value('datadir'); + if (not $opt_start_dirty) + { + + my @options= ('log-bin', 'relay-log'); + foreach my $option_name ( @options ) { + next unless $mysqld->option($option_name); + + my $file_name= $mysqld->value($option_name); + next unless + defined $file_name and + -e $file_name; + + mtr_debug(" -removing '$file_name'"); + unlink($file_name) or die ("unable to remove file '$file_name'"); + } + + if (-d $datadir ) { + preserve_error_log($mysqld); + mtr_verbose(" - removing '$datadir'"); + rmtree($datadir); + } + } + + my $mysqld_basedir= $mysqld->value('basedir'); + if ( $basedir eq $mysqld_basedir ) + { + if (! $opt_start_dirty) # If dirty, keep possibly grown system db + { + # Copy datadir from installed system db + for my $path ( "$opt_vardir", "$opt_vardir/..") { + my $install_db= "$path/install.db"; + copytree($install_db, $datadir) + if -d $install_db; + } + mtr_error("Failed to copy system db to '$datadir'") + unless -d $datadir; + } + } + else + { + mysql_install_db($mysqld); # For versional testing + + mtr_error("Failed to install system db to '$datadir'") + unless -d $datadir; + + } + restore_error_log($mysqld); + + # Create the servers tmpdir + my $tmpdir= $mysqld->value('tmpdir'); + mkpath($tmpdir) unless -d $tmpdir; + + # Write start of testcase to log file + mark_log($mysqld->value('#log-error'), $tinfo); + + # Run <tname>-master.sh + if ($mysqld->option('#!run-master-sh') and + run_sh_script($tinfo->{master_sh}) ) + { + $tinfo->{'comment'}= "Failed to execute '$tinfo->{master_sh}'"; + return 1; + } + + # Run <tname>-slave.sh + if ($mysqld->option('#!run-slave-sh') and + run_sh_script($tinfo->{slave_sh})) + { + $tinfo->{'comment'}= "Failed to execute '$tinfo->{slave_sh}'"; + return 1; + } + + if (!$opt_embedded_server) + { + my $extra_opts= get_extra_opts($mysqld, $tinfo); + mysqld_start($mysqld,$extra_opts); + + # Save this test case information, so next can examine it + $mysqld->{'started_tinfo'}= $tinfo; + } +} + +sub mysql_server_wait { + my ($mysqld) = @_; + + return not sleep_until_file_created($mysqld->value('pid-file'), + $opt_start_timeout, + $mysqld->{'proc'}); +} + sub create_config_file_for_extern { my %opts= ( @@ -3454,9 +3562,83 @@ sub restart_forced_by_test # Return timezone value of tinfo or default value sub timezone { my ($tinfo)= @_; - return $tinfo->{timezone} || "DEFAULT"; + local $_ = $tinfo->{timezone}; + return 'DEFAULT' unless defined $_; + no warnings 'uninitialized'; + s/\$\{(\w+)\}/$ENV{$1}/ge; + s/\$(\w+)/$ENV{$1}/ge; + $_; +} + +sub mycnf_create { + my ($config) = @_; + my $res; + + foreach my $group ($config->groups()) { + $res .= "[$group->{name}]\n"; + + foreach my $option ($group->options()) { + $res .= $option->name(); + my $value= $option->value(); + if (defined $value) { + $res .= "=$value"; + } + $res .= "\n"; + } + $res .= "\n"; + } + $res; } +sub config_files($) { + my ($tinfo) = @_; + ( + 'my.cnf' => \&mycnf_create, + $suites{$tinfo->{suite}}->config_files() + ); +} + +sub _like { return $config ? $config->like($_[0]) : (); } +sub mysqlds { return _like('mysqld\.'); } +sub ndbds { return _like('cluster_config\.ndbd\.');} +sub ndb_mgmds { return _like('cluster_config\.ndb_mgmd\.'); } + +sub fix_servers($) { + my ($tinfo) = @_; + return () unless $config; + my %servers = ( + qr/mysqld\./ => { + SORT => 300, + START => \&mysql_server_start, + WAIT => \&mysql_server_wait, + }, + qr/mysql_cluster\./ => { + SORT => 200, + START => \&ndbcluster_start, + WAIT => \&ndbcluster_wait_started, + }, + qr/cluster_config\.ndb_mgmd\./ => { + SORT => 210, + START => undef, + }, + qr/cluster_config\.ndbd\./ => { + SORT => 220, + START => undef, + }, + $suites{$tinfo->{suite}}->servers() + ); + for ($config->groups()) { + while (my ($re,$prop) = each %servers) { + @$_{keys %$prop} = values %$prop if $_->{name} =~ /^$re/; + } + } +} + +sub all_servers { + return unless $config; + ( sort { $a->{SORT} <=> $b->{SORT} } + grep { defined $_->{SORT} } $config->groups() ); +} # Storage for changed environment variables my %old_env; @@ -3499,7 +3681,7 @@ sub run_testcase ($$) { if ( @restart != 0) { # Remember that we restarted for this test case (count restarts) $tinfo->{'restarted'}= 1; - stop_servers(@restart ); + stop_servers(reverse @restart); if ($opt_warnings) { check_warnings_post_shutdown($server_socket); } @@ -3535,7 +3717,6 @@ sub run_testcase ($$) { vardir => $opt_vardir, tmpdir => $opt_tmpdir, baseport => $baseport, - #hosts => [ 'host1', 'host2' ], user => $opt_user, password => '', ssl => $opt_ssl_supported, @@ -3543,8 +3724,16 @@ sub run_testcase ($$) { } ); - # Write the new my.cnf - $config->save($path_config_file); + fix_servers($tinfo); + + # Write config files: + my %config_files = config_files($tinfo); + while (my ($file, $generate) = each %config_files) { + my ($path) = "$opt_vardir/$file"; + open (F, '>', $path) or die "Could not open '$path': $!"; + print F &$generate($config); + close F; + } # Remember current config so a restart can occur when a test need # to use a different one @@ -3687,7 +3876,7 @@ sub run_testcase ($$) { if ($opt_warnings) { # Checking error logs for warnings, so need to stop server # gracefully so that memory leaks etc. can be properly detected. - stop_servers(all_servers()); + stop_servers(reverse all_servers()); check_warnings_post_shutdown($server_socket); # Even if we got warnings here, we should not fail this # particular test, as the warnings may be caused by an earlier @@ -3845,7 +4034,8 @@ sub run_testcase ($$) { # valuable debugging information even if there is no test failure recorded. sub _preserve_error_log_names { my ($mysqld)= @_; - my $error_log_file= $mysqld->value('#log-error'); + my $error_log_file= $mysqld->if_exist('#log-error'); + return unless $error_log_file and -r $error_log_file; my $error_log_dir= dirname($error_log_file); my $save_name= $error_log_dir ."/../". $mysqld->name() .".error.log"; return ($error_log_file, $save_name); @@ -3854,14 +4044,14 @@ sub _preserve_error_log_names { sub preserve_error_log { my ($mysqld)= @_; my ($error_log_file, $save_name)= _preserve_error_log_names($mysqld); - my $res= rename($error_log_file, $save_name); + rename($error_log_file, $save_name) if $save_name; # Ignore any errors, as it's just a best-effort to keep the log if possible. } sub restore_error_log { my ($mysqld)= @_; my ($error_log_file, $save_name)= _preserve_error_log_names($mysqld); - my $res= rename($save_name, $error_log_file); + rename($save_name, $error_log_file) if $save_name; } # Keep track of last position in mysqld error log where we scanned for @@ -3905,6 +4095,8 @@ sub pre_write_errorlog { sub extract_server_log ($$) { my ($error_log, $tname) = @_; + + return unless $error_log; # Open the servers .err log file and read all lines # belonging to current test into @lines @@ -3947,9 +4139,9 @@ sub get_log_from_proc ($$) { my ($proc, $name)= @_; my $srv_log= ""; - foreach my $mysqld (mysqlds()) { + foreach my $mysqld (all_servers()) { if ($mysqld->{proc} eq $proc) { - my @srv_lines= extract_server_log($mysqld->value('#log-error'), $name); + my @srv_lines= extract_server_log($mysqld->if_exist('#log-error'), $name); $srv_log= "\nServer log from this test:\n" . join ("", @srv_lines); last; } @@ -4028,15 +4220,18 @@ sub extract_warning_lines ($) { my @antipatterns = ( qr/error .*connecting to master/, + qr/Plugin 'ndbcluster' will be forced to shutdown/, qr/InnoDB: Error: in ALTER TABLE `test`.`t[12]`/, qr/InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal/, qr/Slave: Unknown table 't1' Error_code: 1051/, qr/Slave SQL:.*(Error_code: [[:digit:]]+|Query:.*)/, qr/slave SQL thread aborted/, - qr/unknown option '--loose-/, - qr/unknown variable 'loose-/, + qr/unknown option '--loose[-_]/, + qr/unknown variable 'loose[-_]/, qr/Now setting lower_case_table_names to [02]/, qr/Setting lower_case_table_names=2/, + qr/You have forced lower_case_table_names to 0/, + qr/Plugin 'ndbcluster' will be forced to shutdow/, qr/deprecated/, qr/Slave SQL thread retried transaction/, qr/Slave \(additional info\)/, @@ -4345,29 +4540,18 @@ sub clean_dir { sub clean_datadir { - mtr_verbose("Cleaning datadirs..."); if (started(all_servers()) != 0){ mtr_error("Trying to clean datadir before all servers stopped"); } - foreach my $cluster ( clusters() ) + for (all_servers()) { - my $cluster_dir= "$opt_vardir/".$cluster->{name}; - mtr_verbose(" - removing '$cluster_dir'"); - rmtree($cluster_dir); - - } - - foreach my $mysqld ( mysqlds() ) - { - my $mysqld_dir= dirname($mysqld->value('datadir')); - preserve_error_log($mysqld); - if (-d $mysqld_dir ) { - mtr_verbose(" - removing '$mysqld_dir'"); - rmtree($mysqld_dir); - } + preserve_error_log($_); # or at least, try to + my $dir= "$opt_vardir/".$_->{name}; + mtr_verbose(" - removing '$dir'"); + rmtree($dir); } # Remove all files in tmp and var/tmp @@ -4390,17 +4574,6 @@ sub save_datadir_after_failure($$) { } -sub remove_ndbfs_from_ndbd_datadir { - my ($ndbd_datadir)= @_; - # Remove the ndb_*_fs directory from ndbd.X/ dir - foreach my $ndbfs_dir ( glob("$ndbd_datadir/ndb_*_fs") ) - { - next unless -d $ndbfs_dir; # Skip if not a directory - rmtree($ndbfs_dir); - } -} - - sub after_failure ($) { my ($tinfo)= @_; @@ -4417,31 +4590,18 @@ sub after_failure ($) { mkpath($save_dir) if ! -d $save_dir; - # Save the used my.cnf file - copy($path_config_file, $save_dir); + # Save the used config files + my %config_files = config_files($tinfo); + while (my ($file, $generate) = each %config_files) { + copy("$opt_vardir/$file", $save_dir); + } # Copy the tmp dir copytree("$opt_vardir/tmp/", "$save_dir/tmp/"); - if ( clusters() ) { - foreach my $cluster ( clusters() ) { - my $cluster_dir= "$opt_vardir/".$cluster->{name}; - - # Remove the fileystem of each ndbd - foreach my $ndbd ( in_cluster($cluster, ndbds()) ) - { - my $ndbd_datadir= $ndbd->value("DataDir"); - remove_ndbfs_from_ndbd_datadir($ndbd_datadir); - } - - save_datadir_after_failure($cluster_dir, $save_dir); - } - } - else { - foreach my $mysqld ( mysqlds() ) { - my $data_dir= $mysqld->value('datadir'); - save_datadir_after_failure(dirname($data_dir), $save_dir); - } + foreach (all_servers()) { + my $dir= "$opt_vardir/".$_->{name}; + save_datadir_after_failure($dir, $save_dir); } } @@ -4540,7 +4700,7 @@ sub mysqld_stop { name => "mysqladmin shutdown ".$mysqld->name(), path => $exe_mysqladmin, args => \$args, - error => "/dev/null", + error => "$opt_vardir/log/mysqladmin.err", ); } @@ -4579,8 +4739,8 @@ sub mysqld_arguments ($$$) { mtr_add_arg($args, "%s--log-output=table,file"); } - # Check if "extra_opt" contains skip-log-bin - my $skip_binlog= grep(/^(--|--loose-)skip-log-bin/, @$extra_opts); + # Check if "extra_opt" contains --log-bin + my $skip_binlog= not grep /^--(loose-)?log-bin/, @$extra_opts; # Indicate to mysqld it will be debugged in debugger if ( $glob_debugger ) @@ -4836,8 +4996,7 @@ sub server_need_restart { return 1; } - my $is_mysqld= grep ($server eq $_, mysqlds()); - if ($is_mysqld) + if ($server->name() =~ /^mysqld\./) { # Check that running process was started with same options @@ -4889,17 +5048,9 @@ sub servers_need_restart($) { -# -# Return list of specific servers -# - there is no servers in an empty config -# -sub _like { return $config ? $config->like($_[0]) : (); } -sub mysqlds { return _like('mysqld.'); } -sub ndbds { return _like('cluster_config.ndbd.');} -sub ndb_mgmds { return _like('cluster_config.ndb_mgmd.'); } -sub clusters { return _like('mysql_cluster.'); } -sub all_servers { return ( mysqlds(), ndb_mgmds(), ndbds() ); } +############################################ +############################################ # # Filter a list of servers and return only those that are part @@ -4921,18 +5072,6 @@ sub started { return grep(defined $_, ma sub stopped { return grep(!defined $_, map($_->{proc}, @_)); } -sub envsubst { - my $string= shift; - - if ( ! defined $ENV{$string} ) - { - mtr_error(".opt file references '$string' which is not set"); - } - - return $ENV{$string}; -} - - sub get_extra_opts { my ($mysqld, $tinfo)= @_; @@ -4943,8 +5082,9 @@ sub get_extra_opts { # Expand environment variables foreach my $opt ( @$opts ) { - $opt =~ s/\$\{(\w+)\}/envsubst($1)/ge; - $opt =~ s/\$(\w+)/envsubst($1)/ge; + no warnings 'uninitialized'; + $opt =~ s/\$\{(\w+)\}/$ENV{$1}/ge; + $opt =~ s/\$(\w+)/$ENV{$1}/ge; } return $opts; } @@ -4953,28 +5093,10 @@ sub get_extra_opts { sub stop_servers($$) { my (@servers)= @_; - if ( join('|', @servers) eq join('|', all_servers()) ) - { - # All servers are going down, use some kind of order to - # avoid too many warnings in the log files - - mtr_report("Restarting all servers"); - - # mysqld processes - My::SafeProcess::shutdown( $opt_shutdown_timeout, started(mysqlds()) ); - - # cluster processes - My::SafeProcess::shutdown( $opt_shutdown_timeout, - started(ndbds(), ndb_mgmds()) ); - } - else - { - mtr_report("Restarting ", started(@servers)); + mtr_report("Restarting ", started(@servers)); - # Stop only some servers - My::SafeProcess::shutdown( $opt_shutdown_timeout, - started(@servers) ); - } + My::SafeProcess::shutdown($opt_shutdown_timeout, + started(@servers)); foreach my $server (@servers) { @@ -5001,145 +5123,14 @@ sub stop_servers($$) { sub start_servers($) { my ($tinfo)= @_; - # Start clusters - foreach my $cluster ( clusters() ) - { - ndbcluster_start($cluster); + for (all_servers()) { + $_->{START}->($_, $tinfo) if $_->{START}; } - # Start mysqlds - foreach my $mysqld ( mysqlds() ) - { - if ( $mysqld->{proc} ) - { - # Already started - - # Write start of testcase to log file - mark_log($mysqld->value('#log-error'), $tinfo); - - next; - } - - my $datadir= $mysqld->value('datadir'); - if ($opt_start_dirty) - { - # Don't delete anything if starting dirty - ; - } - else - { - - my @options= ('log-bin', 'relay-log'); - foreach my $option_name ( @options ) { - next unless $mysqld->option($option_name); - - my $file_name= $mysqld->value($option_name); - next unless - defined $file_name and - -e $file_name; - - mtr_debug(" -removing '$file_name'"); - unlink($file_name) or die ("unable to remove file '$file_name'"); - } - - if (-d $datadir ) { - preserve_error_log($mysqld); - mtr_verbose(" - removing '$datadir'"); - rmtree($datadir); - } - } - - my $mysqld_basedir= $mysqld->value('basedir'); - if ( $basedir eq $mysqld_basedir ) - { - if (! $opt_start_dirty) # If dirty, keep possibly grown system db - { - # Copy datadir from installed system db - for my $path ( "$opt_vardir", "$opt_vardir/..") { - my $install_db= "$path/install.db"; - copytree($install_db, $datadir) - if -d $install_db; - } - mtr_error("Failed to copy system db to '$datadir'") - unless -d $datadir; - } - } - else - { - mysql_install_db($mysqld); # For versional testing - - mtr_error("Failed to install system db to '$datadir'") - unless -d $datadir; - - } - restore_error_log($mysqld); - - # Create the servers tmpdir - my $tmpdir= $mysqld->value('tmpdir'); - mkpath($tmpdir) unless -d $tmpdir; - - # Write start of testcase to log file - mark_log($mysqld->value('#log-error'), $tinfo); - - # Run <tname>-master.sh - if ($mysqld->option('#!run-master-sh') and - run_sh_script($tinfo->{master_sh}) ) - { - $tinfo->{'comment'}= "Failed to execute '$tinfo->{master_sh}'"; - return 1; - } - - # Run <tname>-slave.sh - if ($mysqld->option('#!run-slave-sh') and - run_sh_script($tinfo->{slave_sh})) - { - $tinfo->{'comment'}= "Failed to execute '$tinfo->{slave_sh}'"; - return 1; - } - - if (!$opt_embedded_server) - { - my $extra_opts= get_extra_opts($mysqld, $tinfo); - mysqld_start($mysqld,$extra_opts); - - # Save this test case information, so next can examine it - $mysqld->{'started_tinfo'}= $tinfo; - } - - } - - # Wait for clusters to start - foreach my $cluster ( clusters() ) - { - if (ndbcluster_wait_started($cluster, "")) - { - # failed to start - $tinfo->{'comment'}= "Start of '".$cluster->name()."' cluster failed"; - return 1; - } - } - - # Wait for mysqlds to start - foreach my $mysqld ( mysqlds() ) - { - next if !started($mysqld); - - if (sleep_until_file_created($mysqld->value('pid-file'), - $opt_start_timeout, - $mysqld->{'proc'}) == 0) { - $tinfo->{comment}= - "Failed to start ".$mysqld->name(); - - my $logfile= $mysqld->value('#log-error'); - if ( defined $logfile and -f $logfile ) - { - my @srv_lines= extract_server_log($logfile, $tinfo->{name}); - $tinfo->{logfile}= "Server log is:\n" . join ("", @srv_lines); - } - else - { - $tinfo->{logfile}= "Could not open server logfile: '$logfile'"; - } + for (all_servers()) { + next unless $_->{WAIT} and started($_); + if ($_->{WAIT}->($_)) { + $tinfo->{comment}= "Failed to start ".$_->name(); return 1; } } @@ -5401,13 +5392,7 @@ sub gdb_arguments { else { # write init file for mysqld - mtr_tofile($gdb_init_file, - "set args $str\n" . - "break mysql_parse\n" . - "commands 1\n" . - "disable 1\n" . - "end\n" . - "run"); + mtr_tofile($gdb_init_file, "set args $str\n"); } if ( $opt_manual_gdb ) @@ -5465,13 +5450,7 @@ sub ddd_arguments { else { # write init file for mysqld - mtr_tofile($gdb_init_file, - "file $$exe\n" . - "set args $str\n" . - "break mysql_parse\n" . - "commands 1\n" . - "disable 1\n" . - "end"); + mtr_tofile($gdb_init_file, "file $$exe\nset args $str\n"); } if ( $opt_manual_ddd ) @@ -5853,3 +5832,25 @@ sub list_options ($) { exit(1); } + +sub time_format($) { + sprintf '%d:%02d:%02d', $_[0]/3600, ($_[0]/60)%60, $_[0]%60; +} + +my $num_tests; + +sub xterm_stat { + if (-t STDOUT and $ENV{TERM} =~ /xterm/) { + my ($left) = @_; + + # 2.5 -> best by test + $num_tests = $left + 2.5 unless $num_tests; + + my $done = $num_tests - $left; + my $spent = time - $^T; + + printf "\e];mtr: spent %s on %d tests. %s (%d tests) left\a", + time_format($spent), $done, + time_format($spent/$done * $left), $left; + } +} === modified file 'mysql-test/r/commit_1innodb.result' --- a/mysql-test/r/commit_1innodb.result 2009-08-26 23:13:03 +0000 +++ b/mysql-test/r/commit_1innodb.result 2010-07-20 17:36:15 +0000 @@ -841,11 +841,11 @@ call p_verify_status_increment(2, 0, 2, SUCCESS alter table t3 rename t4; -call p_verify_status_increment(2, 2, 2, 2); +call p_verify_status_increment(1, 0, 1, 0); SUCCESS rename table t4 to t3; -call p_verify_status_increment(2, 2, 2, 2); +call p_verify_status_increment(1, 0, 1, 0); SUCCESS truncate table t3; === removed file 'mysql-test/r/exampledb.result' --- a/mysql-test/r/exampledb.result 2006-05-05 17:08:40 +0000 +++ b/mysql-test/r/exampledb.result 1970-01-01 00:00:00 +0000 @@ -1,8 +0,0 @@ -drop database if exists events_test; -drop database if exists events_test2; -drop table if exists t1; -CREATE TABLE t1 ( -Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, -Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL -) ENGINE=example; -drop table t1; === modified file 'mysql-test/r/func_gconcat.result' --- a/mysql-test/r/func_gconcat.result 2010-03-31 13:00:56 +0000 +++ b/mysql-test/r/func_gconcat.result 2010-07-23 11:52:54 +0000 @@ -995,6 +995,7 @@ SELECT 1 FROM 1 1 DROP TABLE t1; +End of 5.0 tests # # Bug #52397: another crash with explain extended and group_concat # @@ -1010,4 +1011,22 @@ id select_type table type possible_keys Warnings: Note 1003 select 1 AS `1` from (select group_concat(`test`.`t1`.`a` order by `test`.`t1`.`a` ASC separator ',') AS `GROUP_CONCAT(t1.a ORDER BY t1.a ASC)` from `test`.`t1` `t2` join `test`.`t1` group by `test`.`t1`.`a`) `d` DROP TABLE t1; -End of 5.0 tests +# +# Bug #54476: crash when group_concat and 'with rollup' in prepared statements +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); +PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP"; +EXECUTE stmt; +GROUP_CONCAT(t1.a ORDER BY t1.a) +1,1 +2,2 +1,1,2,2 +EXECUTE stmt; +GROUP_CONCAT(t1.a ORDER BY t1.a) +1,1 +2,2 +1,1,2,2 +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +End of 5.1 tests === modified file 'mysql-test/r/func_misc.result' --- a/mysql-test/r/func_misc.result 2010-01-11 13:15:28 +0000 +++ b/mysql-test/r/func_misc.result 2010-08-27 14:12:44 +0000 @@ -243,4 +243,19 @@ End of 5.0 tests select connection_id() > 0; connection_id() > 0 1 +# +# Bug #54461: crash with longblob and union or update with subquery +# +CREATE TABLE t1 (a INT, b LONGBLOB); +INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2'); +SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; +LEAST(a, (SELECT b FROM t1 LIMIT 1)) +1 +2 +SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; +GREATEST(a, (SELECT b FROM t1 LIMIT 1)) +2 +3 +1 +DROP TABLE t1; End of tests === modified file 'mysql-test/r/group_by.result' --- a/mysql-test/r/group_by.result 2010-05-12 16:10:33 +0000 +++ b/mysql-test/r/group_by.result 2010-08-27 14:12:44 +0000 @@ -1809,5 +1809,57 @@ SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON MAX(t2.a) 2 DROP TABLE t1, t2; +CREATE TABLE t1 (a int(11) NOT NULL); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 ( +key_col int(11) NOT NULL, +KEY (key_col) +); +INSERT INTO t2 VALUES (1),(2); +select min(t2.key_col) from t1,t2 where t1.a=1; +min(t2.key_col) +1 +select min(t2.key_col) from t1,t2 where t1.a > 1000; +min(t2.key_col) +NULL +select min(t2.key_col)+1 from t1,t2 where t1.a> 1000; +min(t2.key_col)+1 +NULL +drop table t1,t2; # +# Bug#55188: GROUP BY, GROUP_CONCAT and TEXT - inconsistent results +# +CREATE TABLE t1 (a text, b varchar(10)); +INSERT INTO t1 VALUES (repeat('1', 1300),'one'), (repeat('1', 1300),'two'); +EXPLAIN +SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a; +id 1 +select_type SIMPLE +table t1 +type ALL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows 2 +Extra Using filesort +SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a; +SUBSTRING(a,1,10) LENGTH(a) GROUP_CONCAT(b) +1111111111 1300 one,two +EXPLAIN +SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a; +id 1 +select_type SIMPLE +table t1 +type ALL +possible_keys NULL +key NULL +key_len NULL +ref NULL +rows 2 +Extra Using temporary; Using filesort +SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a; +SUBSTRING(a,1,10) LENGTH(a) +1111111111 1300 +DROP TABLE t1; # End of 5.1 tests === modified file 'mysql-test/r/having.result' --- a/mysql-test/r/having.result 2010-05-26 18:55:40 +0000 +++ b/mysql-test/r/having.result 2010-08-27 14:12:44 +0000 @@ -470,10 +470,9 @@ WHERE table2.f1 = 2 GROUP BY table1.f1, table2.f2 HAVING (table2.f2 = 8 AND table1.f1 >= 6); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort -1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables Warnings: -Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having (('7' = 8) and (`test`.`table1`.`f1` >= 6)) +Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having 0 EXPLAIN EXTENDED SELECT table1.f1, table2.f2 FROM t1 AS table1 @@ -482,10 +481,9 @@ WHERE table2.f1 = 2 GROUP BY table1.f1, table2.f2 HAVING (table2.f2 = 8); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort -1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables Warnings: -Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having ('7' = 8) +Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having 0 DROP TABLE t1; # # Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355 @@ -532,3 +530,19 @@ MAX(t2.f2) NULL DROP TABLE t1,t2; End of 5.0 tests +# +# Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set +# +CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (1,'f'); +CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1)); +INSERT INTO t2 VALUES (2,'m'); +INSERT INTO t2 VALUES (3,'m'); +INSERT INTO t2 VALUES (11,NULL); +INSERT INTO t2 VALUES (12,'k'); +SELECT MAX(t1.f1) field1 +FROM t1 JOIN t2 ON t2.f2 LIKE 'x' +HAVING field1 < 7; +field1 +DROP TABLE t1,t2; +End of 5.1 tests === modified file 'mysql-test/r/information_schema.result' --- a/mysql-test/r/information_schema.result 2010-08-02 09:01:24 +0000 +++ b/mysql-test/r/information_schema.result 2010-08-27 14:12:44 +0000 @@ -1651,4 +1651,21 @@ WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_N COLUMN_DEFAULT TABLE_NAME NULL variables DROP TABLE variables; +# +# Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19, +# should be 20 +# +CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED); +SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION +FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig'; +TABLE_NAME COLUMN_NAME NUMERIC_PRECISION +ubig a 19 +ubig b 20 +INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +SELECT length(CAST(b AS CHAR)) FROM ubig; +length(CAST(b AS CHAR)) +20 +DROP TABLE ubig; End of 5.1 tests. === modified file 'mysql-test/r/loaddata.result' --- a/mysql-test/r/loaddata.result 2010-06-09 08:29:27 +0000 +++ b/mysql-test/r/loaddata.result 2010-07-14 11:54:51 +0000 @@ -503,4 +503,33 @@ DROP TABLE t1; CREATE TABLE t1 (id INT NOT NULL); LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1; DROP TABLE t1; +# +# Bug #51876 : crash/memory underrun when loading data with ucs2 +# and reverse() function +# +# Problem # 1 (original report): wrong parsing of ucs2 data +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +Warnings: +Warning 1366 Incorrect integer value: '00' for column 'a' at row 1 +Warning 1366 Incorrect integer value: '10' for column 'a' at row 2 +# should return 2 zeroes (as the value is truncated) +SELECT * FROM t1; +a +0 +0 +DROP TABLE t1; +# Problem # 2 : if you write and read ucs2 data to a file they're lost +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +# should return 0 and 1 (10 reversed) +SELECT * FROM t1; +a +0 +1 +DROP TABLE t1; End of 5.1 tests === modified file 'mysql-test/r/lowercase_table2.result' --- a/mysql-test/r/lowercase_table2.result 2006-06-14 05:54:56 +0000 +++ b/mysql-test/r/lowercase_table2.result 2010-07-21 15:05:57 +0000 @@ -56,6 +56,7 @@ CREATE DATABASE `TEST_$1`; SHOW DATABASES LIKE "TEST%"; Database (TEST%) TEST_$1 +test DROP DATABASE `test_$1`; CREATE TABLE T1 (a int) engine=innodb; INSERT INTO T1 VALUES (1); @@ -171,6 +172,6 @@ create table myUC (i int); select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES where TABLE_SCHEMA ='mysqltest_LC2'; TABLE_SCHEMA TABLE_NAME -mysqltest_LC2 myUC +mysqltest_lc2 myUC use test; drop database mysqltest_LC2; === modified file 'mysql-test/r/lowercase_view.result' --- a/mysql-test/r/lowercase_view.result 2007-11-13 17:32:12 +0000 +++ b/mysql-test/r/lowercase_view.result 2010-06-25 12:59:44 +0000 @@ -148,3 +148,20 @@ a DROP VIEW v1; DROP TABLE t1; End of 5.0 tests. +# +# Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS +# returns nothing +# +CREATE TABLE `ttt` ( +`f1` char(3) NOT NULL, +PRIMARY KEY (`f1`) +) ENGINE=myisam DEFAULT CHARSET=latin1; +SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = +'TTT'; +count(COLUMN_NAME) +1 +SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT'; +count(*) +1 +DROP TABLE `ttt`; +End of 5.0 tests. === modified file 'mysql-test/r/mysql_client_test.result' --- a/mysql-test/r/mysql_client_test.result 2008-11-13 19:19:00 +0000 +++ b/mysql-test/r/mysql_client_test.result 2010-07-30 12:17:10 +0000 @@ -1,3 +1,5 @@ SET @old_general_log= @@global.general_log; +SET @old_slow_query_log= @@global.slow_query_log; ok SET @@global.general_log= @old_general_log; +SET @@global.slow_query_log= @old_slow_query_log; === modified file 'mysql-test/r/mysql_upgrade.result' --- a/mysql-test/r/mysql_upgrade.result 2009-12-04 16:00:20 +0000 +++ b/mysql-test/r/mysql_upgrade.result 2010-07-01 09:05:09 +0000 @@ -169,3 +169,45 @@ DROP PROCEDURE testproc; WARNING: NULL values of the 'character_set_client' column ('mysql.proc' table) have been updated with a default value (latin1). Please verify if necessary. WARNING: NULL values of the 'collation_connection' column ('mysql.proc' table) have been updated with a default value (latin1_swedish_ci). Please verify if necessary. WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been updated with default values. Please verify if necessary. +# +# Bug #53613: mysql_upgrade incorrectly revokes +# TRIGGER privilege on given table +# +GRANT USAGE ON *.* TO 'user3'@'%'; +GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'; +Run mysql_upgrade with all privileges on a user +mtr.global_suppressions OK +mtr.test_suppressions OK +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.general_log +Error : You can't use locks with log tables. +status : OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.host OK +mysql.ndb_binlog_index OK +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.servers OK +mysql.slow_log +Error : You can't use locks with log tables. +status : 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.user OK +SHOW GRANTS FOR 'user3'@'%'; +Grants for user3@% +GRANT USAGE ON *.* TO 'user3'@'%' +GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%' +DROP USER 'user3'@'%'; +End of 5.1 tests === modified file 'mysql-test/r/subselect4.result' --- a/mysql-test/r/subselect4.result 2009-09-28 13:48:40 +0000 +++ b/mysql-test/r/subselect4.result 2010-08-23 09:46:25 +0000 @@ -59,3 +59,26 @@ FROM t3 WHERE 1 = 0 GROUP BY 1; (SELECT 1 FROM t1,t2 WHERE t2.b > t3.b) DROP TABLE t1,t2,t3; End of 5.0 tests. +CREATE TABLE t1 (col_int_nokey int(11) NOT NULL, col_varchar_nokey varchar(1) NOT NULL) engine=myisam; +INSERT INTO t1 VALUES (2,'s'),(0,'v'),(2,'s'); +CREATE TABLE t2 ( +pk int(11) NOT NULL AUTO_INCREMENT, +`col_int_key` int(11) NOT NULL, +col_varchar_key varchar(1) NOT NULL, +PRIMARY KEY (pk), +KEY `col_int_key` (`col_int_key`), +KEY `col_varchar_key` (`col_varchar_key`) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (4,10,'g'), (5,20,'v'); +SELECT t1.col_int_nokey,(SELECT MIN( t2_a.col_int_key ) FROM t2 t2_a, t2 t2_b, t1 t1_a WHERE t1_a.col_varchar_nokey = t2_b.col_varchar_key and t1.col_int_nokey ) as sub FROM t1; +col_int_nokey sub +2 10 +0 NULL +2 10 +SELECT t1.col_int_nokey,(SELECT MIN( t2_a.col_int_key ) +1 FROM t2 t2_a, t2 t2_b, t1 t1_a WHERE t1_a.col_varchar_nokey = t2_b.col_varchar_key and t1.col_int_nokey ) as sub FROM t1; +col_int_nokey sub +2 11 +0 NULL +2 11 +DROP TABLE t1,t2; +End of 5.1 tests. === modified file 'mysql-test/r/update.result' --- a/mysql-test/r/update.result 2010-03-10 16:10:05 +0000 +++ b/mysql-test/r/update.result 2010-07-19 09:03:52 +0000 @@ -527,3 +527,17 @@ ERROR HY000: You are using safe update m SET SESSION sql_safe_updates = DEFAULT; DROP TABLE t1; DROP VIEW v1; +# +# Bug#54734 assert in Diagnostics_area::set_ok_status +# +DROP TABLE IF EXISTS t1, not_exists; +DROP FUNCTION IF EXISTS f1; +DROP VIEW IF EXISTS v1; +CREATE TABLE t1 (PRIMARY KEY(pk)) AS SELECT 1 AS pk; +CREATE FUNCTION f1() RETURNS INTEGER RETURN (SELECT 1 FROM not_exists); +CREATE VIEW v1 AS SELECT pk FROM t1 WHERE f1() = 13; +UPDATE v1 SET pk = 7 WHERE pk > 0; +ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +DROP VIEW v1; +DROP FUNCTION f1; +DROP TABLE t1; === modified file 'mysql-test/r/warnings_engine_disabled.result' --- a/mysql-test/r/warnings_engine_disabled.result 2008-12-17 15:45:34 +0000 +++ b/mysql-test/r/warnings_engine_disabled.result 2010-08-17 07:14:46 +0000 @@ -1,15 +1,14 @@ -create table t1 (id int) engine=NDB; +create table t1 (id int) engine=InnoDB; Warnings: -Warning 1286 Unknown table engine 'NDB' +Warning 1286 Unknown table engine 'InnoDB' Warning 1266 Using storage engine MyISAM for table 't1' -alter table t1 engine=NDB; +alter table t1 engine=InnoDB; Warnings: -Warning 1286 Unknown table engine 'NDB' +Warning 1286 Unknown table engine 'InnoDB' drop table t1; -SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ndbcluster'; +SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='InnoDB'; ENGINE SUPPORT -ndbcluster NO -SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE -PLUGIN_NAME='ndbcluster'; +InnoDB NO +SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='InnoDB'; PLUGIN_NAME PLUGIN_STATUS -ndbcluster DISABLED +InnoDB DISABLED === modified file 'mysql-test/std_data/server8k-cert.pem' --- a/mysql-test/std_data/server8k-cert.pem 2010-03-04 08:03:07 +0000 +++ b/mysql-test/std_data/server8k-cert.pem 2010-08-27 14:12:44 +0000 @@ -1,125 +1,51 @@ -Certificate: - Data: - Version: 1 (0x0) - Serial Number: 1048579 (0x100003) - Signature Algorithm: md5WithRSAEncryption - Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB - Validity - Not Before: Jan 29 12:01:53 2010 GMT - Not After : Jan 28 12:01:53 2015 GMT - Subject: C=SE, ST=Uppsala, O=MySQL AB, CN=server - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - Public-Key: (8192 bit) - Modulus: - 00:ca:aa:1d:c4:11:ec:91:f0:c7:ff:5f:90:92:fc: - 40:0c:5e:b7:3d:00:c5:20:d5:0f:89:31:07:d7:41: - 4c:8b:60:80:aa:38:14:de:93:6b:9c:74:88:41:68: - b5:02:41:01:2d:86:a2:7a:95:53:5e:7b:67:2f:6c: - 1e:29:51:f9:44:fd:4a:80:be:b2:23:a1:3e:1b:38: - cf:88:c4:71:ee:f8:6b:41:c5:2d:c0:c3:52:ac:59: - 7d:81:34:19:95:32:b8:9a:51:b6:41:36:d4:c4:a1: - ae:84:e6:38:b9:e8:bf:96:be:19:7a:6b:77:4d:e0: - de:e6:b3:b6:6b:bc:3d:dd:68:bc:4b:c4:eb:f5:36: - 93:ed:56:a2:15:50:8a:10:e8:d6:22:ed:6c:b1:cd: - c3:18:c9:f6:0a:e1:de:61:65:62:d6:14:41:8c:b5: - fb:14:68:c1:cf:12:5d:41:21:9d:57:11:43:7d:bb: - 43:2c:21:bb:c3:44:7d:a8:cf:1f:c3:71:75:b5:47: - c2:7d:ce:38:3c:73:64:9e:15:d8:a7:27:cf:bd:40: - c8:45:08:e3:c8:39:a8:0b:8e:c2:5b:7b:f1:47:91: - 12:91:cc:e1:00:e0:94:5b:bd:32:e4:0c:8d:c3:be: - cc:76:32:52:12:69:b0:18:e0:b0:c2:76:34:5a:5f: - 79:d9:f6:81:9d:02:0a:61:69:1c:33:ce:49:fa:76: - 03:1e:07:5b:27:0b:bf:34:9e:34:96:b8:03:9b:50: - 3a:6a:2f:17:7a:14:cf:65:63:00:37:52:a8:73:ce: - 4b:14:40:f4:d2:9a:56:54:33:b8:77:2e:42:5b:8f: - ec:1f:18:f4:ad:ab:8a:4a:8d:6d:70:25:f3:58:e7: - cb:66:51:14:7d:16:f4:eb:6d:56:76:76:51:6e:d6: - 1d:da:d3:8d:c0:64:5a:67:4e:af:e2:bf:33:d1:b8: - f6:2a:fc:57:87:a7:35:5e:80:c9:ac:fc:87:c9:71: - 17:91:bf:b7:4d:a3:ed:3c:1b:27:f4:66:a0:f9:46: - 03:27:cc:ea:80:f6:4b:40:f6:41:94:cd:bd:0a:b3: - ef:26:be:de:6f:69:ae:0f:3f:1c:55:63:33:90:9b: - ed:ca:5a:12:4d:de:4b:06:c2:a2:92:b0:42:3d:31: - af:a4:15:12:15:f8:8a:e9:88:8d:cf:fd:85:66:50: - 6f:11:f1:9f:48:f3:b5:ba:9d:86:68:24:a2:5d:a8: - 7c:54:42:fa:d8:b5:c5:f2:dd:0e:0f:d0:68:e4:54: - 7e:c5:b9:a0:9b:65:2d:77:f4:8f:b9:30:0a:d5:86: - 5c:ed:c9:7c:d1:da:9d:0d:63:50:ee:e5:1e:92:63: - cc:a2:0c:e8:4a:96:02:4d:dc:8f:df:7c:8f:08:18: - a8:30:88:d7:af:89:ad:fc:57:4b:10:f9:f1:cb:48: - e8:b6:3b:c8:3f:fc:c2:d3:d1:4a:10:3c:1b:6b:64: - dc:e5:65:1e:5b:b2:da:b1:e2:24:97:8f:ee:c0:4b: - 8e:18:83:7c:17:a6:3c:45:b3:60:06:23:f2:2f:18: - 13:9e:17:8a:c6:72:79:8c:4d:04:f3:9d:ea:e0:25: - d3:33:8c:1e:11:47:63:1f:a5:45:3f:bd:85:b3:fe: - a5:68:ee:48:b7:0c:a4:c9:7f:72:d0:75:66:9b:6a: - f9:a0:50:f3:a8:59:6d:a3:dd:38:4f:70:2b:bb:ff: - 92:2e:71:ab:ef:e9:00:ed:0d:d1:b4:6f:f0:8e:b2: - 09:fb:4d:61:0d:d9:10:d5:54:11:cd:03:94:84:fd: - a8:68:e4:45:6e:1e:6a:1e:2f:85:a1:6d:f5:b6:c0: - f1:ee:f7:36:e9:fe:c2:f7:ad:cc:13:46:5b:88:42: - f0:2d:1f:b5:0e:7e:b5:2b:e4:8d:ab:b9:87:30:6a: - 3d:12:f4:ad:f3:1c:ac:cc:1a:48:29:2a:96:7b:80: - 00:0b:6e:59:87:bf:a3:ca:70:99:1b:1c:fd:72:3d: - b2:d3:94:4a:cf:55:75:be:1f:40:ec:55:35:48:2d: - 55:f0:00:da:3c:b0:60:ba:11:32:66:54:0b:be:06: - a4:5e:b7:c9:59:bb:4d:f4:92:06:26:48:6e:c2:12: - d4:7c:f0:20:b8:a2:e1:bc:6a:b6:19:0e:37:47:55: - c9:f2:49:0d:96:75:a2:84:64:bf:34:fc:be:b2:41: - e4:f5:88:eb:e1:b7:26:a5:e5:41:c2:20:0c:f6:e2: - a8:a5:e7:76:54:a5:fb:4b:80:05:7d:18:85:7a:ba: - bc:b7:ad:c0:2f:60:85:cc:15:12:1c:2f:0a:9e:f3: - 7c:40:cf:f4:3e:23:d2:95:ca:d0:06:58:52:f0:84: - d8:0f:3d:eb:ff:12:68:94:79:8f:be:40:29:5f:98: - c8:90:6c:05:2f:99:8c:2a:63:78:1f:23:b1:29:c5: - e7:49:c9:b2:92:0f:53:0b:d5:71:28:17:c2:19:bf: - 60:bf:7c:87:a8:ab:c1:f4:0a:c1:b8:d2:68:ee:c1: - ce:a7:13:13:17:6d:24:5d:a2:37:a6:d7:7d:48:8b: - 2b:74:2d:40:2e:ca:19:d5:b6:3e:6c:42:71:fa:cf: - 85:87:f9:de:80:73:8b:89:f4:70:f0:d8:d7:ff:40: - 41:9c:c7:15:6d:9b:6e:4c:b5:52:02:99:79:32:73: - ca:26:a0:ac:31:6f:c4:b0:f5:da:bb:c2:1f:e0:9f: - 44:ba:25:f7:9f - Exponent: 65537 (0x10001) - Signature Algorithm: md5WithRSAEncryption - 08:75:dc:b9:3f:aa:b6:7e:81:7a:39:d1:ee:ed:44:b6:ce:1b: - 37:c4:4c:19:d0:66:e6:eb:b5:4f:2a:ef:95:58:64:21:55:01: - 12:30:ac:8a:95:d1:06:de:29:46:a4:f1:7d:7f:b0:1e:d2:4e: - fb:f6:fa:9a:74:be:85:62:db:0b:82:90:58:62:c5:5f:f1:80: - 02:9f:c5:fb:f3:6b:b0:b4:3b:04:b1:e5:53:c2:d0:00:a1:1a: - 9d:65:60:6f:73:98:67:e0:9c:c8:12:94:79:59:bf:43:7b:f5: - 77:c8:8f:df:b1:cd:11:1c:01:19:99:c2:22:42:f7:41:ae:b4: - b8:1a -----BEGIN CERTIFICATE----- -MIIFfDCCBOUCAxAAAzANBgkqhkiG9w0BAQQFADBEMQswCQYDVQQGEwJTRTEQMA4G -A1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwg -QUIwHhcNMTAwMTI5MTIwMTUzWhcNMTUwMTI4MTIwMTUzWjBDMQswCQYDVQQGEwJT -RTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIxDzANBgNVBAMT -BnNlcnZlcjCCBCIwDQYJKoZIhvcNAQEBBQADggQPADCCBAoCggQBAMqqHcQR7JHw -x/9fkJL8QAxetz0AxSDVD4kxB9dBTItggKo4FN6Ta5x0iEFotQJBAS2GonqVU157 -Zy9sHilR+UT9SoC+siOhPhs4z4jEce74a0HFLcDDUqxZfYE0GZUyuJpRtkE21MSh -roTmOLnov5a+GXprd03g3uaztmu8Pd1ovEvE6/U2k+1WohVQihDo1iLtbLHNwxjJ -9grh3mFlYtYUQYy1+xRowc8SXUEhnVcRQ327Qywhu8NEfajPH8NxdbVHwn3OODxz -ZJ4V2Kcnz71AyEUI48g5qAuOwlt78UeREpHM4QDglFu9MuQMjcO+zHYyUhJpsBjg -sMJ2NFpfedn2gZ0CCmFpHDPOSfp2Ax4HWycLvzSeNJa4A5tQOmovF3oUz2VjADdS -qHPOSxRA9NKaVlQzuHcuQluP7B8Y9K2rikqNbXAl81jny2ZRFH0W9OttVnZ2UW7W -HdrTjcBkWmdOr+K/M9G49ir8V4enNV6Ayaz8h8lxF5G/t02j7TwbJ/RmoPlGAyfM -6oD2S0D2QZTNvQqz7ya+3m9prg8/HFVjM5Cb7cpaEk3eSwbCopKwQj0xr6QVEhX4 -iumIjc/9hWZQbxHxn0jztbqdhmgkol2ofFRC+ti1xfLdDg/QaORUfsW5oJtlLXf0 -j7kwCtWGXO3JfNHanQ1jUO7lHpJjzKIM6EqWAk3cj998jwgYqDCI16+JrfxXSxD5 -8ctI6LY7yD/8wtPRShA8G2tk3OVlHluy2rHiJJeP7sBLjhiDfBemPEWzYAYj8i8Y -E54XisZyeYxNBPOd6uAl0zOMHhFHYx+lRT+9hbP+pWjuSLcMpMl/ctB1Zptq+aBQ -86hZbaPdOE9wK7v/ki5xq+/pAO0N0bRv8I6yCftNYQ3ZENVUEc0DlIT9qGjkRW4e -ah4vhaFt9bbA8e73Nun+wvetzBNGW4hC8C0ftQ5+tSvkjau5hzBqPRL0rfMcrMwa -SCkqlnuAAAtuWYe/o8pwmRsc/XI9stOUSs9Vdb4fQOxVNUgtVfAA2jywYLoRMmZU -C74GpF63yVm7TfSSBiZIbsIS1HzwILii4bxqthkON0dVyfJJDZZ1ooRkvzT8vrJB -5PWI6+G3JqXlQcIgDPbiqKXndlSl+0uABX0YhXq6vLetwC9ghcwVEhwvCp7zfEDP -9D4j0pXK0AZYUvCE2A896/8SaJR5j75AKV+YyJBsBS+ZjCpjeB8jsSnF50nJspIP -UwvVcSgXwhm/YL98h6irwfQKwbjSaO7BzqcTExdtJF2iN6bXfUiLK3QtQC7KGdW2 -PmxCcfrPhYf53oBzi4n0cPDY1/9AQZzHFW2bbky1UgKZeTJzyiagrDFvxLD12rvC -H+CfRLol958CAwEAATANBgkqhkiG9w0BAQQFAAOBgQAIddy5P6q2foF6OdHu7US2 -zhs3xEwZ0Gbm67VPKu+VWGQhVQESMKyKldEG3ilGpPF9f7Ae0k779vqadL6FYtsL -gpBYYsVf8YACn8X782uwtDsEseVTwtAAoRqdZWBvc5hn4JzIEpR5Wb9De/V3yI/f -sc0RHAEZmcIiQvdBrrS4Gg== +MIIJFDCCBPwCAQEwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCU0UxEDAOBgNV +BAgTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMQ0wCwYDVQQLEwRUZXN0MQsw +CQYDVQQDEwJDQTAeFw0xMDA3MjgxNDA3MjhaFw0xODEwMTQxNDA3MjhaMFIxCzAJ +BgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMREwDwYDVQQKEwhNeVNRTCBBQjEN +MAsGA1UECxMEVGVzdDEPMA0GA1UEAxMGc2VydmVyMIIEIjANBgkqhkiG9w0BAQEF +AAOCBA8AMIIECgKCBAEA6h3v1OWb9I9U/Z8diBu/xYGS8NCTD3ZESboHxVI2qSEC +PgxNNcG8Lh0ktQdgYcOe64MnDTZX0Bibm47hoDldrAlTSffFxQhylqBBoXxDF+Lr +hXIqCz7K0PsK+bYusL9ezJ7PETDnCT7oy95q4GXbKsutbNsm9if4ZE41gs2KnoU2 +DA7kvMmkKojrMIL4+BqTXA20LLo0iSbgvUTvpSJw4u96BeyzMNnxK2wP5vvTtUo5 +hACbfU87YjaSKs+q2VXCzfyYGZk1L1xk5GUI0bP+jutf1dDzNttW2/q2Nf5rxx09 +Gh/GwmOnEk1O7cOZ8VQCsOHirIM39NuSARsY6Y3G5XM4k2W4nxyR/RtdG9bvs/33 +aGsZ5V5yp7WSs8s9HHwaCPSsUiLKckQ7uA0TTRgbeweMrrLKovG57jsbBBB8pQD4 +PRd31qgxCdstWXHiWwRyI8vOLWENPXPFqA/rJwwqNdWTogy38aqVXxGYR8PIwjA2 +OaIwFjwGZcsPNLqw6bgAN8O2UBqZHWiMF8mi7brvioDvAIufZuqa2SqT/At45H83 +psQ6R4FsxZt6SAK7EsdPo8OYTrY1i4iPZd/eKhnEu2srEZgsKRwY5H1mvDH5fWCc +HSFu07sWmlmK6Or65Fsa0IaKLJiQDVVETd6xrI0wkM4AOcbKDrS7aywJ426dopbs ++LFdt4N0cdII4gBgJAfLuuA2yrDXRq4P6cgpVMy0R+0dEYE8zzm8zf1a+Ud273LS +9+LB+LJKwqbW8nOPBoiekimIKfJYoOA4+C/mAjsYl1sVjjEhXJAs9S9L2UvnUk1P +sZi4UKHI6eAIEl7VM1sQ4GbdZ0px2dF2Ax7pGkhD+DLpYyYkCprharKZdmuUNLUd +NhXxi/HSEiE+Uy+o8RIzmH7LuROl/ZgnfHjJEiBLt2qPvwrwYd4c3XuXWs4YsWfV +JTt8Mx2ihgVcdGy9//shCSmgJwR1oWrhgC10AEL2fKeRnYUal1i+IxFPp7nb8uwx +UADgR0cY4A3qR/JP489QFIcxBTVs65De+Bq3ecnujk6yeGpD9iptonq4Y8uNZMc1 +kOE7GiFGwR4EufT5SEMh+tUkjth2r+842vmZZuxrVQaohDiATmIJA07W51zKH+nQ +uw4qVKnAhPaDLCLc7YMIH9JcmkeQX0nf8/S2O2WYDH8glVDi5hfW08tCmV647vRY +nTIywUTO0lFpz7M+VyMNaJ6yXU6biBV5hLAI8C5ldr/SWI789W2+ebBaJ9gfK+PT +trohFSK37GcoSH4V6qSLJHCBASEsiddqHIHMLJZRYD+B6J3tLhjVUM43u+MEGbFT +d33ZDke/WzLTExWkaOv36e67gDBmgDuj9yroq3wGfwIDAQABMA0GCSqGSIb3DQEB +BAUAA4IEAQCc9RBhRbuWlmRZPZkqIdi5/+enyjoMmOa6ryJPxFSP8D2jrlHgQsk1 ++GsJmPFT3rwWfoGAQu/aeSX4sp8OhKVJtqNA6MJrGYnZIMolgYa1wZPbkjJsdEfi +UsZdIB0n2+KA0xwEdGPdkGCfNPBtOg557DkcyEvsIZ9ELp4Pp2XzWRhyFGasJZc4 +YwgD/3K2rpOPZoMkBKeKqV19j41OfLKGBVyuaqzitbu9+KT4RU1ibr2a+UuFCwdT +oqyN7bfWXjcjXOMkxCsOmLfKmqQxs7TEOVrYPTdYjamDxLy/e5g5FgoCxGY8iil0 ++YFLZyH6eEx/Os9DlG/M3O1MeRD9U97CdsphbDVZIDyWw5xeX8qQHJe0KSprAgiG +TLhTZHeyrKujQCQS1oFFmNy4gSqXt0j1/6/9T80j6HeyjiiYEaEQK9YLTAjRoA7W +VN8wtHI5F3RlNOVQEJks/bjdlpLL3VhaWtfewGh/mXRGcow84cgcsejMexmhreHm +JfTUl9+X1IFFxGq2/606A9ROQ7kN/s4rXu7/TiMODXI/kZijoWd2SCc7Z0YWoNo7 +IRKkmZtrsflJbObEuK2Jk59uqzSxyQOBId8qtbPo8qJJyHGV5GCp34g4x67BxJBo +h1iyVMamBAS5Ip1ejghuROrB8Hit8NhAZApXju62btJeXLX+mQayXb/wC/IXNJJD +83tXiLfZgs6GzLAq7+KW/64sZSvj87CPiNtxkvjchAvyr+fhbBXCrf4rlOjJE6SH +Je2/Jon7uqijncARGLBeYUT0Aa6k1slpXuSKxDNt7EIkP21kDZ5/OJ0Y1u587KVB +dEhuDgNf2/8ij7gAQBwBoZMe1DrwddrxgLLBlyHpAZetNYFZNT+Cs/OlpqI0Jm59 +kK9pX0BY4AGOd23XM3K/uLawdmf67kkftim7aVaqXFHPiWsJVtlzmidKvNSmbmZe +dOmMXp6PBoqcdusFVUS7vjd3KAes5wUX/CaTyOOPRu0LMSnpwEnaL76IC9x4Jd6d +7QqY/OFTjpPH8nP57LwouiT6MgSUCWGaOkPuBJ9w9sENSbbINpgJJ42iAe2kE+R7 +qEIvf/2ETCTseeQUqm2nWiSPLkNagEh6kojmEoKrGyrv3YjrSXSOY1a70tDVy43+ +ueQDQzNZm3Q7inpke2ZKvWyY0LQmLzP2te+tnNBcdLyKJx7emPRTuMUlEdK7cLbt +V3Sy9IKtyAXqqd66fPFj4NhJygyncj8M6CSqhG5L0GhDbkA8UJ8yK/gfKm3h5xe2 +utULK5VMtAhQt6cVahO59A9t/OI17y45bmlIgdlEQISzVFe9ZbIUJW44zBfPx74k +/w8pMRr8gEuRqpL2WdJiKGG6lhMHLVFo -----END CERTIFICATE----- === modified file 'mysql-test/std_data/server8k-key.pem' --- a/mysql-test/std_data/server8k-key.pem 2010-01-29 14:54:27 +0000 +++ b/mysql-test/std_data/server8k-key.pem 2010-07-28 15:59:19 +0000 @@ -1,99 +1,99 @@ -----BEGIN RSA PRIVATE KEY----- -MIISKgIBAAKCBAEAyqodxBHskfDH/1+QkvxADF63PQDFINUPiTEH10FMi2CAqjgU -3pNrnHSIQWi1AkEBLYaiepVTXntnL2weKVH5RP1KgL6yI6E+GzjPiMRx7vhrQcUt -wMNSrFl9gTQZlTK4mlG2QTbUxKGuhOY4uei/lr4Zemt3TeDe5rO2a7w93Wi8S8Tr -9TaT7VaiFVCKEOjWIu1ssc3DGMn2CuHeYWVi1hRBjLX7FGjBzxJdQSGdVxFDfbtD -LCG7w0R9qM8fw3F1tUfCfc44PHNknhXYpyfPvUDIRQjjyDmoC47CW3vxR5ESkczh -AOCUW70y5AyNw77MdjJSEmmwGOCwwnY0Wl952faBnQIKYWkcM85J+nYDHgdbJwu/ -NJ40lrgDm1A6ai8XehTPZWMAN1Koc85LFED00ppWVDO4dy5CW4/sHxj0rauKSo1t -cCXzWOfLZlEUfRb0621WdnZRbtYd2tONwGRaZ06v4r8z0bj2KvxXh6c1XoDJrPyH -yXEXkb+3TaPtPBsn9Gag+UYDJ8zqgPZLQPZBlM29CrPvJr7eb2muDz8cVWMzkJvt -yloSTd5LBsKikrBCPTGvpBUSFfiK6YiNz/2FZlBvEfGfSPO1up2GaCSiXah8VEL6 -2LXF8t0OD9Bo5FR+xbmgm2Utd/SPuTAK1YZc7cl80dqdDWNQ7uUekmPMogzoSpYC -TdyP33yPCBioMIjXr4mt/FdLEPnxy0jotjvIP/zC09FKEDwba2Tc5WUeW7LaseIk -l4/uwEuOGIN8F6Y8RbNgBiPyLxgTnheKxnJ5jE0E853q4CXTM4weEUdjH6VFP72F -s/6laO5ItwykyX9y0HVmm2r5oFDzqFlto904T3Aru/+SLnGr7+kA7Q3RtG/wjrIJ -+01hDdkQ1VQRzQOUhP2oaORFbh5qHi+FoW31tsDx7vc26f7C963ME0ZbiELwLR+1 -Dn61K+SNq7mHMGo9EvSt8xyszBpIKSqWe4AAC25Zh7+jynCZGxz9cj2y05RKz1V1 -vh9A7FU1SC1V8ADaPLBguhEyZlQLvgakXrfJWbtN9JIGJkhuwhLUfPAguKLhvGq2 -GQ43R1XJ8kkNlnWihGS/NPy+skHk9Yjr4bcmpeVBwiAM9uKoped2VKX7S4AFfRiF -erq8t63AL2CFzBUSHC8KnvN8QM/0PiPSlcrQBlhS8ITYDz3r/xJolHmPvkApX5jI -kGwFL5mMKmN4HyOxKcXnScmykg9TC9VxKBfCGb9gv3yHqKvB9ArBuNJo7sHOpxMT -F20kXaI3ptd9SIsrdC1ALsoZ1bY+bEJx+s+Fh/negHOLifRw8NjX/0BBnMcVbZtu -TLVSApl5MnPKJqCsMW/EsPXau8If4J9EuiX3nwIDAQABAoIEAElnTjqq502AsV+c -hGfId4ZDdAjjU4LtyJ+/I4DihM/ilxeQEnb/XDWhu4w9WXpEgyGzJvxRQ43wElKJ -zW7X4voK58Yzy5++EhmX/QsjY8TTMz3yJf0wgawtCZkXfsCcS2KRf/qk2nGRwf0e -yaMEWwhFOEMv01lgvjs/Ei55Usrz2Wd0HqaFKxUGkNQ5hJhVTOH/rqPDzAsZc0VD -w+Dw8NhrI8bMTvF4c+IFW8NwYmWbuh87CTxdx30VPJI82ttWJ/UN1bLtU08J2IKt -lPgOIl8ArMjcTGxD/cqZ3Wl3Pc/XCqvGUiSYMwP7Rgh1R4+DdtjEpxdGMmMAVuVI -HPQyqpa4gv+UMqBPish0yjSuM7jXnztINOvg9Vk1sxC5AT9eaRltmiS1s+lVxe+T -43ulf0ccYXJD/WclWSGCwloNFuokPIV+Lgo1pKsp4XDgoxQfkXwH8Q4dEqebY9rT -Tv9FGb1bMbdl22X1oSu2lBltBZaB/QnruV7L2GaQ0tqLKizgBRuvZFSE+DWdMb6d -9mnEB8LWtca/nzogXb5qv4GEMUX4FUAmSf1FnGWZwwDi1DFfJ860RVKf0xokGGQ3 -cm3H/F4veds88Z1hsAu0bG8h/bEAim+Whvag995cFHDD4on41KXW8wX1on9VFA1W -CkaGUPhLRytXDBVCSJkOYYFSJlb2wqONiWe4Tn5hsantCfliTj/GVkgDq2h7dAGR -WyoqTntJAv/xJsUOV9WmGXnWNeZX8BSO3P5dnXnMzhCWQGoprXmWFyJ3TYCJ2+CO -rzkZbtuKvTvGc3sDJgrSVmmg0BrOkH+GyYVlJdTDBmfzoORludDCFHECa8oK7NwY -t3o0eNlG6IqTxl2HIoPneW9nXFQtCXv6tpJjljwjlz5WpJG+kBW6bDedcxZu7olZ -fqtnyZTB2SjzzbGdQ4JvFup8MxNyPvYiqumQXJgkyXFVDl/UFhjWuGe04i8NBJgJ -xORcjfgLrKH1XKVBWPJdh/2YeUKIIvQ9RB4WVqXgGmD/21tgv1bVEMYabh23e/HE -Fe1U2XQPJKxGCEtG6b4zhFP+PeZACS+Vk5IVJYK9n4SepPBPgX/wbJLOcKGpsKjp -yx5WjopMO6T+VUV8HIduuZ+E8+uAILHDmo2Bq+LHblaxd4SkM0+hL2H36imK5CUO -5fLuvHW88LvFtQw6xhP20s+BnmgzE5ZvNG4Iedkjvwe9HmdNDew0UYT5vNJN0ehh -OlraBC++JYwEclrBD9SRvprT63XKDG735pPvzLQi7WKDCBn1/JEgxDIO8nkMewOZ -FU48Mdmkn9wqPeIigQciwl62fuAQCGRG+RXMQqra4A1apqMZQEauTK50VhHDGdbc -ye9LHaECggIBAO9lAzoYS/Lu0ticMt24P8BSbGdxSNIpEyIlTTs+7A0UjpfXsoK9 -4EJWZ7lhgbQh+SCTS662SeC+s8M6bT+3mELxUC5S/N3aCPyfjcM3JaoACkI9+VMn -9otJZjAEwH7cNpMN0Xa8fHCEma3l3XKiVxEJbuJC86S5mpkjeXVnDajAidBtevBd -LWJ9n2yXk+ZKUyI0mjpqItwUxOgQ/MOIvqAu66xyjg08/I1QQTuIrReAA+oaVKhp -c42Ufn26hUhNrQCBAtMAO3VC/chciet6vEMNEM13GqLp4+PcPhRX90gO4+bNrScD -WgiW/jc24CGan8gAenBWC/3l/C6JUsMp+ZYmPozsa0zo6edgiO/f2KXe5nP87wZT -MxaYJgnyXJxMefI79kUHPrhpXZxuiSCEWLhCBN34Lhpr2L491i2g/FJj9i6N3EzE -N3ic5Q63o4QFusjqIm3taQQFoGP2Cgg9owz5WJ0uRz/gtOE3XQiQA7+ozoAXOlTw -pJK5MMtVrEoOLIbVJIpxfDcKDp3yorR8QCQLHgDBmFeNCDmk+7YP33dRIc/AVNLF -q7cecqEc7D8AkXX8Q53GfCEg+uqbdeMQXK4BUE9iwRK9RiFhas/RJe73+Iio3S0L -ekLpnnOfvk744ws+JWsLpsfC/ZE7OxBLPtq2xvGl/RT2G7tCjmpX3CbPAoICAQDY -uOEJks2T105EcMPJjzNHCCqjK6S7qZaWkF3KT1Z0Mu5oUZwwHamsMg4BQJ2mjMrL -fRBKfXQLA6vgE7zysw3F300RDxE1RVow5+JLDQ4bqupp27/M0a8fuwksyOdKHqCV -YHzuTCxbVIFZawTjfOxJVXDHKCFCilfY1LsA+V+oFe3Ej8YYxWXkXA9ZLigpmt3s -Wu6eFcZgF3utzIGjI6eP6lL5bWp6Bh9Avp2xrOvpFwE2m02Y7/Zom6MT4DXvByY2 -KHHQLsasEMpeLuxQXjLeTocwcxBwBFKhX95yFuv31k00VydT+NExtaZeUYi9l19J -WmM4GjFjAqa3uUwMNVv5JfWtKMyk4FOox2XftLvMiIhV95B8hAGxtYr3hPkGg80O -AWPq6OKUD332COXRaHkmL5aQdN3gP5zh9+rH6icLrrZbrQidVRyDw03doRoGrH7i -ixXLyYoW80PHgqUDPohd5bFkZpi2vwXMl1YQ2TfN9TvYFSGme9YCm9ZuypnqauW/ -aAf0FI1MNwS+XDREtzPdFi0me6WxpKL4a2Z3GGNxIFuBjQ/uydWpjxkny9qI3KAp -SgjI3kBUDGq3gf0R+Xo/d4d/4asK9Nv2Fi0X+RfGqioFaTbQl/1zhNdvhP9IcwEJ -DLVQ3UhMdfg285RarC2Sihui0M8Smi9od9Dj6rdWMQKCAgEAiQVRFoRnnDGz/wVQ -W/Wkj6jdoUuG+btG10lwbhOyuj3k6+Yqp4iUfoPENKgpu/eiB1InhGWT3Y5ph7m+ -ZDTqco56bTlUwIqWkDmmw3CiHy6MsKOWPFFoXQry8VMW9sWGex7yoDp8I07SQ2WJ -HZ7rpLW4gMr/d25AnZxfXaJRgCBMAT9YmZFLc88hW99aaPproO1oxTyQnVVJ6uYm -NqjjKv4QKJEc21jn2N5xp+iv4f6Evw65G/fXitbOm5oRxXOoLNyqyCie35wrc+37 -hwumC97DmkasuUiUBoy9/5jl0ZmsOiPJEsZpVvdNpD7FhJZjE++qJPgrPvTPJbe1 -5jz1PUrAjJqZQ9kgYC2x01JVR4NQdlz0VrNyT2FgjFrrRQ7E0bAeYh4meRjd2rat -yC3YNgabkI0HnlnSIfl0yIMXSPUsKDNMP6gjc+aheI4FioBZC7xvXmn/rKynw+9E -iLj2xWtGnBir8VTlUu8EUe1UJ/Qv1cL1wT5HhC95TTjJN03rkHUYyCDyjvIzsZX6 -KMHhWIAAeUBVuO7hIVVcOTXWmw2WA7o7ErTPdy13QN40Hk9t8pEkBn9f9vpQg83d -aMypr3LTC80jY11wcZS3tSEpzCCkYVv91FV4cioTZmytWbg9A+dbNWzi1f22ctTr -FoVrAXaSYie2trOy5bjPmPCW8qMCggIBALQUKymBSkDmTqqf6I+65ajIKGWdBizJ -Jc/F9aj9c6DqER+tcFKq0ym6DdkMj/KsWnXrXXYH+DyOuGpg/EfOcEtS2P6rvmi9 -T8wDYg1qs6ZZxp5fcmgGc7Wx/FWyOj1kZZq5qhV4RgM9nJ1oR4+fZdcpn6RcvAZG -XehWG20byVgpoIAL11cN7zRpKne32rd3b5/NjyjcfxGpcaNgovej0L/MvVV0jV0H -aUCrIu1X+k6cRu3Q7hF+kwkpCcCiNS6AikfGI4wQ0hR3fy/zXXkKTMpcBglEEwyB -Cwf8WSID2d79uvka0hr8TRc5ERyeMzkWZp7U9EzRtufGdDGFTqN2Uw4bdKCFnkYC -AIHl7ciMrN+vM1n7c5uDNMUtTGOPojy/l8tjbFrtWBgfJ1Mg4ZW3cbNBJ6Kw+Qw0 -z28USYoEDp2uduiGRvo0lpUF29Wk37Nb8bLcTygeNxgK2u8Up3iipT0gdt4uQgbX -g0IVHfayB6SjeS57oJJto85XHz7AKlSWroD1OGagDSifLtneU7AlanryymGHrI6H -dsNkuqeLJFYDxQVI6UxJebiCpyxiPxwp9wtX8SS3SEyOZL5GzLn6ypGiCH1CTpW0 -EHHSy3V4DUGOc4w7eMirAnbSkxCfOmBA70NNw/uFY2XlQHKow0T0fImfKIeJagbT -B0GPDYvUpLKBAoICAQCzYnq8xupXK7lvTLaj936qGSe54OC2sj9+UpsFiPxglNY2 -sO5zKWKyY7+rjK6zG2ciGfPEDsZNIqKw1W/KBfR2kRLqkt4bC3fSCvUztx0vtGUe -veXlqiwETdE7RJXoaGJrgJArYJvpOd8PtWGeM+sSJNNrUlGlJnSiZ0CcypqUZgZL -WzGFfLOQYAXCykdB1iZkBqU2C5wktvCb9sVz6G3TmAwSKTENOWWZWmh+W0J4pZFV -ZEyvsxViJRQbwxa0kC0F5J/UtWZknO79/ZFj1H4jiAR45EjWHE+UZAkFwG8BSl54 -EKOx7GDanuRILr0dtbyi4d31nCYXdjs3x2+1N3exw4oKQIvNuF54WoowbNPu0kEb -G+7/kLwcJqRnSV4AiLuMz5aOte7JJSw5tzgZZlAQwJO7IDfrLqodivcXF5yirwiF -dyBpzSDmupy/aTHnCpT+l0H96jRU2awxaeRHZUqZog8gMHsslNVZEFvUFDJ7AUN/ -yyfUzJYjH18pZt0hS7jNb1O7KxZCkWGMiEcxHkgF/UINab5qruNBVKOkJ5vqGhYi -uNkgeGsQtXJcpqMRRiVXJE0kE+26gk+iaYnBJN9jnwy8OEAlYFUHsbCPObe/vPMQ -3RLl+ZoKdFkN/gTiy70wUTRVw+tWk+iAZc7GPX1CqDFOqGZ2t+xdF8hpsMtEww== +MIISKQIBAAKCBAEA6h3v1OWb9I9U/Z8diBu/xYGS8NCTD3ZESboHxVI2qSECPgxN +NcG8Lh0ktQdgYcOe64MnDTZX0Bibm47hoDldrAlTSffFxQhylqBBoXxDF+LrhXIq +Cz7K0PsK+bYusL9ezJ7PETDnCT7oy95q4GXbKsutbNsm9if4ZE41gs2KnoU2DA7k +vMmkKojrMIL4+BqTXA20LLo0iSbgvUTvpSJw4u96BeyzMNnxK2wP5vvTtUo5hACb +fU87YjaSKs+q2VXCzfyYGZk1L1xk5GUI0bP+jutf1dDzNttW2/q2Nf5rxx09Gh/G +wmOnEk1O7cOZ8VQCsOHirIM39NuSARsY6Y3G5XM4k2W4nxyR/RtdG9bvs/33aGsZ +5V5yp7WSs8s9HHwaCPSsUiLKckQ7uA0TTRgbeweMrrLKovG57jsbBBB8pQD4PRd3 +1qgxCdstWXHiWwRyI8vOLWENPXPFqA/rJwwqNdWTogy38aqVXxGYR8PIwjA2OaIw +FjwGZcsPNLqw6bgAN8O2UBqZHWiMF8mi7brvioDvAIufZuqa2SqT/At45H83psQ6 +R4FsxZt6SAK7EsdPo8OYTrY1i4iPZd/eKhnEu2srEZgsKRwY5H1mvDH5fWCcHSFu +07sWmlmK6Or65Fsa0IaKLJiQDVVETd6xrI0wkM4AOcbKDrS7aywJ426dopbs+LFd +t4N0cdII4gBgJAfLuuA2yrDXRq4P6cgpVMy0R+0dEYE8zzm8zf1a+Ud273LS9+LB ++LJKwqbW8nOPBoiekimIKfJYoOA4+C/mAjsYl1sVjjEhXJAs9S9L2UvnUk1PsZi4 +UKHI6eAIEl7VM1sQ4GbdZ0px2dF2Ax7pGkhD+DLpYyYkCprharKZdmuUNLUdNhXx +i/HSEiE+Uy+o8RIzmH7LuROl/ZgnfHjJEiBLt2qPvwrwYd4c3XuXWs4YsWfVJTt8 +Mx2ihgVcdGy9//shCSmgJwR1oWrhgC10AEL2fKeRnYUal1i+IxFPp7nb8uwxUADg +R0cY4A3qR/JP489QFIcxBTVs65De+Bq3ecnujk6yeGpD9iptonq4Y8uNZMc1kOE7 +GiFGwR4EufT5SEMh+tUkjth2r+842vmZZuxrVQaohDiATmIJA07W51zKH+nQuw4q +VKnAhPaDLCLc7YMIH9JcmkeQX0nf8/S2O2WYDH8glVDi5hfW08tCmV647vRYnTIy +wUTO0lFpz7M+VyMNaJ6yXU6biBV5hLAI8C5ldr/SWI789W2+ebBaJ9gfK+PTtroh +FSK37GcoSH4V6qSLJHCBASEsiddqHIHMLJZRYD+B6J3tLhjVUM43u+MEGbFTd33Z +Dke/WzLTExWkaOv36e67gDBmgDuj9yroq3wGfwIDAQABAoIEAQCSt6YoZqigz/50 +XvYT6Uf6T6S1lBDFXNmY1qOuDkLBJTWRiwYMDViQEaWCaZgGTKDYeT3M8uR/Phyu +lRFi5vCEMufmcAeZ3hxptw7KU+R8ILJ207/zgit6YglTys9h5txTIack39+6FJmx +wbZ64HpETJZnpMO6+fuZaMXyLjuT8mmXjvHcOgXOvjWeFkZOveDhjJkAesUXuqyX +EI+ajoXuQiPXeKonkD2qd7NTjzfy4gw/ZF4NXs0ZVJeviqtIPo2xp33udOw2vRFh +bMvlF4cNLAbIKYVyOG0ruOfd2I7Unsc/CvD1u5vlRVuUd8OO0JZLIZR7hlRX+A58 +8O1g2H/wJZAsF1BnLnFzDGYCX2WjCCK3Zn85FkKGRa0lTdYDduad/C/N3Y2/pHFE +e7U/2D7IkEei59tD2HcsDBB3MJnckkn/hyiL9qWcxqWZ61vurE+XjU6tc6fnfhk9 +pJQ6yU3epPU7Vfsk0UGA7bbgKpsyzyH8Zl76YC2mN2ZVJjZekfhY+ibT9odEPdOl +yLB5iXA6/WhKkDWaOqZGOH+7MblWgT9wHINlcn+nKzOr00JHl26ac6aMlXXi9vbe +4jgJbFK1HYlFIndyX/BdqRTsFemDoDrVqrEYsaONoVYDd9c5qrqYOeh34DhOksQW +hNwWBfmMlfzgOGtCYhMeK+AajqTtUbMYQA6qp47KJd/Oa5Dvi3ZCpvZh3Ll5iIau +rqCtmojsWCqmpWSu7P+Wu4+O3XkUMPdQUuQ5rJFESEBB3yEJcxqk/RItTcKNElNC +PASrPrMD9cli7S/pJ+frbhu1Gna1ArXzXQE9pMozPaBpjCig7+15R0lL3pmOKO6e +WK3dgSwrnW6TQdLPlSD4lbRoiIdTHVBczztDeUqVvFiV3/cuaEi1nvaVdAYLqjuL +ogK4HwE/FQ54S0ijAsP52n25usoH6OTU3bSd/7NTp0vZCy3yf10x7HUdsh2DvhRO +3+TSK5t0yz0Nt7hNwcI6pLmWUIYcZgpFc/WsiiGscTfhy8rh3kRHI8ylGq53KNF+ +yCVmjqnBRWs91ArxmeF1ctX2t3w5p7gf65hJWqoX/2DiSi5FBsr6HLxa5sUi4wRZ +136aCNt5Wu7w+AzPDbQW6qKUGSyfHJAw4JZasZcaZLise5IWb1ks0DtFbWWdT3ux +8r2AM7IO1WopnekrYCnx/aBvBAv4NjWozVA517ztVttPERt3AGb4nm387nYt5R2U +NO2GBWcDyT8JQLKmffE1AkWolCR1GsvcNLQfLCbnNppgsnsLE/viTG4mq1wjnd8O +2Q8nH1SVTuyGFREMp/zsiAEaGfdd0hI2r1J7OdNPBBCtmhITsy9ZYHqm5vrGvy3s +vi2GuB2RAoICAQD/oWUsg4eTJxHifTJLz/tVSTXnw7DhfbFVa1K1rUV63/MRQAFW +pabN4T6Yfp3CpdRkljCA8KPJZj7euwhm4OEg1ulpOouA+cfWlE9RFE8wyOK5SYwM +k+nk31P9MUC866pZg/ghzBGDub91OW1+ZGEtqnLI/n/LhiAIWt0hJvgZclTc1cAL +xffHVlFwoSyNl/nc3ueZCC95nOLst2XcuxZLLbOFtZCmDYsp49q/Jn6EFjn4Ge2o +qp38z6eZgDMP1F4lb9nDqXPHfUSt2jxKlmpfXS+IPKdba67+EjhbtmUYzaR4EoPI +zh+o6SrVWT6Yve7KGiYv06fuRz1m/lLQO/Arbd9ntSjgn+ZEXGOkbhnHUX3DJ4ny +/6XEGB9NLQjern4uNTn0AaV+uvhncapFMaIBnVfq0Cw8eog0136PBYRaVX7T44j5 +HwIyGXWtYGA/SzDEQoksD0Y/T61BEGnLZaKeavNd82WwFvcYHZtE0J4aQGjCEE7N ++nijzCy+j5ETmme9KJvQHpEyXP3N4RBko1eWvyTwFZDdIXtoa6TTEI51lm+FXJ/b +Y+BzMr6KRo29FB+7//1ptUoMvn5hzL0PwOv2ZSTQuoG5hLDEbxWXLNhd1VHcfznF +3EZHwfD2F8aGQ3kz+fkMTNfK955KorDrmLgvmV9eZZ5yQxGZrs5H5YfKpwKCAgEA +6nSUbzfSdVFUH89NM5FmEJgkD06vqCgHl2mpyF+VmDGcay4K06eA4QbRO5kns13+ +n6PcBl/YVW/rNE8iFi+WxfqUpAjdR1HlShvTuTRVqtFTfuN8XhbYU6VMjKyuE0kd +LKe3KRdwubjVNhXRZLBknU+3Y/4hnIR7mcE3/M5Zv5hjb7XnwWg/SzxV9WojCKiu +vQ7cXhH5/o7EuKcl1d6vueGhWsRylCG9RimwgViR2H7zD9kpkOc0nNym9cSpb0Gv +Lui4cf/fVwIt2HfNEGBjbM/83e2MH6b8Xp1fFAy0aXCdRtOo4LVOzJVAxn5dERMX +4JJ4d5cSFbssDN1bITOKzuytfBqRIQGNkOfizgQNWUiaFI0MhEN/icymjm1ybOIh +Gc9tzqKI4wP2X9g+u3+Oof1QaBcZ4UbZEU9ITN87Pa6XVJmpNx7A81BafWoEPFeE +ahoO4XDwlHZazDuSlOseEShxXcVwaIiqySy7OBEPBVuYdEd2Qw/z3JTx9Kw8MKnf +hu+ar5tz5dPnJIsvLeYCcJDe/K6loiZuHTtPbWEy9p6It7qubQNPBvTSBN5eVDKc +Q2bTQNCx8SAAA9C5gJiwWoQKsXJzbRFRY77P9JjuGpua3YJ2nYBHEJmF+fp1R33c +uHIyMphPMkKC4GC3/43kkMr6tck8kZbXGSYsLsBr2GkCggIBAJvvrjILQianzKcm +zAmnI6AQ+ssYesvyyrxaraeZvSqJdlLtgmOCxVANuQt5IW9djUSWwZvGL4Np1aw0 +15k6UNqhftzsE7FnrVneOsww4WXXBUcV8FKz4Bf3i9qFswILmGzmrfSf8YczRfGS +SJKzVPxwX3jwlrBmbx/pnb7dcLbFIbNcyLvl1ZJJu4BDMVRmgssTRp/5eExtQZg4 +//A4SA8wH7TO3yAMXvn8vrGgH8kfbdlEp88d1SYk3g4rP/rGB3A63NIYikIEzmJn +ICQ3wUfPJnGq3kRMWgEuyCZaCy2oNE3yrWVPJ8z3/2MJ/79ZDVNHxEeki2o1FuW+ ++nGAPq+fZIp03iy4HdVRro7dgugtc9QaSHJtNId8V4vSjviX5Oz3FxUb9AJst58S +nVV8Q2FMxBa/SlzSOkhRtCg2q1gXkzhaMnIVUleRZFGQ2uWBToxKMjcoUifIyN1J +z999bkfI4hBLq5pRSAXz+YVu5SMKa10GaawIwJLat+i+1zboF6QyI2o/Wz8nrsNq +KX/ajFGu5C94WFgsVoWKNI90KBLe48Ssje9c68waBlV/WHMg1YLvU3yqVDOV+K5c +IHB9tPMnG+AgBYZPxSzuvnLrrkj/GeKx0WI7TrvzOLRGKJo6irMEJ8IzFegASRUq +TVZKYQDYRG7m+lKlSxU+pyMAh2c9AoICAE4kavCip1eIssQjYLTGSkFPo/0iGbOv +G9CgXAE3snFWX67tWphupKrbjdMSWcQTmPD2OTg6q6zWL4twsIi6dcMooHAHsFC7 +//LyUV/SDJdxSyXohiQJ8zH1zwy35RDydnHSuF5OvLh53T44iWDI1dAEqLgAFI3J +LjTxzEpLMGiGTuYFt+ejai0WQAQayvBw4ESM9m+4CB2K0hBFTXv5y5HlnNTW0uWC +VUZUUMrbjUieDz8B/zOXi9aYSGFzmZFGUDAPSqJcSMEELemPDF7f8WNr8vi42tIV +4tlaFD1nep4F9bWMiCXU6B2RxVQi+7vcJEIqL1KUnGd3ydfD00K+ng4Xnj7Vz/cz +QE7CqrpFaXmPlCMzW6+dm51/AyhHXDLkL2od05hiXcNkJ7KMLWRqwExHVIxM3shR +x7lYNl3ArUsCrNd6m4aOjnrKFk7kjeLavHxskPccoGKrC9o0JMfTkWLgmuBJFQ0S +N/HzIbcvIFWF0Ms4ojb50yp6ziXhXfJOO/0KUQEki71XIhvw89mVZszDzD5lqzjf +HCZMBU4MbmL6NdEevFIDH0zPPkx3HPNtJt3kIJbit9wI8VhUMe+ldGnGxpWb8tKw +SfM3vrHkYr+lizk26XfXMFhdAuVtT7dzQKSNEyP/1a2Hs307Xzgiv8JulJ8QIkrX +/nsYWPOAGLG5AoICABmdW9Ppkvuhb1AEcjTWb+XCyopoBc6vit/uQWD9uO+CeX7a +cfzq+iH01CAjyVMc4E1JDc5Lpi106U+GRGcAAaPJB2Sp5NznoxaOVrb71blu4Q4x +bNjtKM/P/DXpO+yJYoOPdKtaSDhtnfNDM7H/jztJ3XIrOltKA7CcRDohbBWIx8Q0 +0uEpvfFpZZBco3yVmjP0RLgIVYn/ZDj9wGhSvFWIJ5vv6GXmtDrcHGMLxcfv7t76 +UVcMW/Yy4mYJRCzGOrWagyVijJ6MTVNciqadWcH1KcbB3EGoMFYMn61or2qJABPM +xz89IlhnROU1Re3X/QRx5t86cw6oa+FqrWMOhSs31I0dNWSuS/xDympG27YIYSDd +mv5seT78GjFmMJC5pPOLoXsbTPB0HpsX2/UL/w/eRAfilTOef/Cf9VE5MP/C2YR7 +NBxUU7/+21D6WvdtBTcZbrXWGroAo8zPP+PwX0+c6WoAvqDJvCPndp8xZhSgEJN/ +0kScptezi8n3ZHI95EA9U5mAHxHz0IhDDVzWw/z1f1SBPxKVX3+By3zaa3lrD2ch +cHq7nBkX72veEevnHUY8Z2rHE2G2jdmRfOtwm4sjL0VBV9fRRoxzJWRduKyeOtDL +EhhBhUoTrT48UnfW9hxnbNLB9P/hh+UJu9HrS2uAwHoGE1+8gcyundupGDBn -----END RSA PRIVATE KEY----- === modified file 'mysql-test/suite/binlog/t/binlog_base64_flag.test' --- a/mysql-test/suite/binlog/t/binlog_base64_flag.test 2010-06-18 17:32:23 +0000 +++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test 2010-08-17 07:14:46 +0000 @@ -7,6 +7,7 @@ # BINLOG statement does not work in embedded mode. +source include/have_log_bin.inc; source include/not_embedded.inc; disable_warnings; === modified file 'mysql-test/suite/binlog/t/binlog_old_versions.test' --- a/mysql-test/suite/binlog/t/binlog_old_versions.test 2008-02-07 11:38:13 +0000 +++ b/mysql-test/suite/binlog/t/binlog_old_versions.test 2010-08-17 07:14:46 +0000 @@ -22,6 +22,7 @@ # Related bugs: BUG#27779, BUG#31581, BUG#31582, BUG#31583, BUG#32407 +source include/have_log_bin.inc; source include/not_embedded.inc; --disable_warnings === modified file 'mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt' --- a/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt 2007-06-27 12:28:02 +0000 +++ b/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=2 +--loose-innodb_lock_wait_timeout=2 === modified file 'mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt' --- a/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt 2007-06-27 12:28:02 +0000 +++ b/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=2 +--loose-innodb_lock_wait_timeout=2 === added file 'mysql-test/suite/federated/federated_bug_32426.result' --- a/mysql-test/suite/federated/federated_bug_32426.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/federated/federated_bug_32426.result 2010-08-18 07:52:57 +0000 @@ -0,0 +1,30 @@ +CREATE DATABASE federated; +CREATE DATABASE federated; +# +# Bug #32426: FEDERATED query returns corrupt results for ORDER BY +# on a TEXT column +# +CREATE TABLE federated.t1(a TEXT); +INSERT INTO federated.t1 VALUES('abc'), ('gh'), ('f'), ('ijk'), ('de'); +CREATE TABLE federated.t1(a TEXT) ENGINE=FEDERATED +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +SELECT * FROM federated.t1 ORDER BY A; +a +abc +de +f +gh +ijk +SELECT * FROM federated.t1 ORDER BY A DESC; +a +ijk +gh +f +de +abc +DROP TABLE federated.t1; +DROP TABLE federated.t1; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; === added file 'mysql-test/suite/federated/federated_bug_32426.test' --- a/mysql-test/suite/federated/federated_bug_32426.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/federated/federated_bug_32426.test 2010-08-18 07:52:57 +0000 @@ -0,0 +1,24 @@ +source federated.inc; + +--echo # +--echo # Bug #32426: FEDERATED query returns corrupt results for ORDER BY +--echo # on a TEXT column +--echo # +connection slave; +CREATE TABLE federated.t1(a TEXT); +INSERT INTO federated.t1 VALUES('abc'), ('gh'), ('f'), ('ijk'), ('de'); + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1(a TEXT) ENGINE=FEDERATED + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; +SELECT * FROM federated.t1 ORDER BY A; +SELECT * FROM federated.t1 ORDER BY A DESC; +DROP TABLE federated.t1; + +connection slave; +DROP TABLE federated.t1; + +connection default; + +source federated_cleanup.inc; === removed file 'mysql-test/suite/federated/federated_innodb-slave.opt' --- a/mysql-test/suite/federated/federated_innodb-slave.opt 2007-12-12 17:19:24 +0000 +++ b/mysql-test/suite/federated/federated_innodb-slave.opt 1970-01-01 00:00:00 +0000 @@ -1 +0,0 @@ ---innodb === modified file 'mysql-test/suite/federated/federated_server.result' --- a/mysql-test/suite/federated/federated_server.result 2010-07-16 13:43:46 +0000 +++ b/mysql-test/suite/federated/federated_server.result 2010-08-12 17:52:52 +0000 @@ -213,7 +213,7 @@ id name alter server s1 options (database 'db_bogus'); flush tables; select * from federated.t1; -ERROR 42000: Got error: 1044 : Access denied for user 'test_fed'@'localhost' to database 'db_bogus' +ERROR 42000: Received error: 1044 : Access denied for user 'test_fed'@'localhost' to database 'db_bogus' drop server if exists 's1'; ERROR 42000: Access denied; you need the SUPER privilege for this operation create server 's1' foreign data wrapper 'mysql' options === removed file 'mysql-test/suite/federated/federated_transactions-slave.opt' --- a/mysql-test/suite/federated/federated_transactions-slave.opt 2007-12-12 17:19:24 +0000 +++ b/mysql-test/suite/federated/federated_transactions-slave.opt 1970-01-01 00:00:00 +0000 @@ -1 +0,0 @@ ---loose-innodb === modified file 'mysql-test/suite/federated/my.cnf' --- a/mysql-test/suite/federated/my.cnf 2009-09-30 22:25:06 +0000 +++ b/mysql-test/suite/federated/my.cnf 2010-08-25 20:22:33 +0000 @@ -6,7 +6,6 @@ log-bin= master-bin [mysqld.2] - [ENV] MASTER_MYPORT= @mysqld.1.port MASTER_MYSOCK= @mysqld.1.socket === added file 'mysql-test/suite/federated/suite.opt' --- a/mysql-test/suite/federated/suite.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/federated/suite.opt 2010-08-25 20:22:33 +0000 @@ -0,0 +1,2 @@ +--federated +--plugin-load=$HA_FEDERATEDX_SO === modified file 'mysql-test/suite/funcs_1/r/is_basics_mixed.result' --- a/mysql-test/suite/funcs_1/r/is_basics_mixed.result 2008-03-07 19:18:14 +0000 +++ b/mysql-test/suite/funcs_1/r/is_basics_mixed.result 2010-07-09 12:17:47 +0000 @@ -328,7 +328,7 @@ ERROR 42000: Access denied for user 'roo SELECT table_schema,table_name FROM information_schema.tables WHERE table_schema = 'information_schema' AND table_name = 'tables'; table_schema table_name -information_schema tables +information_schema TABLES SELECT * FROM information_schema.table_privileges WHERE table_schema = 'information_schema'; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE === modified file 'mysql-test/suite/funcs_1/r/is_columns_innodb.result' --- a/mysql-test/suite/funcs_1/r/is_columns_innodb.result 2009-03-05 11:15:47 +0000 +++ b/mysql-test/suite/funcs_1/r/is_columns_innodb.result 2010-07-16 13:56:33 +0000 @@ -450,9 +450,9 @@ NULL test tb1 f27 27 NULL YES int NULL N NULL test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references NULL test tb1 f3 3 NULL YES char 0 0 NULL NULL latin1 latin1_swedish_ci char(0) select,insert,update,references -NULL test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -NULL test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb1 f30 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL test tb1 f31 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb1 f32 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references NULL test tb1 f33 33 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb1 f34 34 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references NULL test tb1 f35 35 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references @@ -565,9 +565,9 @@ NULL test tb3 f143 26 99999 NO int NULL NULL test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references -NULL test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb3 f147 30 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references NULL test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references NULL test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references === modified file 'mysql-test/suite/funcs_1/r/is_columns_is.result' --- a/mysql-test/suite/funcs_1/r/is_columns_is.result 2010-08-05 15:38:06 +0000 +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result 2010-08-27 14:12:44 +0000 @@ -15,8 +15,8 @@ NULL information_schema COLLATIONS IS_DE NULL information_schema COLLATIONS SORTLEN 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(3) select NULL information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME 2 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select NULL information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME 1 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select -NULL information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select NULL information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select NULL information_schema COLUMNS COLUMN_COMMENT 19 NO varchar 255 765 NULL NULL utf8 utf8_general_ci varchar(255) select @@ -27,9 +27,9 @@ NULL information_schema COLUMNS COLUMN_T NULL information_schema COLUMNS DATA_TYPE 8 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema COLUMNS EXTRA 17 NO varchar 27 81 NULL NULL utf8 utf8_general_ci varchar(27) select NULL information_schema COLUMNS IS_NULLABLE 7 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select -NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select NULL information_schema COLUMNS TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema COLUMNS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -71,14 +71,14 @@ NULL information_schema EVENTS SQL_MODE NULL information_schema EVENTS STARTS 13 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema EVENTS STATUS 15 NO varchar 18 54 NULL NULL utf8 utf8_general_ci varchar(18) select NULL information_schema EVENTS TIME_ZONE 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema FILES AUTOEXTEND_SIZE 19 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema FILES AVG_ROW_LENGTH 28 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema FILES CHECKSUM 36 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES AUTOEXTEND_SIZE 19 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES AVG_ROW_LENGTH 28 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES CHECKSUM 36 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema FILES CHECK_TIME 35 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema FILES CREATE_TIME 33 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema FILES CREATION_TIME 20 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema FILES DATA_FREE 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema FILES DATA_LENGTH 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES DATA_FREE 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES DATA_LENGTH 29 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema FILES DELETED_ROWS 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema FILES ENGINE 10 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema FILES EXTENT_SIZE 16 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select @@ -88,27 +88,27 @@ NULL information_schema FILES FILE_NAME NULL information_schema FILES FILE_TYPE 3 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema FILES FREE_EXTENTS 14 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema FILES FULLTEXT_KEYS 11 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema FILES INDEX_LENGTH 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema FILES INITIAL_SIZE 17 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES INDEX_LENGTH 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES INITIAL_SIZE 17 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema FILES LAST_ACCESS_TIME 22 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema FILES LAST_UPDATE_TIME 21 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema FILES LOGFILE_GROUP_NAME 8 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema FILES LOGFILE_GROUP_NUMBER 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select -NULL information_schema FILES MAXIMUM_SIZE 18 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema FILES MAX_DATA_LENGTH 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES MAXIMUM_SIZE 18 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES MAX_DATA_LENGTH 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema FILES RECOVER_TIME 23 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema FILES ROW_FORMAT 26 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select NULL information_schema FILES STATUS 37 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select NULL information_schema FILES TABLESPACE_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema FILES TABLE_CATALOG 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema FILES TABLE_NAME 7 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema FILES TABLE_ROWS 27 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES TABLE_ROWS 27 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema FILES TABLE_SCHEMA 6 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema FILES TOTAL_EXTENTS 15 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema FILES TRANSACTION_COUNTER 24 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema FILES UPDATE_COUNT 13 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema FILES UPDATE_TIME 34 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema FILES VERSION 25 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema FILES VERSION 25 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select NULL information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -233,29 +233,29 @@ NULL information_schema KEY_COLUMN_USAGE NULL information_schema KEY_COLUMN_USAGE TABLE_CATALOG 4 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema KEY_COLUMN_USAGE TABLE_NAME 6 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema KEY_COLUMN_USAGE TABLE_SCHEMA 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema PARTITIONS AVG_ROW_LENGTH 14 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS AVG_ROW_LENGTH 14 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema PARTITIONS CHECK_TIME 21 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema PARTITIONS CREATE_TIME 19 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema PARTITIONS DATA_FREE 18 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema PARTITIONS DATA_LENGTH 15 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema PARTITIONS INDEX_LENGTH 17 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS DATA_FREE 18 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS DATA_LENGTH 15 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS INDEX_LENGTH 17 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema PARTITIONS NODEGROUP 24 NO varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select NULL information_schema PARTITIONS PARTITION_COMMENT 23 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select NULL information_schema PARTITIONS PARTITION_DESCRIPTION 12 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema PARTITIONS PARTITION_EXPRESSION 10 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema PARTITIONS PARTITION_METHOD 8 NULL YES varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select NULL information_schema PARTITIONS PARTITION_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema PARTITIONS PARTITION_ORDINAL_POSITION 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS PARTITION_ORDINAL_POSITION 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema PARTITIONS SUBPARTITION_EXPRESSION 11 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema PARTITIONS SUBPARTITION_METHOD 9 NULL YES varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select NULL information_schema PARTITIONS SUBPARTITION_NAME 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema PARTITIONS TABLESPACE_NAME 25 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema PARTITIONS TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema PARTITIONS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema PARTITIONS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema PARTITIONS UPDATE_TIME 20 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema PBXT_STATISTICS ID 1 0 NO int NULL NULL 10 0 NULL NULL int(4) select @@ -343,27 +343,27 @@ NULL information_schema STATISTICS SUB_P NULL information_schema STATISTICS TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema TABLES CHECK_TIME 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select NULL information_schema TABLES CREATE_OPTIONS 20 NULL YES varchar 255 765 NULL NULL utf8 utf8_general_ci varchar(255) select NULL information_schema TABLES CREATE_TIME 15 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema TABLES DATA_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES DATA_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema TABLES ENGINE 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select -NULL information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema TABLES ROW_FORMAT 7 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select NULL information_schema TABLES TABLE_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema TABLES TABLE_COLLATION 18 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select NULL information_schema TABLES TABLE_COMMENT 21 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select NULL information_schema TABLES TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema TABLES TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TABLES TABLE_TYPE 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TABLES UPDATE_TIME 16 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select -NULL information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select +NULL information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select NULL information_schema TABLE_CONSTRAINTS CONSTRAINT_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema TABLE_CONSTRAINTS CONSTRAINT_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema TABLE_CONSTRAINTS CONSTRAINT_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select === modified file 'mysql-test/suite/funcs_1/r/is_columns_memory.result' --- a/mysql-test/suite/funcs_1/r/is_columns_memory.result 2009-03-05 11:15:47 +0000 +++ b/mysql-test/suite/funcs_1/r/is_columns_memory.result 2010-07-16 13:56:33 +0000 @@ -437,9 +437,9 @@ NULL test tb1 f27 19 NULL YES int NULL N NULL test tb1 f28 20 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb1 f29 21 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references NULL test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) select,insert,update,references -NULL test tb1 f30 22 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL test tb1 f31 23 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -NULL test tb1 f32 24 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb1 f30 22 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL test tb1 f31 23 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb1 f32 24 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references NULL test tb1 f33 25 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb1 f34 26 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references NULL test tb1 f35 27 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references @@ -540,9 +540,9 @@ NULL test tb3 f143 20 99999 NO int NULL NULL test tb3 f144 21 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb3 f145 22 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb3 f146 23 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references -NULL test tb3 f147 24 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL test tb3 f148 25 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -NULL test tb3 f149 26 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb3 f147 24 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL test tb3 f148 25 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb3 f149 26 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references NULL test tb3 f150 27 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb3 f151 28 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references NULL test tb3 f152 29 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references === modified file 'mysql-test/suite/funcs_1/r/is_columns_myisam.result' --- a/mysql-test/suite/funcs_1/r/is_columns_myisam.result 2009-03-05 11:15:47 +0000 +++ b/mysql-test/suite/funcs_1/r/is_columns_myisam.result 2010-07-16 13:56:33 +0000 @@ -479,9 +479,9 @@ NULL test tb1 f27 27 NULL YES int NULL N NULL test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references NULL test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) select,insert,update,references -NULL test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -NULL test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb1 f30 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL test tb1 f31 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb1 f32 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references NULL test tb1 f33 33 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb1 f34 34 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references NULL test tb1 f35 35 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references @@ -602,9 +602,9 @@ NULL test tb3 f143 26 99999 NO int NULL NULL test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references NULL test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references -NULL test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references -NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb3 f147 30 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references +NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references NULL test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references NULL test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references NULL test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references === modified file 'mysql-test/suite/funcs_1/r/is_columns_mysql.result' --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result 2009-10-28 09:23:02 +0000 +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result 2010-07-16 13:56:33 +0000 @@ -97,13 +97,13 @@ NULL mysql host Select_priv 3 N NO enum NULL mysql host Show_view_priv 16 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql host Trigger_priv 20 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql host Update_priv 5 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references -NULL mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references +NULL mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references NULL mysql ndb_binlog_index File 2 NULL NO varchar 255 255 NULL NULL latin1 latin1_swedish_ci varchar(255) select,insert,update,references -NULL mysql ndb_binlog_index inserts 4 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL mysql ndb_binlog_index Position 1 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL mysql ndb_binlog_index schemaops 7 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references -NULL mysql ndb_binlog_index updates 5 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL mysql ndb_binlog_index inserts 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL mysql ndb_binlog_index Position 1 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL mysql ndb_binlog_index schemaops 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references +NULL mysql ndb_binlog_index updates 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references NULL mysql plugin dl 2 NO char 128 384 NULL NULL utf8 utf8_bin char(128) select,insert,update,references NULL mysql plugin name 1 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references NULL mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL longblob select,insert,update,references === modified file 'mysql-test/suite/funcs_1/t/is_columns_is.test' --- a/mysql-test/suite/funcs_1/t/is_columns_is.test 2010-08-05 11:40:54 +0000 +++ b/mysql-test/suite/funcs_1/t/is_columns_is.test 2010-08-17 07:14:46 +0000 @@ -18,6 +18,7 @@ --source include/not_embedded.inc # This test depends on having the PBXT information_schema stuff. --source include/have_pbxt.inc +--source include/have_innodb.inc --source include/have_xtradb.inc let $my_where = WHERE table_schema = 'information_schema' === added file 'mysql-test/suite/innodb/r/innodb_bug53756.result' --- a/mysql-test/suite/innodb/r/innodb_bug53756.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/innodb/r/innodb_bug53756.result 2010-07-06 02:26:38 +0000 @@ -0,0 +1,118 @@ +DROP TABLE IF EXISTS bug_53756 ; +CREATE TABLE bug_53756 (pk INT, c1 INT) ENGINE=InnoDB; +ALTER TABLE bug_53756 ADD PRIMARY KEY (pk); +INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44); + +# Select a less restrictive isolation level. +SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +COMMIT; + +# Start a transaction in the default connection for isolation. +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +SELECT * FROM bug_53756; +pk c1 +1 11 +2 22 +3 33 +4 44 + +# connection con1 deletes row 1 +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +DELETE FROM bug_53756 WHERE pk=1; + +# connection con2 deletes row 2 +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +DELETE FROM bug_53756 WHERE pk=2; + +# connection con3 updates row 3 +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +UPDATE bug_53756 SET c1=77 WHERE pk=3; + +# connection con4 updates row 4 +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +UPDATE bug_53756 SET c1=88 WHERE pk=4; + +# connection con5 inserts row 5 +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +INSERT INTO bug_53756 VALUES(5, 55); + +# connection con6 inserts row 6 +START TRANSACTION; +SELECT @@tx_isolation; +@@tx_isolation +READ-COMMITTED +INSERT INTO bug_53756 VALUES(6, 66); + +# connection con1 commits. +COMMIT; + +# connection con3 commits. +COMMIT; + +# connection con4 rolls back. +ROLLBACK; + +# connection con6 rolls back. +ROLLBACK; + +# The connections 2 and 5 stay open. + +# connection default selects resulting data. +# Delete of row 1 was committed. +# Update of row 3 was committed. +# Due to isolation level read committed, these should be included. +# All other changes should not be included. +SELECT * FROM bug_53756; +pk c1 +2 22 +3 77 +4 44 + +# connection default +# +# Crash server. +START TRANSACTION; +INSERT INTO bug_53756 VALUES (666,666); +SET SESSION debug="+d,crash_commit_before"; +COMMIT; +ERROR HY000: Lost connection to MySQL server during query + +# +# disconnect con1, con2, con3, con4, con5, con6. +# +# Restart server. + +# +# Select recovered data. +# Delete of row 1 was committed. +# Update of row 3 was committed. +# These should be included. +# All other changes should not be included. +# Delete of row 2 and insert of row 5 should be rolled back +SELECT * FROM bug_53756; +pk c1 +2 22 +3 77 +4 44 + +# Clean up. +DROP TABLE bug_53756; === modified file 'mysql-test/suite/innodb/r/innodb_mysql.result' --- a/mysql-test/suite/innodb/r/innodb_mysql.result 2010-08-02 09:01:24 +0000 +++ b/mysql-test/suite/innodb/r/innodb_mysql.result 2010-08-27 14:12:44 +0000 @@ -2507,4 +2507,12 @@ ORDER BY f1 DESC LIMIT 5; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range f2,f4 f4 1 NULL 11 Using where DROP TABLE t1; +# +# Bug#54117 crash in thr_multi_unlock, temporary table +# +CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB; +LOCK TABLES t1 READ; +ALTER TABLE t1 COMMENT 'test'; +UNLOCK TABLES; +DROP TABLE t1; End of 5.1 tests === modified file 'mysql-test/suite/innodb/t/disabled.def' --- a/mysql-test/suite/innodb/t/disabled.def 2010-08-04 08:39:53 +0000 +++ b/mysql-test/suite/innodb/t/disabled.def 2010-08-27 14:12:44 +0000 @@ -12,3 +12,4 @@ #innodb : Bug#53306 2010-04-30 VasilDimov valgrind warnings innodb_bug48024 : Waiting for merge with Percona Server; bug fixed in innodb_plugin in MySQL 5.1.48 +innodb_bug53756 : Waiting for merge with Percona Server; bug fixed in innodb_plugin in MySQL 5.1.50 === modified file 'mysql-test/suite/innodb/t/innodb-master.opt' --- a/mysql-test/suite/innodb/t/innodb-master.opt 2010-04-12 11:56:24 +0000 +++ b/mysql-test/suite/innodb/t/innodb-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---binlog_cache_size=32768 --innodb_lock_wait_timeout=1 +--binlog_cache_size=32768 --loose-innodb_lock_wait_timeout=1 === modified file 'mysql-test/suite/innodb/t/innodb-semi-consistent-master.opt' --- a/mysql-test/suite/innodb/t/innodb-semi-consistent-master.opt 2010-04-12 11:56:24 +0000 +++ b/mysql-test/suite/innodb/t/innodb-semi-consistent-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=2 +--loose-innodb_lock_wait_timeout=2 === modified file 'mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero-master.opt' --- a/mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero-master.opt 2010-06-03 09:50:32 +0000 +++ b/mysql-test/suite/innodb/t/innodb_autoinc_lock_mode_zero-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb-autoinc-lock-mode=0 +--loose-innodb-autoinc-lock-mode=0 === modified file 'mysql-test/suite/innodb/t/innodb_bug30919-master.opt' --- a/mysql-test/suite/innodb/t/innodb_bug30919-master.opt 2010-06-03 09:50:32 +0000 +++ b/mysql-test/suite/innodb/t/innodb_bug30919-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb --innodb_autoinc_lock_mode=0 +--loose-innodb --loose-innodb_autoinc_lock_mode=0 === modified file 'mysql-test/suite/innodb/t/innodb_bug39438-master.opt' --- a/mysql-test/suite/innodb/t/innodb_bug39438-master.opt 2010-04-12 11:56:24 +0000 +++ b/mysql-test/suite/innodb/t/innodb_bug39438-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb-file-per-table=1 +--loose-innodb-file-per-table=1 === modified file 'mysql-test/suite/innodb/t/innodb_bug52663-master.opt' --- a/mysql-test/suite/innodb/t/innodb_bug52663-master.opt 2010-04-26 10:27:25 +0000 +++ b/mysql-test/suite/innodb/t/innodb_bug52663-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=1 +--loose-innodb_lock_wait_timeout=1 === modified file 'mysql-test/suite/innodb/t/innodb_bug53674-master.opt' --- a/mysql-test/suite/innodb/t/innodb_bug53674-master.opt 2010-06-02 10:26:37 +0000 +++ b/mysql-test/suite/innodb/t/innodb_bug53674-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---log-bin --innodb-locks-unsafe-for-binlog --binlog-format=mixed +--loose-innodb-locks-unsafe-for-binlog --binlog-format=mixed === modified file 'mysql-test/suite/innodb/t/innodb_bug53674.test' --- a/mysql-test/suite/innodb/t/innodb_bug53674.test 2010-06-02 10:26:37 +0000 +++ b/mysql-test/suite/innodb/t/innodb_bug53674.test 2010-08-17 07:14:46 +0000 @@ -1,4 +1,5 @@ -- source include/have_innodb.inc +-- source include/have_log_bin.inc create table bug53674(a int)engine=innodb; insert into bug53674 values (1),(2); === added file 'mysql-test/suite/innodb/t/innodb_bug53756-master.opt' --- a/mysql-test/suite/innodb/t/innodb_bug53756-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/innodb/t/innodb_bug53756-master.opt 2010-07-06 02:26:38 +0000 @@ -0,0 +1 @@ +--skip-stack-trace --skip-core-file === added file 'mysql-test/suite/innodb/t/innodb_bug53756.test' --- a/mysql-test/suite/innodb/t/innodb_bug53756.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/innodb/t/innodb_bug53756.test 2010-07-06 02:26:38 +0000 @@ -0,0 +1,184 @@ +# This is the test case for bug #53756. Alter table operation could +# leave a deleted record for the temp table (later renamed to the altered +# table) in the SYS_TABLES secondary index, we should ignore this row and +# find the first non-deleted row for the specified table_id when load table +# metadata in the function dict_load_table_on_id() during crash recovery. + +# +# innobackup needs to connect to the server. Not supported in embedded. +--source include/not_embedded.inc +# +# This test case needs to crash the server. Needs a debug server. +--source include/have_debug.inc +# +# Don't test this under valgrind, memory leaks will occur. +--source include/not_valgrind.inc +# +# This test case needs InnoDB. +--source include/have_innodb.inc + +# +# Precautionary clean up. +# +--disable_warnings +DROP TABLE IF EXISTS bug_53756 ; +--enable_warnings + +# +# Create test data. +# +CREATE TABLE bug_53756 (pk INT, c1 INT) ENGINE=InnoDB; +ALTER TABLE bug_53756 ADD PRIMARY KEY (pk); +INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44); + +--echo +--echo # Select a less restrictive isolation level. +# Don't use user variables. They won't survive server crash. +--let $global_isolation= `SELECT @@global.tx_isolation`; +--let $session_isolation= `SELECT @@session.tx_isolation`; +SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +COMMIT; + +--echo +--echo # Start a transaction in the default connection for isolation. +START TRANSACTION; +SELECT @@tx_isolation; +SELECT * FROM bug_53756; + +--echo +--echo # connection con1 deletes row 1 +--connect (con1,localhost,root,,) +START TRANSACTION; +SELECT @@tx_isolation; +DELETE FROM bug_53756 WHERE pk=1; + +--echo +--echo # connection con2 deletes row 2 +--connect (con2,localhost,root,,) +START TRANSACTION; +SELECT @@tx_isolation; +DELETE FROM bug_53756 WHERE pk=2; + +--echo +--echo # connection con3 updates row 3 +--connect (con3,localhost,root,,) +START TRANSACTION; +SELECT @@tx_isolation; +UPDATE bug_53756 SET c1=77 WHERE pk=3; + +--echo +--echo # connection con4 updates row 4 +--connect (con4,localhost,root,,) +START TRANSACTION; +SELECT @@tx_isolation; +UPDATE bug_53756 SET c1=88 WHERE pk=4; + +--echo +--echo # connection con5 inserts row 5 +--connect (con5,localhost,root,,) +START TRANSACTION; +SELECT @@tx_isolation; +INSERT INTO bug_53756 VALUES(5, 55); + +--echo +--echo # connection con6 inserts row 6 +--connect (con6,localhost,root,,) +START TRANSACTION; +SELECT @@tx_isolation; +INSERT INTO bug_53756 VALUES(6, 66); + +--echo +--echo # connection con1 commits. +--connection con1 +COMMIT; + +--echo +--echo # connection con3 commits. +--connection con3 +COMMIT; + +--echo +--echo # connection con4 rolls back. +--connection con4 +ROLLBACK; + +--echo +--echo # connection con6 rolls back. +--connection con6 +ROLLBACK; + +--echo +--echo # The connections 2 and 5 stay open. + +--echo +--echo # connection default selects resulting data. +--echo # Delete of row 1 was committed. +--echo # Update of row 3 was committed. +--echo # Due to isolation level read committed, these should be included. +--echo # All other changes should not be included. +--connection default +SELECT * FROM bug_53756; + +--echo +--echo # connection default +--connection default +--echo # +--echo # Crash server. +# +# Write file to make mysql-test-run.pl expect the "crash", but don't start +# it until it's told to +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +# +START TRANSACTION; +INSERT INTO bug_53756 VALUES (666,666); +# +# Request a crash on next execution of commit. +SET SESSION debug="+d,crash_commit_before"; +# +# Execute the statement that causes the crash. +--error 2013 +COMMIT; +--echo +--echo # +--echo # disconnect con1, con2, con3, con4, con5, con6. +--disconnect con1 +--disconnect con2 +--disconnect con3 +--disconnect con4 +--disconnect con5 +--disconnect con6 +--echo # +--echo # Restart server. +# +# Write file to make mysql-test-run.pl start up the server again +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +# +# Turn on reconnect +--enable_reconnect +# +# Call script that will poll the server waiting for it to be back online again +--source include/wait_until_connected_again.inc +# +# Turn off reconnect again +--disable_reconnect +--echo + +--echo # +--echo # Select recovered data. +--echo # Delete of row 1 was committed. +--echo # Update of row 3 was committed. +--echo # These should be included. +--echo # All other changes should not be included. +--echo # Delete of row 2 and insert of row 5 should be rolled back +SELECT * FROM bug_53756; + +--echo +--echo # Clean up. +DROP TABLE bug_53756; + +--disable_query_log +eval SET GLOBAL tx_isolation= '$global_isolation'; +eval SET SESSION tx_isolation= '$session_isolation'; +--enable_query_log + === modified file 'mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1-master.opt' --- a/mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1-master.opt 2010-06-03 09:50:32 +0000 +++ b/mysql-test/suite/innodb/t/innodb_lock_wait_timeout_1-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=1 +--loose-innodb_lock_wait_timeout=1 === modified file 'mysql-test/suite/innodb/t/innodb_misc1-master.opt' --- a/mysql-test/suite/innodb/t/innodb_misc1-master.opt 2010-04-27 06:09:08 +0000 +++ b/mysql-test/suite/innodb/t/innodb_misc1-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---binlog_cache_size=32768 --innodb_lock_wait_timeout=1 +--binlog_cache_size=32768 --loose-innodb_lock_wait_timeout=1 === modified file 'mysql-test/suite/innodb/t/innodb_mysql-master.opt' --- a/mysql-test/suite/innodb/t/innodb_mysql-master.opt 2010-06-03 09:50:32 +0000 +++ b/mysql-test/suite/innodb/t/innodb_mysql-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb-lock-wait-timeout=2 +--loose-innodb-lock-wait-timeout=2 === modified file 'mysql-test/suite/innodb/t/innodb_mysql.test' --- a/mysql-test/suite/innodb/t/innodb_mysql.test 2010-08-02 09:01:24 +0000 +++ b/mysql-test/suite/innodb/t/innodb_mysql.test 2010-08-27 14:12:44 +0000 @@ -752,4 +752,18 @@ ORDER BY f1 DESC LIMIT 5; DROP TABLE t1; + +--echo # +--echo # Bug#54117 crash in thr_multi_unlock, temporary table +--echo # + +CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB; + +LOCK TABLES t1 READ; +ALTER TABLE t1 COMMENT 'test'; +UNLOCK TABLES; + +DROP TABLE t1; + + --echo End of 5.1 tests === modified file 'mysql-test/suite/innodb/t/innodb_mysql_rbk-master.opt' --- a/mysql-test/suite/innodb/t/innodb_mysql_rbk-master.opt 2010-06-03 09:50:32 +0000 +++ b/mysql-test/suite/innodb/t/innodb_mysql_rbk-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=1 --innodb_rollback_on_timeout=1 +--loose-innodb_lock_wait_timeout=1 --loose-innodb_rollback_on_timeout=1 === modified file 'mysql-test/suite/innodb/t/innodb_timeout_rollback-master.opt' --- a/mysql-test/suite/innodb/t/innodb_timeout_rollback-master.opt 2010-06-03 09:50:32 +0000 +++ b/mysql-test/suite/innodb/t/innodb_timeout_rollback-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=2 --innodb_rollback_on_timeout +--loose-innodb_lock_wait_timeout=2 --loose-innodb_rollback_on_timeout === added file 'mysql-test/suite/innodb_plugin/combinations' --- a/mysql-test/suite/innodb_plugin/combinations 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/innodb_plugin/combinations 2010-08-17 07:14:46 +0000 @@ -0,0 +1,12 @@ +[innodb_plugin] +ignore-builtin-innodb +plugin-load=$HA_INNODB_PLUGIN_SO +innodb + +[xtradb_plugin] +ignore-builtin-innodb +plugin-load=$HA_XTRADB_SO +innodb + +[xtradb] +innodb === added file 'mysql-test/suite/innodb_plugin/r/innodb_bug54453.result' --- a/mysql-test/suite/innodb_plugin/r/innodb_bug54453.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/innodb_plugin/r/innodb_bug54453.result 2010-07-20 17:36:15 +0000 @@ -0,0 +1,9 @@ +# +# Bug#54453: Failing assertion: trx->active_trans when renaming a table with active trx +# +DROP TABLE IF EXISTS bug54453; +CREATE TABLE bug54453(a INT) ENGINE=InnoDB; +ALTER TABLE bug54453 RENAME TO bug54453_2; +SELECT * FROM bug54453_2; +a +DROP TABLE bug54453_2; === added file 'mysql-test/suite/innodb_plugin/suite.pm' --- a/mysql-test/suite/innodb_plugin/suite.pm 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/innodb_plugin/suite.pm 2010-08-24 12:33:34 +0000 @@ -0,0 +1,19 @@ +package My::Suite::InnoDB_plugin; + +@ISA = qw(My::Suite); + +############# initialization ###################### +my @combinations; + +push @combinations, 'innodb_plugin' if $ENV{HA_INNODB_PLUGIN_SO}; +push @combinations, 'xtradb_plugin' if $ENV{HA_XTRADB_SO}; +push @combinations, 'xtradb' if $::mysqld_variables{'innodb'} eq "ON"; + +return "Neither innodb_plugin nor xtradb are available" unless @combinations; + +$ENV{INNODB_PLUGIN_COMBINATIONS}=join ':', @combinations + unless $ENV{INNODB_PLUGIN_COMBINATIONS}; + +############# return an object ###################### +bless { }; + === modified file 'mysql-test/suite/innodb_plugin/t/innodb-autoinc-44030.test' --- a/mysql-test/suite/innodb_plugin/t/innodb-autoinc-44030.test 2010-04-09 13:33:42 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-44030.test 2010-07-30 14:09:24 +0000 @@ -1,6 +1,8 @@ -- source include/have_innodb_plugin.inc # embedded server ignores 'delayed', so skip this -- source include/not_embedded.inc +# remove the next line after bug #55503 is fixed +-- source include/not_valgrind.inc let $innodb_file_format_check_orig=`select @@innodb_file_format_check`; === modified file 'mysql-test/suite/innodb_plugin/t/innodb-autoinc.test' --- a/mysql-test/suite/innodb_plugin/t/innodb-autoinc.test 2010-04-09 13:25:17 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb-autoinc.test 2010-07-30 14:09:24 +0000 @@ -1,6 +1,8 @@ -- source include/have_innodb_plugin.inc # embedded server ignores 'delayed', so skip this -- source include/not_embedded.inc +# remove the next line after bug #55503 is fixed +-- source include/not_valgrind.inc let $innodb_file_format_check_orig=`select @@innodb_file_format_check`; === modified file 'mysql-test/suite/innodb_plugin/t/innodb-consistent-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb-consistent-master.opt 2010-04-09 12:56:51 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb-consistent-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=2 +--loose-innodb_lock_wait_timeout=2 === modified file 'mysql-test/suite/innodb_plugin/t/innodb-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb-master.opt 2010-04-09 12:56:51 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---binlog_cache_size=32768 --innodb_lock_wait_timeout=1 +--binlog_cache_size=32768 --loose-innodb_lock_wait_timeout=1 === modified file 'mysql-test/suite/innodb_plugin/t/innodb-semi-consistent-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb-semi-consistent-master.opt 2010-04-09 12:56:51 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb-semi-consistent-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=2 +--loose-innodb_lock_wait_timeout=2 === modified file 'mysql-test/suite/innodb_plugin/t/innodb-use-sys-malloc-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb-use-sys-malloc-master.opt 2010-04-09 12:56:51 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb-use-sys-malloc-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb-use-sys-malloc=true +--loose-innodb-use-sys-malloc=true === modified file 'mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt 2010-06-03 09:48:59 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb_autoinc_lock_mode_zero-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb-autoinc-lock-mode=0 +--loose-innodb-autoinc-lock-mode=0 === modified file 'mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt 2010-06-03 09:48:59 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug30919-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb --innodb_autoinc_lock_mode=0 +--loose-innodb_autoinc_lock_mode=0 === modified file 'mysql-test/suite/innodb_plugin/t/innodb_bug39438-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb_bug39438-master.opt 2010-04-09 12:56:51 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug39438-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb-file-per-table=1 +--loose-innodb-file-per-table=1 === modified file 'mysql-test/suite/innodb_plugin/t/innodb_bug42101-nonzero-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb_bug42101-nonzero-master.opt 2010-04-09 12:56:51 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug42101-nonzero-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_commit_concurrency=1 +--loose-innodb_commit_concurrency=1 === modified file 'mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt 2010-06-02 10:37:14 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53674-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---log-bin --innodb-locks-unsafe-for-binlog --binlog-format=mixed +--log-bin=master-bin --loose-innodb-locks-unsafe-for-binlog --binlog-format=mixed === added file 'mysql-test/suite/innodb_plugin/t/innodb_bug54453.test' --- a/mysql-test/suite/innodb_plugin/t/innodb_bug54453.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb_bug54453.test 2010-07-20 17:36:15 +0000 @@ -0,0 +1,15 @@ +--source include/have_innodb_plugin.inc +--source include/have_log_bin.inc + +--echo # +--echo # Bug#54453: Failing assertion: trx->active_trans when renaming a table with active trx +--echo # + +--disable_warnings +DROP TABLE IF EXISTS bug54453; +--enable_warnings + +CREATE TABLE bug54453(a INT) ENGINE=InnoDB; +ALTER TABLE bug54453 RENAME TO bug54453_2; +SELECT * FROM bug54453_2; +DROP TABLE bug54453_2; === modified file 'mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt 2010-06-03 09:48:59 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb_lock_wait_timeout_1-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=1 +--loose-innodb_lock_wait_timeout=1 === modified file 'mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt 2010-06-03 09:48:59 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb-lock-wait-timeout=2 +--loose-innodb-lock-wait-timeout=2 === modified file 'mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt 2010-06-03 09:48:59 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql_rbk-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=1 --innodb_rollback_on_timeout=1 +--loose-innodb_lock_wait_timeout=1 --loose-innodb_rollback_on_timeout=1 === modified file 'mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt' --- a/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt 2010-06-03 09:48:59 +0000 +++ b/mysql-test/suite/innodb_plugin/t/innodb_timeout_rollback-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=2 --innodb_rollback_on_timeout +--loose-innodb_lock_wait_timeout=2 --loose-innodb_rollback_on_timeout === modified file 'mysql-test/suite/maria/r/maria.result' --- a/mysql-test/suite/maria/r/maria.result 2010-08-02 09:22:36 +0000 +++ b/mysql-test/suite/maria/r/maria.result 2010-08-10 21:58:08 +0000 @@ -2139,7 +2139,7 @@ Data records: 0 D Block_size: 8192 Recordlength: 99 -table description: +Table description: Key Start Len Index Type 1 2 30 multip. varchar 2 33 30 multip. char NULL @@ -2607,3 +2607,20 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 drop table t1; +CREATE TABLE t1 ( f1 DOUBLE , f2 DOUBLE , f3 DOUBLE , f4 DOUBLE , v3 DOUBLE , v4 DOUBLE , KEY ( v3 ) , KEY ( v4 ) ) engine=maria; +REPLACE t1 ( f2 , f1 ) VALUES ( f2 , 56 ) ; +INSERT t1 ( f1 , f2 , f3 , f4 ) VALUES ( 0 , f2 , 8 , f3 ) ; +INSERT t1 ( f4 , f2 ) VALUES ( 4 , 92 ) ; +DELETE FROM t1 WHERE v3 = 173 OR v4 = 9 ; +drop table t1; +CREATE TABLE t1 ( +f1 CHAR(255) BINARY , +f2 CHAR(255) BINARY NOT NULL DEFAULT '0', +f3 CHAR(255) BINARY NOT NULL , +f4 CHAR(255) BINARY NOT NULL DEFAULT '0' , +v3 CHAR(255) BINARY NOT NULL DEFAULT '0' , +KEY (v3) +) ENGINE=Maria; +INSERT INTO t1 ( f1 , f2 , f3 , f4 ) SELECT f1 , f4 , f1 , f4 FROM t1; +DELETE FROM t1; +drop table t1; === modified file 'mysql-test/suite/maria/r/maria3.result' --- a/mysql-test/suite/maria/r/maria3.result 2010-06-13 22:13:32 +0000 +++ b/mysql-test/suite/maria/r/maria3.result 2010-08-24 22:18:01 +0000 @@ -310,12 +310,12 @@ maria_log_file_size 4294959104 maria_log_purge_type immediate maria_max_sort_file_size 9223372036853727232 maria_pagecache_age_threshold 300 -maria_pagecache_buffer_size 8384512 +maria_pagecache_buffer_size 134213632 maria_pagecache_division_limit 100 maria_page_checksum OFF maria_recover NORMAL maria_repair_threads 1 -maria_sort_buffer_size 8388608 +maria_sort_buffer_size 134217728 maria_stats_method nulls_unequal maria_sync_log_dir NEWFILE show status like 'maria%'; === modified file 'mysql-test/suite/maria/t/maria.test' --- a/mysql-test/suite/maria/t/maria.test 2010-08-02 09:22:36 +0000 +++ b/mysql-test/suite/maria/t/maria.test 2010-08-07 14:42:30 +0000 @@ -1881,6 +1881,38 @@ Create table t1 (a int) engine="aria"; show create table t1; drop table t1; +# +# Test of LP#614265. This happens when we where using quick_range_select in +# delete +# + +CREATE TABLE t1 ( f1 DOUBLE , f2 DOUBLE , f3 DOUBLE , f4 DOUBLE , v3 DOUBLE , v4 DOUBLE , KEY ( v3 ) , KEY ( v4 ) ) engine=maria; +REPLACE t1 ( f2 , f1 ) VALUES ( f2 , 56 ) ; +INSERT t1 ( f1 , f2 , f3 , f4 ) VALUES ( 0 , f2 , 8 , f3 ) ; +INSERT t1 ( f4 , f2 ) VALUES ( 4 , 92 ) ; +DELETE FROM t1 WHERE v3 = 173 OR v4 = 9 ; +drop table t1; + +# +# Test for LP#61465 Memory corruption with (M)aria storage engine and +# virtual columns +# + +CREATE TABLE t1 ( + f1 CHAR(255) BINARY , + f2 CHAR(255) BINARY NOT NULL DEFAULT '0', + f3 CHAR(255) BINARY NOT NULL , + f4 CHAR(255) BINARY NOT NULL DEFAULT '0' , + v3 CHAR(255) BINARY NOT NULL DEFAULT '0' , + KEY (v3) +) ENGINE=Maria; +INSERT INTO t1 ( f1 , f2 , f3 , f4 ) SELECT f1 , f4 , f1 , f4 FROM t1; +DELETE FROM t1; +drop table t1; + +# +# End of test +# # Set defaults back --disable_result_log --disable_query_log === modified file 'mysql-test/suite/ndb_team/t/rpl_ndb_mix_innodb-master.opt' --- a/mysql-test/suite/ndb_team/t/rpl_ndb_mix_innodb-master.opt 2008-01-04 14:33:01 +0000 +++ b/mysql-test/suite/ndb_team/t/rpl_ndb_mix_innodb-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb --default-storage-engine=innodb +--loose-innodb --default-storage-engine=innodb === modified file 'mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt' --- a/mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt 2010-03-17 14:10:41 +0000 +++ b/mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_file_per_table=1 +--loose-innodb_file_per_table=1 === modified file 'mysql-test/suite/parts/t/partition_special_innodb-master.opt' --- a/mysql-test/suite/parts/t/partition_special_innodb-master.opt 2008-08-20 15:29:14 +0000 +++ b/mysql-test/suite/parts/t/partition_special_innodb-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=2 +--loose-innodb_lock_wait_timeout=2 === modified file 'mysql-test/suite/pbxt/my.cnf' --- a/mysql-test/suite/pbxt/my.cnf 2009-10-26 11:35:42 +0000 +++ b/mysql-test/suite/pbxt/my.cnf 2010-08-17 07:14:46 +0000 @@ -2,6 +2,7 @@ !include include/default_mysqld.cnf [mysqld.1] +pbxt default-storage-engine=pbxt [ENV] === modified file 'mysql-test/suite/pbxt/r/range.result' --- a/mysql-test/suite/pbxt/r/range.result 2010-05-06 12:43:19 +0000 +++ b/mysql-test/suite/pbxt/r/range.result 2010-08-10 16:06:34 +0000 @@ -420,19 +420,19 @@ analyze table t1,t2; Table Op Msg_type Msg_text test.t1 analyze status OK test.t2 analyze status OK -explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; +explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 -explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; +explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 -explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; +explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 -explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; +explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 === modified file 'mysql-test/suite/pbxt/t/range.test' --- a/mysql-test/suite/pbxt/t/range.test 2009-04-03 09:12:59 +0000 +++ b/mysql-test/suite/pbxt/t/range.test 2010-08-10 16:06:34 +0000 @@ -380,10 +380,13 @@ select count(*) from t2; analyze table t1,t2; -explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; -explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; -explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; -explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; +# This part doesn't make sense for pbxt as the result may vary becasue +# records_in_range() gives same results for t1 and t2. +# Added straight_join to get predictable results +explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; +explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; +explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; +explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; === added file 'mysql-test/suite/pbxt/t/skip_name_resolve-master.opt' --- a/mysql-test/suite/pbxt/t/skip_name_resolve-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/pbxt/t/skip_name_resolve-master.opt 2010-08-06 12:39:37 +0000 @@ -0,0 +1 @@ +--force-restart === removed file 'mysql-test/suite/pbxt/t/suite.opt' --- a/mysql-test/suite/pbxt/t/suite.opt 2010-03-30 12:36:49 +0000 +++ b/mysql-test/suite/pbxt/t/suite.opt 1970-01-01 00:00:00 +0000 @@ -1 +0,0 @@ ---default-storage-engine=pbxt === modified file 'mysql-test/suite/percona/percona_innodb_doublewrite_file-master.opt' --- a/mysql-test/suite/percona/percona_innodb_doublewrite_file-master.opt 2010-08-03 10:54:05 +0000 +++ b/mysql-test/suite/percona/percona_innodb_doublewrite_file-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_doublewrite_file=ib_doublewrite +--loose-innodb_doublewrite_file=ib_doublewrite === modified file 'mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test' --- a/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test 2010-08-04 08:39:53 +0000 +++ b/mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test 2010-08-07 14:42:30 +0000 @@ -1,3 +1,5 @@ +-- source include/not_windows.inc + -- echo # Activate master-slave replication -- source include/master-slave.inc === modified file 'mysql-test/suite/percona/percona_log_slow_slave_statements.test' --- a/mysql-test/suite/percona/percona_log_slow_slave_statements.test 2010-08-05 09:28:19 +0000 +++ b/mysql-test/suite/percona/percona_log_slow_slave_statements.test 2010-08-07 14:42:30 +0000 @@ -1,3 +1,5 @@ +-- source include/not_windows.inc + -- echo # Activate master-slave replication -- source include/master-slave.inc === modified file 'mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test' --- a/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test 2010-08-05 09:28:19 +0000 +++ b/mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test 2010-08-07 14:42:30 +0000 @@ -1,3 +1,5 @@ +--source include/not_windows.inc + source include/have_innodb.inc; SELECT sleep(2); set global log_slow_verbosity=innodb; === modified file 'mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test' --- a/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test 2010-08-05 09:28:19 +0000 +++ b/mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test 2010-08-07 14:42:30 +0000 @@ -1,3 +1,5 @@ +-- source include/not_windows.inc + source include/have_innodb.inc; SET GLOBAL SLOW_QUERY_LOG=OFF; === modified file 'mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test' --- a/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test 2010-08-05 09:28:19 +0000 +++ b/mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test 2010-08-07 14:42:30 +0000 @@ -1,3 +1,5 @@ +-- source include/not_windows.inc + source include/have_innodb.inc; SELECT sleep(2); === modified file 'mysql-test/suite/percona/percona_slow_query_log-long_query_time.test' --- a/mysql-test/suite/percona/percona_slow_query_log-long_query_time.test 2010-08-06 07:46:51 +0000 +++ b/mysql-test/suite/percona/percona_slow_query_log-long_query_time.test 2010-08-07 14:42:30 +0000 @@ -1,3 +1,4 @@ +source include/not_windows.inc; source include/have_innodb.inc; SELECT sleep(1); === modified file 'mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test' --- a/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test 2010-08-05 09:28:19 +0000 +++ b/mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test 2010-08-07 14:42:30 +0000 @@ -1,3 +1,4 @@ +source include/not_windows.inc; source include/have_innodb.inc; SELECT sleep(2); === modified file 'mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test' --- a/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test 2010-08-05 09:28:19 +0000 +++ b/mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test 2010-08-07 14:42:30 +0000 @@ -1,3 +1,4 @@ +source include/not_windows.inc; source include/have_innodb.inc; SET GLOBAL SLOW_QUERY_LOG=OFF; === modified file 'mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test' --- a/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test 2010-08-05 09:28:19 +0000 +++ b/mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test 2010-08-07 14:42:30 +0000 @@ -1,3 +1,4 @@ +source include/not_windows.inc; source include/have_innodb.inc; SELECT sleep(1); === added file 'mysql-test/suite/rpl/r/rpl_conditional_comments.result' --- a/mysql-test/suite/rpl/r/rpl_conditional_comments.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/rpl/r/rpl_conditional_comments.result 2010-07-29 03:00:57 +0000 @@ -0,0 +1,57 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +CREATE TABLE t1(c1 INT); +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) + +# Case 1: +# ------------------------------------------------------------------ +# In a statement, some CCs are applied while others are not. The CCs +# which are not applied on master will be binlogged as common comments. +/*!99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!99999 ,(11)*/; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; /* 99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /* 99999 ,(11)*/ +Comparing tables master:test.t1 and slave:test.t1 + +# Case 2: +# ----------------------------------------------------------------- +# Verify whether it can be binlogged correctly when executing prepared +# statement. +PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/'; +EXECUTE stmt; +DROP TABLE t1; +CREATE TABLE t1(c1 INT); +EXECUTE stmt; +Comparing tables master:test.t1 and slave:test.t1 + +SET @value=62; +PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/'; +EXECUTE stmt USING @value; +DROP TABLE t1; +CREATE TABLE t1(c1 INT); +EXECUTE stmt USING @value; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/ +master-bin.000001 # Query # # use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) +master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/ +master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/ +master-bin.000001 # Query # # use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT) +master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/ +Comparing tables master:test.t1 and slave:test.t1 + +# Case 3: +# ----------------------------------------------------------------- +# Verify it can restore the '!', if the it is an uncomplete conditional +# comments +SELECT c1 FROM /*!99999 t1 WHEREN; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!99999 t1 WHEREN' at line 1 +DROP TABLE t1; === added file 'mysql-test/suite/rpl/r/rpl_current_user.result' --- a/mysql-test/suite/rpl/r/rpl_current_user.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/rpl/r/rpl_current_user.result 2010-07-04 04:02:49 +0000 @@ -0,0 +1,205 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; + +# On slave2 +# Connect slave2 to slave +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_MYPORT;, +MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; +START SLAVE; + +# [On master] +DROP VIEW IF EXISTS v_user; +DROP VIEW IF EXISTS v_tables_priv; +DROP VIEW IF EXISTS v_procs_priv; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS my_grant; +DROP PROCEDURE IF EXISTS my_revoke; +DROP FUNCTION IF EXISTS my_user; +DROP EVENT IF EXISTS e1; +CREATE TABLE t1(c1 char(100)); +CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1'; +CREATE PROCEDURE p1() SELECT 1; +# bug48321_1-01234 has the max length(16) of user. +GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION; + +# Make sure the max lengths of user and host +# the user name is too lengh +GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost'; +ERROR HY000: String '01234567890123456' is too long for user name (should be no longer than 16) +# the host name is too lengh +GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890'; +ERROR HY000: String '0123456789012345678901234567890123456789012345678901234567890' is too long for host name (should be no longer than 60) + +# User 'bug48321_1-01234' connects to master by conn1 +# [On conn1] +# Verify 'REVOKE ALL' statement +REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'GRANT ... ON TABLE ...' statement +GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'GRANT ... ON PROCEDURE...' statement +GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); +Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv +Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv + +# Verify 'GRANT ... ON *.* ...' statement +GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; +Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv +Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv + +# Verify 'REVOKE ... ON TABLE ...' statement +REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'REVOKE ... ON PROCEDURE...' statement +REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); +Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv +Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv + +# Verify 'REVOKE ... ON *.* ...' statement +REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'GRANT ...' statement in the procedure +CREATE PROCEDURE my_grant() +GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +call my_grant; +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'REVOKE ... ON TABLE ...' statement in the procedure +CREATE PROCEDURE my_revoke() +REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +call my_revoke; +Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv +Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv + +# Verify 'RENAME USER ...' statement +RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'DROP USER ...' statement +GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; +DROP USER CURRENT_USER(); +Comparing tables master:test.v_user and slave:test.v_user +Comparing tables master:test.v_user and slave2:test.v_user + +# Verify 'ALTER EVENT...' statement +CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; +# Explicitly assign CURRENT_USER() to definer +ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; +Comparing tables master:test.v_event and slave:test.v_event +Comparing tables master:test.v_event and slave2:test.v_event + +# Session user will be set as definer, if the statement does not assign +# a definer +ALTER EVENT e1 ENABLE; +Comparing tables master:test.v_event and slave:test.v_event +Comparing tables master:test.v_event and slave2:test.v_event + +# Verify that this patch does not affect the calling of CURRENT_USER() +# in the other statements +# [On master] +INSERT INTO t1 VALUES(CURRENT_USER()), ('1234'); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT * FROM t1; +c1 +root@localhost +1234 +# [On slave] +SELECT * FROM t1; +c1 +@ +1234 +# [On slave2] +SELECT * FROM t1; +c1 +@ +1234 +# [On master] +UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234'; +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT * FROM t1; +c1 +root@localhost +root@localhost +# [On slave] +SELECT * FROM t1; +c1 +@ +@ +# [On slave2] +SELECT * FROM t1; +c1 +@ +@ +# [On master] +DELETE FROM t1 WHERE c1=CURRENT_USER(); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +SELECT * FROM t1; +c1 +# [On slave] +SELECT * FROM t1; +c1 +# [On slave2] +SELECT * FROM t1; +c1 +# [On master] +CREATE TABLE t2(c1 char(100)); +CREATE FUNCTION my_user() RETURNS VARCHAR(64) +SQL SECURITY INVOKER +BEGIN +INSERT INTO t2 VALUES(CURRENT_USER()); +RETURN CURRENT_USER(); +END | +INSERT INTO t1 VALUES(my_user()); +Warnings: +Note 1592 Statement may not be safe to log in statement format. +Note 1592 Statement may not be safe to log in statement format. +SELECT * FROM t1; +c1 +root@localhost +SELECT * FROM t2; +c1 +root@localhost +# [On slave] +SELECT * FROM t1; +c1 +@ +SELECT * FROM t2; +c1 +@ +# [On slave2] +SELECT * FROM t1; +c1 +@ +SELECT * FROM t2; +c1 +@ + +# END +DROP TABLE t1, t2; +DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event; +DROP PROCEDURE p1; +DROP PROCEDURE my_grant; +DROP PROCEDURE my_revoke; +DROP FUNCTION my_user; +DROP EVENT e1; === modified file 'mysql-test/suite/rpl/r/rpl_drop.result' --- a/mysql-test/suite/rpl/r/rpl_drop.result 2007-06-27 12:28:02 +0000 +++ b/mysql-test/suite/rpl/r/rpl_drop.result 2010-08-02 19:48:56 +0000 @@ -8,3 +8,27 @@ drop table if exists t1, t2; create table t1 (a int); drop table t1, t2; ERROR 42S02: Unknown table 't2' +include/stop_slave.inc +SET @old_binlog_format= @@global.binlog_format; +SET GLOBAL binlog_format = ROW; +include/start_slave.inc +SET @old_binlog_format= @@global.binlog_format; +SET binlog_format = ROW; +CREATE TABLE t2(a INT) ENGINE=MYISAM; +CREATE TABLE t3(a INT) ENGINE=INNODB; +CREATE FUNCTION f1() RETURNS INT +BEGIN +insert into t2 values(1); +insert into t3 values(1); +return 1; +END| +CREATE TABLE t1(UNIQUE(a)) ENGINE=MYISAM SELECT 1 AS a UNION ALL SELECT f1(); +ERROR 23000: Duplicate entry '1' for key 'a' +CREATE TABLE t1(UNIQUE(a)) ENGINE=INNODB SELECT 1 AS a UNION ALL SELECT f1(); +ERROR 23000: Duplicate entry '1' for key 'a' +show binlog events in 'master-bin.000001' from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +DROP FUNCTION f1; +DROP TABLE t2, t3; +SET @@global.binlog_format= @old_binlog_format; +SET @@global.binlog_format= @old_binlog_format; === modified file 'mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result' --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result 2010-06-28 20:59:41 +0000 +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result 2010-07-04 04:02:49 +0000 @@ -750,7 +750,7 @@ test_rpl e2 root@localhost SYSTEM RECURR USE test_rpl; SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation -test_rpl e2 @ SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci ==========MASTER========== SELECT COUNT(*) FROM t1; COUNT(*) === modified file 'mysql-test/suite/rpl/r/rpl_packet.result' --- a/mysql-test/suite/rpl/r/rpl_packet.result 2009-09-24 13:19:06 +0000 +++ b/mysql-test/suite/rpl/r/rpl_packet.result 2010-07-20 15:27:13 +0000 @@ -49,6 +49,14 @@ Slave_IO_Running = No (expect No) SELECT "Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'" AS Last_IO_Error; Last_IO_Error Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master' +STOP SLAVE; +RESET SLAVE; +RESET MASTER; +SET @max_allowed_packet_0= @@session.max_allowed_packet; +SHOW BINLOG EVENTS; +SET @max_allowed_packet_1= @@session.max_allowed_packet; +SHOW BINLOG EVENTS; +SET @max_allowed_packet_2= @@session.max_allowed_packet; ==== clean up ==== DROP TABLE t1; SET @@global.max_allowed_packet= 1024; === modified file 'mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt' --- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt 2007-06-27 12:28:02 +0000 +++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb +--loose-innodb === modified file 'mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt' --- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt 2007-06-27 12:28:02 +0000 +++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs-slave.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb +--loose-innodb === modified file 'mysql-test/suite/rpl/rpl_1slave_base.cnf' --- a/mysql-test/suite/rpl/rpl_1slave_base.cnf 2008-11-04 17:07:14 +0000 +++ b/mysql-test/suite/rpl/rpl_1slave_base.cnf 2010-08-17 07:14:46 +0000 @@ -8,8 +8,6 @@ log-bin= master-bin -loose-innodb - [mysqld.2] # Run the slave.sh script before starting this process #!run-slave-sh @@ -18,7 +16,6 @@ loose-innodb # starting the mysqld #!use-slave-opt -log-bin= slave-bin relay-log= slave-relay-bin init-rpl-role= slave === modified file 'mysql-test/suite/rpl/t/rpl_begin_commit_rollback-master.opt' --- a/mysql-test/suite/rpl/t/rpl_begin_commit_rollback-master.opt 2010-03-28 11:57:33 +0000 +++ b/mysql-test/suite/rpl/t/rpl_begin_commit_rollback-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb --binlog-ignore-db=db2 +--loose-innodb --binlog-ignore-db=db2 === modified file 'mysql-test/suite/rpl/t/rpl_begin_commit_rollback-slave.opt' --- a/mysql-test/suite/rpl/t/rpl_begin_commit_rollback-slave.opt 2009-05-31 05:44:41 +0000 +++ b/mysql-test/suite/rpl/t/rpl_begin_commit_rollback-slave.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb --replicate-do-db=db1 +--loose-innodb --replicate-do-db=db1 === modified file 'mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf' --- a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf 2008-04-25 16:54:42 +0000 +++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf 2010-08-17 07:14:46 +0000 @@ -2,19 +2,19 @@ [mysqld.1] log-slave-updates -innodb +loose-innodb [mysqld.2] log-slave-updates -innodb +loose-innodb [mysqld.3] log-slave-updates -innodb +loose-innodb [mysqld.4] log-slave-updates -innodb +loose-innodb [ENV] SLAVE_MYPORT1= @mysqld.3.port === modified file 'mysql-test/suite/rpl/t/rpl_concurrency_error-master.opt' --- a/mysql-test/suite/rpl/t/rpl_concurrency_error-master.opt 2009-07-06 08:02:14 +0000 +++ b/mysql-test/suite/rpl/t/rpl_concurrency_error-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb-lock-wait-timeout=1 +--loose-innodb-lock-wait-timeout=1 === added file 'mysql-test/suite/rpl/t/rpl_conditional_comments.test' --- a/mysql-test/suite/rpl/t/rpl_conditional_comments.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/rpl/t/rpl_conditional_comments.test 2010-07-29 03:00:57 +0000 @@ -0,0 +1,74 @@ +############################################################################### +# After the patch for BUG#49124: +# - Use ' ' instead of '!' in the conditional comments which are not applied on +# master. So they become common comments and will not be applied on slave. +# +# - Example: +# 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /*!99999 ,(3)*/ +# will be binlogged as +# 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/'. +############################################################################### +source include/master-slave.inc; +source include/have_binlog_format_statement.inc; + +CREATE TABLE t1(c1 INT); +source include/show_binlog_events.inc; +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); + +--echo +--echo # Case 1: +--echo # ------------------------------------------------------------------ +--echo # In a statement, some CCs are applied while others are not. The CCs +--echo # which are not applied on master will be binlogged as common comments. + +/*!99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!99999 ,(11)*/; + +source include/show_binlog_events.inc; +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); +sync_slave_with_master; +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +--echo +--echo # Case 2: +--echo # ----------------------------------------------------------------- +--echo # Verify whether it can be binlogged correctly when executing prepared +--echo # statement. +PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/'; +EXECUTE stmt; +DROP TABLE t1; +CREATE TABLE t1(c1 INT); +EXECUTE stmt; + +sync_slave_with_master; +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +--echo +SET @value=62; +PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/'; +EXECUTE stmt USING @value; +DROP TABLE t1; +CREATE TABLE t1(c1 INT); +EXECUTE stmt USING @value; + +source include/show_binlog_events.inc; +let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); + +sync_slave_with_master; +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +--echo +--echo # Case 3: +--echo # ----------------------------------------------------------------- +--echo # Verify it can restore the '!', if the it is an uncomplete conditional +--echo # comments +--error 1064 +SELECT c1 FROM /*!99999 t1 WHEREN; + +DROP TABLE t1; +source include/master-slave-end.inc; === added file 'mysql-test/suite/rpl/t/rpl_current_user.cnf' --- a/mysql-test/suite/rpl/t/rpl_current_user.cnf 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/rpl/t/rpl_current_user.cnf 2010-07-04 04:02:49 +0000 @@ -0,0 +1,9 @@ +!include ../my.cnf + +[mysqld.3] +server-id=3 +log-bin=slave-bin + +[ENV] +SLAVE_MYPORT1= @mysqld.3.port +SLAVE_MYSOCK1= @mysqld.3.socket === added file 'mysql-test/suite/rpl/t/rpl_current_user.test' --- a/mysql-test/suite/rpl/t/rpl_current_user.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/rpl/t/rpl_current_user.test 2010-07-04 04:02:49 +0000 @@ -0,0 +1,238 @@ +############################################################################## +# BUG#48321 CURRENT_USER() incorrectly replicated for DROP/RENAME USER, +# REVOKE, GRANT, ALTER EVENT +# +# Calling CURRENT_USER() results into inconsistency between slave and master, +# as the slave SQL thread has different user with common users. +# +# After the patch for bug#48321, session's user will be written into query log +# event if CURRENT_USER() is called in 'DROP/RENAME USER', 'REVOKE', 'GRANT', +# 'ALTER EVENT'. +# +############################################################################## +source include/master-slave.inc; +source include/have_binlog_format_statement.inc; + +--echo +--echo # On slave2 +connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT1,); +connection slave2; + +--echo # Connect slave2 to slave +--replace_result $SLAVE_MYPORT SLAVE_MYPORT; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, + MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root'; +START SLAVE; +source include/wait_for_slave_to_start.inc; + +--echo +--echo # [On master] +connection master; +--disable_warnings +DROP VIEW IF EXISTS v_user; +DROP VIEW IF EXISTS v_tables_priv; +DROP VIEW IF EXISTS v_procs_priv; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS my_grant; +DROP PROCEDURE IF EXISTS my_revoke; +DROP FUNCTION IF EXISTS my_user; +DROP EVENT IF EXISTS e1; +--enable_warnings +CREATE TABLE t1(c1 char(100)); +CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%'; +CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1'; +CREATE PROCEDURE p1() SELECT 1; +--echo # bug48321_1-01234 has the max length(16) of user. +GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION; + +--echo +--echo # Make sure the max lengths of user and host +--echo # the user name is too lengh +--error 1470 +GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost'; +--echo # the host name is too lengh +--error 1470 +GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890'; + +--echo +--echo # User 'bug48321_1-01234' connects to master by conn1 +connect (conn1, 127.0.0.1, 'bug48321_1-01234'@'localhost',,); +connection conn1; +--echo # [On conn1] +--echo # Verify 'REVOKE ALL' statement +REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER(); +let $diff_table= test.v_user; +let $diff_server_list= master, slave, slave2; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ... ON TABLE ...' statement +connection conn1; +GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ... ON PROCEDURE...' statement +connection conn1; +GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER(); +let $diff_table= test.v_procs_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ... ON *.* ...' statement +connection conn1; +GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON TABLE ...' statement +connection conn1; +REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON PROCEDURE...' statement +connection conn1; +REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER(); +let $diff_table= test.v_procs_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON *.* ...' statement +connection conn1; +REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER(); +let $diff_table= test.v_user; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'GRANT ...' statement in the procedure +connection conn1; +CREATE PROCEDURE my_grant() + GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER(); +call my_grant; +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'REVOKE ... ON TABLE ...' statement in the procedure +connection conn1; +CREATE PROCEDURE my_revoke() + REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER(); +call my_revoke; +let $diff_table= test.v_tables_priv; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'RENAME USER ...' statement +connection conn1; +RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost'; +let $diff_table= test.v_user; +source include/rpl_diff_tables.inc; + +disconnect conn1; + +--echo +--echo # Verify 'DROP USER ...' statement +connection master; +GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost'; +connect (conn1, 127.0.0.1, 'bug48321_2'@'localhost',,); +connection conn1; +DROP USER CURRENT_USER(); +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify 'ALTER EVENT...' statement +connection master; +CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; + +--echo # Explicitly assign CURRENT_USER() to definer +ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; +let $diff_table= test.v_event; +source include/rpl_diff_tables.inc; + +connection master; +--echo +--echo # Session user will be set as definer, if the statement does not assign +--echo # a definer +ALTER EVENT e1 ENABLE; +sync_slave_with_master; +source include/rpl_diff_tables.inc; + +--echo +--echo # Verify that this patch does not affect the calling of CURRENT_USER() +--echo # in the other statements +connection master; +--echo # [On master] +INSERT INTO t1 VALUES(CURRENT_USER()), ('1234'); +SELECT * FROM t1; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +--echo # [On slave2] +sync_slave_with_master slave2; +SELECT * FROM t1; + +connection master; +--echo # [On master] +UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234'; +SELECT * FROM t1; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +sync_slave_with_master slave2; +--echo # [On slave2] +SELECT * FROM t1; + +connection master; +--echo # [On master] +DELETE FROM t1 WHERE c1=CURRENT_USER(); +SELECT * FROM t1; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +sync_slave_with_master slave2; +--echo # [On slave2] +SELECT * FROM t1; + +connection master; +--echo # [On master] +CREATE TABLE t2(c1 char(100)); + +DELIMITER |; +CREATE FUNCTION my_user() RETURNS VARCHAR(64) + SQL SECURITY INVOKER +BEGIN + INSERT INTO t2 VALUES(CURRENT_USER()); + RETURN CURRENT_USER(); +END | +DELIMITER ;| + +INSERT INTO t1 VALUES(my_user()); +SELECT * FROM t1; +SELECT * FROM t2; +sync_slave_with_master; +--echo # [On slave] +SELECT * FROM t1; +SELECT * FROM t2; +sync_slave_with_master slave2; +--echo # [On slave2] +SELECT * FROM t1; +SELECT * FROM t2; + +--echo +--echo # END +connection master; +DROP TABLE t1, t2; +DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event; +DROP PROCEDURE p1; +DROP PROCEDURE my_grant; +DROP PROCEDURE my_revoke; +DROP FUNCTION my_user; +DROP EVENT e1; +sync_slave_with_master; +sync_slave_with_master slave2; +source include/master-slave-end.inc; === added file 'mysql-test/suite/rpl/t/rpl_ddl-slave.opt' --- a/mysql-test/suite/rpl/t/rpl_ddl-slave.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/rpl/t/rpl_ddl-slave.opt 2010-08-17 07:14:46 +0000 @@ -0,0 +1 @@ +--loose-skip-innodb === modified file 'mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt' --- a/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt 2008-10-29 13:25:03 +0000 +++ b/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=4 --slave-transaction-retries=2 --max-relay-log-size=4096 +--loose-innodb-lock-wait-timeout=4 --slave-transaction-retries=2 --max-relay-log-size=4096 === modified file 'mysql-test/suite/rpl/t/rpl_drop.test' --- a/mysql-test/suite/rpl/t/rpl_drop.test 2007-06-27 12:28:02 +0000 +++ b/mysql-test/suite/rpl/t/rpl_drop.test 2010-08-02 19:48:56 +0000 @@ -1,6 +1,7 @@ # Testcase for BUG#4552 (DROP on two tables, one of which does not # exist, must be binlogged with a non-zero error code) source include/master-slave.inc; +source include/have_innodb.inc; --disable_warnings drop table if exists t1, t2; --enable_warnings @@ -10,7 +11,57 @@ drop table t1, t2; save_master_pos; connection slave; sync_with_master; - # End of 4.1 tests +# BUG#55625 RBR breaks on failing 'CREATE TABLE' +# A CREATE...SELECT that fails is written to the binary log if a non-transactional +# statement is updated. If the logging format is ROW, the CREATE statement and the +# changes are written to the binary log as distinct events and by consequence the +# created table is not rolled back in the slave. +# To fix the problem, we do not write a CREATE...SELECT that fails to the binary +# log. Howerver, the changes to non-transactional tables are not replicated and +# thus the slave goes out of sync. This should be fixed after BUG#47899. +# +# In the test case, we verify if the binary log contains no information for a +# CREATE...SELECT that fails. +connection slave; + +--source include/stop_slave.inc +SET @old_binlog_format= @@global.binlog_format; +SET GLOBAL binlog_format = ROW; +--source include/start_slave.inc + +connection master; +SET @old_binlog_format= @@global.binlog_format; +SET binlog_format = ROW; + +CREATE TABLE t2(a INT) ENGINE=MYISAM; +CREATE TABLE t3(a INT) ENGINE=INNODB; + +delimiter |; +CREATE FUNCTION f1() RETURNS INT +BEGIN + insert into t2 values(1); + insert into t3 values(1); + return 1; +END| +delimiter ;| + +let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1); +let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1); + +--error 1062 +CREATE TABLE t1(UNIQUE(a)) ENGINE=MYISAM SELECT 1 AS a UNION ALL SELECT f1(); +--error 1062 +CREATE TABLE t1(UNIQUE(a)) ENGINE=INNODB SELECT 1 AS a UNION ALL SELECT f1(); + +--source include/show_binlog_events.inc + +DROP FUNCTION f1; +DROP TABLE t2, t3; +SET @@global.binlog_format= @old_binlog_format; + +--sync_slave_with_master +SET @@global.binlog_format= @old_binlog_format; +# End of 5.1 tests === modified file 'mysql-test/suite/rpl/t/rpl_innodb-master.opt' --- a/mysql-test/suite/rpl/t/rpl_innodb-master.opt 2008-10-29 13:25:03 +0000 +++ b/mysql-test/suite/rpl/t/rpl_innodb-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_autoinc_lock_mode=0 +--loose-innodb-autoinc-lock-mode=0 === modified file 'mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt' --- a/mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt 2008-10-29 13:25:03 +0000 +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_autoinc_lock_mode=0 +--loose-innodb-autoinc-lock-mode=0 === modified file 'mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt' --- a/mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt 2008-10-29 13:25:03 +0000 +++ b/mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_autoinc_lock_mode=0 +--loose-innodb-autoinc-lock-mode=0 === modified file 'mysql-test/suite/rpl/t/rpl_packet.test' --- a/mysql-test/suite/rpl/t/rpl_packet.test 2009-09-24 13:19:06 +0000 +++ b/mysql-test/suite/rpl/t/rpl_packet.test 2010-07-20 15:27:13 +0000 @@ -1,7 +1,12 @@ +# ==== Purpose ==== # # Check replication protocol packet size handling -# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave # +# ==== Related bugs ==== +# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave +# BUG#23755: Replicated event larger that max_allowed_packet infinitely re-transmits +# BUG#42914: No LAST_IO_ERROR for max_allowed_packet errors +# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET # max-out size db name source include/master-slave.inc; @@ -119,6 +124,38 @@ let $slave_io_running= query_get_value(S let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1); eval SELECT "$last_io_error" AS Last_IO_Error; +# Remove the bad binlog and clear error status on slave. +STOP SLAVE; +RESET SLAVE; +--connection master +RESET MASTER; + + +# +# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET +# +# In BUG#55322, @@session.max_allowed_packet increased each time SHOW +# BINLOG EVENTS was issued. To verify that this bug is fixed, we +# execute SHOW BINLOG EVENTS twice and check that max_allowed_packet +# never changes. We turn off the result log because we don't care +# about the contents of the binlog. + +--disable_result_log +SET @max_allowed_packet_0= @@session.max_allowed_packet; +SHOW BINLOG EVENTS; +SET @max_allowed_packet_1= @@session.max_allowed_packet; +SHOW BINLOG EVENTS; +SET @max_allowed_packet_2= @@session.max_allowed_packet; +--enable_result_log +if (`SELECT NOT(@max_allowed_packet_0 = @max_allowed_packet_1 AND @max_allowed_packet_1 = @max_allowed_packet_2)`) +{ + --echo ERROR: max_allowed_packet changed after executing SHOW BINLOG EVENTS + --source include/show_rpl_debug_info.inc + SELECT @max_allowed_packet_0, @max_allowed_packet_1, @max_allowed_packet_2; + --die @max_allowed_packet changed after executing SHOW BINLOG EVENTS +} + + --echo ==== clean up ==== connection master; DROP TABLE t1; === modified file 'mysql-test/suite/rpl/t/rpl_start_stop_slave-slave.opt' --- a/mysql-test/suite/rpl/t/rpl_start_stop_slave-slave.opt 2009-03-26 08:25:06 +0000 +++ b/mysql-test/suite/rpl/t/rpl_start_stop_slave-slave.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=60 +--loose-innodb-lock-wait-timeout=60 === modified file 'mysql-test/suite/rpl/t/rpl_trigger.test' --- a/mysql-test/suite/rpl/t/rpl_trigger.test 2010-01-13 09:00:03 +0000 +++ b/mysql-test/suite/rpl/t/rpl_trigger.test 2010-08-17 07:14:46 +0000 @@ -4,6 +4,11 @@ # TODO: Remove statement include once 12574 is patched --source include/have_binlog_format_mixed_or_statement.inc --source include/master-slave.inc +--source include/have_innodb.inc +connection slave; +--source include/have_innodb.inc +connection master; + CALL mtr.add_suppression("Statement may not be safe to log in statement format."); @@ -506,11 +511,9 @@ sync_slave_with_master; connection master; source include/master-slave-reset.inc; -source include/have_innodb.inc; connection slave; -source include/have_innodb.inc; - connection master; + create table t1 ( f int ) engine = innodb; create table log ( r int ) engine = myisam; create trigger tr === modified file 'mysql-test/suite/rpl/t/rpl_typeconv-slave.opt' --- a/mysql-test/suite/rpl/t/rpl_typeconv-slave.opt 2010-03-17 14:28:49 +0000 +++ b/mysql-test/suite/rpl/t/rpl_typeconv-slave.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb \ No newline at end of file +--loose-innodb === modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt' --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt 2008-01-04 14:33:01 +0000 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb --default-storage-engine=innodb --ndbcluster=0 +--loose-innodb --default-storage-engine=innodb --ndbcluster=0 === modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_2other-slave.opt' --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other-slave.opt 2009-05-18 11:39:13 +0000 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other-slave.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb --loose-ndbcluster=OFF --log-slave-updates=0 +--loose-innodb --loose-ndbcluster=OFF --log-slave-updates=0 === modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf' --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf 2008-10-31 14:11:44 +0000 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf 2010-08-17 07:14:46 +0000 @@ -2,15 +2,12 @@ [mysqld.1.1] server-id= 1 -log-bin [mysqld.2.1] server-id= 1 -log-bin [mysqld.1.slave] server-id= 2 -log-bin skip-slave-start [mysqld.2.slave] @@ -21,7 +18,6 @@ master-password= @mysqld.2.1.#password master-user= @mysqld.2.1.#user master-connect-retry= 1 init-rpl-role= slave -log-bin skip-slave-start ndb_connectstring= @mysql_cluster.slave.ndb_connectstring === modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-master.opt' --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-master.opt 2007-06-27 12:28:02 +0000 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb +--loose-innodb === modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans-slave.opt' --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans-slave.opt 2007-06-27 12:28:02 +0000 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans-slave.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb +--loose-innodb === modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-master.opt' --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-master.opt 2008-07-06 10:53:25 +0000 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb +--loose-innodb === modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-slave.opt' --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-slave.opt 2008-07-06 10:53:25 +0000 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-slave.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb +--loose-innodb === modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-master.opt' --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-master.opt 2009-09-23 09:43:43 +0000 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb --ndbcluster +--loose-innodb --ndbcluster === modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt' --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt 2009-09-23 09:43:43 +0000 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb --ndbcluster --replicate-ignore-table=mysql.ndb_apply_status +--loose-innodb --ndbcluster --replicate-ignore-table=mysql.ndb_apply_status === modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb-master.opt' --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb-master.opt 2007-07-04 20:38:53 +0000 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb --default-storage-engine=innodb +--loose-innodb --default-storage-engine=innodb === modified file 'mysql-test/suite/sys_vars/t/autocommit_func-master.opt' --- a/mysql-test/suite/sys_vars/t/autocommit_func-master.opt 2008-12-19 15:12:15 +0000 +++ b/mysql-test/suite/sys_vars/t/autocommit_func-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb +--loose-innodb === modified file 'mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt' --- a/mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt 2008-12-19 15:12:15 +0000 +++ b/mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---secure-file-priv=$MYSQL_TEST_DIR --innodb +--secure-file-priv=$MYSQL_TEST_DIR --loose-innodb === modified file 'mysql-test/suite/sys_vars/t/identity_func-master.opt' --- a/mysql-test/suite/sys_vars/t/identity_func-master.opt 2008-12-19 15:12:15 +0000 +++ b/mysql-test/suite/sys_vars/t/identity_func-master.opt 2010-08-17 07:14:46 +0000 @@ -1,2 +1,2 @@ ---innodb +--loose-innodb === modified file 'mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt' --- a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt 2008-12-19 15:12:15 +0000 +++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt 2010-08-17 07:14:46 +0000 @@ -1,2 +1,2 @@ ---innodb-autoinc-lock-mode=1 +--loose-innodb-autoinc-lock-mode=1 === modified file 'mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt' --- a/mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt 2008-12-19 15:12:15 +0000 +++ b/mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt 2010-08-17 07:14:46 +0000 @@ -1,2 +1,2 @@ ---innodb +--loose-innodb === modified file 'mysql-test/suite/sys_vars/t/max_binlog_cache_size_func-master.opt' --- a/mysql-test/suite/sys_vars/t/max_binlog_cache_size_func-master.opt 2008-12-19 15:12:15 +0000 +++ b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_func-master.opt 2010-08-17 07:14:46 +0000 @@ -1,2 +1,2 @@ --log-bin ---innodb +--loose-innodb === modified file 'mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt' --- a/mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt 2008-12-19 15:12:15 +0000 +++ b/mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb +--loose-innodb === modified file 'mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt' --- a/mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt 2008-12-19 15:12:15 +0000 +++ b/mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt 2010-08-17 07:14:46 +0000 @@ -1,3 +1,3 @@ ---innodb ---innodb_lock_wait_timeout=2 +--loose-innodb +--loose-innodb_lock_wait_timeout=2 --binlog-format=row \ No newline at end of file === modified file 'mysql-test/t/bug46760-master.opt' --- a/mysql-test/t/bug46760-master.opt 2009-09-18 13:01:18 +0000 +++ b/mysql-test/t/bug46760-master.opt 2010-08-17 07:14:46 +0000 @@ -1,2 +1,2 @@ ---innodb-lock-wait-timeout=2 ---innodb-file-per-table +--loose-innodb-lock-wait-timeout=2 +--loose-innodb-file-per-table === modified file 'mysql-test/t/concurrent_innodb_safelog-master.opt' --- a/mysql-test/t/concurrent_innodb_safelog-master.opt 2008-08-15 18:48:14 +0000 +++ b/mysql-test/t/concurrent_innodb_safelog-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=1 +--loose-innodb_lock_wait_timeout=1 === modified file 'mysql-test/t/concurrent_innodb_unsafelog-master.opt' --- a/mysql-test/t/concurrent_innodb_unsafelog-master.opt 2008-08-15 18:48:14 +0000 +++ b/mysql-test/t/concurrent_innodb_unsafelog-master.opt 2010-08-17 07:14:46 +0000 @@ -1,2 +1,2 @@ ---innodb_locks_unsafe_for_binlog ---innodb_lock_wait_timeout=1 +--loose-innodb_locks_unsafe_for_binlog +--loose-innodb_lock_wait_timeout=1 === modified file 'mysql-test/t/connect.cnf' --- a/mysql-test/t/connect.cnf 2009-03-18 15:46:32 +0000 +++ b/mysql-test/t/connect.cnf 2010-08-17 07:14:46 +0000 @@ -5,4 +5,4 @@ extra-port= @mysqld.1.#extra-port extra-max-connections=1 [ENV] -MASTER_EXTRA_PORT= @mysqld.1.extra-port +MASTER_EXTRA_PORT= @mysqld.1.#extra-port === modified file 'mysql-test/t/ctype_filesystem.test' --- a/mysql-test/t/ctype_filesystem.test 2008-12-01 11:34:53 +0000 +++ b/mysql-test/t/ctype_filesystem.test 2010-08-07 14:42:30 +0000 @@ -1,3 +1,5 @@ +--source include/not_windows.inc + SET CHARACTER SET utf8; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR SHOW VARIABLES like 'character_sets_dir'; === modified file 'mysql-test/t/disabled.def' --- a/mysql-test/t/disabled.def 2010-08-02 09:01:24 +0000 +++ b/mysql-test/t/disabled.def 2010-08-11 21:33:15 +0000 @@ -14,3 +14,4 @@ query_cache_28249 : Bug#43861 200 partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings main.mysqlhotcopy_myisam : bug#54129 2010-06-04 Horst main.mysqlhotcopy_archive: bug#54129 2010-06-04 Horst +main.events_time_zone : Test is not predictable as it depends on precise timing. === modified file 'mysql-test/t/events_time_zone.test' --- a/mysql-test/t/events_time_zone.test 2010-08-02 16:39:45 +0000 +++ b/mysql-test/t/events_time_zone.test 2010-08-07 14:42:30 +0000 @@ -5,7 +5,7 @@ # to wait for operation to complete. Should be positive. Test runs # about 25*N seconds (it sleeps most of the time, so CPU speed is not # relevant). -let $N = 5; +let $N = 6; # # 2. Some subtests # - create a new time zone === removed file 'mysql-test/t/exampledb.test' --- a/mysql-test/t/exampledb.test 2006-05-05 17:08:40 +0000 +++ b/mysql-test/t/exampledb.test 1970-01-01 00:00:00 +0000 @@ -1,22 +0,0 @@ -# -# Simple test for the example storage engine -# Taken fromm the select test -# --- source include/have_exampledb.inc - ---disable_warnings -# Clean up if event's test fails -drop database if exists events_test; -drop database if exists events_test2; - -drop table if exists t1; ---enable_warnings - -CREATE TABLE t1 ( - Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, - Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL -) ENGINE=example; - -drop table t1; - -# End of 4.1 tests === modified file 'mysql-test/t/func_gconcat.test' --- a/mysql-test/t/func_gconcat.test 2010-03-31 13:00:56 +0000 +++ b/mysql-test/t/func_gconcat.test 2010-07-23 11:52:54 +0000 @@ -708,6 +708,7 @@ SELECT 1 FROM DROP TABLE t1; +--echo End of 5.0 tests --echo # --echo # Bug #52397: another crash with explain extended and group_concat @@ -719,5 +720,18 @@ EXPLAIN EXTENDED SELECT 1 FROM t1 t2, t1 GROUP BY t1.a) AS d; DROP TABLE t1; +--echo # +--echo # Bug #54476: crash when group_concat and 'with rollup' in prepared statements +--echo # ---echo End of 5.0 tests +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); + +PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP"; +EXECUTE stmt; +EXECUTE stmt; + +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + +--echo End of 5.1 tests === modified file 'mysql-test/t/func_misc.test' --- a/mysql-test/t/func_misc.test 2010-01-11 13:15:28 +0000 +++ b/mysql-test/t/func_misc.test 2010-08-27 14:12:44 +0000 @@ -279,4 +279,16 @@ select NAME_CONST('_id',1234) as id; select connection_id() > 0; +--echo # +--echo # Bug #54461: crash with longblob and union or update with subquery +--echo # + +CREATE TABLE t1 (a INT, b LONGBLOB); +INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2'); + +SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; +SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1; + +DROP TABLE t1; + --echo End of tests === modified file 'mysql-test/t/group_by.test' --- a/mysql-test/t/group_by.test 2010-05-12 16:10:33 +0000 +++ b/mysql-test/t/group_by.test 2010-08-27 14:12:44 +0000 @@ -1219,7 +1219,38 @@ EXPLAIN SELECT MAX(t2.a) FROM t2 LEFT JO SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a; DROP TABLE t1, t2; +# +# min() returns wrong value when used in expression when there is no matching +# rows +# +CREATE TABLE t1 (a int(11) NOT NULL); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 ( + key_col int(11) NOT NULL, + KEY (key_col) +); +INSERT INTO t2 VALUES (1),(2); + +select min(t2.key_col) from t1,t2 where t1.a=1; +select min(t2.key_col) from t1,t2 where t1.a > 1000; +select min(t2.key_col)+1 from t1,t2 where t1.a> 1000; +drop table t1,t2; + +--echo # +--echo # Bug#55188: GROUP BY, GROUP_CONCAT and TEXT - inconsistent results --echo # +CREATE TABLE t1 (a text, b varchar(10)); +INSERT INTO t1 VALUES (repeat('1', 1300),'one'), (repeat('1', 1300),'two'); + +query_vertical EXPLAIN +SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a; +SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a; +query_vertical EXPLAIN +SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a; +SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a; +DROP TABLE t1; + + --echo # End of 5.1 tests === modified file 'mysql-test/t/having.test' --- a/mysql-test/t/having.test 2010-04-12 10:12:20 +0000 +++ b/mysql-test/t/having.test 2010-07-09 10:39:47 +0000 @@ -544,3 +544,24 @@ ORDER BY t1.f2; DROP TABLE t1,t2; --echo End of 5.0 tests + +--echo # +--echo # Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set +--echo # + +CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (1,'f'); + +CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1)); +INSERT INTO t2 VALUES (2,'m'); +INSERT INTO t2 VALUES (3,'m'); +INSERT INTO t2 VALUES (11,NULL); +INSERT INTO t2 VALUES (12,'k'); + +SELECT MAX(t1.f1) field1 +FROM t1 JOIN t2 ON t2.f2 LIKE 'x' +HAVING field1 < 7; + +DROP TABLE t1,t2; + +--echo End of 5.1 tests === modified file 'mysql-test/t/information_schema.test' --- a/mysql-test/t/information_schema.test 2010-08-02 09:01:24 +0000 +++ b/mysql-test/t/information_schema.test 2010-08-27 14:12:44 +0000 @@ -1423,6 +1423,22 @@ FROM INFORMATION_SCHEMA.COLUMNS WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables'; DROP TABLE variables; +--echo # +--echo # Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19, +--echo # should be 20 +--echo # + +CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED); + +SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION + FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig'; + +INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF); +SELECT length(CAST(b AS CHAR)) FROM ubig; + +DROP TABLE ubig; + + --echo End of 5.1 tests. # Wait till all disconnects are completed === modified file 'mysql-test/t/loaddata.test' --- a/mysql-test/t/loaddata.test 2010-06-09 08:29:27 +0000 +++ b/mysql-test/t/loaddata.test 2010-07-14 11:54:51 +0000 @@ -580,4 +580,36 @@ DROP TABLE t1; connection default; disconnect con1; + +--echo # +--echo # Bug #51876 : crash/memory underrun when loading data with ucs2 +--echo # and reverse() function +--echo # + +--echo # Problem # 1 (original report): wrong parsing of ucs2 data +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +--echo # should return 2 zeroes (as the value is truncated) +SELECT * FROM t1; + +DROP TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/tmpp.txt; + + +--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +--echo # should return 0 and 1 (10 reversed) +SELECT * FROM t1; + +DROP TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/tmpp2.txt; + + --echo End of 5.1 tests === modified file 'mysql-test/t/lowercase_view.test' --- a/mysql-test/t/lowercase_view.test 2007-11-13 09:39:52 +0000 +++ b/mysql-test/t/lowercase_view.test 2010-06-25 12:59:44 +0000 @@ -160,4 +160,26 @@ SELECT * FROM v1; DROP VIEW v1; DROP TABLE t1; + +--echo End of 5.0 tests. + + +--echo # +--echo # Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS +--echo # returns nothing +--echo # + +CREATE TABLE `ttt` ( + `f1` char(3) NOT NULL, + PRIMARY KEY (`f1`) +) ENGINE=myisam DEFAULT CHARSET=latin1; + +SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = +'TTT'; +SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT'; + +DROP TABLE `ttt`; + + --echo End of 5.0 tests. + === modified file 'mysql-test/t/mysql_client_test.test' --- a/mysql-test/t/mysql_client_test.test 2008-11-13 19:19:00 +0000 +++ b/mysql-test/t/mysql_client_test.test 2010-07-30 12:17:10 +0000 @@ -2,6 +2,7 @@ -- source include/not_embedded.inc SET @old_general_log= @@global.general_log; +SET @old_slow_query_log= @@global.slow_query_log; # We run with different binaries for normal and --embedded-server # @@ -17,3 +18,4 @@ SET @old_general_log= @@global.general_l echo ok; SET @@global.general_log= @old_general_log; +SET @@global.slow_query_log= @old_slow_query_log; === modified file 'mysql-test/t/mysql_upgrade.test' --- a/mysql-test/t/mysql_upgrade.test 2010-04-28 12:52:24 +0000 +++ b/mysql-test/t/mysql_upgrade.test 2010-08-27 14:12:44 +0000 @@ -109,3 +109,19 @@ CALL testproc(); DROP PROCEDURE testproc; --cat_file $MYSQLTEST_VARDIR/tmp/41569.txt --remove_file $MYSQLTEST_VARDIR/tmp/41569.txt + + +--echo # +--echo # Bug #53613: mysql_upgrade incorrectly revokes +--echo # TRIGGER privilege on given table +--echo # + +GRANT USAGE ON *.* TO 'user3'@'%'; +GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'; +--echo Run mysql_upgrade with all privileges on a user +--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1 +SHOW GRANTS FOR 'user3'@'%'; + +DROP USER 'user3'@'%'; + +--echo End of 5.1 tests === modified file 'mysql-test/t/mysqltest_ps.test' --- a/mysql-test/t/mysqltest_ps.test 2009-10-09 08:09:24 +0000 +++ b/mysql-test/t/mysqltest_ps.test 2010-08-25 20:22:33 +0000 @@ -4,7 +4,7 @@ if (`SELECT $PS_PROTOCOL = 0`) { - --skip Need prepared statement protocol + --skip Need ps-protocol } # === modified file 'mysql-test/t/partition_innodb-master.opt' --- a/mysql-test/t/partition_innodb-master.opt 2010-01-18 16:49:18 +0000 +++ b/mysql-test/t/partition_innodb-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=1 +--loose-innodb_lock_wait_timeout=1 === modified file 'mysql-test/t/partition_innodb_semi_consistent-master.opt' --- a/mysql-test/t/partition_innodb_semi_consistent-master.opt 2008-12-16 11:44:18 +0000 +++ b/mysql-test/t/partition_innodb_semi_consistent-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_lock_wait_timeout=2 +--loose-innodb_lock_wait_timeout=2 === modified file 'mysql-test/t/pool_of_threads.cnf' --- a/mysql-test/t/pool_of_threads.cnf 2009-05-06 12:03:24 +0000 +++ b/mysql-test/t/pool_of_threads.cnf 2010-08-17 07:14:46 +0000 @@ -11,4 +11,4 @@ extra-max-connections=1 connect-timeout= 2 [ENV] -MASTER_EXTRA_PORT= @mysqld.1.extra-port +MASTER_EXTRA_PORT= @mysqld.1.#extra-port === modified file 'mysql-test/t/show_check-master.opt' --- a/mysql-test/t/show_check-master.opt 2010-01-27 21:53:08 +0000 +++ b/mysql-test/t/show_check-master.opt 2010-08-07 14:42:30 +0000 @@ -1 +1 @@ ---log-output=file --slow-query-log --log-long-format --log-queries-not-using-indexes --myisam-recover="" --general-log --general-log-file="foo" --slow-query-log-file="" +--log-output=file --slow-query-log --log-long-format --log-queries-not-using-indexes --myisam-recover="" --general-log --general-log-file="foo" --slow-query-log-file="" --long_query_time=20 === modified file 'mysql-test/t/sp_trans_log.test' --- a/mysql-test/t/sp_trans_log.test 2010-05-24 13:54:08 +0000 +++ b/mysql-test/t/sp_trans_log.test 2010-08-17 07:14:46 +0000 @@ -3,7 +3,7 @@ # part of sp_trans test that appeared to be sensitive to binlog format --source include/have_innodb.inc ---source include/have_binlog_format_mixed_or_row.inc +--source include/have_binlog_format_mixed.inc delimiter |; === added file 'mysql-test/t/ssl_8k_key-master.opt' --- a/mysql-test/t/ssl_8k_key-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/t/ssl_8k_key-master.opt 2010-07-28 15:59:19 +0000 @@ -0,0 +1 @@ +--loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem --loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem === modified file 'mysql-test/t/subselect4.test' --- a/mysql-test/t/subselect4.test 2009-09-18 09:34:08 +0000 +++ b/mysql-test/t/subselect4.test 2010-08-23 09:46:25 +0000 @@ -62,3 +62,29 @@ FROM t3 WHERE 1 = 0 GROUP BY 1; DROP TABLE t1,t2,t3; --echo End of 5.0 tests. + +# +# Fix for LP#612894 +# Some aggregate functions (such as MIN MAX) work incorrectly in subqueries +# after getting NULL value +# + +CREATE TABLE t1 (col_int_nokey int(11) NOT NULL, col_varchar_nokey varchar(1) NOT NULL) engine=myisam; +INSERT INTO t1 VALUES (2,'s'),(0,'v'),(2,'s'); +CREATE TABLE t2 ( + pk int(11) NOT NULL AUTO_INCREMENT, + `col_int_key` int(11) NOT NULL, + col_varchar_key varchar(1) NOT NULL, + PRIMARY KEY (pk), + KEY `col_int_key` (`col_int_key`), + KEY `col_varchar_key` (`col_varchar_key`) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (4,10,'g'), (5,20,'v'); + +SELECT t1.col_int_nokey,(SELECT MIN( t2_a.col_int_key ) FROM t2 t2_a, t2 t2_b, t1 t1_a WHERE t1_a.col_varchar_nokey = t2_b.col_varchar_key and t1.col_int_nokey ) as sub FROM t1; + +SELECT t1.col_int_nokey,(SELECT MIN( t2_a.col_int_key ) +1 FROM t2 t2_a, t2 t2_b, t1 t1_a WHERE t1_a.col_varchar_nokey = t2_b.col_varchar_key and t1.col_int_nokey ) as sub FROM t1; + +DROP TABLE t1,t2; + +--echo End of 5.1 tests. === modified file 'mysql-test/t/unsafe_binlog_innodb-master.opt' --- a/mysql-test/t/unsafe_binlog_innodb-master.opt 2006-08-16 12:58:49 +0000 +++ b/mysql-test/t/unsafe_binlog_innodb-master.opt 2010-08-17 07:14:46 +0000 @@ -1 +1 @@ ---innodb_locks_unsafe_for_binlog=true --innodb_lock_wait_timeout=1 +--loose-innodb_locks_unsafe_for_binlog=true --loose-innodb_lock_wait_timeout=1 === modified file 'mysql-test/t/update.test' --- a/mysql-test/t/update.test 2010-03-10 16:10:05 +0000 +++ b/mysql-test/t/update.test 2010-07-19 09:03:52 +0000 @@ -483,3 +483,23 @@ UPDATE IGNORE v1 SET a = 1; SET SESSION sql_safe_updates = DEFAULT; DROP TABLE t1; DROP VIEW v1; + +--echo # +--echo # Bug#54734 assert in Diagnostics_area::set_ok_status +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1, not_exists; +DROP FUNCTION IF EXISTS f1; +DROP VIEW IF EXISTS v1; +--enable_warnings + +CREATE TABLE t1 (PRIMARY KEY(pk)) AS SELECT 1 AS pk; +CREATE FUNCTION f1() RETURNS INTEGER RETURN (SELECT 1 FROM not_exists); +CREATE VIEW v1 AS SELECT pk FROM t1 WHERE f1() = 13; +--error ER_VIEW_INVALID +UPDATE v1 SET pk = 7 WHERE pk > 0; + +DROP VIEW v1; +DROP FUNCTION f1; +DROP TABLE t1; === modified file 'mysql-test/t/warnings_engine_disabled.test' --- a/mysql-test/t/warnings_engine_disabled.test 2008-12-17 15:45:34 +0000 +++ b/mysql-test/t/warnings_engine_disabled.test 2010-08-17 07:14:46 +0000 @@ -2,23 +2,22 @@ # Only run this test with a compiled in but disabled # engine # -disable_query_log; ---require r/true.require -select support = 'NO' as `TRUE` from information_schema.engines where engine = 'ndbcluster'; -enable_query_log; +if (!`SELECT count(*) FROM information_schema.engines WHERE + support = 'NO' AND engine = 'innodb'`){ + skip Needs innodb engine; +} # # Test for handler type, will select MyISAM and print a warning -# about that - since NDB is disabled +# about that - since InnoDB is disabled # -create table t1 (id int) engine=NDB; -alter table t1 engine=NDB; +create table t1 (id int) engine=InnoDB; +alter table t1 engine=InnoDB; drop table t1; # # Bug#29263 disabled storage engines omitted in SHOW ENGINES # -SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ndbcluster'; -SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE -PLUGIN_NAME='ndbcluster'; +SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='InnoDB'; +SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='InnoDB'; === modified file 'mysys/Makefile.am' --- a/mysys/Makefile.am 2009-12-03 11:19:05 +0000 +++ b/mysys/Makefile.am 2010-08-27 14:12:44 +0000 @@ -147,7 +147,3 @@ test_base64$(EXEEXT): base64.c $(LIBRARI test_thr_mutex$(EXEEXT): test_thr_mutex.c $(LIBRARIES) $(LINK) $(FLAGS) $(srcdir)/test_thr_mutex.c $(LDADD) $(LIBS) - - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'mysys/errors.c' --- a/mysys/errors.c 2009-11-07 10:34:19 +0000 +++ b/mysys/errors.c 2010-08-27 14:12:44 +0000 @@ -50,6 +50,8 @@ const char * NEAR globerrs[GLOBERRS]= "Collation '%s' is not a compiled collation and is not specified in the '%s' file", "File '%s' not found (Errcode: %d)", "File '%s' (fileno: %d) was not closed", + "Can't change ownership of the file '%s' (Errcode: %d)", + "Can't change permissions of the file '%s' (Errcode: %d)", "Can't change mode for file '%s' to 0x%lx (Error: %d)", "Can't do seek on file '%s' (Errcode: %d)", "Warning: Can't copy ownership for file '%s' (Error: %d)" @@ -93,6 +95,8 @@ void init_glob_errs() EE(EE_UNKNOWN_COLLATION)= "Collation '%s' is not a compiled collation and is not specified in the %s file"; EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)"; EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed"; + EE(EE_CHANGE_OWNERSHIP) = "Can't change ownership of the file '%s' (Errcode: %d)"; + EE(EE_CHANGE_PERMISSIONS) = "Can't change permissions of the file '%s' (Errcode: %d)"; EE(EE_CANT_CHMOD) = "Can't change mode for file '%s' to 0x%lx (Error: %d)"; EE(EE_CANT_SEEK) = "Can't do seek on file '%s' (Errcode: %d)"; EE(EE_CANT_COPY_OWNERSHIP)= "Warning: Can't copy ownership for file '%s' (Error: %d)"; === modified file 'mysys/mf_iocache.c' --- a/mysys/mf_iocache.c 2009-10-15 21:38:29 +0000 +++ b/mysys/mf_iocache.c 2010-08-27 14:12:44 +0000 @@ -1701,16 +1701,19 @@ int my_block_write(register IO_CACHE *in #endif -int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock) +int my_b_flush_io_cache(IO_CACHE *info, + int need_append_buffer_lock __attribute__((unused))) { size_t length; - my_bool append_cache; my_off_t pos_in_file; + my_bool append_cache= (info->type == SEQ_READ_APPEND); DBUG_ENTER("my_b_flush_io_cache"); DBUG_PRINT("enter", ("cache: 0x%lx", (long) info)); - if (!(append_cache = (info->type == SEQ_READ_APPEND))) - need_append_buffer_lock=0; +#ifdef THREAD + if (!append_cache) + need_append_buffer_lock= 0; +#endif if (info->type == WRITE_CACHE || append_cache) { === modified file 'mysys/mf_pack.c' --- a/mysys/mf_pack.c 2010-03-30 12:10:25 +0000 +++ b/mysys/mf_pack.c 2010-07-02 18:30:47 +0000 @@ -52,7 +52,7 @@ void pack_dirname(char * to, const char buff_length= strlen(buff); d_length= (size_t) (start-to); if ((start == to || - (buff_length == d_length && !bcmp(buff,start,d_length))) && + (buff_length == d_length && !memcmp(buff,start,d_length))) && *start != FN_LIBCHAR && *start) { /* Put current dir before */ bchange((uchar*) to, d_length, (uchar*) buff, buff_length, strlen(to)+1); @@ -70,7 +70,7 @@ void pack_dirname(char * to, const char } if (length > 1 && length < d_length) { /* test if /xx/yy -> ~/yy */ - if (bcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR) + if (memcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR) { to[0]=FN_HOMELIB; /* Filename begins with ~ */ (void) strmov_overlapp(to+1,to+length); @@ -80,7 +80,7 @@ void pack_dirname(char * to, const char { /* Test if cwd is ~/... */ if (length > 1 && length < buff_length) { - if (bcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR) + if (memcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR) { buff[0]=FN_HOMELIB; (void) strmov_overlapp(buff+1,buff+length); @@ -166,7 +166,7 @@ size_t cleanup_dirname(register char *to *pos = FN_LIBCHAR; if (*pos == FN_LIBCHAR) { - if ((size_t) (pos-start) > length && bcmp(pos-length,parent,length) == 0) + if ((size_t) (pos-start) > length && memcmp(pos-length,parent,length) == 0) { /* If .../../; skip prev */ pos-=length; if (pos != start) @@ -197,7 +197,7 @@ size_t cleanup_dirname(register char *to end_parentdir=pos; while (pos >= start && *pos != FN_LIBCHAR) /* remove prev dir */ pos--; - if (pos[1] == FN_HOMELIB || bcmp(pos,parent,length) == 0) + if (pos[1] == FN_HOMELIB || memcmp(pos,parent,length) == 0) { /* Don't remove ~user/ */ pos=strmov(end_parentdir+1,parent); *pos=FN_LIBCHAR; @@ -206,7 +206,7 @@ size_t cleanup_dirname(register char *to } } else if ((size_t) (pos-start) == length-1 && - !bcmp(start,parent+1,length-1)) + !memcmp(start,parent+1,length-1)) start=pos; /* Starts with "../" */ else if (pos-start > 0 && pos[-1] == FN_LIBCHAR) { === removed file 'mysys/my_atomic.c' --- a/mysys/my_atomic.c 2008-04-28 16:24:05 +0000 +++ b/mysys/my_atomic.c 1970-01-01 00:00:00 +0000 @@ -1,45 +0,0 @@ -/* Copyright (C) 2006 MySQL AB - - 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 Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include <my_global.h> -#include <my_pthread.h> - -#ifndef HAVE_INLINE -/* the following will cause all inline functions to be instantiated */ -#define HAVE_INLINE -#undef STATIC_INLINE -#define STATIC_INLINE extern -#endif - -#include <my_atomic.h> - -/* - checks that the current build of atomic ops - can run on this machine - - RETURN - ATOMIC_xxx values, see my_atomic.h -*/ -int my_atomic_initialize() -{ - compile_time_assert(sizeof(intptr) == sizeof(void *)); - /* currently the only thing worth checking is SMP/UP issue */ -#ifdef MY_ATOMIC_MODE_DUMMY - return my_getncpus() == 1 ? MY_ATOMIC_OK : MY_ATOMIC_NOT_1CPU; -#else - return MY_ATOMIC_OK; -#endif -} - === added file 'mysys/my_atomic.c' --- a/mysys/my_atomic.c 1970-01-01 00:00:00 +0000 +++ b/mysys/my_atomic.c 2010-08-27 14:12:44 +0000 @@ -0,0 +1,45 @@ +/* Copyright (C) 2006 MySQL AB + + 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 Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include <my_global.h> +#include <my_pthread.h> + +#ifndef HAVE_INLINE +/* the following will cause all inline functions to be instantiated */ +#define HAVE_INLINE +#undef STATIC_INLINE +#define STATIC_INLINE extern +#endif + +#include <my_atomic.h> + +/* + checks that the current build of atomic ops + can run on this machine + + RETURN + ATOMIC_xxx values, see my_atomic.h +*/ +int my_atomic_initialize() +{ + compile_time_assert(sizeof(intptr) == sizeof(void *)); + /* currently the only thing worth checking is SMP/UP issue */ +#ifdef MY_ATOMIC_MODE_DUMMY + return my_getncpus() == 1 ? MY_ATOMIC_OK : MY_ATOMIC_NOT_1CPU; +#else + return MY_ATOMIC_OK; +#endif +} + === modified file 'mysys/my_bitmap.c' --- a/mysys/my_bitmap.c 2010-08-04 13:01:13 +0000 +++ b/mysys/my_bitmap.c 2010-08-27 14:12:44 +0000 @@ -550,7 +550,7 @@ uint bitmap_get_first(const MY_BITMAP *m { byte_ptr= (uchar*)data_ptr; for (j=0; ; j++, byte_ptr++) - { + { if (*byte_ptr != 0xFF) { for (k=0; ; k++) === modified file 'mysys/my_copy.c' --- a/mysys/my_copy.c 2009-12-03 11:19:05 +0000 +++ b/mysys/my_copy.c 2010-08-27 14:12:44 +0000 @@ -17,6 +17,7 @@ #include "mysys_err.h" #include <my_dir.h> /* for stat */ #include <m_string.h> +#include "mysys_err.h" #if defined(HAVE_UTIME_H) #include <utime.h> #elif defined(HAVE_SYS_UTIME_H) @@ -57,7 +58,7 @@ int my_copy(const char *from, const char File from_file,to_file; uchar buff[IO_SIZE]; MY_STAT stat_buff,new_stat_buff; - int res; + my_bool file_created= 0; DBUG_ENTER("my_copy"); DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags)); @@ -82,6 +83,7 @@ int my_copy(const char *from, const char MyFlags)) < 0) goto err; + file_created= 1; while ((Count=my_read(from_file, buff, sizeof(buff), MyFlags)) != 0) { if (Count == (uint) -1 || @@ -99,15 +101,30 @@ int my_copy(const char *from, const char if (my_close(from_file,MyFlags) | my_close(to_file,MyFlags)) DBUG_RETURN(-1); /* Error on close */ + from_file=to_file= -1; /* Files are closed */ + /* Copy modes if possible */ if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) DBUG_RETURN(0); /* File copyed but not stat */ - res= chmod(to, stat_buff.st_mode & 07777); /* Copy modes */ + /* Copy modes */ + if (chmod(to, stat_buff.st_mode & 07777)) + { + my_errno= errno; + if (MyFlags & MY_WME) + my_error(EE_CHANGE_PERMISSIONS, MYF(ME_BELL+ME_WAITTANG), from, errno); + if (MyFlags & MY_FAE) + goto err; + } #if !defined(__WIN__) && !defined(__NETWARE__) + /* Copy ownership */ if (chown(to, stat_buff.st_uid,stat_buff.st_gid)) { - my_error(EE_CANT_COPY_OWNERSHIP, MYF(ME_JUST_WARNING), to); + my_errno= errno; + if (MyFlags & MY_WME) + my_error(EE_CANT_COPY_OWNERSHIP, MYF(ME_JUST_WARNING), to, errno); + if (MyFlags & MY_FAE) + goto err; } #endif #if !defined(VMS) && !defined(__ZTC__) @@ -124,11 +141,11 @@ int my_copy(const char *from, const char err: if (from_file >= 0) VOID(my_close(from_file,MyFlags)); - if (to_file >= 0) - { - VOID(my_close(to_file, MyFlags)); - /* attempt to delete the to-file we've partially written */ + if (to_file >= 0) VOID(my_close(to_file, MyFlags)); + + /* attempt to delete the to-file we've partially written */ + if (file_created) VOID(my_delete(to, MyFlags)); - } + DBUG_RETURN(-1); } /* my_copy */ === modified file 'mysys/my_gethwaddr.c' --- a/mysys/my_gethwaddr.c 2007-08-09 12:56:57 +0000 +++ b/mysys/my_gethwaddr.c 2010-07-02 18:30:47 +0000 @@ -47,7 +47,7 @@ my_bool my_gethwaddr(uchar *to) uchar *buf, *next, *end, *addr; struct if_msghdr *ifm; struct sockaddr_dl *sdl; - int i, res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0}; + int res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0}; if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1) goto err; === modified file 'mysys/my_getopt.c' --- a/mysys/my_getopt.c 2010-08-02 09:01:24 +0000 +++ b/mysys/my_getopt.c 2010-08-27 14:12:44 +0000 @@ -30,7 +30,7 @@ my_error_reporter my_getopt_error_report static int findopt(char *optpat, uint length, const struct my_option **opt_res, - char **ffname); + const char **ffname); my_bool getopt_compare_strings(const char *s, const char *t, uint length); @@ -115,8 +115,8 @@ int handle_options(int *argc, char ***ar uint opt_found, argvpos= 0, length; my_bool end_of_options= 0, must_be_var, set_maximum_value, option_is_loose; - char **pos, **pos_end, *optend, *UNINIT_VAR(prev_found), - *opt_str, key_name[FN_REFLEN]; + char **pos, **pos_end, *optend, *opt_str, key_name[FN_REFLEN]; + const char *prev_found; const struct my_option *optp; void *value; int error, i; @@ -711,10 +711,10 @@ static int setval(const struct my_option static int findopt(char *optpat, uint length, const struct my_option **opt_res, - char **ffname) + const char **ffname) { uint count; - struct my_option *opt= (struct my_option *) *opt_res; + const struct my_option *opt= *opt_res; for (count= 0; opt->name; opt++) { @@ -725,8 +725,9 @@ static int findopt(char *optpat, uint le return 1; if (!count) { + /* We only need to know one prev */ count= 1; - *ffname= (char *) opt->name; /* We only need to know one prev */ + *ffname= opt->name; } else if (strcmp(*ffname, opt->name)) { === modified file 'mysys/my_getwd.c' --- a/mysys/my_getwd.c 2010-05-05 08:54:52 +0000 +++ b/mysys/my_getwd.c 2010-08-14 14:44:45 +0000 @@ -51,7 +51,7 @@ int my_getwd(char * buf, size_t size, my (long) buf, (uint) size, MyFlags)); if (size < 1) - return(-1); + DBUG_RETURN(-1); if (curr_dir[0]) /* Current pos is saved here */ VOID(strmake(buf,&curr_dir[0],size-1)); @@ -59,12 +59,12 @@ int my_getwd(char * buf, size_t size, my { #if defined(HAVE_GETCWD) if (size < 2) - return(-1); + DBUG_RETURN(-1); if (!getcwd(buf,(uint) (size-2)) && MyFlags & MY_WME) { my_errno=errno; my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno); - return(-1); + DBUG_RETURN(-1); } #elif defined(HAVE_GETWD) { @@ -74,12 +74,12 @@ int my_getwd(char * buf, size_t size, my } #elif defined(VMS) if (size < 2) - return(-1); + DBUG_RETURN(-1); if (!getcwd(buf,size-2,1) && MyFlags & MY_WME) { my_errno=errno; my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno); - return(-1); + DBUG_RETURN(-1); } intern_filename(buf,buf); #else === modified file 'mysys/my_handler.c' --- a/mysys/my_handler.c 2008-06-26 05:18:28 +0000 +++ b/mysys/my_handler.c 2010-08-27 14:12:44 +0000 @@ -277,7 +277,6 @@ int ha_key_cmp(register HA_KEYSEG *keyse return ((keyseg->flag & HA_REVERSE_SORT) ? -flag : flag); a+=a_length; b+=b_length; - break; } break; case HA_KEYTYPE_INT8: === modified file 'mysys/my_redel.c' --- a/mysys/my_redel.c 2009-11-29 23:08:56 +0000 +++ b/mysys/my_redel.c 2010-08-27 14:12:44 +0000 @@ -71,14 +71,28 @@ end: } /* my_redel */ - /* Copy stat from one file to another */ - /* Return -1 if can't get stat, 1 if wrong type of file */ +/** + Copy stat from one file to another + @fn my_copystat() + @param from Copy stat from this file + @param to Copy stat to this file + @param MyFlags Flags: + MY_WME Give error if something goes wrong + MY_FAE Abort operation if something goes wrong + If MY_FAE is not given, we don't return -1 for + errors from chown (which normally require root + privilege) + + @return 0 ok + -1 if can't get stat, + 1 if wrong type of file +*/ int my_copystat(const char *from, const char *to, int MyFlags) { struct stat statbuf; - if (stat((char*) from, &statbuf)) + if (stat(from, &statbuf)) { my_errno=errno; if (MyFlags & (MY_FAE+MY_WME)) @@ -87,7 +101,15 @@ int my_copystat(const char *from, const } if ((statbuf.st_mode & S_IFMT) != S_IFREG) return 1; - VOID(chmod(to, statbuf.st_mode & 07777)); /* Copy modes */ + + /* Copy modes */ + if (chmod(to, statbuf.st_mode & 07777)) + { + my_errno= errno; + if (MyFlags & (MY_FAE+MY_WME)) + my_error(EE_CHANGE_PERMISSIONS, MYF(ME_BELL+ME_WAITTANG), from, errno); + return -1; + } #if !defined(__WIN__) && !defined(__NETWARE__) if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING) @@ -95,9 +117,14 @@ int my_copystat(const char *from, const if (MyFlags & MY_LINK_WARNING) my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink); } + /* Copy ownership */ if (chown(to, statbuf.st_uid, statbuf.st_gid)) { - my_error(EE_CANT_COPY_OWNERSHIP, MYF(ME_JUST_WARNING), to); + my_errno= errno; + if (MyFlags & MY_WME) + my_error(EE_CHANGE_OWNERSHIP, MYF(ME_BELL+ME_WAITTANG), from, errno); + if (MyFlags & MY_FAE) + return -1; } #endif /* !__WIN__ && !__NETWARE__ */ === modified file 'mysys/my_static.c' --- a/mysys/my_static.c 2009-12-03 11:19:05 +0000 +++ b/mysys/my_static.c 2010-08-09 17:05:42 +0000 @@ -119,6 +119,7 @@ ulonglong query_performance_frequency, q /* How to disable options */ my_bool NEAR my_disable_locking=0; +my_bool NEAR my_disable_sync=0; my_bool NEAR my_disable_async_io=0; my_bool NEAR my_disable_flush_key_blocks=0; my_bool NEAR my_disable_symlinks=0; === modified file 'mysys/my_sync.c' --- a/mysys/my_sync.c 2010-03-09 19:22:24 +0000 +++ b/mysys/my_sync.c 2010-08-10 16:06:34 +0000 @@ -48,6 +48,9 @@ int my_sync(File fd, myf my_flags) DBUG_ENTER("my_sync"); DBUG_PRINT("my",("fd: %d my_flags: %d", fd, my_flags)); + if (my_disable_sync) + DBUG_RETURN(0); + statistic_increment(my_sync_count,&THR_LOCK_open); do { @@ -65,6 +68,8 @@ int my_sync(File fd, myf my_flags) res= fdatasync(fd); #elif defined(HAVE_FSYNC) res= fsync(fd); + if (res == -1 && errno == ENOLCK) + res= 0; /* Result Bug in Old FreeBSD */ #elif defined(__WIN__) res= _commit(fd); #else === modified file 'mysys/stacktrace.c' --- a/mysys/stacktrace.c 2010-07-30 07:45:27 +0000 +++ b/mysys/stacktrace.c 2010-08-27 14:12:44 +0000 @@ -86,7 +86,9 @@ void my_print_stacktrace(uchar* stack_bo #if BACKTRACE_DEMANGLE -char __attribute__ ((weak)) *my_demangle(const char *mangled_name __attribute__((unused)), int *status __attribute__((unused))) +char __attribute__ ((weak)) * +my_demangle(const char *mangled_name __attribute__((unused)), + int *status __attribute__((unused))) { return NULL; } === modified file 'mysys/thr_lock.c' --- a/mysys/thr_lock.c 2009-12-03 11:19:05 +0000 +++ b/mysys/thr_lock.c 2010-08-27 14:12:44 +0000 @@ -131,8 +131,7 @@ static int check_lock(struct st_lock_lis { THR_LOCK_DATA *data,**prev; uint count=0; - THR_LOCK_OWNER *first_owner; - LINT_INIT(first_owner); + THR_LOCK_OWNER *UNINIT_VAR(first_owner); prev= &list->data; if (list->data) === modified file 'netware/Makefile.am' --- a/netware/Makefile.am 2009-02-07 15:50:31 +0000 +++ b/netware/Makefile.am 2010-08-27 14:12:44 +0000 @@ -115,6 +115,3 @@ test_db.sql: init_db.sql $(top_srcdir)/s @echo "Building $@"; @cat init_db.sql \ $(top_srcdir)/scripts/mysql_test_data_timezone.sql > $@; - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'plugin/Makefile.am' --- a/plugin/Makefile.am 2009-02-15 02:18:30 +0000 +++ b/plugin/Makefile.am 2010-08-27 14:12:44 +0000 @@ -23,6 +23,3 @@ EXTRA_DIST = fulltext/configure.in SUBDIRS = @mysql_pg_dirs@ DIST_SUBDIRS = @mysql_pg_distdirs@ - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'plugin/daemon_example/Makefile.am' --- a/plugin/daemon_example/Makefile.am 2008-01-02 13:00:46 +0000 +++ b/plugin/daemon_example/Makefile.am 2010-07-09 11:37:51 +0000 @@ -27,14 +27,14 @@ INCLUDES = -I$(top_srcdir)/ EXTRA_LTLIBRARIES = libdaemon_example.la pkgplugin_LTLIBRARIES = @plugin_daemon_example_shared_target@ libdaemon_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -libdaemon_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +libdaemon_example_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN libdaemon_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN libdaemon_example_la_SOURCES = daemon_example.cc EXTRA_LIBRARIES = libdaemon_example.a noinst_LIBRARIES = @plugin_daemon_example_static_target@ -libdaemon_example_a_CXXFLAGS = $(AM_CFLAGS) +libdaemon_example_a_CXXFLAGS = $(AM_CXXFLAGS) libdaemon_example_a_CFLAGS = $(AM_CFLAGS) libdaemon_example_a_SOURCES= daemon_example.cc === modified file 'pstack/Makefile.am' --- a/pstack/Makefile.am 2007-09-27 19:39:23 +0000 +++ b/pstack/Makefile.am 2010-08-27 14:12:44 +0000 @@ -27,6 +27,3 @@ libpstack_a_SOURCES = bucomm.c filemode. debug.c ieee.c pstack.c stabs.c noinst_HEADERS = bucomm.h debug.h ieee.h budbg.h demangle.h \ linuxthreads.h pstack.h pstacktrace.h - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'regex/Makefile.am' --- a/regex/Makefile.am 2006-12-31 00:32:21 +0000 +++ b/regex/Makefile.am 2010-08-27 14:12:44 +0000 @@ -31,6 +31,3 @@ test: re tests ./re < tests ./re -el < tests ./re -er < tests - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'regex/engine.c' --- a/regex/engine.c 2009-11-29 23:08:56 +0000 +++ b/regex/engine.c 2010-08-27 14:12:44 +0000 @@ -256,7 +256,6 @@ sopno stopst; register const char *ssp; /* start of string matched by subsubRE */ register const char *sep; /* end of string matched by subsubRE */ register const char *oldssp; /* previous ssp */ - register const char *dp; /* used in debug mode to check asserts */ AT("diss", start, stop, startst, stopst); sp = start; @@ -314,11 +313,9 @@ sopno stopst; ssub = ss + 1; esub = es - 1; /* did innards match? */ - if (slow(charset, m, sp, rest, ssub, esub) != NULL) { - dp = dissect(charset, m, sp, rest, ssub, esub); - assert(dp == rest); - } else /* no */ - assert(sp == rest); + if (slow(charset, m, sp, rest, ssub, esub) != NULL) + sp = dissect(charset, m, sp, rest, ssub, esub); + assert(sp == rest); sp = rest; break; case OPLUS_: @@ -353,8 +350,8 @@ sopno stopst; } assert(sep == rest); /* must exhaust substring */ assert(slow(charset, m, ssp, sep, ssub, esub) == rest); - dp = dissect(charset, m, ssp, sep, ssub, esub); - assert(dp == sep); + sp = dissect(charset, m, ssp, sep, ssub, esub); + assert(sp == sep); sp = rest; break; case OCH_: @@ -388,8 +385,8 @@ sopno stopst; else assert(OP(m->g->strip[esub]) == O_CH); } - dp = dissect(charset, m, sp, rest, ssub, esub); - assert(dp == rest); + sp = dissect(charset, m, sp, rest, ssub, esub); + assert(sp == rest); sp = rest; break; case O_PLUS: === modified file 'regex/regcomp.c' --- a/regex/regcomp.c 2009-08-28 16:21:54 +0000 +++ b/regex/regcomp.c 2010-07-09 19:37:52 +0000 @@ -690,7 +690,6 @@ register cset *cs; case '-': SETERROR(REG_ERANGE); return; /* NOTE RETURN */ - break; default: c = '\0'; break; @@ -1564,13 +1563,13 @@ struct parse *p; register struct re_guts *g; { register sop *scan; - sop *start; - register sop *newstart; + sop *UNINIT_VAR(start); + register sop *UNINIT_VAR(newstart); register sopno newlen; register sop s; register char *cp; register sopno i; - LINT_INIT(start); LINT_INIT(newstart); + /* avoid making error situations worse */ if (p->error != 0) return; === modified file 'scripts/Makefile.am' --- a/scripts/Makefile.am 2010-04-28 12:52:24 +0000 +++ b/scripts/Makefile.am 2010-08-27 14:12:44 +0000 @@ -37,7 +37,8 @@ bin_SCRIPTS = @server_scripts@ \ mysqld_multi noinst_SCRIPTS = make_binary_distribution \ - make_sharedlib_distribution + make_sharedlib_distribution \ + convert-debug-for-diff EXTRA_SCRIPTS = make_binary_distribution.sh \ make_sharedlib_distribution.sh \ @@ -59,7 +60,8 @@ EXTRA_SCRIPTS = make_binary_distributio mysqlhotcopy.sh \ mysqldumpslow.sh \ mysqld_multi.sh \ - mysqld_safe.sh + mysqld_safe.sh \ + convert-debug-for-diff.sh EXTRA_DIST = $(EXTRA_SCRIPTS) \ mysqlaccess.conf \ @@ -91,6 +93,7 @@ CLEANFILES = @server_scripts@ \ mysqlhotcopy \ mysqldumpslow \ mysqld_multi \ + convert-debug-for-diff \ $(EXTRA_PROGRAMS) pkgplugindir = $(pkglibdir)/plugin @@ -193,7 +196,3 @@ SUFFIXES = .sh $< > $@-t @CHMOD@ +x $@-t @MV@ $@-t $@ - - -# Don't update the files from bitkeeper -%::SCCS/s.% === added file 'scripts/convert-debug-for-diff.sh' --- a/scripts/convert-debug-for-diff.sh 1970-01-01 00:00:00 +0000 +++ b/scripts/convert-debug-for-diff.sh 2010-08-23 09:52:57 +0000 @@ -0,0 +1,25 @@ +#!/usr/bin/perl -i +# +# This script converts all numbers that look like addresses or memory sizes, +# in a debug files generated by --debug (like mysqld --debug), to #. +# The script also deletes all thread id's from the start of the line. + +# This allows you to easily compare the files (for example with diff) +# to find out what changes between different executions. +# This is extremely useful for comparing two mysqld versions to see +# why things now work differently. + +# The script converts the files in place. +# +# Typical usage: +# +# convert-debug-for-diff /tmp/mysqld.trace /tmp/mysqld-old.trace +# diff /tmp/mysqld.trace /tmp/mysqld-old.trace + +while (<>) +{ + s/^T@[0-9]+\s*://g; + s/0x[0-9a-f]+(\s|\n|\))/#$1/g; + s/size: [0-9]+/size: #/g; + print $_; +} === modified file 'scripts/mysql_secure_installation.pl.in' --- a/scripts/mysql_secure_installation.pl.in 2009-11-03 21:34:01 +0000 +++ b/scripts/mysql_secure_installation.pl.in 2010-07-14 10:53:49 +0000 @@ -208,7 +208,7 @@ sub remove_anonymous_users { } sub remove_remote_root { - if (do_query("DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';")) { + if (do_query("DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');")) { print " ... Success!\n"; } else { print " ... Failed!\n"; === modified file 'scripts/mysql_secure_installation.sh' --- a/scripts/mysql_secure_installation.sh 2010-01-15 15:27:55 +0000 +++ b/scripts/mysql_secure_installation.sh 2010-08-27 14:12:44 +0000 @@ -68,7 +68,8 @@ parse_arguments() # release or installed source directory and return the path. find_in_basedir() { - return_dir= + return_dir=0 + found=0 case "$1" in --dir) return_dir=1; shift @@ -81,7 +82,8 @@ find_in_basedir() do if test -f "$basedir/$dir/$file" then - if test -n "$return_dir" + found=1 + if test $return_dir -eq 1 then echo "$basedir/$dir" else @@ -90,6 +92,17 @@ find_in_basedir() break fi done + + if test $found -eq 0 + then + # Test if command is in PATH + $file --no-defaults --version > /dev/null 2>&1 + status=$? + if test $status -eq 0 + then + echo $file + fi + fi } cannot_find_file() @@ -298,7 +311,7 @@ remove_anonymous_users() { } remove_remote_root() { - do_query "DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';" + do_query "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');" if [ $? -eq 0 ]; then echo " ... Success!" else @@ -355,14 +368,15 @@ cleanup() { # The actual script starts here prepare +find_mysql_client set_echo_compat echo -echo "NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL" +echo "NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB" echo " SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!" echo -echo "In order to log into MySQL to secure it, we'll need the current" -echo "password for the root user. If you've just installed MySQL, and" +echo "In order to log into MariaDB to secure it, we'll need the current" +echo "password for the root user. If you've just installed MariaDB, and" echo "you haven't set the root password yet, the password will be blank," echo "so you should just press enter here." echo @@ -374,7 +388,7 @@ get_root_password # Set the root password # -echo "Setting the root password ensures that nobody can log into the MySQL" +echo "Setting the root password ensures that nobody can log into the MariaDB" echo "root user without the proper authorisation." echo @@ -403,8 +417,8 @@ echo # Remove anonymous users # -echo "By default, a MySQL installation has an anonymous user, allowing anyone" -echo "to log into MySQL without having to have a user account created for" +echo "By default, a MariaDB installation has an anonymous user, allowing anyone" +echo "to log into MariaDB without having to have a user account created for" echo "them. This is intended only for testing, and to make the installation" echo "go a bit smoother. You should remove them before moving into a" echo "production environment." @@ -443,7 +457,7 @@ echo # Remove test database # -echo "By default, MySQL comes with a database named 'test' that anyone can" +echo "By default, MariaDB comes with a database named 'test' that anyone can" echo "access. This is also intended only for testing, and should be removed" echo "before moving into a production environment." echo @@ -478,8 +492,7 @@ echo cleanup echo -echo "All done! If you've completed all of the above steps, your MySQL" +echo "All done! If you've completed all of the above steps, your MariaDB" echo "installation should now be secure." echo -echo "Thanks for using MySQL!" - +echo "Thanks for using MariaDB!" === modified file 'scripts/mysql_system_tables_fix.sql' --- a/scripts/mysql_system_tables_fix.sql 2010-02-26 12:22:48 +0000 +++ b/scripts/mysql_system_tables_fix.sql 2010-07-01 09:05:09 +0000 @@ -58,7 +58,7 @@ ALTER TABLE tables_priv COLLATE utf8_general_ci DEFAULT '' NOT NULL, MODIFY Table_priv set('Select','Insert','Update','Delete','Create', 'Drop','Grant','References','Index','Alter', - 'Create View','Show view') + 'Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, COMMENT='Table privileges'; @@ -584,8 +584,6 @@ ALTER TABLE host MODIFY Trigger_priv enu ALTER TABLE db ADD Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; ALTER TABLE db MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; -ALTER TABLE tables_priv MODIFY Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL; - UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0; # Activate the new, possible modified privilege tables === modified file 'server-tools/Makefile.am' --- a/server-tools/Makefile.am 2006-12-31 00:32:21 +0000 +++ b/server-tools/Makefile.am 2010-08-27 14:12:44 +0000 @@ -15,6 +15,3 @@ SUBDIRS = . instance-manager DIST_SUBDIRS = . instance-manager - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'server-tools/instance-manager/instance_options.cc' --- a/server-tools/instance-manager/instance_options.cc 2009-04-29 02:59:10 +0000 +++ b/server-tools/instance-manager/instance_options.cc 2010-07-20 18:07:36 +0000 @@ -303,7 +303,6 @@ bool Instance_options::fill_log_options( enum { MAX_LOG_OPTION_LENGTH= 256 }; char datadir[MAX_LOG_OPTION_LENGTH]; char hostname[MAX_LOG_OPTION_LENGTH]; - uint hostname_length; struct log_files_st { const char *name; @@ -335,8 +334,6 @@ bool Instance_options::fill_log_options( strmov(hostname, "mysql"); hostname[MAX_LOG_OPTION_LENGTH - 1]= 0; /* Safety */ - hostname_length= strlen(hostname); - for (log_files= logs_st; log_files->name; log_files++) { === modified file 'sql-bench/Makefile.am' --- a/sql-bench/Makefile.am 2006-12-31 00:32:21 +0000 +++ b/sql-bench/Makefile.am 2010-08-27 14:12:44 +0000 @@ -81,6 +81,3 @@ SUFFIXES = .sh $< > $@-t @CHMOD@ +x $@-t @MV@ $@-t $@ - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'sql-common/Makefile.am' --- a/sql-common/Makefile.am 2006-12-31 00:02:27 +0000 +++ b/sql-common/Makefile.am 2010-08-27 14:12:44 +0000 @@ -15,6 +15,3 @@ ## Process this file with automake to create Makefile.in EXTRA_DIST = client.c pack.c my_time.c my_user.c - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'sql/Makefile.am' --- a/sql/Makefile.am 2009-12-03 11:19:05 +0000 +++ b/sql/Makefile.am 2010-08-27 14:12:44 +0000 @@ -191,6 +191,3 @@ install-exec-hook: test ! -x mysqld-debug$(EXEEXT) || $(INSTALL_PROGRAM) mysqld-debug$(EXEEXT) $(DESTDIR)$(libexecdir) test ! -f mysqld-debug.sym.gz || $(INSTALL_DATA) mysqld-debug.sym.gz $(DESTDIR)$(pkglibdir) test ! -f mysqld.sym.gz || $(INSTALL_DATA) mysqld.sym.gz $(DESTDIR)$(pkglibdir) - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'sql/field.cc' --- a/sql/field.cc 2010-08-02 09:01:24 +0000 +++ b/sql/field.cc 2010-08-27 14:12:44 +0000 @@ -8696,7 +8696,13 @@ int Field_set::store(longlong nr, bool u { ASSERT_COLUMN_MARKED_FOR_WRITE; int error= 0; - ulonglong max_nr= set_bits(ulonglong, typelib->count); + ulonglong max_nr; + + if (sizeof(ulonglong)*8 <= typelib->count) + max_nr= ULONGLONG_MAX; + else + max_nr= (ULL(1) << typelib->count) - 1; + if ((ulonglong) nr > max_nr) { nr&= max_nr; === modified file 'sql/ha_partition.cc' --- a/sql/ha_partition.cc 2010-08-02 09:01:24 +0000 +++ b/sql/ha_partition.cc 2010-08-27 14:12:44 +0000 @@ -4220,6 +4220,58 @@ int ha_partition::index_read_last_map(uc /* + Optimization of the default implementation to take advantage of dynamic + partition pruning. +*/ +int ha_partition::index_read_idx_map(uchar *buf, uint index, + const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) +{ + int error= HA_ERR_KEY_NOT_FOUND; + DBUG_ENTER("ha_partition::index_read_idx_map"); + + if (find_flag == HA_READ_KEY_EXACT) + { + uint part; + m_start_key.key= key; + m_start_key.keypart_map= keypart_map; + m_start_key.flag= find_flag; + m_start_key.length= calculate_key_len(table, index, m_start_key.key, + m_start_key.keypart_map); + + get_partition_set(table, buf, index, &m_start_key, &m_part_spec); + + /* How can it be more than one partition with the current use? */ + DBUG_ASSERT(m_part_spec.start_part == m_part_spec.end_part); + + for (part= m_part_spec.start_part; part <= m_part_spec.end_part; part++) + { + if (bitmap_is_set(&(m_part_info->used_partitions), part)) + { + error= m_file[part]->index_read_idx_map(buf, index, key, + keypart_map, find_flag); + if (error != HA_ERR_KEY_NOT_FOUND && + error != HA_ERR_END_OF_FILE) + break; + } + } + } + else + { + /* + If not only used with READ_EXACT, we should investigate if possible + to optimize for other find_flag's as well. + */ + DBUG_ASSERT(0); + /* fall back on the default implementation */ + error= handler::index_read_idx_map(buf, index, key, keypart_map, find_flag); + } + DBUG_RETURN(error); +} + + +/* Read next record in a forward index scan SYNOPSIS === modified file 'sql/ha_partition.h' --- a/sql/ha_partition.h 2010-07-23 20:37:21 +0000 +++ b/sql/ha_partition.h 2010-08-27 14:12:44 +0000 @@ -53,8 +53,7 @@ typedef struct st_ha_data_partition HA_CAN_FULLTEXT | \ HA_DUPLICATE_POS | \ HA_CAN_SQL_HANDLER | \ - HA_CAN_INSERT_DELAYED | \ - HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) + HA_CAN_INSERT_DELAYED) class ha_partition :public handler { private: @@ -448,6 +447,15 @@ public: virtual int index_init(uint idx, bool sorted); virtual int index_end(); + /** + @breif + Positions an index cursor to the index specified in the hanlde. Fetches the + row if available. If the key value is null, begin at first key of the + index. + */ + virtual int index_read_idx_map(uchar *buf, uint index, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag); /* These methods are used to jump to next or previous entry in the index scan. There are also methods to jump to first and last entry. @@ -766,9 +774,6 @@ public: HA_PRIMARY_KEY_REQUIRED_FOR_POSITION: Does the storage engine need a PK for position? - Used with hidden primary key in InnoDB. - Hidden primary keys cannot be supported by partitioning, since the - partitioning expressions columns must be a part of the primary key. (InnoDB) HA_FILE_BASED is always set for partition handler since we use a === modified file 'sql/handler.cc' --- a/sql/handler.cc 2010-08-02 09:22:36 +0000 +++ b/sql/handler.cc 2010-08-06 12:39:37 +0000 @@ -2027,6 +2027,10 @@ int ha_delete_table(THD *thd, handlerton handler *handler::clone(MEM_ROOT *mem_root) { handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type()); + + if (!new_handler) + return NULL; + /* Allocate handler->ref here because otherwise ha_open will allocate it on this->table->mem_root and we will not be able to reclaim that memory @@ -2034,12 +2038,13 @@ handler *handler::clone(MEM_ROOT *mem_ro */ if (!(new_handler->ref= (uchar*) alloc_root(mem_root, ALIGN_SIZE(ref_length)*2))) return NULL; - if (new_handler && !new_handler->ha_open(table, - table->s->normalized_path.str, - table->db_stat, - HA_OPEN_IGNORE_IF_LOCKED)) - return new_handler; - return NULL; + if (new_handler->ha_open(table, + table->s->normalized_path.str, + table->db_stat, + HA_OPEN_IGNORE_IF_LOCKED)) + return NULL; + new_handler->cloned= 1; // Marker for debugging + return new_handler; } === modified file 'sql/handler.h' --- a/sql/handler.h 2010-08-02 09:01:24 +0000 +++ b/sql/handler.h 2010-08-27 14:12:44 +0000 @@ -93,7 +93,10 @@ #define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15) /* If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position() - uses a primary key. Without primary key, we can't call position(). + uses a primary key given by the record argument. + Without primary key, we can't call position(). + If not set, the position is returned as the current rows position + regardless of what argument is given. */ #define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16) #define HA_CAN_RTREEKEYS (1 << 17) @@ -1129,6 +1132,7 @@ public: enum {NONE=0, INDEX, RND} inited; bool locked; bool implicit_emptied; /* Can be !=0 only if HEAP */ + bool cloned; /* 1 if this was created with clone */ const COND *pushed_cond; /** next_insert_id is the next value which should be inserted into the @@ -1166,7 +1170,7 @@ public: ref(0), key_used_on_scan(MAX_KEY), active_index(MAX_KEY), ref_length(sizeof(my_off_t)), ft_handler(0), inited(NONE), - locked(FALSE), implicit_emptied(0), + locked(FALSE), implicit_emptied(0), cloned(0), pushed_cond(0), next_insert_id(0), insert_id_for_cur_row(0), auto_inc_intervals_count(0) {} @@ -1460,10 +1464,9 @@ public: virtual int rnd_next(uchar *buf)=0; virtual int rnd_pos(uchar * buf, uchar *pos)=0; /** - One has to use this method when to find - random position by record as the plain - position() call doesn't work for some - handlers for random position. + This function only works for handlers having + HA_PRIMARY_KEY_REQUIRED_FOR_POSITION set. + It will return the row with the PK given in the record argument. */ virtual int rnd_pos_by_record(uchar *record) { @@ -1485,6 +1488,12 @@ public: virtual ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key) { return (ha_rows) 10; } + /* + If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, then it sets ref + (reference to the row, aka position, with the primary key given in + the record). + Otherwise it set ref to the current row. + */ virtual void position(const uchar *record)=0; virtual int info(uint)=0; // see my_base.h for full description virtual void get_dynamic_partition_info(PARTITION_INFO *stat_info, === modified file 'sql/item.cc' --- a/sql/item.cc 2010-08-02 09:01:24 +0000 +++ b/sql/item.cc 2010-08-27 14:12:44 +0000 @@ -255,8 +255,9 @@ my_decimal *Item::val_decimal_from_int(m my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value) { String *res; + if (!(res= val_str(&str_value))) - return 0; // NULL or EOM + return 0; if (str2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM, res->ptr(), res->length(), res->charset(), @@ -4139,8 +4140,7 @@ Item_field::fix_outer_field(THD *thd, Fi context->first_name_resolution_table, context->last_name_resolution_table, reference, REPORT_ALL_ERRORS, - !any_privileges && - TRUE, TRUE); + !any_privileges, TRUE); } return -1; } === modified file 'sql/item.h' --- a/sql/item.h 2010-08-02 09:01:24 +0000 +++ b/sql/item.h 2010-08-27 14:12:44 +0000 @@ -852,6 +852,7 @@ public: set value of aggregate function in case of no rows for grouping were found */ virtual void no_rows_in_result() {} + virtual void restore_to_before_no_rows_in_result() {} virtual Item *copy_or_same(THD *thd) { return this; } virtual Item *copy_andor_structure(THD *thd) { return this; } virtual Item *real_item() { return this; } @@ -908,6 +909,21 @@ public: virtual bool register_field_in_read_map(uchar *arg) { return 0; } virtual bool enumerate_field_refs_processor(uchar *arg) { return 0; } virtual bool mark_as_eliminated_processor(uchar *arg) { return 0; } + + /* To call bool function for all arguments */ + struct bool_func_call_args + { + Item *original_func_item; + void (Item::*bool_function)(); + }; + bool call_bool_func_processor(uchar *org_item) + { + bool_func_call_args *info= (bool_func_call_args*) org_item; + /* Avoid recursion, as walk also calls for original item */ + if (info->original_func_item != this) + (this->*(info->bool_function))(); + return FALSE; + } /* Check if a partition function is allowed SYNOPSIS @@ -2321,6 +2337,14 @@ public: return (*ref)->walk(processor, walk_subquery, arg) || (this->*processor)(arg); } + void no_rows_in_result() + { + (*ref)->no_rows_in_result(); + } + void restore_to_before_no_rows_in_result() + { + (*ref)->restore_to_before_no_rows_in_result(); + } virtual void print(String *str, enum_query_type query_type); bool result_as_longlong() { @@ -2778,6 +2802,7 @@ public: class Cached_item_str :public Cached_item { Item *item; + uint32 value_max_length; String value,tmp_value; public: Cached_item_str(THD *thd, Item *arg); === modified file 'sql/item_buff.cc' --- a/sql/item_buff.cc 2007-10-11 17:29:09 +0000 +++ b/sql/item_buff.cc 2010-07-30 13:35:06 +0000 @@ -58,7 +58,9 @@ Cached_item::~Cached_item() {} */ Cached_item_str::Cached_item_str(THD *thd, Item *arg) - :item(arg), value(min(arg->max_length, thd->variables.max_sort_length)) + :item(arg), + value_max_length(min(arg->max_length, thd->variables.max_sort_length)), + value(value_max_length) {} bool Cached_item_str::cmp(void) @@ -67,7 +69,7 @@ bool Cached_item_str::cmp(void) bool tmp; if ((res=item->val_str(&tmp_value))) - res->length(min(res->length(), value.alloced_length())); + res->length(min(res->length(), value_max_length)); if (null_value != item->null_value) { if ((null_value= item->null_value)) === modified file 'sql/item_create.cc' --- a/sql/item_create.cc 2010-05-13 11:00:53 +0000 +++ b/sql/item_create.cc 2010-08-27 14:12:44 +0000 @@ -5054,8 +5054,6 @@ create_func_cast(THD *thd, Item *a, Cast CHARSET_INFO *cs) { Item *UNINIT_VAR(res); - ulong len; - uint dec; switch (cast_type) { case ITEM_CAST_BINARY: @@ -5078,11 +5076,10 @@ create_func_cast(THD *thd, Item *a, Cast break; case ITEM_CAST_DECIMAL: { - if (c_len == NULL) - { - len= 0; - } - else + ulong len= 0; + uint dec= 0; + + if (c_len) { ulong decoded_size; errno= 0; @@ -5096,11 +5093,7 @@ create_func_cast(THD *thd, Item *a, Cast len= decoded_size; } - if (c_dec == NULL) - { - dec= 0; - } - else + if (c_dec) { ulong decoded_size; errno= 0; @@ -5136,12 +5129,9 @@ create_func_cast(THD *thd, Item *a, Cast } case ITEM_CAST_CHAR: { + int len= -1; CHARSET_INFO *real_cs= (cs ? cs : thd->variables.collation_connection); - if (c_len == NULL) - { - len= (ulong) -1L; - } - else + if (c_len) { ulong decoded_size; errno= 0; @@ -5151,7 +5141,7 @@ create_func_cast(THD *thd, Item *a, Cast my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), "cast as char", MAX_FIELD_BLOBLENGTH); return NULL; } - len= decoded_size; + len= (int) decoded_size; } res= new (thd->mem_root) Item_char_typecast(a, len, real_cs); break; === modified file 'sql/item_func.cc' --- a/sql/item_func.cc 2010-04-28 12:52:24 +0000 +++ b/sql/item_func.cc 2010-08-27 14:12:44 +0000 @@ -2242,6 +2242,8 @@ void Item_func_min_max::fix_length_and_d max_length= my_decimal_precision_to_length_no_truncation(max_int_part + decimals, decimals, unsigned_flag); + else if (cmp_type == REAL_RESULT) + max_length= float_length(decimals); cached_field_type= agg_field_type(args, arg_count); } @@ -4718,6 +4720,7 @@ bool Item_func_get_user_var::set_value(T bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); + DBUG_ASSERT(thd->lex->exchange); if (Item::fix_fields(thd, ref) || !(entry= get_variable(&thd->user_vars, name, 1))) return TRUE; @@ -4727,7 +4730,9 @@ bool Item_user_var_as_out_param::fix_fie of fields in LOAD DATA INFILE. (Since Item_user_var_as_out_param is used only there). */ - entry->collation.set(thd->variables.collation_database); + entry->collation.set(thd->lex->exchange->cs ? + thd->lex->exchange->cs : + thd->variables.collation_database); entry->update_query_id= thd->query_id; return FALSE; } === modified file 'sql/item_func.h' --- a/sql/item_func.h 2010-03-04 08:03:07 +0000 +++ b/sql/item_func.h 2010-08-23 09:46:25 +0000 @@ -217,6 +217,21 @@ public: { return functype() == *(Functype *) arg; } + + void no_rows_in_result() + { + bool_func_call_args info; + info.original_func_item= this; + info.bool_function= &Item::no_rows_in_result; + walk(&Item::call_bool_func_processor, FALSE, (uchar*) &info); + } + void restore_to_before_no_rows_in_result() + { + bool_func_call_args info; + info.original_func_item= this; + info.bool_function= &Item::restore_to_before_no_rows_in_result; + walk(&Item::call_bool_func_processor, FALSE, (uchar*) &info); + } }; === modified file 'sql/item_sum.cc' --- a/sql/item_sum.cc 2010-08-02 09:01:24 +0000 +++ b/sql/item_sum.cc 2010-08-27 14:12:44 +0000 @@ -1638,8 +1638,22 @@ void Item_sum_hybrid::cleanup() void Item_sum_hybrid::no_rows_in_result() { - was_values= FALSE; - clear(); + /* We may be called here twice in case of ref field in function */ + if (was_values) + { + was_values= FALSE; + was_null_value= value->null_value; + clear(); + } +} + +void Item_sum_hybrid::restore_to_before_no_rows_in_result() +{ + if (!was_values) + { + was_values= TRUE; + null_value= value->null_value= was_null_value; + } } @@ -3029,7 +3043,6 @@ Item_func_group_concat::Item_func_group_ tree(item->tree), unique_filter(item->unique_filter), table(item->table), - order(item->order), context(item->context), arg_count_order(item->arg_count_order), arg_count_field(item->arg_count_field), @@ -3042,6 +3055,24 @@ Item_func_group_concat::Item_func_group_ { quick_group= item->quick_group; result.set_charset(collation.collation); + + /* + Since the ORDER structures pointed to by the elements of the 'order' array + may be modified in find_order_in_list() called from + Item_func_group_concat::setup(), create a copy of those structures so that + such modifications done in this object would not have any effect on the + object being copied. + */ + ORDER *tmp; + if (!(order= (ORDER **) thd->alloc(sizeof(ORDER *) * arg_count_order + + sizeof(ORDER) * arg_count_order))) + return; + tmp= (ORDER *)(order + arg_count_order); + for (uint i= 0; i < arg_count_order; i++, tmp++) + { + memcpy(tmp, item->order[i], sizeof(ORDER)); + order[i]= tmp; + } } === modified file 'sql/item_sum.h' --- a/sql/item_sum.h 2010-08-02 09:01:24 +0000 +++ b/sql/item_sum.h 2010-08-23 09:46:25 +0000 @@ -496,7 +496,7 @@ public: enum Sumfunctype sum_func () const { return SUM_DISTINCT_FUNC; } void reset_field() {} // not used void update_field() {} // not used - virtual void no_rows_in_result() {} + void no_rows_in_result() {} void fix_length_and_dec(); enum Item_result result_type () const { return val.traits->type(); } virtual void calculate_val_and_count(); @@ -845,6 +845,7 @@ protected: enum_field_types hybrid_field_type; int cmp_sign; bool was_values; // Set if we have found at least one row (for max/min only) + bool was_null_value; public: Item_sum_hybrid(Item *item_par,int sign) @@ -876,6 +877,7 @@ protected: void cleanup(); bool any_value() { return was_values; } void no_rows_in_result(); + void restore_to_before_no_rows_in_result(); Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length); }; === modified file 'sql/item_timefunc.cc' --- a/sql/item_timefunc.cc 2010-04-28 12:52:24 +0000 +++ b/sql/item_timefunc.cc 2010-08-27 14:12:44 +0000 @@ -2996,7 +2996,7 @@ String *Item_func_maketime::val_str(Stri buf, len, MYSQL_TIMESTAMP_TIME, NullS); } - + if (make_time_with_warn((DATE_TIME_FORMAT *) 0, <ime, str)) { null_value= 1; === modified file 'sql/log.cc' --- a/sql/log.cc 2010-08-02 09:01:24 +0000 +++ b/sql/log.cc 2010-08-27 14:12:44 +0000 @@ -372,6 +372,7 @@ bool Log_to_csv_event_handler:: Open_tables_state open_tables_backup; ulonglong save_thd_options; bool save_time_zone_used; + DBUG_ENTER("log_general"); /* CSV uses TIME_to_timestamp() internally if table needs to be repaired @@ -490,7 +491,7 @@ err: thd->options= save_thd_options; thd->time_zone_used= save_time_zone_used; - return result; + DBUG_RETURN(result); } @@ -1640,6 +1641,19 @@ static int binlog_rollback(handlerton *h DBUG_RETURN(error); } +/** + Cleanup the cache. + + @param thd The client thread that wants to clean up the cache. +*/ +void MYSQL_BIN_LOG::reset_gathered_updates(THD *thd) +{ + binlog_trx_data *const trx_data= + (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton); + + trx_data->reset(); +} + void MYSQL_BIN_LOG::set_write_error(THD *thd) { DBUG_ENTER("MYSQL_BIN_LOG::set_write_error"); @@ -1748,17 +1762,17 @@ static int binlog_savepoint_rollback(han int check_binlog_magic(IO_CACHE* log, const char** errmsg) { - char magic[4]; + uchar magic[4]; DBUG_ASSERT(my_b_tell(log) == 0); - if (my_b_read(log, (uchar*) magic, sizeof(magic))) + if (my_b_read(log, magic, sizeof(magic))) { *errmsg = "I/O error reading the header from the binary log"; sql_print_error("%s, errno=%d, io cache code=%d", *errmsg, my_errno, log->error); return 1; } - if (memcmp(magic, BINLOG_MAGIC, sizeof(magic))) + if (bcmp(magic, BINLOG_MAGIC, sizeof(magic))) { *errmsg = "Binlog has bad magic number; It's not a binary log file that can be used by this version of MySQL"; return 1; @@ -1875,7 +1889,7 @@ static int find_uniq_filename(char *name file_info= dir_info->dir_entry; for (i=dir_info->number_off_files ; i-- ; file_info++) { - if (bcmp((uchar*) file_info->name, (uchar*) start, length) == 0 && + if (memcmp(file_info->name, start, length) == 0 && test_if_number(file_info->name+length, &number,0)) { set_if_bigger(max_found,(ulong) number); @@ -2653,7 +2667,7 @@ bool MYSQL_BIN_LOG::open(const char *log an extension for the binary log files. In this case we write a standard header to it. */ - if (my_b_safe_write(&log_file, (uchar*) BINLOG_MAGIC, + if (my_b_safe_write(&log_file, BINLOG_MAGIC, BIN_LOG_HEADER_SIZE)) goto err; bytes_written+= BIN_LOG_HEADER_SIZE; @@ -5088,6 +5102,22 @@ void sql_perror(const char *message) } +/* + Unfortunately, there seems to be no good way + to restore the original streams upon failure. +*/ +static bool redirect_std_streams(const char *file) +{ + if (freopen(file, "a+", stdout) && freopen(file, "a+", stderr)) + { + setbuf(stderr, NULL); + return FALSE; + } + + return TRUE; +} + + bool flush_error_log() { bool result=0; @@ -5116,11 +5146,7 @@ bool flush_error_log() setbuf(stderr, NULL); (void) my_delete(err_renamed, MYF(0)); my_rename(log_error_file,err_renamed,MYF(0)); - if (freopen(log_error_file,"a+",stdout)) - { - freopen(log_error_file,"a+",stderr); - setbuf(stderr, NULL); - } + redirect_std_streams(log_error_file); if ((fd = my_open(err_temp, O_RDONLY, MYF(0))) >= 0) { @@ -5135,13 +5161,7 @@ bool flush_error_log() result= 1; #else my_rename(log_error_file,err_renamed,MYF(0)); - if (freopen(log_error_file,"a+",stdout)) - { - FILE *reopen; - reopen= freopen(log_error_file,"a+",stderr); - setbuf(stderr, NULL); - } - else + if (redirect_std_streams(log_error_file)) result= 1; #endif VOID(pthread_mutex_unlock(&LOCK_error_log)); @@ -5192,25 +5212,9 @@ static void print_buffer_to_nt_eventlog( #endif /* __NT__ */ -/** - Prints a printf style message to the error log and, under NT, to the - Windows event log. - - This function prints the message into a buffer and then sends that buffer - to other functions to write that message to other logging sources. - - @param event_type Type of event to write (Error, Warning, or Info) - @param format Printf style format of message - @param args va_list list of arguments for the message - - @returns - The function always returns 0. The return value is present in the - signature to be compatible with other logging routines, which could - return an error (e.g. logging to the log tables) -*/ - #ifndef EMBEDDED_LIBRARY -static void print_buffer_to_file(enum loglevel level, const char *buffer) +static void print_buffer_to_file(enum loglevel level, const char *buffer, + size_t length) { time_t skr; struct tm tm_tmp; @@ -5224,7 +5228,7 @@ static void print_buffer_to_file(enum lo localtime_r(&skr, &tm_tmp); start=&tm_tmp; - fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n", + fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %.*s\n", start->tm_year % 100, start->tm_mon+1, start->tm_mday, @@ -5233,7 +5237,7 @@ static void print_buffer_to_file(enum lo start->tm_sec, (level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ? "Warning" : "Note"), - buffer); + (int) length, buffer); fflush(stderr); @@ -5241,17 +5245,30 @@ static void print_buffer_to_file(enum lo DBUG_VOID_RETURN; } +/** + Prints a printf style message to the error log and, under NT, to the + Windows event log. + + This function prints the message into a buffer and then sends that buffer + to other functions to write that message to other logging sources. + + @param level The level of the msg significance + @param format Printf style format of message + @param args va_list list of arguments for the message + @returns + The function always returns 0. The return value is present in the + signature to be compatible with other logging routines, which could + return an error (e.g. logging to the log tables) +*/ int vprint_msg_to_log(enum loglevel level, const char *format, va_list args) { char buff[1024]; + size_t length; DBUG_ENTER("vprint_msg_to_log"); -#ifdef __NT__ - size_t length= -#endif - my_vsnprintf(buff, sizeof(buff), format, args); - print_buffer_to_file(level, buff); + length= my_vsnprintf(buff, sizeof(buff), format, args); + print_buffer_to_file(level, buff, length); #ifdef __NT__ print_buffer_to_nt_eventlog(level, buff, length, sizeof(buff)); @@ -5259,7 +5276,7 @@ int vprint_msg_to_log(enum loglevel leve DBUG_RETURN(0); } -#endif /*EMBEDDED_LIBRARY*/ +#endif /* EMBEDDED_LIBRARY */ void sql_print_error(const char *format, ...) @@ -5345,7 +5362,7 @@ ulong tc_log_page_waits= 0; #define TC_LOG_HEADER_SIZE (sizeof(tc_log_magic)+1) -static const char tc_log_magic[]={(char) 254, 0x23, 0x05, 0x74}; +static const uchar tc_log_magic[]={(uchar) 254, 0x23, 0x05, 0x74}; ulong opt_tc_log_size= TC_LOG_MIN_SIZE; ulong tc_log_max_pages_used=0, tc_log_page_size=0, tc_log_cur_pages_used=0; @@ -5745,7 +5762,7 @@ int TC_LOG_MMAP::recover() HASH xids; PAGE *p=pages, *end_p=pages+npages; - if (memcmp(data, tc_log_magic, sizeof(tc_log_magic))) + if (bcmp(data, tc_log_magic, sizeof(tc_log_magic))) { sql_print_error("Bad magic header in tc log"); goto err1; === modified file 'sql/log.h' --- a/sql/log.h 2010-05-19 17:01:12 +0000 +++ b/sql/log.h 2010-08-02 19:48:56 +0000 @@ -356,10 +356,11 @@ public: /* Use this to start writing a new log file */ void new_file(); + void reset_gathered_updates(THD *thd); bool write(Log_event* event_info); // binary log write bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident); - bool write_incident(THD *thd, bool lock); + bool write_incident(THD *thd, bool lock); int write_cache(IO_CACHE *cache, bool lock_log, bool flush_and_sync); void set_write_error(THD *thd); bool check_write_error(THD *thd); === modified file 'sql/log_event.cc' --- a/sql/log_event.cc 2010-08-02 09:01:24 +0000 +++ b/sql/log_event.cc 2010-08-27 14:12:44 +0000 @@ -1673,7 +1673,7 @@ beg: precision, decimals); return bin_size; } - + case MYSQL_TYPE_FLOAT: { float fl; @@ -2306,6 +2306,53 @@ bool Query_log_event::write(IO_CACHE* fi start+= 4; } + if (thd && thd->is_current_user_used()) + { + LEX_STRING user; + LEX_STRING host; + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); + + if (thd->slave_thread && thd->has_invoker()) + { + /* user will be null, if master is older than this patch */ + user= thd->get_invoker_user(); + host= thd->get_invoker_host(); + } + else if (thd->security_ctx->priv_user) + { + Security_context *ctx= thd->security_ctx; + + user.length= strlen(ctx->priv_user); + user.str= ctx->priv_user; + if (ctx->priv_host[0] != '\0') + { + host.str= ctx->priv_host; + host.length= strlen(ctx->priv_host); + } + } + + if (user.length > 0) + { + *start++= Q_INVOKER; + + /* + Store user length and user. The max length of use is 16, so 1 byte is + enough to store the user's length. + */ + *start++= (uchar)user.length; + memcpy(start, user.str, user.length); + start+= user.length; + + /* + Store host length and host. The max length of host is 60, so 1 byte is + enough to store the host's length. + */ + *start++= (uchar)host.length; + memcpy(start, host.str, host.length); + start+= host.length; + } + } /* NOTE: When adding new status vars, please don't forget to update the MAX_SIZE_LOG_EVENT_STATUS in log_event.h and update the function @@ -2348,6 +2395,8 @@ bool Query_log_event::write(IO_CACHE* fi Query_log_event::Query_log_event() :Log_event(), data_buf(0) { + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); } @@ -2390,6 +2439,9 @@ Query_log_event::Query_log_event(THD* th { time_t end_time; + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); + error_code= errcode; time(&end_time); @@ -2574,6 +2626,8 @@ Query_log_event::Query_log_event(const c bool catalog_nz= 1; DBUG_ENTER("Query_log_event::Query_log_event(char*,...)"); + memset(&user, 0, sizeof(user)); + memset(&host, 0, sizeof(host)); common_header_len= description_event->common_header_len; post_header_len= description_event->post_header_len[event_type-1]; DBUG_PRINT("info",("event_len: %u common_header_len: %d post_header_len: %d", @@ -2728,6 +2782,20 @@ Query_log_event::Query_log_event(const c data_written= master_data_written= uint4korr(pos); pos+= 4; break; + case Q_INVOKER: + { + CHECK_SPACE(pos, end, 1); + user.length= *pos++; + CHECK_SPACE(pos, end, user.length); + user.str= (char *)pos; + pos+= user.length; + + CHECK_SPACE(pos, end, 1); + host.length= *pos++; + CHECK_SPACE(pos, end, host.length); + host.str= (char *)pos; + pos+= host.length; + } default: /* That's why you must write status vars in growing order of code */ DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\ @@ -2741,12 +2809,16 @@ Query_log_event::Query_log_event(const c time_zone_len + 1 + data_len + 1 + QUERY_CACHE_FLAGS_SIZE + + user.length + 1 + + host.length + 1 + db_len + 1, MYF(MY_WME)))) #else if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 + time_zone_len + 1 + - data_len + 1, + data_len + 1 + + user.length + 1 + + host.length + 1, MYF(MY_WME)))) #endif DBUG_VOID_RETURN; @@ -2769,6 +2841,11 @@ Query_log_event::Query_log_event(const c if (time_zone_len) copy_str_and_move(&time_zone_str, &start, time_zone_len); + if (user.length > 0) + copy_str_and_move((const char **)&(user.str), &start, user.length); + if (host.length > 0) + copy_str_and_move((const char **)&(host.str), &start, host.length); + /** if time_zone_len or catalog_len are 0, then time_zone and catalog are uninitialized at this point. shouldn't they point to the @@ -2904,7 +2981,7 @@ void Query_log_event::print_query_header if (likely(charset_inited) && (unlikely(!print_event_info->charset_inited || - bcmp((uchar*) print_event_info->charset, (uchar*) charset, 6)))) + memcmp(print_event_info->charset, charset, 6)))) { CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME)); if (cs_info) @@ -2927,8 +3004,8 @@ void Query_log_event::print_query_header } if (time_zone_len) { - if (bcmp((uchar*) print_event_info->time_zone_str, - (uchar*) time_zone_str, time_zone_len+1)) + if (memcmp(print_event_info->time_zone_str, + time_zone_str, time_zone_len+1)) { my_b_printf(file,"SET @@session.time_zone='%s'%s\n", time_zone_str, print_event_info->delimiter); @@ -3177,7 +3254,7 @@ int Query_log_event::do_apply_event(Rela thd->variables.collation_database= thd->db_charset; thd->table_map_for_update= (table_map)table_map_for_update; - + thd->set_invoker(&user, &host); /* Execute the query (note that we bypass dispatch_command()) */ const char* found_semicolon= NULL; mysql_parse(thd, thd->query(), thd->query_length(), &found_semicolon); @@ -5588,7 +5665,7 @@ void User_var_log_event::print(FILE* fil double real_val; char real_buf[FMT_G_BUFSIZE(14)]; float8get(real_val, val); - my_sprintf(real_buf, (real_buf, "%.14g", real_val)); + sprintf(real_buf, "%.14g", real_val); my_b_printf(&cache, ":=%s%s\n", real_buf, print_event_info->delimiter); break; case INT_RESULT: @@ -7505,8 +7582,7 @@ int Rows_log_event::do_apply_event(Relay { int actual_error= convert_handler_error(error, thd, table); bool idempotent_error= (idempotent_error_code(error) && - ((bit_is_set(slave_exec_mode, - SLAVE_EXEC_MODE_IDEMPOTENT)) == 1)); + (slave_exec_mode & SLAVE_EXEC_MODE_IDEMPOTENT)); bool ignored_error= (idempotent_error == 0 ? ignored_error_code(actual_error) : 0); @@ -8334,7 +8410,7 @@ Write_rows_log_event::do_before_row_oper todo: to introduce a property for the event (handler?) which forces applying the event in the replace (idempotent) fashion. */ - if (bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1 || + if ((slave_exec_mode & SLAVE_EXEC_MODE_IDEMPOTENT) || m_table->s->db_type()->db_type == DB_TYPE_NDBCLUSTER) { /* @@ -8413,7 +8489,7 @@ Write_rows_log_event::do_after_row_opera int local_error= 0; m_table->next_number_field=0; m_table->auto_increment_field_not_null= FALSE; - if (bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1 || + if ((slave_exec_mode & SLAVE_EXEC_MODE_IDEMPOTENT) || m_table->s->db_type()->db_type == DB_TYPE_NDBCLUSTER) { m_table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); @@ -8516,7 +8592,7 @@ Rows_log_event::write_row(const Relay_lo TABLE *table= m_table; // pointer to event's table int error; - int keynum; + int UNINIT_VAR(keynum); auto_afree_ptr<char> key(NULL); /* fill table->record[0] with default values */ @@ -8714,10 +8790,8 @@ int Write_rows_log_event::do_exec_row(const Relay_log_info *const rli) { DBUG_ASSERT(m_table != NULL); - int error= - write_row(rli, /* if 1 then overwrite */ - bit_is_set(slave_exec_mode, SLAVE_EXEC_MODE_IDEMPOTENT) == 1); - + int error= write_row(rli, (slave_exec_mode & SLAVE_EXEC_MODE_IDEMPOTENT)); + if (error && !thd->is_error()) { DBUG_ASSERT(0); === modified file 'sql/log_event.h' --- a/sql/log_event.h 2010-08-02 09:01:24 +0000 +++ b/sql/log_event.h 2010-08-27 14:12:44 +0000 @@ -264,7 +264,8 @@ struct sql_ex_info 1 + 2 /* type, lc_time_names_number */ + \ 1 + 2 /* type, charset_database_number */ + \ 1 + 8 /* type, table_map_for_update */ + \ - 1 + 4 /* type, master_data_written */) + 1 + 4 /* type, master_data_written */ + \ + 1 + 16 + 1 + 60/* type, user_len, user, host_len, host */) #define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \ LOG_EVENT_HEADER_LEN + /* write_header */ \ QUERY_HEADER_LEN + /* write_data */ \ @@ -333,6 +334,8 @@ struct sql_ex_info #define Q_MASTER_DATA_WRITTEN_CODE 10 +#define Q_INVOKER 11 + /* Intvar event post-header */ /* Intvar event data */ @@ -395,7 +398,7 @@ struct sql_ex_info #define ELQ_DUP_HANDLING_OFFSET ELQ_FILE_ID_OFFSET + 12 /* 4 bytes which all binlogs should begin with */ -#define BINLOG_MAGIC "\xfe\x62\x69\x6e" +#define BINLOG_MAGIC (const uchar*) "\xfe\x62\x69\x6e" /* The 2 flags below were useless : @@ -1546,6 +1549,8 @@ protected: */ class Query_log_event: public Log_event { + LEX_STRING user; + LEX_STRING host; protected: Log_event::Byte* data_buf; public: === modified file 'sql/log_event_old.cc' --- a/sql/log_event_old.cc 2010-08-02 09:01:24 +0000 +++ b/sql/log_event_old.cc 2010-08-27 14:12:44 +0000 @@ -441,7 +441,7 @@ copy_extra_record_fields(TABLE *table, DBUG_ASSERT(master_reclength <= table->s->reclength); if (master_reclength < table->s->reclength) - bmove_align(table->record[0] + master_reclength, + memcpy(table->record[0] + master_reclength, table->record[1] + master_reclength, table->s->reclength - master_reclength); @@ -720,7 +720,7 @@ static int find_and_fetch_row(TABLE *tab rnd_pos() returns the record in table->record[0], so we have to move it to table->record[1]. */ - bmove_align(table->record[1], table->record[0], table->s->reclength); + memcpy(table->record[1], table->record[0], table->s->reclength); DBUG_RETURN(error); } @@ -1213,7 +1213,7 @@ int Update_rows_log_event_old::do_exec_r overwriting the default values that where put there by the unpack_row() function. */ - bmove_align(table->record[0], m_after_image, table->s->reclength); + memcpy(table->record[0], m_after_image, table->s->reclength); copy_extra_record_fields(table, m_master_reclength, m_width); /* === modified file 'sql/mysql_priv.h' --- a/sql/mysql_priv.h 2010-08-04 18:36:11 +0000 +++ b/sql/mysql_priv.h 2010-08-27 14:12:44 +0000 @@ -1041,7 +1041,7 @@ bool mysql_opt_change_db(THD *thd, bool force_switch, bool *cur_db_changed); -void mysql_parse(THD *thd, const char *inBuf, uint length, +void mysql_parse(THD *thd, char *rawbuf, uint length, const char ** semicolon); bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length); === modified file 'sql/mysqld.cc' --- a/sql/mysqld.cc 2010-08-02 09:01:24 +0000 +++ b/sql/mysqld.cc 2010-08-27 14:12:44 +0000 @@ -187,7 +187,7 @@ typedef fp_except fp_except_t; # define fpu_control_t unsigned int # define _FPU_EXTENDED 0x300 # define _FPU_DOUBLE 0x200 -# if defined(__GNUC__) || defined(__SUNPRO_CC) +# if defined(__GNUC__) || (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590) # define _FPU_GETCW(cw) asm volatile ("fnstcw %0" : "=m" (*&cw)) # define _FPU_SETCW(cw) asm volatile ("fldcw %0" : : "m" (*&cw)) # else @@ -418,6 +418,7 @@ static bool volatile ready_to_exit; static my_bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0; static my_bool opt_short_log_format= 0; static my_bool opt_ignore_wrong_options= 0, opt_expect_abort= 0; +static my_bool opt_sync= 0; static uint kill_cached_threads, wake_thread; ulong thread_created; static ulong max_used_connections; @@ -572,7 +573,7 @@ ulong query_buff_size, slow_launch_time, ulong open_files_limit, max_binlog_size, max_relay_log_size; ulong slave_net_timeout, slave_trans_retries; ulong slave_exec_mode_options; -const char *slave_exec_mode_str= "STRICT"; +static const char *slave_exec_mode_str= "STRICT"; ulong thread_cache_size=0, thread_pool_size= 0; ulong binlog_cache_size=0; ulonglong max_binlog_cache_size=0; @@ -2548,7 +2549,9 @@ extern "C" sig_handler handle_segfault(i { time_t curr_time; struct tm tm; +#ifdef HAVE_STACKTRACE THD *thd=current_thd; +#endif /* Strictly speaking, one needs a mutex here @@ -2615,13 +2618,14 @@ the thread stack. Please read http://dev #endif /* HAVE_LINUXTHREADS */ #ifdef HAVE_STACKTRACE + if (!(test_flags & TEST_NO_STACKTRACE)) { - fprintf(stderr,"thd: 0x%lx\n",(long) thd); - fprintf(stderr,"\ -Attempting backtrace. You can use the following information to find out\n\ -where mysqld died. If you see no messages after this, something went\n\ -terribly wrong...\n"); + fprintf(stderr, "thd: 0x%lx\n",(long) thd); + fprintf(stderr, "Attempting backtrace. You can use the following " + "information to find out\nwhere mysqld died. If " + "you see no messages after this, something went\n" + "terribly wrong...\n"); my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL, my_thread_stack_size); } @@ -5897,7 +5901,7 @@ enum options_mysqld OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS, OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE, OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE, - OPT_SYNC_FRM, OPT_SYNC_BINLOG, + OPT_SYNC_FRM, OPT_SYNC_BINLOG, OPT_SYNC, OPT_SYNC_REPLICATION, OPT_SYNC_REPLICATION_SLAVE_ID, OPT_SYNC_REPLICATION_TIMEOUT, @@ -7417,6 +7421,10 @@ thread is in the relay logs.", {"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.", &opt_sync_frm, &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"sync-sys", OPT_SYNC, + "Enable/disable system sync calls. Should only be turned off when running " + "tests or debugging!!", + &opt_sync, &opt_sync, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"table_cache", OPT_TABLE_OPEN_CACHE, "Deprecated; use --table_open_cache instead.", &table_cache_size, &table_cache_size, 0, GET_ULONG, @@ -8149,10 +8157,11 @@ static int mysql_init_variables(void) /* Things with default values that are not zero */ delay_key_write_options= (uint) DELAY_KEY_WRITE_ON; - slave_exec_mode_options= 0; - slave_exec_mode_options= (uint) - find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL, - &error); + slave_exec_mode_options= find_bit_type_or_exit(slave_exec_mode_str, + &slave_exec_mode_typelib, + NULL, &error); + /* Default mode string must not yield a error. */ + DBUG_ASSERT(!error); if (error) return 1; opt_specialflag= SPECIAL_ENGLISH; @@ -8443,8 +8452,9 @@ mysqld_get_one_option(int optid, init_slave_skip_errors(argument); break; case OPT_SLAVE_EXEC_MODE: - slave_exec_mode_options= (uint) - find_bit_type_or_exit(argument, &slave_exec_mode_typelib, "", &error); + slave_exec_mode_options= find_bit_type_or_exit(argument, + &slave_exec_mode_typelib, + "", &error); if (error) return 1; break; @@ -8548,7 +8558,7 @@ mysqld_get_one_option(int optid, *val= 0; val+= 2; while (*val && my_isspace(mysqld_charset, *val)) - *val++; + val++; if (!*val) { sql_print_error("Bad syntax in replicate-rewrite-db - empty TO db!\n"); @@ -9138,7 +9148,7 @@ static int get_options(int *argc,char ** /* Set global MyISAM variables from delay_key_write_options */ fix_delay_key_write((THD*) 0, OPT_GLOBAL); /* Set global slave_exec_mode from its option */ - fix_slave_exec_mode(OPT_GLOBAL); + fix_slave_exec_mode(); global_system_variables.log_slow_filter= fix_log_slow_filter(global_system_variables.log_slow_filter); @@ -9158,6 +9168,7 @@ static int get_options(int *argc,char ** In most cases the global variables will not be used */ my_disable_locking= myisam_single_user= test(opt_external_locking == 0); + my_disable_sync= opt_sync == 0; my_default_record_cache_size=global_system_variables.read_buff_size; myisam_max_temp_length= (my_off_t) global_system_variables.myisam_max_sort_file_size; @@ -9303,6 +9314,8 @@ bool is_secure_file_path(char *path) static int fix_paths(void) { char buff[FN_REFLEN],*pos; + DBUG_ENTER("fix_paths"); + convert_dirname(mysql_home,mysql_home,NullS); /* Resolve symlinks to allow 'mysql_home' to be a relative symlink */ my_realpath(mysql_home,mysql_home,MYF(0)); @@ -9347,12 +9360,12 @@ static int fix_paths(void) charsets_dir=mysql_charsets_dir; if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) - return 1; + DBUG_RETURN(1); #ifdef HAVE_REPLICATION if (!slave_load_tmpdir) { if (!(slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE)))) - return 1; + DBUG_RETURN(1); } #endif /* HAVE_REPLICATION */ /* @@ -9373,7 +9386,7 @@ static int fix_paths(void) if (my_realpath(buff, opt_secure_file_priv, 0)) { sql_print_warning("Failed to normalize the argument for --secure-file-priv."); - return 1; + DBUG_RETURN(1); } secure_file_real_path= (char *)my_malloc(FN_REFLEN, MYF(MY_FAE)); convert_dirname(secure_file_real_path, buff, NullS); @@ -9381,7 +9394,7 @@ static int fix_paths(void) opt_secure_file_priv= secure_file_real_path; } } - return 0; + DBUG_RETURN(0); } === modified file 'sql/opt_range.cc' --- a/sql/opt_range.cc 2010-08-02 09:01:24 +0000 +++ b/sql/opt_range.cc 2010-08-27 14:12:44 +0000 @@ -7627,7 +7627,7 @@ check_quick_keys(PARAM *param, uint idx, if (unlikely(param->thd->killed != 0)) return HA_POS_ERROR; - + keynr=param->real_keynr[idx]; param->range_count++; if (!tmp_min_flag && ! tmp_max_flag && === modified file 'sql/partition_info.cc' --- a/sql/partition_info.cc 2010-05-26 18:55:40 +0000 +++ b/sql/partition_info.cc 2010-08-27 14:12:44 +0000 @@ -103,8 +103,8 @@ char *partition_info::create_default_par { do { - my_sprintf(move_ptr, (move_ptr,"p%u", (start_no + i))); - move_ptr+=MAX_PART_NAME_SIZE; + sprintf(move_ptr, "p%u", (start_no + i)); + move_ptr+= MAX_PART_NAME_SIZE; } while (++i < no_parts_arg); } else @@ -135,7 +135,7 @@ char *partition_info::create_subpartitio if (likely(ptr != NULL)) { - my_sprintf(ptr, (ptr, "%ssp%u", part_name, subpart_no)); + my_snprintf(ptr, size_alloc, "%ssp%u", part_name, subpart_no); } else { === modified file 'sql/protocol.cc' --- a/sql/protocol.cc 2010-04-28 12:52:24 +0000 +++ b/sql/protocol.cc 2010-08-27 14:12:44 +0000 @@ -596,7 +596,11 @@ void Protocol::end_partial_result_set(TH bool Protocol::flush() { #ifndef EMBEDDED_LIBRARY - return net_flush(&thd->net); + bool error; + thd->main_da.can_overwrite_status= TRUE; + error= net_flush(&thd->net); + thd->main_da.can_overwrite_status= FALSE; + return error; #else return 0; #endif @@ -636,7 +640,8 @@ bool Protocol::send_fields(List<Item> *l if (flags & SEND_NUM_ROWS) { // Packet with number of elements uchar *pos= net_store_length(buff, list->elements); - (void) my_net_write(&thd->net, buff, (size_t) (pos-buff)); + if (my_net_write(&thd->net, buff, (size_t) (pos-buff))) + DBUG_RETURN(1); } #ifndef DBUG_OFF @@ -760,7 +765,7 @@ bool Protocol::send_fields(List<Item> *l if (flags & SEND_DEFAULTS) item->send(&prot, &tmp); // Send default value if (prot.write()) - break; /* purecov: inspected */ + DBUG_RETURN(1); #ifndef DBUG_OFF field_types[count++]= field.type; #endif @@ -773,7 +778,9 @@ bool Protocol::send_fields(List<Item> *l to show that there is no cursor. Send no warning information, as it will be sent at statement end. */ - write_eof_packet(thd, &thd->net, thd->server_status, thd->total_warn_count); + if (write_eof_packet(thd, &thd->net, thd->server_status, + thd->total_warn_count)) + DBUG_RETURN(1); } DBUG_RETURN(prepare_for_send(list)); === modified file 'sql/rpl_rli.cc' --- a/sql/rpl_rli.cc 2010-08-02 09:01:24 +0000 +++ b/sql/rpl_rli.cc 2010-08-27 14:12:44 +0000 @@ -1115,8 +1115,7 @@ bool Relay_log_info::cached_charset_comp { DBUG_ENTER("Relay_log_info::cached_charset_compare"); - if (bcmp((uchar*) cached_charset, (uchar*) charset, - sizeof(cached_charset))) + if (memcmp(cached_charset, charset, sizeof(cached_charset))) { memcpy(const_cast<char*>(cached_charset), charset, sizeof(cached_charset)); DBUG_RETURN(1); === modified file 'sql/set_var.cc' --- a/sql/set_var.cc 2010-08-02 09:01:24 +0000 +++ b/sql/set_var.cc 2010-08-27 14:12:44 +0000 @@ -95,14 +95,13 @@ TYPELIB delay_key_write_typelib= delay_key_write_type_names, NULL }; -const char *slave_exec_mode_names[]= -{ "STRICT", "IDEMPOTENT", NullS }; -static const unsigned int slave_exec_mode_names_len[]= -{ sizeof("STRICT") - 1, sizeof("IDEMPOTENT") - 1, 0 }; +static const char *slave_exec_mode_names[]= { "STRICT", "IDEMPOTENT", NullS }; +static unsigned int slave_exec_mode_names_len[]= { sizeof("STRICT") - 1, + sizeof("IDEMPOTENT") - 1, 0 }; TYPELIB slave_exec_mode_typelib= { array_elements(slave_exec_mode_names)-1, "", - slave_exec_mode_names, (unsigned int *) slave_exec_mode_names_len + slave_exec_mode_names, slave_exec_mode_names_len }; static int sys_check_ftb_syntax(THD *thd, set_var *var); @@ -1267,7 +1266,7 @@ uchar *sys_var_set::value_ptr(THD *thd, void sys_var_set_slave_mode::set_default(THD *thd, enum_var_type type) { - slave_exec_mode_options= (ULL(1) << SLAVE_EXEC_MODE_STRICT); + slave_exec_mode_options= SLAVE_EXEC_MODE_STRICT; } bool sys_var_set_slave_mode::check(THD *thd, set_var *var) @@ -1275,8 +1274,7 @@ bool sys_var_set_slave_mode::check(THD * bool rc= sys_var_set::check(thd, var); if (!rc && test_all_bits(var->save_result.ulong_value, - ((ULL(1) << SLAVE_EXEC_MODE_STRICT) | - (ULL(1) << SLAVE_EXEC_MODE_IDEMPOTENT)))) + SLAVE_EXEC_MODE_STRICT | SLAVE_EXEC_MODE_IDEMPOTENT)) { rc= true; my_error(ER_SLAVE_AMBIGOUS_EXEC_MODE, MYF(0), ""); @@ -1293,21 +1291,18 @@ bool sys_var_set_slave_mode::update(THD return rc; } -void fix_slave_exec_mode(enum_var_type type) +void fix_slave_exec_mode(void) { DBUG_ENTER("fix_slave_exec_mode"); - compile_time_assert(sizeof(slave_exec_mode_options) * CHAR_BIT - > SLAVE_EXEC_MODE_LAST_BIT - 1); + if (test_all_bits(slave_exec_mode_options, - ((ULL(1) << SLAVE_EXEC_MODE_STRICT) | - (ULL(1) << SLAVE_EXEC_MODE_IDEMPOTENT)))) + SLAVE_EXEC_MODE_STRICT | SLAVE_EXEC_MODE_IDEMPOTENT)) { - sql_print_error("Ambiguous slave modes combination." - " STRICT will be used"); - slave_exec_mode_options&= ~(ULL(1) << SLAVE_EXEC_MODE_IDEMPOTENT); + sql_print_error("Ambiguous slave modes combination. STRICT will be used"); + slave_exec_mode_options&= ~SLAVE_EXEC_MODE_IDEMPOTENT; } - if (!(slave_exec_mode_options & (ULL(1) << SLAVE_EXEC_MODE_IDEMPOTENT))) - slave_exec_mode_options|= (ULL(1)<< SLAVE_EXEC_MODE_STRICT); + if (!(slave_exec_mode_options & SLAVE_EXEC_MODE_IDEMPOTENT)) + slave_exec_mode_options|= SLAVE_EXEC_MODE_STRICT; DBUG_VOID_RETURN; } === modified file 'sql/set_var.h' --- a/sql/set_var.h 2010-08-02 09:01:24 +0000 +++ b/sql/set_var.h 2010-08-27 14:12:44 +0000 @@ -1458,7 +1458,7 @@ sys_var *find_sys_var(THD *thd, const ch int sql_set_variables(THD *thd, List<set_var_base> *var_list); bool not_all_support_one_shot(List<set_var_base> *var_list); void fix_delay_key_write(THD *thd, enum_var_type type); -void fix_slave_exec_mode(enum_var_type type); +void fix_slave_exec_mode(void); ulong fix_sql_mode(ulong sql_mode); extern sys_var_const_str sys_charset_system; extern sys_var_str sys_init_connect; === modified file 'sql/slave.cc' --- a/sql/slave.cc 2010-08-02 09:01:24 +0000 +++ b/sql/slave.cc 2010-08-27 14:12:44 +0000 @@ -2073,7 +2073,7 @@ int apply_event_and_update_pos(Log_event DBUG_PRINT("info", ("thd->options: %s%s; rli->last_event_start_time: %lu", FLAGSTR(thd->options, OPTION_NOT_AUTOCOMMIT), FLAGSTR(thd->options, OPTION_BEGIN), - rli->last_event_start_time)); + (ulong) rli->last_event_start_time)); /* Execute the event to change the database and update the binary @@ -2846,8 +2846,8 @@ pthread_handler_t handle_slave_sql(void char llbuff[22],llbuff1[22]; char saved_log_name[FN_REFLEN]; char saved_master_log_name[FN_REFLEN]; - my_off_t saved_log_pos; - my_off_t saved_master_log_pos; + my_off_t UNINIT_VAR(saved_log_pos); + my_off_t UNINIT_VAR(saved_master_log_pos); my_off_t saved_skip= 0; Relay_log_info* rli = &((Master_info*)arg)->rli; const char *errmsg; === modified file 'sql/spatial.cc' --- a/sql/spatial.cc 2009-10-15 21:38:29 +0000 +++ b/sql/spatial.cc 2010-08-27 14:12:44 +0000 @@ -53,7 +53,7 @@ static Geometry::Class_info **ci_collect Geometry::ci_collection+Geometry::wkb_last + 1; Geometry::Class_info::Class_info(const char *name, int type_id, - void(*create_func)(void *)): + create_geom_t create_func): m_type_id(type_id), m_create_func(create_func) { m_name.str= (char *) name; @@ -62,39 +62,39 @@ Geometry::Class_info::Class_info(const c ci_collection[type_id]= this; } -static void create_point(void *buffer) +static Geometry *create_point(char *buffer) { - new(buffer) Gis_point; + return new (buffer) Gis_point; } -static void create_linestring(void *buffer) +static Geometry *create_linestring(char *buffer) { - new(buffer) Gis_line_string; + return new (buffer) Gis_line_string; } -static void create_polygon(void *buffer) +static Geometry *create_polygon(char *buffer) { - new(buffer) Gis_polygon; + return new (buffer) Gis_polygon; } -static void create_multipoint(void *buffer) +static Geometry *create_multipoint(char *buffer) { - new(buffer) Gis_multi_point; + return new (buffer) Gis_multi_point; } -static void create_multipolygon(void *buffer) +static Geometry *create_multipolygon(char *buffer) { - new(buffer) Gis_multi_polygon; + return new (buffer) Gis_multi_polygon; } -static void create_multilinestring(void *buffer) +static Geometry *create_multilinestring(char *buffer) { - new(buffer) Gis_multi_line_string; + return new (buffer) Gis_multi_line_string; } -static void create_geometrycollection(void *buffer) +static Geometry *create_geometrycollection(char *buffer) { - new(buffer) Gis_geometry_collection; + return new (buffer) Gis_geometry_collection; } @@ -145,6 +145,15 @@ Geometry::Class_info *Geometry::find_cla } +Geometry *Geometry::create_by_typeid(Geometry_buffer *buffer, int type_id) +{ + Class_info *ci; + if (!(ci= find_class(type_id))) + return NULL; + return (*ci->m_create_func)(buffer->data); +} + + Geometry *Geometry::construct(Geometry_buffer *buffer, const char *data, uint32 data_len) { @@ -153,6 +162,7 @@ Geometry *Geometry::construct(Geometry_b if (data_len < SRID_SIZE + WKB_HEADER_SIZE) // < 4 + (1 + 4) return NULL; + /* + 1 to skip the byte order (stored in position SRID_SIZE). */ geom_type= uint4korr(data + SRID_SIZE + 1); if (!(result= create_by_typeid(buffer, (int) geom_type))) return NULL; @@ -177,9 +187,7 @@ Geometry *Geometry::create_from_wkt(Geom if (!(ci= find_class(name.str, name.length)) || wkt->reserve(1 + 4, 512)) return NULL; - (*ci->m_create_func)((void *)buffer); - Geometry *result= (Geometry *)buffer; - + Geometry *result= (*ci->m_create_func)(buffer->data); wkt->q_append((char) wkb_ndr); wkt->q_append((uint32) result->get_class_info()->m_type_id); if (trs->check_next_symbol('(') || === modified file 'sql/spatial.h' --- a/sql/spatial.h 2009-09-07 20:50:10 +0000 +++ b/sql/spatial.h 2010-08-27 14:12:44 +0000 @@ -225,15 +225,18 @@ public: { wkb_xdr= 0, /* Big Endian */ wkb_ndr= 1 /* Little Endian */ - }; + }; + + /** Callback which creates Geometry objects on top of a given placement. */ + typedef Geometry *(*create_geom_t)(char *); class Class_info { public: LEX_STRING m_name; int m_type_id; - void (*m_create_func)(void *); - Class_info(const char *name, int type_id, void(*create_func)(void *)); + create_geom_t m_create_func; + Class_info(const char *name, int type_id, create_geom_t create_func); }; virtual const Class_info *get_class_info() const=0; @@ -263,15 +266,7 @@ public: virtual int geometry_n(uint32 num, String *result) const { return -1; } public: - static Geometry *create_by_typeid(Geometry_buffer *buffer, int type_id) - { - Class_info *ci; - if (!(ci= find_class((int) type_id))) - return NULL; - (*ci->m_create_func)((void *)buffer); - return my_reinterpret_cast(Geometry *)(buffer); - } - + static Geometry *create_by_typeid(Geometry_buffer *buffer, int type_id); static Geometry *construct(Geometry_buffer *buffer, const char *data, uint32 data_len); static Geometry *create_from_wkt(Geometry_buffer *buffer, @@ -528,11 +523,8 @@ public: const Class_info *get_class_info() const; }; -const int geometry_buffer_size= sizeof(Gis_point); -struct Geometry_buffer -{ - void *arr[(geometry_buffer_size - 1)/sizeof(void *) + 1]; -}; +struct Geometry_buffer : public + my_aligned_storage<sizeof(Gis_point), MY_ALIGNOF(Gis_point)> {}; #endif /*HAVE_SPATAIAL*/ #endif === modified file 'sql/sql_acl.cc' --- a/sql/sql_acl.cc 2010-08-02 09:01:24 +0000 +++ b/sql/sql_acl.cc 2010-08-27 14:12:44 +0000 @@ -194,6 +194,7 @@ static bool compare_hostname(const acl_h const char *ip); static my_bool acl_load(THD *thd, TABLE_LIST *tables); static my_bool grant_load(THD *thd, TABLE_LIST *tables); +static inline void get_grantor(THD *thd, char* grantor); /* Convert scrambled password to binary form, according to scramble type, @@ -2705,6 +2706,20 @@ end: DBUG_RETURN(result); } +static inline void get_grantor(THD *thd, char *grantor) +{ + const char *user= thd->security_ctx->user; + const char *host= thd->security_ctx->host_or_ip; + +#if defined(HAVE_REPLICATION) + if (thd->slave_thread && thd->has_invoker()) + { + user= thd->get_invoker_user().str; + host= thd->get_invoker_host().str; + } +#endif + strxmov(grantor, user, "@", host, NullS); +} static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, TABLE *table, const LEX_USER &combo, @@ -2719,9 +2734,7 @@ static int replace_table_table(THD *thd, uchar user_key[MAX_KEY_LENGTH]; DBUG_ENTER("replace_table_table"); - strxmov(grantor, thd->security_ctx->user, "@", - thd->security_ctx->host_or_ip, NullS); - + get_grantor(thd, grantor); /* The following should always succeed as new users are created before this function is called! @@ -2851,9 +2864,7 @@ static int replace_routine_table(THD *th DBUG_RETURN(-1); } - strxmov(grantor, thd->security_ctx->user, "@", - thd->security_ctx->host_or_ip, NullS); - + get_grantor(thd, grantor); /* New users are created before this function is called. === modified file 'sql/sql_base.cc' --- a/sql/sql_base.cc 2010-08-02 09:01:24 +0000 +++ b/sql/sql_base.cc 2010-08-27 14:12:44 +0000 @@ -5696,7 +5696,7 @@ static void update_field_dependencies(TH DBUG_ENTER("update_field_dependencies"); if (thd->mark_used_columns != MARK_COLUMNS_NONE) { - MY_BITMAP *current_bitmap; + MY_BITMAP *bitmap; /* We always want to register the used keys, as the column bitmap may have @@ -5707,9 +5707,9 @@ static void update_field_dependencies(TH table->merge_keys.merge(field->part_of_key); if (thd->mark_used_columns == MARK_COLUMNS_READ) - current_bitmap= table->read_set; + bitmap= table->read_set; else - current_bitmap= table->write_set; + bitmap= table->write_set; /* The test-and-set mechanism in the bitmap is not reliable during @@ -5718,7 +5718,7 @@ static void update_field_dependencies(TH only those columns that are used in the SET clause. I.e they are being set here. See multi_update::prepare() */ - if (bitmap_fast_test_and_set(current_bitmap, field->field_index)) + if (bitmap_fast_test_and_set(bitmap, field->field_index)) { if (thd->mark_used_columns == MARK_COLUMNS_WRITE) { @@ -8424,15 +8424,15 @@ my_bool mysql_rm_tmp_tables(void) (file->name[1] == '.' && !file->name[2]))) continue; - if (!bcmp((uchar*) file->name, (uchar*) tmp_file_prefix, - tmp_file_prefix_length)) + if (!memcmp(file->name, tmp_file_prefix, + tmp_file_prefix_length)) { char *ext= fn_ext(file->name); uint ext_len= strlen(ext); uint filePath_len= my_snprintf(filePath, sizeof(filePath), "%s%c%s", tmpdir, FN_LIBCHAR, file->name); - if (!bcmp((uchar*) reg_ext, (uchar*) ext, ext_len)) + if (!strcmp(reg_ext, ext)) { handler *handler_file= 0; /* We should cut file extention before deleting of table */ === modified file 'sql/sql_cache.cc' --- a/sql/sql_cache.cc 2010-01-29 10:42:31 +0000 +++ b/sql/sql_cache.cc 2010-08-27 14:12:44 +0000 @@ -1679,7 +1679,8 @@ def_week_frmt: %lu, in_trans: %d, autoco thd->limit_found_rows = query->found_rows(); thd->status_var.last_query_cost= 0.0; thd->query_plan_flags= (thd->query_plan_flags & ~QPLAN_QC_NO) | QPLAN_QC; - thd->main_da.disable_status(); + if (!thd->main_da.is_set()) + thd->main_da.disable_status(); BLOCK_UNLOCK_RD(query_block); DBUG_RETURN(1); // Result sent to client === modified file 'sql/sql_class.cc' --- a/sql/sql_class.cc 2010-08-02 09:01:24 +0000 +++ b/sql/sql_class.cc 2010-08-27 14:12:44 +0000 @@ -747,6 +747,9 @@ THD::THD() thr_lock_owner_init(&main_lock_id, &lock_info); m_internal_handler= NULL; + current_user_used= FALSE; + memset(&invoker_user, 0, sizeof(invoker_user)); + memset(&invoker_host, 0, sizeof(invoker_host)); } @@ -1072,6 +1075,9 @@ void add_to_status(STATUS_VAR *to_var, S while (to != end) *(to++)+= *(from++); + + to_var->bytes_received+= from_var->bytes_received; + to_var->bytes_sent+= from_var->bytes_sent; } /* @@ -1097,6 +1103,9 @@ void add_diff_to_status(STATUS_VAR *to_v while (to != end) *(to++)+= *(from++) - *(dec++); + + to_var->bytes_received+= from_var->bytes_received - dec_var->bytes_received;; + to_var->bytes_sent+= from_var->bytes_sent - dec_var->bytes_sent; } #define SECONDS_TO_WAIT_FOR_KILL 2 @@ -1303,6 +1312,7 @@ void THD::cleanup_after_query() where= THD::DEFAULT_WHERE; /* reset table map for multi-table update */ table_map_for_update= 0; + clean_current_user_used(); } @@ -3336,6 +3346,22 @@ void THD::set_query(char *query_arg, uin pthread_mutex_unlock(&LOCK_thd_data); } +void THD::get_definer(LEX_USER *definer) +{ + set_current_user_used(); +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + if (slave_thread && has_invoker()) + { + definer->user = invoker_user; + definer->host= invoker_host; + definer->password.str= NULL; + definer->password.length= 0; + } + else +#endif + get_default_definer(this, definer); +} + /** Mark transaction to rollback and mark error as fatal to a sub-statement. @@ -3434,9 +3460,13 @@ bool xid_cache_insert(XID *xid, enum xa_ bool xid_cache_insert(XID_STATE *xid_state) { pthread_mutex_lock(&LOCK_xid_cache); - DBUG_ASSERT(hash_search(&xid_cache, xid_state->xid.key(), - xid_state->xid.key_length())==0); - my_bool res=my_hash_insert(&xid_cache, (uchar*)xid_state); + if (hash_search(&xid_cache, xid_state->xid.key(), xid_state->xid.key_length())) + { + pthread_mutex_unlock(&LOCK_xid_cache); + my_error(ER_XAER_DUPID, MYF(0)); + return TRUE; + } + my_bool res= my_hash_insert(&xid_cache, (uchar*)xid_state); pthread_mutex_unlock(&LOCK_xid_cache); return res; } === modified file 'sql/sql_class.h' --- a/sql/sql_class.h 2010-08-02 09:01:24 +0000 +++ b/sql/sql_class.h 2010-08-27 14:12:44 +0000 @@ -86,9 +86,10 @@ enum enum_ha_read_modes { RFIRST, RNEXT, enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE }; enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON, DELAY_KEY_WRITE_ALL }; -enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT, - SLAVE_EXEC_MODE_IDEMPOTENT, - SLAVE_EXEC_MODE_LAST_BIT}; + +#define SLAVE_EXEC_MODE_STRICT (1U << 0) +#define SLAVE_EXEC_MODE_IDEMPOTENT (1U << 1) + enum enum_mark_columns { MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE}; @@ -415,12 +416,14 @@ struct system_variables }; -/* per thread status variables */ +/** + Per thread status variables. + Must be long/ulong up to last_system_status_var so that + add_to_status/add_diff_to_status can work. +*/ typedef struct system_status_var { - ulonglong bytes_received; - ulonglong bytes_sent; ulong com_other; ulong com_stat[(uint) SQLCOM_END]; ulong created_tmp_disk_tables; @@ -476,13 +479,14 @@ typedef struct system_status_var Number of statements sent from the client */ ulong questions; + + ulonglong bytes_received; + ulonglong bytes_sent; /* IMPORTANT! SEE last_system_status_var DEFINITION BELOW. - Below 'last_system_status_var' are all variables which doesn't make any - sense to add to the /global/ status variable counter. - Status variables which it does not make sense to add to - global status variable counter + Below 'last_system_status_var' are all variables that cannot be handled + automatically by add_to_status()/add_diff_to_status(). */ double last_query_cost; } STATUS_VAR; @@ -2360,6 +2364,18 @@ public: Protected with LOCK_thd_data mutex. */ void set_query(char *query_arg, uint32 query_length_arg); + void set_current_user_used() { current_user_used= TRUE; } + bool is_current_user_used() { return current_user_used; } + void clean_current_user_used() { current_user_used= FALSE; } + void get_definer(LEX_USER *definer); + void set_invoker(const LEX_STRING *user, const LEX_STRING *host) + { + invoker_user= *user; + invoker_host= *host; + } + LEX_STRING get_invoker_user() { return invoker_user; } + LEX_STRING get_invoker_host() { return invoker_host; } + bool has_invoker() { return invoker_user.length > 0; } private: /** The current internal error handler for this thread, or NULL. */ Internal_error_handler *m_internal_handler; @@ -2379,6 +2395,25 @@ private: tree itself is reused between executions and thus is stored elsewhere. */ MEM_ROOT main_mem_root; + + /** + It will be set TURE if CURRENT_USER() is called in account management + statements or default definer is set in CREATE/ALTER SP, SF, Event, + TRIGGER or VIEW statements. + + Current user will be binlogged into Query_log_event if current_user_used + is TRUE; It will be stored into invoker_host and invoker_user by SQL thread. + */ + bool current_user_used; + + /** + It points to the invoker in the Query_log_event. + SQL thread use it as the default definer in CREATE/ALTER SP, SF, Event, + TRIGGER or VIEW statements or current user in account management + statements if it is not NULL. + */ + LEX_STRING invoker_user; + LEX_STRING invoker_host; }; @@ -2438,7 +2473,7 @@ class select_result :public Sql_alloc { protected: THD *thd; SELECT_LEX_UNIT *unit; - uint nest_level; + int nest_level; public: select_result(); virtual ~select_result() {}; @@ -2579,7 +2614,7 @@ public: Creates a select_export to represent INTO OUTFILE <filename> with a defined level of subquery nesting. */ - select_export(sql_exchange *ex, uint nest_level_arg) :select_to_file(ex) + select_export(sql_exchange *ex, int nest_level_arg) :select_to_file(ex) { nest_level= nest_level_arg; } @@ -2596,7 +2631,7 @@ public: Creates a select_export to represent INTO DUMPFILE <filename> with a defined level of subquery nesting. */ - select_dump(sql_exchange *ex, uint nest_level_arg) : + select_dump(sql_exchange *ex, int nest_level_arg) : select_to_file(ex) { nest_level= nest_level_arg; @@ -3073,7 +3108,7 @@ public: Creates a select_dumpvar to represent INTO <variable> with a defined level of subquery nesting. */ - select_dumpvar(uint nest_level_arg) + select_dumpvar(int nest_level_arg) { var_list.empty(); row_count= 0; === modified file 'sql/sql_cursor.cc' --- a/sql/sql_cursor.cc 2008-12-10 14:16:21 +0000 +++ b/sql/sql_cursor.cc 2010-07-21 07:56:43 +0000 @@ -658,7 +658,12 @@ void Materialized_cursor::fetch(ulong nu if ((res= table->file->rnd_next(table->record[0]))) break; /* Send data only if the read was successful. */ - result->send_data(item_list); + /* + If network write failed (i.e. due to a closed socked), + the error has already been set. Just return. + */ + if (result->send_data(item_list)) + return; } switch (res) { === modified file 'sql/sql_insert.cc' --- a/sql/sql_insert.cc 2010-08-04 18:36:11 +0000 +++ b/sql/sql_insert.cc 2010-08-27 14:12:44 +0000 @@ -3913,6 +3913,17 @@ void select_create::abort() if (table) { + if (thd->lex->sql_command == SQLCOM_CREATE_TABLE && + thd->current_stmt_binlog_row_based && + !(thd->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) && + mysql_bin_log.is_open()) + { + /* + This should be removed after BUG#47899. + */ + mysql_bin_log.reset_gathered_updates(thd); + } + table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); if (!create_info->table_existed) === modified file 'sql/sql_lex.cc' --- a/sql/sql_lex.cc 2010-08-02 09:01:24 +0000 +++ b/sql/sql_lex.cc 2010-08-27 14:12:44 +0000 @@ -111,7 +111,7 @@ st_parsing_options::reset() } -bool Lex_input_stream::init(THD *thd, const char *buff, unsigned int length) +bool Lex_input_stream::init(THD *thd, char *buff, unsigned int length) { DBUG_EXECUTE_IF("bug42064_simulate_oom", DBUG_SET("+d,simulate_out_of_memory");); @@ -1302,11 +1302,10 @@ int MYSQLlex(void *arg, void *yythd) ulong version; version=strtol(version_str, NULL, 10); - /* Accept 'M' 'm' 'm' 'd' 'd' */ - lip->yySkipn(5); - if (version <= MYSQL_VERSION_ID) { + /* Accept 'M' 'm' 'm' 'd' 'd' */ + lip->yySkipn(5); /* Expand the content of the special comment as real code */ lip->set_echo(TRUE); state=MY_LEX_START; @@ -1314,7 +1313,16 @@ int MYSQLlex(void *arg, void *yythd) } else { + /* + Patch and skip the conditional comment to avoid it + being propagated infinitely (eg. to a slave). + */ + char *pcom= lip->yyUnput(' '); comment_closed= ! consume_comment(lip, 1); + if (! comment_closed) + { + *pcom= '!'; + } /* version allowed to have one level of comment inside. */ } } === modified file 'sql/sql_lex.h' --- a/sql/sql_lex.h 2010-08-02 09:01:24 +0000 +++ b/sql/sql_lex.h 2010-08-27 14:12:44 +0000 @@ -1179,7 +1179,7 @@ public: @retval FALSE OK @retval TRUE Error */ - bool init(THD *thd, const char *buff, unsigned int length); + bool init(THD *thd, char *buff, unsigned int length); /** Set the echo mode. @@ -1294,6 +1294,20 @@ public: } /** + Puts a character back into the stream, canceling + the effect of the last yyGet() or yySkip(). + Note that the echo mode should not change between calls + to unput, get, or skip from the stream. + */ + char *yyUnput(char ch) + { + *--m_ptr= ch; + if (m_echo) + m_cpp_ptr--; + return m_ptr; + } + + /** End of file indicator for the query text to parse. @return true if there are no more characters to parse */ @@ -1439,7 +1453,7 @@ public: private: /** Pointer to the current position in the raw input stream. */ - const char *m_ptr; + char *m_ptr; /** Starting position of the last token parsed, in the raw buffer. */ const char *m_tok_start; @@ -1971,7 +1985,7 @@ public: @retval FALSE OK @retval TRUE Error */ - bool init(THD *thd, const char *buff, unsigned int length) + bool init(THD *thd, char *buff, unsigned int length) { return m_lip.init(thd, buff, length); } === modified file 'sql/sql_list.h' --- a/sql/sql_list.h 2010-08-02 16:39:45 +0000 +++ b/sql/sql_list.h 2010-08-27 14:12:44 +0000 @@ -74,7 +74,7 @@ public: SQL_I_List() { empty(); } - SQL_I_List(const SQL_I_List &tmp) :Sql_alloc() + SQL_I_List(const SQL_I_List &tmp) : Sql_alloc() { elements= tmp.elements; first= tmp.first; === modified file 'sql/sql_load.cc' --- a/sql/sql_load.cc 2010-08-02 16:39:45 +0000 +++ b/sql/sql_load.cc 2010-08-27 14:12:44 +0000 @@ -128,6 +128,7 @@ int mysql_load(THD *thd,sql_exchange *ex bool is_fifo=0; #ifndef EMBEDDED_LIBRARY LOAD_FILE_INFO lf_info; + THD::killed_state killed_status; #endif char *db = table_list->db; // This is never null /* @@ -138,7 +139,6 @@ int mysql_load(THD *thd,sql_exchange *ex char *tdb= thd->db ? thd->db : db; // Result is never null ulong skip_lines= ex->skip_lines; bool transactional_table; - THD::killed_state killed_status= THD::NOT_KILLED; DBUG_ENTER("mysql_load"); #ifdef EMBEDDED_LIBRARY @@ -455,7 +455,11 @@ int mysql_load(THD *thd,sql_exchange *ex error=1; thd->killed= THD::KILL_QUERY; };); - killed_status= (error == 0)? THD::NOT_KILLED : thd->killed; + +#ifndef EMBEDDED_LIBRARY + killed_status= (error == 0) ? THD::NOT_KILLED : thd->killed; +#endif + /* We must invalidate the table in query cache before binlog writing and ha_autocommit_... @@ -1202,29 +1206,6 @@ int READ_INFO::read_field() while ( to < end_of_buff) { chr = GET; -#ifdef USE_MB - if ((my_mbcharlen(read_charset, chr) > 1) && - to+my_mbcharlen(read_charset, chr) <= end_of_buff) - { - uchar* p = (uchar*)to; - *to++ = chr; - int ml = my_mbcharlen(read_charset, chr); - int i; - for (i=1; i<ml; i++) { - chr = GET; - if (chr == my_b_EOF) - goto found_eof; - *to++ = chr; - } - if (my_ismbchar(read_charset, - (const char *)p, - (const char *)to)) - continue; - for (i=0; i<ml; i++) - PUSH((uchar) *--to); - chr = GET; - } -#endif if (chr == my_b_EOF) goto found_eof; if (chr == escape_char) @@ -1309,6 +1290,39 @@ int READ_INFO::read_field() return 0; } } +#ifdef USE_MB + if (my_mbcharlen(read_charset, chr) > 1 && + to + my_mbcharlen(read_charset, chr) <= end_of_buff) + { + uchar* p= (uchar*) to; + int ml, i; + *to++ = chr; + + ml= my_mbcharlen(read_charset, chr); + + for (i= 1; i < ml; i++) + { + chr= GET; + if (chr == my_b_EOF) + { + /* + Need to back up the bytes already ready from illformed + multi-byte char + */ + to-= i; + goto found_eof; + } + *to++ = chr; + } + if (my_ismbchar(read_charset, + (const char *)p, + (const char *)to)) + continue; + for (i= 0; i < ml; i++) + PUSH((uchar) *--to); + chr= GET; + } +#endif *to++ = (uchar) chr; } /* === modified file 'sql/sql_parse.cc' --- a/sql/sql_parse.cc 2010-08-02 09:01:24 +0000 +++ b/sql/sql_parse.cc 2010-08-27 14:12:44 +0000 @@ -473,6 +473,7 @@ static void handle_bootstrap_impl(THD *t buff= (char*) thd->net.buff; if (!fgets(buff + length, thd->net.max_packet - length, file)) { + net_end_statement(thd); bootstrap_error= 1; break; } @@ -1597,13 +1598,13 @@ bool dispatch_command(enum enum_server_c (sf_malloc_max_memory+1023L)/1024L); } #endif -#ifdef EMBEDDED_LIBRARY - /* Store the buffer in permanent memory */ - my_ok(thd, 0, 0, buff); -#else +#ifndef EMBEDDED_LIBRARY VOID(my_net_write(net, (uchar*) buff, length)); VOID(net_flush(net)); thd->main_da.disable_status(); +#else + /* Store the buffer in permanent memory */ + my_ok(thd, 0, 0, buff); #endif break; } @@ -4792,7 +4793,7 @@ create_sp_error: my_error(ER_XAER_NOTA, MYF(0)); break; } - thd->transaction.xid_state.xa_state=XA_ACTIVE; + thd->transaction.xid_state.xa_state= XA_ACTIVE; my_ok(thd); break; } @@ -4812,16 +4813,16 @@ create_sp_error: my_error(ER_XAER_OUTSIDE, MYF(0)); break; } - if (xid_cache_search(thd->lex->xid)) - { - my_error(ER_XAER_DUPID, MYF(0)); - break; - } DBUG_ASSERT(thd->transaction.xid_state.xid.is_null()); - thd->transaction.xid_state.xa_state=XA_ACTIVE; + thd->transaction.xid_state.xa_state= XA_ACTIVE; thd->transaction.xid_state.rm_error= 0; thd->transaction.xid_state.xid.set(thd->lex->xid); - xid_cache_insert(&thd->transaction.xid_state); + if (xid_cache_insert(&thd->transaction.xid_state)) + { + thd->transaction.xid_state.xa_state= XA_NOTR; + thd->transaction.xid_state.xid.null(); + break; + } thd->transaction.all.modified_non_trans_table= FALSE; thd->options= ((thd->options & ~(OPTION_KEEP_LOG)) | OPTION_BEGIN); thd->server_status|= SERVER_STATUS_IN_TRANS; @@ -4875,6 +4876,16 @@ create_sp_error: case SQLCOM_XA_COMMIT: if (!thd->transaction.xid_state.xid.eq(thd->lex->xid)) { + /* + xid_state.in_thd is always true beside of xa recovery + procedure. Note, that there is no race condition here + between xid_cache_search and xid_cache_delete, since we're always + deleting our own XID (thd->lex->xid == thd->transaction.xid_state.xid). + The only case when thd->lex->xid != thd->transaction.xid_state.xid + and xid_state->in_thd == 0 is in ha_recover() functionality, + which is called before starting client connections, and thus is + always single-threaded. + */ XID_STATE *xs=xid_cache_search(thd->lex->xid); if (!xs || xs->in_thd) my_error(ER_XAER_NOTA, MYF(0)); @@ -5995,13 +6006,13 @@ void mysql_init_multi_delete(LEX *lex) Parse a query. @param thd Current thread - @param inBuf Begining of the query text + @param rawbuf Begining of the query text @param length Length of the query text @param[out] found_semicolon For multi queries, position of the character of the next query in the query text. */ -void mysql_parse(THD *thd, const char *inBuf, uint length, +void mysql_parse(THD *thd, char *rawbuf, uint length, const char ** found_semicolon) { DBUG_ENTER("mysql_parse"); @@ -6027,7 +6038,7 @@ void mysql_parse(THD *thd, const char *i lex_start(thd); mysql_reset_thd_for_next_command(thd); - if (query_cache_send_result_to_client(thd, (char*) inBuf, length) <= 0) + if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0) { LEX *lex= thd->lex; @@ -6036,7 +6047,7 @@ void mysql_parse(THD *thd, const char *i Parser_state parser_state; bool err; - if (!(err= parser_state.init(thd, inBuf, length))) + if (!(err= parser_state.init(thd, rawbuf, length))) { err= parse_sql(thd, & parser_state, NULL); *found_semicolon= parser_state.m_lip.found_semicolon; @@ -6122,14 +6133,14 @@ void mysql_parse(THD *thd, const char *i 1 can be ignored */ -bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length) +bool mysql_test_parse_for_slave(THD *thd, char *rawbuf, uint length) { LEX *lex= thd->lex; bool error= 0; DBUG_ENTER("mysql_test_parse_for_slave"); Parser_state parser_state; - if (!(error= parser_state.init(thd, inBuf, length))) + if (!(error= parser_state.init(thd, rawbuf, length))) { lex_start(thd); mysql_reset_thd_for_next_command(thd); @@ -7718,7 +7729,7 @@ LEX_USER *create_default_definer(THD *th if (! (definer= (LEX_USER*) thd->alloc(sizeof(LEX_USER)))) return 0; - get_default_definer(thd, definer); + thd->get_definer(definer); return definer; } === modified file 'sql/sql_partition.cc' --- a/sql/sql_partition.cc 2010-08-02 09:01:24 +0000 +++ b/sql/sql_partition.cc 2010-08-27 14:12:44 +0000 @@ -3876,7 +3876,7 @@ void get_partition_set(const TABLE *tabl */ bool mysql_unpack_partition(THD *thd, - const char *part_buf, uint part_info_len, + char *part_buf, uint part_info_len, const char *part_state, uint part_state_len, TABLE* table, bool is_create_table_ind, handlerton *default_db_type, === modified file 'sql/sql_partition.h' --- a/sql/sql_partition.h 2009-12-13 20:29:50 +0000 +++ b/sql/sql_partition.h 2010-07-29 03:00:57 +0000 @@ -78,7 +78,7 @@ void get_full_part_id_from_key(const TAB KEY *key_info, const key_range *key_spec, part_id_range *part_spec); -bool mysql_unpack_partition(THD *thd, const char *part_buf, +bool mysql_unpack_partition(THD *thd, char *part_buf, uint part_info_len, const char *part_state, uint part_state_len, TABLE *table, bool is_create_table_ind, === modified file 'sql/sql_prepare.cc' --- a/sql/sql_prepare.cc 2010-08-02 09:01:24 +0000 +++ b/sql/sql_prepare.cc 2010-08-27 14:12:44 +0000 @@ -263,8 +263,11 @@ static bool send_prep_stmt(Prepared_stat &stmt->lex->param_list, Protocol::SEND_EOF); } - /* Flag that a response has already been sent */ - thd->main_da.disable_status(); + + if (!error) + /* Flag that a response has already been sent */ + thd->main_da.disable_status(); + DBUG_RETURN(error); } #else @@ -790,7 +793,7 @@ static bool insert_params_with_log(Prepa type (the types are supplied at execute). Check that the supplied type of placeholder can accept a data stream. */ - else if (!is_param_long_data_type(param)) + else if (! is_param_long_data_type(param)) DBUG_RETURN(1); res= param->query_val_str(&str); if (param->convert_str_value(thd)) @@ -836,7 +839,7 @@ static bool insert_params(Prepared_state type (the types are supplied at execute). Check that the supplied type of placeholder can accept a data stream. */ - else if (is_param_long_data_type(param)) + else if (! is_param_long_data_type(param)) DBUG_RETURN(1); if (param->convert_str_value(stmt->thd)) DBUG_RETURN(1); /* out of memory */ === modified file 'sql/sql_repl.cc' --- a/sql/sql_repl.cc 2010-08-02 09:01:24 +0000 +++ b/sql/sql_repl.cc 2010-08-27 14:12:44 +0000 @@ -218,8 +218,7 @@ bool log_in_use(const char* log_name) if ((linfo = tmp->current_linfo)) { pthread_mutex_lock(&linfo->lock); - result = !bcmp((uchar*) log_name, (uchar*) linfo->log_file_name, - log_name_len); + result = !memcmp(log_name, linfo->log_file_name, log_name_len); pthread_mutex_unlock(&linfo->lock); if (result) break; @@ -357,6 +356,7 @@ void mysql_binlog_send(THD* thd, char* l #ifndef DBUG_OFF int left_events = max_binlog_dump_events; #endif + int old_max_allowed_packet= thd->variables.max_allowed_packet; DBUG_ENTER("mysql_binlog_send"); DBUG_PRINT("enter",("log_ident: '%s' pos: %ld", log_ident, (long) pos)); @@ -762,6 +762,7 @@ end: pthread_mutex_lock(&LOCK_thread_count); thd->current_linfo = 0; pthread_mutex_unlock(&LOCK_thread_count); + thd->variables.max_allowed_packet= old_max_allowed_packet; DBUG_VOID_RETURN; err: @@ -779,6 +780,7 @@ err: pthread_mutex_unlock(&LOCK_thread_count); if (file >= 0) (void) my_close(file, MYF(MY_WME)); + thd->variables.max_allowed_packet= old_max_allowed_packet; my_message(my_errno, errmsg, MYF(0)); DBUG_VOID_RETURN; @@ -1419,6 +1421,7 @@ bool mysql_show_binlog_events(THD* thd) bool ret = TRUE; IO_CACHE log; File file = -1; + int old_max_allowed_packet= thd->variables.max_allowed_packet; DBUG_ENTER("mysql_show_binlog_events"); Log_event::init_show_field_list(&field_list); @@ -1557,6 +1560,7 @@ err: pthread_mutex_lock(&LOCK_thread_count); thd->current_linfo = 0; pthread_mutex_unlock(&LOCK_thread_count); + thd->variables.max_allowed_packet= old_max_allowed_packet; DBUG_RETURN(ret); } === modified file 'sql/sql_select.cc' --- a/sql/sql_select.cc 2010-08-04 13:01:13 +0000 +++ b/sql/sql_select.cc 2010-08-27 14:12:44 +0000 @@ -1128,6 +1128,30 @@ JOIN::optimize() { conds=new Item_int((longlong) 0,1); // Always false } + + /* + It's necessary to check const part of HAVING cond as there is a + chance that some cond parts may become const items after + make_join_statistics() (for example when Item is a reference to + cost table field from outer join). + + This check is performed only for those conditions which do not use + aggregate functions. In such case temporary table may not be used + and const condition elements may be lost during further having + condition transformation in JOIN::exec. + */ + if (having && const_table_map && !having->with_sum_func) + { + having->update_used_tables(); + having= remove_eq_conds(thd, having, &having_value); + if (having_value == Item::COND_FALSE) + { + having= new Item_int((longlong) 0,1); + zero_result_cause= "Impossible HAVING noticed after reading const tables"; + DBUG_RETURN(0); + } + } + if (make_join_select(this, select, conds)) { zero_result_cause= @@ -1688,6 +1712,16 @@ JOIN::reinit() func->clear(); } + if (no_rows_in_result_called) + { + /* Reset effect of possible no_rows_in_result() */ + List_iterator_fast<Item> it(fields_list); + Item *item; + + no_rows_in_result_called= 0; + while ((item= it++)) + item->restore_to_before_no_rows_in_result(); + } DBUG_RETURN(0); } @@ -11870,6 +11904,7 @@ flush_cached_records(JOIN *join,JOIN_TAB enum_nested_loop_state rc= NESTED_LOOP_OK; int error; READ_RECORD *info; + SQL_SELECT *select; join_tab->table->null_row= 0; if (!join_tab->cache.records) @@ -11884,7 +11919,7 @@ flush_cached_records(JOIN *join,JOIN_TAB join_tab->select->quick=0; } } - /* read through all records */ + /* read through all records */ if ((error=join_init_read_record(join_tab))) { reset_cache_write(&join_tab->cache); @@ -11898,22 +11933,26 @@ flush_cached_records(JOIN *join,JOIN_TAB } info= &join_tab->read_record; + select= join_tab->select; + do { + int err= 0; if (join->thd->killed) { join->thd->send_kill_message(); return NESTED_LOOP_KILLED; // Aborted by user /* purecov: inspected */ } - int err= 0; - SQL_SELECT *select=join_tab->select; if (rc == NESTED_LOOP_OK && (!join_tab->cache.select || (err= join_tab->cache.select->skip_record(join->thd)) != 0 )) { if (err < 0) + { + reset_cache_write(&join_tab->cache); return NESTED_LOOP_ERROR; - rc= NESTED_LOOP_OK; + } + reset_cache_read(&join_tab->cache); for (uint i= (join_tab->cache.records- (skip_last ? 1 : 0)) ; i-- > 0 ;) { @@ -11922,7 +11961,10 @@ flush_cached_records(JOIN *join,JOIN_TAB if (!select || (err= select->skip_record(join->thd)) != 0) { if (err < 0) + { + reset_cache_write(&join_tab->cache); return NESTED_LOOP_ERROR; + } rc= (join_tab->next_select)(join,join_tab+1,0); if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS) { @@ -12681,8 +12723,11 @@ end_send_group(JOIN *join, JOIN_TAB *joi { List_iterator_fast<Item> it(*join->fields); Item *item; + DBUG_PRINT("info", ("no matching rows")); + /* No matching rows for group function */ join->clear(); + join->no_rows_in_result_called= 1; while ((item= it++)) item->no_rows_in_result(); === modified file 'sql/sql_select.h' --- a/sql/sql_select.h 2010-04-28 12:52:24 +0000 +++ b/sql/sql_select.h 2010-08-24 17:17:17 +0000 @@ -365,24 +365,31 @@ public: the number of rows in it may vary from one subquery execution to another. */ bool no_const_tables; + /* + This flag is set if we call no_rows_in_result() as par of end_group(). + This is used as a simple speed optimization to avoiding calling + restore_no_rows_in_result() in ::reinit() + */ + bool no_rows_in_result_called; /** Copy of this JOIN to be used with temporary tables. - tmp_join is used when the JOIN needs to be "reusable" (e.g. in a subquery - that gets re-executed several times) and we know will use temporary tables - for materialization. The materialization to a temporary table overwrites the - JOIN structure to point to the temporary table after the materialization is - done. This is where tmp_join is used : it's a copy of the JOIN before the - materialization and is used in restoring before re-execution by overwriting - the current JOIN structure with the saved copy. - Because of this we should pay extra care of not freeing up helper structures - that are referenced by the original contents of the JOIN. We can check for - this by making sure the "current" join is not the temporary copy, e.g. - !tmp_join || tmp_join != join + tmp_join is used when the JOIN needs to be "reusable" (e.g. in a + subquery that gets re-executed several times) and we know will use + temporary tables for materialization. The materialization to a + temporary table overwrites the JOIN structure to point to the + temporary table after the materialization is done. This is where + tmp_join is used : it's a copy of the JOIN before the + materialization and is used in restoring before re-execution by + overwriting the current JOIN structure with the saved copy. + Because of this we should pay extra care of not freeing up helper + structures that are referenced by the original contents of the + JOIN. We can check for this by making sure the "current" join is + not the temporary copy, e.g. !tmp_join || tmp_join != join - We should free these sub-structures at JOIN::destroy() if the "current" join - has a copy is not that copy. + We should free these sub-structures at JOIN::destroy() if the + "current" join has a copy is not that copy. */ JOIN *tmp_join; ROLLUP rollup; ///< Used with rollup @@ -512,6 +519,7 @@ public: optimized= 0; cond_equal= 0; group_optimized_away= 0; + no_rows_in_result_called= 0; all_fields= fields_arg; if (&fields_list != &fields_arg) /* Avoid valgrind-warning */ === modified file 'sql/sql_show.cc' --- a/sql/sql_show.cc 2010-08-04 10:19:18 +0000 +++ b/sql/sql_show.cc 2010-08-27 14:12:44 +0000 @@ -1,4 +1,4 @@ -/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. +/* Copyright 2000, 2010 Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -9,9 +9,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* Function with list databases, tables or fields */ @@ -480,8 +480,6 @@ find_files(THD *thd, List<LEX_STRING> *f wild_length= strlen(wild); } - - bzero((char*) &table_list,sizeof(table_list)); if (!(dirp = my_dir(path,MYF(dir ? MY_WANT_STAT : 0)))) @@ -523,9 +521,20 @@ find_files(THD *thd, List<LEX_STRING> *f continue; file_name_len= filename_to_tablename(file->name, uname, sizeof(uname)); - if (wild && wild_compare(uname, wild, 0)) - continue; - if (!(file_name= + if (wild) + { + if (lower_case_table_names) + { + if (my_wildcmp(files_charset_info, + uname, uname + file_name_len, + wild, wild + wild_length, + wild_prefix, wild_one, wild_many)) + continue; + } + else if (wild_compare(uname, wild, 0)) + continue; + } + if (!(file_name= thd->make_lex_string(file_name, uname, file_name_len, TRUE))) { my_dirend(dirp); @@ -2221,8 +2230,8 @@ static bool show_status_array(THD *thd, bool ucase_names, COND *cond) { - MY_ALIGNED_BYTE_ARRAY(buff_data, SHOW_VAR_FUNC_BUFF_SIZE, long); - char * const buff= (char *) &buff_data; + my_aligned_storage<SHOW_VAR_FUNC_BUFF_SIZE, MY_ALIGNOF(long)> buffer; + char * const buff= buffer.data; char *prefix_end; /* the variable name should not be longer than 64 characters */ char name_buffer[64]; @@ -2707,36 +2716,54 @@ bool get_lookup_field_values(THD *thd, C { LEX *lex= thd->lex; const char *wild= lex->wild ? lex->wild->ptr() : NullS; + bool rc= 0; + bzero((char*) lookup_field_values, sizeof(LOOKUP_FIELD_VALUES)); switch (lex->sql_command) { case SQLCOM_SHOW_DATABASES: if (wild) { - lookup_field_values->db_value.str= (char*) wild; - lookup_field_values->db_value.length= strlen(wild); + thd->make_lex_string(&lookup_field_values->db_value, + wild, strlen(wild), 0); lookup_field_values->wild_db_value= 1; } - return 0; + break; case SQLCOM_SHOW_TABLES: case SQLCOM_SHOW_TABLE_STATUS: case SQLCOM_SHOW_TRIGGERS: case SQLCOM_SHOW_EVENTS: - lookup_field_values->db_value.str= lex->select_lex.db; - lookup_field_values->db_value.length=strlen(lex->select_lex.db); + thd->make_lex_string(&lookup_field_values->db_value, + lex->select_lex.db, strlen(lex->select_lex.db), 0); if (wild) { - lookup_field_values->table_value.str= (char*)wild; - lookup_field_values->table_value.length= strlen(wild); + thd->make_lex_string(&lookup_field_values->table_value, + wild, strlen(wild), 0); lookup_field_values->wild_table_value= 1; } - return 0; + break; default: /* The "default" is for queries over I_S. All previous cases handle SHOW commands. */ - return calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values); + rc= calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values); + break; } + + if (lower_case_table_names && !rc) + { + /* + We can safely do in-place upgrades here since all of the above cases + are allocating a new memory buffer for these strings. + */ + if (lookup_field_values->db_value.str && lookup_field_values->db_value.str[0]) + my_casedn_str(system_charset_info, lookup_field_values->db_value.str); + if (lookup_field_values->table_value.str && + lookup_field_values->table_value.str[0]) + my_casedn_str(system_charset_info, lookup_field_values->table_value.str); + } + + return rc; } @@ -2938,11 +2965,15 @@ make_table_name_list(THD *thd, List<LEX_ { if (with_i_schema) { + LEX_STRING *name; ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, lookup_field_vals->table_value.str); if (schema_table && !schema_table->hidden) { - if (table_names->push_back(&lookup_field_vals->table_value)) + if (!(name= + thd->make_lex_string(NULL, schema_table->table_name, + strlen(schema_table->table_name), TRUE)) || + table_names->push_back(name)) return 1; } } @@ -2981,7 +3012,7 @@ make_table_name_list(THD *thd, List<LEX_ */ if (res == FIND_FILES_DIR) { - if (lex->sql_command != SQLCOM_SELECT) + if (sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) return 1; thd->clear_error(); return 2; @@ -3341,6 +3372,7 @@ int get_all_tables(THD *thd, TABLE_LIST error= 0; goto err; } + DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'", STR_OR_NIL(lookup_field_vals.db_value.str), STR_OR_NIL(lookup_field_vals.table_value.str))); @@ -3868,7 +3900,6 @@ static int get_schema_column_record(THD uint flags=field->flags; char tmp[MAX_FIELD_WIDTH]; String type(tmp,sizeof(tmp), system_charset_info); - char *end; int decimals, field_length; if (wild && wild[0] && @@ -3889,7 +3920,7 @@ static int get_schema_column_record(THD field->field_name) & COL_ACLS; if (!tables->schema_table && !col_access) continue; - end= tmp; + char *end= tmp; for (uint bitnr=0; col_access ; col_access>>=1,bitnr++) { if (col_access & 1) @@ -3965,10 +3996,13 @@ static int get_schema_column_record(THD case MYSQL_TYPE_TINY: case MYSQL_TYPE_SHORT: case MYSQL_TYPE_LONG: - case MYSQL_TYPE_LONGLONG: case MYSQL_TYPE_INT24: field_length= field->max_display_length() - 1; break; + case MYSQL_TYPE_LONGLONG: + field_length= field->max_display_length() - + ((field->flags & UNSIGNED_FLAG) ? 0 : 1); + break; case MYSQL_TYPE_BIT: field_length= field->max_display_length(); decimals= -1; // return NULL @@ -4012,7 +4046,6 @@ static int get_schema_column_record(THD table->field[15]->store((const char*) pos, strlen((const char*) pos), cs); - end= tmp; if (field->unireg_check == Field::NEXT_NUMBER) table->field[16]->store(STRING_WITH_LEN("auto_increment"), cs); if (show_table->timestamp_field == field && === modified file 'sql/sql_table.cc' --- a/sql/sql_table.cc 2010-08-03 21:26:17 +0000 +++ b/sql/sql_table.cc 2010-08-27 14:12:44 +0000 @@ -6883,6 +6883,14 @@ view_err: if (!error && (new_name != table_name || new_db != db)) { thd_proc_info(thd, "rename"); + + /* + Workaround InnoDB ending the transaction when the table instance + is unlocked/closed (close_cached_table below), otherwise the trx + state will differ between the server and storage engine layers. + */ + ha_autocommit_or_rollback(thd, 0); + /* Then do a 'simple' rename of the table. First we need to close all instances of 'source' table. @@ -7430,6 +7438,11 @@ view_err: mysql_unlock_tables(thd, thd->lock); thd->lock=0; } + /* + If LOCK TABLES list is not empty and contains this table, + unlock the table and remove the table from this list. + */ + mysql_lock_remove(thd, thd->locked_tables, table, FALSE); /* Remove link to old table and rename the new one */ close_temporary_table(thd, table, 1, 1); /* Should pass the 'new_name' as we store table name in the cache */ === modified file 'sql/sql_update.cc' --- a/sql/sql_update.cc 2010-08-04 18:36:11 +0000 +++ b/sql/sql_update.cc 2010-08-27 14:12:44 +0000 @@ -467,11 +467,10 @@ int mysql_update(THD *thd, thd_proc_info(thd, "Searching rows for update"); ha_rows tmp_limit= limit; - while (!(error=info.read_record(&info)) && - !thd->killed && !thd->is_error()) + while (!(error=info.read_record(&info)) && !thd->killed) { thd->examined_row_count++; - if (!select || select->skip_record(thd) > 0) + if (!select || (error= select->skip_record(thd)) > 0) { if (table->file->was_semi_consistent_read()) continue; /* repeat the read of the same row if it still exists */ @@ -490,7 +489,15 @@ int mysql_update(THD *thd, } } else + { table->file->unlock_row(); + if (error < 0) + { + /* Fatal error from select->skip_record() */ + error= 1; + break; + } + } } if (thd->killed && !error) error= 1; // Aborted === modified file 'sql/table.h' --- a/sql/table.h 2010-08-04 13:01:13 +0000 +++ b/sql/table.h 2010-08-27 14:12:44 +0000 @@ -55,7 +55,6 @@ typedef struct st_order { struct st_order *next; Item **item; /* Point at item in select fields */ Item *item_ptr; /* Storage for initial item */ - Item **item_copy; /* For SPs; the original item ptr */ int counter; /* position in SELECT list, correct only if counter_used is true*/ bool asc; /* true if ascending */ @@ -451,7 +450,7 @@ typedef struct st_table_share #ifdef WITH_PARTITION_STORAGE_ENGINE /** @todo: Move into *ha_data for partitioning */ bool auto_partitioned; - const char *partition_info; + char *partition_info; uint partition_info_len; uint partition_info_buffer_size; const char *part_state; === modified file 'sql/udf_example.c' --- a/sql/udf_example.c 2009-12-03 11:19:05 +0000 +++ b/sql/udf_example.c 2010-08-27 14:12:44 +0000 @@ -1067,7 +1067,7 @@ char *myfunc_argument_name(UDF_INIT *ini { if (!args->attributes[0]) { - null_value= 0; + *null_value= 1; return 0; } (*length)--; /* space for ending \0 (for debugging purposes) */ === modified file 'sql/unireg.h' --- a/sql/unireg.h 2009-09-07 20:50:10 +0000 +++ b/sql/unireg.h 2010-08-27 14:12:44 +0000 @@ -129,8 +129,8 @@ #define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */ /* Extern defines */ -#define store_record(A,B) bmove_align((A)->B,(A)->record[0],(size_t) (A)->s->reclength) -#define restore_record(A,B) bmove_align((A)->record[0],(A)->B,(size_t) (A)->s->reclength) +#define store_record(A,B) memcpy((A)->B,(A)->record[0],(size_t) (A)->s->reclength) +#define restore_record(A,B) memcpy((A)->record[0],(A)->B,(size_t) (A)->s->reclength) #define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength) #define empty_record(A) { \ restore_record((A),s->default_values); \ === modified file 'storage/Makefile.am' --- a/storage/Makefile.am 2009-09-07 20:50:10 +0000 +++ b/storage/Makefile.am 2010-08-27 14:12:44 +0000 @@ -21,6 +21,3 @@ AUTOMAKE_OPTIONS = foreign EXTRA_DIST = mysql_storage_engine.cmake SUBDIRS = @mysql_se_dirs@ DIST_SUBDIRS = @mysql_se_distdirs@ - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'storage/archive/Makefile.am' --- a/storage/archive/Makefile.am 2008-01-02 13:00:46 +0000 +++ b/storage/archive/Makefile.am 2010-07-09 11:37:51 +0000 @@ -36,14 +36,14 @@ noinst_PROGRAMS = archive_test archive_r EXTRA_LTLIBRARIES = ha_archive.la pkgplugin_LTLIBRARIES = @plugin_archive_shared_target@ ha_archive_la_LDFLAGS = -module -rpath $(pkgplugindir) -ha_archive_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_archive_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_archive_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_archive_la_SOURCES = ha_archive.cc azio.c EXTRA_LIBRARIES = libarchive.a noinst_LIBRARIES = @plugin_archive_static_target@ -libarchive_a_CXXFLAGS = $(AM_CFLAGS) +libarchive_a_CXXFLAGS = $(AM_CXXFLAGS) libarchive_a_CFLAGS = $(AM_CFLAGS) libarchive_a_SOURCES = ha_archive.cc azio.c === modified file 'storage/blackhole/Makefile.am' --- a/storage/blackhole/Makefile.am 2008-01-02 13:00:46 +0000 +++ b/storage/blackhole/Makefile.am 2010-07-09 11:37:51 +0000 @@ -35,14 +35,14 @@ noinst_HEADERS = ha_blackhole.h EXTRA_LTLIBRARIES = ha_blackhole.la pkgplugin_LTLIBRARIES = @plugin_blackhole_shared_target@ ha_blackhole_la_LDFLAGS=-module -rpath $(pkgplugindir) -ha_blackhole_la_CXXFLAGS=$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_blackhole_la_CXXFLAGS=$(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_blackhole_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_blackhole_la_SOURCES=ha_blackhole.cc EXTRA_LIBRARIES = libblackhole.a noinst_LIBRARIES = @plugin_blackhole_static_target@ -libblackhole_a_CXXFLAGS=$(AM_CFLAGS) +libblackhole_a_CXXFLAGS=$(AM_CXXFLAGS) libblackhole_a_CFLAGS = $(AM_CFLAGS) libblackhole_a_SOURCES= ha_blackhole.cc === modified file 'storage/csv/Makefile.am' --- a/storage/csv/Makefile.am 2007-01-04 18:54:52 +0000 +++ b/storage/csv/Makefile.am 2010-07-09 11:37:51 +0000 @@ -32,12 +32,12 @@ noinst_HEADERS = ha_tina.h transparent EXTRA_LTLIBRARIES = ha_csv.la pkglib_LTLIBRARIES = @plugin_csv_shared_target@ ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) -ha_csv_la_CXXFLAGS = $(AM_CFLAGS) -DMYSQL_PLUGIN +ha_csv_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_PLUGIN ha_csv_la_SOURCES = transparent_file.cc ha_tina.cc EXTRA_LIBRARIES = libcsv.a noinst_LIBRARIES = @plugin_csv_static_target@ -libcsv_a_CXXFLAGS = $(AM_CFLAGS) +libcsv_a_CXXFLAGS = $(AM_CXXFLAGS) libcsv_a_SOURCES = transparent_file.cc ha_tina.cc EXTRA_DIST = CMakeLists.txt plug.in === modified file 'storage/csv/ha_tina.cc' --- a/storage/csv/ha_tina.cc 2010-06-23 07:33:00 +0000 +++ b/storage/csv/ha_tina.cc 2010-08-27 14:12:44 +0000 @@ -468,7 +468,7 @@ int ha_tina::encode_quote(uchar *buf) const char *ptr; const char *end_ptr; const bool was_null= (*field)->is_null(); - + /* assistance for backwards compatibility in production builds. note: this will not work for ENUM columns. @@ -480,7 +480,7 @@ int ha_tina::encode_quote(uchar *buf) } (*field)->val_str(&attribute,&attribute); - + if (was_null) (*field)->set_null(); @@ -498,34 +498,30 @@ int ha_tina::encode_quote(uchar *buf) buffer.append('"'); - while (ptr < end_ptr) + for (; ptr < end_ptr; ptr++) { if (*ptr == '"') { buffer.append('\\'); buffer.append('"'); - *ptr++; } else if (*ptr == '\r') { buffer.append('\\'); buffer.append('r'); - *ptr++; } else if (*ptr == '\\') { buffer.append('\\'); buffer.append('\\'); - *ptr++; } else if (*ptr == '\n') { buffer.append('\\'); buffer.append('n'); - *ptr++; } else - buffer.append(*ptr++); + buffer.append(*ptr); } buffer.append('"'); } === modified file 'storage/example/Makefile.am' --- a/storage/example/Makefile.am 2008-01-02 13:00:46 +0000 +++ b/storage/example/Makefile.am 2010-07-09 11:37:51 +0000 @@ -35,14 +35,14 @@ noinst_HEADERS = ha_example.h EXTRA_LTLIBRARIES = ha_example.la pkgplugin_LTLIBRARIES = @plugin_example_shared_target@ ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -ha_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_example_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_SOURCES = ha_example.cc EXTRA_LIBRARIES = libexample.a noinst_LIBRARIES = @plugin_example_static_target@ -libexample_a_CXXFLAGS = $(AM_CFLAGS) +libexample_a_CXXFLAGS = $(AM_CXXFLAGS) libexample_a_CFLAGS = $(AM_CFLAGS) libexample_a_SOURCES= ha_example.cc === modified file 'storage/example/ha_example.cc' --- a/storage/example/ha_example.cc 2008-02-24 13:12:17 +0000 +++ b/storage/example/ha_example.cc 2010-07-20 18:07:36 +0000 @@ -153,7 +153,7 @@ static int example_done_func(void *p) hash_free(&example_open_tables); pthread_mutex_destroy(&example_mutex); - DBUG_RETURN(0); + DBUG_RETURN(error); } === modified file 'storage/federated/Makefile.am' --- a/storage/federated/Makefile.am 2010-06-09 21:29:18 +0000 +++ b/storage/federated/Makefile.am 2010-08-27 14:12:44 +0000 @@ -33,14 +33,14 @@ noinst_HEADERS = ha_federated.h EXTRA_LTLIBRARIES = ha_federated.la pkgplugin_LTLIBRARIES = @plugin_federated_shared_target@ ha_federated_la_LDFLAGS = -module -rpath $(pkgplugindir) -ha_federated_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_federated_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federated_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federated_la_SOURCES = ha_federated.cc $(top_srcdir)/mysys/string.c EXTRA_LIBRARIES = libfederated.a noinst_LIBRARIES = @plugin_federated_static_target@ -libfederated_a_CXXFLAGS = $(AM_CFLAGS) +libfederated_a_CXXFLAGS = $(AM_CXXFLAGS) libfederated_a_CFLAGS = $(AM_CFLAGS) libfederated_a_SOURCES= ha_federated.cc === modified file 'storage/federated/ha_federated.cc' --- a/storage/federated/ha_federated.cc 2010-07-23 20:37:21 +0000 +++ b/storage/federated/ha_federated.cc 2010-08-27 14:12:44 +0000 @@ -561,7 +561,6 @@ static int parse_url_error(FEDERATED_SHA int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share) { int error_num= ER_FOREIGN_SERVER_DOESNT_EXIST; - char error_buffer[FEDERATED_QUERY_BUFFER_SIZE]; FOREIGN_SERVER *server, server_buffer; DBUG_ENTER("ha_federated::get_connection"); @@ -613,10 +612,8 @@ int get_connection(MEM_ROOT *mem_root, F DBUG_RETURN(0); error: - my_sprintf(error_buffer, - (error_buffer, "server name: '%s' doesn't exist!", - share->connection_string)); - my_error(error_num, MYF(0), error_buffer); + my_printf_error(error_num, "server name: '%s' doesn't exist!", + MYF(0), share->connection_string); DBUG_RETURN(error_num); } @@ -2405,8 +2402,8 @@ int ha_federated::index_read_idx_with_re if (real_query(sql_query.ptr(), sql_query.length())) { - my_sprintf(error_buffer, (error_buffer, "error: %d '%s'", - mysql_errno(mysql), mysql_error(mysql))); + sprintf(error_buffer, "error: %d '%s'", + mysql_errno(mysql), mysql_error(mysql)); retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE; goto error; } @@ -2775,7 +2772,6 @@ int ha_federated::rnd_pos(uchar *buf, uc int ha_federated::info(uint flag) { - char error_buffer[FEDERATED_QUERY_BUFFER_SIZE]; char status_buf[FEDERATED_QUERY_BUFFER_SIZE]; int error; uint error_code; @@ -2859,9 +2855,8 @@ error: mysql_free_result(result); if (mysql) { - my_sprintf(error_buffer, (error_buffer, ": %d : %s", - mysql_errno(mysql), mysql_error(mysql))); - my_error(error_code, MYF(0), error_buffer); + my_printf_error(error_code, ": %d : %s", MYF(0), + mysql_errno(mysql), mysql_error(mysql)); } else if (remote_error_number != -1 /* error already reported */) === modified file 'storage/federatedx/federatedx_io_mysql.cc' --- a/storage/federatedx/federatedx_io_mysql.cc 2009-11-14 19:33:59 +0000 +++ b/storage/federatedx/federatedx_io_mysql.cc 2010-08-12 17:52:52 +0000 @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2007, Antony T Curtis All rights reserved. @@ -51,6 +51,12 @@ typedef struct federatedx_savepoint uint flags; } SAVEPT; +struct mysql_position +{ + MYSQL_RES* result; + MYSQL_ROW_OFFSET offset; +}; + class federatedx_io_mysql :public federatedx_io { @@ -76,16 +82,16 @@ public: virtual int error_code(); virtual const char *error_str(); - + void reset(); int commit(); int rollback(); - + int savepoint_set(ulong sp); ulong savepoint_release(ulong sp); ulong savepoint_rollback(ulong sp); void savepoint_restrict(ulong sp); - + ulong last_savepoint() const; ulong actual_savepoint() const; bool is_autocommit() const; @@ -94,7 +100,7 @@ public: uint table_name_length, uint flag); /* resultset operations */ - + virtual void free_result(FEDERATEDX_IO_RESULT *io_result); virtual unsigned int get_num_fields(FEDERATEDX_IO_RESULT *io_result); virtual my_ulonglong get_num_rows(FEDERATEDX_IO_RESULT *io_result); @@ -104,6 +110,12 @@ public: unsigned int column); virtual bool is_column_null(const FEDERATEDX_IO_ROW *row, unsigned int column) const; + + virtual size_t get_ref_length() const; + virtual void mark_position(FEDERATEDX_IO_RESULT *io_result, + void *ref); + virtual int seek_position(FEDERATEDX_IO_RESULT **io_result, + const void *ref); }; @@ -466,14 +478,13 @@ const char *federatedx_io_mysql::error_s return mysql_error(&mysql); } - FEDERATEDX_IO_RESULT *federatedx_io_mysql::store_result() { FEDERATEDX_IO_RESULT *result; DBUG_ENTER("federatedx_io_mysql::store_result"); - + result= (FEDERATEDX_IO_RESULT *) mysql_store_result(&mysql); - + DBUG_RETURN(result); } @@ -590,3 +601,45 @@ error: free_result(result); return 1; } + + + +size_t federatedx_io_mysql::get_ref_length() const +{ + return sizeof(mysql_position); +} + + +void federatedx_io_mysql::mark_position(FEDERATEDX_IO_RESULT *io_result, + void *ref) +{ + MYSQL_ROWS *tmp= 0; + mysql_position& pos= *reinterpret_cast<mysql_position*>(ref); + pos.result= (MYSQL_RES *) io_result; + + if (pos.result && pos.result->data) + { + for (tmp= pos.result->data->data; + tmp && (tmp->next != pos.result->data_cursor); + tmp= tmp->next) + {} + } + + pos.offset= tmp; +} + +int federatedx_io_mysql::seek_position(FEDERATEDX_IO_RESULT **io_result, + const void *ref) +{ + const mysql_position& pos= *reinterpret_cast<const mysql_position*>(ref); + + if (!pos.result || !pos.offset) + return HA_ERR_END_OF_FILE; + + pos.result->current_row= 0; + pos.result->data_cursor= pos.offset; + *io_result= (FEDERATEDX_IO_RESULT*) pos.result; + + return 0; +} + === modified file 'storage/federatedx/federatedx_io_null.cc' --- a/storage/federatedx/federatedx_io_null.cc 2009-11-14 19:33:59 +0000 +++ b/storage/federatedx/federatedx_io_null.cc 2010-08-12 17:52:52 +0000 @@ -96,6 +96,11 @@ public: unsigned int column); virtual bool is_column_null(const FEDERATEDX_IO_ROW *row, unsigned int column) const; + virtual size_t get_ref_length() const; + virtual void mark_position(FEDERATEDX_IO_RESULT *io_result, + void *ref); + virtual int seek_position(FEDERATEDX_IO_RESULT **io_result, + const void *ref); }; @@ -275,3 +280,20 @@ bool federatedx_io_null::table_metadata( return 0; } + +size_t federatedx_io_null::get_ref_length() const +{ + return sizeof(int); +} + + +void federatedx_io_null::mark_position(FEDERATEDX_IO_RESULT *io_result, + void *ref) +{ +} + +int federatedx_io_null::seek_position(FEDERATEDX_IO_RESULT **io_result, + const void *ref) +{ + return 0; +} === modified file 'storage/federatedx/ha_federatedx.cc' --- a/storage/federatedx/ha_federatedx.cc 2010-07-23 20:37:21 +0000 +++ b/storage/federatedx/ha_federatedx.cc 2010-08-20 07:29:26 +0000 @@ -1717,14 +1717,14 @@ federatedx_txn *ha_federatedx::get_txn(T return *txnp; } - + int ha_federatedx::disconnect(handlerton *hton, MYSQL_THD thd) { federatedx_txn *txn= (federatedx_txn *) thd_get_ha_data(thd, hton); delete txn; return 0; } - + /* Used for opening tables. The name will be the name of the file. @@ -1756,14 +1756,15 @@ int ha_federatedx::open(const char *name free_share(txn, share); DBUG_RETURN(error); } - + + ref_length= io->get_ref_length(); + txn->release(&io); - - ref_length= (table->s->primary_key != MAX_KEY ? - table->key_info[table->s->primary_key].key_length : - table->s->reclength); + DBUG_PRINT("info", ("ref_length: %u", ref_length)); + my_init_dynamic_array(&results, sizeof(FEDERATEDX_IO_RESULT*), 4, 4); + reset(); DBUG_RETURN(0); @@ -1788,8 +1789,9 @@ int ha_federatedx::close(void) DBUG_ENTER("ha_federatedx::close"); /* free the result set */ - if (stored_result) - retval= free_result(); + reset(); + + delete_dynamic(&results); /* Disconnect from mysql */ if (!thd || !(txn= get_txn(thd, true))) @@ -1799,7 +1801,7 @@ int ha_federatedx::close(void) tmp_txn.release(&io); DBUG_ASSERT(io == NULL); - + if ((error= free_share(&tmp_txn, share))) retval= error; } @@ -2525,7 +2527,7 @@ int ha_federatedx::index_read_idx(uchar uint key_len, enum ha_rkey_function find_flag) { int retval; - FEDERATEDX_IO_RESULT *io_result; + FEDERATEDX_IO_RESULT *io_result= 0; DBUG_ENTER("ha_federatedx::index_read_idx"); if ((retval= index_read_idx_with_result_set(buf, index, key, @@ -2601,7 +2603,7 @@ int ha_federatedx::index_read_idx_with_r if (!(retval= read_next(buf, *result))) DBUG_RETURN(retval); - io->free_result(*result); + insert_dynamic(&results, (uchar*) result); *result= 0; table->status= STATUS_NOT_FOUND; DBUG_RETURN(retval); @@ -2669,10 +2671,7 @@ int ha_federatedx::read_range_first(cons DBUG_RETURN(retval); if (stored_result) - { - io->free_result(stored_result); - stored_result= 0; - } + (void) free_result(); if (io->query(sql_query.ptr(), sql_query.length())) { @@ -2773,10 +2772,7 @@ int ha_federatedx::rnd_init(bool scan) DBUG_RETURN(error); if (stored_result) - { - io->free_result(stored_result); - stored_result= 0; - } + (void) free_result(); if (io->query(share->select_query, strlen(share->select_query))) @@ -2803,17 +2799,35 @@ int ha_federatedx::rnd_end() int ha_federatedx::free_result() { int error; - federatedx_io *tmp_io= 0, **iop; + DBUG_ENTER("ha_federatedx::free_result"); DBUG_ASSERT(stored_result); - if (!*(iop= &io) && (error= txn->acquire(share, TRUE, (iop= &tmp_io)))) + for (uint i= 0; i < results.elements; ++i) + { + FEDERATEDX_IO_RESULT *result= 0; + get_dynamic(&results, (uchar*) &result, i); + if (result == stored_result) + goto end; + } + if (position_called) + { + insert_dynamic(&results, (uchar*) &stored_result); + } + else { - DBUG_ASSERT(0); // Fail when testing - return error; + federatedx_io *tmp_io= 0, **iop; + if (!*(iop= &io) && (error= txn->acquire(share, TRUE, (iop= &tmp_io)))) + { + DBUG_ASSERT(0); // Fail when testing + insert_dynamic(&results, (uchar*) &stored_result); + goto end; + } + (*iop)->free_result(stored_result); + txn->release(&tmp_io); } - (*iop)->free_result(stored_result); +end: stored_result= 0; - txn->release(&tmp_io); - return 0; + position_called= FALSE; + DBUG_RETURN(0); } int ha_federatedx::index_end(void) @@ -2862,8 +2876,8 @@ int ha_federatedx::rnd_next(uchar *buf) SYNOPSIS field_in_record_is_null() - buf byte pointer to record - result mysql result set + buf byte pointer to record + result mysql result set DESCRIPTION This method is a wrapper method that reads one record from a result @@ -2896,24 +2910,43 @@ int ha_federatedx::read_next(uchar *buf, } -/* - store reference to current row so that we can later find it for - a re-read, update or delete. +/** + @brief Store a reference to current row. - In case of federatedx, a reference is either a primary key or - the whole record. + @details During a query execution we may have different result sets (RS), + e.g. for different ranges. All the RS's used are stored in + memory and placed in @c results dynamic array. At the end of + execution all stored RS's are freed at once in the + @c ha_federated::reset(). + So, in case of federated, a reference to current row is a + stored result address and current data cursor position. + As we keep all RS in memory during a query execution, + we can get any record using the reference any time until + @c ha_federated::reset() is called. + TODO: we don't have to store all RS's rows but only those + we call @c ha_federated::position() for, so we can free memory + where we store other rows in the @c ha_federated::index_end(). + + @param[in] record record data (unused) - Called from filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc. */ -void ha_federatedx::position(const uchar *record) +void ha_federatedx::position(const uchar *record __attribute__ ((unused))) { DBUG_ENTER("ha_federatedx::position"); - if (table->s->primary_key != MAX_KEY) - key_copy(ref, (uchar *)record, table->key_info + table->s->primary_key, - ref_length); - else - memcpy(ref, record, ref_length); + + bzero(ref, ref_length); + + if (!stored_result) + DBUG_VOID_RETURN; + + if (txn->acquire(share, TRUE, &io)) + DBUG_VOID_RETURN; + + io->mark_position(stored_result, ref); + + position_called= TRUE; + DBUG_VOID_RETURN; } @@ -2929,23 +2962,23 @@ void ha_federatedx::position(const uchar int ha_federatedx::rnd_pos(uchar *buf, uchar *pos) { - int result; + int retval; + FEDERATEDX_IO_RESULT *result= stored_result; DBUG_ENTER("ha_federatedx::rnd_pos"); ha_statistic_increment(&SSV::ha_read_rnd_count); - if (table->s->primary_key != MAX_KEY) - { - /* We have a primary key, so use index_read_idx to find row */ - result= index_read_idx(buf, table->s->primary_key, pos, - ref_length, HA_READ_KEY_EXACT); - } - else - { - /* otherwise, get the old record ref as obtained in ::position */ - memcpy(buf, pos, ref_length); - result= 0; - } - table->status= result ? STATUS_NOT_FOUND : 0; - DBUG_RETURN(result); + + if ((retval= txn->acquire(share, TRUE, &io))) + goto error; + + if ((retval= io->seek_position(&result, pos))) + goto error; + + retval= read_next(buf, result); + DBUG_RETURN(retval); + +error: + table->status= STATUS_NOT_FOUND; + DBUG_RETURN(retval); } @@ -2996,15 +3029,20 @@ int ha_federatedx::rnd_pos(uchar *buf, u int ha_federatedx::info(uint flag) { uint error_code; + THD *thd= current_thd; + federatedx_txn *tmp_txn; federatedx_io *tmp_io= 0, **iop= 0; DBUG_ENTER("ha_federatedx::info"); error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE; + // external_lock may not have been called so txn may not be set + tmp_txn= get_txn(thd); + /* we want not to show table status if not needed to do so */ if (flag & (HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_AUTO)) { - if (!*(iop= &io) && (error_code= txn->acquire(share, TRUE, (iop= &tmp_io)))) + if (!*(iop= &io) && (error_code= tmp_txn->acquire(share, TRUE, (iop= &tmp_io)))) goto fail; } @@ -3029,14 +3067,14 @@ int ha_federatedx::info(uint flag) If ::info created it's own transaction, close it. This happens in case of show table status; */ - txn->release(&tmp_io); + tmp_txn->release(&tmp_io); DBUG_RETURN(0); error: if (iop && *iop) { - my_printf_error((*iop)->error_code(), "Got error: %d : %s", MYF(0), + my_printf_error((*iop)->error_code(), "Received error: %d : %s", MYF(0), (*iop)->error_code(), (*iop)->error_str()); } else if (remote_error_number != -1 /* error already reported */) @@ -3045,7 +3083,7 @@ error: my_error(error_code, MYF(0), ER(error_code)); } fail: - txn->release(&tmp_io); + tmp_txn->release(&tmp_io); DBUG_RETURN(error_code); } @@ -3105,12 +3143,44 @@ int ha_federatedx::extra(ha_extra_functi int ha_federatedx::reset(void) { + int error = 0; + insert_dup_update= FALSE; ignore_duplicates= FALSE; replace_duplicates= FALSE; - return 0; -} + position_called= FALSE; + + if (stored_result) + insert_dynamic(&results, (uchar*) &stored_result); + stored_result= 0; + + if (results.elements) + { + federatedx_txn *tmp_txn; + federatedx_io *tmp_io= 0, **iop; + // external_lock may not have been called so txn may not be set + tmp_txn= get_txn(current_thd); + + if (!*(iop= &io) && (error= tmp_txn->acquire(share, TRUE, (iop= &tmp_io)))) + { + DBUG_ASSERT(0); // Fail when testing + return error; + } + + for (uint i= 0; i < results.elements; ++i) + { + FEDERATEDX_IO_RESULT *result= 0; + get_dynamic(&results, (uchar*) &result, i); + (*iop)->free_result(result); + } + tmp_txn->release(&tmp_io); + reset_dynamic(&results); + } + + return error; + +} /* Used to delete all rows in a table. Both for cases of truncate and @@ -3237,7 +3307,7 @@ static int test_connection(MYSQL_THD thd str.length(0); str.append(STRING_WITH_LEN("SELECT * FROM ")); - append_identifier(thd, &str, share->table_name, + append_identifier(thd, &str, share->table_name, share->table_name_length); str.append(STRING_WITH_LEN(" WHERE 1=0")); @@ -3288,14 +3358,14 @@ int ha_federatedx::create(const char *na pthread_mutex_lock(&federatedx_mutex); tmp_share.s= get_server(&tmp_share, NULL); pthread_mutex_unlock(&federatedx_mutex); - + if (tmp_share.s) { tmp_txn= get_txn(thd); if (!(retval= tmp_txn->acquire(&tmp_share, TRUE, &tmp_io))) { retval= test_connection(thd, tmp_io, &tmp_share); - tmp_txn->release(&tmp_io); + tmp_txn->release(&tmp_io); } free_server(tmp_txn, tmp_share.s); } === modified file 'storage/federatedx/ha_federatedx.h' --- a/storage/federatedx/ha_federatedx.h 2010-07-23 20:37:21 +0000 +++ b/storage/federatedx/ha_federatedx.h 2010-08-12 17:52:52 +0000 @@ -1,5 +1,5 @@ -/* -Copyright (c) 2008, Patrick Galbraith +/* +Copyright (c) 2008, Patrick Galbraith All rights reserved. Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ class federatedx_io; typedef struct st_fedrated_server { MEM_ROOT mem_root; uint use_count, io_count; - + uchar *key; uint key_length; @@ -74,10 +74,10 @@ typedef struct st_fedrated_server { #include <mysql.h> -/* +/* handler::print_error has a case statement for error numbers. - This value is (10000) is far out of range and will envoke the - default: case. + This value is (10000) is far out of range and will envoke the + default: case. (Current error range is 120-159 from include/my_base.h) */ #define HA_FEDERATEDX_ERROR_WITH_REMOTE_SYSTEM 10000 @@ -158,7 +158,7 @@ public: const char * get_database() const { return server->database; } ushort get_port() const { return server->port; } const char * get_socket() const { return server->socket; } - + static bool handles_scheme(const char *scheme); static federatedx_io *construct(MEM_ROOT *server_root, FEDERATEDX_SERVER *server); @@ -167,7 +167,7 @@ public: { return alloc_root(mem_root, size); } static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); } - + virtual int query(const char *buffer, uint length)=0; virtual FEDERATEDX_IO_RESULT *store_result()=0; @@ -178,25 +178,25 @@ public: virtual int error_code()=0; virtual const char *error_str()=0; - + virtual void reset()=0; virtual int commit()=0; virtual int rollback()=0; - + virtual int savepoint_set(ulong sp)=0; virtual ulong savepoint_release(ulong sp)=0; virtual ulong savepoint_rollback(ulong sp)=0; virtual void savepoint_restrict(ulong sp)=0; - + virtual ulong last_savepoint() const=0; virtual ulong actual_savepoint() const=0; virtual bool is_autocommit() const=0; virtual bool table_metadata(ha_statistics *stats, const char *table_name, uint table_name_length, uint flag) = 0; - + /* resultset operations */ - + virtual void free_result(FEDERATEDX_IO_RESULT *io_result)=0; virtual unsigned int get_num_fields(FEDERATEDX_IO_RESULT *io_result)=0; virtual my_ulonglong get_num_rows(FEDERATEDX_IO_RESULT *io_result)=0; @@ -206,6 +206,13 @@ public: unsigned int column)=0; virtual bool is_column_null(const FEDERATEDX_IO_ROW *row, unsigned int column) const=0; + + virtual size_t get_ref_length() const=0; + virtual void mark_position(FEDERATEDX_IO_RESULT *io_result, + void *ref)=0; + virtual int seek_position(FEDERATEDX_IO_RESULT **io_result, + const void *ref)=0; + }; @@ -215,12 +222,12 @@ class federatedx_txn ulong savepoint_level; ulong savepoint_stmt; ulong savepoint_next; - + void release_scan(); public: federatedx_txn(); ~federatedx_txn(); - + bool has_connections() const { return txn_list != NULL; } bool in_transaction() const { return savepoint_next != 0; } int acquire(FEDERATEDX_SHARE *share, bool readonly, federatedx_io **io); @@ -254,8 +261,12 @@ class ha_federatedx: public handler federatedx_txn *txn; federatedx_io *io; FEDERATEDX_IO_RESULT *stored_result; + /** + Array of all stored results we get during a query execution. + */ + DYNAMIC_ARRAY results; + bool position_called; uint fetch_num; // stores the fetch num - FEDERATEDX_IO_OFFSET current_position; // Current position used by ::position() int remote_error_number; char remote_error_buf[FEDERATEDX_QUERY_BUFFER_SIZE]; bool ignore_duplicates, replace_duplicates; @@ -269,7 +280,7 @@ private: */ uint convert_row_to_internal_format(uchar *buf, FEDERATEDX_IO_ROW *row, FEDERATEDX_IO_RESULT *result); - bool create_where_from_key(String *to, KEY *key_info, + bool create_where_from_key(String *to, KEY *key_info, const key_range *start_key, const key_range *end_key, bool records_in_range, bool eq_range); @@ -348,18 +359,18 @@ public: Talk to Kostja about this - how to get the number of rows * ... disk scan time on other side (block size, size of the row) + network time ... - The reason for "records * 1000" is that such a large number forces + The reason for "records * 1000" is that such a large number forces this to use indexes " */ double scan_time() { DBUG_PRINT("info", ("records %lu", (ulong) stats.records)); - return (double)(stats.records*1000); + return (double)(stats.records*1000); } /* The next method will never be called if you do not implement indexes. */ - double read_time(uint index, uint ranges, ha_rows rows) + double read_time(uint index, uint ranges, ha_rows rows) { /* Per Brian, this number is bugus, but this method must be implemented, === modified file 'storage/heap/hp_test2.c' --- a/storage/heap/hp_test2.c 2009-08-28 16:21:54 +0000 +++ b/storage/heap/hp_test2.c 2010-07-02 18:30:47 +0000 @@ -406,7 +406,7 @@ int main(int argc, char *argv[]) bmove(record2,record,reclength); if (heap_rsame(file,record,-1) || heap_rsame(file,record2,2)) goto err; - if (bcmp(record2,record,reclength)) + if (memcmp(record2,record,reclength)) { puts("heap_rsame didn't find right record"); goto end; @@ -415,7 +415,7 @@ int main(int argc, char *argv[]) puts("- Test of read through position"); if (heap_rrnd(file,record,position)) goto err; - if (bcmp(record3,record,reclength)) + if (memcmp(record3,record,reclength)) { puts("heap_frnd didn't find right record"); goto end; === modified file 'storage/ibmdb2i/Makefile.am' --- a/storage/ibmdb2i/Makefile.am 2009-04-01 20:18:49 +0000 +++ b/storage/ibmdb2i/Makefile.am 2010-07-09 11:37:51 +0000 @@ -34,7 +34,7 @@ EXTRA_LTLIBRARIES = ha_ibmdb2i.la pkgplugin_LTLIBRARIES = @plugin_ibmdb2i_shared_target@ ha_ibmdb2i_la_LIBADD = -liconv ha_ibmdb2i_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) -ha_ibmdb2i_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_ibmdb2i_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_ibmdb2i_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \ db2i_blobCollection.cc db2i_file.cc db2i_charsetSupport.cc \ @@ -44,7 +44,7 @@ ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db EXTRA_LIBRARIES = libibmdb2i.a noinst_LIBRARIES = @plugin_ibmdb2i_static_target@ -libibmdb2i_a_CXXFLAGS = $(AM_CFLAGS) +libibmdb2i_a_CXXFLAGS = $(AM_CXXFLAGS) libibmdb2i_a_CFLAGS = $(AM_CFLAGS) libibmdb2i_a_SOURCES= $(ha_ibmdb2i_la_SOURCES) === modified file 'storage/ibmdb2i/db2i_file.h' --- a/storage/ibmdb2i/db2i_file.h 2009-03-09 21:20:14 +0000 +++ b/storage/ibmdb2i/db2i_file.h 2010-07-05 12:00:39 +0000 @@ -40,7 +40,6 @@ OF SUCH DAMAGE. #include "db2i_global.h" #include "db2i_ileBridge.h" #include "db2i_validatedPointer.h" -#include "my_atomic.h" #include "db2i_iconv.h" #include "db2i_charsetSupport.h" === modified file 'storage/innobase/Makefile.am' --- a/storage/innobase/Makefile.am 2010-03-30 16:03:46 +0000 +++ b/storage/innobase/Makefile.am 2010-07-09 11:37:51 +0000 @@ -156,14 +156,14 @@ libinnobase_a_SOURCES= btr/btr0btr.c btr ut/ut0ut.c ut/ut0vec.c ut/ut0wqueue.c \ handler/ha_innodb.cc -libinnobase_a_CXXFLAGS= $(AM_CFLAGS) +libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS) libinnobase_a_CFLAGS= $(AM_CFLAGS) EXTRA_LTLIBRARIES= ha_innodb.la pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@ ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir) -ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) +ha_innodb_la_CXXFLAGS= $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_la_SOURCES= $(libinnobase_a_SOURCES) === modified file 'storage/innobase/dict/dict0load.c' --- a/storage/innobase/dict/dict0load.c 2009-01-14 13:51:30 +0000 +++ b/storage/innobase/dict/dict0load.c 2010-06-29 02:41:37 +0000 @@ -927,6 +927,8 @@ dict_load_table_on_id( ut_ad(mutex_own(&(dict_sys->mutex))); + table = NULL; + /* NOTE that the operation of this function is protected by the dictionary mutex, and therefore no deadlocks can occur with other dictionary operations. */ @@ -953,15 +955,17 @@ dict_load_table_on_id( BTR_SEARCH_LEAF, &pcur, &mtr); rec = btr_pcur_get_rec(&pcur); - if (!btr_pcur_is_on_user_rec(&pcur, &mtr) - || rec_get_deleted_flag(rec, 0)) { + if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) { /* Not found */ + goto func_exit; + } - btr_pcur_close(&pcur); - mtr_commit(&mtr); - mem_heap_free(heap); - - return(NULL); + /* Find the first record that is not delete marked */ + while (rec_get_deleted_flag(rec, 0)) { + if (!btr_pcur_move_to_next_user_rec(&pcur, &mtr)) { + goto func_exit; + } + rec = btr_pcur_get_rec(&pcur); } /*---------------------------------------------------*/ @@ -974,19 +978,14 @@ dict_load_table_on_id( /* Check if the table id in record is the one searched for */ if (ut_dulint_cmp(table_id, mach_read_from_8(field)) != 0) { - - btr_pcur_close(&pcur); - mtr_commit(&mtr); - mem_heap_free(heap); - - return(NULL); + goto func_exit; } /* Now we get the table name from the record */ field = rec_get_nth_field_old(rec, 1, &len); /* Load the table definition to memory */ table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len)); - +func_exit: btr_pcur_close(&pcur); mtr_commit(&mtr); mem_heap_free(heap); === modified file 'storage/innobase/os/os0file.c' --- a/storage/innobase/os/os0file.c 2010-02-11 10:24:19 +0000 +++ b/storage/innobase/os/os0file.c 2010-07-02 18:30:47 +0000 @@ -3974,6 +3974,9 @@ os_aio_simulated_handle( ulint n; ulint i; + /* Fix compiler warning */ + *consecutive_ios = NULL; + segment = os_aio_get_array_and_local_segment(&array, global_segment); restart: === modified file 'storage/innodb_plugin/ChangeLog' --- a/storage/innodb_plugin/ChangeLog 2010-07-04 07:12:44 +0000 +++ b/storage/innodb_plugin/ChangeLog 2010-07-28 10:20:44 +0000 @@ -1,3 +1,27 @@ +2010-07-27 The InnoDB Team + + * include/mem0pool.h, mem/mem0mem.c, mem/mem0pool.c, srv/srv0start.c: + Fix Bug#55581 shutdown with innodb-use-sys-malloc=0: assert + mutex->magic_n == MUTEX_MAGIC_N. + +2010-06-30 The InnoDB Team + + * btr/btr0sea.c, ha/ha0ha.c, handler/ha_innodb.cc, include/btr0sea.h: + Fix Bug#54311 Crash on CHECK PARTITION after concurrent LOAD DATA + and adaptive_hash_index=OFF + +2010-06-29 The InnoDB Team + * row/row0row.c, row/row0undo.c, row/row0upd.c: + Fix Bug#54408 txn rollback after recovery: row0umod.c:673 + dict_table_get_format(index->table) + +2010-06-29 The InnoDB Team + + * btr/btr0cur.c, include/btr0cur.h, + include/row0mysql.h, row/row0merge.c, row/row0sel.c: + Fix Bug#54358 READ UNCOMMITTED access failure of off-page DYNAMIC + or COMPRESSED columns + 2010-06-24 The InnoDB Team * handler/ha_innodb.cc: === modified file 'storage/innodb_plugin/Makefile.am' --- a/storage/innodb_plugin/Makefile.am 2010-04-07 17:24:43 +0000 +++ b/storage/innodb_plugin/Makefile.am 2010-07-09 11:37:51 +0000 @@ -325,14 +325,14 @@ libinnobase_a_SOURCES= \ ut/ut0vec.c \ ut/ut0wqueue.c -libinnobase_a_CXXFLAGS= $(AM_CFLAGS) +libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS) libinnobase_a_CFLAGS= $(AM_CFLAGS) EXTRA_LTLIBRARIES= ha_innodb_plugin.la pkgplugin_LTLIBRARIES= @plugin_innodb_plugin_shared_target@ ha_innodb_plugin_la_LDFLAGS= -module -rpath $(pkgplugindir) -ha_innodb_plugin_la_CXXFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) +ha_innodb_plugin_la_CXXFLAGS= $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_plugin_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_plugin_la_SOURCES= $(libinnobase_a_SOURCES) === modified file 'storage/innodb_plugin/btr/btr0cur.c' --- a/storage/innodb_plugin/btr/btr0cur.c 2010-06-01 12:07:51 +0000 +++ b/storage/innodb_plugin/btr/btr0cur.c 2010-06-30 09:31:49 +0000 @@ -4814,7 +4814,7 @@ btr_copy_externally_stored_field( /*******************************************************************//** Copies an externally stored field of a record to mem heap. -@return the field copied to heap */ +@return the field copied to heap, or NULL if the field is incomplete */ UNIV_INTERN byte* btr_rec_copy_externally_stored_field( @@ -4844,6 +4844,18 @@ btr_rec_copy_externally_stored_field( data = rec_get_nth_field(rec, offsets, no, &local_len); + ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE); + + if (UNIV_UNLIKELY + (!memcmp(data + local_len - BTR_EXTERN_FIELD_REF_SIZE, + field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE))) { + /* The externally stored field was not written yet. + This record should only be seen by + recv_recovery_rollback_active() or any + TRX_ISO_READ_UNCOMMITTED transactions. */ + return(NULL); + } + return(btr_copy_externally_stored_field(len, data, zip_size, local_len, heap)); } === modified file 'storage/innodb_plugin/btr/btr0sea.c' --- a/storage/innodb_plugin/btr/btr0sea.c 2010-05-31 16:35:40 +0000 +++ b/storage/innodb_plugin/btr/btr0sea.c 2010-07-01 05:06:01 +0000 @@ -46,6 +46,7 @@ Created 2/17/1996 Heikki Tuuri /** Flag: has the search system been enabled? Protected by btr_search_latch and btr_search_enabled_mutex. */ UNIV_INTERN char btr_search_enabled = TRUE; +UNIV_INTERN ibool btr_search_fully_disabled = FALSE; /** Mutex protecting btr_search_enabled */ static mutex_t btr_search_enabled_mutex; @@ -201,12 +202,19 @@ btr_search_disable(void) mutex_enter(&btr_search_enabled_mutex); rw_lock_x_lock(&btr_search_latch); + /* Disable access to hash index, also tell ha_insert_for_fold() + stop adding new nodes to hash index, but still allow updating + existing nodes */ btr_search_enabled = FALSE; /* Clear all block->is_hashed flags and remove all entries from btr_search_sys->hash_index. */ buf_pool_drop_hash_index(); + /* hash index has been cleaned up, disallow any operation to + the hash index */ + btr_search_fully_disabled = TRUE; + /* btr_search_enabled_mutex should guarantee this. */ ut_ad(!btr_search_enabled); @@ -225,6 +233,7 @@ btr_search_enable(void) rw_lock_x_lock(&btr_search_latch); btr_search_enabled = TRUE; + btr_search_fully_disabled = FALSE; rw_lock_x_unlock(&btr_search_latch); mutex_exit(&btr_search_enabled_mutex); @@ -1363,7 +1372,7 @@ btr_search_build_page_hash_index( rw_lock_x_lock(&btr_search_latch); - if (UNIV_UNLIKELY(!btr_search_enabled)) { + if (UNIV_UNLIKELY(btr_search_fully_disabled)) { goto exit_func; } === modified file 'storage/innodb_plugin/ha/ha0ha.c' --- a/storage/innodb_plugin/ha/ha0ha.c 2010-04-07 18:24:55 +0000 +++ b/storage/innodb_plugin/ha/ha0ha.c 2010-07-01 05:06:01 +0000 @@ -31,9 +31,7 @@ Created 8/22/1994 Heikki Tuuri #ifdef UNIV_DEBUG # include "buf0buf.h" #endif /* UNIV_DEBUG */ -#ifdef UNIV_SYNC_DEBUG -# include "btr0sea.h" -#endif /* UNIV_SYNC_DEBUG */ +#include "btr0sea.h" #include "page0page.h" /*************************************************************//** @@ -127,7 +125,8 @@ ha_clear( /*************************************************************//** Inserts an entry into a hash table. If an entry with the same fold number is found, its node is updated to point to the new data, and no new node -is inserted. +is inserted. If btr_search_enabled is set to FALSE, we will only allow +updating existing nodes, but no new node is allowed to be added. @return TRUE if succeed, FALSE if no more memory could be allocated */ UNIV_INTERN ibool @@ -174,6 +173,7 @@ ha_insert_for_fold_func( prev_block->n_pointers--; block->n_pointers++; } + ut_ad(!btr_search_fully_disabled); # endif /* !UNIV_HOTBACKUP */ prev_node->block = block; @@ -186,6 +186,13 @@ ha_insert_for_fold_func( prev_node = prev_node->next; } + /* We are in the process of disabling hash index, do not add + new chain node */ + if (!btr_search_enabled) { + ut_ad(!btr_search_fully_disabled); + return(TRUE); + } + /* We have to allocate a new chain node */ node = mem_heap_alloc(hash_get_heap(table, fold), sizeof(ha_node_t)); === modified file 'storage/innodb_plugin/handler/ha_innodb.cc' --- a/storage/innodb_plugin/handler/ha_innodb.cc 2010-08-03 21:26:17 +0000 +++ b/storage/innodb_plugin/handler/ha_innodb.cc 2010-08-27 14:12:44 +0000 @@ -2270,6 +2270,7 @@ innobase_change_buffering_inited_ok: /* Get the current high water mark format. */ innobase_file_format_check = (char*) trx_sys_file_format_max_get(); + btr_search_fully_disabled = (!btr_search_enabled); DBUG_RETURN(FALSE); error: DBUG_RETURN(TRUE); === modified file 'storage/innodb_plugin/include/btr0cur.h' --- a/storage/innodb_plugin/include/btr0cur.h 2010-02-20 16:45:41 +0000 +++ b/storage/innodb_plugin/include/btr0cur.h 2010-06-29 12:55:18 +0000 @@ -570,7 +570,7 @@ btr_copy_externally_stored_field_prefix( ulint local_len);/*!< in: length of data, in bytes */ /*******************************************************************//** Copies an externally stored field of a record to mem heap. -@return the field copied to heap */ +@return the field copied to heap, or NULL if the field is incomplete */ UNIV_INTERN byte* btr_rec_copy_externally_stored_field( === modified file 'storage/innodb_plugin/include/btr0sea.h' --- a/storage/innodb_plugin/include/btr0sea.h 2009-11-02 09:42:56 +0000 +++ b/storage/innodb_plugin/include/btr0sea.h 2010-07-01 05:06:01 +0000 @@ -190,7 +190,13 @@ btr_search_validate(void); /** Flag: has the search system been enabled? Protected by btr_search_latch and btr_search_enabled_mutex. */ -extern char btr_search_enabled; +extern char btr_search_enabled; + +/** Flag: whether the search system has completed its disabling process, +It is set to TRUE right after buf_pool_drop_hash_index() in +btr_search_disable(), indicating hash index entries are cleaned up. +Protected by btr_search_latch and btr_search_enabled_mutex. */ +extern ibool btr_search_fully_disabled; /** The search info struct in an index */ struct btr_search_struct{ === modified file 'storage/innodb_plugin/include/mem0pool.h' --- a/storage/innodb_plugin/include/mem0pool.h 2009-11-02 09:42:56 +0000 +++ b/storage/innodb_plugin/include/mem0pool.h 2010-07-28 10:20:44 +0000 @@ -100,18 +100,6 @@ mem_pool_get_reserved( /*==================*/ mem_pool_t* pool); /*!< in: memory pool */ /********************************************************************//** -Reserves the mem pool mutex. */ -UNIV_INTERN -void -mem_pool_mutex_enter(void); -/*======================*/ -/********************************************************************//** -Releases the mem pool mutex. */ -UNIV_INTERN -void -mem_pool_mutex_exit(void); -/*=====================*/ -/********************************************************************//** Validates a memory pool. @return TRUE if ok */ UNIV_INTERN === modified file 'storage/innodb_plugin/include/row0mysql.h' --- a/storage/innodb_plugin/include/row0mysql.h 2010-06-02 10:37:14 +0000 +++ b/storage/innodb_plugin/include/row0mysql.h 2010-06-29 12:55:18 +0000 @@ -622,7 +622,11 @@ struct row_prebuilt_struct { the secondary index, then this is set to TRUE */ unsigned templ_contains_blob:1;/*!< TRUE if the template contains - BLOB column(s) */ + a column with DATA_BLOB == + get_innobase_type_from_mysql_type(); + not to be confused with InnoDB + externally stored columns + (VARCHAR can be off-page too) */ mysql_row_templ_t* mysql_template;/*!< template used to transform rows fast between MySQL and Innobase formats; memory for this template === modified file 'storage/innodb_plugin/include/univ.i' --- a/storage/innodb_plugin/include/univ.i 2010-06-22 16:30:43 +0000 +++ b/storage/innodb_plugin/include/univ.i 2010-08-27 14:12:44 +0000 @@ -46,7 +46,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 1 #define INNODB_VERSION_MINOR 0 -#define INNODB_VERSION_BUGFIX 10 +#define INNODB_VERSION_BUGFIX 11 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; @@ -165,7 +165,7 @@ command. Not tested on Windows. */ #define UNIV_COMPILE_TEST_FUNCS */ -#if defined HAVE_VALGRIND +#if defined(HAVE_valgrind)&& defined(HAVE_VALGRIND_MEMCHECK_H) # define UNIV_DEBUG_VALGRIND #endif /* HAVE_VALGRIND */ #if 0 === modified file 'storage/innodb_plugin/mem/mem0mem.c' --- a/storage/innodb_plugin/mem/mem0mem.c 2010-02-20 16:45:41 +0000 +++ b/storage/innodb_plugin/mem/mem0mem.c 2010-07-28 10:20:44 +0000 @@ -367,7 +367,7 @@ mem_heap_create_block( block->line = line; #ifdef MEM_PERIODIC_CHECK - mem_pool_mutex_enter(); + mutex_enter(&(mem_comm_pool->mutex)); if (!mem_block_list_inited) { mem_block_list_inited = TRUE; @@ -376,7 +376,7 @@ mem_heap_create_block( UT_LIST_ADD_LAST(mem_block_list, mem_block_list, block); - mem_pool_mutex_exit(); + mutex_exit(&(mem_comm_pool->mutex)); #endif mem_block_set_len(block, len); mem_block_set_type(block, type); @@ -479,11 +479,11 @@ mem_heap_block_free( UT_LIST_REMOVE(list, heap->base, block); #ifdef MEM_PERIODIC_CHECK - mem_pool_mutex_enter(); + mutex_enter(&(mem_comm_pool->mutex)); UT_LIST_REMOVE(mem_block_list, mem_block_list, block); - mem_pool_mutex_exit(); + mutex_exit(&(mem_comm_pool->mutex)); #endif ut_ad(heap->total_size >= block->len); @@ -556,7 +556,7 @@ mem_validate_all_blocks(void) { mem_block_t* block; - mem_pool_mutex_enter(); + mutex_enter(&(mem_comm_pool->mutex)); block = UT_LIST_GET_FIRST(mem_block_list); @@ -568,6 +568,6 @@ mem_validate_all_blocks(void) block = UT_LIST_GET_NEXT(mem_block_list, block); } - mem_pool_mutex_exit(); + mutex_exit(&(mem_comm_pool->mutex)); } #endif === modified file 'storage/innodb_plugin/mem/mem0pool.c' --- a/storage/innodb_plugin/mem/mem0pool.c 2009-11-02 09:42:56 +0000 +++ b/storage/innodb_plugin/mem/mem0pool.c 2010-07-28 10:20:44 +0000 @@ -34,6 +34,7 @@ Created 5/12/1997 Heikki Tuuri #include "ut0lst.h" #include "ut0byte.h" #include "mem0mem.h" +#include "srv0start.h" /* We would like to use also the buffer frames to allocate memory. This would be desirable, because then the memory consumption of the database @@ -121,23 +122,33 @@ mysql@lists.mysql.com */ UNIV_INTERN ulint mem_n_threads_inside = 0; /********************************************************************//** -Reserves the mem pool mutex. */ -UNIV_INTERN +Reserves the mem pool mutex if we are not in server shutdown. Use +this function only in memory free functions, since only memory +free functions are used during server shutdown. */ +UNIV_INLINE void -mem_pool_mutex_enter(void) -/*======================*/ +mem_pool_mutex_enter( +/*=================*/ + mem_pool_t* pool) /*!< in: memory pool */ { - mutex_enter(&(mem_comm_pool->mutex)); + if (srv_shutdown_state < SRV_SHUTDOWN_EXIT_THREADS) { + mutex_enter(&(pool->mutex)); + } } /********************************************************************//** -Releases the mem pool mutex. */ -UNIV_INTERN +Releases the mem pool mutex if we are not in server shutdown. As +its corresponding mem_pool_mutex_enter() function, use it only +in memory free functions */ +UNIV_INLINE void -mem_pool_mutex_exit(void) -/*=====================*/ +mem_pool_mutex_exit( +/*================*/ + mem_pool_t* pool) /*!< in: memory pool */ { - mutex_exit(&(mem_comm_pool->mutex)); + if (srv_shutdown_state < SRV_SHUTDOWN_EXIT_THREADS) { + mutex_exit(&(pool->mutex)); + } } /********************************************************************//** @@ -567,7 +578,7 @@ mem_area_free( n = ut_2_log(size); - mutex_enter(&(pool->mutex)); + mem_pool_mutex_enter(pool); mem_n_threads_inside++; ut_a(mem_n_threads_inside == 1); @@ -595,7 +606,7 @@ mem_area_free( pool->reserved += ut_2_exp(n); mem_n_threads_inside--; - mutex_exit(&(pool->mutex)); + mem_pool_mutex_exit(pool); mem_area_free(new_ptr, pool); @@ -611,7 +622,7 @@ mem_area_free( } mem_n_threads_inside--; - mutex_exit(&(pool->mutex)); + mem_pool_mutex_exit(pool); ut_ad(mem_pool_validate(pool)); } @@ -630,7 +641,7 @@ mem_pool_validate( ulint free; ulint i; - mutex_enter(&(pool->mutex)); + mem_pool_mutex_enter(pool); free = 0; @@ -658,7 +669,7 @@ mem_pool_validate( ut_a(free + pool->reserved == pool->size); - mutex_exit(&(pool->mutex)); + mem_pool_mutex_exit(pool); return(TRUE); } === modified file 'storage/innodb_plugin/row/row0merge.c' --- a/storage/innodb_plugin/row/row0merge.c 2010-06-22 16:30:43 +0000 +++ b/storage/innodb_plugin/row/row0merge.c 2010-06-29 12:55:18 +0000 @@ -1780,6 +1780,11 @@ row_merge_copy_blobs( (below). */ data = btr_rec_copy_externally_stored_field( mrec, offsets, zip_size, i, &len, heap); + /* Because we have locked the table, any records + written by incomplete transactions must have been + rolled back already. There must not be any incomplete + BLOB columns. */ + ut_a(data); dfield_set_data(field, data, len); } === modified file 'storage/innodb_plugin/row/row0row.c' --- a/storage/innodb_plugin/row/row0row.c 2010-03-26 14:19:01 +0000 +++ b/storage/innodb_plugin/row/row0row.c 2010-06-29 13:00:58 +0000 @@ -294,7 +294,13 @@ row_build( ut_ad(dtuple_check_typed(row)); - if (j) { + if (!ext) { + /* REDUNDANT and COMPACT formats store a local + 768-byte prefix of each externally stored + column. No cache is needed. */ + ut_ad(dict_table_get_format(index->table) + < DICT_TF_FORMAT_ZIP); + } else if (j) { *ext = row_ext_create(j, ext_cols, row, dict_table_zip_size(index->table), heap); === modified file 'storage/innodb_plugin/row/row0sel.c' --- a/storage/innodb_plugin/row/row0sel.c 2010-06-09 12:17:18 +0000 +++ b/storage/innodb_plugin/row/row0sel.c 2010-06-30 09:38:47 +0000 @@ -416,7 +416,7 @@ row_sel_fetch_columns( field_no))) { /* Copy an externally stored field to the - temporary heap */ + temporary heap, if possible. */ heap = mem_heap_create(1); @@ -425,6 +425,17 @@ row_sel_fetch_columns( dict_table_zip_size(index->table), field_no, &len, heap); + /* data == NULL means that the + externally stored field was not + written yet. This record + should only be seen by + recv_recovery_rollback_active() or any + TRX_ISO_READ_UNCOMMITTED + transactions. The InnoDB SQL parser + (the sole caller of this function) + does not implement READ UNCOMMITTED, + and it is not involved during rollback. */ + ut_a(data); ut_a(len != UNIV_SQL_NULL); needs_copy = TRUE; @@ -926,6 +937,7 @@ row_sel_get_clust_rec( when plan->clust_pcur was positioned. The latch will not be released until mtr_commit(mtr). */ + ut_ad(!rec_get_deleted_flag(clust_rec, rec_offs_comp(offsets))); row_sel_fetch_columns(index, clust_rec, offsets, UT_LIST_GET_FIRST(plan->columns)); *out_rec = clust_rec; @@ -1628,6 +1640,13 @@ skip_lock: } if (old_vers == NULL) { + /* The record does not exist + in our read view. Skip it, but + first attempt to determine + whether the index segment we + are searching through has been + exhausted. */ + offsets = rec_get_offsets( rec, index, offsets, ULINT_UNDEFINED, &heap); @@ -2647,9 +2666,8 @@ Convert a row in the Innobase format to Note that the template in prebuilt may advise us to copy only a few columns to mysql_rec, other columns are left blank. All columns may not be needed in the query. -@return TRUE if success, FALSE if could not allocate memory for a BLOB -(though we may also assert in that case) */ -static +@return TRUE on success, FALSE if not all columns could be retrieved */ +static __attribute__((warn_unused_result)) ibool row_sel_store_mysql_rec( /*====================*/ @@ -2672,6 +2690,7 @@ row_sel_store_mysql_rec( ut_ad(prebuilt->mysql_template); ut_ad(prebuilt->default_rec); ut_ad(rec_offs_validate(rec, NULL, offsets)); + ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets))); if (UNIV_LIKELY_NULL(prebuilt->blob_heap)) { mem_heap_free(prebuilt->blob_heap); @@ -2719,6 +2738,21 @@ row_sel_store_mysql_rec( dict_table_zip_size(prebuilt->table), templ->rec_field_no, &len, heap); + if (UNIV_UNLIKELY(!data)) { + /* The externally stored field + was not written yet. This + record should only be seen by + recv_recovery_rollback_active() + or any TRX_ISO_READ_UNCOMMITTED + transactions. */ + + if (extern_field_heap) { + mem_heap_free(extern_field_heap); + } + + return(FALSE); + } + ut_a(len != UNIV_SQL_NULL); } else { /* Field is stored in the row. */ @@ -3136,9 +3170,10 @@ row_sel_pop_cached_row_for_mysql( } /********************************************************************//** -Pushes a row for MySQL to the fetch cache. */ -UNIV_INLINE -void +Pushes a row for MySQL to the fetch cache. +@return TRUE on success, FALSE if the record contains incomplete BLOBs */ +UNIV_INLINE __attribute__((warn_unused_result)) +ibool row_sel_push_cache_row_for_mysql( /*=============================*/ row_prebuilt_t* prebuilt, /*!< in: prebuilt struct */ @@ -3180,10 +3215,11 @@ row_sel_push_cache_row_for_mysql( prebuilt->fetch_cache[ prebuilt->n_fetch_cached], prebuilt, rec, offsets))) { - ut_error; + return(FALSE); } prebuilt->n_fetch_cached++; + return(TRUE); } /*********************************************************************//** @@ -3578,11 +3614,21 @@ row_search_for_mysql( if (!row_sel_store_mysql_rec(buf, prebuilt, rec, offsets)) { - err = DB_TOO_BIG_RECORD; + /* Only fresh inserts may contain + incomplete externally stored + columns. Pretend that such + records do not exist. Such + records may only be accessed + at the READ UNCOMMITTED + isolation level or when + rolling back a recovered + transaction. Rollback happens + at a lower level, not here. */ + ut_a(trx->isolation_level + == TRX_ISO_READ_UNCOMMITTED); - /* We let the main loop to do the - error handling */ - goto shortcut_fails_too_big_rec; + /* Proceed as in case SEL_RETRY. */ + break; } mtr_commit(&mtr); @@ -3622,7 +3668,7 @@ release_search_latch_if_needed: default: ut_ad(0); } -shortcut_fails_too_big_rec: + mtr_commit(&mtr); mtr_start(&mtr); } @@ -4357,9 +4403,18 @@ requires_clust_rec: not cache rows because there the cursor is a scrollable cursor. */ - row_sel_push_cache_row_for_mysql(prebuilt, result_rec, - offsets); - if (prebuilt->n_fetch_cached == MYSQL_FETCH_CACHE_SIZE) { + if (!row_sel_push_cache_row_for_mysql(prebuilt, result_rec, + offsets)) { + /* Only fresh inserts may contain incomplete + externally stored columns. Pretend that such + records do not exist. Such records may only be + accessed at the READ UNCOMMITTED isolation + level or when rolling back a recovered + transaction. Rollback happens at a lower + level, not here. */ + ut_a(trx->isolation_level == TRX_ISO_READ_UNCOMMITTED); + } else if (prebuilt->n_fetch_cached + == MYSQL_FETCH_CACHE_SIZE) { goto got_row; } @@ -4375,9 +4430,17 @@ requires_clust_rec: } else { if (!row_sel_store_mysql_rec(buf, prebuilt, result_rec, offsets)) { - err = DB_TOO_BIG_RECORD; - - goto lock_wait_or_error; + /* Only fresh inserts may contain + incomplete externally stored + columns. Pretend that such records do + not exist. Such records may only be + accessed at the READ UNCOMMITTED + isolation level or when rolling back a + recovered transaction. Rollback + happens at a lower level, not here. */ + ut_a(trx->isolation_level + == TRX_ISO_READ_UNCOMMITTED); + goto next_rec; } } === modified file 'storage/innodb_plugin/row/row0undo.c' --- a/storage/innodb_plugin/row/row0undo.c 2010-06-25 08:18:41 +0000 +++ b/storage/innodb_plugin/row/row0undo.c 2010-06-29 13:00:58 +0000 @@ -199,8 +199,24 @@ row_undo_search_clust_to_pcur( ret = FALSE; } else { + row_ext_t** ext; + + if (dict_table_get_format(node->table) >= DICT_TF_FORMAT_ZIP) { + /* In DYNAMIC or COMPRESSED format, there is + no prefix of externally stored columns in the + clustered index record. Build a cache of + column prefixes. */ + ext = &node->ext; + } else { + /* REDUNDANT and COMPACT formats store a local + 768-byte prefix of each externally stored + column. No cache is needed. */ + ext = NULL; + node->ext = NULL; + } + node->row = row_build(ROW_COPY_DATA, clust_index, rec, - offsets, NULL, &node->ext, node->heap); + offsets, NULL, ext, node->heap); if (node->update) { node->undo_row = dtuple_copy(node->row, node->heap); row_upd_replace(node->undo_row, &node->undo_ext, === modified file 'storage/innodb_plugin/row/row0upd.c' --- a/storage/innodb_plugin/row/row0upd.c 2010-06-10 13:58:11 +0000 +++ b/storage/innodb_plugin/row/row0upd.c 2010-06-29 13:00:58 +0000 @@ -1398,6 +1398,7 @@ row_upd_store_row( dict_index_t* clust_index; rec_t* rec; mem_heap_t* heap = NULL; + row_ext_t** ext; ulint offsets_[REC_OFFS_NORMAL_SIZE]; const ulint* offsets; rec_offs_init(offsets_); @@ -1414,8 +1415,22 @@ row_upd_store_row( offsets = rec_get_offsets(rec, clust_index, offsets_, ULINT_UNDEFINED, &heap); + + if (dict_table_get_format(node->table) >= DICT_TF_FORMAT_ZIP) { + /* In DYNAMIC or COMPRESSED format, there is no prefix + of externally stored columns in the clustered index + record. Build a cache of column prefixes. */ + ext = &node->ext; + } else { + /* REDUNDANT and COMPACT formats store a local + 768-byte prefix of each externally stored column. + No cache is needed. */ + ext = NULL; + node->ext = NULL; + } + node->row = row_build(ROW_COPY_DATA, clust_index, rec, offsets, - NULL, &node->ext, node->heap); + NULL, ext, node->heap); if (node->is_delete) { node->upd_row = NULL; node->upd_ext = NULL; === modified file 'storage/innodb_plugin/srv/srv0start.c' --- a/storage/innodb_plugin/srv/srv0start.c 2010-02-20 16:45:41 +0000 +++ b/storage/innodb_plugin/srv/srv0start.c 2010-07-28 10:20:44 +0000 @@ -2018,9 +2018,13 @@ innobase_shutdown_for_mysql(void) pars_lexer_close(); log_mem_free(); buf_pool_free(); - ut_free_all_mem(); mem_close(); + /* ut_free_all_mem() frees all allocated memory not freed yet + in shutdown, and it will also free the ut_list_mutex, so it + should be the last one for all operation */ + ut_free_all_mem(); + if (os_thread_count != 0 || os_event_count != 0 || os_mutex_count != 0 === modified file 'storage/maria/ha_maria.cc' --- a/storage/maria/ha_maria.cc 2010-07-30 07:45:27 +0000 +++ b/storage/maria/ha_maria.cc 2010-08-24 18:15:05 +0000 @@ -212,7 +212,7 @@ static MYSQL_THDVAR_ULONG(repair_threads static MYSQL_THDVAR_ULONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG, "The buffer that is allocated when sorting the index when doing a " "REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.", - 0, 0, 8192*1024, 4, ~0L, 1); + 0, 0, 128L*1024L*1024L, 4, ~0L, 1); static MYSQL_THDVAR_ENUM(stats_method, PLUGIN_VAR_RQCMDARG, "Specifies how maria index statistics collection code should treat " @@ -790,7 +790,11 @@ handler *ha_maria::clone(MEM_ROOT *mem_r { ha_maria *new_handler= static_cast <ha_maria *>(handler::clone(mem_root)); if (new_handler) + { new_handler->file->state= file->state; + /* maria_create_trn_for_mysql() is never called for clone() tables */ + new_handler->file->trn= file->trn; + } return new_handler; } @@ -1042,6 +1046,7 @@ int ha_maria::check(THD * thd, HA_CHECK_ HA_CHECK param; MARIA_SHARE *share= file->s; const char *old_proc_info= thd_proc_info(thd, "Checking table"); + TRN *old_trn= file->trn; maria_chk_init(¶m); param.thd= thd; @@ -1120,6 +1125,8 @@ int ha_maria::check(THD * thd, HA_CHECK_ file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED; } + /* Reset trn, that may have been set by repair */ + _ma_set_trn_for_table(file, old_trn); thd_proc_info(thd, old_proc_info); return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK; } @@ -1343,11 +1350,13 @@ int ha_maria::zerofill(THD * thd, HA_CHE { int error; HA_CHECK param; + TRN *old_trn; MARIA_SHARE *share= file->s; if (!file) return HA_ADMIN_INTERNAL_ERROR; + old_trn= file->trn; maria_chk_init(¶m); param.thd= thd; param.op_name= "zerofill"; @@ -1355,6 +1364,9 @@ int ha_maria::zerofill(THD * thd, HA_CHE param.sort_buffer_length= THDVAR(thd, sort_buffer_size); error=maria_zerofill(¶m, file, share->open_file_name.str); + /* Reset trn, that may have been set by repair */ + _ma_set_trn_for_table(file, old_trn); + if (!error) { pthread_mutex_lock(&share->intern_lock); @@ -1368,6 +1380,7 @@ int ha_maria::optimize(THD * thd, HA_CHE { int error; HA_CHECK param; + if (!file) return HA_ADMIN_INTERNAL_ERROR; @@ -1384,6 +1397,7 @@ int ha_maria::optimize(THD * thd, HA_CHE param.testflag &= ~T_REP_BY_SORT; error= repair(thd, ¶m, 1); } + return error; } @@ -1397,6 +1411,7 @@ int ha_maria::repair(THD *thd, HA_CHECK char fixed_name[FN_REFLEN]; MARIA_SHARE *share= file->s; ha_rows rows= file->state->records; + TRN *old_trn= file->trn; DBUG_ENTER("ha_maria::repair"); /* @@ -1558,6 +1573,9 @@ int ha_maria::repair(THD *thd, HA_CHECK thd_proc_info(thd, old_proc_info); if (!thd->locked_tables) maria_lock_database(file, F_UNLCK); + + /* Reset trn, that may have been set by repair */ + _ma_set_trn_for_table(file, old_trn); error= error ? HA_ADMIN_FAILED : (optimize_done ? (write_log_record_for_repair(param, file) ? HA_ADMIN_FAILED : @@ -1796,7 +1814,7 @@ int ha_maria::enable_indexes(uint mode) "retrying", my_errno, param.db_name, param.table_name); /* This should never fail normally */ - DBUG_ASSERT(0); + DBUG_ASSERT(thd->killed != 0); /* Repairing by sort failed. Now try standard repair method. */ param.testflag &= ~T_REP_BY_SORT; error= (repair(thd, ¶m, 0) != HA_ADMIN_OK); @@ -2295,6 +2313,8 @@ int ha_maria::info(uint flag, my_bool lo int ha_maria::extra(enum ha_extra_function operation) { + int tmp; + TRN *old_trn= file->trn; if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_KEYREAD) return 0; #ifdef NOT_USED @@ -2320,7 +2340,9 @@ int ha_maria::extra(enum ha_extra_functi TRN *trn= THD_TRN; _ma_set_trn_for_table(file, trn); } - return maria_extra(file, operation, 0); + tmp= maria_extra(file, operation, 0); + file->trn= old_trn; // Reset trn if was used + return tmp; } int ha_maria::reset(void) @@ -2415,6 +2437,13 @@ int ha_maria::external_lock(THD *thd, in *file->state= file->s->state.state; } + if (file->trn) + { + /* This can only happen with tables created with clone() */ + DBUG_ASSERT(cloned); + trnman_increment_locked_tables(file->trn); + } + if (!thd->transaction.on) { /* === modified file 'storage/maria/ma_bitmap.c' --- a/storage/maria/ma_bitmap.c 2009-01-12 11:12:00 +0000 +++ b/storage/maria/ma_bitmap.c 2010-08-23 09:52:57 +0000 @@ -365,8 +365,8 @@ my_bool _ma_bitmap_flush_all(MARIA_SHARE */ if (bitmap->changed) { - res= write_changed_bitmap(share, bitmap); bitmap->changed= FALSE; + res= write_changed_bitmap(share, bitmap); } /* We do NOT use FLUSH_KEEP_LAZY because we must be sure that bitmap @@ -2063,6 +2063,13 @@ my_bool _ma_bitmap_set_full_page_bits(MA safe_mutex_assert_owner(&info->s->bitmap.bitmap_lock); bitmap_page= page - page % bitmap->pages_covered; + if (page == bitmap_page || + page + page_count >= bitmap_page + bitmap->pages_covered) + { + DBUG_ASSERT(0); /* Wrong in data */ + DBUG_RETURN(1); + } + if (bitmap_page != bitmap->page && _ma_change_bitmap_page(info, bitmap, bitmap_page)) DBUG_RETURN(1); @@ -2142,12 +2149,12 @@ void _ma_bitmap_flushable(MARIA_HA *info DBUG_VOID_RETURN; bitmap= &share->bitmap; + pthread_mutex_lock(&bitmap->bitmap_lock); + if (non_flushable_inc == -1) { - pthread_mutex_lock(&bitmap->bitmap_lock); DBUG_ASSERT((int) bitmap->non_flushable > 0); DBUG_ASSERT(info->non_flushable_state == 1); - info->non_flushable_state= 0; if (--bitmap->non_flushable == 0) { /* @@ -2164,11 +2171,11 @@ void _ma_bitmap_flushable(MARIA_HA *info } DBUG_PRINT("info", ("bitmap->non_flushable: %u", bitmap->non_flushable)); pthread_mutex_unlock(&bitmap->bitmap_lock); + info->non_flushable_state= 0; DBUG_VOID_RETURN; } DBUG_ASSERT(non_flushable_inc == 1); DBUG_ASSERT(info->non_flushable_state == 0); - pthread_mutex_lock(&bitmap->bitmap_lock); while (unlikely(bitmap->flush_all_requested)) { /* @@ -2186,9 +2193,9 @@ void _ma_bitmap_flushable(MARIA_HA *info pthread_cond_wait(&bitmap->bitmap_cond, &bitmap->bitmap_lock); } bitmap->non_flushable++; - info->non_flushable_state= 1; DBUG_PRINT("info", ("bitmap->non_flushable: %u", bitmap->non_flushable)); pthread_mutex_unlock(&bitmap->bitmap_lock); + info->non_flushable_state= 1; DBUG_VOID_RETURN; } @@ -2217,6 +2224,8 @@ void _ma_bitmap_flushable(MARIA_HA *info Note that we may have 'filler blocks' that are used to split a block in half; These can be recognized by that they have page_count == 0. + This code also reverse the effect of ma_bitmap_flushable(.., 1); + RETURN 0 ok 1 error (Couldn't write or read bitmap page) @@ -2393,6 +2402,8 @@ my_bool _ma_bitmap_set(MARIA_HA *info, p uint bits; my_bool res; DBUG_ENTER("_ma_bitmap_set"); + DBUG_PRINT("enter", ("page: %lu head: %d empty_space: %u", + (ulong) page, head, empty_space)); pthread_mutex_lock(&info->s->bitmap.bitmap_lock); bits= (head ? === modified file 'storage/maria/ma_blockrec.c' --- a/storage/maria/ma_blockrec.c 2010-07-30 07:45:27 +0000 +++ b/storage/maria/ma_blockrec.c 2010-08-24 17:17:17 +0000 @@ -334,12 +334,13 @@ typedef struct st_maria_extent_cursor } \ } while (0) + static my_bool delete_tails(MARIA_HA *info, MARIA_RECORD_POS *tails); static my_bool delete_head_or_tail(MARIA_HA *info, pgcache_page_no_t page, uint record_number, my_bool head, my_bool from_update); #ifndef DBUG_OFF -static void _ma_print_directory(uchar *buff, uint block_size); +static void _ma_print_directory(FILE *file, uchar *buff, uint block_size); #endif static uchar *store_page_range(uchar *to, MARIA_BITMAP_BLOCK *block, uint block_size, ulong length, @@ -615,7 +616,7 @@ static inline uint end_of_previous_entry #ifndef DBUG_OFF -static void _ma_print_directory(uchar *buff, uint block_size) +static void _ma_print_directory(FILE *file, uchar *buff, uint block_size) { uint max_entry= (uint) ((uchar *) buff)[DIR_COUNT_OFFSET], row= 0; uint end_of_prev_row= PAGE_HEADER_SIZE; @@ -624,40 +625,46 @@ static void _ma_print_directory(uchar *b dir= dir_entry_pos(buff, block_size, max_entry-1); end= dir_entry_pos(buff, block_size, 0); - DBUG_LOCK_FILE; - fprintf(DBUG_FILE,"Directory dump (pos:length):\n"); + DBUG_LOCK_FILE; /* If using DBUG_FILE */ + fprintf(file,"Directory dump (pos:length):\n"); for (row= 1; dir <= end ; end-= DIR_ENTRY_SIZE, row++) { uint offset= uint2korr(end); uint length= uint2korr(end+2); - fprintf(DBUG_FILE, " %4u:%4u", offset, offset ? length : 0); + fprintf(file, " %4u:%4u", offset, offset ? length : 0); if (!(row % (80/12))) - fputc('\n', DBUG_FILE); + fputc('\n', file); if (offset) { DBUG_ASSERT(offset >= end_of_prev_row); end_of_prev_row= offset + length; } } - fputc('\n', DBUG_FILE); - fflush(DBUG_FILE); + fputc('\n', file); + fflush(file); DBUG_UNLOCK_FILE; } -static void check_directory(uchar *buff, uint block_size, uint min_row_length) +static void check_directory(uchar *buff, uint block_size, uint min_row_length, + uint real_empty_size) { uchar *dir, *end; uint max_entry= (uint) buff[DIR_COUNT_OFFSET]; uint start_of_dir, deleted; - uchar free_entry, prev_free_entry; uint end_of_prev_row= PAGE_HEADER_SIZE; + uint empty_size_on_page; + uint empty_size; + uchar free_entry, prev_free_entry; dir= dir_entry_pos(buff, block_size, max_entry-1); start_of_dir= (uint) (dir - buff); end= dir_entry_pos(buff, block_size, 0); - deleted= 0; + deleted= empty_size= 0; + + empty_size_on_page= (real_empty_size != (uint) -1 ? real_empty_size : + uint2korr(buff + EMPTY_SPACE_OFFSET)); /* Ensure that all rows are in increasing order and no overlaps */ for (; dir <= end ; end-= DIR_ENTRY_SIZE) @@ -668,12 +675,15 @@ static void check_directory(uchar *buff, { DBUG_ASSERT(offset >= end_of_prev_row); DBUG_ASSERT(!length || length >= min_row_length); + empty_size+= offset - end_of_prev_row; end_of_prev_row= offset + length; } else deleted++; } + empty_size+= start_of_dir - end_of_prev_row; DBUG_ASSERT(end_of_prev_row <= start_of_dir); + DBUG_ASSERT(empty_size == empty_size_on_page); /* check free links */ free_entry= buff[DIR_FREE_OFFSET]; @@ -690,7 +700,7 @@ static void check_directory(uchar *buff, DBUG_ASSERT(deleted == 0); } #else -#define check_directory(A,B,C) +#define check_directory(A,B,C,D) #endif /* DBUG_OFF */ @@ -698,7 +708,8 @@ static void check_directory(uchar *buff, @brief Calculate if there is enough entries on the page */ -my_bool enough_free_entries(uchar *buff, uint block_size, uint wanted_entries) +static my_bool enough_free_entries(uchar *buff, uint block_size, + uint wanted_entries) { uint entries= (uint) buff[DIR_COUNT_OFFSET]; uint needed_free_entries, free_entry; @@ -723,6 +734,33 @@ my_bool enough_free_entries(uchar *buff, /** + @brief Check if there is room for more rows on page + + @fn enough_free_entries_on_page + + @return 0 Directory is full + @return 1 There is room for more entries on the page +*/ + +static my_bool enough_free_entries_on_page(MARIA_SHARE *share, + uchar *page_buff) +{ + enum en_page_type page_type; + page_type= (enum en_page_type) (page_buff[PAGE_TYPE_OFFSET] & + ~(uchar) PAGE_CAN_BE_COMPACTED); + + if (page_type == HEAD_PAGE) + { + uint row_count= (uint) page_buff[DIR_COUNT_OFFSET]; + return !(row_count == MAX_ROWS_PER_PAGE && + page_buff[DIR_FREE_OFFSET] == END_OF_DIR_FREE_LIST); + } + return enough_free_entries(page_buff, share->block_size, + 1 + share->base.blobs); +} + + +/** @brief Extend a record area to fit a given size block @fn extend_area_on_page() @@ -764,20 +802,27 @@ static my_bool extend_area_on_page(MARIA uint *empty_space, uint *ret_offset, uint *ret_length) { - uint rec_offset, length; + uint rec_offset, length, org_rec_length; uint max_entry= (uint) buff[DIR_COUNT_OFFSET]; DBUG_ENTER("extend_area_on_page"); + /* + We can't check for min length here as we may have called + extend_directory() to create a new (empty) entry just before + */ + check_directory(buff, block_size, 0, *empty_space); + rec_offset= uint2korr(dir); if (rec_offset) { /* Extending old row; Mark current space as 'free' */ - length= uint2korr(dir + 2); + length= org_rec_length= uint2korr(dir + 2); DBUG_PRINT("info", ("rec_offset: %u length: %u request_length: %u " "empty_space: %u", - rec_offset, length, request_length, *empty_space)); + rec_offset, org_rec_length, request_length, + *empty_space)); - *empty_space+= length; + *empty_space+= org_rec_length; } else { @@ -847,6 +892,7 @@ static my_bool extend_area_on_page(MARIA "length: %u request_length: %u", length, request_length)); my_errno= HA_ERR_WRONG_IN_RECORD; /* File crashed */ + DBUG_ASSERT(0); /* For debugging */ DBUG_RETURN(1); /* Error in block */ } *empty_space= length; /* All space is here */ @@ -857,7 +903,9 @@ static my_bool extend_area_on_page(MARIA int2store(dir + 2, length); *ret_offset= rec_offset; *ret_length= length; - check_directory(buff, block_size, info ? info->s->base.min_block_length : 0); + + check_directory(buff, block_size, info ? info->s->base.min_block_length : 0, + *empty_space - length); DBUG_RETURN(0); } @@ -1066,7 +1114,7 @@ static uchar *find_free_position(MARIA_H *res_length= length; check_directory(buff, block_size, - info ? info->s->base.min_block_length : 0); + info ? info->s->base.min_block_length : 0, (uint) -1); DBUG_RETURN(dir); } /* No free places in dir; create a new one */ @@ -1087,7 +1135,8 @@ static uchar *find_free_position(MARIA_H *res_rownr= max_entry; *res_length= length; - check_directory(buff, block_size, info ? info->s->base.min_block_length : 0); + check_directory(buff, block_size, info ? info->s->base.min_block_length : 0, + *empty_space); DBUG_RETURN(dir); } @@ -1167,7 +1216,8 @@ static my_bool extend_directory(MARIA_HA } check_directory(buff, block_size, - info ? min(info->s->base.min_block_length, length) : 0); + info ? min(info->s->base.min_block_length, length) : 0, + *empty_space); DBUG_RETURN(0); } @@ -1468,6 +1518,8 @@ void _ma_compact_block_page(uchar *buff, { /* Move all entries after rownr to end of page */ uint rownr_length; + + DBUG_ASSERT(extend_block); /* Should always be true */ next_free_pos= end_of_found_block= page_pos= block_size - DIR_ENTRY_SIZE * max_entry - PAGE_SUFFIX_SIZE; diff= 0; @@ -1539,13 +1591,13 @@ void _ma_compact_block_page(uchar *buff, int2store(dir, offset + diff); /* correct current pos */ next_free_pos= offset; } - if (page_pos != end_of_found_block) { uint length= (end_of_found_block - next_free_pos); memmove(buff + page_pos - length, buff + next_free_pos, length); next_free_pos= page_pos- length; } + /* Extend rownr block to cover hole */ rownr_length= next_free_pos - start_of_found_block; int2store(dir+2, rownr_length); @@ -1568,8 +1620,9 @@ void _ma_compact_block_page(uchar *buff, } buff[PAGE_TYPE_OFFSET]&= ~(uchar) PAGE_CAN_BE_COMPACTED; } - check_directory(buff, block_size, min_row_length); - DBUG_EXECUTE("directory", _ma_print_directory(buff, block_size);); + check_directory(buff, block_size, min_row_length, + extend_block ? 0 : (uint) -1); + DBUG_EXECUTE("directory", _ma_print_directory(DBUG_FILE, buff, block_size);); DBUG_VOID_RETURN; } @@ -1798,16 +1851,11 @@ static my_bool get_rowpos_in_head_or_tai goto err; } + /* + The following dir entry is unused in case of insert / update but + not in case of undo_update / undo_delete + */ dir= dir_entry_pos(buff, block_size, rownr); -#ifdef SANITY_CHECKS - /* Tail's should always be unused */ - if (page_type == TAIL_PAGE && max_entry > rownr && - (dir[0] != 0 || dir[1] != 0)) - { - DBUG_ASSERT(0); - goto err; - } -#endif if (extend_area_on_page(page_type == HEAD_PAGE ? info : 0, buff, dir, rownr, block_size, length, @@ -2184,6 +2232,8 @@ static void store_extent_info(uchar *to, MARIA_BITMAP_BLOCK *block, *end_block; uint copy_length; my_bool first_found= 0; + DBUG_ENTER("store_extent_info"); + DBUG_PRINT("enter", ("count: %u", count)); for (block= first_block, end_block= first_block+count ; block < end_block; block++) @@ -2203,6 +2253,7 @@ static void store_extent_info(uchar *to, page_count|= START_EXTENT_BIT; } pagerange_store(to + PAGE_STORE_SIZE, page_count); + DBUG_DUMP("extent", to, ROW_EXTENT_SIZE); to+= ROW_EXTENT_SIZE; if (!first_found) { @@ -2217,6 +2268,7 @@ static void store_extent_info(uchar *to, data. */ bzero(to, (size_t) (row_extents_second_part + copy_length - to)); + DBUG_VOID_RETURN; } @@ -2235,7 +2287,8 @@ static void store_extent_info(uchar *to, @return @retval 0 ok - @retval 1 Error (out of memory or disk error changing bitmap) + @retval 1 Error (out of memory or disk error changing bitmap) or + wrong information in extent information */ static my_bool extent_to_bitmap_blocks(MARIA_HA *info, @@ -2246,7 +2299,7 @@ static my_bool extent_to_bitmap_blocks(M { MARIA_BITMAP_BLOCK *block, *start_block; MARIA_SHARE *share= info->s; - uint i; + uint i, tail_page; DBUG_ENTER("extent_to_bitmap_blocks"); if (allocate_dynamic(&info->bitmap_blocks, extent_count + 2)) @@ -2272,13 +2325,36 @@ static my_bool extent_to_bitmap_blocks(M page_count&= ~START_EXTENT_BIT; start_block->sub_blocks= (uint) (block - start_block); start_block= block; - } block->page= page_korr(extent_info); block->page_count= page_count; block->sub_blocks= 0; + if (block->page_count == 0) + { + /* Extend allocated but not used by write_block_record() */ + DBUG_ASSERT(block->page == 0); + /* This is the last block */ + blocks->count= i; + break; + } + if ((tail_page= page_count & TAIL_BIT)) + page_count= 1; - if (page_count & TAIL_BIT) + /* Check if wrong data */ + if (block->page == 0 || page_count == 0 || + (block->page + page_count) * share->block_size > + share->state.state.data_file_length) + { + DBUG_PRINT("error", ("page: %lu page_count: %u tail: %u length: %ld data_length: %ld", + (ulong) block->page, + (block->page_count & ~TAIL_BIT), + (uint) test(block->page_count & TAIL_BIT), + (ulong) ((block->page + (page_count & ~TAIL_BIT)) * + share->block_size), + (ulong) share->state.state.data_file_length)); + DBUG_RETURN(1); + } + if (tail_page) { block->org_bitmap_value= _ma_bitmap_get_page_bits(info, &share->bitmap, block->page); @@ -2290,7 +2366,7 @@ static my_bool extent_to_bitmap_blocks(M my_bool res; pthread_mutex_lock(&share->bitmap.bitmap_lock); res= _ma_bitmap_set_full_page_bits(info, &share->bitmap, - block->page, block->page_count); + block->page, page_count); pthread_mutex_unlock(&share->bitmap.bitmap_lock); if (res) DBUG_RETURN(1); @@ -2712,9 +2788,16 @@ static my_bool write_block_record(MARIA_ sizeof(char*)); memcpy(data, tmp_pos, *blob_lengths); data+= *blob_lengths; - /* Skip over tail page that was to be used to store blob */ - block++; - bitmap_blocks->tail_page_skipped= 1; + /* + The following is not true when we want to insert data into original + place. In this case we don't have any extra blocks allocated + */ + if (likely(undo_lsn == LSN_ERROR)) + { + /* Skip over tail page that was prepared for storing blob */ + block++; + bitmap_blocks->tail_page_skipped= 1; + } } if (head_block->sub_blocks > 1) { @@ -2727,7 +2810,9 @@ static my_bool write_block_record(MARIA_ /* Update page directory */ head_length= (uint) (data - row_pos->data); - DBUG_PRINT("info", ("Used head length on page: %u", head_length)); + DBUG_PRINT("info", ("Used head length on page: %u header_length: %u", + head_length, + (uint) (flag & ROW_FLAG_TRANSID ? TRANSID_SIZE : 0))); DBUG_ASSERT(data <= end_of_data); if (head_length < share->base.min_block_length) { @@ -2737,6 +2822,7 @@ static my_bool write_block_record(MARIA_ data+= diff_length; head_length= share->base.min_block_length; } + DBUG_ASSERT(undo_lsn == LSN_ERROR || head_length == row_pos->length); int2store(row_pos->dir + 2, head_length); /* update empty space at start of block */ row_pos->empty_space-= head_length; @@ -2748,7 +2834,8 @@ static my_bool write_block_record(MARIA_ head_block->empty_space= 0; /* Page is full */ head_block->used|= BLOCKUSED_USED; - check_directory(page_buff, share->block_size, share->base.min_block_length); + check_directory(page_buff, share->block_size, share->base.min_block_length, + (uint) -1); /* Now we have to write tail pages, as we need to store the position @@ -2799,11 +2886,13 @@ static my_bool write_block_record(MARIA_ { /* Set only a bit, to not cause bitmap code to believe a block is full - when there is still a lot of entries in it + when there is still a lot of entries in it. */ block->used|= BLOCKUSED_USED; } } + DBUG_ASSERT((undo_lsn == LSN_ERROR || + block == bitmap_blocks->block + bitmap_blocks->count)); column= save_column; block= save_block; blob_lengths= save_blob_lengths; @@ -3197,9 +3286,10 @@ static my_bool write_block_record(MARIA_ else { uchar log_data[LSN_STORE_SIZE + FILEID_STORE_SIZE + - PAGE_STORE_SIZE + DIRPOS_STORE_SIZE + + PAGE_STORE_SIZE + DIRPOS_STORE_SIZE + 2 + HA_CHECKSUM_STORE_SIZE + 2 + PAGERANGE_STORE_SIZE + ROW_EXTENT_SIZE]; + uchar *log_pos; ha_checksum checksum_delta; /* LOGREC_UNDO_ROW_INSERT & LOGREC_UNDO_ROW_UPDATE share same header */ @@ -3209,18 +3299,17 @@ static my_bool write_block_record(MARIA_ dirpos_store(log_data + LSN_STORE_SIZE + FILEID_STORE_SIZE + PAGE_STORE_SIZE, row_pos->rownr); - - log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data; - log_array[TRANSLOG_INTERNAL_PARTS + 0].length= - (LSN_STORE_SIZE + FILEID_STORE_SIZE + PAGE_STORE_SIZE + - DIRPOS_STORE_SIZE); + log_pos= (log_data + LSN_STORE_SIZE + FILEID_STORE_SIZE + + PAGE_STORE_SIZE + DIRPOS_STORE_SIZE); store_checksum_in_rec(share, checksum_delta, row->checksum - old_record_checksum, - log_data + LSN_STORE_SIZE + FILEID_STORE_SIZE + - PAGE_STORE_SIZE + DIRPOS_STORE_SIZE, - log_array[TRANSLOG_INTERNAL_PARTS + 0].length); + log_pos, log_pos); compile_time_assert(sizeof(ha_checksum) == HA_CHECKSUM_STORE_SIZE); + log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data; + log_array[TRANSLOG_INTERNAL_PARTS + 0].length= (uint) (log_pos - + log_data); + if (!old_record) { /* Store undo_lsn in case we are aborting the insert */ @@ -3239,16 +3328,18 @@ static my_bool write_block_record(MARIA_ else { /* Write UNDO log record for the UPDATE */ - uchar *log_pos= (log_data + - log_array[TRANSLOG_INTERNAL_PARTS + 0].length); size_t row_length, extents_length; - uint row_parts_count; + uint row_parts_count, cur_head_length; /* Write head length and extents of the original row so that we - during UNDO can put it back in the original position + during UNDO can put it back in the original position. + We don't store size for TRANSID, as we don't write this during + UNDO. */ - int2store(log_pos, info->cur_row.head_length); + cur_head_length= (info->cur_row.head_length - + info->cur_row.header_length); + int2store(log_pos, cur_head_length); pagerange_store(log_pos + 2, info->cur_row.extents_count); log_pos+= 2 + PAGERANGE_STORE_SIZE; log_array[TRANSLOG_INTERNAL_PARTS + 0].length+= (2 + @@ -3561,6 +3652,7 @@ static my_bool _ma_update_block_record2( MARIA_PINNED_PAGE page_link; uint rownr, org_empty_size, head_length; uint block_size= info->s->block_size; + uint errpos= 0; uchar *dir; pgcache_page_no_t page; struct st_row_pos_info row_pos; @@ -3599,11 +3691,21 @@ static my_bool _ma_update_block_record2( rownr= ma_recordpos_to_dir_entry(record_pos); dir= dir_entry_pos(buff, block_size, rownr); - if ((org_empty_size + cur_row->head_length) >= new_row->total_length) + /* + We can't use cur_row->head_length as the block may have been compacted + since we read it. + */ + head_length= uint2korr(dir + 2); + + if ((org_empty_size + head_length) >= new_row->total_length) { uint rec_offset, length; MARIA_BITMAP_BLOCK block; + DBUG_PRINT("info", ("org_empty_size: %u org_length: %u new_length: %lu", + org_empty_size, head_length, + new_row->total_length)); + /* We can fit the new row in the same page as the original head part of the row @@ -3613,7 +3715,10 @@ static my_bool _ma_update_block_record2( if (extend_area_on_page(info, buff, dir, rownr, block_size, new_row->total_length, &org_empty_size, &rec_offset, &length)) + { + errpos= 1; goto err; + } row_pos.buff= buff; row_pos.rownr= rownr; @@ -3630,9 +3735,15 @@ static my_bool _ma_update_block_record2( if (*cur_row->tail_positions && delete_tails(info, cur_row->tail_positions)) + { + errpos= 2; goto err; + } if (cur_row->extents_count && free_full_pages(info, cur_row)) + { + errpos= 3; goto err; + } res= write_block_record(info, oldrec, record, new_row, blocks, 1, &row_pos, undo_lsn, old_checksum); /* We can't update or delete this without re-reading it again */ @@ -3642,14 +3753,23 @@ static my_bool _ma_update_block_record2( /* Delete old row */ if (*cur_row->tail_positions && delete_tails(info, cur_row->tail_positions)) + { + errpos= 4; goto err; + } if (cur_row->extents_count && free_full_pages(info, cur_row)) + { + errpos= 5; goto err; + } head_length= uint2korr(dir + 2); if (_ma_bitmap_find_new_place(info, new_row, page, head_length + org_empty_size, blocks)) + { + errpos= 6; goto err; + } /* Allocate all size in block for record @@ -3676,10 +3796,14 @@ static my_bool _ma_update_block_record2( row_pos.length= head_length; if ((res= write_block_record(info, oldrec, record, new_row, blocks, 1, &row_pos, undo_lsn, old_checksum))) + { + errpos= 7; goto err; + } DBUG_RETURN(0); err: + DBUG_PRINT("error", ("errpos: %d", errpos)); if (info->non_flushable_state) _ma_bitmap_flushable(info, -1); _ma_unpin_all_pages_and_finalize_row(info, LSN_IMPOSSIBLE); @@ -3697,6 +3821,8 @@ err: This is the main reason we don't make a lot of subfunctions that are common between _ma_update_block_record2() and this function. + + Note: If something goes wrong we mark the file crashed */ static my_bool _ma_update_at_original_place(MARIA_HA *info, @@ -3752,6 +3878,10 @@ static my_bool _ma_update_at_original_pl if ((org_empty_size + cur_row->head_length) < length_on_head_page) { + DBUG_PRINT("error", + ("org_empty_size: %u head_length: %u length_on_page: %u", + org_empty_size, (uint) cur_row->head_length, + length_on_head_page)); my_errno= HA_ERR_WRONG_IN_RECORD; goto err; } @@ -3771,7 +3901,6 @@ static my_bool _ma_update_at_original_pl row_pos.empty_space= empty_size; row_pos.dir= dir; row_pos.data= buff + rec_offset; - row_pos.length= length_on_head_page; /* Delete old row */ if (*cur_row->tail_positions && @@ -3801,12 +3930,17 @@ static my_bool _ma_update_at_original_pl max(new_row->total_length, share->base.min_block_length) <= length_on_head_page); + /* Store same amount of data on head page as on original page */ + row_pos.length= (length_on_head_page - + (extent_count + 1 - blocks->count) * ROW_EXTENT_SIZE); + set_if_bigger(row_pos.length, share->base.min_block_length); if ((res= write_block_record(info, oldrec, record, new_row, blocks, 1, &row_pos, undo_lsn, old_checksum))) goto err; DBUG_RETURN(0); err: + _ma_mark_file_crashed(share); if (info->non_flushable_state) _ma_bitmap_flushable(info, -1); _ma_unpin_all_pages_and_finalize_row(info, LSN_IMPOSSIBLE); @@ -3860,7 +3994,7 @@ static int delete_dir_entry(uchar *buff, } #endif - check_directory(buff, block_size, 0); + check_directory(buff, block_size, 0, (uint) -1); empty_space= uint2korr(buff + EMPTY_SPACE_OFFSET); dir= dir_entry_pos(buff, block_size, record_number); length= uint2korr(dir + 2); @@ -3935,7 +4069,7 @@ static int delete_dir_entry(uchar *buff, *empty_space_res= empty_space; - check_directory(buff, block_size, 0); + check_directory(buff, block_size, 0, empty_space); DBUG_RETURN(0); } @@ -4137,7 +4271,8 @@ my_bool _ma_delete_block_record(MARIA_HA log_pos= log_data + LSN_STORE_SIZE + FILEID_STORE_SIZE + PAGE_STORE_SIZE; dirpos_store(log_pos, record_number); log_pos+= DIRPOS_STORE_SIZE; - int2store(log_pos, info->cur_row.head_length); + int2store(log_pos, info->cur_row.head_length - + info->cur_row.header_length); log_pos+= 2; pagerange_store(log_pos, info->cur_row.extents_count); log_pos+= PAGERANGE_STORE_SIZE; @@ -4410,8 +4545,7 @@ static my_bool read_long_data2(MARIA_HA MARIA_EXTENT_CURSOR *extent, uchar **data, uchar **end_of_data) { - uint left_length; - left_length= (uint) (*end_of_data - *data); + uint left_length= (uint) (*end_of_data - *data); DBUG_ENTER("read_long_data2"); DBUG_PRINT("enter", ("length: %lu left_length: %u", length, left_length)); @@ -4516,6 +4650,8 @@ int _ma_read_block_record2(MARIA_HA *inf cur_row->head_length= (uint) (end_of_data - data); cur_row->full_page_count= cur_row->tail_count= 0; cur_row->blob_length= 0; + /* Number of bytes in header that we don't need to write during undo */ + cur_row->header_length= total_header_size[(flag & PRECALC_HEADER_BITMASK)]-1; if (flag & ROW_FLAG_TRANSID) { @@ -4527,7 +4663,7 @@ int _ma_read_block_record2(MARIA_HA *inf } /* Skip trans header (for now, until we have MVCC csupport) */ - data+= total_header_size[(flag & PRECALC_HEADER_BITMASK)]; + data+= cur_row->header_length + 1 ; if (flag & ROW_FLAG_NULLS_EXTENDED) cur_null_bytes+= data[-1]; @@ -4923,7 +5059,10 @@ int _ma_read_block_record(MARIA_HA *info uint offset; uint block_size= share->block_size; DBUG_ENTER("_ma_read_block_record"); - DBUG_PRINT("enter", ("rowid: %lu", (long) record_pos)); + DBUG_PRINT("enter", ("rowid: %lu page: %lu rownr: %u", + (ulong) record_pos, + (ulong) ma_recordpos_to_page(record_pos), + ma_recordpos_to_dir_entry(record_pos))); offset= ma_recordpos_to_dir_entry(record_pos); @@ -6107,6 +6246,9 @@ uint _ma_apply_redo_insert_row_head_or_t { /* Fix bitmap, just in case */ empty_space= uint2korr(buff + EMPTY_SPACE_OFFSET); + if (!enough_free_entries_on_page(share, buff)) + empty_space= 0; /* Page is full */ + if (_ma_bitmap_set(info, page, page_type == HEAD_PAGE, empty_space)) goto err; pagecache_unlock_by_link(share->pagecache, page_link.link, @@ -6179,6 +6321,8 @@ uint _ma_apply_redo_insert_row_head_or_t result= my_errno; /* Fix bitmap */ + if (!enough_free_entries_on_page(share, buff)) + empty_space= 0; /* Page is full */ if (_ma_bitmap_set(info, page, page_type == HEAD_PAGE, empty_space)) goto err; @@ -6266,6 +6410,8 @@ uint _ma_apply_redo_purge_row_head_or_ta if ((uint) (buff[PAGE_TYPE_OFFSET] & PAGE_TYPE_MASK) == page_type) { empty_space= uint2korr(buff+EMPTY_SPACE_OFFSET); + if (!enough_free_entries_on_page(share, buff)) + empty_space= 0; /* Page is full */ if (_ma_bitmap_set(info, page, page_type == HEAD_PAGE, empty_space)) goto err; @@ -6290,6 +6436,8 @@ uint _ma_apply_redo_purge_row_head_or_ta push_dynamic(&info->pinned_pages, (void*) &page_link); result= 0; + if (!enough_free_entries_on_page(share, buff)) + empty_space= 0; /* Page is full */ /* This will work even if the page was marked as UNALLOCATED_PAGE */ if (_ma_bitmap_set(info, page, page_type == HEAD_PAGE, empty_space)) result= my_errno; @@ -6662,7 +6810,7 @@ my_bool _ma_apply_undo_row_insert(MARIA_ pgcache_page_no_t page; uint rownr; uchar *buff; - my_bool res= 1; + my_bool res; MARIA_PINNED_PAGE page_link; MARIA_SHARE *share= info->s; ha_checksum checksum; @@ -6708,11 +6856,16 @@ my_bool _ma_apply_undo_row_insert(MARIA_ goto err; res= 0; -err: +end: if (info->non_flushable_state) _ma_bitmap_flushable(info, -1); _ma_unpin_all_pages_and_finalize_row(info, lsn); DBUG_RETURN(res); + +err: + res= 1; + _ma_mark_file_crashed(share); + goto end; } @@ -6935,6 +7088,10 @@ my_bool _ma_apply_undo_row_delete(MARIA_ { DBUG_ASSERT(row.checksum == (share->calc_checksum)(info, record)); } + /* Store same amount of data on head page as on original page */ + row_pos.length= (length_on_head_page - + (extent_count + 1 - blocks->count) * ROW_EXTENT_SIZE); + set_if_bigger(row_pos.length, share->base.min_block_length); if (write_block_record(info, (uchar*) 0, record, &row, blocks, blocks->block->org_bitmap_value != 0, &row_pos, undo_lsn, 0)) @@ -6944,6 +7101,7 @@ my_bool _ma_apply_undo_row_delete(MARIA_ DBUG_RETURN(0); err: + _ma_mark_file_crashed(share); if (info->non_flushable_state) _ma_bitmap_flushable(info, -1); _ma_unpin_all_pages_and_finalize_row(info, LSN_IMPOSSIBLE); @@ -6974,7 +7132,7 @@ my_bool _ma_apply_undo_row_update(MARIA_ pgcache_page_no_t page; ha_checksum checksum_delta; uint rownr, field_length_header, extent_count, length_on_head_page; - int error= 1; + int error; DBUG_ENTER("_ma_apply_undo_row_update"); LINT_INIT(checksum_delta); @@ -6982,6 +7140,7 @@ my_bool _ma_apply_undo_row_update(MARIA_ header+= PAGE_STORE_SIZE; rownr= dirpos_korr(header); header+= DIRPOS_STORE_SIZE; + record_pos= ma_recordpos(page, rownr); DBUG_PRINT("enter", ("rowid: %lu page: %lu rownr: %u", (ulong) record_pos, (ulong) page, rownr)); @@ -7111,9 +7270,14 @@ my_bool _ma_apply_undo_row_update(MARIA_ goto err; error= 0; -err: +end: my_free(current_record, MYF(0)); DBUG_RETURN(error); + +err: + error= 1; + _ma_mark_file_crashed(share); + goto end; } @@ -7193,3 +7357,25 @@ void maria_ignore_trids(MARIA_HA *info) info->trn->min_read_from= ~(TrID) 0; } } + + +#ifndef DBUG_OFF + +/* The following functions are useful to call from debugger */ + +void _ma_print_block_info(uchar *buff) +{ + LSN lsn= lsn_korr(buff); + + printf("LSN: %lu,0x%lx type: %u dir_entries: %u dir_free: %u empty_space: %u\n", + LSN_IN_PARTS(lsn), + (uint)buff[PAGE_TYPE_OFFSET], + (uint)buff[DIR_COUNT_OFFSET], + (uint)buff[DIR_FREE_OFFSET], + (uint) uint2korr(buff + EMPTY_SPACE_OFFSET)); + printf("Start of directory: %lu\n", + maria_block_size - PAGE_SUFFIX_SIZE - + (uint) buff[DIR_COUNT_OFFSET] * DIR_ENTRY_SIZE); + _ma_print_directory(stdout, buff, maria_block_size); +} +#endif === modified file 'storage/maria/ma_check.c' --- a/storage/maria/ma_check.c 2010-07-30 07:45:27 +0000 +++ b/storage/maria/ma_check.c 2010-08-12 16:46:36 +0000 @@ -1929,8 +1929,8 @@ static int check_block_record(HA_CHECK * else _ma_check_print_error(param, "Page %9s: Wrong data in bitmap. Page_type: " - "%d empty_space: %u Bitmap-bits: %d", - llstr(page, llbuff), page_type, + "%d full: %d empty_space: %u Bitmap-bits: %d", + llstr(page, llbuff), page_type, full_dir, empty_space, bitmap_pattern); if (param->err_count++ > MAXERR || !(param->testflag & T_VERBOSE)) goto err; @@ -2270,10 +2270,14 @@ static int initialize_variables_for_repa MARIA_SORT_INFO *sort_info, MARIA_SORT_PARAM *sort_param, MARIA_HA *info, - my_bool rep_quick) + my_bool rep_quick, + MARIA_SHARE *org_share) { MARIA_SHARE *share= info->s; + /* Ro allow us to restore state and check how state changed */ + memcpy(org_share, share, sizeof(*share)); + /* Repair code relies on share->state.state so we have to update it here */ if (share->lock.update_status) (*share->lock.update_status)(info); @@ -2333,6 +2337,23 @@ static int initialize_variables_for_repa } +/* + During initialize_variables_for_repair and related functions we set some + variables to values that makes sence during repair. + This function restores these values to their original values so that we can + use the handler in MariaDB without having to close and open the table. +*/ + +static void restore_table_state_after_repair(MARIA_HA *info, + MARIA_SHARE *org_share) +{ + maria_versioning(info, info->s->have_versioning); + info->s->lock_key_trees= org_share->lock_key_trees; +} + + + + /** @brief Drop all indexes @@ -2481,11 +2502,11 @@ int maria_repair(HA_CHECK *param, regist char llbuff[22],llbuff2[22]; MARIA_SORT_INFO sort_info; MARIA_SORT_PARAM sort_param; - my_bool block_record, scan_inited= 0, - reenable_logging= share->now_transactional; + my_bool block_record, scan_inited= 0, reenable_logging= 0; enum data_file_type org_data_file_type= share->data_file_type; myf sync_dir= ((share->now_transactional && !share->temporary) ? MY_SYNC_DIR : 0); + MARIA_SHARE backup_share; DBUG_ENTER("maria_repair"); got_error= 1; @@ -2498,10 +2519,10 @@ int maria_repair(HA_CHECK *param, regist } if (initialize_variables_for_repair(param, &sort_info, &sort_param, info, - rep_quick)) + rep_quick, &backup_share)) goto err; - if (reenable_logging) + if ((reenable_logging= share->now_transactional)) _ma_tmp_disable_logging_for_table(info, 0); sort_param.current_filepos= sort_param.filepos= new_header_length= @@ -2780,6 +2801,7 @@ err: /* If caller had disabled logging it's not up to us to re-enable it */ if (reenable_logging) _ma_reenable_logging_for_table(info, FALSE); + restore_table_state_after_repair(info, &backup_share); my_free(sort_param.rec_buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR)); @@ -3550,7 +3572,8 @@ int maria_repair_by_sort(HA_CHECK *param ulonglong key_map; myf sync_dir= ((share->now_transactional && !share->temporary) ? MY_SYNC_DIR : 0); - my_bool scan_inited= 0; + my_bool scan_inited= 0, reenable_logging= 0; + MARIA_SHARE backup_share; DBUG_ENTER("maria_repair_by_sort"); LINT_INIT(key_map); @@ -3564,9 +3587,12 @@ int maria_repair_by_sort(HA_CHECK *param } if (initialize_variables_for_repair(param, &sort_info, &sort_param, info, - rep_quick)) + rep_quick, &backup_share)) goto err; + if ((reenable_logging= share->now_transactional)) + _ma_tmp_disable_logging_for_table(info, 0); + org_header_length= share->pack.header_length; new_header_length= (param->testflag & T_UNPACK) ? 0 : org_header_length; sort_param.filepos= new_header_length; @@ -3972,6 +3998,11 @@ err: share->state.changed&= ~(STATE_NOT_OPTIMIZED_ROWS | STATE_NOT_ZEROFILLED | STATE_NOT_MOVABLE); + /* If caller had disabled logging it's not up to us to re-enable it */ + if (reenable_logging) + _ma_reenable_logging_for_table(info, FALSE); + restore_table_state_after_repair(info, &backup_share); + my_free(sort_param.rec_buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_param.record,MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_info.key_block, MYF(MY_ALLOW_ZERO_PTR)); @@ -4042,10 +4073,12 @@ int maria_repair_parallel(HA_CHECK *para IO_CACHE new_data_cache; /* For non-quick repair. */ IO_CACHE_SHARE io_share; MARIA_SORT_INFO sort_info; + MARIA_SHARE backup_share; ulonglong key_map; pthread_attr_t thr_attr; myf sync_dir= ((share->now_transactional && !share->temporary) ? MY_SYNC_DIR : 0); + my_bool reenable_logging= 0; DBUG_ENTER("maria_repair_parallel"); LINT_INIT(key_map); @@ -4059,9 +4092,12 @@ int maria_repair_parallel(HA_CHECK *para } if (initialize_variables_for_repair(param, &sort_info, &tmp_sort_param, info, - rep_quick)) + rep_quick, &backup_share)) goto err; + if ((reenable_logging= share->now_transactional)) + _ma_tmp_disable_logging_for_table(info, 0); + new_header_length= ((param->testflag & T_UNPACK) ? 0 : share->pack.header_length); @@ -4489,6 +4525,11 @@ err: pthread_cond_destroy (&sort_info.cond); pthread_mutex_destroy(&sort_info.mutex); + /* If caller had disabled logging it's not up to us to re-enable it */ + if (reenable_logging) + _ma_reenable_logging_for_table(info, FALSE); + restore_table_state_after_repair(info, &backup_share); + my_free(sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR)); my_free(sort_param,MYF(MY_ALLOW_ZERO_PTR)); @@ -6721,7 +6762,7 @@ static void _ma_check_print_not_visible_ { _ma_check_print_warning(param, "Found row with transaction id %s but no " - "maria_control_file was specified. " + "maria_control_file was used or specified. " "The table may be corrupted", llstr(used_trid, buff)); } === modified file 'storage/maria/ma_checkpoint.c' --- a/storage/maria/ma_checkpoint.c 2009-02-09 21:02:04 +0000 +++ b/storage/maria/ma_checkpoint.c 2010-08-12 17:55:00 +0000 @@ -827,7 +827,6 @@ static int collect_tables(LEX_STRING *st not seen again in the loop. */ share->in_checkpoint= MARIA_CHECKPOINT_LOOKS_AT_ME; - /** @todo avoid strlen() */ total_names_length+= share->open_file_name.length; } } === modified file 'storage/maria/ma_control_file.c' --- a/storage/maria/ma_control_file.c 2008-11-04 10:54:04 +0000 +++ b/storage/maria/ma_control_file.c 2010-08-10 21:58:08 +0000 @@ -398,7 +398,7 @@ CONTROL_FILE_ERROR ma_control_file_open( } new_block_size= uint2korr(buffer + CF_BLOCKSIZE_OFFSET); - if (new_block_size != maria_block_size) + if (new_block_size != maria_block_size && maria_block_size) { error= CONTROL_FILE_WRONG_BLOCKSIZE; sprintf(errmsg_buff, @@ -407,6 +407,7 @@ CONTROL_FILE_ERROR ma_control_file_open( errmsg= errmsg_buff; goto err; } + maria_block_size= new_block_size; if (my_checksum(0, buffer, new_cf_create_time_size - CF_CHECKSUM_SIZE) != uint4korr(buffer + new_cf_create_time_size - CF_CHECKSUM_SIZE)) === modified file 'storage/maria/ma_key_recover.c' --- a/storage/maria/ma_key_recover.c 2009-02-19 09:01:25 +0000 +++ b/storage/maria/ma_key_recover.c 2010-08-23 09:52:57 +0000 @@ -64,8 +64,9 @@ void _ma_unpin_all_pages(MARIA_HA *info, builds. */ #ifdef EXTRA_DEBUG - DBUG_ASSERT(!pinned_page->changed || - undo_lsn != LSN_IMPOSSIBLE || !info->s->now_transactional); + DBUG_ASSERT((!pinned_page->changed || + undo_lsn != LSN_IMPOSSIBLE || !info->s->now_transactional) || + (info->s->state.changed & STATE_CRASHED)); #endif pagecache_unlock_by_link(info->s->pagecache, pinned_page->link, pinned_page->unlock, PAGECACHE_UNPIN, @@ -494,7 +495,8 @@ my_bool _ma_log_add(MARIA_PAGE *ma_page, my_bool handle_overflow __attribute__ ((unused))) { LSN lsn; - uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 3 + 3 + 3 + 3 + 7 + 2]; + uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 2 + 3 + 3 + 3 + 3 + 7 + + 2]; uchar *log_pos; uchar *buff= ma_page->buff; LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 3]; @@ -509,6 +511,7 @@ my_bool _ma_log_add(MARIA_PAGE *ma_page, (ulong) ma_page->pos, org_page_length, changed_length, move_length)); DBUG_ASSERT(info->s->now_transactional); + DBUG_ASSERT(move_length <= (int) changed_length); /* Write REDO entry that contains the logical operations we need @@ -519,6 +522,11 @@ my_bool _ma_log_add(MARIA_PAGE *ma_page, page_store(log_pos, page_pos); log_pos+= PAGE_STORE_SIZE; +#ifdef EXTRA_DEBUG_KEY_CHANGES + *log_pos++= KEY_OP_DEBUG; + *log_pos++= KEY_OP_DEBUG_LOG_ADD; +#endif + /* Store keypage_flag */ *log_pos++= KEY_OP_SET_PAGEFLAG; *log_pos++= buff[KEYPAGE_TRANSFLAG_OFFSET]; @@ -533,21 +541,31 @@ my_bool _ma_log_add(MARIA_PAGE *ma_page, DBUG_ASSERT(handle_overflow); if (offset + changed_length > page_length) { + /* Log that data changed to end of page */ changed_length= page_length - offset; move_length= 0; + /* Set page to max length */ + org_page_length= page_length; + *log_pos++= KEY_OP_MAX_PAGELENGTH; } else { + /* They key will not be part of the page ; Don't log it */ uint diff= org_page_length + move_length - page_length; log_pos[0]= KEY_OP_DEL_SUFFIX; int2store(log_pos+1, diff); log_pos+= 3; - org_page_length= page_length - move_length; + org_page_length-= diff; + DBUG_ASSERT(org_page_length == page_length - move_length); } + DBUG_ASSERT(offset != org_page_length); } if (offset == org_page_length) + { + DBUG_ASSERT(move_length == (int) changed_length); log_pos[0]= KEY_OP_ADD_SUFFIX; + } else { log_pos[0]= KEY_OP_OFFSET; @@ -832,6 +850,8 @@ err: KEY_OP_CHECK 6 page_length[2},CRC Used only when debugging KEY_OP_COMPACT_PAGE 6 transid KEY_OP_SET_PAGEFLAG 1 flag for page + KEY_OP_MAX_PAGELENGTH 0 Set page to max length + KEY_OP_DEBUG 1 Info where logging was done @return Operation status @retval 0 OK @@ -850,6 +870,7 @@ uint _ma_apply_redo_index(MARIA_HA *info const uchar *header_end= header + head_length; uint page_offset= 0, org_page_length; uint nod_flag, page_length, keypage_header, keynr; + uint max_page_length= share->block_size - KEYPAGE_CHECKSUM_SIZE; int result; MARIA_PAGE page; DBUG_ENTER("_ma_apply_redo_index"); @@ -898,12 +919,12 @@ uint _ma_apply_redo_index(MARIA_HA *info header+= 2; DBUG_PRINT("redo", ("key_op_shift: %d", length)); DBUG_ASSERT(page_offset != 0 && page_offset <= page_length && - page_length + length < share->block_size); + page_length + length <= max_page_length); if (length < 0) bmove(buff + page_offset, buff + page_offset - length, page_length - page_offset + length); - else + else if (page_length != page_offset) bmove_upp(buff + page_length + length, buff + page_length, page_length - page_offset); page_length+= length; @@ -927,7 +948,7 @@ uint _ma_apply_redo_index(MARIA_HA *info insert_length, changed_length)); DBUG_ASSERT(insert_length <= changed_length && - page_length + changed_length <= share->block_size); + page_length + changed_length <= max_page_length); bmove_upp(buff + page_length + insert_length, buff + page_length, page_length - keypage_header); @@ -954,7 +975,7 @@ uint _ma_apply_redo_index(MARIA_HA *info { uint insert_length= uint2korr(header); DBUG_PRINT("redo", ("key_op_add_prefix: %u", insert_length)); - DBUG_ASSERT(page_length + insert_length <= share->block_size); + DBUG_ASSERT(page_length + insert_length <= max_page_length); memcpy(buff + page_length, header+2, insert_length); page_length+= insert_length; @@ -983,7 +1004,7 @@ uint _ma_apply_redo_index(MARIA_HA *info page_length - LSN_STORE_SIZE)) { DBUG_PRINT("error", ("page_length %u",page_length)); - DBUG_DUMP("KEY_OP_CHECK bad page", buff, share->block_size); + DBUG_DUMP("KEY_OP_CHECK bad page", buff, max_page_length); DBUG_ASSERT("crc" == "failure in REDO_INDEX"); } #endif @@ -991,6 +1012,14 @@ uint _ma_apply_redo_index(MARIA_HA *info header+= 6; break; } + case KEY_OP_DEBUG: + DBUG_PRINT("redo", ("Debug: %u", (uint) header[0])); + header++; + break; + case KEY_OP_MAX_PAGELENGTH: + DBUG_PRINT("redo", ("key_op_max_page_length")); + page_length= max_page_length; + break; case KEY_OP_MULTI_COPY: /* 9 */ { /* @@ -1011,7 +1040,7 @@ uint _ma_apply_redo_index(MARIA_HA *info log_memcpy_length= uint2korr(header); header+= 2; log_memcpy_end= header + log_memcpy_length; - DBUG_ASSERT(full_length < share->block_size); + DBUG_ASSERT(full_length <= max_page_length); while (header < log_memcpy_end) { uint to, from; @@ -1020,7 +1049,7 @@ uint _ma_apply_redo_index(MARIA_HA *info from= uint2korr(header); header+= 2; /* "from" is a place in the existing page */ - DBUG_ASSERT(max(from, to) < share->block_size); + DBUG_ASSERT(max(from, to) < max_page_length); memcpy(buff + to, buff + from, full_length); } break; === modified file 'storage/maria/ma_key_recover.h' --- a/storage/maria/ma_key_recover.h 2010-03-09 19:22:24 +0000 +++ b/storage/maria/ma_key_recover.h 2010-08-09 17:05:42 +0000 @@ -72,7 +72,8 @@ my_bool _ma_log_add(MARIA_PAGE *page, ui my_bool handle_overflow); my_bool _ma_log_delete(MARIA_PAGE *page, const uchar *key_pos, uint changed_length, uint move_length); -my_bool _ma_log_change(MARIA_PAGE *page, const uchar *key_pos, uint length); +my_bool _ma_log_change(MARIA_PAGE *page, const uchar *key_pos, uint length, + enum en_key_debug debug_marker); my_bool _ma_log_new(MARIA_PAGE *page, my_bool root_page); uint _ma_apply_redo_index_new_page(MARIA_HA *info, LSN lsn, === modified file 'storage/maria/ma_loghandler.h' --- a/storage/maria/ma_loghandler.h 2009-01-15 22:25:53 +0000 +++ b/storage/maria/ma_loghandler.h 2010-08-09 17:05:42 +0000 @@ -165,7 +165,20 @@ enum en_key_op KEY_OP_CHECK, /* For debugging; CRC of used part of page */ KEY_OP_MULTI_COPY, /* List of memcpy()s with fixed-len sources in page */ KEY_OP_SET_PAGEFLAG, /* Set pageflag from next byte */ - KEY_OP_COMPACT_PAGE /* Compact key page */ + KEY_OP_COMPACT_PAGE, /* Compact key page */ + KEY_OP_MAX_PAGELENGTH, /* Set page to max page length */ + KEY_OP_DEBUG /* Entry for storing what triggered redo_index */ +}; + +enum en_key_debug +{ + KEY_OP_DEBUG_RTREE_COMBINE, + KEY_OP_DEBUG_RTREE_SPLIT, + KEY_OP_DEBUG_RTREE_SET_KEY, + KEY_OP_DEBUG_FATHER_CHANGED_1, + KEY_OP_DEBUG_FATHER_CHANGED_2, + KEY_OP_DEBUG_LOG_SPLIT, + KEY_OP_DEBUG_LOG_ADD }; === modified file 'storage/maria/ma_recovery.c' --- a/storage/maria/ma_recovery.c 2010-08-05 15:56:31 +0000 +++ b/storage/maria/ma_recovery.c 2010-08-23 09:52:57 +0000 @@ -494,8 +494,10 @@ end: } else if (!error && max_trid_in_control_file != max_long_trid) { - /* Set max trid in log file so that one can run maria_chk on the tables */ - max_trid_in_control_file= trnman_get_max_trid(); + /* + maria_end() will set max trid in log file so that one can run + maria_chk on the tables + */ maria_recovery_changed_data= 1; } @@ -2395,6 +2397,7 @@ static int run_redo_phase(LSN lsn, LSN l struct st_translog_scanner_data scanner; int len; uint i; + DBUG_ENTER("run_redo_phase"); /* install hooks for execution */ #define install_redo_exec_hook(R) \ @@ -2459,7 +2462,7 @@ static int run_redo_phase(LSN lsn, LSN l { tprint(tracef, "checkpoint address refers to the log end log or " "log is empty, nothing to do.\n"); - return 0; + DBUG_RETURN(0); } len= translog_read_record_header(lsn, &rec); @@ -2467,12 +2470,12 @@ static int run_redo_phase(LSN lsn, LSN l if (len == RECHEADER_READ_ERROR) { eprint(tracef, "Failed to read header of the first record."); - return 1; + DBUG_RETURN(1); } if (translog_scanner_init(lsn, 1, &scanner, 1)) { tprint(tracef, "Scanner init failed\n"); - return 1; + DBUG_RETURN(1); } for (i= 1;;i++) { @@ -2525,7 +2528,7 @@ static int run_redo_phase(LSN lsn, LSN l LSN_IN_PARTS(rec2.lsn)); translog_destroy_scanner(&scanner); translog_free_record_header(&rec); - return(0); + DBUG_RETURN(0); } if (translog_scanner_init(rec2.lsn, 1, &scanner2, 1)) @@ -2623,12 +2626,12 @@ static int run_redo_phase(LSN lsn, LSN l fflush(stderr); procent_printed= 1; } - return 0; + DBUG_RETURN(0); err: translog_destroy_scanner(&scanner); translog_free_record_header(&rec); - return 1; + DBUG_RETURN(1); } @@ -3167,6 +3170,8 @@ static LSN parse_checkpoint_record(LSN l return LSN_ERROR; next_dirty_page_in_pool= dirty_pages_pool; minimum_rec_lsn_of_dirty_pages= LSN_MAX; + if (maria_recovery_verbose) + tprint(tracef, "Table_id Is_index Page_id Rec_lsn\n"); for (i= 0; i < nb_dirty_pages ; i++) { pgcache_page_no_t page_id; @@ -3183,6 +3188,9 @@ static LSN parse_checkpoint_record(LSN l if (new_page((is_index << 16) | table_id, page_id, rec_lsn, next_dirty_page_in_pool++)) return LSN_ERROR; + if (maria_recovery_verbose) + tprint(tracef, "%8u %8u %12lu %lu,0x%lx\n", (uint) table_id, + (uint) is_index, (ulong) page_id, LSN_IN_PARTS(rec_lsn)); set_if_smaller(minimum_rec_lsn_of_dirty_pages, rec_lsn); } /* after that, there will be no insert/delete into the hash */ === modified file 'storage/maria/ma_rt_index.c' --- a/storage/maria/ma_rt_index.c 2009-09-15 11:22:39 +0000 +++ b/storage/maria/ma_rt_index.c 2010-08-09 17:05:42 +0000 @@ -625,7 +625,8 @@ static int maria_rtree_insert_req(MARIA_ { maria_rtree_combine_rect(keyinfo->seg, k, key->data, k, key_length); if (share->now_transactional && - _ma_log_change(&page, k, key_length)) + _ma_log_change(&page, k, key_length, + KEY_OP_DEBUG_RTREE_COMBINE)) goto err; page_mark_changed(info, &page); if (_ma_write_keypage(&page, PAGECACHE_LOCK_LEFT_WRITELOCKED, @@ -652,7 +653,8 @@ static int maria_rtree_insert_req(MARIA_ if (maria_rtree_set_key_mbr(info, &k_key, _ma_kpos(nod_flag, k))) goto err; if (share->now_transactional && - _ma_log_change(&page, k, key_length)) + _ma_log_change(&page, k, key_length, + KEY_OP_DEBUG_RTREE_SPLIT)) goto err; /* add new key for new page */ _ma_kpointer(info, new_key_buff - nod_flag, *new_page); @@ -964,7 +966,8 @@ static int maria_rtree_delete_req(MARIA_ _ma_kpos(nod_flag, k))) goto err; if (share->now_transactional && - _ma_log_change(&page, k, key->data_length)) + _ma_log_change(&page, k, key->data_length, + KEY_OP_DEBUG_RTREE_SET_KEY)) goto err; page_mark_changed(info, &page) if (_ma_write_keypage(&page, === modified file 'storage/maria/ma_state.c' --- a/storage/maria/ma_state.c 2010-06-15 22:00:51 +0000 +++ b/storage/maria/ma_state.c 2010-08-07 14:42:30 +0000 @@ -678,6 +678,7 @@ void maria_versioning(MARIA_HA *info, my info->lock.type= versioning ? TL_WRITE_CONCURRENT_INSERT : TL_WRITE; _ma_block_get_status((void*) info, versioning); info->lock.type= save_lock_type; + info->state= info->state_start= &info->s->state.common; } } === modified file 'storage/maria/ma_static.c' --- a/storage/maria/ma_static.c 2010-06-13 22:13:32 +0000 +++ b/storage/maria/ma_static.c 2010-08-18 07:52:57 +0000 @@ -37,7 +37,7 @@ my_bool maria_flush= 0, maria_single_use my_bool maria_delay_key_write= 0, maria_page_checksums= 1; my_bool maria_inited= FALSE; my_bool maria_in_ha_maria= FALSE; /* If used from ha_maria or not */ -my_bool maria_recovery_changed_data= 0; +my_bool maria_recovery_changed_data= 0, maria_recovery_verbose= 0; pthread_mutex_t THR_LOCK_maria; #if defined(THREAD) && !defined(DONT_USE_RW_LOCKS) ulong maria_concurrent_insert= 2; === modified file 'storage/maria/ma_test2.c' --- a/storage/maria/ma_test2.c 2009-01-12 11:12:00 +0000 +++ b/storage/maria/ma_test2.c 2010-08-20 07:29:26 +0000 @@ -83,6 +83,9 @@ int main(int argc, char *argv[]) if (! async_io) my_disable_async_io=1; + /* If we sync or not have no affect on this test */ + my_disable_sync= 1; + maria_data_root= (char *)"."; /* Maria requires that we always have a page cache */ if (maria_init() || @@ -351,7 +354,10 @@ int main(int argc, char *argv[]) key3[atoi((char*) read_record+keyinfo[2].seg[0].start)]=0; } else + { puts("Warning: Skipping delete test because no dupplicate keys"); + break; + } } if (testflag == 3) goto end; === modified file 'storage/maria/ma_write.c' --- a/storage/maria/ma_write.c 2010-08-05 15:56:31 +0000 +++ b/storage/maria/ma_write.c 2010-08-20 07:29:26 +0000 @@ -1416,7 +1416,8 @@ static int _ma_balance_page(MARIA_HA *in /* Log changes to father (one level up) page */ if (share->now_transactional && - _ma_log_change(father_page, father_key_pos, k_length)) + _ma_log_change(father_page, father_key_pos, k_length, + KEY_OP_DEBUG_FATHER_CHANGED_1)) goto err; /* @@ -1583,7 +1584,8 @@ static int _ma_balance_page(MARIA_HA *in /* Log changes to father (one level up) page */ if (share->now_transactional && - _ma_log_change(father_page, father_key_pos, k_length)) + _ma_log_change(father_page, father_key_pos, k_length, + KEY_OP_DEBUG_FATHER_CHANGED_2)) goto err; } @@ -1905,32 +1907,39 @@ my_bool _ma_log_new(MARIA_PAGE *ma_page, Log when some part of the key page changes */ -my_bool _ma_log_change(MARIA_PAGE *ma_page, - const uchar *key_pos, uint length) +my_bool _ma_log_change(MARIA_PAGE *ma_page, const uchar *key_pos, uint length, + enum en_key_debug debug_marker __attribute__((unused))) { LSN lsn; - uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 6 + 7], *log_pos; + uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 2 + 6 + 7], *log_pos; LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 3]; uint offset= (uint) (key_pos - ma_page->buff), translog_parts; - uint extra_length= 0; my_off_t page; MARIA_HA *info= ma_page->info; DBUG_ENTER("_ma_log_change"); DBUG_PRINT("enter", ("page: %lu length: %u", (ulong) ma_page->pos, length)); DBUG_ASSERT(info->s->now_transactional); + DBUG_ASSERT(offset + length <= ma_page->size); /* Store address of new root page */ page= ma_page->pos / info->s->block_size; page_store(log_data + FILEID_STORE_SIZE, page); log_pos= log_data+ FILEID_STORE_SIZE + PAGE_STORE_SIZE; + +#ifdef EXTRA_DEBUG_KEY_CHANGES + (*log_pos++)= KEY_OP_DEBUG; + (*log_pos++)= debug_marker; +#endif + log_pos[0]= KEY_OP_OFFSET; int2store(log_pos+1, offset); log_pos[3]= KEY_OP_CHANGE; int2store(log_pos+4, length); + log_pos+= 6; log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data; - log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data) - 7; + log_array[TRANSLOG_INTERNAL_PARTS + 0].length= (log_pos - log_data); log_array[TRANSLOG_INTERNAL_PARTS + 1].str= key_pos; log_array[TRANSLOG_INTERNAL_PARTS + 1].length= length; translog_parts= 2; @@ -1941,21 +1950,19 @@ my_bool _ma_log_change(MARIA_PAGE *ma_pa ha_checksum crc; crc= my_checksum(0, ma_page->buff + LSN_STORE_SIZE, page_length - LSN_STORE_SIZE); - log_pos+= 6; log_pos[0]= KEY_OP_CHECK; int2store(log_pos+1, page_length); int4store(log_pos+3, crc); log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].str= log_pos; log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].length= 7; - extra_length+= 7; + log_pos+= 7; translog_parts++; } #endif if (translog_write_record(&lsn, LOGREC_REDO_INDEX, info->trn, info, - (translog_size_t) (sizeof(log_data) - 7 + length + - extra_length), + (translog_size_t) (log_pos - log_data) + length, TRANSLOG_INTERNAL_PARTS + translog_parts, log_array, log_data, NULL)) DBUG_RETURN(1); @@ -1966,6 +1973,21 @@ my_bool _ma_log_change(MARIA_PAGE *ma_pa /** @brief Write log entry for page splitting + @fn _ma_log_split() + @param + ma_page Page that is changed + org_length Original length of page + new_length New length of page + key_pos Where key is inserted on page (may be 0 if no key) + key_length Number of bytes changed at key_pos + move_length Number of bytes moved at key_pos to make room for key + prefix_or_suffix KEY_OP_NONE Ignored + KEY_OP_ADD_PREFIX Add data to start of page + KEY_OP_ADD_SUFFIX Add data to end of page + data What data was added + data_length Number of bytes added first or last + changed_length Number of bytes changed first or last. + @note Write log entry for page that has got a key added to the page under one and only one of the following senarios: @@ -1973,9 +1995,6 @@ my_bool _ma_log_change(MARIA_PAGE *ma_pa - Data is added to end of page - Data added at front of page - @param prefix_or_suffix KEY_OP_NONE Ignored - KEY_OP_ADD_PREFIX Add data to start of page - KEY_OP_ADD_SUFFIX Add data to end of page */ @@ -1987,7 +2006,7 @@ static my_bool _ma_log_split(MARIA_PAGE uint changed_length) { LSN lsn; - uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 3+3+3+3+3+2 +7]; + uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 2 + 3+3+3+3+3+2 +7]; uchar *log_pos; LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 4]; uint offset= (uint) (key_pos - ma_page->buff); @@ -1998,11 +2017,18 @@ static my_bool _ma_log_split(MARIA_PAGE DBUG_PRINT("enter", ("page: %lu org_length: %u new_length: %u", (ulong) ma_page->pos, org_length, new_length)); + DBUG_ASSERT(changed_length >= data_length); + log_pos= log_data + FILEID_STORE_SIZE; page= ma_page->pos / info->s->block_size; page_store(log_pos, page); log_pos+= PAGE_STORE_SIZE; +#ifdef EXTRA_DEBUG_KEY_CHANGES + (*log_pos++)= KEY_OP_DEBUG; + (*log_pos++)= KEY_OP_DEBUG_LOG_SPLIT; +#endif + if (new_length <= offset || !key_pos) { /* @@ -2015,6 +2041,7 @@ static my_bool _ma_log_split(MARIA_PAGE log_pos+= 3; translog_parts= 1; extra_length= 0; + DBUG_ASSERT(data_length == 0); } else { @@ -2034,10 +2061,13 @@ static my_bool _ma_log_split(MARIA_PAGE log_pos[0]= KEY_OP_DEL_SUFFIX; int2store(log_pos + 1, diff); log_pos+= 3; + DBUG_ASSERT(data_length == 0); /* Page is shortened */ + DBUG_ASSERT(offset <= org_length - diff); } else { DBUG_ASSERT(new_length == org_length + move_length + data_length); + DBUG_ASSERT(offset <= org_length); } log_pos[0]= KEY_OP_OFFSET; === modified file 'storage/maria/maria_chk.c' --- a/storage/maria/maria_chk.c 2010-08-05 15:59:44 +0000 +++ b/storage/maria/maria_chk.c 2010-08-24 22:43:26 +0000 @@ -71,6 +71,14 @@ static const char *record_formats[]= "Fixed length", "Packed", "Compressed", "Block", "?" }; +static const char *bitmap_description[]= +{ + "Empty page", "Part filled head page","Part filled head page", + "Part filled head page", "Full head page", + "Part filled tail page","Part filled tail page", + "Full tail or blob page" +}; + static const char *maria_stats_method_str="nulls_unequal"; static char default_open_errmsg[]= "%d when opening MARIA-table '%s'"; static char default_close_errmsg[]= "%d when closing MARIA-table '%s'"; @@ -106,7 +114,9 @@ int main(int argc, char **argv) error=0; maria_init(); - if (ma_control_file_open(FALSE, opt_require_control_file) && + maria_block_size= 0; /* Use block size from control file */ + if (ma_control_file_open(FALSE, opt_require_control_file || + !(check_param.testflag & T_SILENT)) && (opt_require_control_file || (opt_transaction_logging && (check_param.testflag & T_REP_ANY)))) { @@ -1242,7 +1252,7 @@ static int maria_chk(HA_CHECK *param, ch } else if ((param->testflag & T_CHECK) || !(param->testflag & T_AUTO_INC)) { - if (!(param->testflag & T_SILENT) || param->testflag & T_INFO) + if (!(param->testflag & T_VERY_SILENT) || param->testflag & T_INFO) printf("Checking MARIA file: %s\n",filename); if (!(param->testflag & T_SILENT)) printf("Data records: %7s Deleted blocks: %7s\n", @@ -1516,7 +1526,7 @@ static void descript(HA_CHECK *param, re printf("Using only keys '%s' of %d possibly keys\n", buff, share->base.keys); } - puts("\ntable description:"); + puts("\nTable description:"); printf("Key Start Len Index Type"); if (param->testflag & T_VERBOSE) printf(" Rec/key Root Blocksize"); @@ -1658,6 +1668,14 @@ static void descript(HA_CHECK *param, re } VOID(putchar('\n')); } + if (share->data_file_type == BLOCK_RECORD) + { + uint i; + puts("\nBitmap Data size Description"); + for (i=0 ; i <= 7 ; i++) + printf("%u %5u %s\n", i, share->bitmap.sizes[i], + bitmap_description[i]); + } } DBUG_VOID_RETURN; } /* describe */ === modified file 'storage/maria/maria_def.h' --- a/storage/maria/maria_def.h 2010-07-30 07:45:27 +0000 +++ b/storage/maria/maria_def.h 2010-08-24 22:18:01 +0000 @@ -459,8 +459,9 @@ typedef struct st_maria_row uint *null_field_lengths; /* All null field lengths */ ulong *blob_lengths; /* Length for each blob */ ulong min_length, normal_length, char_length, varchar_length; - ulong blob_length, head_length, total_length; + ulong blob_length, total_length; size_t extents_buffer_length; /* Size of 'extents' buffer */ + uint head_length, header_length; uint field_lengths_length; /* Length of data in field_lengths */ uint extents_count; /* number of extents in 'extents' */ uint full_page_count, tail_count; /* For maria_chk */ @@ -797,6 +798,7 @@ extern uint maria_quick_table_bits; extern char *maria_data_root; extern uchar maria_zero_string[]; extern my_bool maria_inited, maria_in_ha_maria, maria_recovery_changed_data; +extern my_bool maria_recovery_verbose; extern HASH maria_stored_state; extern int (*maria_create_trn_hook)(MARIA_HA *); @@ -1081,7 +1083,7 @@ typedef struct st_maria_block_info #define USE_BUFFER_INIT (((1024L*1024L*128-MALLOC_OVERHEAD)/8192)*8192) #define READ_BUFFER_INIT (1024L*256L-MALLOC_OVERHEAD) -#define SORT_BUFFER_INIT (1024L*1024L*64-MALLOC_OVERHEAD) +#define SORT_BUFFER_INIT (1024L*1024L*256-MALLOC_OVERHEAD) #define MIN_SORT_BUFFER (4096-MALLOC_OVERHEAD) #define fast_ma_writeinfo(INFO) if (!(INFO)->s->tot_locks) (void) _ma_writeinfo((INFO),0) === modified file 'storage/maria/maria_pack.c' --- a/storage/maria/maria_pack.c 2010-08-02 09:01:24 +0000 +++ b/storage/maria/maria_pack.c 2010-08-11 10:55:54 +0000 @@ -261,8 +261,8 @@ static struct my_option my_long_options[ {"backup", 'b', "Make a backup of the table as table_name.OLD.", &backup, &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR_MP, - "Directory where character sets are.", &charsets_dir, - &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + "Directory where character sets are.", (char**) &charsets_dir, + (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', === modified file 'storage/maria/maria_read_log.c' --- a/storage/maria/maria_read_log.c 2010-08-05 15:59:44 +0000 +++ b/storage/maria/maria_read_log.c 2010-08-18 07:52:57 +0000 @@ -33,7 +33,7 @@ static my_bool opt_display_only, opt_app static my_bool opt_check; static const char *opt_tmpdir; static ulong opt_page_buffer_size; -static ulonglong opt_start_from_lsn, opt_end_lsn; +static ulonglong opt_start_from_lsn, opt_end_lsn, opt_start_from_checkpoint; static MY_TMPDIR maria_chk_tmpdir; @@ -56,6 +56,7 @@ int main(int argc, char **argv) fprintf(stderr, "Can't init Maria engine (%d)\n", errno); goto err; } + maria_block_size= 0; /* Use block size from file */ /* we don't want to create a control file, it MUST exist */ if (ma_control_file_open(FALSE, TRUE)) { @@ -68,7 +69,7 @@ int main(int argc, char **argv) goto err; } if (init_pagecache(maria_pagecache, opt_page_buffer_size, 0, 0, - TRANSLOG_PAGE_SIZE, MY_WME) == 0) + maria_block_size, MY_WME) == 0) { fprintf(stderr, "Got error in init_pagecache() (errno: %d)\n", errno); goto err; @@ -93,7 +94,6 @@ int main(int argc, char **argv) if (opt_display_only) printf("You are using --display-only, NOTHING will be written to disk\n"); - /* LSN could be also --start-from-lsn=# */ lsn= translog_first_lsn_in_log(); if (lsn == LSN_ERROR) { @@ -104,8 +104,16 @@ int main(int argc, char **argv) { fprintf(stdout, "The transaction log is empty\n"); } - fprintf(stdout, "The transaction log starts from lsn (%lu,0x%lx)\n", - LSN_IN_PARTS(lsn)); + if (opt_start_from_checkpoint && !opt_start_from_lsn && + last_checkpoint_lsn != LSN_IMPOSSIBLE) + { + lsn= LSN_IMPOSSIBLE; /* LSN set in maria_apply_log() */ + fprintf(stdout, "Starting from checkpoint (%lu,0x%lx)\n", + LSN_IN_PARTS(last_checkpoint_lsn)); + } + else + fprintf(stdout, "The transaction log starts from lsn (%lu,0x%lx)\n", + LSN_IN_PARTS(lsn)); if (opt_start_from_lsn) { @@ -182,7 +190,7 @@ static struct my_option my_long_options[ {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"display-only", 'd', "display brief info read from records' header", - (uchar **) &opt_display_only, (uchar **) &opt_display_only, 0, GET_BOOL, + &opt_display_only, &opt_display_only, 0, GET_BOOL, NO_ARG,0, 0, 0, 0, 0, 0}, {"maria-log-dir-path", 'l', "Path to the directory where to store transactional log", @@ -196,11 +204,17 @@ static struct my_option my_long_options[ { "start-from-lsn", 'o', "Start reading log from this lsn", &opt_start_from_lsn, &opt_start_from_lsn, 0, GET_ULL, REQUIRED_ARG, 0, 0, ~(longlong) 0, 0, 0, 0 }, + {"start-from-checkpoint", 'C', "Start applying from last checkpoint", + &opt_start_from_checkpoint, &opt_start_from_checkpoint, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { "end-lsn", 'e', "Stop applying at this lsn. If end-lsn is used, UNDO:s " "will not be applied", &opt_end_lsn, &opt_end_lsn, 0, GET_ULL, REQUIRED_ARG, 0, 0, ~(longlong) 0, 0, 0, 0 }, {"silent", 's', "Print less information during apply/undo phase", - (uchar **) &opt_silent, (uchar **) &opt_silent, 0, + &opt_silent, &opt_silent, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"verbose", 'v', "Print more information during apply/undo phase", + &maria_recovery_verbose, &maria_recovery_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"tmpdir", 't', "Path for temporary files. Multiple paths can be specified, " "separated by " === modified file 'storage/maria/trnman.c' --- a/storage/maria/trnman.c 2010-07-30 07:45:27 +0000 +++ b/storage/maria/trnman.c 2010-08-07 14:42:30 +0000 @@ -176,7 +176,8 @@ int trnman_init(TrID initial_trid) trnman_active_transactions= 0; trnman_committed_transactions= 0; trnman_allocated_transactions= 0; - dummy_transaction_object.min_read_from= ~(TrID) 0; /* for recovery */ + /* This is needed for recovery and repair */ + dummy_transaction_object.min_read_from= ~(TrID) 0; pool= 0; global_trid_generator= initial_trid; === modified file 'storage/maria/unittest/ma_test_recovery.pl' --- a/storage/maria/unittest/ma_test_recovery.pl 2008-07-09 09:02:27 +0000 +++ b/storage/maria/unittest/ma_test_recovery.pl 2010-08-20 07:29:26 +0000 @@ -300,7 +300,7 @@ sub check_table_is_same $com.= "| grep -v \"file length\" | grep -v \"LSNs:\" | grep -v \"UUID:\" > $tmp/maria_chk_message.txt 2>&1"; $res= `$com`; print MY_LOG $res; - $res= `$maria_exe_path/maria_chk$suffix -s -e --read-only $table`; + $res= `$maria_exe_path/maria_chk$suffix -ss -e --read-only $table`; print MY_LOG $res; $checksum2= `$maria_exe_path/maria_chk$suffix -dss $table`; if ("$checksum" ne "$checksum2") @@ -415,7 +415,7 @@ sub physical_cmp # save original tables to restore them later copy("$table.MAD", "$tmp/before_zerofill$table_no.MAD") || die(); copy("$table.MAI", "$tmp/before_zerofill$table_no.MAI") || die(); - $com= "$maria_exe_path/maria_chk$suffix -s --zerofill-keep-lsn $table"; + $com= "$maria_exe_path/maria_chk$suffix -ss --zerofill-keep-lsn $table"; $res= `$com`; print MY_LOG $res; $table_no= $table_no + 1; === modified file 'storage/myisam/mi_dynrec.c' --- a/storage/myisam/mi_dynrec.c 2010-06-15 22:00:51 +0000 +++ b/storage/myisam/mi_dynrec.c 2010-08-27 14:12:44 +0000 @@ -66,9 +66,12 @@ static int _mi_cmp_buffer(File file, con my_bool mi_dynmap_file(MI_INFO *info, my_off_t size) { DBUG_ENTER("mi_dynmap_file"); - if (size > (my_off_t) (~((size_t) 0))) + if (size == 0 || size > (my_off_t) (~((size_t) 0))) { - DBUG_PRINT("warning", ("File is too large for mmap")); + if (size) + DBUG_PRINT("warning", ("File is too large for mmap")); + else + DBUG_PRINT("warning", ("Do not mmap zero-length")); DBUG_RETURN(1); } /* === modified file 'storage/myisam/mi_locking.c' --- a/storage/myisam/mi_locking.c 2010-04-28 12:52:24 +0000 +++ b/storage/myisam/mi_locking.c 2010-08-27 14:12:44 +0000 @@ -29,7 +29,6 @@ int mi_lock_database(MI_INFO *info, int int error; uint count; MYISAM_SHARE *share=info->s; - uint flag; DBUG_ENTER("mi_lock_database"); DBUG_PRINT("enter",("lock_type: %d old lock %d r_locks: %u w_locks: %u " "global_changed: %d open_count: %u name: '%s'", @@ -48,7 +47,7 @@ int mi_lock_database(MI_INFO *info, int DBUG_RETURN(0); } - flag=error=0; + error= 0; pthread_mutex_lock(&share->intern_lock); if (share->kfile >= 0) /* May only be false on windows */ { @@ -126,14 +125,12 @@ int mi_lock_database(MI_INFO *info, int { if (share->r_locks) { /* Only read locks left */ - flag=1; if (my_lock(share->kfile,F_RDLCK,0L,F_TO_EOF, MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error) error=my_errno; } else if (!share->w_locks) { /* No more locks */ - flag=1; if (my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF, MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error) error=my_errno; @@ -154,7 +151,6 @@ int mi_lock_database(MI_INFO *info, int */ if (share->w_locks == 1) { - flag=1; if (my_lock(share->kfile,lock_type,0L,F_TO_EOF, MYF(MY_SEEK_NOT_DONE))) { @@ -169,7 +165,6 @@ int mi_lock_database(MI_INFO *info, int } if (!share->r_locks && !share->w_locks) { - flag=1; if (my_lock(share->kfile,lock_type,0L,F_TO_EOF, info->lock_wait | MY_SEEK_NOT_DONE)) { @@ -194,7 +189,6 @@ int mi_lock_database(MI_INFO *info, int { /* Change READONLY to RW */ if (share->r_locks == 1) { - flag=1; if (my_lock(share->kfile,lock_type,0L,F_TO_EOF, MYF(info->lock_wait | MY_SEEK_NOT_DONE))) { @@ -211,7 +205,6 @@ int mi_lock_database(MI_INFO *info, int { if (!share->w_locks) { - flag=1; if (my_lock(share->kfile,lock_type,0L,F_TO_EOF, info->lock_wait | MY_SEEK_NOT_DONE)) { @@ -258,11 +251,6 @@ int mi_lock_database(MI_INFO *info, int } #endif pthread_mutex_unlock(&share->intern_lock); -#if defined(FULL_LOG) || defined(_lint) - lock_type|=(int) (flag << 8); /* Set bit to set if real lock */ - myisam_log_command(MI_LOG_LOCK,info,(uchar*) &lock_type,sizeof(lock_type), - error); -#endif DBUG_RETURN(error); } /* mi_lock_database */ === modified file 'storage/myisam/mi_open.c' --- a/storage/myisam/mi_open.c 2010-04-28 12:52:24 +0000 +++ b/storage/myisam/mi_open.c 2010-08-27 14:12:44 +0000 @@ -139,8 +139,7 @@ MI_INFO *mi_open(const char *name, int m my_errno= HA_ERR_NOT_A_TABLE; goto err; } - if (memcmp((uchar*) share->state.header.file_version, - (uchar*) myisam_file_magic, 4)) + if (bcmp(share->state.header.file_version, myisam_file_magic, 4)) { DBUG_PRINT("error",("Wrong header in %s",name_buff)); DBUG_DUMP("error_dump", share->state.header.file_version, === modified file 'storage/myisam/mi_page.c' --- a/storage/myisam/mi_page.c 2010-04-28 12:52:24 +0000 +++ b/storage/myisam/mi_page.c 2010-08-27 14:12:44 +0000 @@ -49,7 +49,7 @@ uchar *_mi_fetch_keypage(register MI_INF { DBUG_PRINT("error",("page %lu had wrong page length: %u", (ulong) page, page_size)); - DBUG_DUMP("page",tmp, keyinfo->block_length); + DBUG_DUMP("page", tmp, keyinfo->block_length); info->last_keypage = HA_OFFSET_ERROR; mi_print_error(info->s, HA_ERR_CRASHED); my_errno = HA_ERR_CRASHED; === modified file 'storage/myisam/mi_search.c' --- a/storage/myisam/mi_search.c 2009-12-03 11:19:05 +0000 +++ b/storage/myisam/mi_search.c 2010-08-27 14:12:44 +0000 @@ -819,7 +819,7 @@ uint _mi_get_pack_key(register MI_KEYDEF DBUG_PRINT("error", ("Found too long null packed key: %u of %u at 0x%lx", length, keyseg->length, (long) *page_pos)); - DBUG_DUMP("key",*page_pos,16); + DBUG_DUMP("key", *page_pos, 16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; return 0; @@ -876,7 +876,7 @@ uint _mi_get_pack_key(register MI_KEYDEF { DBUG_PRINT("error",("Found too long packed key: %u of %u at 0x%lx", length, keyseg->length, (long) *page_pos)); - DBUG_DUMP("key",*page_pos,16); + DBUG_DUMP("key", *page_pos, 16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; return 0; /* Error */ @@ -948,7 +948,7 @@ uint _mi_get_binary_pack_key(register MI DBUG_PRINT("error", ("Found too long binary packed key: %u of %u at 0x%lx", length, keyinfo->maxlength, (long) *page_pos)); - DBUG_DUMP("key",*page_pos,16); + DBUG_DUMP("key", *page_pos, 16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; DBUG_RETURN(0); /* Wrong key */ === modified file 'storage/myisam/mi_test2.c' --- a/storage/myisam/mi_test2.c 2008-04-28 16:24:05 +0000 +++ b/storage/myisam/mi_test2.c 2010-08-27 14:12:44 +0000 @@ -409,7 +409,7 @@ int main(int argc, char *argv[]) } ant=0; while (mi_rprev(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys) { printf("prev: Found: %d records of %d\n",ant,dupp_keys); @@ -447,7 +447,7 @@ int main(int argc, char *argv[]) goto end; } if (mi_rlast(file,read_record2,0) || - bcmp(read_record2,read_record3,reclength)) + memcmp(read_record2,read_record3,reclength)) { printf("Can't find last record\n"); DBUG_DUMP("record2",(uchar*) read_record2,reclength); @@ -462,7 +462,7 @@ int main(int argc, char *argv[]) printf("prev: I found: %d records of %d\n",ant,write_count); goto end; } - if (bcmp(read_record,read_record3,reclength)) + if (memcmp(read_record,read_record3,reclength)) { printf("Can't find first record\n"); goto end; @@ -477,7 +477,7 @@ int main(int argc, char *argv[]) mi_rprev(file,read_record3,0) == 0 || mi_rnext(file,read_record3,0)) goto err; - if (bcmp(read_record,read_record3,reclength) != 0) + if (memcmp(read_record,read_record3,reclength) != 0) printf("Can't find first record\n"); if (!silent) @@ -489,7 +489,7 @@ int main(int argc, char *argv[]) mi_rnext(file,read_record3,0) == 0 || mi_rprev(file,read_record3,0)) goto err; - if (bcmp(read_record2,read_record3,reclength)) + if (memcmp(read_record2,read_record3,reclength)) printf("Can't find last record\n"); #ifdef NOT_ANYMORE if (!silent) @@ -503,7 +503,7 @@ int main(int argc, char *argv[]) bzero((char*) file->lastkey,file->s->base.max_key_length*2); if (mi_rkey(file,read_record,0,key2,(uint) i,HA_READ_PREFIX)) goto err; - if (bcmp(read_record+start,key,(uint) i)) + if (memcmp(read_record+start,key,(uint) i)) { puts("Didn't find right record"); goto end; @@ -522,7 +522,7 @@ int main(int argc, char *argv[]) opt_delete++; ant=1; while (mi_rnext(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-1) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-1); @@ -540,7 +540,7 @@ int main(int argc, char *argv[]) opt_delete++; ant=1; while (mi_rprev(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-2) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-2); @@ -560,7 +560,7 @@ int main(int argc, char *argv[]) if (mi_rnext(file,read_record,0)) goto err; /* Skall finnas poster */ while (mi_rnext(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-3) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-3); @@ -575,7 +575,7 @@ int main(int argc, char *argv[]) opt_delete++; ant=0; while (mi_rprev(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-4) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-4); @@ -598,7 +598,7 @@ int main(int argc, char *argv[]) for (i=min(2,keys) ; i-- > 0 ;) { if (mi_rsame(file,read_record2,(int) i)) goto err; - if (bcmp(read_record,read_record2,reclength) != 0) + if (memcmp(read_record,read_record2,reclength) != 0) { printf("mi_rsame didn't find same record\n"); goto end; === modified file 'storage/myisam/mi_unique.c' --- a/storage/myisam/mi_unique.c 2008-04-28 16:24:05 +0000 +++ b/storage/myisam/mi_unique.c 2010-08-27 14:12:44 +0000 @@ -56,7 +56,7 @@ my_bool mi_check_unique(MI_INFO *info, M if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey, MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER, info->s->state.key_root[def->key]) || - bcmp((char*) info->lastkey, (char*) key_buff, MI_UNIQUE_HASH_LENGTH)) + memcmp(info->lastkey, key_buff, MI_UNIQUE_HASH_LENGTH)) { info->page_changed=1; /* Can't optimize read next */ info->lastpos=lastpos; === modified file 'storage/myisam/rt_split.c' --- a/storage/myisam/rt_split.c 2010-03-25 11:18:14 +0000 +++ b/storage/myisam/rt_split.c 2010-07-20 18:07:36 +0000 @@ -255,7 +255,6 @@ int rtree_split_page(MI_INFO *info, MI_K SplitStruct *stop; double *coord_buf; double *next_coord; - double *old_coord; int n_dim; uchar *source_cur, *cur1, *cur2; uchar *new_page= info->buff; @@ -293,8 +292,6 @@ int rtree_split_page(MI_INFO *info, MI_K rtree_d_mbr(keyinfo->seg, key, key_length, cur->coords); cur->key = key; - old_coord = next_coord; - if (split_rtree_node(task, max_keys + 1, mi_getint(page) + full_length + 2, full_length, rt_PAGE_MIN_SIZE(keyinfo->block_length), === modified file 'storage/myisammrg/ha_myisammrg.cc' --- a/storage/myisammrg/ha_myisammrg.cc 2010-08-02 09:01:24 +0000 +++ b/storage/myisammrg/ha_myisammrg.cc 2010-08-27 14:12:44 +0000 @@ -295,8 +295,8 @@ static int myisammrg_parent_open_callbac } } - DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", (int)(child_l->db_length), - child_l->db, (int)(child_l->table_name_length), + DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", (int) child_l->db_length, + child_l->db, (int) child_l->table_name_length, child_l->table_name)); /* Convert to lowercase if required. */ === modified file 'storage/myisammrg/myrg_open.c' --- a/storage/myisammrg/myrg_open.c 2010-04-28 12:52:24 +0000 +++ b/storage/myisammrg/myrg_open.c 2010-08-27 14:12:44 +0000 @@ -227,9 +227,7 @@ MYRG_INFO *myrg_parent_open(const char * int save_errno; int insert_method; uint length; - uint dir_length; uint child_count; - size_t name_buff_length; File fd; IO_CACHE file_cache; char parent_name_buff[FN_REFLEN * 2]; @@ -300,7 +298,6 @@ MYRG_INFO *myrg_parent_open(const char * } /* Call callback for each child. */ - dir_length= dirname_part(parent_name_buff, parent_name, &name_buff_length); my_b_seek(&file_cache, 0); while ((length= my_b_gets(&file_cache, child_name_buff, FN_REFLEN - 1))) { @@ -380,7 +377,6 @@ int myrg_attach_children(MYRG_INFO *m_in { ulonglong file_offset; MI_INFO *myisam; - int rc; int errpos; int save_errno; uint idx; @@ -399,7 +395,6 @@ int myrg_attach_children(MYRG_INFO *m_in here and in ha_myisammrg::store_lock() forces consistent data. */ pthread_mutex_lock(&m_info->mutex); - rc= 1; errpos= 0; file_offset= 0; min_keys= 0; === modified file 'storage/ndb/src/common/portlib/NdbMutex.c' --- a/storage/ndb/src/common/portlib/NdbMutex.c 2006-12-23 19:20:40 +0000 +++ b/storage/ndb/src/common/portlib/NdbMutex.c 2010-07-14 13:10:12 +0000 @@ -24,36 +24,31 @@ NdbMutex* NdbMutex_Create(void) { NdbMutex* pNdbMutex; int result; - DBUG_ENTER("NdbMutex_Create"); - + pNdbMutex = (NdbMutex*)NdbMem_Allocate(sizeof(NdbMutex)); - DBUG_PRINT("info",("NdbMem_Allocate 0x%lx", (long) pNdbMutex)); - + if (pNdbMutex == NULL) - DBUG_RETURN(NULL); - + return NULL; + result = pthread_mutex_init(pNdbMutex, NULL); assert(result == 0); - - DBUG_RETURN(pNdbMutex); + + return pNdbMutex; } int NdbMutex_Destroy(NdbMutex* p_mutex) { int result; - DBUG_ENTER("NdbMutex_Destroy"); if (p_mutex == NULL) - DBUG_RETURN(-1); + return -1; result = pthread_mutex_destroy(p_mutex); - DBUG_PRINT("info",("NdbMem_Free 0x%lx", (long) p_mutex)); NdbMem_Free(p_mutex); - - DBUG_RETURN(result); + return result; } === modified file 'storage/ndb/src/ndbapi/DictCache.cpp' --- a/storage/ndb/src/ndbapi/DictCache.cpp 2009-05-15 12:57:51 +0000 +++ b/storage/ndb/src/ndbapi/DictCache.cpp 2010-07-14 13:10:12 +0000 @@ -20,8 +20,10 @@ #include <NdbCondition.h> #include <NdbSleep.h> -static NdbTableImpl f_invalid_table; -static NdbTableImpl f_altered_table; +static NdbTableImpl * f_invalid_table = 0; +static NdbTableImpl * f_altered_table = 0; + +static int ndb_dict_cache_count = 0; Ndb_local_table_info * Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz) @@ -93,11 +95,29 @@ GlobalDictCache::GlobalDictCache(){ DBUG_ENTER("GlobalDictCache::GlobalDictCache"); m_tableHash.createHashTable(); m_waitForTableCondition = NdbCondition_Create(); + if (f_invalid_table == NULL) + f_invalid_table = new NdbTableImpl(); + if (f_altered_table == NULL) + f_altered_table = new NdbTableImpl(); + ndb_dict_cache_count++; DBUG_VOID_RETURN; } GlobalDictCache::~GlobalDictCache(){ DBUG_ENTER("GlobalDictCache::~GlobalDictCache"); + if (--ndb_dict_cache_count == 0) + { + if (f_invalid_table) + { + delete f_invalid_table; + f_invalid_table = 0; + } + if (f_altered_table) + { + delete f_altered_table; + f_altered_table = 0; + } + } NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0); while(curr != 0){ Vector<TableVersion> * vers = curr->theData; @@ -254,7 +274,7 @@ GlobalDictCache::put(const char * name, TableVersion & ver = vers->back(); if(ver.m_status != RETREIVING || !(ver.m_impl == 0 || - ver.m_impl == &f_invalid_table || ver.m_impl == &f_altered_table) || + ver.m_impl == f_invalid_table || ver.m_impl == f_altered_table) || ver.m_version != 0 || ver.m_refCount == 0){ abort(); @@ -271,7 +291,7 @@ GlobalDictCache::put(const char * name, ver.m_version = tab->m_version; ver.m_status = OK; } - else if (ver.m_impl == &f_invalid_table) + else if (ver.m_impl == f_invalid_table) { DBUG_PRINT("info", ("Table DROPPED invalid")); ver.m_impl = tab; @@ -279,7 +299,7 @@ GlobalDictCache::put(const char * name, ver.m_status = DROPPED; ver.m_impl->m_status = NdbDictionary::Object::Invalid; } - else if(ver.m_impl == &f_altered_table) + else if(ver.m_impl == f_altered_table) { DBUG_PRINT("info", ("Table DROPPED altered")); ver.m_impl = tab; @@ -440,7 +460,7 @@ GlobalDictCache::alter_table_rep(const c if(i == sz - 1 && ver.m_status == RETREIVING) { - ver.m_impl = altered ? &f_altered_table : &f_invalid_table; + ver.m_impl = altered ? f_altered_table : f_invalid_table; DBUG_VOID_RETURN; } } === modified file 'storage/xtradb/buf/buf0lru.c' --- a/storage/xtradb/buf/buf0lru.c 2010-08-04 08:39:53 +0000 +++ b/storage/xtradb/buf/buf0lru.c 2010-08-11 10:55:54 +0000 @@ -2131,7 +2131,7 @@ ibool buf_LRU_file_dump(void) /*===================*/ { - os_file_t dump_file = -1; + os_file_t dump_file = (os_file_t) -1; ibool success; byte* buffer_base = NULL; byte* buffer = NULL; @@ -2221,7 +2221,7 @@ buf_LRU_file_dump(void) ret = TRUE; end: - if (dump_file != -1) + if (dump_file != (os_file_t) -1) os_file_close(dump_file); if (buffer_base) ut_free(buffer_base); @@ -2235,7 +2235,7 @@ ibool buf_LRU_file_restore(void) /*======================*/ { - os_file_t dump_file = -1; + os_file_t dump_file = (os_file_t) -1; ibool success; byte* buffer_base = NULL; byte* buffer = NULL; @@ -2326,7 +2326,7 @@ buf_LRU_file_restore(void) " (requested: %lu, read: %lu)\n", req, reads); ret = TRUE; end: - if (dump_file != -1) + if (dump_file != (os_file_t) -1) os_file_close(dump_file); if (buffer_base) ut_free(buffer_base); === modified file 'storage/xtradb/fil/fil0fil.c' --- a/storage/xtradb/fil/fil0fil.c 2010-08-04 08:39:53 +0000 +++ b/storage/xtradb/fil/fil0fil.c 2010-08-11 10:55:54 +0000 @@ -3044,7 +3044,7 @@ fil_open_single_table_tablespace( dulint new_id[31]; ulint root_page[31]; ulint n_index; - os_file_t info_file = -1; + os_file_t info_file = (os_file_t) -1; char* info_file_path; ulint i; int len; @@ -3130,7 +3130,7 @@ fil_open_single_table_tablespace( } skip_info: - if (info_file != -1) + if (info_file != (os_file_t) -1) os_file_close(info_file); /* === modified file 'storage/xtradb/handler/i_s.cc' --- a/storage/xtradb/handler/i_s.cc 2010-08-04 08:39:53 +0000 +++ b/storage/xtradb/handler/i_s.cc 2010-08-11 10:55:54 +0000 @@ -2821,7 +2821,7 @@ i_s_innodb_table_stats_fill( field_store_string(i_s_table->field[0], buf); field_store_string(i_s_table->field[1], ptr); - i_s_table->field[2]->store(table->stat_n_rows); + i_s_table->field[2]->store(table->stat_n_rows, 1); i_s_table->field[3]->store(table->stat_clustered_index_size); i_s_table->field[4]->store(table->stat_sum_of_other_index_sizes); i_s_table->field[5]->store(table->stat_modified_counter); === modified file 'storage/xtradb/include/univ.i' --- a/storage/xtradb/include/univ.i 2010-08-04 08:39:53 +0000 +++ b/storage/xtradb/include/univ.i 2010-08-07 16:08:59 +0000 @@ -168,7 +168,7 @@ command. Not tested on Windows. */ #define UNIV_COMPILE_TEST_FUNCS */ -#ifdef HAVE_valgrind +#if defined(HAVE_valgrind)&& defined(HAVE_VALGRIND_MEMCHECK_H) # define UNIV_DEBUG_VALGRIND #endif /* HAVE_valgrind */ #if 0 === modified file 'storage/xtradb/srv/srv0srv.c' --- a/storage/xtradb/srv/srv0srv.c 2010-08-04 08:39:53 +0000 +++ b/storage/xtradb/srv/srv0srv.c 2010-08-11 10:55:54 +0000 @@ -2897,7 +2897,7 @@ loop: if (bpl) { retry_flush_batch: n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, - bpl, + (ulint) bpl, oldest_lsn + (lsn - lsn_old)); if (n_pages_flushed == ULINT_UNDEFINED) { os_thread_sleep(5000); === modified file 'strings/CMakeLists.txt' --- a/strings/CMakeLists.txt 2010-06-25 13:09:45 +0000 +++ b/strings/CMakeLists.txt 2010-08-27 14:12:44 +0000 @@ -18,7 +18,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) -SET(STRINGS_SOURCES bchange.c bcmp.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c +SET(STRINGS_SOURCES bchange.c bfill.c bmove512.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c ctype-czech.c ctype-euc_kr.c ctype-eucjpms.c ctype-extra.c ctype-gb2312.c ctype-gbk.c ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c int2str.c === modified file 'strings/Makefile.am' --- a/strings/Makefile.am 2010-03-04 08:03:07 +0000 +++ b/strings/Makefile.am 2010-08-27 14:12:44 +0000 @@ -79,7 +79,3 @@ test_decimal$(EXEEXT): decimal.c $(pkgli $(CP) $(srcdir)/decimal.c ./test_decimal.c $(LINK) $(FLAGS) -DMAIN ./test_decimal.c $(LDADD) $(pkglib_LIBRARIES) $(RM) -f ./test_decimal.c - -# Don't update the files from bitkeeper -%::SCCS/s.% - === added file 'strings/bcmp.c' --- a/strings/bcmp.c 1970-01-01 00:00:00 +0000 +++ b/strings/bcmp.c 2010-08-27 14:12:44 +0000 @@ -0,0 +1,66 @@ +/* Copyright (C) 2000 MySQL AB + + 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 Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + bcmp(s1, s2, len) returns 0 if the "len" bytes starting at "s1" are + identical to the "len" bytes starting at "s2", non-zero if they are + different. + Now only used with purify because purify gives wrong warnings when + comparing a shorter string with bcmp. +*/ + +#include <my_global.h> +#include "m_string.h" + +#ifdef HAVE_valgrind +#undef bcmp +#undef HAVE_BCMP +#endif + +#if !defined(bcmp) && !defined(HAVE_BCMP) + +#if defined(MC68000) && defined(DS90) + +int bcmp(s1,s2, len) +const char *s1; +const char *s2; +uint len; /* 0 <= len <= 65535 */ +{ + asm(" movl 12(a7),d0 "); + asm(" subqw #1,d0 "); + asm(" blt .L5 "); + asm(" movl 4(a7),a1 "); + asm(" movl 8(a7),a0 "); + asm(".L4: cmpmb (a0)+,(a1)+ "); + asm(" dbne d0,.L4 "); + asm(".L5: addqw #1,d0 "); +} + +#else + +#ifndef HAVE_valgrind +size_t bcmp(register const uchar *s1,register const uchar *s2, + register size_t len) +#else +size_t my_bcmp(register const uchar *s1,register const uchar *s2, + register size_t len) +#endif +{ + while (len-- != 0 && *s1++ == *s2++) ; + return len+1; +} + +#endif +#endif /* BSD_FUNCS */ === removed file 'strings/bcmp.c' --- a/strings/bcmp.c 2009-05-06 12:03:24 +0000 +++ b/strings/bcmp.c 1970-01-01 00:00:00 +0000 @@ -1,66 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - 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 Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* - bcmp(s1, s2, len) returns 0 if the "len" bytes starting at "s1" are - identical to the "len" bytes starting at "s2", non-zero if they are - different. - Now only used with purify because purify gives wrong warnings when - comparing a shorter string with bcmp. -*/ - -#include <my_global.h> -#include "m_string.h" - -#ifdef HAVE_valgrind -#undef bcmp -#undef HAVE_BCMP -#endif - -#if !defined(bcmp) && !defined(HAVE_BCMP) - -#if defined(MC68000) && defined(DS90) - -int bcmp(s1,s2, len) -const char *s1; -const char *s2; -uint len; /* 0 <= len <= 65535 */ -{ - asm(" movl 12(a7),d0 "); - asm(" subqw #1,d0 "); - asm(" blt .L5 "); - asm(" movl 4(a7),a1 "); - asm(" movl 8(a7),a0 "); - asm(".L4: cmpmb (a0)+,(a1)+ "); - asm(" dbne d0,.L4 "); - asm(".L5: addqw #1,d0 "); -} - -#else - -#ifndef HAVE_valgrind -size_t bcmp(register const uchar *s1,register const uchar *s2, - register size_t len) -#else -size_t my_bcmp(register const uchar *s1,register const uchar *s2, - register size_t len) -#endif -{ - while (len-- != 0 && *s1++ == *s2++) ; - return len+1; -} - -#endif -#endif /* BSD_FUNCS */ === added file 'strings/bzero.c' --- a/strings/bzero.c 1970-01-01 00:00:00 +0000 +++ b/strings/bzero.c 2010-08-27 14:12:44 +0000 @@ -0,0 +1,82 @@ +/* Copyright (C) 2000 MySQL AB + + 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 Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* File : bzero.c + Author : Richard A. O'Keefe. + Michael Widenius; ifdef MC68000 + Updated: 23 April 1984 + Defines: bzero() + + bzero(dst, len) moves "len" 0 bytes to "dst". + Thus to clear a disc buffer to 0s do bzero(buffer, BUFSIZ). + + Note: the "b" routines are there to exploit certain VAX order codes, + The asm code is presented for your interest and amusement. +*/ + +#ifndef BSD_FUNCS +#include "strings.h" + +#ifdef bzero +#undef bzero /* remove macro */ +#endif + +#if VaxAsm + +static void _bzero64 _A((void *dst,int len)); + +void bzero(dst, len) +void *dst; +uint len; +{ + while ((int) len >= 64*K) + { + _bzero64(dst, 64*K-1); + dst += 64*K-1; + len -= 64*K-1; + } + _bzero64(dst, len); +} + +_bzero64(dst, len) +void *dst; +int len; +{ + asm("movc5 $0,*4(ap),$0,8(ap),*4(ap)"); +} + +#else + +#if defined(MC68000) && defined(DS90) + +void bzero(dst, len) +void *dst; +uint len; +{ + bfill(dst,len,0); /* This is very optimized ! */ +} /* bzero */ + +#else + +void bzero(dst, len) +register void *dst; +register uint len; +{ + while (len-- != 0) *dst++ = 0; +} /* bzero */ + +#endif +#endif +#endif /* BSD_FUNCS */ === removed file 'strings/bzero.c' --- a/strings/bzero.c 2006-12-23 19:17:15 +0000 +++ b/strings/bzero.c 1970-01-01 00:00:00 +0000 @@ -1,82 +0,0 @@ -/* Copyright (C) 2000 MySQL AB - - 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 Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* File : bzero.c - Author : Richard A. O'Keefe. - Michael Widenius; ifdef MC68000 - Updated: 23 April 1984 - Defines: bzero() - - bzero(dst, len) moves "len" 0 bytes to "dst". - Thus to clear a disc buffer to 0s do bzero(buffer, BUFSIZ). - - Note: the "b" routines are there to exploit certain VAX order codes, - The asm code is presented for your interest and amusement. -*/ - -#ifndef BSD_FUNCS -#include "strings.h" - -#ifdef bzero -#undef bzero /* remove macro */ -#endif - -#if VaxAsm - -static void _bzero64 _A((char *dst,int len)); - -void bzero(dst, len) -char *dst; -uint len; -{ - while ((int) len >= 64*K) - { - _bzero64(dst, 64*K-1); - dst += 64*K-1; - len -= 64*K-1; - } - _bzero64(dst, len); -} - -_bzero64(dst, len) -char *dst; -int len; -{ - asm("movc5 $0,*4(ap),$0,8(ap),*4(ap)"); -} - -#else - -#if defined(MC68000) && defined(DS90) - -void bzero(dst, len) -char *dst; -uint len; -{ - bfill(dst,len,0); /* This is very optimized ! */ -} /* bzero */ - -#else - -void bzero(dst, len) -register char *dst; -register uint len; -{ - while (len-- != 0) *dst++ = 0; -} /* bzero */ - -#endif -#endif -#endif /* BSD_FUNCS */ === modified file 'strings/ctype-big5.c' --- a/strings/ctype-big5.c 2008-04-23 06:06:26 +0000 +++ b/strings/ctype-big5.c 2010-07-26 05:06:18 +0000 @@ -377,86 +377,6 @@ static int my_strxfrm_big5(uchar *dest, #endif -/* -** Calculate min_str and max_str that ranges a LIKE string. -** Arguments: -** ptr Pointer to LIKE string. -** ptr_length Length of LIKE string. -** escape Escape character in LIKE. (Normally '\'). -** All escape characters should be removed from min_str and max_str -** res_length Length of min_str and max_str. -** min_str Smallest case sensitive string that ranges LIKE. -** Should be space padded to res_length. -** max_str Largest case sensitive string that ranges LIKE. -** Normally padded with the biggest character sort value. -** -** The function should return 0 if ok and 1 if the LIKE string can't be -** optimized ! -*/ - -#define max_sort_char ((char) 255) - -static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,size_t ptr_length, - pbool escape, pbool w_one, pbool w_many, - size_t res_length, - char *min_str, char *max_str, - size_t *min_length, size_t *max_length) -{ - const char *end= ptr + ptr_length; - char *min_org=min_str; - char *min_end=min_str+res_length; - size_t charlen= res_length / cs->mbmaxlen; - - for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--) - { - if (ptr+1 != end && isbig5code(ptr[0],ptr[1])) - { - *min_str++= *max_str++ = *ptr++; - *min_str++= *max_str++ = *ptr; - continue; - } - if (*ptr == escape && ptr+1 != end) - { - ptr++; /* Skip escape */ - if (isbig5code(ptr[0], ptr[1])) - *min_str++= *max_str++ = *ptr++; - if (min_str < min_end) - *min_str++= *max_str++= *ptr; - continue; - } - if (*ptr == w_one) /* '_' in SQL */ - { - *min_str++='\0'; /* This should be min char */ - *max_str++=max_sort_char; - continue; - } - if (*ptr == w_many) /* '%' in SQL */ - { - /* - Calculate length of keys: - 'a\0\0... is the smallest possible string when we have space expand - a\ff\ff... is the biggest possible string - */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : - res_length); - *max_length= res_length; - do { - *min_str++ = 0; - *max_str++ = max_sort_char; - } while (min_str != min_end); - return 0; - } - *min_str++= *max_str++ = *ptr; - } - - *min_length= *max_length= (size_t) (min_str-min_org); - while (min_str != min_end) - *min_str++= *max_str++= ' '; - return 0; -} - - static uint ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { @@ -6338,7 +6258,7 @@ static MY_COLLATION_HANDLER my_collation my_strnncollsp_big5, my_strnxfrm_big5, my_strnxfrmlen_simple, - my_like_range_big5, + my_like_range_mb, my_wildcmp_mb, my_strcasecmp_mb, my_instr_mb, @@ -6402,7 +6322,7 @@ CHARSET_INFO my_charset_big5_chinese_ci= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xF9D5, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_big5_handler, @@ -6435,7 +6355,7 @@ CHARSET_INFO my_charset_big5_bin= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xF9FE, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_big5_handler, === modified file 'strings/ctype-cp932.c' --- a/strings/ctype-cp932.c 2009-05-05 06:55:22 +0000 +++ b/strings/ctype-cp932.c 2010-07-26 05:06:18 +0000 @@ -306,76 +306,6 @@ static size_t my_strnxfrm_cp932(CHARSET_ } -/* -** Calculate min_str and max_str that ranges a LIKE string. -** Arguments: -** ptr Pointer to LIKE string. -** ptr_length Length of LIKE string. -** escape Escape character in LIKE. (Normally '\'). -** All escape characters should be removed from min_str and max_str -** res_length Length of min_str and max_str. -** min_str Smallest case sensitive string that ranges LIKE. -** Should be space padded to res_length. -** max_str Largest case sensitive string that ranges LIKE. -** Normally padded with the biggest character sort value. -** -** The function should return 0 if ok and 1 if the LIKE string can't be -** optimized ! -*/ - -#define max_sort_char ((char) 255) - -static my_bool my_like_range_cp932(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,size_t ptr_length, - pbool escape, pbool w_one, pbool w_many, - size_t res_length, - char *min_str,char *max_str, - size_t *min_length, size_t *max_length) -{ - const char *end=ptr+ptr_length; - char *min_org=min_str; - char *min_end=min_str+res_length; - - while (ptr < end && min_str < min_end) { - if (ismbchar_cp932(cs, ptr, end)) { - *min_str++ = *max_str++ = *ptr++; - if (min_str < min_end) - *min_str++ = *max_str++ = *ptr++; - continue; - } - if (*ptr == escape && ptr+1 < end) { - ptr++; /* Skip escape */ - if (ismbchar_cp932(cs, ptr, end)) - *min_str++ = *max_str++ = *ptr++; - if (min_str < min_end) - *min_str++ = *max_str++ = *ptr++; - continue; - } - if (*ptr == w_one) { /* '_' in SQL */ - *min_str++ = '\0'; /* This should be min char */ - *max_str++ = max_sort_char; - ptr++; - continue; - } - if (*ptr == w_many) - { /* '%' in SQL */ - *min_length = (size_t)(min_str - min_org); - *max_length = res_length; - do - { - *min_str++= 0; - *max_str++= max_sort_char; - } while (min_str < min_end); - return 0; - } - *min_str++ = *max_str++ = *ptr++; - } - *min_length = *max_length = (size_t) (min_str - min_org); - while (min_str < min_end) - *min_str++ = *max_str++ = ' '; /* Because if key compression */ - return 0; -} - /* page 0 0x00A1-0x00DF */ static uint16 tab_cp932_uni0[]={ 0xFF61,0xFF62,0xFF63,0xFF64,0xFF65,0xFF66,0xFF67,0xFF68, @@ -5467,7 +5397,7 @@ static MY_COLLATION_HANDLER my_collation my_strnncollsp_cp932, my_strnxfrm_cp932, my_strnxfrmlen_simple, - my_like_range_cp932, + my_like_range_mb, my_wildcmp_mb, /* wildcmp */ my_strcasecmp_8bit, my_instr_mb, @@ -5533,7 +5463,7 @@ CHARSET_INFO my_charset_cp932_japanese_c 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFCFC, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -5565,7 +5495,7 @@ CHARSET_INFO my_charset_cp932_bin= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFCFC, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, === modified file 'strings/ctype-euc_kr.c' --- a/strings/ctype-euc_kr.c 2009-07-24 06:27:23 +0000 +++ b/strings/ctype-euc_kr.c 2010-07-26 05:06:18 +0000 @@ -8762,7 +8762,7 @@ CHARSET_INFO my_charset_euckr_korean_ci= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -8795,7 +8795,7 @@ CHARSET_INFO my_charset_euckr_bin= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, === modified file 'strings/ctype-eucjpms.c' --- a/strings/ctype-eucjpms.c 2008-02-20 18:49:26 +0000 +++ b/strings/ctype-eucjpms.c 2010-07-26 05:06:18 +0000 @@ -8710,7 +8710,7 @@ CHARSET_INFO my_charset_eucjpms_japanese 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad_char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -8743,7 +8743,7 @@ CHARSET_INFO my_charset_eucjpms_bin= 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad_char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, === modified file 'strings/ctype-gb2312.c' --- a/strings/ctype-gb2312.c 2008-02-20 18:49:26 +0000 +++ b/strings/ctype-gb2312.c 2010-07-26 05:06:18 +0000 @@ -5790,7 +5790,7 @@ CHARSET_INFO my_charset_gb2312_chinese_c 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xF7FE, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -5822,7 +5822,7 @@ CHARSET_INFO my_charset_gb2312_bin= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xF7FE, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, === modified file 'strings/ctype-gbk.c' --- a/strings/ctype-gbk.c 2008-04-23 06:06:26 +0000 +++ b/strings/ctype-gbk.c 2010-07-26 05:06:18 +0000 @@ -2690,86 +2690,6 @@ static size_t my_strnxfrm_gbk(CHARSET_IN } -/* -** Calculate min_str and max_str that ranges a LIKE string. -** Arguments: -** ptr Pointer to LIKE string. -** ptr_length Length of LIKE string. -** escape Escape character in LIKE. (Normally '\'). -** All escape characters should be removed from min_str and max_str -** res_length Length of min_str and max_str. -** min_str Smallest case sensitive string that ranges LIKE. -** Should be space padded to res_length. -** max_str Largest case sensitive string that ranges LIKE. -** Normally padded with the biggest character sort value. -** -** The function should return 0 if ok and 1 if the LIKE string can't be -** optimized ! -*/ - -#define max_sort_char ((uchar) 255) - -static my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,size_t ptr_length, - pbool escape, pbool w_one, pbool w_many, - size_t res_length, - char *min_str,char *max_str, - size_t *min_length,size_t *max_length) -{ - const char *end= ptr + ptr_length; - char *min_org=min_str; - char *min_end=min_str+res_length; - size_t charlen= res_length / cs->mbmaxlen; - - for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--) - { - if (ptr+1 != end && isgbkcode(ptr[0],ptr[1])) - { - *min_str++= *max_str++ = *ptr++; - *min_str++= *max_str++ = *ptr; - continue; - } - if (*ptr == escape && ptr+1 != end) - { - ptr++; /* Skip escape */ - if (isgbkcode(ptr[0], ptr[1])) - *min_str++= *max_str++ = *ptr; - if (min_str < min_end) - *min_str++= *max_str++= *ptr; - continue; - } - if (*ptr == w_one) /* '_' in SQL */ - { - *min_str++='\0'; /* This should be min char */ - *max_str++=max_sort_char; - continue; - } - if (*ptr == w_many) /* '%' in SQL */ - { - /* - Calculate length of keys: - 'a\0\0... is the smallest possible string when we have space expand - a\ff\ff... is the biggest possible string - */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : - res_length); - *max_length= res_length; - do { - *min_str++= 0; - *max_str++= max_sort_char; - } while (min_str != min_end); - return 0; - } - *min_str++= *max_str++ = *ptr; - } - - *min_length= *max_length = (size_t) (min_str - min_org); - while (min_str != min_end) - *min_str++= *max_str++= ' '; /* Because if key compression */ - return 0; -} - - static uint ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)), const char* p, const char *e) { @@ -9983,7 +9903,7 @@ static MY_COLLATION_HANDLER my_collation my_strnncollsp_gbk, my_strnxfrm_gbk, my_strnxfrmlen_simple, - my_like_range_gbk, + my_like_range_mb, my_wildcmp_mb, my_strcasecmp_mb, my_instr_mb, @@ -10048,7 +9968,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xA967, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -10080,7 +10000,7 @@ CHARSET_INFO my_charset_gbk_bin= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, === modified file 'strings/ctype-mb.c' --- a/strings/ctype-mb.c 2009-11-30 12:42:24 +0000 +++ b/strings/ctype-mb.c 2010-08-27 14:12:44 +0000 @@ -498,7 +498,9 @@ static void my_hash_sort_mb_bin(CHARSET_ DESCRIPTION Write max key: - for non-Unicode character sets: - just set to 255. + just bfill using max_sort_char if max_sort_char is one byte. + In case when max_sort_char is two bytes, fill with double-byte pairs + and optionally pad with a single space character. - for Unicode character set (utf-8): create a buffer with multibyte representation of the max_sort_char character, and copy it into max_str in a loop. @@ -510,12 +512,20 @@ static void pad_max_char(CHARSET_INFO *c if (!(cs->state & MY_CS_UNICODE)) { - bfill(str, end - str, 255); - return; + if (cs->max_sort_char <= 255) + { + bfill(str, end - str, cs->max_sort_char); + return; + } + buf[0]= cs->max_sort_char >> 8; + buf[1]= cs->max_sort_char & 0xFF; + buflen= 2; + } + else + { + buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf, + (uchar*) buf + sizeof(buf)); } - - buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf, - (uchar*) buf + sizeof(buf)); DBUG_ASSERT(buflen > 0); do === modified file 'strings/ctype-sjis.c' --- a/strings/ctype-sjis.c 2009-09-07 20:50:10 +0000 +++ b/strings/ctype-sjis.c 2010-08-27 14:12:44 +0000 @@ -304,85 +304,6 @@ static size_t my_strnxfrm_sjis(CHARSET_I } -/* -** Calculate min_str and max_str that ranges a LIKE string. -** Arguments: -** ptr Pointer to LIKE string. -** ptr_length Length of LIKE string. -** escape Escape character in LIKE. (Normally '\'). -** All escape characters should be removed from min_str and max_str -** res_length Length of min_str and max_str. -** min_str Smallest case sensitive string that ranges LIKE. -** Should be space padded to res_length. -** max_str Largest case sensitive string that ranges LIKE. -** Normally padded with the biggest character sort value. -** -** The function should return 0 if ok and 1 if the LIKE string can't be -** optimized ! -*/ - -#define max_sort_char ((char) 255) - -static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)), - const char *ptr,size_t ptr_length, - pbool escape, pbool w_one, pbool w_many, - size_t res_length, - char *min_str,char *max_str, - size_t *min_length,size_t *max_length) -{ - const char *end= ptr + ptr_length; - char *min_org=min_str; - char *min_end=min_str+res_length; - size_t charlen= res_length / cs->mbmaxlen; - - for ( ; ptr < end && min_str < min_end && charlen > 0 ; charlen--) - { - if (ismbchar_sjis(cs, ptr, end)) { - *min_str++ = *max_str++ = *ptr++; - if (min_str < min_end) - *min_str++ = *max_str++ = *ptr++; - continue; - } - if (*ptr == escape && ptr+1 < end) { - ptr++; /* Skip escape */ - if (ismbchar_sjis(cs, ptr, end)) - *min_str++ = *max_str++ = *ptr++; - if (min_str < min_end) - *min_str++ = *max_str++ = *ptr++; - continue; - } - if (*ptr == w_one) { /* '_' in SQL */ - *min_str++ = '\0'; /* This should be min char */ - *max_str++ = max_sort_char; - ptr++; - continue; - } - if (*ptr == w_many) - { /* '%' in SQL */ - /* - Calculate length of keys: - 'a\0\0... is the smallest possible string when we have space expand - a\ff\ff... is the biggest possible string - */ - *min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) : - res_length); - *max_length= res_length; - do - { - *min_str++= 0; - *max_str++= max_sort_char; - } while (min_str < min_end); - return 0; - } - *min_str++ = *max_str++ = *ptr++; - } - - *min_length= *max_length= (size_t) (min_str - min_org); - while (min_str != min_end) - *min_str++= *max_str++= ' '; /* Because if key compression */ - return 0; -} - /* page 0 0x00A1-0x00DF */ static uint16 tab_sjis_uni0[]={ 0xFF61,0xFF62,0xFF63,0xFF64,0xFF65,0xFF66,0xFF67,0xFF68, @@ -4628,7 +4549,7 @@ static MY_COLLATION_HANDLER my_collation my_strnncollsp_sjis, my_strnxfrm_sjis, my_strnxfrmlen_simple, - my_like_range_sjis, + my_like_range_mb, my_wildcmp_mb, /* wildcmp */ my_strcasecmp_8bit, my_instr_mb, @@ -4694,7 +4615,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFCFC, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -4726,7 +4647,7 @@ CHARSET_INFO my_charset_sjis_bin= 1, /* mbminlen */ 2, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFCFC, /* max_sort_char */ ' ', /* pad char */ 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, === modified file 'strings/ctype-ujis.c' --- a/strings/ctype-ujis.c 2008-02-20 18:49:26 +0000 +++ b/strings/ctype-ujis.c 2010-07-26 05:06:18 +0000 @@ -8567,7 +8567,7 @@ CHARSET_INFO my_charset_ujis_japanese_ci 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, @@ -8600,7 +8600,7 @@ CHARSET_INFO my_charset_ujis_bin= 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFEFE, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, === modified file 'strings/decimal.c' --- a/strings/decimal.c 2010-08-02 09:01:24 +0000 +++ b/strings/decimal.c 2010-08-27 14:12:44 +0000 @@ -1934,8 +1934,7 @@ static int do_sub(decimal_t *from1, deci int decimal_intg(decimal_t *from) { int res; - dec1 *tmp_res; - tmp_res= remove_leading_zeroes(from, &res); + remove_leading_zeroes(from, &res); return res; } === modified file 'strings/make-ccc' --- a/strings/make-ccc 2000-07-31 19:29:14 +0000 +++ b/strings/make-ccc 2010-07-02 18:30:47 +0000 @@ -1,3 +1,3 @@ -ccc -DHAVE_CONFIG_H -I. -I. -I.. -I./../include -I../include -O -DDBUG_OFF -fast -O3 -fomit-frame-pointer -c atof.c bchange.c bcmp.c bfill.c bmove.c bmove512.c bmove_upp.c ct_init.c ctype-latin1.c int2str.c is_prefix.c llstr.c longlong2str.c r_strinstr.c str2int.c strappend.c strcend.c strcont.c strend.c strfill.c strinstr.c strmake.c strmov.c strnmov.c strstr.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c +ccc -DHAVE_CONFIG_H -I. -I. -I.. -I./../include -I../include -O -DDBUG_OFF -fast -O3 -fomit-frame-pointer -c atof.c bchange.c bfill.c bmove.c bmove512.c bmove_upp.c ct_init.c ctype-latin1.c int2str.c is_prefix.c llstr.c longlong2str.c r_strinstr.c str2int.c strappend.c strcend.c strcont.c strend.c strfill.c strinstr.c strmake.c strmov.c strnmov.c strstr.c strtol.c strtoll.c strtoul.c strtoull.c strxmov.c strxnmov.c rm libmystrings.a ar -cr libmystrings.a atof.o === modified file 'strings/strxmov.c' --- a/strings/strxmov.c 2006-12-23 19:17:15 +0000 +++ b/strings/strxmov.c 2010-08-27 14:12:44 +0000 @@ -32,7 +32,6 @@ #include <my_global.h> #include "m_string.h" -#include <stdarg.h> char *strxmov(char *dst,const char *src, ...) { === modified file 'support-files/Makefile.am' --- a/support-files/Makefile.am 2010-03-04 08:03:07 +0000 +++ b/support-files/Makefile.am 2010-08-27 14:12:44 +0000 @@ -129,6 +129,3 @@ SUFFIXES = .sh -e 's!@''PERL_DATA_DUMPER''@!@PERL_DATA_DUMPER@!' \ $< > $@-t @MV@ $@-t $@ - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'support-files/compiler_warnings.supp' --- a/support-files/compiler_warnings.supp 2010-08-06 06:36:09 +0000 +++ b/support-files/compiler_warnings.supp 2010-08-20 13:16:47 +0000 @@ -44,6 +44,7 @@ buf/buf0buf\.c: .*block_mutex.* might be btr/btr0cur\.c: null argument where non-null required: 1800-3000 btr/btr0btr\.c: null argument where non-null required: 2500-3000 ibuf/ibuf0ibuf.c: null argument where non-null required: 700-1000 +fsp/fsp0fsp\.c: result of 32-bit shift implicitly converted to 64 bits # # bdb is not critical to keep up to date @@ -108,6 +109,7 @@ signal\.c : .*unused parameter.* .* : conversion from '.*size_t' to 'UINT'.* .* : conversion from '.*size_t' to 'uInt'.* .* : conversion from '.*size_t' to 'uint16'.* +.* : The following environment variables were not found.* # # The following should be fixed by the ndb team @@ -125,6 +127,8 @@ storage/maria/ma_pagecache.c: .*'info_ch # Pbxt # xaction_xt\.cc: may be used uninitialized in this function +lock_xt\.cc : uninitialized local variable .* used +restart_xt\.cc : dereferencing pointer .* does break strict-aliasing # # I think these are due to mix of C and C++. === modified file 'tests/Makefile.am' --- a/tests/Makefile.am 2009-07-08 14:49:45 +0000 +++ b/tests/Makefile.am 2010-08-27 14:12:44 +0000 @@ -60,6 +60,3 @@ DEFS = -DMYSQL_CLIENT_NO_THREADS thread_test.o: thread_test.c $(COMPILE) -c $(INCLUDES) $< - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'tests/mysql_client_test.c' --- a/tests/mysql_client_test.c 2010-08-02 16:39:45 +0000 +++ b/tests/mysql_client_test.c 2010-08-27 14:12:44 +0000 @@ -3325,7 +3325,7 @@ static void test_long_data_str() DIE_UNLESS(rc == 1); mysql_free_result(result); - my_sprintf(data, (data, "%d", i*5)); + sprintf(data, "%d", i*5); verify_col_data("test_long_data_str", "LENGTH(longstr)", data); data[0]= '\0'; while (i--) @@ -3423,10 +3423,10 @@ static void test_long_data_str1() DIE_UNLESS(rc == 1); mysql_free_result(result); - my_sprintf(data, (data, "%ld", (long)i*length)); + sprintf(data, "%ld", (long)i*length); verify_col_data("test_long_data_str", "length(longstr)", data); - my_sprintf(data, (data, "%d", i*2)); + sprintf(data, "%d", i*2); verify_col_data("test_long_data_str", "length(blb)", data); /* Test length of field->max_length */ @@ -13286,37 +13286,52 @@ static void test_bug15518() } -static void disable_general_log() +static void disable_query_logs() { int rc; rc= mysql_query(mysql, "set @@global.general_log=off"); myquery(rc); + rc= mysql_query(mysql, "set @@global.slow_query_log=off"); + myquery(rc); } -static void enable_general_log(int truncate) +static void enable_query_logs(int truncate) { int rc; rc= mysql_query(mysql, "set @save_global_general_log=@@global.general_log"); myquery(rc); + rc= mysql_query(mysql, "set @save_global_slow_query_log=@@global.slow_query_log"); + myquery(rc); + rc= mysql_query(mysql, "set @@global.general_log=on"); myquery(rc); + rc= mysql_query(mysql, "set @@global.slow_query_log=on"); + myquery(rc); + + if (truncate) { rc= mysql_query(mysql, "truncate mysql.general_log"); myquery(rc); + + rc= mysql_query(mysql, "truncate mysql.slow_log"); + myquery(rc); } } -static void restore_general_log() +static void restore_query_logs() { int rc; rc= mysql_query(mysql, "set @@global.general_log=@save_global_general_log"); myquery(rc); + + rc= mysql_query(mysql, "set @@global.slow_query_log=@save_global_slow_query_log"); + myquery(rc); } @@ -15487,7 +15502,7 @@ static void test_bug17667() return; } - enable_general_log(1); + enable_query_logs(1); for (statement_cursor= statements; statement_cursor->buffer != NULL; statement_cursor++) @@ -15567,7 +15582,7 @@ static void test_bug17667() statement_cursor->buffer); } - restore_general_log(); + restore_query_logs(); if (!opt_silent) printf("success. All queries found intact in the log.\n"); @@ -17431,7 +17446,7 @@ static void test_bug28386() } mysql_free_result(result); - enable_general_log(1); + enable_query_logs(1); stmt= mysql_simple_prepare(mysql, "SELECT ?"); check_stmt(stmt); @@ -17470,7 +17485,7 @@ static void test_bug28386() mysql_free_result(result); - restore_general_log(); + restore_query_logs(); DBUG_VOID_RETURN; } @@ -18139,7 +18154,7 @@ static void test_bug53371() static void test_bug53907() { int rc; - char buf[] = "\x4test\x14../client_test_db/t1"; + uchar buf[] = "\x4test\x14../client_test_db/t1"; myheader("test_bug53907"); @@ -18159,7 +18174,7 @@ static void test_bug53907() rc= mysql_change_user(mysql, "testbug", NULL, "bug53907"); myquery(rc); - rc= simple_command(mysql, COM_TABLE_DUMP, (uchar*) buf, sizeof(buf), 0); + rc= simple_command(mysql, COM_TABLE_DUMP, buf, sizeof(buf), 0); fprintf(stderr, ">>>>>>>>> %d\n", mysql_errno(mysql)); DIE_UNLESS(mysql_errno(mysql) == 1103); /* ER_WRONG_TABLE_NAME */ @@ -18258,7 +18273,7 @@ static void test_bug42373() Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run */ -static void test_bug54041() +static void test_bug54041_impl() { int rc; MYSQL_STMT *stmt; @@ -18273,7 +18288,7 @@ static void test_bug54041() rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)"); myquery(rc); - stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 (a) VALUES (?)"); + stmt= mysql_simple_prepare(mysql, "SELECT a FROM t1 WHERE a > ?"); check_stmt(stmt); verify_param_count(stmt, 1); @@ -18311,6 +18326,20 @@ static void test_bug54041() } +/** + Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run +*/ + +static void test_bug54041() +{ + enable_query_logs(0); + test_bug54041_impl(); + disable_query_logs(); + test_bug54041_impl(); + restore_query_logs(); +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -18320,14 +18349,14 @@ static char **defaults_argv; static struct my_option client_test_long_options[] = { - {"basedir", 'b', "Basedir for tests.", &opt_basedir, - &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"basedir", 'b', "Basedir for tests.", (char**) &opt_basedir, + (char**) &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"count", 't', "Number of times test to be executed", &opt_count, &opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0}, {"database", 'D', "Database to use", &opt_db, &opt_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"debug", '#', "Output debug log", &default_dbug_option, - &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"debug", '#', "Output debug log", (char**) &default_dbug_option, + (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host", &opt_host, &opt_host, @@ -18363,8 +18392,8 @@ static struct my_option client_test_long {"user", 'u', "User for login if not current user", &opt_user, &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"vardir", 'v', "Data dir for tests.", &opt_vardir, - &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"vardir", 'v', "Data dir for tests.", (char**) &opt_vardir, + (char**) &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"getopt-ll-test", 'g', "Option for testing bug in getopt library", &opt_getopt_ll_test, &opt_getopt_ll_test, 0, GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0}, @@ -18391,7 +18420,7 @@ and you are welcome to modify and redist static struct my_tests_st my_tests[]= { - { "disable_general_log", disable_general_log }, + { "disable_query_logs", disable_query_logs }, { "test_view_sp_list_fields", test_view_sp_list_fields }, { "client_query", client_query }, { "test_prepare_insert_update", test_prepare_insert_update}, === modified file 'unittest/Makefile.am' --- a/unittest/Makefile.am 2008-02-01 15:21:44 +0000 +++ b/unittest/Makefile.am 2010-08-27 14:12:44 +0000 @@ -13,18 +13,15 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -SUBDIRS = mytap mysys examples +SUBDIRS = mytap . mysys examples strings EXTRA_DIST = unit.pl CLEANFILES = unit -unittests = mytap mysys @mysql_se_unittest_dirs@ @mysql_pg_unittest_dirs@ ../dbug +unittests = mytap mysys strings @mysql_se_unittest_dirs@ @mysql_pg_unittest_dirs@ ../dbug test: perl unit.pl run $(unittests) test-verbose: HARNESS_VERBOSE=1 perl unit.pl run $(unittests) - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'unittest/mysys/Makefile.am' --- a/unittest/mysys/Makefile.am 2009-12-03 11:19:05 +0000 +++ b/unittest/mysys/Makefile.am 2010-08-27 14:12:44 +0000 @@ -26,12 +26,5 @@ LDADD = $(top_builddir)/unittest/mytap EXTRA_DIST = CMakeLists.txt noinst_PROGRAMS = bitmap-t base64-t my_atomic-t lf-t waiting_threads-t -if NEED_THREAD -# my_atomic-t is used to check thread functions, so it is safe to -# ignore the file in non-threaded builds. -# In fact, it will not compile without thread support. -noinst_PROGRAMS += my_atomic-t -endif - # Don't update the files from bitkeeper %::SCCS/s.% === added file 'unittest/mysys/my_atomic-t.c' --- a/unittest/mysys/my_atomic-t.c 1970-01-01 00:00:00 +0000 +++ b/unittest/mysys/my_atomic-t.c 2010-08-27 14:12:44 +0000 @@ -0,0 +1,146 @@ +/* Copyright (C) 2006-2008 MySQL AB, 2008 Sun Microsystems, Inc. + + 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 Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "thr_template.c" + +/* at least gcc 3.4.5 and 3.4.6 (but not 3.2.3) on RHEL */ +#if __GNUC__ == 3 && __GNUC_MINOR__ == 4 +#define GCC_BUG_WORKAROUND volatile +#else +#define GCC_BUG_WORKAROUND +#endif + +volatile uint32 b32; +volatile int32 c32; +my_atomic_rwlock_t rwl; + +/* add and sub a random number in a loop. Must get 0 at the end */ +pthread_handler_t test_atomic_add(void *arg) +{ + int m= (*(int *)arg)/2; + GCC_BUG_WORKAROUND int32 x; + for (x= ((int)(intptr)(&m)); m ; m--) + { + x= (x*m+0x87654321) & INT_MAX32; + my_atomic_rwlock_wrlock(&rwl); + my_atomic_add32(&bad, x); + my_atomic_rwlock_wrunlock(&rwl); + + my_atomic_rwlock_wrlock(&rwl); + my_atomic_add32(&bad, -x); + my_atomic_rwlock_wrunlock(&rwl); + } + pthread_mutex_lock(&mutex); + if (!--running_threads) pthread_cond_signal(&cond); + pthread_mutex_unlock(&mutex); + return 0; +} + +/* + 1. generate thread number 0..N-1 from b32 + 2. add it to bad + 3. swap thread numbers in c32 + 4. (optionally) one more swap to avoid 0 as a result + 5. subtract result from bad + must get 0 in bad at the end +*/ +pthread_handler_t test_atomic_fas(void *arg) +{ + int m= *(int *)arg; + int32 x; + + my_atomic_rwlock_wrlock(&rwl); + x= my_atomic_add32(&b32, 1); + my_atomic_rwlock_wrunlock(&rwl); + + my_atomic_rwlock_wrlock(&rwl); + my_atomic_add32(&bad, x); + my_atomic_rwlock_wrunlock(&rwl); + + for (; m ; m--) + { + my_atomic_rwlock_wrlock(&rwl); + x= my_atomic_fas32(&c32, x); + my_atomic_rwlock_wrunlock(&rwl); + } + + if (!x) + { + my_atomic_rwlock_wrlock(&rwl); + x= my_atomic_fas32(&c32, x); + my_atomic_rwlock_wrunlock(&rwl); + } + + my_atomic_rwlock_wrlock(&rwl); + my_atomic_add32(&bad, -x); + my_atomic_rwlock_wrunlock(&rwl); + + pthread_mutex_lock(&mutex); + if (!--running_threads) pthread_cond_signal(&cond); + pthread_mutex_unlock(&mutex); + return 0; +} + +/* + same as test_atomic_add, but my_atomic_add32 is emulated with + my_atomic_cas32 - notice that the slowdown is proportional to the + number of CPUs +*/ +pthread_handler_t test_atomic_cas(void *arg) +{ + int m= (*(int *)arg)/2, ok= 0; + GCC_BUG_WORKAROUND int32 x, y; + for (x= ((int)(intptr)(&m)); m ; m--) + { + my_atomic_rwlock_wrlock(&rwl); + y= my_atomic_load32(&bad); + my_atomic_rwlock_wrunlock(&rwl); + x= (x*m+0x87654321) & INT_MAX32; + do { + my_atomic_rwlock_wrlock(&rwl); + ok= my_atomic_cas32(&bad, &y, (uint32)y+x); + my_atomic_rwlock_wrunlock(&rwl); + } while (!ok) ; + do { + my_atomic_rwlock_wrlock(&rwl); + ok= my_atomic_cas32(&bad, &y, y-x); + my_atomic_rwlock_wrunlock(&rwl); + } while (!ok) ; + } + pthread_mutex_lock(&mutex); + if (!--running_threads) pthread_cond_signal(&cond); + pthread_mutex_unlock(&mutex); + return 0; +} + +void do_tests() +{ + plan(4); + + bad= my_atomic_initialize(); + ok(!bad, "my_atomic_initialize() returned %d", bad); + + my_atomic_rwlock_init(&rwl); + + b32= c32= 0; + test_concurrently("my_atomic_add32", test_atomic_add, THREADS, CYCLES); + b32= c32= 0; + test_concurrently("my_atomic_fas32", test_atomic_fas, THREADS, CYCLES); + b32= c32= 0; + test_concurrently("my_atomic_cas32", test_atomic_cas, THREADS, CYCLES); + + my_atomic_rwlock_destroy(&rwl); +} + === removed file 'unittest/mysys/my_atomic-t.c' --- a/unittest/mysys/my_atomic-t.c 2009-01-15 21:27:36 +0000 +++ b/unittest/mysys/my_atomic-t.c 1970-01-01 00:00:00 +0000 @@ -1,146 +0,0 @@ -/* Copyright (C) 2006-2008 MySQL AB, 2008 Sun Microsystems, Inc. - - 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 Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include "thr_template.c" - -/* at least gcc 3.4.5 and 3.4.6 (but not 3.2.3) on RHEL */ -#if __GNUC__ == 3 && __GNUC_MINOR__ == 4 -#define GCC_BUG_WORKAROUND volatile -#else -#define GCC_BUG_WORKAROUND -#endif - -volatile uint32 b32; -volatile int32 c32; -my_atomic_rwlock_t rwl; - -/* add and sub a random number in a loop. Must get 0 at the end */ -pthread_handler_t test_atomic_add(void *arg) -{ - int m= (*(int *)arg)/2; - GCC_BUG_WORKAROUND int32 x; - for (x= ((int)(intptr)(&m)); m ; m--) - { - x= (x*m+0x87654321) & INT_MAX32; - my_atomic_rwlock_wrlock(&rwl); - my_atomic_add32(&bad, x); - my_atomic_rwlock_wrunlock(&rwl); - - my_atomic_rwlock_wrlock(&rwl); - my_atomic_add32(&bad, -x); - my_atomic_rwlock_wrunlock(&rwl); - } - pthread_mutex_lock(&mutex); - if (!--running_threads) pthread_cond_signal(&cond); - pthread_mutex_unlock(&mutex); - return 0; -} - -/* - 1. generate thread number 0..N-1 from b32 - 2. add it to bad - 3. swap thread numbers in c32 - 4. (optionally) one more swap to avoid 0 as a result - 5. subtract result from bad - must get 0 in bad at the end -*/ -pthread_handler_t test_atomic_fas(void *arg) -{ - int m= *(int *)arg; - int32 x; - - my_atomic_rwlock_wrlock(&rwl); - x= my_atomic_add32(&b32, 1); - my_atomic_rwlock_wrunlock(&rwl); - - my_atomic_rwlock_wrlock(&rwl); - my_atomic_add32(&bad, x); - my_atomic_rwlock_wrunlock(&rwl); - - for (; m ; m--) - { - my_atomic_rwlock_wrlock(&rwl); - x= my_atomic_fas32(&c32, x); - my_atomic_rwlock_wrunlock(&rwl); - } - - if (!x) - { - my_atomic_rwlock_wrlock(&rwl); - x= my_atomic_fas32(&c32, x); - my_atomic_rwlock_wrunlock(&rwl); - } - - my_atomic_rwlock_wrlock(&rwl); - my_atomic_add32(&bad, -x); - my_atomic_rwlock_wrunlock(&rwl); - - pthread_mutex_lock(&mutex); - if (!--running_threads) pthread_cond_signal(&cond); - pthread_mutex_unlock(&mutex); - return 0; -} - -/* - same as test_atomic_add, but my_atomic_add32 is emulated with - my_atomic_cas32 - notice that the slowdown is proportional to the - number of CPUs -*/ -pthread_handler_t test_atomic_cas(void *arg) -{ - int m= (*(int *)arg)/2, ok= 0; - GCC_BUG_WORKAROUND int32 x, y; - for (x= ((int)(intptr)(&m)); m ; m--) - { - my_atomic_rwlock_wrlock(&rwl); - y= my_atomic_load32(&bad); - my_atomic_rwlock_wrunlock(&rwl); - x= (x*m+0x87654321) & INT_MAX32; - do { - my_atomic_rwlock_wrlock(&rwl); - ok= my_atomic_cas32(&bad, &y, (uint32)y+x); - my_atomic_rwlock_wrunlock(&rwl); - } while (!ok) ; - do { - my_atomic_rwlock_wrlock(&rwl); - ok= my_atomic_cas32(&bad, &y, y-x); - my_atomic_rwlock_wrunlock(&rwl); - } while (!ok) ; - } - pthread_mutex_lock(&mutex); - if (!--running_threads) pthread_cond_signal(&cond); - pthread_mutex_unlock(&mutex); - return 0; -} - -void do_tests() -{ - plan(4); - - bad= my_atomic_initialize(); - ok(!bad, "my_atomic_initialize() returned %d", bad); - - my_atomic_rwlock_init(&rwl); - - b32= c32= 0; - test_concurrently("my_atomic_add32", test_atomic_add, THREADS, CYCLES); - b32= c32= 0; - test_concurrently("my_atomic_fas32", test_atomic_fas, THREADS, CYCLES); - b32= c32= 0; - test_concurrently("my_atomic_cas32", test_atomic_cas, THREADS, CYCLES); - - my_atomic_rwlock_destroy(&rwl); -} - === modified file 'unittest/mytap/tap.h' --- a/unittest/mytap/tap.h 2010-08-02 09:01:24 +0000 +++ b/unittest/mytap/tap.h 2010-08-11 10:55:54 +0000 @@ -106,7 +106,7 @@ extern int skip_big_tests; @param count The planned number of tests to run. */ -void plan(int const count); +void plan(int count); /** @@ -125,7 +125,7 @@ void plan(int const count); which case nothing is printed. */ -void ok(int const pass, char const *fmt, ...) +void ok(int pass, char const *fmt, ...) __attribute__((format(printf,2,3))); === added directory 'unittest/strings' === added file 'unittest/strings/Makefile.am' --- a/unittest/strings/Makefile.am 1970-01-01 00:00:00 +0000 +++ b/unittest/strings/Makefile.am 2010-07-26 05:06:18 +0000 @@ -0,0 +1,27 @@ +# Copyright 2000, 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +AM_CPPFLAGS = @ZLIB_INCLUDES@ -I$(top_builddir)/include +AM_CPPFLAGS += -I$(top_srcdir)/include -I$(top_srcdir)/unittest/mytap + +LDADD = $(top_builddir)/unittest/mytap/libmytap.a \ + $(top_builddir)/mysys/libmysys.a \ + $(top_builddir)/dbug/libdbug.a \ + $(top_builddir)/strings/libmystrings.a + +noinst_PROGRAMS = strings-t + +# Don't update the files from bitkeeper +%::SCCS/s.% === added file 'unittest/strings/strings-t.c' --- a/unittest/strings/strings-t.c 1970-01-01 00:00:00 +0000 +++ b/unittest/strings/strings-t.c 2010-07-29 06:12:44 +0000 @@ -0,0 +1,114 @@ +/* Copyright 2000, 2010, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include <tap.h> +#include <my_global.h> +#include <my_sys.h> + + +/* + Test that like_range() returns well-formed results. +*/ +static int +test_like_range_for_charset(CHARSET_INFO *cs, const char *src, size_t src_len) +{ + char min_str[32], max_str[32]; + size_t min_len, max_len, min_well_formed_len, max_well_formed_len; + int error= 0; + + cs->coll->like_range(cs, src, src_len, '\\', '_', '%', + sizeof(min_str), min_str, max_str, &min_len, &max_len); + diag("min_len=%d\tmax_len=%d\t%s", (int) min_len, (int) max_len, cs->name); + min_well_formed_len= cs->cset->well_formed_len(cs, + min_str, min_str + min_len, + 10000, &error); + max_well_formed_len= cs->cset->well_formed_len(cs, + max_str, max_str + max_len, + 10000, &error); + if (min_len != min_well_formed_len) + diag("Bad min_str: min_well_formed_len=%d min_str[%d]=0x%02X", + (int) min_well_formed_len, (int) min_well_formed_len, + (uchar) min_str[min_well_formed_len]); + if (max_len != max_well_formed_len) + diag("Bad max_str: max_well_formed_len=%d max_str[%d]=0x%02X", + (int) max_well_formed_len, (int) max_well_formed_len, + (uchar) max_str[max_well_formed_len]); + return + min_len == min_well_formed_len && + max_len == max_well_formed_len ? 0 : 1; +} + + +static CHARSET_INFO *charset_list[]= +{ +#ifdef HAVE_CHARSET_big5 + &my_charset_big5_chinese_ci, + &my_charset_big5_bin, +#endif +#ifdef HAVE_CHARSET_euckr + &my_charset_euckr_korean_ci, + &my_charset_euckr_bin, +#endif +#ifdef HAVE_CHARSET_gb2312 + &my_charset_gb2312_chinese_ci, + &my_charset_gb2312_bin, +#endif +#ifdef HAVE_CHARSET_gbk + &my_charset_gbk_chinese_ci, + &my_charset_gbk_bin, +#endif +#ifdef HAVE_CHARSET_latin1 + &my_charset_latin1, + &my_charset_latin1_bin, +#endif +#ifdef HAVE_CHARSET_sjis + &my_charset_sjis_japanese_ci, + &my_charset_sjis_bin, +#endif +#ifdef HAVE_CHARSET_tis620 + &my_charset_tis620_thai_ci, + &my_charset_tis620_bin, +#endif +#ifdef HAVE_CHARSET_ujis + &my_charset_ujis_japanese_ci, + &my_charset_ujis_bin, +#endif +#ifdef HAVE_CHARSET_utf8 + &my_charset_utf8_general_ci, + &my_charset_utf8_unicode_ci, + &my_charset_utf8_bin, +#endif +}; + + +int main() +{ + size_t i, failed= 0; + + plan(1); + diag("Testing my_like_range_xxx() functions"); + + for (i= 0; i < array_elements(charset_list); i++) + { + CHARSET_INFO *cs= charset_list[i]; + if (test_like_range_for_charset(cs, "abc%", 4)) + { + ++failed; + diag("Failed for %s", cs->name); + } + } + ok(failed == 0, "Testing my_like_range_xxx() functions"); + return exit_status(); +} === modified file 'vio/Makefile.am' --- a/vio/Makefile.am 2006-12-31 00:32:21 +0000 +++ b/vio/Makefile.am 2010-08-27 14:12:44 +0000 @@ -23,6 +23,3 @@ noinst_HEADERS = vio_priv.h libvio_a_SOURCES = vio.c viosocket.c viossl.c viosslfactories.c EXTRA_DIST= CMakeLists.txt - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'win/Makefile.am' --- a/win/Makefile.am 2009-10-11 10:21:49 +0000 +++ b/win/Makefile.am 2010-08-27 14:12:44 +0000 @@ -18,6 +18,3 @@ EXTRA_DIST = build-vs71.bat build-vs8.ba build-vs9_x64.bat configure.js README mysql_manifest.cmake \ create_manifest.js create_def_file.js build-nmake.bat \ build-nmake-x64.bat configure-mariadb.sh make_mariadb_win_dist - -# Don't update the files from bitkeeper -%::SCCS/s.% === modified file 'zlib/Makefile.am' --- a/zlib/Makefile.am 2007-04-10 23:48:43 +0000 +++ b/zlib/Makefile.am 2010-08-27 14:12:44 +0000 @@ -33,6 +33,3 @@ libz_la_SOURCES = adler32.c compress. libzlt_la_SOURCES = $(libz_la_SOURCES) EXTRA_DIST= README FAQ INDEX ChangeLog algorithm.txt zlib.3 CMakeLists.txt - -# Don't update the files from bitkeeper -%::SCCS/s.%
participants (1)
-
Michael Widenius