List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:July 15 2011 4:16pm
Subject:bzr push into mysql-5.1-mtr branch (bjorn.munch:3005 to 3006)
View as plain text  
 3006 Bjorn Munch	2011-07-15 [merge]
      merge from 5.1 main

    removed:
      storage/ndb/test/sql/
      storage/ndb/test/sql/BANK.sql
      storage/ndb/test/sql/T1.sql
      storage/ndb/test/sql/test_create_drop.pl
      storage/ndb/test/sql/test_range_bounds.pl
    added:
      include/welcome_copyright_notice.h
      mysql-test/r/secure_file_priv_win.result
      mysql-test/suite/rpl/r/rpl_row_corruption.result
      mysql-test/suite/rpl/t/rpl_row_corruption-slave.opt
      mysql-test/suite/rpl/t/rpl_row_corruption.test
      mysql-test/t/secure_file_priv_win-master.opt
      mysql-test/t/secure_file_priv_win.test
    modified:
      client/mysqlbinlog.cc
      include/Makefile.am
      mysql-test/r/explain.result
      mysql-test/r/sp-security.result
      mysql-test/r/subselect.result
      mysql-test/suite/innodb_plugin/r/innodb-index.result
      mysql-test/suite/innodb_plugin/t/innodb-index.test
      mysql-test/t/explain.test
      mysql-test/t/sp-security.test
      mysql-test/t/subselect.test
      mysys/my_symlink.c
      sql/item.cc
      sql/item_subselect.cc
      sql/item_sum.cc
      sql/log_event.cc
      sql/mysql_priv.h
      sql/mysqld.cc
      sql/sp_head.cc
      sql/sql_connect.cc
      sql/sql_lex.cc
      sql/sql_lex.h
      sql/sql_load.cc
      sql/sql_partition.cc
      sql/sql_select.cc
      storage/innodb_plugin/ChangeLog
      storage/innodb_plugin/row/row0row.c
      support-files/mysql.spec.sh
 3005 Bjorn Munch	2011-07-04 [merge]
      merge from 5.1 main

    modified:
      BUILD/FINISH.sh
      BUILD/SETUP.sh
      BUILD/check-cpu
      BUILD/compile-dist
      BUILD/compile-pentium-icc-valgrind-max
      BUILD/compile-pentium-mysqlfs-debug
      BUILD/compile-pentium-valgrind-max
      BUILD/compile-pentium64-valgrind-max
      BUILD/compile-solaris-amd64-forte
      BUILD/compile-solaris-amd64-forte-debug
      BUILD/compile-solaris-sparc
      BUILD/compile-solaris-sparc-forte
      CMakeLists.txt
      client/CMakeLists.txt
      client/Makefile.am
      client/client_priv.h
      client/my_readline.h
      client/mysql.cc
      client/mysql_upgrade.c
      client/mysqladmin.cc
      client/mysqlbinlog.cc
      client/mysqlcheck.c
      client/mysqldump.c
      client/mysqlimport.c
      client/mysqlshow.c
      client/mysqlslap.c
      client/mysqltest.cc
      client/readline.cc
      client/sql_string.cc
      client/sql_string.h
      extra/comp_err.c
      extra/innochecksum.c
      extra/my_print_defaults.c
      extra/mysql_waitpid.c
      extra/perror.c
      extra/replace.c
      extra/resolve_stack_dump.c
      extra/resolveip.c
      extra/yassl/include/cert_wrapper.hpp
      extra/yassl/include/openssl/prefix_ssl.h
      extra/yassl/include/openssl/ssl.h
      extra/yassl/include/yassl_error.hpp
      extra/yassl/include/yassl_imp.hpp
      extra/yassl/include/yassl_int.hpp
      extra/yassl/include/yassl_types.hpp
      extra/yassl/src/buffer.cpp
      extra/yassl/src/cert_wrapper.cpp
      extra/yassl/src/crypto_wrapper.cpp
      extra/yassl/src/handshake.cpp
      extra/yassl/src/ssl.cpp
      extra/yassl/src/yassl_error.cpp
      extra/yassl/src/yassl_imp.cpp
      extra/yassl/src/yassl_int.cpp
      extra/yassl/taocrypt/include/asn.hpp
      extra/yassl/taocrypt/include/block.hpp
      extra/yassl/taocrypt/include/blowfish.hpp
      extra/yassl/taocrypt/include/modes.hpp
      extra/yassl/taocrypt/include/runtime.hpp
      extra/yassl/taocrypt/src/aes.cpp
      extra/yassl/taocrypt/src/algebra.cpp
      extra/yassl/taocrypt/src/asn.cpp
      extra/yassl/taocrypt/src/blowfish.cpp
      extra/yassl/taocrypt/src/coding.cpp
      extra/yassl/taocrypt/src/integer.cpp
      extra/yassl/taocrypt/src/misc.cpp
      extra/yassl/taocrypt/src/random.cpp
      extra/yassl/taocrypt/src/twofish.cpp
      extra/yassl/testsuite/test.hpp
      include/Makefile.am
      include/config-netware.h
      include/config-win.h
      include/hash.h
      include/heap.h
      include/keycache.h
      include/m_ctype.h
      include/m_string.h
      include/my_alarm.h
      include/my_base.h
      include/my_bit.h
      include/my_bitmap.h
      include/my_dbug.h
      include/my_getopt.h
      include/my_global.h
      include/my_no_pthread.h
      include/my_stacktrace.h
      include/my_time.h
      include/myisam.h
      include/myisammrg.h
      include/mysql.h
      include/mysql/plugin.h
      include/mysql_embed.h
      include/mysys_err.h
      include/sslopt-longopts.h
      include/thr_lock.h
      include/violite.h
      libmysql/CMakeLists.txt
      libmysql/Makefile.am
      libmysql/Makefile.shared
      libmysql/libmysql.c
      libmysql/manager.c
      libmysqld/CMakeLists.txt
      libmysqld/Makefile.am
      libmysqld/emb_qcache.h
      libmysqld/examples/CMakeLists.txt
      libmysqld/examples/Makefile.am
      libmysqld/examples/builder-sample/emb_sample.bpr
      libmysqld/examples/builder-sample/emb_sample.cpp
      libmysqld/examples/builder-sample/emb_samples.cpp
      libmysqld/examples/builder-sample/emb_samples.h
      libmysqld/libmysqld.c
      man/Makefile.am
      mysql-test/Makefile.am
      mysql-test/include/default_my.cnf
      mysql-test/include/default_mysqld.cnf
      mysql-test/include/mtr_check.sql
      mysql-test/include/mtr_warnings.sql
      mysql-test/include/set_binlog_format_mixed.sql
      mysql-test/include/set_binlog_format_row.sql
      mysql-test/include/set_binlog_format_statement.sql
      mysql-test/lib/My/Config.pm
      mysql-test/lib/My/ConfigFactory.pm
      mysql-test/lib/My/CoreDump.pm
      mysql-test/lib/My/File/Path.pm
      mysql-test/lib/My/Find.pm
      mysql-test/lib/My/Handles.pm
      mysql-test/lib/My/Platform.pm
      mysql-test/lib/My/SafeProcess.pm
      mysql-test/lib/My/SafeProcess/Base.pm
      mysql-test/lib/My/SafeProcess/Makefile.am
      mysql-test/lib/My/SafeProcess/safe_kill_win.cc
      mysql-test/lib/My/SafeProcess/safe_process.cc
      mysql-test/lib/My/SafeProcess/safe_process.pl
      mysql-test/lib/My/SafeProcess/safe_process_win.cc
      mysql-test/lib/My/SysInfo.pm
      mysql-test/lib/My/Test.pm
      mysql-test/lib/mtr_gcov.pl
      mysql-test/lib/mtr_gprof.pl
      mysql-test/lib/mtr_io.pl
      mysql-test/lib/mtr_stress.pl
      mysql-test/lib/mtr_unique.pm
      mysql-test/lib/t/Base.t
      mysql-test/lib/t/Find.t
      mysql-test/lib/t/Options.t
      mysql-test/lib/t/Platform.t
      mysql-test/lib/t/SafeProcess.t
      mysql-test/lib/t/SafeProcessStress.pl
      mysql-test/lib/t/copytree.t
      mysql-test/lib/t/dummyd.pl
      mysql-test/lib/t/rmtree.t
      mysql-test/lib/t/testMyConfig.t
      mysql-test/lib/t/testMyConfigFactory.t
      mysql-test/lib/t/test_child.pl
      mysql-test/lib/v1/My/Config.pm
      mysql-test/lib/v1/mtr_cases.pl
      mysql-test/lib/v1/mtr_gcov.pl
      mysql-test/lib/v1/mtr_gprof.pl
      mysql-test/lib/v1/mtr_im.pl
      mysql-test/lib/v1/mtr_io.pl
      mysql-test/lib/v1/mtr_match.pl
      mysql-test/lib/v1/mtr_misc.pl
      mysql-test/lib/v1/mtr_process.pl
      mysql-test/lib/v1/mtr_report.pl
      mysql-test/lib/v1/mtr_stress.pl
      mysql-test/lib/v1/mtr_timer.pl
      mysql-test/lib/v1/mtr_unique.pl
      mysql-test/lib/v1/mysql-test-run.pl
      mysql-test/std_data/latin1.xml
      mysql-test/suite/innodb_plugin/r/innodb-index.result
      mysql-test/suite/innodb_plugin/t/innodb-index.test
      mysql-test/t/parser_stack.test
      mysql-test/valgrind.supp
      mysys/CMakeLists.txt
      mysys/Makefile.am
      mysys/array.c
      mysys/base64.c
      mysys/charset.c
      mysys/default.c
      mysys/errors.c
      mysys/hash.c
      mysys/mf_format.c
      mysys/mf_getdate.c
      mysys/mf_iocache.c
      mysys/mf_iocache2.c
      mysys/mf_keycache.c
      mysys/mf_loadpath.c
      mysys/mf_tempdir.c
      mysys/mf_wfile.c
      mysys/my_alloc.c
      mysys/my_bitmap.c
      mysys/my_compare.c
      mysys/my_copy.c
      mysys/my_error.c
      mysys/my_file.c
      mysys/my_fstream.c
      mysys/my_gethwaddr.c
      mysys/my_getncpus.c
      mysys/my_getopt.c
      mysys/my_getwd.c
      mysys/my_handler_errors.h
      mysys/my_init.c
      mysys/my_largepage.c
      mysys/my_malloc.c
      mysys/my_net.c
      mysys/my_new.cc
      mysys/my_pread.c
      mysys/my_redel.c
      mysys/my_seek.c
      mysys/my_static.c
      mysys/my_symlink.c
      mysys/my_sync.c
      mysys/my_thr_init.c
      mysys/my_wincond.c
      mysys/my_winthread.c
      mysys/my_write.c
      mysys/safemalloc.c
      mysys/stacktrace.c
      mysys/string.c
      mysys/thr_alarm.c
      mysys/thr_lock.c
      mysys/thr_mutex.c
      mysys/typelib.c
      plugin/Makefile.am
      plugin/daemon_example/Makefile.am
      plugin/fulltext/plugin_example.c
      regex/CMakeLists.txt
      scripts/Makefile.am
      scripts/make_win_bin_dist
      scripts/mysql_config.pl.in
      scripts/mysql_config.sh
      scripts/mysql_convert_table_format.sh
      scripts/mysql_find_rows.sh
      scripts/mysql_fix_extensions.sh
      scripts/mysql_install_db.sh
      scripts/mysql_secure_installation.pl.in
      scripts/mysql_secure_installation.sh
      scripts/mysql_setpermission.sh
      scripts/mysql_system_tables.sql
      scripts/mysql_system_tables_data.sql
      scripts/mysql_system_tables_fix.sql
      scripts/mysql_zap.sh
      scripts/mysqlaccess.sh
      scripts/mysqld_multi.sh
      scripts/mysqldumpslow.sh
      scripts/mysqlhotcopy.sh
      server-tools/instance-manager/buffer.cc
      server-tools/instance-manager/commands.cc
      server-tools/instance-manager/instance.cc
      server-tools/instance-manager/instance_map.cc
      server-tools/instance-manager/instance_options.cc
      server-tools/instance-manager/listener.cc
      server-tools/instance-manager/mysql_connection.cc
      server-tools/instance-manager/options.cc
      server-tools/instance-manager/options.h
      server-tools/instance-manager/parse.cc
      server-tools/instance-manager/parse.h
      server-tools/instance-manager/parse_output.cc
      server-tools/instance-manager/protocol.cc
      server-tools/instance-manager/user_map.cc
      sql-bench/as3ap.sh
      sql-bench/bench-count-distinct.sh
      sql-bench/bench-init.pl.sh
      sql-bench/compare-results.sh
      sql-bench/copy-db.sh
      sql-bench/crash-me.sh
      sql-bench/run-all-tests.sh
      sql-bench/server-cfg.sh
      sql-bench/test-ATIS.sh
      sql-bench/test-alter-table.sh
      sql-bench/test-big-tables.sh
      sql-bench/test-connect.sh
      sql-bench/test-create.sh
      sql-bench/test-insert.sh
      sql-bench/test-select.sh
      sql-bench/test-transactions.sh
      sql-bench/test-wisconsin.sh
      sql-common/client.c
      sql-common/my_time.c
      sql-common/my_user.c
      sql/CMakeLists.txt
      sql/Makefile.am
      sql/authors.h
      sql/client_settings.h
      sql/debug_sync.cc
      sql/debug_sync.h
      sql/event_data_objects.cc
      sql/event_db_repository.cc
      sql/event_db_repository.h
      sql/event_parse_data.cc
      sql/event_parse_data.h
      sql/event_scheduler.cc
      sql/events.cc
      sql/field.cc
      sql/field.h
      sql/field_conv.cc
      sql/filesort.cc
      sql/gen_lex_hash.cc
      sql/gstream.cc
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/ha_partition.cc
      sql/ha_partition.h
      sql/handler.h
      sql/item.cc
      sql/item_buff.cc
      sql/item_create.cc
      sql/item_create.h
      sql/item_func.h
      sql/item_geofunc.cc
      sql/item_row.cc
      sql/item_row.h
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/item_subselect.h
      sql/item_sum.cc
      sql/item_sum.h
      sql/item_timefunc.cc
      sql/item_timefunc.h
      sql/item_xmlfunc.cc
      sql/key.cc
      sql/lex.h
      sql/lock.cc
      sql/log.h
      sql/log_event.cc
      sql/log_event.h
      sql/log_event_old.cc
      sql/message.h
      sql/my_decimal.cc
      sql/my_decimal.h
      sql/mysql_priv.h
      sql/mysqld.cc
      sql/opt_range.cc
      sql/opt_range.h
      sql/opt_sum.cc
      sql/parse_file.cc
      sql/parse_file.h
      sql/partition_info.cc
      sql/partition_info.h
      sql/password.c
      sql/protocol.cc
      sql/protocol.h
      sql/records.cc
      sql/repl_failsafe.cc
      sql/rpl_constants.h
      sql/rpl_filter.cc
      sql/rpl_injector.cc
      sql/rpl_mi.cc
      sql/rpl_mi.h
      sql/rpl_record.cc
      sql/rpl_record.h
      sql/rpl_record_old.cc
      sql/rpl_reporting.cc
      sql/rpl_reporting.h
      sql/rpl_rli.cc
      sql/rpl_rli.h
      sql/rpl_tblmap.cc
      sql/rpl_utility.cc
      sql/rpl_utility.h
      sql/set_var.cc
      sql/share/Makefile.am
      sql/share/charsets/cp1251.xml
      sql/slave.cc
      sql/slave.h
      sql/sp.cc
      sql/sp.h
      sql/sp_cache.cc
      sql/sp_head.cc
      sql/sp_head.h
      sql/sp_pcontext.cc
      sql/sp_pcontext.h
      sql/sp_rcontext.cc
      sql/spatial.cc
      sql/spatial.h
      sql/sql_acl.h
      sql/sql_analyse.cc
      sql/sql_binlog.cc
      sql/sql_cache.cc
      sql/sql_cache.h
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_connect.cc
      sql/sql_crypt.cc
      sql/sql_crypt.h
      sql/sql_cursor.cc
      sql/sql_db.cc
      sql/sql_delete.cc
      sql/sql_derived.cc
      sql/sql_error.cc
      sql/sql_handler.cc
      sql/sql_help.cc
      sql/sql_insert.cc
      sql/sql_lex.cc
      sql/sql_lex.h
      sql/sql_list.h
      sql/sql_load.cc
      sql/sql_locale.cc
      sql/sql_manager.cc
      sql/sql_olap.cc
      sql/sql_parse.cc
      sql/sql_partition.h
      sql/sql_plugin.cc
      sql/sql_plugin.h
      sql/sql_profile.cc
      sql/sql_profile.h
      sql/sql_rename.cc
      sql/sql_repl.cc
      sql/sql_select.h
      sql/sql_servers.cc
      sql/sql_show.h
      sql/sql_string.cc
      sql/sql_string.h
      sql/sql_table.cc
      sql/sql_tablespace.cc
      sql/sql_test.cc
      sql/sql_trigger.cc
      sql/sql_trigger.h
      sql/sql_udf.cc
      sql/sql_union.cc
      sql/sql_view.h
      sql/sql_yacc.yy
      sql/strfunc.cc
      sql/structs.h
      sql/table.cc
      sql/thr_malloc.cc
      sql/time.cc
      sql/tztime.cc
      sql/tztime.h
      sql/udf_example.c
      sql/uniques.cc
      sql/unireg.cc
      sql/unireg.h
      storage/Makefile.am
      storage/archive/CMakeLists.txt
      storage/archive/Makefile.am
      storage/archive/archive_reader.c
      storage/archive/ha_archive.cc
      storage/blackhole/CMakeLists.txt
      storage/blackhole/Makefile.am
      storage/blackhole/ha_blackhole.cc
      storage/blackhole/ha_blackhole.h
      storage/csv/CMakeLists.txt
      storage/csv/Makefile.am
      storage/csv/ha_tina.cc
      storage/csv/ha_tina.h
      storage/csv/transparent_file.cc
      storage/csv/transparent_file.h
      storage/example/CMakeLists.txt
      storage/example/Makefile.am
      storage/example/ha_example.cc
      storage/example/ha_example.h
      storage/federated/CMakeLists.txt
      storage/federated/Makefile.am
      storage/federated/ha_federated.cc
      storage/federated/ha_federated.h
      storage/heap/CMakeLists.txt
      storage/heap/ha_heap.cc
      storage/heap/ha_heap.h
      storage/heap/hp_hash.c
      storage/heap/hp_test2.c
      storage/heap/hp_write.c
      storage/innodb_plugin/ChangeLog
      storage/innodb_plugin/include/trx0sys.h
      storage/innodb_plugin/row/row0row.c
      storage/myisam/CMakeLists.txt
      storage/myisam/ft_boolean_search.c
      storage/myisam/ft_nlq_search.c
      storage/myisam/ft_parser.c
      storage/myisam/ft_stopwords.c
      storage/myisam/ftdefs.h
      storage/myisam/fulltext.h
      storage/myisam/ha_myisam.cc
      storage/myisam/ha_myisam.h
      storage/myisam/mi_check.c
      storage/myisam/mi_close.c
      storage/myisam/mi_create.c
      storage/myisam/mi_dbug.c
      storage/myisam/mi_delete.c
      storage/myisam/mi_delete_all.c
      storage/myisam/mi_delete_table.c
      storage/myisam/mi_dynrec.c
      storage/myisam/mi_extra.c
      storage/myisam/mi_locking.c
      storage/myisam/mi_open.c
      storage/myisam/mi_packrec.c
      storage/myisam/mi_page.c
      storage/myisam/mi_preload.c
      storage/myisam/mi_range.c
      storage/myisam/mi_rnext.c
      storage/myisam/mi_search.c
      storage/myisam/mi_static.c
      storage/myisam/mi_test1.c
      storage/myisam/mi_test2.c
      storage/myisam/mi_unique.c
      storage/myisam/mi_update.c
      storage/myisam/mi_write.c
      storage/myisam/myisam_ftdump.c
      storage/myisam/myisamchk.c
      storage/myisam/myisamdef.h
      storage/myisam/myisamlog.c
      storage/myisam/myisampack.c
      storage/myisam/rt_split.c
      storage/myisam/sort.c
      storage/myisam/sp_test.c
      storage/myisammrg/CMakeLists.txt
      storage/myisammrg/ha_myisammrg.cc
      storage/myisammrg/ha_myisammrg.h
      storage/myisammrg/myrg_create.c
      storage/myisammrg/myrg_info.c
      storage/myisammrg/myrg_open.c
      storage/myisammrg/myrg_rkey.c
      storage/mysql_storage_engine.cmake
      storage/ndb/MAINTAINERS
      storage/ndb/config/win-lib.am
      storage/ndb/config/win-prg.am
      storage/ndb/include/mgmapi/ndb_logevent.h
      storage/ndb/include/ndbapi/NdbEventOperation.hpp
      storage/ndb/include/ndbapi/NdbOperation.hpp
      storage/ndb/src/common/portlib/NdbMutex.c
      storage/ndb/src/common/util/Makefile.am
      storage/ndb/src/kernel/blocks/backup/read.cpp
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
      storage/ndb/src/kernel/blocks/lgman.cpp
      storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
      storage/ndb/src/kernel/blocks/suma/Suma.cpp
      storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
      storage/ndb/src/mgmsrv/Makefile.am
      storage/ndb/src/ndbapi/DictCache.cpp
      storage/ndb/src/ndbapi/NdbEventOperation.cpp
      storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
      storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp
      storage/ndb/test/run-test/Makefile.am
      storage/ndb/test/run-test/atrt.hpp
      storage/ndb/test/run-test/autotest-boot.sh
      storage/ndb/test/run-test/autotest-run.sh
      storage/ndb/test/run-test/files.cpp
      storage/ndb/test/run-test/setup.cpp
      storage/ndb/test/run-test/upgrade-boot.sh
      storage/ndb/test/sql/BANK.sql
      storage/ndb/test/sql/T1.sql
      storage/ndb/test/tools/connect.cpp
      storage/ndb/test/tools/log_listner.cpp
      storage/ndb/tools/restore/consumer_restore.cpp
      storage/ndb/tools/restore/consumer_restorem.cpp
      strings/CMakeLists.txt
      strings/Makefile.am
      strings/bchange.c
      strings/bcopy-duff.c
      strings/bfill.c
      strings/bmove.c
      strings/bmove512.c
      strings/bmove_upp.c
      strings/conf_to_src.c
      strings/ctype-big5.c
      strings/ctype-bin.c
      strings/ctype-cp932.c
      strings/ctype-czech.c
      strings/ctype-euc_kr.c
      strings/ctype-eucjpms.c
      strings/ctype-extra.c
      strings/ctype-gb2312.c
      strings/ctype-gbk.c
      strings/ctype-latin1.c
      strings/ctype-mb.c
      strings/ctype-simple.c
      strings/ctype-sjis.c
      strings/ctype-tis620.c
      strings/ctype-uca.c
      strings/ctype-ucs2.c
      strings/ctype-ujis.c
      strings/ctype-utf8.c
      strings/ctype-win1250ch.c
      strings/ctype.c
      strings/decimal.c
      strings/do_ctype.c
      strings/dump_map.c
      strings/int2str.c
      strings/is_prefix.c
      strings/llstr.c
      strings/longlong2str.c
      strings/longlong2str_asm.c
      strings/memcmp.c
      strings/memcpy.c
      strings/memset.c
      strings/my_strchr.c
      strings/my_strtoll10.c
      strings/my_vsnprintf.c
      strings/r_strinstr.c
      strings/str2int.c
      strings/str_alloc.c
      strings/str_test.c
      strings/strappend.c
      strings/strcat.c
      strings/strcend.c
      strings/strchr.c
      strings/strcmp.c
      strings/strcont.c
      strings/strend.c
      strings/strfill.c
      strings/strinstr.c
      strings/strlen.c
      strings/strmake.c
      strings/strmov.c
      strings/strnlen.c
      strings/strnmov.c
      strings/strrchr.c
      strings/strstr.c
      strings/strto.c
      strings/strtod.c
      strings/strtol.c
      strings/strtoll.c
      strings/strtoul.c
      strings/strtoull.c
      strings/strxmov.c
      strings/strxnmov.c
      strings/uca-dump.c
      strings/uctypedump.c
      strings/udiv.c
      strings/utr11-dump.c
      strings/xml.c
      support-files/Makefile.am
      support-files/config.huge.ini.sh
      support-files/config.medium.ini.sh
      support-files/config.small.ini.sh
      support-files/mysql.spec.sh
      support-files/ndb-config-2-node.ini.sh
      tests/Makefile.am
      tests/bug25714.c
      tests/grant.pl
      tests/mysql_client_test.c
      unittest/Makefile.am
      unittest/examples/Makefile.am
      unittest/examples/skip-t.c
      unittest/examples/skip_all-t.c
      unittest/examples/todo-t.c
      unittest/mysys/Makefile.am
      unittest/mysys/base64-t.c
      unittest/mysys/bitmap-t.c
      unittest/mytap/t/basic-t.c
      unittest/strings/Makefile.am
      unittest/strings/strings-t.c
      vio/vio.c
      vio/vio_priv.h
      vio/viosocket.c
      vio/viosslfactories.c
      vio/viotest-sslconnect.cc
      vio/viotest.cc
      win/Makefile.am
      win/build-vs10.bat
      win/build-vs10_x64.bat
      win/configure.js
      win/create_def_file.js
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc	2011-07-03 15:47:37 +0000
+++ b/client/mysqlbinlog.cc	2011-07-11 16:13:27 +0000
@@ -36,6 +36,7 @@
 #include "mysql_priv.h" 
 #include "log_event.h"
 #include "sql_common.h"
+#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
 
 #define BIN_LOG_HEADER_SIZE	4
 #define PROBE_HEADER_LEN	(EVENT_LEN_OFFSET+4)
@@ -1249,10 +1250,7 @@ static void print_version()
 static void usage()
 {
   print_version();
-  puts("By Monty and Sasha, for your professional use\n\
-This software comes with NO WARRANTY:  This is free software,\n\
-and you are welcome to modify and redistribute it under the GPL license.\n");
-
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
   printf("\
 Dumps a MySQL binary log in a format usable for viewing or for piping to\n\
 the mysql command line client.\n\n");

=== modified file 'include/Makefile.am'
--- a/include/Makefile.am	2011-07-03 18:08:47 +0000
+++ b/include/Makefile.am	2011-07-12 01:13:36 +0000
@@ -38,7 +38,7 @@ noinst_HEADERS =	config-win.h config-net
 			my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
 			thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
 			my_compare.h my_time.h my_vle.h my_user.h \
-			my_libwrap.h my_stacktrace.h
+			my_libwrap.h my_stacktrace.h welcome_copyright_notice.h
 
 EXTRA_DIST =        mysql.h.pp mysql/plugin.h.pp
 

=== added file 'include/welcome_copyright_notice.h'
--- a/include/welcome_copyright_notice.h	1970-01-01 00:00:00 +0000
+++ b/include/welcome_copyright_notice.h	2011-07-11 16:11:41 +0000
@@ -0,0 +1,31 @@
+/* Copyright (c) 2011, 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 */
+
+#ifndef _welcome_copyright_notice_h_
+#define _welcome_copyright_notice_h_
+
+/*
+  This define specifies copyright notice which is displayed by every MySQL
+  program on start, or on help screen.
+*/
+
+#define ORACLE_WELCOME_COPYRIGHT_NOTICE(years) \
+  "Copyright (c) " years ", Oracle and/or its affiliates. All rights reserved.\n" \
+  "\n" \
+  "Oracle is a registered trademark of Oracle Corporation and/or its\n" \
+  "affiliates. Other names may be trademarks of their respective\n" \
+  "owners.\n"
+
+#endif /* _welcome_copyright_notice_h_ */

=== modified file 'mysql-test/r/explain.result'
--- a/mysql-test/r/explain.result	2010-10-18 12:12:27 +0000
+++ b/mysql-test/r/explain.result	2011-05-04 15:12:45 +0000
@@ -176,11 +176,12 @@ SELECT @@session.sql_mode INTO @old_sql_
 SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
 EXPLAIN EXTENDED SELECT 1 FROM t1
 WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
-ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
-SHOW WARNINGS;
-Level	Code	Message
-Error	1140	Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
-Note	1003	select 1 AS `1` from `test`.`t1` where <not>(<exists>(...))
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+2	SUBQUERY	t1	system	NULL	NULL	NULL	NULL	0	0.00	const row not found
+2	SUBQUERY	t	system	NULL	NULL	NULL	NULL	0	0.00	const row not found
+Warnings:
+Note	1003	select 1 AS `1` from `test`.`t1` where 0
 SET SESSION sql_mode=@old_sql_mode;
 DROP TABLE t1;
 End of 5.0 tests.

=== added file 'mysql-test/r/secure_file_priv_win.result'
--- a/mysql-test/r/secure_file_priv_win.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/secure_file_priv_win.result	2011-05-04 12:47:29 +0000
@@ -0,0 +1,38 @@
+CREATE TABLE t1 (c1 longtext);
+INSERT INTO t1 values ('a');
+SELECT * FROM t1 INTO OUTFILE 'MYSQL_TMP_DIR/B11764517.tmp';
+show global variables like 'secure_file_priv';
+Variable_name	Value
+secure_file_priv	MYSQL_TMP_DIR/
+SELECT load_file('MYSQL_TMP_DIR\\B11764517.tmp') AS x;
+x
+a
+
+SELECT load_file('MYSQL_TMP_DIR/B11764517.tmp') AS x;
+x
+a
+
+SELECT load_file('MYSQL_TMP_DIR_UCASE/B11764517.tmp') AS x;
+x
+a
+
+SELECT load_file('MYSQL_TMP_DIR_LCASE/B11764517.tmp') AS x;
+x
+a
+
+SELECT load_file('MYSQL_TMP_DIR\\..a..\\..\\..\\B11764517.tmp') AS x;
+x
+NULL
+LOAD DATA INFILE 'MYSQL_TMP_DIR\\B11764517.tmp' INTO TABLE t1;
+LOAD DATA INFILE 'MYSQL_TMP_DIR/B11764517.tmp' INTO TABLE t1;
+LOAD DATA INFILE 'MYSQL_TMP_DIR_UCASE/B11764517.tmp' INTO TABLE t1;
+LOAD DATA INFILE 'MYSQL_TMP_DIR_LCASE/B11764517.tmp' INTO TABLE t1;
+LOAD DATA INFILE "MYSQL_TMP_DIR\\..a..\\..\\..\\B11764517.tmp" into table t1;
+ERROR HY000: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
+SELECT * FROM t1 INTO OUTFILE 'MYSQL_TMP_DIR\\..a..\\..\\..\\B11764517-2.tmp';
+ERROR HY000: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
+SELECT * FROM t1 INTO OUTFILE 'MYSQL_TMP_DIR\\B11764517-2.tmp';
+SELECT * FROM t1 INTO OUTFILE 'MYSQL_TMP_DIR/B11764517-3.tmp';
+SELECT * FROM t1 INTO OUTFILE 'MYSQL_TMP_DIR_UCASE/B11764517-4.tmp';
+SELECT * FROM t1 INTO OUTFILE 'MYSQL_TMP_DIR_LCASE/B11764517-5.tmp';
+DROP TABLE t1;

=== modified file 'mysql-test/r/sp-security.result'
--- a/mysql-test/r/sp-security.result	2010-02-26 13:16:46 +0000
+++ b/mysql-test/r/sp-security.result	2011-04-13 07:57:16 +0000
@@ -567,3 +567,28 @@ DROP USER 'tester';
 DROP USER 'Tester';
 DROP DATABASE B48872;
 End of 5.0 tests.
+#
+# Bug#11882603 SELECT_ACL ON ANY COLUMN IN MYSQL.PROC ALLOWS TO SEE
+#              DEFINITION OF ANY ROUTINE. 
+#
+DROP DATABASE IF EXISTS db1;
+CREATE DATABASE db1;
+CREATE PROCEDURE db1.p1() SELECT 1;
+CREATE USER user2@localhost IDENTIFIED BY '';
+GRANT SELECT(db) ON mysql.proc TO user2@localhost;
+# Connection con2 as user2
+# The statement below before disclosed info from body_utf8 column.
+SHOW CREATE PROCEDURE db1.p1;
+ERROR 42000: PROCEDURE p1 does not exist
+# Check that SHOW works with SELECT grant on whole table
+# Connection default
+GRANT SELECT ON mysql.proc TO user2@localhost;
+# Connection con2
+# This should work
+SHOW CREATE PROCEDURE db1.p1;
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+p1		CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SELECT 1	latin1	latin1_swedish_ci	latin1_swedish_ci
+# Connection default
+DROP USER user2@localhost;
+DROP DATABASE db1;

=== modified file 'mysql-test/r/subselect.result'
--- a/mysql-test/r/subselect.result	2011-04-14 14:35:24 +0000
+++ b/mysql-test/r/subselect.result	2011-05-10 13:57:40 +0000
@@ -4435,6 +4435,32 @@ pk	int_key
 3	3
 7	3
 DROP TABLE t1,t2;
+#
+# Bug#12329653 
+# EXPLAIN, UNION, PREPARED STATEMENT, CRASH, SQL_FULL_GROUP_BY
+#
+CREATE TABLE t1(a1 int);
+INSERT INTO t1 VALUES (1),(2);
+SELECT @@session.sql_mode INTO @old_sql_mode;
+SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
+1
+1
+1
+PREPARE stmt FROM 
+'SELECT 1 UNION ALL 
+SELECT 1 FROM t1
+ORDER BY
+(SELECT 1 FROM t1 AS t1_0  
+  WHERE 1 < SOME (SELECT a1 FROM t1)
+)' ;
+EXECUTE stmt ;
+ERROR 21000: Subquery returns more than 1 row
+EXECUTE stmt ;
+ERROR 21000: Subquery returns more than 1 row
+SET SESSION sql_mode=@old_sql_mode;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
 End of 5.0 tests.
 CREATE TABLE t1 (a INT, b INT);
 INSERT INTO t1 VALUES (2,22),(1,11),(2,22);

=== modified file 'mysql-test/suite/innodb_plugin/r/innodb-index.result'
--- a/mysql-test/suite/innodb_plugin/r/innodb-index.result	2011-06-30 10:18:54 +0000
+++ b/mysql-test/suite/innodb_plugin/r/innodb-index.result	2011-07-07 21:29:30 +0000
@@ -1,3 +1,46 @@
+set global innodb_file_per_table=on;
+set global innodb_file_format='Barracuda';
+CREATE TABLE t1_purge (
+A INT,
+B BLOB, C BLOB, D BLOB, E BLOB,
+F BLOB, G BLOB, H BLOB,
+PRIMARY KEY (B(767), C(767), D(767), E(767), A),
+INDEX (A)
+) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1_purge VALUES (1,
+REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
+REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766));
+CREATE TABLE t2_purge (
+A INT PRIMARY KEY,
+B BLOB, C BLOB, D BLOB, E BLOB,
+F BLOB, G BLOB, H BLOB, I BLOB,
+J BLOB, K BLOB, L BLOB,
+INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t2_purge VALUES (1,
+REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
+REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766), REPEAT('i', 766),
+REPEAT('j', 766), REPEAT('k', 766), REPEAT('l', 766));
+CREATE TABLE t3_purge (
+A INT,
+B VARCHAR(800), C VARCHAR(800), D VARCHAR(800), E VARCHAR(800),
+F VARCHAR(800), G VARCHAR(800), H VARCHAR(800),
+PRIMARY KEY (B(767), C(767), D(767), E(767), A),
+INDEX (A)
+) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t3_purge SELECT * FROM t1_purge;
+CREATE TABLE t4_purge (
+A INT PRIMARY KEY,
+B VARCHAR(800), C VARCHAR(800), D VARCHAR(800), E VARCHAR(800),
+F VARCHAR(800), G VARCHAR(800), H VARCHAR(800), I VARCHAR(800),
+J VARCHAR(800), K VARCHAR(800), L VARCHAR(800),
+INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t4_purge SELECT * FROM t2_purge;
+DELETE FROM t1_purge;
+DELETE FROM t2_purge;
+DELETE FROM t3_purge;
+DELETE FROM t4_purge;
+set global innodb_file_per_table=0;
+set global innodb_file_format=Antelope;
 create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb;
 insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak');
 commit;
@@ -979,6 +1022,7 @@ v16 VARCHAR(500), v17 VARCHAR(500), v18
 CREATE INDEX idx1 ON t1(a,v1);
 INSERT INTO t1 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
 UPDATE t1 SET a=1000;
+DELETE FROM t1;
 DROP TABLE t1;
 set global innodb_file_per_table=0;
 set global innodb_file_format=Antelope;
@@ -1183,3 +1227,4 @@ a	b
 3	a
 3	b
 DROP TABLE t1;
+DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;

=== modified file 'mysql-test/suite/innodb_plugin/t/innodb-index.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb-index.test	2011-06-30 10:18:54 +0000
+++ b/mysql-test/suite/innodb_plugin/t/innodb-index.test	2011-07-07 21:29:30 +0000
@@ -4,6 +4,65 @@ let $MYSQLD_DATADIR= `select @@datadir`;
 
 let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
 
+let $per_table=`select @@innodb_file_per_table`;
+let $format=`select @@innodb_file_format`;
+set global innodb_file_per_table=on;
+set global innodb_file_format='Barracuda';
+
+# Test an assertion failure on purge.
+CREATE TABLE t1_purge (
+A INT,
+B BLOB, C BLOB, D BLOB, E BLOB,
+F BLOB, G BLOB, H BLOB,
+PRIMARY KEY (B(767), C(767), D(767), E(767), A),
+INDEX (A)
+) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+
+INSERT INTO t1_purge VALUES (1,
+REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
+REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766));
+
+CREATE TABLE t2_purge (
+A INT PRIMARY KEY,
+B BLOB, C BLOB, D BLOB, E BLOB,
+F BLOB, G BLOB, H BLOB, I BLOB,
+J BLOB, K BLOB, L BLOB,
+INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+
+INSERT INTO t2_purge VALUES (1,
+REPEAT('b', 766), REPEAT('c', 766), REPEAT('d', 766), REPEAT('e', 766),
+REPEAT('f', 766), REPEAT('g', 766), REPEAT('h', 766), REPEAT('i', 766),
+REPEAT('j', 766), REPEAT('k', 766), REPEAT('l', 766));
+
+CREATE TABLE t3_purge (
+A INT,
+B VARCHAR(800), C VARCHAR(800), D VARCHAR(800), E VARCHAR(800),
+F VARCHAR(800), G VARCHAR(800), H VARCHAR(800),
+PRIMARY KEY (B(767), C(767), D(767), E(767), A),
+INDEX (A)
+) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+
+INSERT INTO t3_purge SELECT * FROM t1_purge;
+
+CREATE TABLE t4_purge (
+A INT PRIMARY KEY,
+B VARCHAR(800), C VARCHAR(800), D VARCHAR(800), E VARCHAR(800),
+F VARCHAR(800), G VARCHAR(800), H VARCHAR(800), I VARCHAR(800),
+J VARCHAR(800), K VARCHAR(800), L VARCHAR(800),
+INDEX (B(767))) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+
+INSERT INTO t4_purge SELECT * FROM t2_purge;
+
+# This would trigger the failure (Bug #12429576)
+# if purge gets a chance to run before DROP TABLE t1_purge, ....
+DELETE FROM t1_purge;
+DELETE FROM t2_purge;
+DELETE FROM t3_purge;
+DELETE FROM t4_purge;
+
+eval set global innodb_file_per_table=$per_table;
+eval set global innodb_file_format=$format;
+
 create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb;
 insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak');
 commit;
@@ -360,8 +419,6 @@ disconnect b;
 
 drop table t1;
 
-let $per_table=`select @@innodb_file_per_table`;
-let $format=`select @@innodb_file_format`;
 set global innodb_file_per_table=on;
 set global innodb_file_format='Barracuda';
 # Test creating a table that could lead to undo log overflow.
@@ -418,6 +475,9 @@ CREATE TABLE t1(a INT,
 CREATE INDEX idx1 ON t1(a,v1);
 INSERT INTO t1 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
 UPDATE t1 SET a=1000;
+DELETE FROM t1;
+# Let the purge thread clean up this file.
+-- sleep 10
 DROP TABLE t1;
 
 eval set global innodb_file_per_table=$per_table;
@@ -557,6 +617,7 @@ disconnect a;
 disconnect b;
 
 DROP TABLE t1;
+DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge;
 
 #
 # restore environment to the state it was before this test execution

=== added file 'mysql-test/suite/rpl/r/rpl_row_corruption.result'
--- a/mysql-test/suite/rpl/r/rpl_row_corruption.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_corruption.result	2011-07-14 11:15:24 +0000
@@ -0,0 +1,49 @@
+include/master-slave.inc
+[connection master]
+CREATE TABLE t1_11753004 (c1 INT);
+CREATE TABLE t2_11753004 (c1 INT);
+INSERT INTO t1_11753004 VALUES (1);
+INSERT INTO t2_11753004 VALUES (2);
+call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*");
+include/stop_slave.inc
+SET @save_debug= @@global.debug;
+SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
+include/start_slave.inc
+UPDATE t1_11753004, t2_11753004 SET t1_11753004.c1=3, t2_11753004.c1=4 WHERE t1_11753004.c1=1 OR t2_11753004.c1=2;
+include/wait_for_slave_sql_error.inc [errno=1593 ]
+include/stop_slave.inc
+SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
+include/start_slave.inc
+include/rpl_reset.inc
+DROP TABLE t1_11753004, t2_11753004;
+include/stop_slave.inc
+SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
+include/start_slave.inc
+include/rpl_reset.inc
+CREATE TABLE t1_11753004 (c1 INT);
+CREATE TABLE t2_11753004_ign (c1 INT);
+INSERT INTO t1_11753004 VALUES (1);
+INSERT INTO t2_11753004_ign VALUES (2);
+UPDATE t1_11753004, t2_11753004_ign SET t1_11753004.c1=3, t2_11753004_ign.c1=4 WHERE t1_11753004.c1=1 OR t2_11753004_ign.c1=2;
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+BINLOG '
+SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=
+'/*!*/;
+SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
+BINLOG '
+SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE=
+SOgWThMBAAAAKQAAAC8DAAAAAEMAAAAAAAEABHRlc3QAAnQyAAEDAAE=
+SOgWThgBAAAAKAAAAFcDAAAAAEIAAAAAAAAAAf///gEAAAD+AwAAAA==
+SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA==
+'/*!*/;
+ERROR HY000: Fatal error: Found table map event mapping table id 0 which was already mapped but with different settings.
+DROP TABLE t1,t2;
+SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
+DROP TABLE t1_11753004;
+DROP TABLE t2_11753004_ign;
+SET GLOBAL debug= @save_debug;
+include/rpl_end.inc

=== added file 'mysql-test/suite/rpl/t/rpl_row_corruption-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_row_corruption-slave.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_corruption-slave.opt	2011-07-14 11:15:24 +0000
@@ -0,0 +1 @@
+--replicate-ignore-table=test.t2_11753004_ign

=== added file 'mysql-test/suite/rpl/t/rpl_row_corruption.test'
--- a/mysql-test/suite/rpl/t/rpl_row_corruption.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_corruption.test	2011-07-14 11:15:24 +0000
@@ -0,0 +1,115 @@
+#
+--source include/master-slave.inc
+--source include/have_debug.inc
+--source include/have_binlog_format_row.inc
+
+# BUG#11753004: 44360: REPLICATION FAILED 
+
+## assert that we get an error when checking the
+## identifiers at the slave (instead of a crash or
+## different table being updated)
+
+--let $t1= t1_11753004
+--let $t2= t2_11753004
+--let $t2_ign= t2_11753004_ign
+
+## test #1: assert that we get an error raised when multiple
+##          tables in the same RBR statement are mapped with the
+##          same identifier
+
+--eval CREATE TABLE $t1 (c1 INT)
+--eval CREATE TABLE $t2 (c1 INT)
+--eval INSERT INTO $t1 VALUES (1)
+--eval INSERT INTO $t2 VALUES (2)
+
+--sync_slave_with_master
+call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*");
+
+# stop the slave and inject corruption
+--source include/stop_slave.inc
+SET @save_debug= @@global.debug;
+SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
+--source include/start_slave.inc
+--connection master
+# both tables get mapped to 0 (in a way, simulating scenario 
+# originated by BUG#56226)
+--eval UPDATE $t1, $t2 SET $t1.c1=3, $t2.c1=4 WHERE $t1.c1=1 OR $t2.c1=2
+--connection slave
+
+# wait for error 1593 (ER_SLAVE_FATAL_ERROR)
+--let $slave_sql_errno=1593 
+--source include/wait_for_slave_sql_error.inc
+--source include/stop_slave.inc
+
+# clean up
+SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
+--source include/start_slave.inc
+--connection master
+--source include/rpl_reset.inc
+--eval DROP TABLE $t1, $t2
+--sync_slave_with_master
+
+## test #2: assert that ignored tables that may have been mapped
+##          with the same identifier are skipped, thus no error
+##          is raised.
+
+--connection slave
+--source include/stop_slave.inc
+SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
+--source include/start_slave.inc
+--source include/rpl_reset.inc
+--connection master
+--eval CREATE TABLE $t1 (c1 INT)
+--eval CREATE TABLE $t2_ign (c1 INT)
+--eval INSERT INTO $t1 VALUES (1)
+--eval INSERT INTO $t2_ign VALUES (2)
+--eval UPDATE $t1, $t2_ign SET $t1.c1=3, $t2_ign.c1=4 WHERE $t1.c1=1 OR $t2_ign.c1=2
+
+# must not raise error as second table is filtered
+--sync_slave_with_master
+
+
+## test #3: check that BINLOG statements will also raise an
+##          error if containing table map events mapping different
+##          tables to same table identifier.
+
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+# FD event
+BINLOG '
+SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=
+'/*!*/;
+
+#110708 12:21:44 server id 1  end_log_pos 774   Table_map: `test`.`t1` mapped to number 66
+# at 774
+#110708 12:21:44 server id 1  end_log_pos 815   Table_map: `test`.`t2` mapped to number 67
+# at 815
+#110708 12:21:44 server id 1  end_log_pos 855   Update_rows: table id 66
+# at 855
+#110708 12:21:44 server id 1  end_log_pos 895   Update_rows: table id 67 flags: STMT_END_F
+SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
+--error ER_SLAVE_FATAL_ERROR
+BINLOG '
+SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE=
+SOgWThMBAAAAKQAAAC8DAAAAAEMAAAAAAAEABHRlc3QAAnQyAAEDAAE=
+SOgWThgBAAAAKAAAAFcDAAAAAEIAAAAAAAAAAf///gEAAAD+AwAAAA==
+SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA==
+'/*!*/;
+
+
+# clean up
+DROP TABLE t1,t2;
+--connection slave
+SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
+--connection master
+--eval DROP TABLE $t1
+--eval DROP TABLE $t2_ign
+--sync_slave_with_master
+SET GLOBAL debug= @save_debug;
+
+--source include/rpl_end.inc

=== modified file 'mysql-test/t/explain.test'
--- a/mysql-test/t/explain.test	2010-10-18 12:12:27 +0000
+++ b/mysql-test/t/explain.test	2011-05-04 15:12:45 +0000
@@ -1,5 +1,5 @@
 #
-# Test of different EXPLAIN's
+# Test of different EXPLAINs
 
 --disable_warnings
 drop table if exists t1;
@@ -157,11 +157,12 @@ CREATE TABLE t1 (f1 INT);
 SELECT @@session.sql_mode INTO @old_sql_mode;
 SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
 
-# EXPLAIN EXTENDED (with subselect). used to crash. should give NOTICE.
---error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
+# EXPLAIN EXTENDED (with subselect). used to crash.
+# This is actually a valid query for this sql_mode,
+# but it was transformed in such a way that it failed, see
+# Bug#12329653 - EXPLAIN, UNION, PREPARED STATEMENT, CRASH, SQL_FULL_GROUP_BY
 EXPLAIN EXTENDED SELECT 1 FROM t1
                           WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
-SHOW WARNINGS;
 
 SET SESSION sql_mode=@old_sql_mode;
 

=== added file 'mysql-test/t/secure_file_priv_win-master.opt'
--- a/mysql-test/t/secure_file_priv_win-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/secure_file_priv_win-master.opt	2011-04-28 09:22:41 +0000
@@ -0,0 +1 @@
+--secure_file_priv=$MYSQL_TMP_DIR

=== added file 'mysql-test/t/secure_file_priv_win.test'
--- a/mysql-test/t/secure_file_priv_win.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/secure_file_priv_win.test	2011-05-04 12:47:29 +0000
@@ -0,0 +1,79 @@
+#
+# Bug58747 breaks secure_file_priv+not secure yet+still accesses other folders
+#
+
+# we do the windows specific relative directory testing
+
+--source include/windows.inc
+
+CREATE TABLE t1 (c1 longtext);
+INSERT INTO t1 values ('a');
+
+LET $MYSQL_TMP_DIR_UCASE= `SELECT upper('$MYSQL_TMP_DIR')`;
+LET $MYSQL_TMP_DIR_LCASE= `SELECT lower('$MYSQL_TMP_DIR')`;
+
+#create the file
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR/B11764517.tmp';
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+show global variables like 'secure_file_priv';
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SELECT load_file('$MYSQL_TMP_DIR\\\\B11764517.tmp') AS x;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SELECT load_file('$MYSQL_TMP_DIR/B11764517.tmp') AS x;
+
+--replace_result $MYSQL_TMP_DIR_UCASE MYSQL_TMP_DIR_UCASE
+eval SELECT load_file('$MYSQL_TMP_DIR_UCASE/B11764517.tmp') AS x;
+
+--replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE
+eval SELECT load_file('$MYSQL_TMP_DIR_LCASE/B11764517.tmp') AS x;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SELECT load_file('$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517.tmp') AS x;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval LOAD DATA INFILE '$MYSQL_TMP_DIR\\\\B11764517.tmp' INTO TABLE t1;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval LOAD DATA INFILE '$MYSQL_TMP_DIR/B11764517.tmp' INTO TABLE t1;
+
+--replace_result $MYSQL_TMP_DIR_UCASE MYSQL_TMP_DIR_UCASE
+eval LOAD DATA INFILE '$MYSQL_TMP_DIR_UCASE/B11764517.tmp' INTO TABLE t1;
+
+--replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE
+eval LOAD DATA INFILE '$MYSQL_TMP_DIR_LCASE/B11764517.tmp' INTO TABLE t1;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+--error ER_OPTION_PREVENTS_STATEMENT
+eval LOAD DATA INFILE "$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517.tmp" into table t1;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+--error ER_OPTION_PREVENTS_STATEMENT
+eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517-2.tmp';
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR\\\\B11764517-2.tmp';
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR/B11764517-3.tmp';
+
+--replace_result $MYSQL_TMP_DIR_UCASE MYSQL_TMP_DIR_UCASE
+eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR_UCASE/B11764517-4.tmp';
+
+--replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE
+eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR_LCASE/B11764517-5.tmp';
+
+--error 0,1
+--remove_file $MYSQL_TMP_DIR/B11764517.tmp;
+--error 0,1
+--remove_file $MYSQL_TMP_DIR/B11764517-2.tmp;
+--error 0,1
+--remove_file $MYSQL_TMP_DIR/B11764517-3.tmp;
+--error 0,1
+--remove_file $MYSQL_TMP_DIR/B11764517-4.tmp;
+--error 0,1
+--remove_file $MYSQL_TMP_DIR/B11764517-5.tmp;
+DROP TABLE t1;

=== modified file 'mysql-test/t/sp-security.test'
--- a/mysql-test/t/sp-security.test	2010-02-26 13:16:46 +0000
+++ b/mysql-test/t/sp-security.test	2011-04-13 07:57:16 +0000
@@ -926,6 +926,43 @@ DROP DATABASE B48872;
 
 --echo End of 5.0 tests.
 
+--echo #
+--echo # Bug#11882603 SELECT_ACL ON ANY COLUMN IN MYSQL.PROC ALLOWS TO SEE
+--echo #              DEFINITION OF ANY ROUTINE. 
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+--enable_warnings
+
+CREATE DATABASE db1;
+CREATE PROCEDURE db1.p1() SELECT 1;
+CREATE USER user2@localhost IDENTIFIED BY '';
+GRANT SELECT(db) ON mysql.proc TO user2@localhost;
+ 
+--echo # Connection con2 as user2
+connect (con2, localhost, user2);
+--echo # The statement below before disclosed info from body_utf8 column.
+--error ER_SP_DOES_NOT_EXIST
+SHOW CREATE PROCEDURE db1.p1;
+
+--echo # Check that SHOW works with SELECT grant on whole table
+--echo # Connection default
+connection default;
+GRANT SELECT ON mysql.proc TO user2@localhost;
+
+--echo # Connection con2
+connection con2;
+--echo # This should work
+SHOW CREATE PROCEDURE db1.p1;
+
+--echo # Connection default
+connection default;
+disconnect con2;
+DROP USER user2@localhost;
+DROP DATABASE db1;
+
+
 # Wait till all disconnects are completed
 --source include/wait_until_count_sessions.inc
 

=== modified file 'mysql-test/t/subselect.test'
--- a/mysql-test/t/subselect.test	2011-04-14 14:35:24 +0000
+++ b/mysql-test/t/subselect.test	2011-05-10 13:57:40 +0000
@@ -3393,6 +3393,39 @@ ORDER BY outr.pk;
 
 DROP TABLE t1,t2;
 
+--echo #
+--echo # Bug#12329653 
+--echo # EXPLAIN, UNION, PREPARED STATEMENT, CRASH, SQL_FULL_GROUP_BY
+--echo #
+
+CREATE TABLE t1(a1 int);
+INSERT INTO t1 VALUES (1),(2);
+
+SELECT @@session.sql_mode INTO @old_sql_mode;
+SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
+
+## First a simpler query, illustrating the transformation
+## '1 < some (...)' => '1 < max(...)'
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
+
+## The query which made the server crash.
+PREPARE stmt FROM 
+'SELECT 1 UNION ALL 
+SELECT 1 FROM t1
+ORDER BY
+(SELECT 1 FROM t1 AS t1_0  
+  WHERE 1 < SOME (SELECT a1 FROM t1)
+)' ;
+
+--error ER_SUBQUERY_NO_1_ROW
+EXECUTE stmt ;
+--error ER_SUBQUERY_NO_1_ROW
+EXECUTE stmt ;
+
+SET SESSION sql_mode=@old_sql_mode;
+
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
 
 --echo End of 5.0 tests.
 

=== modified file 'mysys/my_symlink.c'
--- a/mysys/my_symlink.c	2011-06-30 15:37:13 +0000
+++ b/mysys/my_symlink.c	2011-07-07 08:06:59 +0000
@@ -146,24 +146,23 @@ int my_realpath(char *to, const char *fi
     result= -1;
   }
   DBUG_RETURN(result);
-#else
-#ifdef _WIN32
-  int ret= GetFullPathName(filename,FN_REFLEN,
-                           to,
-                           NULL);
+#elif defined(_WIN32)
+  int ret= GetFullPathName(filename,FN_REFLEN, to, NULL);
   if (ret == 0 || ret > FN_REFLEN)
   {
-    if (ret > FN_REFLEN)
-      my_errno= ENAMETOOLONG;
-    else
-      my_errno= EACCES;
+    my_errno= (ret > FN_REFLEN) ? ENAMETOOLONG : GetLastError();
     if (MyFlags & MY_WME)
       my_error(EE_REALPATH, MYF(0), filename, my_errno);
-	  return -1;
+    /* 
+      GetFullPathName didn't work : use my_load_path() which is a poor 
+      substitute original name but will at least be able to resolve 
+      paths that starts with '.'.
+    */  
+    my_load_path(to, filename, NullS);
+    return -1;
   }
 #else
   my_load_path(to, filename, NullS);
 #endif
   return 0;
-#endif
 }

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2011-07-03 15:47:37 +0000
+++ b/sql/item.cc	2011-07-07 08:06:59 +0000
@@ -4466,14 +4466,14 @@ mark_non_agg_field:
     SELECT_LEX *select_lex= cached_table ? 
       cached_table->select_lex : context->select_lex;
     if (!thd->lex->in_sum_func)
-      select_lex->full_group_by_flag|= NON_AGG_FIELD_USED;
+      select_lex->set_non_agg_field_used(true);
     else
     {
       if (outer_fixed)
         thd->lex->in_sum_func->outer_fields.push_back(this);
       else if (thd->lex->in_sum_func->nest_level !=
           thd->lex->current_select->nest_level)
-        select_lex->full_group_by_flag|= NON_AGG_FIELD_USED;
+        select_lex->set_non_agg_field_used(true);
     }
   }
   return FALSE;

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2011-07-03 15:47:37 +0000
+++ b/sql/item_subselect.cc	2011-07-07 08:06:59 +0000
@@ -1016,6 +1016,14 @@ Item_in_subselect::single_value_transfor
 	it.replace(item);
       }
 
+      DBUG_EXECUTE("where",
+                   print_where(item, "rewrite with MIN/MAX", QT_ORDINARY););
+      if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY)
+      {
+        DBUG_ASSERT(select_lex->non_agg_field_used());
+        select_lex->set_non_agg_field_used(false);
+      }
+
       save_allow_sum_func= thd->lex->allow_sum_func;
       thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
       /*

=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc	2011-07-03 15:47:37 +0000
+++ b/sql/item_sum.cc	2011-07-07 08:06:59 +0000
@@ -247,10 +247,10 @@ bool Item_sum::check_sum_func(THD *thd,
           in_sum_func->outer_fields.push_back(field);
         }
         else
-          sel->full_group_by_flag|= NON_AGG_FIELD_USED;
+          sel->set_non_agg_field_used(true);
       }
       if (sel->nest_level > aggr_level &&
-          (sel->full_group_by_flag & SUM_FUNC_USED) &&
+          (sel->agg_func_used()) &&
           !sel->group_list.elements)
       {
         my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,
@@ -259,7 +259,7 @@ bool Item_sum::check_sum_func(THD *thd,
       }
     }
   }
-  aggr_sel->full_group_by_flag|= SUM_FUNC_USED;
+  aggr_sel->set_agg_func_used(true);
   update_used_tables();
   thd->lex->in_sum_func= in_sum_func;
   return FALSE;

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2011-07-03 15:47:37 +0000
+++ b/sql/log_event.cc	2011-07-15 11:42:06 +0000
@@ -59,6 +59,11 @@ static int rows_event_stmt_cleanup(Relay
 
 static const char *HA_ERR(int i)
 {
+  /* 
+    This function should only be called in case of an error
+    was detected 
+   */
+  DBUG_ASSERT(i != 0);
   switch (i) {
   case HA_ERR_KEY_NOT_FOUND: return "HA_ERR_KEY_NOT_FOUND";
   case HA_ERR_FOUND_DUPP_KEY: return "HA_ERR_FOUND_DUPP_KEY";
@@ -111,7 +116,7 @@ static const char *HA_ERR(int i)
   case HA_ERR_CORRUPT_EVENT: return "HA_ERR_CORRUPT_EVENT";
   case HA_ERR_ROWS_EVENT_APPLY : return "HA_ERR_ROWS_EVENT_APPLY";
   }
-  return 0;
+  return "No Error!";
 }
 
 /**
@@ -132,7 +137,7 @@ static void inline slave_rows_error_repo
                                            TABLE *table, const char * type,
                                            const char *log_name, ulong pos)
 {
-  const char *handler_error= HA_ERR(ha_error);
+  const char *handler_error= (ha_error ? HA_ERR(ha_error) : NULL);
   char buff[MAX_SLAVE_ERRMSG], *slider;
   const char *buff_end= buff + sizeof(buff);
   uint len;
@@ -7596,7 +7601,8 @@ int Rows_log_event::do_apply_event(Relay
 
       error= do_exec_row(rli);
 
-      DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
+      if (error)
+        DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
       DBUG_ASSERT(error != HA_ERR_RECORD_DELETED);
 
       table->in_use = old_thd;
@@ -8222,6 +8228,97 @@ Table_map_log_event::~Table_map_log_even
  */
 
 #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+
+enum enum_tbl_map_status
+{
+  /* no duplicate identifier found */
+  OK_TO_PROCESS= 0,
+
+  /* this table map must be filtered out */
+  FILTERED_OUT= 1,
+
+  /* identifier mapping table with different properties */
+  SAME_ID_MAPPING_DIFFERENT_TABLE= 2,
+  
+  /* a duplicate identifier was found mapping the same table */
+  SAME_ID_MAPPING_SAME_TABLE= 3
+};
+
+/*
+  Checks if this table map event should be processed or not. First
+  it checks the filtering rules, and then looks for duplicate identifiers
+  in the existing list of rli->tables_to_lock.
+
+  It checks that there hasn't been any corruption by verifying that there
+  are no duplicate entries with different properties.
+
+  In some cases, some binary logs could get corrupted, showing several
+  tables mapped to the same table_id, 0 (see: BUG#56226). Thus we do this
+  early sanity check for such cases and avoid that the server crashes 
+  later.
+
+  In some corner cases, the master logs duplicate table map events, i.e.,
+  same id, same database name, same table name (see: BUG#37137). This is
+  different from the above as it's the same table that is mapped again 
+  to the same identifier. Thus we cannot just check for same ids and 
+  assume that the event is corrupted we need to check every property. 
+
+  NOTE: in the event that BUG#37137 ever gets fixed, this extra check 
+        will still be valid because we would need to support old binary 
+        logs anyway.
+
+  @param rli The relay log info reference.
+  @param table_list A list element containing the table to check against.
+  @return OK_TO_PROCESS 
+            if there was no identifier already in rli->tables_to_lock 
+            
+          FILTERED_OUT
+            if the event is filtered according to the filtering rules
+
+          SAME_ID_MAPPING_DIFFERENT_TABLE 
+            if the same identifier already maps a different table in 
+            rli->tables_to_lock
+
+          SAME_ID_MAPPING_SAME_TABLE 
+            if the same identifier already maps the same table in 
+            rli->tables_to_lock.
+*/
+static enum_tbl_map_status
+check_table_map(Relay_log_info const *rli, RPL_TABLE_LIST *table_list)
+{
+  DBUG_ENTER("check_table_map");
+  enum_tbl_map_status res= OK_TO_PROCESS;
+
+  if (rli->sql_thd->slave_thread /* filtering is for slave only */ &&
+      (!rpl_filter->db_ok(table_list->db) ||
+       (rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list))))
+    res= FILTERED_OUT;
+  else
+  {
+    for(RPL_TABLE_LIST *ptr= static_cast<RPL_TABLE_LIST*>(rli->tables_to_lock);
+        ptr; 
+        ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_local))
+    {
+      if (ptr->table_id == table_list->table_id)
+      {
+
+        if (strcmp(ptr->db, table_list->db) || 
+            strcmp(ptr->alias, table_list->table_name) || 
+            ptr->lock_type != TL_WRITE) // the ::do_apply_event always sets TL_WRITE
+          res= SAME_ID_MAPPING_DIFFERENT_TABLE;
+        else
+          res= SAME_ID_MAPPING_SAME_TABLE;
+
+        break;
+      }
+    }
+  }
+
+  DBUG_PRINT("debug", ("check of table map ended up with: %u", res));
+
+  DBUG_RETURN(res);
+}
+
 int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
 {
   RPL_TABLE_LIST *table_list;
@@ -8248,20 +8345,13 @@ int Table_map_log_event::do_apply_event(
   table_list->alias= table_list->table_name = tname_mem;
   table_list->lock_type= TL_WRITE;
   table_list->next_global= table_list->next_local= 0;
-  table_list->table_id= m_table_id;
+  table_list->table_id= DBUG_EVALUATE_IF("inject_tblmap_same_id_maps_diff_table", 0, m_table_id);
   table_list->updating= 1;
   strmov(table_list->db, rpl_filter->get_rewrite_db(m_dbnam, &dummy_len));
   strmov(table_list->table_name, m_tblnam);
-
-  int error= 0;
-
-  if (rli->sql_thd->slave_thread /* filtering is for slave only */ &&
-      (!rpl_filter->db_ok(table_list->db) ||
-       (rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list))))
-  {
-    my_free(memory, MYF(MY_WME));
-  }
-  else
+  DBUG_PRINT("debug", ("table: %s is mapped to %u", table_list->table_name, table_list->table_id));
+  enum_tbl_map_status tblmap_status= check_table_map(rli, table_list);
+  if (tblmap_status == OK_TO_PROCESS)
   {
     DBUG_ASSERT(thd->lex->query_tables != table_list);
 
@@ -8290,8 +8380,48 @@ int Table_map_log_event::do_apply_event(
     const_cast<Relay_log_info*>(rli)->tables_to_lock_count++;
     /* 'memory' is freed in clear_tables_to_lock */
   }
+  else  // FILTERED_OUT, SAME_ID_MAPPING_*
+  {
+    /*
+      If mapped already but with different properties, we raise an
+      error.
+      If mapped already but with same properties we skip the event.
+      If filtered out we skip the event.
 
-  DBUG_RETURN(error);
+      In all three cases, we need to free the memory previously 
+      allocated.
+     */
+    if (tblmap_status == SAME_ID_MAPPING_DIFFERENT_TABLE)
+    {
+      /*
+        Something bad has happened. We need to stop the slave as strange things
+        could happen if we proceed: slave crash, wrong table being updated, ...
+        As a consequence we push an error in this case.
+       */
+
+      char buf[256];
+
+      my_snprintf(buf, sizeof(buf), 
+                  "Found table map event mapping table id %u which "
+                  "was already mapped but with different settings.",
+                  table_list->table_id);
+
+      if (thd->slave_thread)
+        rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, 
+                    ER(ER_SLAVE_FATAL_ERROR), buf);
+      else
+        /* 
+          For the cases in which a 'BINLOG' statement is set to 
+          execute in a user session 
+         */
+        my_printf_error(ER_SLAVE_FATAL_ERROR, ER(ER_SLAVE_FATAL_ERROR), 
+                        MYF(0), buf);
+    } 
+    
+    my_free(memory, MYF(0));
+  }
+
+  DBUG_RETURN(tblmap_status == SAME_ID_MAPPING_DIFFERENT_TABLE);
 }
 
 Log_event::enum_skip_reason
@@ -9220,7 +9350,8 @@ int Rows_log_event::find_row(const Relay
   restart_rnd_next:
       error= table->file->rnd_next(table->record[0]);
 
-      DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
+      if (error)
+        DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
       switch (error) {
 
       case 0:

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2011-07-03 15:47:37 +0000
+++ b/sql/mysql_priv.h	2011-07-07 08:06:59 +0000
@@ -1476,13 +1476,6 @@ SQL_SELECT *make_select(TABLE *head, tab
 extern Item **not_found_item;
 
 /*
-  A set of constants used for checking non aggregated fields and sum
-  functions mixture in the ONLY_FULL_GROUP_BY_MODE.
-*/
-#define NON_AGG_FIELD_USED  1
-#define SUM_FUNC_USED       2
-
-/*
   This enumeration type is used only by the function find_item_in_list
   to return the info on how an item has been resolved against a list
   of possibly aliased items.

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-07-03 15:47:37 +0000
+++ b/sql/mysqld.cc	2011-07-07 08:06:59 +0000
@@ -8973,12 +8973,15 @@ fn_format_relative_to_data_home(char * t
 bool is_secure_file_path(char *path)
 {
   char buff1[FN_REFLEN], buff2[FN_REFLEN];
+  size_t opt_secure_file_priv_len;
   /*
     All paths are secure if opt_secure_file_path is 0
   */
   if (!opt_secure_file_priv)
     return TRUE;
 
+  opt_secure_file_priv_len= strlen(opt_secure_file_priv);
+
   if (strlen(path) >= FN_REFLEN)
     return FALSE;
 
@@ -8996,11 +8999,24 @@ bool is_secure_file_path(char *path)
       return FALSE;
   }
   convert_dirname(buff2, buff1, NullS);
-  if (strncmp(opt_secure_file_priv, buff2, strlen(opt_secure_file_priv)))
-    return FALSE;
+  if (!lower_case_file_system)
+  {
+    if (strncmp(opt_secure_file_priv, buff2, opt_secure_file_priv_len))
+      return FALSE;
+  }
+  else
+  {
+    if (files_charset_info->coll->strnncoll(files_charset_info,
+                                            (uchar *) buff2, strlen(buff2),
+                                            (uchar *) opt_secure_file_priv,
+                                            opt_secure_file_priv_len,
+                                            TRUE))
+      return FALSE;
+  }
   return TRUE;
 }
 
+
 static int fix_paths(void)
 {
   char buff[FN_REFLEN],*pos;

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2011-07-03 15:47:37 +0000
+++ b/sql/sp_head.cc	2011-07-07 08:06:59 +0000
@@ -2403,7 +2403,8 @@ bool check_show_routine_access(THD *thd,
   bzero((char*) &tables,sizeof(tables));
   tables.db= (char*) "mysql";
   tables.table_name= tables.alias= (char*) "proc";
-  *full_access= (!check_table_access(thd, SELECT_ACL, &tables, 1, TRUE) ||
+  *full_access= ((!check_table_access(thd, SELECT_ACL, &tables, 1, TRUE) &&
+                  (tables.grant.privilege & SELECT_ACL) != 0) ||
                  (!strcmp(sp->m_definer_user.str,
                           thd->security_ctx->priv_user) &&
                   !strcmp(sp->m_definer_host.str,

=== modified file 'sql/sql_connect.cc'
--- a/sql/sql_connect.cc	2011-07-03 15:47:37 +0000
+++ b/sql/sql_connect.cc	2011-07-05 22:56:51 +0000
@@ -21,23 +21,10 @@
 
 #include "mysql_priv.h"
 
-#ifdef HAVE_OPENSSL
-/*
-  Without SSL the handshake consists of one packet. This packet
-  has both client capabilites and scrambled password.
-  With SSL the handshake might consist of two packets. If the first
-  packet (client capabilities) has CLIENT_SSL flag set, we have to
-  switch to SSL and read the second packet. The scrambled password
-  is in the second packet and client_capabilites field will be ignored.
-  Maybe it is better to accept flags other than CLIENT_SSL from the
-  second packet?
-*/
-#define SSL_HANDSHAKE_SIZE      2
-#define NORMAL_HANDSHAKE_SIZE   6
-#define MIN_HANDSHAKE_SIZE      2
-#else
-#define MIN_HANDSHAKE_SIZE      6
-#endif /* HAVE_OPENSSL */
+/** Size of the header fields of an authentication packet. */
+#define AUTH_PACKET_HEADER_SIZE_PROTO_41    32
+#define AUTH_PACKET_HEADER_SIZE_PROTO_40    5  
+#define AUTH_PACKET_HEADER_SIZE_CONNJ_SSL   4
 
 #ifdef __WIN__
 extern void win_install_sigabrt_handler();
@@ -822,6 +809,14 @@ static int check_connection(THD *thd)
   ulong pkt_len= 0;
   char *end;
 
+  bool packet_has_required_size= false;
+  char *db;
+  size_t db_len;
+  char *passwd;
+  size_t passwd_len;
+  char *user;
+  size_t user_len;
+
   DBUG_PRINT("info",
              ("New connection received on %s", vio_description(net->vio)));
 #ifdef SIGNAL_WITH_VIO_CLOSE
@@ -930,8 +925,7 @@ static int check_connection(THD *thd)
     /* At this point we write connection message and read reply */
     if (net_write_command(net, (uchar) protocol_version, (uchar*) "", 0,
                           (uchar*) buff, (size_t) (end-buff)) ||
-	(pkt_len= my_net_read(net)) == packet_error ||
-	pkt_len < MIN_HANDSHAKE_SIZE)
+	(pkt_len= my_net_read(net)) == packet_error)
     {
       inc_host_errors(&thd->remote.sin_addr);
       my_error(ER_HANDSHAKE_ERROR, MYF(0));
@@ -946,22 +940,82 @@ static int check_connection(THD *thd)
   if (thd->packet.alloc(thd->variables.net_buffer_length))
     return 1; /* The error is set by alloc(). */
 
-  thd->client_capabilities= uint2korr(net->read_pos);
+  uint charset_code= 0;
+  end= (char *)net->read_pos;
+  /*
+    In order to safely scan a head for '\0' string terminators
+    we must keep track of how many bytes remain in the allocated
+    buffer or we might read past the end of the buffer.
+  */
+  size_t bytes_remaining_in_packet= pkt_len;
+  
+  /*
+    Peek ahead on the client capability packet and determine which version of
+    the protocol should be used.
+  */
+  if (bytes_remaining_in_packet < 2)
+    goto error;
+  
+  thd->client_capabilities= uint2korr(end);
+
+  /*
+    Connector/J only sends client capabilities (4 bytes) before starting SSL
+    negotiation so we don't have char_set and other information for client in
+    packet read. In that case, skip reading those information. The below code 
+    is patch for this.
+  */
+  if(bytes_remaining_in_packet == AUTH_PACKET_HEADER_SIZE_CONNJ_SSL &&
+     (thd->client_capabilities & CLIENT_SSL))
+  {
+    thd->client_capabilities= uint4korr(end);
+    thd->max_client_packet_length= global_system_variables.max_allowed_packet;
+    charset_code= default_charset_info->number;
+    end+= AUTH_PACKET_HEADER_SIZE_CONNJ_SSL;
+    bytes_remaining_in_packet-= AUTH_PACKET_HEADER_SIZE_CONNJ_SSL;
+    goto skip_to_ssl;
+  }
+
+  if (thd->client_capabilities & CLIENT_PROTOCOL_41)
+    packet_has_required_size= bytes_remaining_in_packet >= 
+      AUTH_PACKET_HEADER_SIZE_PROTO_41;
+  else
+    packet_has_required_size= bytes_remaining_in_packet >=
+      AUTH_PACKET_HEADER_SIZE_PROTO_40;
+  
+  if (!packet_has_required_size)
+    goto error;
+  
   if (thd->client_capabilities & CLIENT_PROTOCOL_41)
   {
-    thd->client_capabilities|= ((ulong) uint2korr(net->read_pos+2)) << 16;
-    thd->max_client_packet_length= uint4korr(net->read_pos+4);
-    DBUG_PRINT("info", ("client_character_set: %d", (uint) net->read_pos[8]));
-    if (thd_init_client_charset(thd, (uint) net->read_pos[8]))
-      return 1;
-    thd->update_charset();
-    end= (char*) net->read_pos+32;
+    thd->client_capabilities= uint4korr(end);
+    thd->max_client_packet_length= uint4korr(end + 4);
+    charset_code= (uint)(uchar)*(end + 8);
+    /*
+      Skip 23 remaining filler bytes which have no particular meaning.
+    */
+    end+= AUTH_PACKET_HEADER_SIZE_PROTO_41;
+    bytes_remaining_in_packet-= AUTH_PACKET_HEADER_SIZE_PROTO_41;
   }
   else
   {
-    thd->max_client_packet_length= uint3korr(net->read_pos+2);
-    end= (char*) net->read_pos+5;
+    thd->client_capabilities= uint2korr(end);
+    thd->max_client_packet_length= uint3korr(end + 2);
+    end+= AUTH_PACKET_HEADER_SIZE_PROTO_40;
+    bytes_remaining_in_packet-= AUTH_PACKET_HEADER_SIZE_PROTO_40;
+    /**
+      Old clients didn't have their own charset. Instead the assumption
+      was that they used what ever the server used.
+    */
+    charset_code= default_charset_info->number;
   }
+
+skip_to_ssl:
+
+  DBUG_PRINT("info", ("client_character_set: %u", charset_code));
+  if (thd_init_client_charset(thd, charset_code))
+    goto error;
+  thd->update_charset();
+
   /*
     Disable those bits which are not supported by the server.
     This is a precautionary measure, if the client lies. See Bug#27944.
@@ -972,42 +1026,63 @@ static int check_connection(THD *thd)
     thd->variables.sql_mode|= MODE_IGNORE_SPACE;
 #ifdef HAVE_OPENSSL
   DBUG_PRINT("info", ("client capabilities: %lu", thd->client_capabilities));
+  
+  /*
+    If client requested SSL then we must stop parsing, try to switch to SSL,
+    and wait for the client to send a new handshake packet.
+    The client isn't expected to send any more bytes until SSL is initialized.
+  */
   if (thd->client_capabilities & CLIENT_SSL)
   {
     /* Do the SSL layering. */
     if (!ssl_acceptor_fd)
-    {
-      inc_host_errors(&thd->remote.sin_addr);
-      my_error(ER_HANDSHAKE_ERROR, MYF(0));
-      return 1;
-    }
+      goto error;
+
     DBUG_PRINT("info", ("IO layer change in progress..."));
     if (sslaccept(ssl_acceptor_fd, net->vio, net->read_timeout))
     {
       DBUG_PRINT("error", ("Failed to accept new SSL connection"));
-      inc_host_errors(&thd->remote.sin_addr);
-      my_error(ER_HANDSHAKE_ERROR, MYF(0));
-      return 1;
+      goto error;
     }
+    
     DBUG_PRINT("info", ("Reading user information over SSL layer"));
-    if ((pkt_len= my_net_read(net)) == packet_error ||
-	pkt_len < NORMAL_HANDSHAKE_SIZE)
+    if ((pkt_len= my_net_read(net)) == packet_error)
     {
       DBUG_PRINT("error", ("Failed to read user information (pkt_len= %lu)",
 			   pkt_len));
-      inc_host_errors(&thd->remote.sin_addr);
-      my_error(ER_HANDSHAKE_ERROR, MYF(0));
-      return 1;
+      goto error;
     }
-  }
-#endif /* HAVE_OPENSSL */
+    /*
+      A new packet was read and the statistics reflecting the remaining bytes
+      in the packet must be updated.
+    */
+    bytes_remaining_in_packet= pkt_len;
 
-  if (end > (char *)net->read_pos + pkt_len)
-  {
-    inc_host_errors(&thd->remote.sin_addr);
-    my_error(ER_HANDSHAKE_ERROR, MYF(0));
-    return 1;
+    /*
+      After the SSL handshake is performed the client resends the handshake
+      packet but because of legacy reasons we chose not to parse the packet
+      fields a second time and instead only assert the length of the packet.
+    */
+    if (thd->client_capabilities & CLIENT_PROTOCOL_41)
+    {
+      
+      packet_has_required_size= bytes_remaining_in_packet >= 
+        AUTH_PACKET_HEADER_SIZE_PROTO_41;
+      end= (char *)net->read_pos + AUTH_PACKET_HEADER_SIZE_PROTO_41;
+      bytes_remaining_in_packet -= AUTH_PACKET_HEADER_SIZE_PROTO_41;
+    }
+    else
+    {
+      packet_has_required_size= bytes_remaining_in_packet >= 
+        AUTH_PACKET_HEADER_SIZE_PROTO_40;
+      end= (char *)net->read_pos + AUTH_PACKET_HEADER_SIZE_PROTO_40;
+      bytes_remaining_in_packet -= AUTH_PACKET_HEADER_SIZE_PROTO_40;
+    }
+  
+    if (!packet_has_required_size)
+      goto error;
   }
+#endif /* HAVE_OPENSSL */
 
   if (thd->client_capabilities & CLIENT_INTERACTIVE)
     thd->variables.net_wait_timeout= thd->variables.net_interactive_timeout;
@@ -1028,29 +1103,17 @@ static int check_connection(THD *thd)
   else
     get_string= get_40_protocol_string;
 
-  /*
-    In order to safely scan a head for '\0' string terminators
-    we must keep track of how many bytes remain in the allocated
-    buffer or we might read past the end of the buffer.
-  */
-  size_t bytes_remaining_in_packet= pkt_len - (end - (char *)net->read_pos);
-
-  size_t user_len;
-  char *user= get_string(&end, &bytes_remaining_in_packet, &user_len);
+  user= get_string(&end, &bytes_remaining_in_packet, &user_len);
   if (user == NULL)
-  {
-    inc_host_errors(&thd->remote.sin_addr);
-    my_error(ER_HANDSHAKE_ERROR, MYF(0));
-    return 1;
-  }
+    goto error;
 
   /*
     Old clients send a null-terminated string as password; new clients send
     the size (1 byte) + string (not null-terminated). Hence in case of empty
     password both send '\0'.
   */
-  size_t passwd_len= 0;
-  char *passwd= NULL;
+  passwd_len= 0;
+  passwd= NULL;
 
   if (thd->client_capabilities & CLIENT_SECURE_CONNECTION)
   {
@@ -1069,24 +1132,16 @@ static int check_connection(THD *thd)
   }
 
   if (passwd == NULL)
-  {
-    inc_host_errors(&thd->remote.sin_addr);
-    my_error(ER_HANDSHAKE_ERROR, MYF(0));
-    return 1;
-  }
+    goto error;
 
-  size_t db_len= 0;
-  char *db= NULL;
+  db_len= 0;
+  db= NULL;
 
   if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB)
   {
     db= get_string(&end, &bytes_remaining_in_packet, &db_len);
     if (db == NULL)
-    {
-      inc_host_errors(&thd->remote.sin_addr);
-      my_error(ER_HANDSHAKE_ERROR, MYF(0));
-      return 1;
-    }
+      goto error;
   }
 
   char db_buff[NAME_LEN + 1];           // buffer to store db in utf8
@@ -1134,11 +1189,14 @@ static int check_connection(THD *thd)
     user[user_len]= '\0';
   }
 
-  if (thd->main_security_ctx.user)
-    x_free(thd->main_security_ctx.user);
   if (!(thd->main_security_ctx.user= my_strdup(user, MYF(MY_WME))))
     return 1; /* The error is set by my_strdup(). */
   return check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE);
+  
+error:
+  inc_host_errors(&thd->remote.sin_addr);
+  my_error(ER_HANDSHAKE_ERROR, MYF(0));
+  return 1;
 }
 
 
@@ -1388,3 +1446,4 @@ end_thread:
   }
 }
 #endif /* EMBEDDED_LIBRARY */
+

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2011-07-03 15:47:37 +0000
+++ b/sql/sql_lex.cc	2011-07-07 08:06:59 +0000
@@ -1623,6 +1623,8 @@ void st_select_lex::init_query()
   nest_level= 0;
   link_next= 0;
   lock_option= TL_READ_DEFAULT;
+  m_non_agg_field_used= false;
+  m_agg_func_used= false;
 }
 
 void st_select_lex::init_select()
@@ -1653,7 +1655,8 @@ void st_select_lex::init_select()
   non_agg_fields.empty();
   cond_value= having_value= Item::COND_UNDEF;
   inner_refs_list.empty();
-  full_group_by_flag= 0;
+  m_non_agg_field_used= false;
+  m_agg_func_used= false;
 }
 
 /*

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2011-07-03 15:47:37 +0000
+++ b/sql/sql_lex.h	2011-07-07 08:06:59 +0000
@@ -715,16 +715,7 @@ public:
     joins on the right.
   */
   List<String> *prev_join_using;
-  /*
-    Bitmap used in the ONLY_FULL_GROUP_BY_MODE to prevent mixture of aggregate
-    functions and non aggregated fields when GROUP BY list is absent.
-    Bits:
-      0 - non aggregated fields are used in this select,
-          defined as NON_AGG_FIELD_USED.
-      1 - aggregate functions are used in this select,
-          defined as SUM_FUNC_USED.
-  */
-  uint8 full_group_by_flag;
+
   void init_query();
   void init_select();
   st_select_lex_unit* master_unit();
@@ -832,7 +823,22 @@ public:
 
   void clear_index_hints(void) { index_hints= NULL; }
 
-private:  
+  /*
+    For MODE_ONLY_FULL_GROUP_BY we need to maintain two flags:
+     - Non-aggregated fields are used in this select.
+     - Aggregate functions are used in this select.
+    In MODE_ONLY_FULL_GROUP_BY only one of these may be true.
+  */
+  bool non_agg_field_used() const { return m_non_agg_field_used; }
+  bool agg_func_used()      const { return m_agg_func_used; }
+
+  void set_non_agg_field_used(bool val) { m_non_agg_field_used= val; }
+  void set_agg_func_used(bool val)      { m_agg_func_used= val; }
+
+private:
+  bool m_non_agg_field_used;
+  bool m_agg_func_used;
+
   /* current index hint kind. used in filling up index_hints */
   enum index_hint_type current_index_hint_type;
   index_clause_map current_index_hint_clause;

=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc	2011-07-03 15:47:37 +0000
+++ b/sql/sql_load.cc	2011-07-07 08:06:59 +0000
@@ -350,21 +350,21 @@ int mysql_load(THD *thd,sql_exchange *ex
 
 #if !defined(__WIN__) && ! defined(__NETWARE__)
     MY_STAT stat_info;
-    if (!my_stat(name,&stat_info,MYF(MY_WME)))
-	    DBUG_RETURN(TRUE);
+    if (!my_stat(name, &stat_info, MYF(MY_WME)))
+      DBUG_RETURN(TRUE);
 
     // if we are not in slave thread, the file must be:
     if (!thd->slave_thread &&
-	      !((stat_info.st_mode & S_IROTH) == S_IROTH &&  // readable by others
-	        (stat_info.st_mode & S_IFLNK) != S_IFLNK && // and not a symlink
-	        ((stat_info.st_mode & S_IFREG) == S_IFREG ||
-	         (stat_info.st_mode & S_IFIFO) == S_IFIFO)))
+        !((stat_info.st_mode & S_IROTH) == S_IROTH &&  // readable by others
+          (stat_info.st_mode & S_IFLNK) != S_IFLNK &&  // and not a symlink
+          ((stat_info.st_mode & S_IFREG) == S_IFREG || // and a regular file
+           (stat_info.st_mode & S_IFIFO) == S_IFIFO))) // or FIFO
     {
-	    my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), name);
-	    DBUG_RETURN(TRUE);
+      my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), name);
+      DBUG_RETURN(TRUE);
     }
     if ((stat_info.st_mode & S_IFIFO) == S_IFIFO)
-	    is_fifo = 1;
+      is_fifo= 1;
 #endif
 
     if ((file=my_open(name,O_RDONLY,MYF(MY_WME))) < 0)

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2011-05-16 20:04:01 +0000
+++ b/sql/sql_partition.cc	2011-06-06 13:53:46 +0000
@@ -930,9 +930,6 @@ static bool fix_fields_part_func(THD *th
   const char *save_where;
   char* db_name;
   char db_name_string[FN_REFLEN];
-  bool save_use_only_table_context;
-  uint8 saved_full_group_by_flag;
-  nesting_map saved_allow_sum_func;
   DBUG_ENTER("fix_fields_part_func");
 
   if (part_info->fixed)
@@ -999,23 +996,26 @@ static bool fix_fields_part_func(THD *th
     of interesting side effects, both desirable and undesirable.
   */
 
-  save_use_only_table_context= thd->lex->use_only_table_context;
-  thd->lex->use_only_table_context= TRUE;
-  thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS;
-  saved_full_group_by_flag= thd->lex->current_select->full_group_by_flag;
-  saved_allow_sum_func= thd->lex->allow_sum_func;
-  thd->lex->allow_sum_func= 0;
+  {
+    const bool save_use_only_table_context= thd->lex->use_only_table_context;
+    thd->lex->use_only_table_context= TRUE;
+    thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS;
+    const bool save_agg_field= thd->lex->current_select->non_agg_field_used();
+    const bool save_agg_func=  thd->lex->current_select->agg_func_used();
+    const nesting_map saved_allow_sum_func= thd->lex->allow_sum_func;
+    thd->lex->allow_sum_func= 0;
   
-  error= func_expr->fix_fields(thd, (Item**)&func_expr);
+    error= func_expr->fix_fields(thd, (Item**)&func_expr);
 
-  /*
-    Restore full_group_by_flag and allow_sum_func,
-    fix_fields should not affect mysql_select later, see Bug#46923.
-  */
-  thd->lex->current_select->full_group_by_flag= saved_full_group_by_flag;
-  thd->lex->allow_sum_func= saved_allow_sum_func;
-
-  thd->lex->use_only_table_context= save_use_only_table_context;
+    /*
+      Restore agg_field/agg_func and allow_sum_func,
+      fix_fields should not affect mysql_select later, see Bug#46923.
+    */
+    thd->lex->current_select->set_non_agg_field_used(save_agg_field);
+    thd->lex->current_select->set_agg_func_used(save_agg_func);
+    thd->lex->allow_sum_func= saved_allow_sum_func;
+    thd->lex->use_only_table_context= save_use_only_table_context;
+  }
 
   context->table_list= save_table_list;
   context->first_name_resolution_table= save_first_table;

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-07-03 15:47:37 +0000
+++ b/sql/sql_select.cc	2011-07-07 08:06:59 +0000
@@ -426,19 +426,18 @@ inline int setup_without_group(THD *thd,
   int res;
   nesting_map save_allow_sum_func=thd->lex->allow_sum_func ;
   /* 
-    Need to save the value, so we can turn off only the new NON_AGG_FIELD
+    Need to save the value, so we can turn off only any new non_agg_field_used
     additions coming from the WHERE
   */
-  uint8 saved_flag= thd->lex->current_select->full_group_by_flag;
+  const bool saved_non_agg_field_used=
+    thd->lex->current_select->non_agg_field_used();
   DBUG_ENTER("setup_without_group");
 
   thd->lex->allow_sum_func&= ~(1 << thd->lex->current_select->nest_level);
   res= setup_conds(thd, tables, leaves, conds);
 
   /* it's not wrong to have non-aggregated columns in a WHERE */
-  if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY)
-    thd->lex->current_select->full_group_by_flag= saved_flag |
-      (thd->lex->current_select->full_group_by_flag & ~NON_AGG_FIELD_USED);
+  thd->lex->current_select->set_non_agg_field_used(saved_non_agg_field_used);
 
   thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
   res= res || setup_order(thd, ref_pointer_array, tables, fields, all_fields,
@@ -644,7 +643,8 @@ JOIN::prepare(Item ***rref_pointer_array
     aggregate functions with implicit grouping (there is no GROUP BY).
   */
   if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY && !group_list &&
-      select_lex->full_group_by_flag == (NON_AGG_FIELD_USED | SUM_FUNC_USED))
+      select_lex->non_agg_field_used() &&
+      select_lex->agg_func_used())
   {
     my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,
                ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0));

=== modified file 'storage/innodb_plugin/ChangeLog'
--- a/storage/innodb_plugin/ChangeLog	2011-06-30 10:18:54 +0000
+++ b/storage/innodb_plugin/ChangeLog	2011-07-05 22:56:51 +0000
@@ -37,6 +37,11 @@
 	* row/row0row.c, row/row0vers.c, trx/trx0rec.c:
 	Instrumentation for Bug#12612184 Race condition in row_upd_clust_rec()
 
+2011-05-19	The InnoDB Team
+
+	* row/row0row.c:
+	Fix Bug#12429576 Assertion failure on purge of column prefix index
+
 2011-04-07	The InnoDB Team
 
 	* handler/ha_innodb.cc, handler/ha_innodb.h, handler/handler0alter.cc:

=== modified file 'storage/innodb_plugin/row/row0row.c'
--- a/storage/innodb_plugin/row/row0row.c	2011-06-30 10:18:54 +0000
+++ b/storage/innodb_plugin/row/row0row.c	2011-07-07 21:29:30 +0000
@@ -148,24 +148,27 @@ row_build_index_entry(
 				continue;
 			}
 		} else if (dfield_is_ext(dfield)) {
-			/* This table should be in Antelope format
-			(ROW_FORMAT=REDUNDANT or ROW_FORMAT=COMPACT).
-			In that format, the maximum column prefix
+			/* This table is either in Antelope format
+			(ROW_FORMAT=REDUNDANT or ROW_FORMAT=COMPACT)
+			or a purge record where the ordered part of
+			the field is not external.
+			In Antelope, the maximum column prefix
 			index length is 767 bytes, and the clustered
 			index record contains a 768-byte prefix of
 			each off-page column. */
 			ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
 			len -= BTR_EXTERN_FIELD_REF_SIZE;
-			ut_a(ind_field->prefix_len <= len
-			     || dict_index_is_clust(index));
+			dfield_set_len(dfield, len);
 		}
 
 		/* If a column prefix index, take only the prefix. */
-		ut_ad(ind_field->prefix_len);
-		len = dtype_get_at_most_n_mbchars(
-			col->prtype, col->mbminlen, col->mbmaxlen,
-			ind_field->prefix_len, len, dfield_get_data(dfield));
-		dfield_set_len(dfield, len);
+		if (ind_field->prefix_len) {
+			len = dtype_get_at_most_n_mbchars(
+				col->prtype, col->mbminlen, col->mbmaxlen,
+				ind_field->prefix_len, len,
+				dfield_get_data(dfield));
+			dfield_set_len(dfield, len);
+		}
 	}
 
 	ut_ad(dtuple_check_typed(entry));

=== removed directory 'storage/ndb/test/sql'
=== removed file 'storage/ndb/test/sql/BANK.sql'
--- a/storage/ndb/test/sql/BANK.sql	2011-06-30 15:37:13 +0000
+++ b/storage/ndb/test/sql/BANK.sql	1970-01-01 00:00:00 +0000
@@ -1,60 +0,0 @@
--- Copyright (c) 2005 MySQL AB
--- Use is subject to license terms.
---
--- 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
-
-CREATE DATABASE IF NOT EXISTS BANK default charset=latin1 default collate=latin1_bin;
-USE BANK;
-DROP TABLE IF EXISTS GL;
-CREATE TABLE GL ( TIME BIGINT UNSIGNED NOT NULL,
-                  ACCOUNT_TYPE INT UNSIGNED NOT NULL,
-                  BALANCE INT UNSIGNED NOT NULL,
-                  DEPOSIT_COUNT INT UNSIGNED NOT NULL,
-                  DEPOSIT_SUM INT UNSIGNED NOT NULL,
-                  WITHDRAWAL_COUNT INT UNSIGNED NOT NULL,
-                  WITHDRAWAL_SUM INT UNSIGNED NOT NULL,
-                  PURGED INT UNSIGNED NOT NULL,
-                  PRIMARY KEY USING HASH (TIME,ACCOUNT_TYPE))
-   ENGINE = NDB;
-
-DROP TABLE IF EXISTS ACCOUNT;
-CREATE TABLE ACCOUNT ( ACCOUNT_ID INT UNSIGNED NOT NULL,
-                       OWNER INT UNSIGNED NOT NULL,
-                       BALANCE INT UNSIGNED NOT NULL,
-                       ACCOUNT_TYPE INT UNSIGNED NOT NULL,
-                       PRIMARY KEY USING HASH (ACCOUNT_ID))
-   ENGINE = NDB;
-
-DROP TABLE IF EXISTS TRANSACTION;
-CREATE TABLE TRANSACTION ( TRANSACTION_ID BIGINT UNSIGNED NOT NULL,
-                           ACCOUNT INT UNSIGNED NOT NULL,
-                           ACCOUNT_TYPE INT UNSIGNED NOT NULL,
-                           OTHER_ACCOUNT INT UNSIGNED NOT NULL,
-                           TRANSACTION_TYPE INT UNSIGNED NOT NULL,
-                           TIME BIGINT UNSIGNED NOT NULL,
-                           AMOUNT INT UNSIGNED NOT NULL,
-                           PRIMARY KEY USING HASH (TRANSACTION_ID,ACCOUNT))
-   ENGINE = NDB;
-
-DROP TABLE IF EXISTS SYSTEM_VALUES;
-CREATE TABLE SYSTEM_VALUES ( SYSTEM_VALUES_ID INT UNSIGNED NOT NULL,
-                             VALUE BIGINT UNSIGNED NOT NULL,
-                             PRIMARY KEY USING HASH (SYSTEM_VALUES_ID))
-   ENGINE = NDB;
-
-DROP TABLE IF EXISTS ACCOUNT_TYPE;
-CREATE TABLE ACCOUNT_TYPE ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL,
-                            DESCRIPTION CHAR(64) NOT NULL,
-                            PRIMARY KEY USING HASH (ACCOUNT_TYPE_ID))
-   ENGINE = NDB;

=== removed file 'storage/ndb/test/sql/T1.sql'
--- a/storage/ndb/test/sql/T1.sql	2011-06-30 15:37:13 +0000
+++ b/storage/ndb/test/sql/T1.sql	1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
--- Copyright (c) 2005 MySQL AB
--- Use is subject to license terms.
---
--- 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
-
-create database if not exists TEST_DB;
-use TEST_DB;
-drop table if exists T1;
-create table T1 (KOL1 int unsigned not null,
-                 KOL2 int unsigned not null,
-	         KOL3 int unsigned not null,
-	         KOL4 int unsigned not null,
-	         KOL5 int unsigned not null,
-	         primary key using hash(KOL1)) engine=ndb;

=== removed file 'storage/ndb/test/sql/test_create_drop.pl'
--- a/storage/ndb/test/sql/test_create_drop.pl	2010-12-28 23:47:05 +0000
+++ b/storage/ndb/test/sql/test_create_drop.pl	1970-01-01 00:00:00 +0000
@@ -1,196 +0,0 @@
-# Copyright (C) 2005 MySQL AB
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-use strict;
-use IO::Socket;
-use DBI;
-
-# mgm info
-my $mgmhost = "localhost";
-my $mgmport = 38101;
-
-# location of ndb_x_fs
-my $datadir = "c2";
-my @schemafiles = <$datadir/ndb_*_fs/D[12]/DBDICT/P0.SchemaLog>;
-@schemafiles or die "no schemafiles in $datadir";
-
-my $dsn;
-$dsn = "dbi:mysql:test:localhost;port=38100";
-
-# this works better for me
-my $cnf = $ENV{MYSQL_HOME} . "/var/my.cnf";
-$dsn = "dbi:mysql:database=test;host=localhost;mysql_read_default_file=$cnf";
-
-my $dbh;
-$dbh = DBI->connect($dsn, 'root', undef, { RaiseError => 0, PrintError => 0 });
-$dbh or die $DBI::errstr;
-
-# mgm commands
-
-my $mgm = undef;
-
-sub mgmconnect {
-  $mgm = IO::Socket::INET->new(
-    Proto => "tcp",
-    PeerHost => $mgmhost,
-    PeerPort => $mgmport);
-  $mgm or die "connect to mgm failed: $!";
-  $mgm->autoflush(1);
-};
-
-mgmconnect();
-warn "connected to mgm $mgmhost $mgmport\n";
-
-my $nodeinfo = {};
-
-sub getnodeinfo {
-  $nodeinfo = {};
-  $mgm->print("get status\n");
-  $mgm->print("\n");
-  while (defined($_ = $mgm->getline)) {
-    /^node\s+status/ && last;
-  }
-  while (defined($_ = $mgm->getline)) {
-    /^\s*$/ && last;
-    /^node\.(\d+)\.(\w+):\s*(\S+)/ && ($nodeinfo->{$1}{$2} = $3);
-  }
-}
-
-getnodeinfo();
-
-my @dbnode = ();
-for my $n (keys %$nodeinfo) {
-  my $p = $nodeinfo->{$n};
-  ($p->{type} eq 'NDB') && push(@dbnode, $n);
-}
-@dbnode = sort { $a <=> $b } @dbnode;
-@dbnode or die "mgm error, found no db nodes";
-warn "db nodes: @dbnode\n";
-
-sub restartnode {
-  my($n, $initialstart) = @_;
-  warn "restart node $n initialstart=$initialstart\n";
-  $mgm->print("restart node\n");
-  $mgm->print("node: $n\n");
-  $mgm->print("initialstart: $initialstart\n");
-  $mgm->print("\n");
-  while (1) {
-    sleep 5;
-    getnodeinfo();
-    my $status = $nodeinfo->{$n}{status};
-    my $sp = $nodeinfo->{$n}{startphase};
-    warn "node $n status: $status sp: $sp\n";
-    last if $status eq 'STARTED';
-  }
-}
-
-sub restartall {
-  warn "restart all\n";
-  $mgm->print("restart all\n");
-  $mgm->print("\n");
-  while (1) {
-    sleep 5;
-    getnodeinfo();
-    my $ok = 1;
-    for my $n (@dbnode) {
-      my $status = $nodeinfo->{$n}{status};
-      my $sp = $nodeinfo->{$n}{startphase};
-      warn "node $n status: $status sp: $sp\n";
-      $ok = 0 if $status ne 'STARTED';
-    }
-    last if $ok;
-  }
-}
-
-# the sql stuff
-
-my $maxtab = 300;
-my @tab = ();
-
-sub create {
-  my($n) = @_;
-  my $sql = "create table t$n (a int primary key, b varchar(20), key (b)) engine=ndb";
-  warn "create t$n\n";
-  $dbh->do($sql) or die "$sql\n$DBI::errstr";
-}
-
-sub drop {
-  my($n) = @_;
-  my $sql = "drop table t$n";
-  warn "drop t$n\n";
-  $dbh->do($sql) or die "$sql\n$DBI::errstr";
-}
-
-sub dropall {
-  for my $n (0..($maxtab-1)) {
-    my $sql = "drop table if exists t$n";
-    $dbh->do($sql) or die "$sql\n$DBI::errstr";
-  }
-}
-
-sub createdrop {
-  my $n = int(rand($maxtab));
-  if (! $tab[$n]) {
-    create($n);
-    $tab[$n] = 1;
-  } else {
-    drop($n);
-    $tab[$n] = 0;
-  }
-}
-
-sub checkschemafiles {
-  system("printSchemaFile -ce @schemafiles");
-  $? == 0 or die "schemafiles check failed";
-}
-
-sub randomrestart {
-  my($k) = @_;
-  my $s = int(rand(500));
-  if ($s < 2) {
-    my $i = $k % scalar(@dbnode);
-    my $n = $dbnode[$i];
-    my $initialstart = ($s < 1 ? 0 : 1);
-    restartnode($n, $initialstart);
-    return 1;
-  }
-  if ($s < 3) {
-    restartall();
-    return 1;
-  }
-  return 0;
-}
-
-# deterministic
-srand(1);
-
-warn "drop any old tables\n";
-dropall();
-
-my $loop = 1000000;
-for my $k (0..($loop-1)) {
-  warn "$k\n";
-  createdrop();
-  checkschemafiles();
-  if (randomrestart($k)) {
-    checkschemafiles();
-  }
-}
-
-$dbh->disconnect or die $DBI::errstr;
-
-# vim: set sw=2:

=== removed file 'storage/ndb/test/sql/test_range_bounds.pl'
--- a/storage/ndb/test/sql/test_range_bounds.pl	2010-12-28 23:47:05 +0000
+++ b/storage/ndb/test/sql/test_range_bounds.pl	1970-01-01 00:00:00 +0000
@@ -1,235 +0,0 @@
-# Copyright (C) 2005 MySQL AB
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library 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
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
-
-#
-# test range scan bounds
-# give option --all to test all cases
-# set MYSQL_HOME to installation top
-#
-
-use strict;
-use integer;
-use Getopt::Long;
-use DBI;
-
-my $opt_all = 0;
-my $opt_cnt = 5;
-my $opt_verbose = 0;
-GetOptions("all" => \$opt_all, "cnt=i" => \$opt_cnt, "verbose" => \$opt_verbose)
-  or die "options are:  --all --cnt=N --verbose";
-
-my $mysql_home = $ENV{MYSQL_HOME};
-defined($mysql_home) or die "no MYSQL_HOME";
-my $dsn = "dbi:mysql:database=test;host=localhost;mysql_read_default_file=$mysql_home/var/my.cnf";
-my $opts = { RaiseError => 0, PrintError => 0, AutoCommit => 1, };
-
-my $dbh;
-my $sth;
-my $sql;
-
-$dbh = DBI->connect($dsn, "root", undef, $opts) or die $DBI::errstr;
-
-my $table = 't';
-
-$sql = "drop table if exists $table";
-$dbh->do($sql) or die $DBI::errstr;
-
-sub cut ($$$) {
-  my($op, $key, $val) = @_;
-  $op = '==' if $op eq '=';
-  my(@w) = @$val;
-  eval "\@w = grep(\$_ $op $key, \@w)";
-  $@ and die $@;
-  return [ @w ];
-}
-
-sub mkdummy ($) {
-  my ($val) = @_;
-  return {
-    'dummy' => 1,
-    'exp' => '9 = 9',
-    'res' => $val,
-  };
-}
-
-sub mkone ($$$$) {
-  my($col, $op, $key, $val) = @_;
-  my $res = cut($op, $key, $val);
-  return {
-    'exp' => "$col $op $key",
-    'res' => $res,
-  };
-}
-
-sub mktwo ($$$$$$) {
-  my($col, $op1, $key1, $op2, $key2, $val) = @_;
-  my $res = cut($op2, $key2, cut($op1, $key1, $val));
-  return {
-    'exp' => "$col $op1 $key1 and $col $op2 $key2",
-    'res' => $res,
-  };
-}
-
-sub mkall ($$$$) {
-  my($col, $key1, $key2, $val) = @_;
-  my @a = ();
-  my $p = mkdummy($val);
-  push(@a, $p) if $opt_all;
-  my @ops = qw(< <= = >= >);
-  for my $op (@ops) {
-    my $p = mkone($col, $op, $key1, $val);
-    push(@a, $p) if $opt_all || @{$p->{res}} != 0;
-  }
-  my @ops1 = $opt_all ? @ops : qw(= >= >);
-  my @ops2 = $opt_all ? @ops : qw(<= <);
-  for my $op1 (@ops1) {
-    for my $op2 (@ops2) {
-      my $p = mktwo($col, $op1, $key1, $op2, $key2, $val);
-      push(@a, $p) if $opt_all || @{$p->{res}} != 0;
-    }
-  }
-  warn scalar(@a)." cases\n" if $opt_verbose;
-  return \@a;
-}
-
-my $casecnt = 0;
-
-sub verify ($$$) {
-  my($sql, $ord, $res) = @_;
-  warn "$sql\n" if $opt_verbose;
-  $sth = $dbh->prepare($sql) or die "prepare: $sql: $DBI::errstr";
-  $sth->execute() or die "execute: $sql: $DBI::errstr";
-  #
-  # BUG: execute can return success on error so check again
-  #
-  $sth->err and die "execute: $sql: $DBI::errstr";
-  my @out = ();
-  for my $b (@{$res->[0]}) {
-    for my $c (@{$res->[1]}) {
-      for my $d (@{$res->[2]}) {
-	push(@out, [$b, $c, $d]);
-      }
-    }
-  }
-  if ($ord) {
-    @out = sort {
-      $ord * ($a->[0] - $b->[0]) ||
-      $ord * ($a->[1] - $b->[1]) ||
-      $ord * ($a->[2] - $b->[2]) ||
-      0
-    } @out;
-  }
-  my $cnt = scalar @out;
-  my $n = 0;
-  while (1) {
-    my $row = $sth->fetchrow_arrayref;
-    $row || last;
-    @$row == 3 or die "bad row: $sql:  @$row";
-    for my $v (@$row) {
-      $v =~ s/^\s+|\s+$//g;
-      $v =~ /^\d+$/ or die "bad value: $sql:  $v";
-    }
-    if ($ord) {
-      my $out = $out[$n];
-      $row->[0] == $out->[0] &&
-      $row->[1] == $out->[1] &&
-      $row->[2] == $out->[2] or
-        die "$sql: row $n: got row @$row != @$out";
-    }
-    $n++;
-  }
-  $sth->err and die "fetch: $sql: $DBI::errstr";
-  $n == $cnt or die "verify: $sql: got row count $n != $cnt";
-  $casecnt++;
-}
-
-for my $nn ("bcd", "") {
-  my %nn;
-  for my $x (qw(b c d)) {
-    $nn{$x} = $nn =~ /$x/ ? "not null" : "null";
-  }
-  warn "create table\n";
-  $sql = <<EOF;
-create table $table (
-  a int primary key,
-  b int $nn{b},
-  c int $nn{c},
-  d int $nn{d},
-  index (b, c, d)
-) engine=ndb
-EOF
-  $dbh->do($sql) or die $DBI::errstr;
-  warn "insert\n";
-  $sql = "insert into $table values(?, ?, ?, ?)";
-  $sth = $dbh->prepare($sql) or die $DBI::errstr;
-  my @val = (0..($opt_cnt-1));
-  my $v0 = 0;
-  for my $v1 (@val) {
-    for my $v2 (@val) {
-      for my $v3 (@val) {
-	$sth->bind_param(1, $v0) or die $DBI::errstr;
-	$sth->bind_param(2, $v1) or die $DBI::errstr;
-	$sth->bind_param(3, $v2) or die $DBI::errstr;
-	$sth->bind_param(4, $v3) or die $DBI::errstr;
-	$sth->execute or die $DBI::errstr;
-	$v0++;
-      }
-    }
-  }
-  warn "generate cases\n";
-  my $key1 = 1;
-  my $key2 = 3;
-  my $a1 = mkall('b', $key1, $key2, \@val);
-  my $a2 = mkall('c', $key1, $key2, \@val);
-  my $a3 = mkall('d', $key1, $key2, \@val);
-  warn "select\n";
-  for my $ord (0, +1, -1) {
-    my $orderby =
-      $ord == 0 ? "" :
-      $ord == +1 ? " order by b, c, d" :
-      $ord == -1 ? " order by b desc, c desc, d desc" : die "not here";
-    for my $p1 (@$a1) {
-      my $res = [ $p1->{res}, \@val, \@val ];
-      $sql = "select b, c, d from $table" .
-	     " where $p1->{exp}" .
-	     $orderby;
-      verify($sql, $ord, $res);
-      for my $p2 (@$a2) {
-	my $res = [ $p1->{res}, $p2->{res}, \@val ];
-	$sql = "select b, c, d from $table" .
-	       " where $p1->{exp} and $p2->{exp}" .
-	       $orderby;
-	verify($sql, $ord, $res);
-	for my $p3 (@$a3) {
-	  my $res = [ $p1->{res}, $p2->{res}, $p3->{res} ];
-	  $sql = "select b, c, d from $table" .
-		 " where $p1->{exp} and $p2->{exp} and $p3->{exp}" .
-		 $orderby;
-	  verify($sql, $ord, $res);
-	}
-      }
-    }
-  }
-  warn "drop table\n";
-  $sql = "drop table $table";
-  $dbh->do($sql) or die $DBI::errstr;
-}
-
-warn "verified $casecnt cases\n";
-warn "done\n";
-
-# vim: set sw=2:

=== modified file 'support-files/mysql.spec.sh'
--- a/support-files/mysql.spec.sh	2011-06-30 15:37:13 +0000
+++ b/support-files/mysql.spec.sh	2011-07-07 15:22:24 +0000
@@ -798,13 +798,12 @@ else
 fi
 # echo "Analyzed: SERVER_TO_START=$SERVER_TO_START"
 if [ ! -d $mysql_datadir/mysql ] ; then
-	mkdir $mysql_datadir/mysql;
+	mkdir $mysql_datadir/mysql $mysql_datadir/test
 	echo "MySQL RPM installation of version $NEW_VERSION" >> $STATUS_FILE
 else
 	# If the directory exists, we may assume it is an upgrade.
 	echo "MySQL RPM upgrade to version $NEW_VERSION" >> $STATUS_FILE
 fi
-if [ ! -d $mysql_datadir/test ] ; then mkdir $mysql_datadir/test; fi
 
 # ----------------------------------------------------------------------
 # Make MySQL start/shutdown automatically when the machine does it.
@@ -837,7 +836,12 @@ chown -R %{mysqld_user}:%{mysqld_group}
 # ----------------------------------------------------------------------
 # Initiate databases if needed
 # ----------------------------------------------------------------------
-%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
+if ! grep '^MySQL RPM upgrade' $STATUS_FILE >/dev/null 2>&1 ; then
+	# Fix bug#45415: no "mysql_install_db" on an upgrade
+	# Do this as a negative to err towards more "install" runs
+	# rather than to miss one.
+	%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
+fi
 
 # ----------------------------------------------------------------------
 # Upgrade databases if needed would go here - but it cannot be automated yet
@@ -1161,6 +1165,12 @@ fi
 # merging BK trees)
 ##############################################################################
 %changelog
+* Thu Jul 07 2011 Joerg Bruehe <joerg.bruehe@stripped>
+
+- Fix bug#45415: "rpm upgrade recreates test database"
+  Let the creation of the "test" database happen only during a new installation,
+  not in an RPM upgrade.
+  This affects both the "mkdir" and the call of "mysql_install_db".
 
 * Thu Feb 03 2011 Joerg Bruehe <joerg.bruehe@stripped>
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-mtr branch (bjorn.munch:3005 to 3006) Bjorn Munch17 Jul