]> review.fuel-infra Code Review - packages/trusty/mysql-wsrep-5.6.git/commitdiff
mysql 5.6.36 46/35446/4
authorDmitry Teselkin <dteselkin@mirantis.com>
Thu, 25 May 2017 15:03:06 +0000 (18:03 +0300)
committerDmitry Teselkin <dteselkin@mirantis.com>
Fri, 26 May 2017 09:45:14 +0000 (12:45 +0300)
* Update mysql to 5.6.36
* d/p/* - quilt refresh to avoid fuzz
* d/rules - switch to bundled editline instead of system to avoid broken
  build

Closes-Bug: #1691463
Related-Prod: https://mirantis.jira.com/browse/PROD-11416

Change-Id: I42628acf53354767ee348941ae6b2a4180514988

244 files changed:
debian/changelog
debian/patches/fix_standalone_tests.patch
debian/patches/hurd.patch
debian/patches/kfreebsd_tests.patch
debian/patches/scripts__mysqld_safe.sh__signals.patch
debian/rules
mysql-wsrep-5.6/CMakeLists.txt
mysql-wsrep-5.6/README
mysql-wsrep-5.6/VERSION
mysql-wsrep-5.6/client/client_priv.h
mysql-wsrep-5.6/client/mysql.cc
mysql-wsrep-5.6/client/mysql_upgrade.c
mysql-wsrep-5.6/client/mysqladmin.cc
mysql-wsrep-5.6/client/mysqlcheck.c
mysql-wsrep-5.6/client/mysqldump.c
mysql-wsrep-5.6/client/mysqlimport.c
mysql-wsrep-5.6/client/mysqlshow.c
mysql-wsrep-5.6/client/mysqlslap.c
mysql-wsrep-5.6/client/mysqltest.cc
mysql-wsrep-5.6/cmake/os/SunOS.cmake
mysql-wsrep-5.6/cmake/os/Windows.cmake
mysql-wsrep-5.6/cmake/readline.cmake
mysql-wsrep-5.6/config.h.cmake
mysql-wsrep-5.6/configure.cmake
mysql-wsrep-5.6/include/mysql.h
mysql-wsrep-5.6/include/mysql.h.pp
mysql-wsrep-5.6/include/mysql_com.h
mysql-wsrep-5.6/include/sql_common.h
mysql-wsrep-5.6/include/sslopt-case.h
mysql-wsrep-5.6/include/sslopt-vars.h
mysql-wsrep-5.6/include/welcome_copyright_notice.h
mysql-wsrep-5.6/mysql-test/collections/default.weekly.basic
mysql-wsrep-5.6/mysql-test/lib/mtr_cases.pm
mysql-wsrep-5.6/mysql-test/mysql-test-run.pl
mysql-wsrep-5.6/mysql-test/r/distinct.result
mysql-wsrep-5.6/mysql-test/r/events_2.result
mysql-wsrep-5.6/mysql-test/r/group_min_max_innodb.result
mysql-wsrep-5.6/mysql-test/r/loaddata.result
mysql-wsrep-5.6/mysql-test/r/log_tables-big.result
mysql-wsrep-5.6/mysql-test/r/mysql_config_editor.result
mysql-wsrep-5.6/mysql-test/r/mysqldump.result
mysql-wsrep-5.6/mysql-test/r/parser.result
mysql-wsrep-5.6/mysql-test/r/ps.result
mysql-wsrep-5.6/mysql-test/r/ssl_mode.result
mysql-wsrep-5.6/mysql-test/r/ssl_mode_no_ssl.result
mysql-wsrep-5.6/mysql-test/r/symlink.result
mysql-wsrep-5.6/mysql-test/std_data/checkDBI_DBD-mysql.pl
mysql-wsrep-5.6/mysql-test/suite/innodb/r/end_range_check.result [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/innodb/r/ibuf_not_empty.result [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/innodb/r/innodb_force_recovery.result
mysql-wsrep-5.6/mysql-test/suite/innodb/r/innodb_io_pf.result [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/innodb/r/undo_space_id.result [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/innodb/t/end_range_check.test [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/innodb/t/ibuf_not_empty-master.opt [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/innodb/t/ibuf_not_empty.test [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/innodb/t/innodb_force_recovery.test
mysql-wsrep-5.6/mysql-test/suite/innodb/t/innodb_io_pf.test [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/innodb/t/undo_space_id.test [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/opt_trace/include/bugs.inc
mysql-wsrep-5.6/mysql-test/suite/opt_trace/r/bugs_no_prot_all.result
mysql-wsrep-5.6/mysql-test/suite/opt_trace/r/bugs_no_prot_none.result
mysql-wsrep-5.6/mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result
mysql-wsrep-5.6/mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result
mysql-wsrep-5.6/mysql-test/suite/perfschema/r/start_server_1_digest.result [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/perfschema/t/start_server_1_digest-master.opt [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/perfschema/t/start_server_1_digest.test [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_alter_user.result [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_gtid_sql_until_before_after.result
mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_gtid_temp_table.result
mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_master_pos_wait.result
mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_parallel_switch_sequential.result
mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_sbm_fake_rotate_event.result [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_alter_user.test [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_gtid_sql_until_before_after.test
mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_gtid_temp_table.test
mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_master_pos_wait.test
mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_parallel_switch_sequential.test
mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_sbm_fake_rotate_event.test [new file with mode: 0644]
mysql-wsrep-5.6/mysql-test/t/disabled.def
mysql-wsrep-5.6/mysql-test/t/distinct.test
mysql-wsrep-5.6/mysql-test/t/events_2.test
mysql-wsrep-5.6/mysql-test/t/group_min_max_innodb.test
mysql-wsrep-5.6/mysql-test/t/loaddata.test
mysql-wsrep-5.6/mysql-test/t/log_tables-big.test
mysql-wsrep-5.6/mysql-test/t/mysqldump.test
mysql-wsrep-5.6/mysql-test/t/parser.test
mysql-wsrep-5.6/mysql-test/t/ps.test
mysql-wsrep-5.6/mysql-test/t/symlink.test
mysql-wsrep-5.6/mysql-test/valgrind.supp
mysql-wsrep-5.6/packaging/WiX/custom_ui.wxs
mysql-wsrep-5.6/packaging/WiX/mysql_server_extra.wxs.in
mysql-wsrep-5.6/packaging/deb-in/CMakeLists.txt [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/README [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/README.Maintainer [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/changelog.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/compat [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/control.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/copyright.com.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/copyright.gpl.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/extra/apparmor-profile [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/extra/conf.d/mysql.cnf [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/extra/my.cnf.fallback [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/extra/mysql-helpers [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/extra/mysql-systemd-start [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/extra/mysql.cnf [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/extra/mysql_embedded.1 [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/extra/mysqld.cnf [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/libmysqlclient-dev.install.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/libmysqlclient-dev.lintian-overrides.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/libmysqlclient18.install.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/libmysqlclient18.lintian-overrides.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/libmysqld-dev.install.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/libmysqld-dev.lintian-overrides.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-client.install.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-client.lintian-overrides.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-common.dirs.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-common.install.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-common.lintian-overrides.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-common.postinst.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-common.postrm.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-bench.install.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-bench.lintian-overrides.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.conffiles.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.install.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.lintian-overrides.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.config.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.dirs.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.install.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.lintian-overrides.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.mysql.init.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.mysql.service.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.postinst.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.postrm.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.preinst.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.prerm.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.templates.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-source.install.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-source.lintian-overrides.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-test.install.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-test.links.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-test.lintian-overrides.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-server.install.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-server.lintian-overrides.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-testsuite.install.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/mysql-testsuite.lintian-overrides.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/patches/series [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/rules.in [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/source/format [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/source/include-binaries [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/source/lintian-overrides [new file with mode: 0644]
mysql-wsrep-5.6/packaging/deb-in/watch [new file with mode: 0644]
mysql-wsrep-5.6/packaging/rpm-fedora/mysql.spec.in
mysql-wsrep-5.6/packaging/rpm-oel/mysql.init
mysql-wsrep-5.6/packaging/rpm-sles/mysql.init
mysql-wsrep-5.6/plugin/connection_control/CMakeLists.txt
mysql-wsrep-5.6/plugin/connection_control/connection_control.cc
mysql-wsrep-5.6/plugin/connection_control/connection_control_coordinator.cc
mysql-wsrep-5.6/plugin/connection_control/connection_delay.cc
mysql-wsrep-5.6/plugin/connection_control/security_context_wrapper.cc
mysql-wsrep-5.6/plugin/innodb_memcached/innodb_memcache/src/innodb_engine.c
mysql-wsrep-5.6/regex/regcomp.c
mysql-wsrep-5.6/scripts/mysql_secure_installation.sh
mysql-wsrep-5.6/scripts/mysqld_safe.sh
mysql-wsrep-5.6/scripts/mysqlhotcopy.sh
mysql-wsrep-5.6/sql-common/client.c
mysql-wsrep-5.6/sql/field.cc
mysql-wsrep-5.6/sql/field.h
mysql-wsrep-5.6/sql/handler.cc
mysql-wsrep-5.6/sql/handler.h
mysql-wsrep-5.6/sql/item.cc
mysql-wsrep-5.6/sql/item_func.cc
mysql-wsrep-5.6/sql/item_strfunc.cc
mysql-wsrep-5.6/sql/item_subselect.cc
mysql-wsrep-5.6/sql/item_xmlfunc.cc
mysql-wsrep-5.6/sql/log_event.cc
mysql-wsrep-5.6/sql/mysqld.cc
mysql-wsrep-5.6/sql/opt_range.cc
mysql-wsrep-5.6/sql/rpl_rli.cc
mysql-wsrep-5.6/sql/rpl_rli.h
mysql-wsrep-5.6/sql/rpl_slave.cc
mysql-wsrep-5.6/sql/sp.cc
mysql-wsrep-5.6/sql/sp_instr.cc
mysql-wsrep-5.6/sql/sql_acl.cc
mysql-wsrep-5.6/sql/sql_acl.h
mysql-wsrep-5.6/sql/sql_base.cc
mysql-wsrep-5.6/sql/sql_class.cc
mysql-wsrep-5.6/sql/sql_class.h
mysql-wsrep-5.6/sql/sql_digest.cc
mysql-wsrep-5.6/sql/sql_load.cc
mysql-wsrep-5.6/sql/sql_parse.cc
mysql-wsrep-5.6/sql/sql_prepare.cc
mysql-wsrep-5.6/sql/sql_select.cc
mysql-wsrep-5.6/sql/sql_table.cc
mysql-wsrep-5.6/sql/table.cc
mysql-wsrep-5.6/sql/xa.h [new file with mode: 0644]
mysql-wsrep-5.6/storage/innobase/btr/btr0sea.cc
mysql-wsrep-5.6/storage/innobase/buf/buf0buf.cc
mysql-wsrep-5.6/storage/innobase/buf/buf0dblwr.cc
mysql-wsrep-5.6/storage/innobase/buf/buf0dump.cc
mysql-wsrep-5.6/storage/innobase/buf/buf0flu.cc
mysql-wsrep-5.6/storage/innobase/dict/dict0boot.cc
mysql-wsrep-5.6/storage/innobase/dict/dict0stats.cc
mysql-wsrep-5.6/storage/innobase/dict/dict0stats_bg.cc
mysql-wsrep-5.6/storage/innobase/fil/fil0fil.cc
mysql-wsrep-5.6/storage/innobase/handler/ha_innodb.cc
mysql-wsrep-5.6/storage/innobase/include/buf0dblwr.h
mysql-wsrep-5.6/storage/innobase/include/fil0fil.h
mysql-wsrep-5.6/storage/innobase/include/ha0ha.h
mysql-wsrep-5.6/storage/innobase/include/os0file.h
mysql-wsrep-5.6/storage/innobase/include/os0file.ic
mysql-wsrep-5.6/storage/innobase/include/row0mysql.h
mysql-wsrep-5.6/storage/innobase/include/srv0srv.h
mysql-wsrep-5.6/storage/innobase/include/srv0start.h
mysql-wsrep-5.6/storage/innobase/include/trx0xa.h
mysql-wsrep-5.6/storage/innobase/include/univ.i
mysql-wsrep-5.6/storage/innobase/log/log0log.cc
mysql-wsrep-5.6/storage/innobase/log/log0recv.cc
mysql-wsrep-5.6/storage/innobase/os/os0file.cc
mysql-wsrep-5.6/storage/innobase/row/row0log.cc
mysql-wsrep-5.6/storage/innobase/row/row0merge.cc
mysql-wsrep-5.6/storage/innobase/row/row0sel.cc
mysql-wsrep-5.6/storage/innobase/srv/srv0srv.cc
mysql-wsrep-5.6/storage/innobase/srv/srv0start.cc
mysql-wsrep-5.6/storage/innobase/trx/trx0purge.cc
mysql-wsrep-5.6/storage/innobase/trx/trx0roll.cc
mysql-wsrep-5.6/storage/innobase/trx/trx0sys.cc
mysql-wsrep-5.6/storage/perfschema/pfs.cc
mysql-wsrep-5.6/storage/perfschema/pfs_digest.cc
mysql-wsrep-5.6/storage/perfschema/unittest/pfs-t.cc
mysql-wsrep-5.6/storage/perfschema/unittest/pfs_account-oom-t.cc
mysql-wsrep-5.6/storage/perfschema/unittest/pfs_connect_attr-t.cc
mysql-wsrep-5.6/storage/perfschema/unittest/pfs_host-oom-t.cc
mysql-wsrep-5.6/storage/perfschema/unittest/pfs_instr-oom-t.cc
mysql-wsrep-5.6/storage/perfschema/unittest/pfs_instr-t.cc
mysql-wsrep-5.6/storage/perfschema/unittest/pfs_instr_class-oom-t.cc
mysql-wsrep-5.6/storage/perfschema/unittest/pfs_instr_class-t.cc
mysql-wsrep-5.6/storage/perfschema/unittest/pfs_misc-t.cc
mysql-wsrep-5.6/storage/perfschema/unittest/pfs_timer-t.cc
mysql-wsrep-5.6/storage/perfschema/unittest/pfs_user-oom-t.cc
mysql-wsrep-5.6/strings/ctype-utf8.c
mysql-wsrep-5.6/support-files/CMakeLists.txt
mysql-wsrep-5.6/support-files/mysql.server.sh
mysql-wsrep-5.6/tests/mysql_client_test.c
mysql-wsrep-5.6/unittest/gunit/dbug-t.cc

index f948e3f7f79f24030e030ba29801fd46eba8b566..cb6cbec9ed9acf9c3d912ee94537e995654d2dc5 100644 (file)
@@ -1,3 +1,12 @@
+mysql-wsrep-5.6 (5.6.36-0~u14.04+mos0) mos; urgency=medium
+
+  * Update mysql to 5.6.36
+  * d/p/* - quilt refresh to avoid fuzz
+  * d/rules - switch to bundled editline instead of system to avoid broken
+    build
+
+ -- Dmitry Teselkin <mos-linux@mirantis.com>  Thu, 25 May 2017 18:02:02 +0300
+
 mysql-wsrep-5.6 (5.6.35-0~u14.04+mos2) mos; urgency=low
 
   * Add libmysqlclient18 metapackage
index faedcc42c89df4c7c6abe2d4862e1d9addf4fffe..a670351f75dea96e2c40e0a9c41709aae7537d20 100644 (file)
@@ -5,7 +5,7 @@ Forwarded: not-needed
 
 --- a/mysql-test/lib/mtr_cases.pm
 +++ b/mysql-test/lib/mtr_cases.pm
-@@ -287,7 +287,8 @@ sub collect_one_suite($)
+@@ -287,7 +287,8 @@
      else
      {
        $suitedir= my_find_dir($::basedir,
@@ -13,5 +13,5 @@ Forwarded: not-needed
 +                             ["lib/mysql-testsuite/suite",
 +                              "share/mysql-test/suite",
                              "mysql-test/suite",
+                               "lib/mysql-test/suite",
                              "internal/mysql-test/suite",
-                             "mysql-test",
index b64feeba713630f0e814c576018136d073f912ba..dbd44e791f020459a4620248728e097c27954f98 100644 (file)
@@ -29,7 +29,7 @@ Reviewed-by: Nicholas Bamber <nicholas@periapt.co.uk>
 +SET(_FILE_OFFSET_BITS 64)
 --- a/mysql-test/lib/My/Platform.pm
 +++ b/mysql-test/lib/My/Platform.pm
-@@ -110,6 +110,9 @@ sub check_socket_path_length {
+@@ -110,6 +110,9 @@
    # This may not be true, but we can't test for it on AIX due to Perl bug
    # See Bug #45771
    return 0 if ($^O eq 'aix');
index 981e0a9afc791d810f805a95f587d08daa228a18..3aaa8ce5d958395541237507b3a9b89badf17006 100644 (file)
@@ -7,7 +7,7 @@ Forwarded: no
 Last-Update: 2012-04-28
 --- a/mysql-test/lib/My/Platform.pm
 +++ b/mysql-test/lib/My/Platform.pm
-@@ -113,6 +113,8 @@ sub check_socket_path_length {
+@@ -113,6 +113,8 @@
    # Similarly the path length is hidden.
    # See Debian bug #651002
    return 0 if ($^O eq 'gnu');
index 984fd8ccc08fbd1287826564a1ca01b2f2f9a98d..2bb2481bb039efd4abc40348d0bd52cee675103d 100644 (file)
@@ -10,7 +10,7 @@ Reviewed-by: Nicholas Bamber <nicholas@periapt.co.uk>
 
 --- a/scripts/mysqld_safe.sh
 +++ b/scripts/mysqld_safe.sh
-@@ -29,9 +29,6 @@ err_log=
+@@ -29,9 +29,6 @@
  syslog_tag_mysqld=mysqld
  syslog_tag_mysqld_safe=mysqld_safe
  
@@ -20,7 +20,7 @@ Reviewed-by: Nicholas Bamber <nicholas@periapt.co.uk>
  # MySQL-specific environment variable. First off, it's not really a umask,
  # it's the desired mode. Second, it follows umask(2), not umask(3) in that
  # octal needs to be explicit. Our shell might be a proper sh without printf,
-@@ -154,7 +151,7 @@ eval_log_error () {
+@@ -169,7 +166,7 @@
        # sed buffers output (only GNU sed supports a -u (unbuffered) option)
        # which means that messages may not get sent to syslog until the
        # mysqld process quits.
@@ -29,7 +29,7 @@ Reviewed-by: Nicholas Bamber <nicholas@periapt.co.uk>
        ;;
      *)
        echo "Internal program error (non-fatal):" \
-@@ -815,6 +815,13 @@ mysqld daemon not started"
+@@ -891,6 +888,13 @@
  fi
  
  #
index 44ee56cce0c49b9e6f70f7bacc44a442bf4a5e8e..e4ab0af303652ca2f5e6231cf5c82a5f7bc11a29 100755 (executable)
@@ -103,7 +103,7 @@ configure-stamp configure-pic-stamp:
                -DWITH_WSREP=1 \
                -DWITH_LIBWRAP=ON \
                -DWITH_ZLIB=system \
-               -DWITH_EDITLINE=system \
+               -DWITH_EDITLINE=bundled \
                $(USE_STATIC_MYSQLD) \
                -DWITH_SSL=system \
                -DCOMPILATION_COMMENT="($(DISTRIBUTION))" \
index 617815c5d3b7fa55d9912bda0842f94092474f7b..fb2bd6c5a8b81464260a81ecd32ce4fa53ba1ab0 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2017, 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
@@ -289,12 +289,9 @@ IF (WITH_ASAN)
   ENDIF()
 ENDIF()
 
-
-OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON) 
-IF(ENABLE_DEBUG_SYNC) 
-  SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") 
-  SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") 
-ENDIF() 
+# Always enable debug sync for debug builds.
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
  
 # Older versions of ccache must be disabled: export CCACHE_DISABLE=1
 # See http://www.cmake.org/Wiki/CTest/Coverage
@@ -524,6 +521,7 @@ IF(NOT WITHOUT_SERVER)
   ADD_SUBDIRECTORY(packaging/rpm-fedora)
   ADD_SUBDIRECTORY(packaging/rpm-sles)
   ADD_SUBDIRECTORY(packaging/rpm-docker)
+  ADD_SUBDIRECTORY(packaging/deb-in)
 ENDIF()
 
 INCLUDE(cmake/abi_check.cmake)
index 108364d0b37825e665d132e08606263f7aa5c2a2..fdda76b4d43473392066374cc7528e01ab02e4e5 100644 (file)
@@ -5,7 +5,7 @@ For the avoidance of doubt, this particular copy of the software
 is released under the version 2 of the GNU General Public License. 
 MySQL is brought to you by Oracle.
 
-Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
 
 License information can be found in the COPYING file.
 
index 929bbfc2ed14f37b0f7aa0220bbc5d58b7fbb4fa..8a4580997a327aa676760721693b0a435af61170 100644 (file)
@@ -1,4 +1,4 @@
 MYSQL_VERSION_MAJOR=5
 MYSQL_VERSION_MINOR=6
-MYSQL_VERSION_PATCH=35
+MYSQL_VERSION_PATCH=36
 MYSQL_VERSION_EXTRA=
index cf63ae94b1cba3f97dc9f13c642a1b0060464e68..e4d7a488954c4e9d6a17508cebc713713413de01 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2001, 2017, 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
@@ -127,13 +127,15 @@ enum options_client
 /**
   Wrapper for mysql_real_connect() that checks if SSL connection is establised.
 
-  The function calls mysql_real_connect() first, then if given ssl_required==TRUE
-  argument (i.e. --ssl-mode=REQUIRED option used) checks current SSL chiper to
-  ensure that SSL is used for current connection.
-  Otherwise it returns NULL and sets errno to CR_SSL_CONNECTION_ERROR.
+  The function calls mysql_real_connect() first. Then, if the ssl_required
+  argument is TRUE (i.e., the --ssl-mode=REQUIRED option was specified), it
+  checks the current SSL cipher to ensure that SSL is used for the current
+  connection. Otherwise, it returns NULL and sets errno to
+  CR_SSL_CONNECTION_ERROR.
 
-  All clients (except mysqlbinlog which disregards SSL options) use this function
-  instead of mysql_real_connect() to handle --ssl-mode=REQUIRED option.
+  All clients (except mysqlbinlog, which disregards SSL options) use this
+  function instead of mysql_real_connect() to handle the --ssl-mode=REQUIRED
+  option.
 */
 MYSQL *mysql_connect_ssl_check(MYSQL *mysql_arg, const char *host,
                                const char *user, const char *passwd,
@@ -141,8 +143,22 @@ MYSQL *mysql_connect_ssl_check(MYSQL *mysql_arg, const char *host,
                                const char *unix_socket, ulong client_flag,
                                my_bool ssl_required MY_ATTRIBUTE((unused)))
 {
-  MYSQL *mysql= mysql_real_connect(mysql_arg, host, user, passwd, db, port,
-                                   unix_socket, client_flag);
+  MYSQL *mysql;
+
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
+  enum mysql_ssl_mode opt_ssl_mode= SSL_MODE_REQUIRED;
+  if (ssl_required &&
+      mysql_options(mysql_arg, MYSQL_OPT_SSL_MODE, (char *) &opt_ssl_mode))
+  {
+    NET *net= &mysql_arg->net;
+    net->last_errno= CR_SSL_CONNECTION_ERROR;
+    strmov(net->last_error, "Client library doesn't support MYSQL_SSL_REQUIRED option");
+    strmov(net->sqlstate, "HY000");
+    return NULL;
+  }
+#endif
+  mysql= mysql_real_connect(mysql_arg, host, user, passwd, db, port,
+                            unix_socket, client_flag);
 #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
   if (mysql &&                                   /* connection established. */
       ssl_required &&                            /* --ssl-mode=REQUIRED. */
index 7ab706fb86410d4f077ccad7cd8c7da51b6a8a9e..6f725df45f260105274f24effe707d2e090eb732 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2000, 2017, 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
@@ -1488,7 +1488,8 @@ sig_handler handle_kill_signal(int sig)
                  "program_name", "mysql");
   if (!mysql_connect_ssl_check(kill_mysql, current_host, current_user,
                                opt_password, "", opt_mysql_port,
-                               opt_mysql_unix_port, 0, opt_ssl_required))
+                               opt_mysql_unix_port, 0,
+                               opt_ssl_mode == SSL_MODE_REQUIRED))
   {
     tee_fprintf(stdout, "%s -- sorry, cannot connect to server to kill query, giving up ...\n", reason);
     goto err;
@@ -2630,7 +2631,7 @@ C_MODE_END
   if not.
 */
 
-#if defined(USE_NEW_READLINE_INTERFACE) 
+#if defined(USE_NEW_EDITLINE_INTERFACE)
 static int fake_magic_space(int, int);
 extern "C" char *no_completion(const char*,int)
 #elif defined(USE_LIBEDIT_INTERFACE)
@@ -2712,7 +2713,7 @@ static int not_in_history(const char *line)
 }
 
 
-#if defined(USE_NEW_READLINE_INTERFACE)
+#if defined(USE_NEW_EDITLINE_INTERFACE)
 static int fake_magic_space(int, int)
 #else
 static int fake_magic_space(const char *, int)
@@ -2729,7 +2730,7 @@ static void initialize_readline (char *name)
   rl_readline_name = name;
 
   /* Tell the completer that we want a crack first. */
-#if defined(USE_NEW_READLINE_INTERFACE)
+#if defined(USE_NEW_EDITLINE_INTERFACE)
   rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion;
   rl_completion_entry_function= (rl_compentry_func_t*)&no_completion;
 
@@ -2759,7 +2760,7 @@ static char **new_mysql_completion(const char *text,
                                    int end MY_ATTRIBUTE((unused)))
 {
   if (!status.batch && !quick)
-#if defined(USE_NEW_READLINE_INTERFACE)
+#if defined(USE_NEW_EDITLINE_INTERFACE)
     return rl_completion_matches(text, new_command_generator);
 #else
     return completion_matches((char *)text, (CPFunction *)new_command_generator);
@@ -4819,7 +4820,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
   if (!mysql_connect_ssl_check(&mysql, host, user, password,
                                database, opt_mysql_port, opt_mysql_unix_port,
                                connect_flag | CLIENT_MULTI_STATEMENTS,
-                               opt_ssl_required))
+                               opt_ssl_mode == SSL_MODE_REQUIRED))
   {
     if (!silent ||
        (mysql_errno(&mysql) != CR_CONN_HOST_ERROR &&
index f8df0cd4fce421756c47101d077de76e3e1715d9..34934eb404d8d47a42b8700651a18234f192d7e4 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2006, 2017, 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
@@ -401,9 +401,11 @@ static int run_tool(char *tool_path, DYNAMIC_STRING *ds_res, ...)
 
   va_end(args);
 
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
   /* If given --ssl-mode=REQUIRED propagate it to the tool. */
-  if (opt_ssl_required)
+  if (opt_ssl_mode == SSL_MODE_REQUIRED)
     dynstr_append(&ds_cmdline, "--ssl-mode=REQUIRED");
+#endif
 
 #ifdef __WIN__
   dynstr_append(&ds_cmdline, "\"");
index 99e9b77471022b3c92a664f590bc4214f83f784a..c608af64500abc00660f4d9397c946bd81a179ab 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2000, 2017, 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
@@ -552,8 +552,8 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
   for (;;)
   {
     if (mysql_connect_ssl_check(mysql, host, user, opt_password, NullS,
-                                tcp_port, unix_port,
-                                CLIENT_REMEMBER_OPTIONS, opt_ssl_required))
+                                tcp_port, unix_port, CLIENT_REMEMBER_OPTIONS,
+                                opt_ssl_mode == SSL_MODE_REQUIRED))
     {
       mysql->reconnect= 1;
       if (info)
index 258ea475f83a3e4cbf114d8653b7142fc9cb195b..e5fb8fc438b0b727d9560252f3d79e0696ed576a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2001, 2017, 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
@@ -937,7 +937,7 @@ static int dbConnect(char *host, char *user, char *passwd)
   if (!(sock = mysql_connect_ssl_check(&mysql_connection, host, user, passwd,
                                        NULL, opt_mysql_port,
                                        opt_mysql_unix_port, 0,
-                                       opt_ssl_required)))
+                                       opt_ssl_mode == SSL_MODE_REQUIRED)))
   {
     DBerror(&mysql_connection, "when trying to connect");
     DBUG_RETURN(1);
index 17637e4e57d1a7f4f045a514c606697bf59c2be6..f131324181ac62ecdd4031b977c313f05907f5a4 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2000, 2017, 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
@@ -582,6 +582,7 @@ static int dump_tablespaces_for_databases(char** databases);
 static int dump_tablespaces(char* ts_where);
 static void print_comment(FILE *sql_file, my_bool is_error, const char *format,
                           ...);
+static const char* fix_identifier_with_newline(char*);
 
 
 /*
@@ -682,7 +683,7 @@ static void write_header(FILE *sql_file, char *db_name)
                   MACHINE_TYPE);
     print_comment(sql_file, 0, "-- Host: %s    Database: %s\n",
                   current_host ? current_host : "localhost",
-                  db_name ? db_name : "");
+                  db_name ? fix_identifier_with_newline(db_name) : "");
     print_comment(sql_file, 0,
                   "-- ------------------------------------------------------\n"
                  );
@@ -1556,7 +1557,7 @@ static int connect_to_db(char *host, char *user,char *passwd)
   if (!(mysql= mysql_connect_ssl_check(&mysql_connection, host, user,
                                        passwd, NULL, opt_mysql_port,
                                        opt_mysql_unix_port, 0,
-                                       opt_ssl_required)))
+                                       opt_ssl_mode == SSL_MODE_REQUIRED)))
   {
     DB_error(&mysql_connection, "when trying to connect");
     DBUG_RETURN(1);
@@ -2036,6 +2037,30 @@ static void print_comment(FILE *sql_file, my_bool is_error, const char *format,
   print_xml_comment(sql_file, strlen(comment_buff), comment_buff);
 }
 
+/*
+ This function accepts object names and prefixes -- wherever \n
+ character is found.
+
+ @param[in]     object_name
+
+ @return
+    @retval fixed object name.
+*/
+
+static const char* fix_identifier_with_newline(char* object_name)
+{
+  static char buff[COMMENT_LENGTH]= {0};
+  char *ptr= buff;
+  memset(buff, 0, 255);
+  while(*object_name)
+  {
+    *ptr++ = *object_name;
+    if (*object_name == '\n')
+      ptr= strmov(ptr, "-- ");
+    object_name++;
+  }
+  return buff;
+}
 
 /*
  create_delimiter
@@ -2104,7 +2129,8 @@ static uint dump_events_for_db(char *db)
 
   /* nice comments */
   print_comment(sql_file, 0,
-                "\n--\n-- Dumping events for database '%s'\n--\n", db);
+                "\n--\n-- Dumping events for database '%s'\n--\n",
+                fix_identifier_with_newline(db));
 
   /*
     not using "mysql_query_with_error_report" because we may have not
@@ -2321,7 +2347,8 @@ static uint dump_routines_for_db(char *db)
 
   /* nice comments */
   print_comment(sql_file, 0,
-                "\n--\n-- Dumping routines for database '%s'\n--\n", db);
+                "\n--\n-- Dumping routines for database '%s'\n--\n",
+                fix_identifier_with_newline(db));
 
   /*
     not using "mysql_query_with_error_report" because we may have not
@@ -2380,7 +2407,7 @@ static uint dump_routines_for_db(char *db)
                           query_buff);
             print_comment(sql_file, 1,
                           "-- does %s have permissions on mysql.proc?\n\n",
-                          current_user);
+                          fix_identifier_with_newline(current_user));
             maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!", current_user, query_buff);
           }
           else if (strlen(row[2]))
@@ -2593,12 +2620,12 @@ static uint get_table_structure(char *table, char *db, char *table_type,
 
       if (strcmp (table_type, "VIEW") == 0)         /* view */
         print_comment(sql_file, 0,
-                      "\n--\n-- Temporary view structure for view %s\n--\n\n",
-                      result_table);
+                      "\n--\n-- Temporary table structure for view %s\n--\n\n",
+                      fix_identifier_with_newline(result_table));
       else
         print_comment(sql_file, 0,
                       "\n--\n-- Table structure for table %s\n--\n\n",
-                      result_table);
+                      fix_identifier_with_newline(result_table));
 
       if (opt_drop)
       {
@@ -2833,7 +2860,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
 
       print_comment(sql_file, 0,
                     "\n--\n-- Table structure for table %s\n--\n\n",
-                    result_table);
+                    fix_identifier_with_newline(result_table));
       if (opt_drop)
         fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", result_table);
       if (!opt_xml)
@@ -3531,21 +3558,23 @@ static void dump_table(char *table, char *db)
   {
     print_comment(md_result_file, 0,
                   "\n--\n-- Dumping data for table %s\n--\n",
-                  result_table);
+                  fix_identifier_with_newline(result_table));
     
     dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * FROM ");
     dynstr_append_checked(&query_string, result_table);
 
     if (where)
     {
-      print_comment(md_result_file, 0, "-- WHERE:  %s\n", where);
+      print_comment(md_result_file, 0, "-- WHERE:  %s\n",
+        fix_identifier_with_newline(where));
 
       dynstr_append_checked(&query_string, " WHERE ");
       dynstr_append_checked(&query_string, where);
     }
     if (order_by)
     {
-      print_comment(md_result_file, 0, "-- ORDER BY:  %s\n", order_by);
+      print_comment(md_result_file, 0, "-- ORDER BY:  %s\n",
+        fix_identifier_with_newline(order_by));
 
       dynstr_append_checked(&query_string, " ORDER BY ");
       dynstr_append_checked(&query_string, order_by);
@@ -4371,7 +4400,8 @@ static int init_dumping(char *database, int init_func(char*))
       char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
 
       print_comment(md_result_file, 0,
-                    "\n--\n-- Current Database: %s\n--\n", qdatabase);
+                    "\n--\n-- Current Database: %s\n--\n",
+                    fix_identifier_with_newline(qdatabase));
 
       /* Call the view or table specific function */
       init_func(qdatabase);
@@ -5597,7 +5627,7 @@ static my_bool get_view_structure(char *table, char* db)
 
   print_comment(sql_file, 0,
                 "\n--\n-- Final view structure for view %s\n--\n\n",
-                result_table);
+                fix_identifier_with_newline(result_table));
 
   verbose_msg("-- Dropping the temporary view structure created\n");
   fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n", opt_quoted_table);
index cec3b08d7fc1f6b34eb85de803fc874d8cce50a6..50ec90b0f0ba925e787ea5b684a7261e3fedd672 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2000, 2017, 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
@@ -482,7 +482,7 @@ static MYSQL *db_connect(char *host, char *database,
                  "program_name", "mysqlimport");
   if (!(mysql_connect_ssl_check(mysql, host, user, passwd, database,
                                 opt_mysql_port, opt_mysql_unix_port,
-                                0, opt_ssl_required)))
+                                0, opt_ssl_mode == SSL_MODE_REQUIRED)))
   {
     ignore_errors=0;     /* NO RETURN FROM db_error */
     db_error(mysql);
index 10a4cf0526236517f6a5c0f02f114904d89f7861..d05577aefc42799c9bc8fcd9cfae9ab58a6541ae 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2000, 2017, 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
@@ -159,7 +159,7 @@ int main(int argc, char **argv)
   if (!(mysql_connect_ssl_check(&mysql, host, user, opt_password,
                                 (first_argument_uses_wildcards) ? "" :
                                 argv[0], opt_mysql_port, opt_mysql_unix_port,
-                                0, opt_ssl_required)))
+                                0, opt_ssl_mode == SSL_MODE_REQUIRED)))
   {
     fprintf(stderr,"%s: %s\n",my_progname,mysql_error(&mysql));
     exit(1);
index ad0bb965657be4f2547e0c5a14b35beeadf11015..afa8c92a104b0c1ef2e7a054ab7fe57d5f8a36c1 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2005, 2017, 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
@@ -371,7 +371,8 @@ int main(int argc, char **argv)
   {
     if (!(mysql_connect_ssl_check(&mysql, host, user, opt_password,
                                   NULL, opt_mysql_port, opt_mysql_unix_port,
-                                  connect_flags, opt_ssl_required)))
+                                  connect_flags,
+                                  opt_ssl_mode == SSL_MODE_REQUIRED)))
     {
       fprintf(stderr,"%s: Error when connecting to server: %s\n",
               my_progname,mysql_error(&mysql));
index 1e133b31c66a3733bf384681e74eaf783d2f8a47..23f21288f132273af0348dcd73d951fcec223cde 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, 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
@@ -35,6 +35,7 @@
 #include <my_dir.h>
 #include <hash.h>
 #include <stdarg.h>
+#include <string>
 #include <violite.h>
 #include "my_regex.h" /* Our own version of regex */
 #ifdef HAVE_SYS_WAIT_H
@@ -52,6 +53,7 @@
 
 using std::min;
 using std::max;
+using std::string;
 
 #ifdef __WIN__
 #include <crtdbg.h>
@@ -4235,7 +4237,11 @@ void do_perl(struct st_command *command)
       die("Failed to create temporary file for perl command");
     my_close(fd, MYF(0));
 
-    str_to_file(temp_file_path, ds_script.str, ds_script.length);
+    /* Compatibility for Perl 5.24 and newer. */
+    string script = "push @INC, \".\";\n";
+    script.append(ds_script.str, ds_script.length);
+
+    str_to_file(temp_file_path, &script[0], script.size());
 
     /* Format the "perl <filename>" command */
     my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path);
@@ -5315,7 +5321,7 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host,
                 &can_handle_expired_passwords);
   while(!mysql_connect_ssl_check(mysql, host,user, pass, db, port, sock,
                                  CLIENT_MULTI_STATEMENTS | CLIENT_REMEMBER_OPTIONS,
-                                 opt_ssl_required))
+                                 opt_ssl_mode == SSL_MODE_REQUIRED))
   {
     /*
       Connect failed
@@ -5421,7 +5427,7 @@ int connect_n_handle_errors(struct st_command *command,
                 &can_handle_expired_passwords);
   while (!mysql_connect_ssl_check(con, host, user, pass, db, port,
                                   sock ? sock: 0, CLIENT_MULTI_STATEMENTS,
-                                  opt_ssl_required))
+                                  opt_ssl_mode == SSL_MODE_REQUIRED))
   {
     /*
       If we have used up all our connections check whether this
index f0b03f239832e3339046274900f132004dcf5308..8efcf71c81af32d38d1a552e210825f02aca4379 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2017, 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
@@ -21,6 +21,7 @@ INCLUDE(CheckCSourceCompiles)
 IF(NOT FORCE_UNSUPPORTED_COMPILER)
   IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
     # CC -V yields
+    # CC: Studio 12.6 Sun C++ 5.15 SunOS_sparc Beta 2016/12/19
     # CC: Studio 12.5 Sun C++ 5.14 SunOS_sparc Dodona 2016/04/04
     # CC: Sun C++ 5.13 SunOS_sparc Beta 2014/03/11
     # CC: Sun C++ 5.11 SunOS_sparc 2010/08/13
@@ -32,7 +33,7 @@ IF(NOT FORCE_UNSUPPORTED_COMPILER)
     )
     STRING(REGEX MATCH "CC: Sun C\\+\\+ 5\\.([0-9]+)" VERSION_STRING ${stderr})
     IF (NOT CMAKE_MATCH_1 OR CMAKE_MATCH_1 STREQUAL "")
-      STRING(REGEX MATCH "CC: Studio 12\\.5 Sun C\\+\\+ 5\\.([0-9]+)"
+      STRING(REGEX MATCH "CC: Studio 12\\.[56] Sun C\\+\\+ 5\\.([0-9]+)"
         VERSION_STRING ${stderr})
     ENDIF()
     SET(CC_MINOR_VERSION ${CMAKE_MATCH_1})
index 188982a837de7c9ae9fd365d8baeae0fd8391cb3..92e4446c5a2e0154f62e5c3fc24a185a0048ea8c 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2017, 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
@@ -65,6 +65,7 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)
 ENDIF()
 
 IF(MSVC)
+  OPTION(LINK_STATIC_RUNTIME_LIBRARIES "Link with /MT" OFF)
   # Enable debug info also in Release build,
   # and create PDB to be able to analyze crashes.
   FOREACH(type EXE SHARED MODULE)
@@ -94,7 +95,9 @@ IF(MSVC)
    CMAKE_C_FLAGS_DEBUG      CMAKE_C_FLAGS_DEBUG_INIT 
    CMAKE_CXX_FLAGS_RELEASE  CMAKE_CXX_FLAGS_RELWITHDEBINFO
    CMAKE_CXX_FLAGS_DEBUG    CMAKE_CXX_FLAGS_DEBUG_INIT)
-   STRING(REPLACE "/MD"  "/MT" "${flag}" "${${flag}}")
+   IF(LINK_STATIC_RUNTIME_LIBRARIES)
+     STRING(REPLACE "/MD"  "/MT" "${flag}" "${${flag}}")
+   ENDIF()
    STRING(REPLACE "/Zi"  "/Z7" "${flag}" "${${flag}}")
    SET("${flag}" "${${flag}} /EHsc")
   ENDFOREACH()
index c4ead950813e4dcf1483cd6789e0a453147d65c4..0b4e936c461fd707c0bd616a2edd533db7fa1215 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2017, 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
@@ -179,12 +179,28 @@ MACRO (FIND_SYSTEM_EDITLINE)
       completion_matches(0,0);
       return res;
     }"
-    EDITLINE_HAVE_COMPLETION)
+    EDITLINE_HAVE_COMPLETION_INT)
 
-    IF(EDITLINE_HAVE_COMPLETION)
+    CHECK_CXX_SOURCE_COMPILES("
+    #include <stdio.h>
+    #include <readline.h>
+    int main(int argc, char **argv)
+    {
+      typedef char* MYFunction(const char*, int);
+      MYFunction* myf= rl_completion_entry_function;
+      char *res= (myf)(NULL, 0);
+      completion_matches(0,0);
+      return res != NULL;
+    }"
+    EDITLINE_HAVE_COMPLETION_CHAR)
+
+    IF(EDITLINE_HAVE_COMPLETION_INT OR EDITLINE_HAVE_COMPLETION_CHAR)
       SET(HAVE_HIST_ENTRY ${EDITLINE_HAVE_HIST_ENTRY})
       SET(USE_LIBEDIT_INTERFACE 1)
       SET(EDITLINE_FOUND 1)
+      IF(EDITLINE_HAVE_COMPLETION_CHAR)
+        SET(USE_NEW_EDITLINE_INTERFACE 1)
+      ENDIF()
     ENDIF()
   ENDIF()
 ENDMACRO()
index 3309fe3ea0fb6ec5f112657beec20d9d963be387..1f5fed4bfffd475c65e41647bd2c4ca2624c4a62 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2009, 2017, 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
 
 /* Readline */
 #cmakedefine HAVE_HIST_ENTRY 1
+#cmakedefine USE_NEW_EDITLINE_INTERFACE 1
 #cmakedefine USE_LIBEDIT_INTERFACE 1
 
 #cmakedefine FIONREAD_IN_SYS_IOCTL 1
index 6559406cfa3a256943eb612e80ef78ebbb6c971e..3d1dfae84ef0c3dc4d3ebbf9952269de2dda6cb0 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2017, 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
@@ -153,6 +153,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND
   GET_FILENAME_COMPONENT(CXX_REALPATH ${CMAKE_CXX_COMPILER} REALPATH)
 
   # CC -V yields
+  # CC: Studio 12.6 Sun C++ 5.15 SunOS_sparc Beta 2016/12/19
   # CC: Studio 12.5 Sun C++ 5.14 SunOS_sparc Dodona 2016/04/04
   # CC: Sun C++ 5.13 SunOS_sparc Beta 2014/03/11
   # CC: Sun C++ 5.11 SunOS_sparc 2010/08/13
@@ -169,7 +170,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND
 
   STRING(REGEX MATCH "CC: Sun C\\+\\+ 5\\.([0-9]+)" VERSION_STRING ${stderr})
   IF (NOT CMAKE_MATCH_1 OR CMAKE_MATCH_1 STREQUAL "")
-    STRING(REGEX MATCH "CC: Studio 12\\.5 Sun C\\+\\+ 5\\.([0-9]+)"
+    STRING(REGEX MATCH "CC: Studio 12\\.[56] Sun C\\+\\+ 5\\.([0-9]+)"
       VERSION_STRING ${stderr})
   ENDIF()
   SET(CC_MINOR_VERSION ${CMAKE_MATCH_1})
index 38b54de2eb51f0d0ac80150e29b4e47ef31721ca..0aeed955101208830cd9a4bd469f8dd0ad97a0cb 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, 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
@@ -175,7 +175,8 @@ enum mysql_option
   MYSQL_OPT_CONNECT_ATTR_DELETE,
   MYSQL_SERVER_PUBLIC_KEY,
   MYSQL_ENABLE_CLEARTEXT_PLUGIN,
-  MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
+  MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
+  MYSQL_OPT_SSL_MODE
 };
 
 /**
@@ -245,6 +246,11 @@ enum mysql_protocol_type
   MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
 };
 
+enum mysql_ssl_mode
+{
+  SSL_MODE_REQUIRED= 3
+};
+
 typedef struct character_set
 {
   unsigned int      number;     /* character set number              */
index 3a5c40d0a0dbf3815006a28078682c1aca28f11c..27696f8984f1cd08704d9f078e12759d5382c5a1 100644 (file)
@@ -272,7 +272,8 @@ enum mysql_option
   MYSQL_OPT_CONNECT_ATTR_DELETE,
   MYSQL_SERVER_PUBLIC_KEY,
   MYSQL_ENABLE_CLEARTEXT_PLUGIN,
-  MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
+  MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
+  MYSQL_OPT_SSL_MODE
 };
 struct st_mysql_options_extention;
 struct st_mysql_options {
@@ -319,6 +320,10 @@ enum mysql_protocol_type
   MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
   MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
 };
+enum mysql_ssl_mode
+{
+  SSL_MODE_REQUIRED= 3
+};
 typedef struct character_set
 {
   unsigned int number;
index a25af23fa19bcedd9378c825d2aa32d3b338e1b5..2c964398347f88d2454f375389c6b401feef9673 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2016, 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
@@ -26,6 +26,7 @@
 #define USERNAME_CHAR_LENGTH 16
 #define NAME_LEN                (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
 #define USERNAME_LENGTH         (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
+#define CONNECT_STRING_MAXLEN 1024
 
 #define MYSQL_AUTODETECT_CHARSET_NAME "auto"
 
index c8ea820fbd82c5c42467eb5888f34a161ab10642..2cc6d658887035a8295adc377c7dce5a215e43e6 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef SQL_COMMON_INCLUDED
 #define SQL_COMMON_INCLUDED
 
-/* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2003, 2017, 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
@@ -38,6 +38,7 @@ struct st_mysql_options_extention {
   char *server_public_key_path;
   size_t connection_attributes_length;
   my_bool enable_cleartext_plugin;
+  unsigned int ssl_mode;
 };
 
 typedef struct st_mysql_methods
index bf9cc03925dac3f784f58bad5f6f51a3b7183e9f..7a42aa63b4300321c64a83eb7a47ea4971a48839 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef SSLOPT_CASE_INCLUDED
 #define SSLOPT_CASE_INCLUDED
 
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, 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
@@ -45,7 +45,7 @@
         exit(1);
       }
       else
-        opt_ssl_required= 1;
+        opt_ssl_mode= SSL_MODE_REQUIRED;
       break;
 #endif /* MYSQL_CLIENT */
 #endif
index e840edce4bf8b3438897081740923c829af051e4..7eebd86a3283d7325237f12ff6d6f4a668fc39df 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef SSLOPT_VARS_INCLUDED
 #define SSLOPT_VARS_INCLUDED
 
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, 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
@@ -33,10 +33,10 @@ SSL_STATIC char *opt_ssl_crlpath = 0;
 
 #ifdef MYSQL_CLIENT
 SSL_STATIC my_bool opt_ssl_verify_server_cert= 0;
-SSL_STATIC my_bool opt_ssl_required= 0;
+SSL_STATIC uint opt_ssl_mode= 0;
 #endif /* MYSQL_CLIENT */
 #else /* HAVE_OPENSSL */
-#define opt_ssl_required 0
+#define opt_ssl_mode 0
 #endif /* HAVE_OPENSSL */
 
 #endif /* SSLOPT_VARS_INCLUDED */
index 7b6c28c2f5665f1dd7f6697255a4a1bac83a3dc1..0c17b5e650cffb95cb39c4ce592687d703e97343 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2017, 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
@@ -16,7 +16,7 @@
 #ifndef _welcome_copyright_notice_h_
 #define _welcome_copyright_notice_h_
 
-#define COPYRIGHT_NOTICE_CURRENT_YEAR "2016"
+#define COPYRIGHT_NOTICE_CURRENT_YEAR "2017"
 
 /*
   This define specifies copyright notice which is displayed by every MySQL
index 954f8b892bb0af50f678cfa4755cba5cc13d169b..b2f5d52f620c737926e2884cd80db218ad047e0f 100644 (file)
@@ -1,22 +1,13 @@
 # Smaller batch of weekly run for tier2 platforms
 # Same as default.weekly, but all tests are run without big-test option. 
 # big-test runs were leading to sporadic failures in tier2 platforms
-# Comprises of the following
-# 1. Repeat of daily runs 
-# 2. All suites in normal mode 
-# 3. nist suite
-# 4. engine independant suite
-# 5. Covers debug and non-debug runs
-# 6. Covers all suites with Multi-Threaded-Slave and MIXED binlog-format
-# 7. Covers all suites with innodb-page-size=4k and 8k
 
-# Repeat daily run
-# big-test option for normal runs 
-# Default suites (in modes binlog format stmt/mixed/row, parts), embedded and ps-protocol
+# Default suites (in modes binlog format stmt/mixed/row, parts)
 perl mysql-test-run.pl --force --timer  --debug-server --parallel=auto --experimental=collections/default.experimental --comment=normal-debug  --vardir=var-normal-debug  --report-features --skip-test-list=collections/disabled-daily.list --mysqld=--innodb_autoextend_increment=64 --unit-tests-report
 
 # Run all default suites with embedded server
-# --debug-server is not used for embedded runs since debug build of embedded server is not available
+# --debug-server is not used for embedded runs 
+# since debug build of embedded server is not available
 perl mysql-test-run.pl --force --timer  --parallel=auto --experimental=collections/default.experimental --comment=embedded  --vardir=var-embedded  --embedded-server
 
 # Run default suites with ps protocol
@@ -47,23 +38,3 @@ perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=
 #Memcached tests
 perl mysql-test-run.pl --timer --force --debug-server --comment=memcached-debug --vardir=var-debug-memcached --experimental=collections/default.experimental --parallel=1 --retry=0 --suite=memcached  --skip-test-list=collections/disabled-weekly.list
 
-# Non debug runs of default suites in normal modes
-perl mysql-test-run.pl --force --timer   --parallel=auto --experimental=collections/default.experimental --comment=normal-non-debug  --vardir=var-normal-non-debug --report-features --skip-test-list=collections/disabled-daily.list
-
-
-
-# Multi-Thread Slave
-perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=MTS-debug --vardir=var-MTS-debug --suite=rpl  --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list --mysqld=--slave-parallel-workers=4 --mysqld=--slave-transaction-retries=0 --skip-test-list=collection/disabled-weekly.list
-
-# Run all default suites with 4K page size
-perl mysql-test-run.pl --debug-server --timer --force --parallel=auto --comment=all_4k_size --vardir=var_all_4k_size --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list --mysqld=--innodb-page-size=4k 
-
-# Run all default suites with 8K page size
-perl mysql-test-run.pl --debug-server  --timer --force --parallel=auto --comment=all_8k_size --vardir=var-all_8k_size --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list --mysqld=--innodb-page-size=8k
-
-
-
-# Additional run to test rpl HASH_SCAN & INDEX_SCAN
-perl mysql-test-run.pl --force --debug-server --timer --parallel=auto --experimental=collections/default.experimental --comment=binlog_rpl_row_hash_scan --vardir=var-binlog_rpl_row_hash_scan --mysqld=--binlog-format=row --suite=binlog,rpl --mysqld=--slave-rows-search-algorithms=HASH_SCAN,INDEX_SCAN --skip-test-list=collection/disabled-weekly.list
-perl mysql-test-run.pl --debug-server --timer --force --parallel=auto --comment=rpl_binlog_row_hash_MTS --vardir=var-mts-rpl-binlog-hash-n_mix --mysqld=--binlog-format=row --experimental=collections/default.experimental --mysqld=--slave-parallel-workers=4 --mysqld=--slave-transaction-retries=0 --suite=rpl,binlog  -mysqld=--slave-rows-search-algorithms=HASH_SCAN,INDEX_SCAN --skip-test-list=collection/disabled-weekly.list
-
index b9e4fb1a2b1bddedb1a718a353fb1c76a43b67dc..b2c6f92f01a5eab7b5824c212e10f7902ec408d8 100644 (file)
@@ -1,5 +1,5 @@
 # -*- cperl -*-
-# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2017, 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
@@ -289,6 +289,7 @@ sub collect_one_suite($)
       $suitedir= my_find_dir($::basedir,
                             ["share/mysql-test/suite",
                              "mysql-test/suite",
+                              "lib/mysql-test/suite",
                              "internal/mysql-test/suite",
                              "mysql-test",
                              # Look in storage engine specific suite dirs
index 41fc1bf6642fb8a356d9101974342641b1687594..3be4e2947ebc6c5dd849a1743334c288b55c5f52 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # -*- cperl -*-
 
-# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2017, 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
@@ -100,6 +100,8 @@ use mtr_results;
 use IO::Socket::INET;
 use IO::Select;
 
+push @INC, ".";
+
 require "lib/mtr_process.pl";
 require "lib/mtr_io.pl";
 require "lib/mtr_gcov.pl";
@@ -5746,16 +5748,14 @@ sub start_servers($) {
     my $mysqld_basedir= $mysqld->value('basedir');
     if ( $basedir eq $mysqld_basedir )
     {
-      if (! $opt_start_dirty)  # If dirty, keep possibly grown system db
+      if (!$opt_start_dirty)   # If dirty, keep possibly grown system db
       {
-       # Copy datadir from installed system db
-       for my $path ( "$opt_vardir", "$opt_vardir/..") {
-         my $install_db= "$path/install.db";
-         copytree($install_db, $datadir)
-           if -d $install_db;
-       }
-       mtr_error("Failed to copy system db to '$datadir'")
-         unless -d $datadir;
+        # Copy datadir from installed system db
+        my $path= ($opt_parallel == 1) ? "$opt_vardir" : "$opt_vardir/..";
+        my $install_db= "$path/install.db";
+        copytree($install_db, $datadir) if -d $install_db;
+        mtr_error("Failed to copy system db to '$datadir'")
+          unless -d $datadir;
       }
     }
     else
index a69d5247dfa88d1bf01ee97b445a644a937fd4a1..da18ecc35322a519caf1d28926319e9ee08e461d 100644 (file)
@@ -982,3 +982,16 @@ LIMIT 1;
 t3_date
 NULL
 DROP TABLE t1,t2,t3;
+#
+# Bug#22686994 REGRESSION FOR A GROUPING QUERY WITH DISTINCT
+#
+CREATE TABLE t1 (a INTEGER, b INTEGER);
+INSERT INTO t1 VALUES (1,3), (2,4), (1,5),
+(1,3), (2,1), (1,5), (1,7), (3,1),
+(3,2), (3,1), (2,4);
+SELECT DISTINCT (COUNT(DISTINCT b) + 1) AS c FROM t1 GROUP BY a;
+c
+4
+3
+DROP TABLE t1;
+# End of test for Bug#22686994
index 102cfee05df612f894d3c69c833cbeb8efd776dc..505d117225e8c427f43bbfb23b18a0314333db74 100644 (file)
@@ -1,10 +1,10 @@
 drop database if exists events_test;
 create database events_test;
 use events_test;
-create event e_26 on schedule at '2038-01-19 03:14:07' disable do set @a = 5;
+create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5;
 select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
 db     name    body    definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion
-events_test    e_26    set @a = 5      root@localhost  2038-01-19 03:14:07     DROP
+events_test    e_26    set @a = 5      root@localhost  2037-01-01 00:00:00     DROP
 drop event e_26;
 create event e_26 on schedule at NULL disable do set @a = 5;
 ERROR HY000: Incorrect AT value: 'NULL'
index a56dc01158b847226157b325705453649cc79aa7..ef4fe64608b82c45c6f1ab7022eec6a32ef86468 100644 (file)
@@ -321,3 +321,241 @@ SET optimizer_trace_max_mem_size=DEFAULT;
 SET optimizer_trace=DEFAULT;
 SET end_markers_in_json=DEFAULT;
 DROP TABLE t0,t1,t2;
+#
+# Bug #21749123: SELECT DISTINCT, WRONG RESULTS COMBINED WITH
+#                USE_INDEX_EXTENSIONS=OFF
+#
+CREATE TABLE t1 (
+pk_col INT AUTO_INCREMENT PRIMARY KEY,
+a1 CHAR(64),
+KEY a1_idx (a1)
+) ENGINE=INNODB;
+INSERT INTO t1 (a1) VALUES ('a'),('a'),('a'),('a'),('a'),('a'),('a'),('a');
+CREATE TABLE t2 (
+pk_col1 INT NOT NULL,
+pk_col2 INT NOT NULL,
+a1 CHAR(64),
+a2 CHAR(64),
+PRIMARY KEY(pk_col1, pk_col2),
+KEY a1_idx (a1),
+KEY a1_a2_idx (a1, a2)
+) ENGINE=INNODB;
+INSERT INTO t2 (pk_col1, pk_col2, a1, a2) VALUES (1,1,'a','b'),(1,2,'a','b'),
+(1,3,'a','c'),(1,4,'a','c'),
+(2,1,'a','d');
+ANALYZE TABLE t1;
+Table  Op      Msg_type        Msg_text
+test.t1        analyze status  OK
+ANALYZE TABLE t2;
+Table  Op      Msg_type        Msg_text
+test.t2        analyze status  OK
+EXPLAIN SELECT DISTINCT a1
+FROM t1
+WHERE (pk_col = 2 OR pk_col = 22) AND a1 = 'a';
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      SIMPLE  t1      ref     PRIMARY,a1_idx  a1_idx  65      const   4       Using where; Using index
+SELECT DISTINCT a1
+FROM t1
+WHERE (pk_col = 2 OR pk_col = 22) AND a1 = 'a';
+a1
+a
+EXPLAIN SELECT COUNT(DISTINCT a1)
+FROM t1
+GROUP BY a1,pk_col;
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      SIMPLE  t1      range   a1_idx  a1_idx  69      NULL    9       Using index for group-by (scanning)
+SELECT COUNT(DISTINCT a1)
+FROM t1
+GROUP BY a1,pk_col;
+COUNT(DISTINCT a1)
+1
+1
+1
+1
+1
+1
+1
+1
+EXPLAIN SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,pk_col1;
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      SIMPLE  t2      range   a1_idx,a1_a2_idx        a1_idx  69      NULL    6       Using index for group-by (scanning)
+SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,pk_col1;
+COUNT(DISTINCT a1)
+1
+1
+EXPLAIN SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,a2;
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      SIMPLE  t2      range   a1_a2_idx       a1_a2_idx       130     NULL    6       Using index for group-by (scanning)
+SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,a2;
+COUNT(DISTINCT a1)
+1
+1
+1
+SET @optimizer_switch_save=@@optimizer_switch;
+SET @@optimizer_switch= "use_index_extensions=off";
+EXPLAIN SELECT DISTINCT a1
+FROM t1
+WHERE (pk_col = 2 OR pk_col = 22) AND a1 = 'a';
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      SIMPLE  t1      ref     PRIMARY,a1_idx  a1_idx  65      const   8       Using where; Using index
+SELECT DISTINCT a1
+FROM t1
+WHERE (pk_col = 2 OR pk_col = 22) AND a1 = 'a';
+a1
+a
+EXPLAIN SELECT COUNT(DISTINCT a1)
+FROM t1
+GROUP BY a1,pk_col;
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      SIMPLE  t1      index   a1_idx  a1_idx  65      NULL    8       Using index
+SELECT COUNT(DISTINCT a1)
+FROM t1
+GROUP BY a1,pk_col;
+COUNT(DISTINCT a1)
+1
+1
+1
+1
+1
+1
+1
+1
+EXPLAIN SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,pk_col1;
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      SIMPLE  t2      index   a1_idx,a1_a2_idx        a1_idx  65      NULL    5       Using index
+SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,pk_col1;
+COUNT(DISTINCT a1)
+1
+1
+EXPLAIN SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,a2;
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      SIMPLE  t2      range   a1_a2_idx       a1_a2_idx       130     NULL    6       Using index for group-by (scanning)
+SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,a2;
+COUNT(DISTINCT a1)
+1
+1
+1
+SET @@optimizer_switch= @optimizer_switch_save;
+DROP TABLE t1, t2;
+#
+# Bug #24671968: WHEN THE OPTIMISER IS USING INDEX FOR GROUP-BY IT OFTEN
+#                OFTEN GIVES WRONG RESULTS
+#
+CREATE TABLE t1 (
+id int NOT NULL,
+c1 int NOT NULL,
+c2 int,
+PRIMARY KEY(id),
+INDEX c1_c2_idx(c1, c2));
+INSERT INTO t1 (id, c1, c2) VALUES (1,1,1), (2,2,2), (10,10,1), (11,10,8),
+(12,10,1), (13,10,2), (3,1,1), (4,10,1),
+(5,10,1), (6,10,8), (7,1,1), (8,10,1);
+ANALYZE TABLE t1;
+Table  Op      Msg_type        Msg_text
+test.t1        analyze status  OK
+EXPLAIN SELECT DISTINCT c1
+FROM t1
+WHERE EXISTS (SELECT *
+FROM DUAL
+WHERE (c2 = 2));
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      PRIMARY t1      index   c1_c2_idx       c1_c2_idx       9       NULL    #       Using where; Using index
+2      DEPENDENT SUBQUERY      NULL    NULL    NULL    NULL    NULL    NULL    #       No tables used
+EXPLAIN SELECT DISTINCT c1
+FROM t1
+WHERE 1 IN (2,
+(SELECT 1
+FROM DUAL
+WHERE (c2 = 2)),
+3);
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      PRIMARY t1      index   c1_c2_idx       c1_c2_idx       9       NULL    #       Using where; Using index
+2      DEPENDENT SUBQUERY      NULL    NULL    NULL    NULL    NULL    NULL    #       No tables used
+EXPLAIN SELECT DISTINCT c1
+FROM t1
+WHERE c2 = 2;
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      SIMPLE  t1      range   c1_c2_idx       c1_c2_idx       9       NULL    #       Using where; Using index for group-by
+EXPLAIN SELECT DISTINCT c1
+FROM t1 IGNORE INDEX (c1_c2_idx)
+WHERE EXISTS (SELECT *
+FROM DUAL
+WHERE (c2 = 2));
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      PRIMARY t1      ALL     c1_c2_idx       NULL    NULL    NULL    #       Using where; Using temporary
+2      DEPENDENT SUBQUERY      NULL    NULL    NULL    NULL    NULL    NULL    #       No tables used
+EXPLAIN SELECT DISTINCT c1
+FROM t1 IGNORE INDEX (c1_c2_idx)
+WHERE 1 IN (2,
+(SELECT 1
+FROM DUAL
+WHERE (c2 = 2)),
+3);
+id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
+1      PRIMARY t1      ALL     c1_c2_idx       NULL    NULL    NULL    #       Using where; Using temporary
+2      DEPENDENT SUBQUERY      NULL    NULL    NULL    NULL    NULL    NULL    #       No tables used
+SET optimizer_trace="enabled=on";
+SELECT DISTINCT c1
+FROM t1
+WHERE EXISTS (SELECT *
+FROM DUAL
+WHERE (c2 = 2));
+c1
+2
+10
+SELECT TRACE INTO @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "keypart_reference_from_where_clause";
+@trace RLIKE "keypart_reference_from_where_clause"
+1
+SET optimizer_trace="enabled=off";
+SELECT DISTINCT c1
+FROM t1
+WHERE 1 IN (2,
+(SELECT 1
+FROM DUAL
+WHERE (c2 = 2)),
+3);
+c1
+2
+10
+SELECT DISTINCT c1
+FROM t1
+WHERE c2 = 2;
+c1
+2
+10
+SELECT DISTINCT c1
+FROM t1 IGNORE INDEX (c1_c2_idx)
+WHERE EXISTS (SELECT *
+FROM DUAL
+WHERE (c2 = 2));
+c1
+2
+10
+SELECT DISTINCT c1
+FROM t1 IGNORE INDEX (c1_c2_idx)
+WHERE 1 IN (2,
+(SELECT 1
+FROM DUAL
+WHERE (c2 = 2)),
+3);
+c1
+2
+10
+DROP TABLE t1;
index 8ccc1a3da3de80600b9c3833b1a7e1979af1172a..3cf3ae3c115daf3d4b0d5e482120a6da9ff65154 100644 (file)
@@ -316,7 +316,7 @@ FIELDS ESCAPED BY '\\'
   TERMINATED BY ','
   ENCLOSED BY '"'
   LINES TERMINATED BY '\n' (c0, c2);
-ERROR HY000: Invalid column reference (v2.c0) in LOAD DATA
+ERROR HY000: Column 'c0' is not updatable
 
 LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v3
 FIELDS ESCAPED BY '\\'
index 9b81127c825623ad44ad312e99857cd47f10ac33..1e189a7726fbff1572636fa7d04ca2297aa15800 100644 (file)
@@ -1,29 +1,31 @@
+set @@global.log_output = 'TABLE';
 set session long_query_time=10;
 select get_lock('bug27638', 1);
 get_lock('bug27638', 1)
 1
 set session long_query_time=1;
-truncate table mysql.slow_log;
 select get_lock('bug27638', 2);
 get_lock('bug27638', 2)
 0
-select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+select if (query_time >= '00:00:01', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
+where sql_text = 'select get_lock(\'bug27638\', 2)';
 qt     sql_text
 OK     select get_lock('bug27638', 2)
-truncate table mysql.slow_log;
 select get_lock('bug27638', 60);
 get_lock('bug27638', 60)
 0
-select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+select if (query_time >= '00:00:59', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
+where sql_text = 'select get_lock(\'bug27638\', 60)';
 qt     sql_text
 OK     select get_lock('bug27638', 60)
-truncate table mysql.slow_log;
 select get_lock('bug27638', 101);
 get_lock('bug27638', 101)
 0
-select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+select if (query_time >= '00:01:40', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
+where sql_text = 'select get_lock(\'bug27638\', 101)';
 qt     sql_text
 OK     select get_lock('bug27638', 101)
 select release_lock('bug27638');
 release_lock('bug27638')
 1
+set @@global.log_output=default;
index 9ddc45723b24bedbee73497cf3671dfb619197e8..39504f7411c6eaf28c0ce28d5a4b1c65ea914df0 100644 (file)
@@ -100,7 +100,7 @@ user = test_user4
 ##############################################
 # Tests for mysql_config_editor's help command
 ##############################################
-Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
 
 Oracle is a registered trademark of Oracle Corporation and/or its
 affiliates. Other names may be trademarks of their respective
index 4e3c686308caf46fb464a29518150f4cc8e08b93..102e69ca659be6a714f4277d008d068381482655 100644 (file)
@@ -5432,3 +5432,66 @@ a
 DROP TABLE t1;
 DROP TABLE t2;
 DROP DATABASE db_20772273;
+#
+# Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
+#
+CREATE DATABASE bug25717383;
+use bug25717383;
+CREATE TABLE `tab
+one` (a int);
+CREATE VIEW `view
+one` as SELECT * FROM `tab
+one`;
+CREATE PROCEDURE `proc
+one`() SELECT * from `tab
+one`;
+CREATE TEMPORARY TABLE `temp
+one` (id INT);
+CREATE TRIGGER `trig
+one` BEFORE INSERT ON `tab
+one` FOR EACH ROW SET NEW.a = 1;
+CREATE EVENT `event
+one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;
+SHOW TABLES FROM bug25717383;
+Tables_in_bug25717383
+tab
+one
+view
+one
+SHOW TRIGGERS FROM bug25717383;
+Trigger        Event   Table   Statement       Timing  Created sql_mode        Definer character_set_client    collation_connection    Database Collation
+trig
+one    INSERT  tab
+one    SET NEW.a = 1   BEFORE  NULL            root@localhost  latin1  latin1_swedish_ci       latin1_swedish_ci
+SHOW EVENTS FROM bug25717383;
+Db     Name    Definer Time zone       Type    Execute at      Interval value  Interval field  Starts  Ends    Status  Originator      character_set_client    collation_connection    Database Collation
+bug25717383    event
+one    root@localhost  SYSTEM  ONE TIME        #       NULL    NULL    NULL    NULL    ENABLED 1       latin1  latin1_swedish_ci       latin1_swedish_ci
+SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
+WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
+       ORDER BY ROUTINE_NAME;
+ROUTINE_NAME
+proc
+one
+SHOW TABLES FROM bug25717383;
+Tables_in_bug25717383
+tab
+one
+view
+one
+SHOW TRIGGERS FROM bug25717383;
+Trigger        Event   Table   Statement       Timing  Created sql_mode        Definer character_set_client    collation_connection    Database Collation
+trig
+one    INSERT  tab
+one    SET NEW.a = 1   BEFORE  NULL            root@localhost  latin1  latin1_swedish_ci       latin1_swedish_ci
+SHOW EVENTS FROM bug25717383;
+Db     Name    Definer Time zone       Type    Execute at      Interval value  Interval field  Starts  Ends    Status  Originator      character_set_client    collation_connection    Database Collation
+bug25717383    event
+one    root@localhost  SYSTEM  ONE TIME        #       NULL    NULL    NULL    NULL    ENABLED 1       latin1  latin1_swedish_ci       latin1_swedish_ci
+SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
+WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
+       ORDER BY ROUTINE_NAME;
+ROUTINE_NAME
+proc
+one
+DROP DATABASE bug25717383;
index dc35a1463610a61db8e34ad5f98ed31bbda43697..9e394354254e637f3ad1e5bc3b241b03d2cf6f15 100644 (file)
@@ -443,6 +443,10 @@ select master_pos_wait(1);
 ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
 select master_pos_wait(1, 2, 3, 4);
 ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
+SET @save_sql_mode_before_master_pos_wait=@@SESSION.SQL_MODE;
+SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES";
+select master_pos_wait('master-bin.999999', 4, -1);
+SET @@SESSION.SQL_MODE=@save_sql_mode_before_master_pos_wait;
 select rand(1, 2, 3);
 ERROR 42000: Incorrect parameter count in the call to native function 'rand'
 select round(1, 2, 3);
index 8347eeb937b9cbda02999bc2f3612b3de9a1cb1a..43e6f1d821a23f1c8ddad9480a1125a2145f991b 100644 (file)
@@ -3920,3 +3920,30 @@ SELECT * FROM t1;
 ERROR 70100: Query execution was interrupted
 # Connection default
 DROP TABLE t1;
+#
+# Bug#19894382 - SERVER SIDE PREPARED STATEMENTS LEADS TO POTENTIAL OFF-BY-SECOND
+#                TIMESTAMP ON SLAVE.
+#
+CREATE TABLE bug19894382(f1 CHAR(64) DEFAULT 'slave',
+f2 TIME, f3 TIMESTAMP NULL, f4 DATETIME,
+f5 TIME(3), f6 TIMESTAMP(3) NULL, f7 DATETIME(3));
+# Execute prepared statements from mysql_client_test.
+# Insert tuples from the client_test_db.bug19894382 to the test.bug19894382.
+# Tuples in the client_test_db.bug19894382 are inserted from the mysql_client_test.
+INSERT INTO bug19894382 SELECT * FROM client_test_db.bug19894382;
+# Replay binlog events
+# Insert tuples from the client_test_db.bug19894382 to the test.bug19894382.
+# Tuples in the client_test_db.bug19894382 are inserted from the binlog.
+INSERT INTO bug19894382(f2, f3, f4, f5, f6, f7)
+SELECT f2, f3, f4, f5, f6, f7 FROM client_test_db.bug19894382;
+# With fix, tuples of "master" and "slave" will be same. There will not be any difference
+# in values inserted for time, timestamp and datetime type columns.
+SELECT * FROM bug19894382 ORDER BY f2;
+f1     f2      f3      f4      f5      f6      f7
+master 07:30:30        2015-04-24 13:30:30     2015-04-24 07:30:30     07:30:30.005    2015-04-24 13:30:30.005 2015-04-24 07:30:30.005
+slave  07:30:30        2015-04-24 13:30:30     2015-04-24 07:30:30     07:30:30.005    2015-04-24 13:30:30.005 2015-04-24 07:30:30.005
+master 07:30:31        2015-04-24 13:30:31     2015-04-24 07:30:31     07:30:30.502    2015-04-24 13:30:30.502 2015-04-24 07:30:30.502
+slave  07:30:31        2015-04-24 13:30:31     2015-04-24 07:30:31     07:30:30.502    2015-04-24 13:30:30.502 2015-04-24 07:30:30.502
+# Cleanup
+DROP DATABASE client_test_db;
+DROP TABLE bug19894382;
index 6a95e208bc00f28caae0a847fef1aab8f36c51f9..6cf2f30ef5a9bdd12d72d0771a980246d9a11ce3 100644 (file)
@@ -38,8 +38,8 @@ DROP TABLE t1;
 # mysql
 Unknown value to --ssl-mode: ''. Use --ssl-mode=REQUIRED
 Unknown value to --ssl-mode: 'DERIUQER'. Use --ssl-mode=REQUIRED
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
+ERROR 2026 (HY000): SSL connection error: Client is not configured to use SSL
+ERROR 2026 (HY000): SSL connection error: Client is not configured to use SSL
+ERROR 2026 (HY000): SSL connection error: Client is not configured to use SSL
 
 End of tests
index 4955efab82e811b8c23eb39f556356795319e038..b0357499e5bb1dc4c08413b474e40bb750d20cad 100644 (file)
@@ -1,23 +1,23 @@
 # negative client tests
 # mysql
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
+ERROR 2026 (HY000): SSL connection error: Server doesn't support SSL
+ERROR 2026 (HY000): SSL connection error: Server doesn't support SSL
+ERROR 2026 (HY000): SSL connection error: Server doesn't support SSL
+ERROR 2026 (HY000): SSL connection error: Server doesn't support SSL
 # mysqldump
-mysqldump: Got error: 2026: --ssl-mode=REQUIRED option forbids non SSL connections when trying to connect
+mysqldump: Got error: 2026: SSL connection error: Server doesn't support SSL when trying to connect
 # mysqladmin
 Warning: Using a password on the command line interface can be insecure.
-mysqladmin: error: '--ssl-mode=REQUIRED option forbids non SSL connections'
+mysqladmin: error: 'SSL connection error: Server doesn't support SSL'
 # mysqlcheck
-mysqlcheck: Got error: 2026: --ssl-mode=REQUIRED option forbids non SSL connections when trying to connect
+mysqlcheck: Got error: 2026: SSL connection error: Server doesn't support SSL when trying to connect
 # mysqlimport
-mysqlimport: Error: 2026 --ssl-mode=REQUIRED option forbids non SSL connections
+mysqlimport: Error: 2026 SSL connection error: Server doesn't support SSL
 # mysqlshow
-mysqlshow: --ssl-mode=REQUIRED option forbids non SSL connections
+mysqlshow: SSL connection error: Server doesn't support SSL
 # mysqlslap
-mysqlslap: Error when connecting to server: --ssl-mode=REQUIRED option forbids non SSL connections
+mysqlslap: Error when connecting to server: SSL connection error: Server doesn't support SSL
 # mysqltest
-mysqltest: Could not open connection 'default': 2026 --ssl-mode=REQUIRED option forbids non SSL connections
+mysqltest: Could not open connection 'default': 2026 SSL connection error: Server doesn't support SSL
 
 End of tests
index 0318299dd270552673939fba6bef5bff423626f1..61eb0f6c4fd1084c0f89f3536f48cb93a38e02f6 100644 (file)
@@ -213,3 +213,14 @@ t2 CREATE TABLE `t2` (
   PRIMARY KEY (`a`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop tables t1, t2;
+#
+# Test for bug #25514146 DB_NAME IS IGNORED WHEN CREATING TABLE
+# WITH DATA DIRECTORY
+#
+# Make sure we have no current database
+CREATE DATABASE x;
+USE x;
+DROP DATABASE x;
+CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM
+DATA DIRECTORY "MYSQLTEST_VARDIR/tmp";
+DROP TABLE test.t1;
index f001e4710816637d74fc23423bfe1a31c072a26c..7ca8c54efa88669a4d40bf4493bacea43fd92e9d 100755 (executable)
@@ -1,6 +1,6 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, 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 Library General Public
diff --git a/mysql-wsrep-5.6/mysql-test/suite/innodb/r/end_range_check.result b/mysql-wsrep-5.6/mysql-test/suite/innodb/r/end_range_check.result
new file mode 100644 (file)
index 0000000..c9d9dbf
--- /dev/null
@@ -0,0 +1,54 @@
+# Bug #23481444        OPTIMISER CALL ROW_SEARCH_MVCC() AND READ
+#              THE INDEX APPLIED BY UNCOMMITTED ROWS.
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+f2 INT NOT NULL, f3 INT NOT NULL,
+KEY(f2, f3))ENGINE=INNODB;
+CREATE PROCEDURE populate_t1(IN BASE INT, IN SIZE INT)
+BEGIN
+DECLARE i INT DEFAULT BASE;
+WHILE (i <= SIZE) DO
+INSERT INTO t1(f2, f3) values (i, i);
+SET i = i + 1;
+END WHILE;
+END|
+CALL populate_t1(1, 10000);
+INSERT INTO t1(f2, f3) VALUES(10000, 10000);
+BEGIN;
+CALL populate_t1(10001, 20000);
+SELECT SQL_NO_CACHE f2, f3 FROM t1 WHERE f2=10000 and f3 between 9999 and 10000;
+f2     f3
+10000  10000
+10000  10000
+DROP TABLE t1;
+CREATE TABLE t1(f2 INT NOT NULL, f3 INT NOT NULL,
+PRIMARY KEY(f2, f3))ENGINE=INNODB;
+CALL populate_t1(1, 10000);
+BEGIN;
+CALL populate_t1(10001, 20000);
+SELECT SQL_NO_CACHE f2, f3 FROM t1 WHERE f2=10000 and f3 between 9999 and 10000;
+f2     f3
+10000  10000
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+f2 INT NOT NULL, f3 INT NOT NULL,
+KEY(f2), KEY(f3))ENGINE=INNODB;
+CALL populate_t1(1, 10000);
+BEGIN;
+CALL populate_t1(10001, 20000);
+SELECT count(*) FROM t1 FORCE INDEX(f2, f3) WHERE f2 < 10000 or f3 < 10000;
+count(*)
+9999
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+f2 INT NOT NULL, f3 INT NOT NULL,
+KEY(f2, f3))ENGINE=INNODB;
+CALL populate_t1(1, 10000);
+CALL populate_t1(100000, 100200);
+BEGIN;
+CALL populate_t1(10001, 20000);
+SELECT SQL_NO_CACHE COUNT(*) FROM t1
+WHERE f2 BETWEEN 9999 AND 10000 OR f2 >= 100000;
+COUNT(*)
+203
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
diff --git a/mysql-wsrep-5.6/mysql-test/suite/innodb/r/ibuf_not_empty.result b/mysql-wsrep-5.6/mysql-test/suite/innodb/r/ibuf_not_empty.result
new file mode 100644 (file)
index 0000000..88d0ea0
--- /dev/null
@@ -0,0 +1,30 @@
+call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'".*".".*"\' in the cache');
+call mtr.add_suppression('InnoDB: Allocated tablespace [0-9]+, old maximum was [0-9]+');
+CREATE TABLE t1(
+a INT AUTO_INCREMENT PRIMARY KEY,
+b CHAR(1),
+c INT,
+INDEX(b))
+ENGINE=InnoDB STATS_PERSISTENT=0;
+SET GLOBAL innodb_change_buffering_debug = 1;
+INSERT INTO t1 VALUES(0,'x',1);
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+# Stop server
+# Restart server.
+insert into t1 values(0,'y',1);
+ERROR HY000: Can't lock file (errno: 165 - Table is read only)
+# Stop server
+# Restart server.
+DROP TABLE t1;
index fb36c98620ee758b98b877c03ff27cf01ed5e599..fe60e3f3bb1745e5e8cc6fd6805079462b51a0b2 100644 (file)
@@ -1,7 +1,9 @@
 call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'".*".".*"\' in the cache');
 call mtr.add_suppression('InnoDB: Allocated tablespace [0-9]+, old maximum was [0-9]+');
 create table t1(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
+create table t2(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
 insert into t1 values(1, 2);
+insert into t2 values(1, 2);
 SET GLOBAL innodb_fast_shutdown = 0;
 # Stop server
 # Restart server.
@@ -29,3 +31,65 @@ ERROR HY000: Table 't1' is read only
 drop table t1;
 show tables;
 Tables_in_test
+t2
+# Stop server
+# Restart server.
+select * from t2;
+f1     f2
+1      2
+insert into t2 values(2, 3);
+ERROR HY000: Table 't2' is read only
+alter table t2 add f3 int not null, algorithm=copy;
+ERROR HY000: InnoDB is in read only mode.
+alter table t2 add f3 int not null, algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY.
+drop index idx on t2;
+ERROR HY000: InnoDB is in read only mode.
+update t2 set f1=3 where f2=2;
+ERROR HY000: Table 't2' is read only
+create table t4(f1 int not null)engine=innodb;
+ERROR HY000: InnoDB is in read only mode.
+drop table t4;
+ERROR 42S02: Unknown table 'test.t4'
+rename table t2 to t3;
+ERROR HY000: Error on rename of './test/t2' to './test/t3' (errno: 165 - Table is read only)
+truncate table t2;
+ERROR HY000: Table 't2' is read only
+drop table t2;
+ERROR 42S02: Unknown table 'test.t2'
+show tables;
+Tables_in_test
+t2
+# Stop server
+# Restart server.
+select * from t2;
+f1     f2
+1      2
+insert into t2 values(2, 3);
+ERROR HY000: Can't lock file (errno: 165 - Table is read only)
+alter table t2 add f3 int not null, algorithm=copy;
+ERROR HY000: Can't lock file (errno: 165 - Table is read only)
+alter table t2 add f3 int not null, algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY.
+drop index idx on t2;
+ERROR HY000: Can't lock file (errno: 165 - Table is read only)
+update t2 set f1=3 where f2=2;
+ERROR HY000: Can't lock file (errno: 165 - Table is read only)
+create table t4(f1 int not null)engine=innodb;
+ERROR HY000: InnoDB is in read only mode.
+drop table t4;
+ERROR 42S02: Unknown table 'test.t4'
+rename table t2 to t3;
+ERROR HY000: Error on rename of './test/t2' to './test/t3' (errno: 165 - Table is read only)
+truncate table t2;
+ERROR HY000: Table 't2' is read only
+drop table t2;
+ERROR 42S02: Unknown table 'test.t2'
+show tables;
+Tables_in_test
+t2
+# Stop server
+# Restart server.
+drop table t2;
+show tables;
+Tables_in_test
diff --git a/mysql-wsrep-5.6/mysql-test/suite/innodb/r/innodb_io_pf.result b/mysql-wsrep-5.6/mysql-test/suite/innodb/r/innodb_io_pf.result
new file mode 100644 (file)
index 0000000..816bd47
--- /dev/null
@@ -0,0 +1,19 @@
+USE test;
+CREATE TABLE t1(id INT);
+INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
+SELECT * FROM t1;
+id
+1
+2
+3
+4
+5
+USE performance_schema;
+SELECT EVENT_NAME,COUNT_STAR FROM performance_schema.file_summary_by_event_name
+WHERE EVENT_NAME like "%inno%";
+EVENT_NAME     COUNT_STAR
+wait/io/file/innodb/innodb_data_file   5
+wait/io/file/innodb/innodb_log_file    5
+wait/io/file/innodb/innodb_temp_file   5
+USE test;
+DROP table t1;
diff --git a/mysql-wsrep-5.6/mysql-test/suite/innodb/r/undo_space_id.result b/mysql-wsrep-5.6/mysql-test/suite/innodb/r/undo_space_id.result
new file mode 100644 (file)
index 0000000..b31e71d
--- /dev/null
@@ -0,0 +1,11 @@
+# Start mysqld to create tablespaces according to my.cnf
+ib_logfile0
+ib_logfile1
+ib_logfile2
+ibdata1
+ibdata2
+my.cnf
+my_restart.err
+undo003
+undo004
+undo005
diff --git a/mysql-wsrep-5.6/mysql-test/suite/innodb/t/end_range_check.test b/mysql-wsrep-5.6/mysql-test/suite/innodb/t/end_range_check.test
new file mode 100644 (file)
index 0000000..a550294
--- /dev/null
@@ -0,0 +1,77 @@
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+--source include/big_test.inc
+
+--echo # Bug #23481444 OPTIMISER CALL ROW_SEARCH_MVCC() AND READ
+--echo #               THE INDEX APPLIED BY UNCOMMITTED ROWS.
+
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+               f2 INT NOT NULL, f3 INT NOT NULL,
+               KEY(f2, f3))ENGINE=INNODB;
+
+DELIMITER |;
+CREATE PROCEDURE populate_t1(IN BASE INT, IN SIZE INT)
+BEGIN
+       DECLARE i INT DEFAULT BASE;
+       WHILE (i <= SIZE) DO
+               INSERT INTO t1(f2, f3) values (i, i);
+               SET i = i + 1;
+       END WHILE;
+END|
+DELIMITER ;|
+CALL populate_t1(1, 10000);
+INSERT INTO t1(f2, f3) VALUES(10000, 10000);
+
+BEGIN;
+CALL populate_t1(10001, 20000);
+
+connect (con1,localhost,root,,);
+connection con1;
+SELECT SQL_NO_CACHE f2, f3 FROM t1 WHERE f2=10000 and f3 between 9999 and 10000;
+connection default;
+DROP TABLE t1;
+
+CREATE TABLE t1(f2 INT NOT NULL, f3 INT NOT NULL,
+               PRIMARY KEY(f2, f3))ENGINE=INNODB;
+
+CALL populate_t1(1, 10000);
+
+BEGIN;
+CALL populate_t1(10001, 20000);
+
+connection con1;
+SELECT SQL_NO_CACHE f2, f3 FROM t1 WHERE f2=10000 and f3 between 9999 and 10000;
+connection default;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+               f2 INT NOT NULL, f3 INT NOT NULL,
+               KEY(f2), KEY(f3))ENGINE=INNODB;
+CALL populate_t1(1, 10000);
+
+BEGIN;
+CALL populate_t1(10001, 20000);
+
+connection con1;
+SELECT count(*) FROM t1 FORCE INDEX(f2, f3) WHERE f2 < 10000 or f3 < 10000;
+connection default;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+               f2 INT NOT NULL, f3 INT NOT NULL,
+               KEY(f2, f3))ENGINE=INNODB;
+
+CALL populate_t1(1, 10000);
+CALL populate_t1(100000, 100200);
+
+BEGIN;
+CALL populate_t1(10001, 20000);
+
+connection con1;
+SELECT SQL_NO_CACHE COUNT(*) FROM t1
+WHERE f2 BETWEEN 9999 AND 10000 OR f2 >= 100000;
+disconnect con1;
+connection default;
+
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
diff --git a/mysql-wsrep-5.6/mysql-test/suite/innodb/t/ibuf_not_empty-master.opt b/mysql-wsrep-5.6/mysql-test/suite/innodb/t/ibuf_not_empty-master.opt
new file mode 100644 (file)
index 0000000..e5d7090
--- /dev/null
@@ -0,0 +1 @@
+--innodb_buffer_pool_size=24M
diff --git a/mysql-wsrep-5.6/mysql-test/suite/innodb/t/ibuf_not_empty.test b/mysql-wsrep-5.6/mysql-test/suite/innodb/t/ibuf_not_empty.test
new file mode 100644 (file)
index 0000000..1d3f878
--- /dev/null
@@ -0,0 +1,102 @@
+--source include/have_innodb.inc
+# innodb_change_buffering_debug option is debug only
+--source include/have_debug.inc
+# Embedded server does not support crashing
+--source include/not_embedded.inc
+
+
+call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'".*".".*"\' in the cache');
+call mtr.add_suppression('InnoDB: Allocated tablespace [0-9]+, old maximum was [0-9]+');
+
+CREATE TABLE t1(
+        a INT AUTO_INCREMENT PRIMARY KEY,
+        b CHAR(1),
+        c INT,
+        INDEX(b))
+ENGINE=InnoDB STATS_PERSISTENT=0;
+
+# The flag innodb_change_buffering_debug is only available in debug builds.
+# It instructs InnoDB to try to evict pages from the buffer pool when
+# change buffering is possible, so that the change buffer will be used
+# whenever possible.
+SET GLOBAL innodb_change_buffering_debug = 1;
+
+# Create enough rows for the table, so that the change buffer will be
+# used for modifying the secondary index page. There must be multiple
+# index pages, because changes to the root page are never buffered.
+INSERT INTO t1 VALUES(0,'x',1);
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+
+# Restart the server in force recovery mode
+--echo # Stop server
+
+# Write file to make mysql-test-run.pl wait for the server to stop
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Request shutdown
+-- send_shutdown
+
+# Call script that will poll the server waiting for it to disapear
+-- source include/wait_until_disconnected.inc
+
+--echo # Restart server.
+
+# Write file to make mysql-test-run.pl start up the server again, ensure
+# that no background threads are started, so that we can check that it
+# shuts down properly.
+--exec echo "restart:--innodb-force-recovery=6" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
+
+--error ER_CANT_LOCK
+insert into t1 values(0,'y',1);
+
+# Restart the server in force recovery mode
+--echo # Stop server
+
+# Write file to make mysql-test-run.pl wait for the server to stop
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Request shutdown
+-- send_shutdown
+
+# Call script that will poll the server waiting for it to disapear
+-- source include/wait_until_disconnected.inc
+
+--echo # Restart server.
+
+# Write file to make mysql-test-run.pl start up the server again, ensure
+# that no background threads are started, so that we can check that it
+# shuts down properly.
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
+
+# Cleanup
+DROP TABLE t1;
index 0feeafda75e185b208ed383f351d85a1f080ce29..9912a907067b3abbf3de9854a3a2814cb53aa5da 100644 (file)
@@ -8,7 +8,9 @@ call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'".*".".*
 call mtr.add_suppression('InnoDB: Allocated tablespace [0-9]+, old maximum was [0-9]+');
 
 create table t1(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
+create table t2(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
 insert into t1 values(1, 2);
+insert into t2 values(1, 2);
 
 SET GLOBAL innodb_fast_shutdown = 0;
 
@@ -71,3 +73,156 @@ truncate table t1;
 
 drop table t1;
 show tables;
+
+# Restart the server in force recovery mode
+--echo # Stop server
+
+# Write file to make mysql-test-run.pl wait for the server to stop
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Request shutdown
+-- send_shutdown
+
+# Call script that will poll the server waiting for it to disapear
+-- source include/wait_until_disconnected.inc
+
+--echo # Restart server.
+
+# Write file to make mysql-test-run.pl start up the server again, ensure
+# that no background threads are started, so that we can check that it
+# shuts down properly.
+--exec echo "restart:--innodb-force-recovery=5" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
+
+select * from t2;
+
+--error ER_OPEN_AS_READONLY
+insert into t2 values(2, 3);
+
+--error ER_INNODB_READ_ONLY
+alter table t2 add f3 int not null, algorithm=copy;
+
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+alter table t2 add f3 int not null, algorithm=inplace;
+
+--error ER_INNODB_READ_ONLY
+drop index idx on t2;
+
+--error ER_OPEN_AS_READONLY
+update t2 set f1=3 where f2=2;
+
+--error ER_INNODB_READ_ONLY
+create table t4(f1 int not null)engine=innodb;
+
+--error ER_BAD_TABLE_ERROR
+drop table t4;
+
+--error ER_ERROR_ON_RENAME
+rename table t2 to t3;
+
+--error ER_OPEN_AS_READONLY
+truncate table t2;
+
+--error ER_BAD_TABLE_ERROR
+drop table t2;
+show tables;
+
+# Restart the server in force recovery mode
+--echo # Stop server
+
+# Write file to make mysql-test-run.pl wait for the server to stop
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Request shutdown
+-- send_shutdown
+
+# Call script that will poll the server waiting for it to disapear
+-- source include/wait_until_disconnected.inc
+
+--echo # Restart server.
+
+# Write file to make mysql-test-run.pl start up the server again, ensure
+# that no background threads are started, so that we can check that it
+# shuts down properly.
+--exec echo "restart:--innodb-force-recovery=6" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
+
+select * from t2;
+
+--error ER_CANT_LOCK
+insert into t2 values(2, 3);
+
+--error ER_CANT_LOCK
+alter table t2 add f3 int not null, algorithm=copy;
+
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+alter table t2 add f3 int not null, algorithm=inplace;
+
+--error ER_CANT_LOCK
+drop index idx on t2;
+
+--error ER_CANT_LOCK
+update t2 set f1=3 where f2=2;
+
+--error ER_INNODB_READ_ONLY
+create table t4(f1 int not null)engine=innodb;
+
+--error ER_BAD_TABLE_ERROR
+drop table t4;
+
+--error ER_ERROR_ON_RENAME
+rename table t2 to t3;
+
+--error ER_OPEN_AS_READONLY
+truncate table t2;
+
+--error ER_BAD_TABLE_ERROR
+drop table t2;
+show tables;
+
+# Restart the server without force recovery mode
+--echo # Stop server
+
+# Write file to make mysql-test-run.pl wait for the server to stop
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Request shutdown
+-- send_shutdown
+
+# Call script that will poll the server waiting for it to disapear
+-- source include/wait_until_disconnected.inc
+
+--echo # Restart server.
+
+# Write file to make mysql-test-run.pl start up the server again, ensure
+# that no background threads are started, so that we can check that it
+# shuts down properly.
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
+
+drop table t2;
+show tables;
diff --git a/mysql-wsrep-5.6/mysql-test/suite/innodb/t/innodb_io_pf.test b/mysql-wsrep-5.6/mysql-test/suite/innodb/t/innodb_io_pf.test
new file mode 100644 (file)
index 0000000..8d4b71f
--- /dev/null
@@ -0,0 +1,15 @@
+--source include/have_innodb.inc
+--source include/have_perfschema.inc
+--source include/not_embedded.inc
+
+USE test;
+CREATE TABLE t1(id INT);
+INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
+SELECT * FROM t1;
+
+USE performance_schema;
+--replace_column 2 5
+SELECT EVENT_NAME,COUNT_STAR FROM performance_schema.file_summary_by_event_name
+               WHERE EVENT_NAME like "%inno%";
+USE test;
+DROP table t1;
diff --git a/mysql-wsrep-5.6/mysql-test/suite/innodb/t/undo_space_id.test b/mysql-wsrep-5.6/mysql-test/suite/innodb/t/undo_space_id.test
new file mode 100644 (file)
index 0000000..f45a956
--- /dev/null
@@ -0,0 +1,30 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+let bugdir= $MYSQLTEST_VARDIR/tmp/datadir1;
+--mkdir $bugdir
+
+let SEARCH_FILE = $bugdir/my_restart.err;
+let $args=--defaults-file=$bugdir/my.cnf --datadir=$bugdir --secure-file-priv="" --loose-console > $SEARCH_FILE 2>&1 ;
+
+--write_file $bugdir/my.cnf
+[mysqld]
+EOF
+
+--exec echo "innodb_data_home_dir = $bugdir" >> $bugdir/my.cnf
+
+--append_file $bugdir/my.cnf
+innodb_data_file_path = ibdata1:10M;ibdata2:10M:autoextend
+innodb_undo_tablespaces = 3
+innodb_log_files_in_group = 3
+EOF
+
+# Innodb creates system tablespaces according to my.cnf and aborts
+# after creating undo tablespace.
+--echo # Start mysqld to create tablespaces according to my.cnf
+--error 2
+--exec $MYSQLD $args --skip-grant-tables --debug=d,innodb_undo_upgrade --innodb-unknown-parameter
+
+--list_files $bugdir
+--remove_files_wildcard $bugdir
+--rmdir $bugdir
index dc8e4db5163f9076f35228845bafa2300c272763..ec6b8880eab8e3cf2ccd997ebfb01f45541e1c53 100644 (file)
@@ -349,20 +349,19 @@ CREATE TABLE t1 (
 ) ENGINE=INNODB;
 INSERT INTO t1 VALUES ('a',1),('a',2),('a',3),('b',1),('b',4),('c',1),('d',1),
                       ('c',4),('d',3),('e',2),('f',2);
+ANALYZE TABLE t1;
 
 SET @optimizer_switch_saved=@@session.optimizer_switch;
 SET @@session.optimizer_switch=default;
-SET optimizer_trace="enabled=on";
 
 # Uses "access_type_changed" to use range over ref despite b_idx not being the
 # cheapest in range.
 EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2;
 
 # Output of table_scan in test_quick_select is not always reliable.
---replace_regex /"rows": 12/"rows": 11/ /"cost": 5.5/"cost": 5.3/
-SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT TRACE into @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "rerunning_range_optimizer_for_single_index";
 
-SET optimizer_trace="enabled=off";
 SET @@session.optimizer_switch=@optimizer_switch_saved;
 
 DROP TABLE t1;
index 08da7b99a674781734cc7bb79a3f5e47709371d0..d2f3ac88856a5ce2d7c9953b1f88e39a5208ed9f 100644 (file)
@@ -2447,299 +2447,17 @@ KEY b_idx(b)
 ) ENGINE=INNODB;
 INSERT INTO t1 VALUES ('a',1),('a',2),('a',3),('b',1),('b',4),('c',1),('d',1),
 ('c',4),('d',3),('e',2),('f',2);
+ANALYZE TABLE t1;
+Table  Op      Msg_type        Msg_text
+test.t1        analyze status  OK
 SET @optimizer_switch_saved=@@session.optimizer_switch;
 SET @@session.optimizer_switch=default;
-SET optimizer_trace="enabled=on";
 EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2;
 id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 1      SIMPLE  t1      range   PRIMARY,b_idx   b_idx   35      NULL    2       Using index condition; Using where
-SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
-QUERY  TRACE   MISSING_BYTES_BEYOND_MAX_MEM_SIZE       INSUFFICIENT_PRIVILEGES
-EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2       {
-  "steps": [
-    {
-      "join_preparation": {
-        "select#": 1,
-        "steps": [
-          {
-            "expanded_query": "/* select#1 */ select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where ((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))"
-          }
-        ] /* steps */
-      } /* join_preparation */
-    },
-    {
-      "join_optimization": {
-        "select#": 1,
-        "steps": [
-          {
-            "condition_processing": {
-              "condition": "WHERE",
-              "original_condition": "((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))",
-              "steps": [
-                {
-                  "transformation": "equality_propagation",
-                  "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
-                },
-                {
-                  "transformation": "constant_propagation",
-                  "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
-                },
-                {
-                  "transformation": "trivial_condition_removal",
-                  "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
-                }
-              ] /* steps */
-            } /* condition_processing */
-          },
-          {
-            "table_dependencies": [
-              {
-                "table": "`t1`",
-                "row_may_be_null": false,
-                "map_bit": 0,
-                "depends_on_map_bits": [
-                ] /* depends_on_map_bits */
-              }
-            ] /* table_dependencies */
-          },
-          {
-            "ref_optimizer_key_uses": [
-              {
-                "table": "`t1`",
-                "field": "b",
-                "equals": "2",
-                "null_rejecting": false
-              }
-            ] /* ref_optimizer_key_uses */
-          },
-          {
-            "rows_estimation": [
-              {
-                "table": "`t1`",
-                "range_analysis": {
-                  "table_scan": {
-                    "rows": 11,
-                    "cost": 5.3
-                  } /* table_scan */,
-                  "potential_range_indices": [
-                    {
-                      "index": "PRIMARY",
-                      "usable": true,
-                      "key_parts": [
-                        "a",
-                        "b"
-                      ] /* key_parts */
-                    },
-                    {
-                      "index": "b_idx",
-                      "usable": true,
-                      "key_parts": [
-                        "b",
-                        "a"
-                      ] /* key_parts */
-                    }
-                  ] /* potential_range_indices */,
-                  "setup_range_conditions": [
-                  ] /* setup_range_conditions */,
-                  "group_index_range": {
-                    "chosen": false,
-                    "cause": "not_group_by_or_distinct"
-                  } /* group_index_range */,
-                  "analyzing_range_alternatives": {
-                    "range_scan_alternatives": [
-                      {
-                        "index": "PRIMARY",
-                        "ranges": [
-                          "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
-                          "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
-                        ] /* ranges */,
-                        "index_dives_for_eq_ranges": true,
-                        "rowid_ordered": true,
-                        "using_mrr": false,
-                        "index_only": false,
-                        "rows": 2,
-                        "cost": 2.41,
-                        "chosen": true
-                      },
-                      {
-                        "index": "b_idx",
-                        "ranges": [
-                          "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
-                          "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
-                        ] /* ranges */,
-                        "index_dives_for_eq_ranges": true,
-                        "rowid_ordered": false,
-                        "using_mrr": false,
-                        "index_only": false,
-                        "rows": 2,
-                        "cost": 4.41,
-                        "chosen": false,
-                        "cause": "cost"
-                      }
-                    ] /* range_scan_alternatives */,
-                    "analyzing_roworder_intersect": {
-                      "usable": false,
-                      "cause": "too_few_roworder_scans"
-                    } /* analyzing_roworder_intersect */
-                  } /* analyzing_range_alternatives */,
-                  "chosen_range_access_summary": {
-                    "range_access_plan": {
-                      "type": "range_scan",
-                      "index": "PRIMARY",
-                      "rows": 2,
-                      "ranges": [
-                        "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
-                        "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
-                      ] /* ranges */
-                    } /* range_access_plan */,
-                    "rows_for_plan": 2,
-                    "cost_for_plan": 2.41,
-                    "chosen": true
-                  } /* chosen_range_access_summary */
-                } /* range_analysis */
-              }
-            ] /* rows_estimation */
-          },
-          {
-            "considered_execution_plans": [
-              {
-                "plan_prefix": [
-                ] /* plan_prefix */,
-                "table": "`t1`",
-                "best_access_path": {
-                  "considered_access_paths": [
-                    {
-                      "access_type": "ref",
-                      "index": "b_idx",
-                      "rows": 2,
-                      "cost": 2.4,
-                      "chosen": true
-                    },
-                    {
-                      "access_type": "range",
-                      "rows": 2,
-                      "cost": 2.81,
-                      "chosen": false
-                    }
-                  ] /* considered_access_paths */
-                } /* best_access_path */,
-                "cost_for_plan": 2.4,
-                "rows_for_plan": 2,
-                "chosen": true
-              }
-            ] /* considered_execution_plans */
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))",
-              "attached_conditions_computation": [
-                {
-                  "rerunning_range_optimizer_for_single_index": [
-                    {
-                      "table_scan": {
-                        "rows": 11,
-                        "cost": 5.3
-                      } /* table_scan */,
-                      "potential_range_indices": [
-                        {
-                          "index": "PRIMARY",
-                          "usable": false,
-                          "cause": "not_applicable"
-                        },
-                        {
-                          "index": "b_idx",
-                          "usable": true,
-                          "key_parts": [
-                            "b",
-                            "a"
-                          ] /* key_parts */
-                        }
-                      ] /* potential_range_indices */,
-                      "setup_range_conditions": [
-                      ] /* setup_range_conditions */,
-                      "group_index_range": {
-                        "chosen": false,
-                        "cause": "not_group_by_or_distinct"
-                      } /* group_index_range */,
-                      "analyzing_range_alternatives": {
-                        "range_scan_alternatives": [
-                          {
-                            "index": "b_idx",
-                            "ranges": [
-                              "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
-                              "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
-                            ] /* ranges */,
-                            "index_dives_for_eq_ranges": true,
-                            "rowid_ordered": false,
-                            "using_mrr": false,
-                            "index_only": false,
-                            "rows": 2,
-                            "cost": 4.41,
-                            "chosen": true
-                          }
-                        ] /* range_scan_alternatives */,
-                        "analyzing_roworder_intersect": {
-                          "usable": false,
-                          "cause": "too_few_roworder_scans"
-                        } /* analyzing_roworder_intersect */
-                      } /* analyzing_range_alternatives */,
-                      "chosen_range_access_summary": {
-                        "range_access_plan": {
-                          "type": "range_scan",
-                          "index": "b_idx",
-                          "rows": 2,
-                          "ranges": [
-                            "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
-                            "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
-                          ] /* ranges */
-                        } /* range_access_plan */,
-                        "rows_for_plan": 2,
-                        "cost_for_plan": 4.41,
-                        "chosen": true
-                      } /* chosen_range_access_summary */
-                    } /* range_analysis */
-                  ] /* rerunning_range_optimizer_for_single_index */
-                },
-                {
-                  "access_type_changed": {
-                    "table": "`t1`",
-                    "index": "b_idx",
-                    "old_type": "ref",
-                    "new_type": "range",
-                    "cause": "uses_more_keyparts"
-                  } /* access_type_changed */
-                }
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
-                {
-                  "table": "`t1`",
-                  "attached": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))"
-                }
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
-          },
-          {
-            "refine_plan": [
-              {
-                "table": "`t1`",
-                "pushed_index_condition": "(`t1`.`b` = 2)",
-                "table_condition_attached": "(`t1`.`a` in ('a','b'))",
-                "access_type": "range"
-              }
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_explain": {
-        "select#": 1,
-        "steps": [
-        ] /* steps */
-      } /* join_explain */
-    }
-  ] /* steps */
-}      0       0
-SET optimizer_trace="enabled=off";
+SELECT TRACE into @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "rerunning_range_optimizer_for_single_index";
+@trace RLIKE "rerunning_range_optimizer_for_single_index"
+1
 SET @@session.optimizer_switch=@optimizer_switch_saved;
 DROP TABLE t1;
index 1143d39622f9f69be246f29358b7d16ec1818d2c..abb4c28ca716667604c95728b8c4ab49cd8ef2ee 100644 (file)
@@ -1907,299 +1907,17 @@ KEY b_idx(b)
 ) ENGINE=INNODB;
 INSERT INTO t1 VALUES ('a',1),('a',2),('a',3),('b',1),('b',4),('c',1),('d',1),
 ('c',4),('d',3),('e',2),('f',2);
+ANALYZE TABLE t1;
+Table  Op      Msg_type        Msg_text
+test.t1        analyze status  OK
 SET @optimizer_switch_saved=@@session.optimizer_switch;
 SET @@session.optimizer_switch=default;
-SET optimizer_trace="enabled=on";
 EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2;
 id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 1      SIMPLE  t1      range   PRIMARY,b_idx   b_idx   35      NULL    2       Using index condition; Using where
-SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
-QUERY  TRACE   MISSING_BYTES_BEYOND_MAX_MEM_SIZE       INSUFFICIENT_PRIVILEGES
-EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2       {
-  "steps": [
-    {
-      "join_preparation": {
-        "select#": 1,
-        "steps": [
-          {
-            "expanded_query": "/* select#1 */ select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where ((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))"
-          }
-        ] /* steps */
-      } /* join_preparation */
-    },
-    {
-      "join_optimization": {
-        "select#": 1,
-        "steps": [
-          {
-            "condition_processing": {
-              "condition": "WHERE",
-              "original_condition": "((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))",
-              "steps": [
-                {
-                  "transformation": "equality_propagation",
-                  "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
-                },
-                {
-                  "transformation": "constant_propagation",
-                  "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
-                },
-                {
-                  "transformation": "trivial_condition_removal",
-                  "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
-                }
-              ] /* steps */
-            } /* condition_processing */
-          },
-          {
-            "table_dependencies": [
-              {
-                "table": "`t1`",
-                "row_may_be_null": false,
-                "map_bit": 0,
-                "depends_on_map_bits": [
-                ] /* depends_on_map_bits */
-              }
-            ] /* table_dependencies */
-          },
-          {
-            "ref_optimizer_key_uses": [
-              {
-                "table": "`t1`",
-                "field": "b",
-                "equals": "2",
-                "null_rejecting": false
-              }
-            ] /* ref_optimizer_key_uses */
-          },
-          {
-            "rows_estimation": [
-              {
-                "table": "`t1`",
-                "range_analysis": {
-                  "table_scan": {
-                    "rows": 11,
-                    "cost": 5.3
-                  } /* table_scan */,
-                  "potential_range_indices": [
-                    {
-                      "index": "PRIMARY",
-                      "usable": true,
-                      "key_parts": [
-                        "a",
-                        "b"
-                      ] /* key_parts */
-                    },
-                    {
-                      "index": "b_idx",
-                      "usable": true,
-                      "key_parts": [
-                        "b",
-                        "a"
-                      ] /* key_parts */
-                    }
-                  ] /* potential_range_indices */,
-                  "setup_range_conditions": [
-                  ] /* setup_range_conditions */,
-                  "group_index_range": {
-                    "chosen": false,
-                    "cause": "not_group_by_or_distinct"
-                  } /* group_index_range */,
-                  "analyzing_range_alternatives": {
-                    "range_scan_alternatives": [
-                      {
-                        "index": "PRIMARY",
-                        "ranges": [
-                          "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
-                          "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
-                        ] /* ranges */,
-                        "index_dives_for_eq_ranges": true,
-                        "rowid_ordered": true,
-                        "using_mrr": false,
-                        "index_only": false,
-                        "rows": 2,
-                        "cost": 2.41,
-                        "chosen": true
-                      },
-                      {
-                        "index": "b_idx",
-                        "ranges": [
-                          "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
-                          "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
-                        ] /* ranges */,
-                        "index_dives_for_eq_ranges": true,
-                        "rowid_ordered": false,
-                        "using_mrr": false,
-                        "index_only": false,
-                        "rows": 2,
-                        "cost": 4.41,
-                        "chosen": false,
-                        "cause": "cost"
-                      }
-                    ] /* range_scan_alternatives */,
-                    "analyzing_roworder_intersect": {
-                      "usable": false,
-                      "cause": "too_few_roworder_scans"
-                    } /* analyzing_roworder_intersect */
-                  } /* analyzing_range_alternatives */,
-                  "chosen_range_access_summary": {
-                    "range_access_plan": {
-                      "type": "range_scan",
-                      "index": "PRIMARY",
-                      "rows": 2,
-                      "ranges": [
-                        "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
-                        "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
-                      ] /* ranges */
-                    } /* range_access_plan */,
-                    "rows_for_plan": 2,
-                    "cost_for_plan": 2.41,
-                    "chosen": true
-                  } /* chosen_range_access_summary */
-                } /* range_analysis */
-              }
-            ] /* rows_estimation */
-          },
-          {
-            "considered_execution_plans": [
-              {
-                "plan_prefix": [
-                ] /* plan_prefix */,
-                "table": "`t1`",
-                "best_access_path": {
-                  "considered_access_paths": [
-                    {
-                      "access_type": "ref",
-                      "index": "b_idx",
-                      "rows": 2,
-                      "cost": 2.4,
-                      "chosen": true
-                    },
-                    {
-                      "access_type": "range",
-                      "rows": 2,
-                      "cost": 2.81,
-                      "chosen": false
-                    }
-                  ] /* considered_access_paths */
-                } /* best_access_path */,
-                "cost_for_plan": 2.4,
-                "rows_for_plan": 2,
-                "chosen": true
-              }
-            ] /* considered_execution_plans */
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))",
-              "attached_conditions_computation": [
-                {
-                  "rerunning_range_optimizer_for_single_index": [
-                    {
-                      "table_scan": {
-                        "rows": 11,
-                        "cost": 5.3
-                      } /* table_scan */,
-                      "potential_range_indices": [
-                        {
-                          "index": "PRIMARY",
-                          "usable": false,
-                          "cause": "not_applicable"
-                        },
-                        {
-                          "index": "b_idx",
-                          "usable": true,
-                          "key_parts": [
-                            "b",
-                            "a"
-                          ] /* key_parts */
-                        }
-                      ] /* potential_range_indices */,
-                      "setup_range_conditions": [
-                      ] /* setup_range_conditions */,
-                      "group_index_range": {
-                        "chosen": false,
-                        "cause": "not_group_by_or_distinct"
-                      } /* group_index_range */,
-                      "analyzing_range_alternatives": {
-                        "range_scan_alternatives": [
-                          {
-                            "index": "b_idx",
-                            "ranges": [
-                              "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
-                              "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
-                            ] /* ranges */,
-                            "index_dives_for_eq_ranges": true,
-                            "rowid_ordered": false,
-                            "using_mrr": false,
-                            "index_only": false,
-                            "rows": 2,
-                            "cost": 4.41,
-                            "chosen": true
-                          }
-                        ] /* range_scan_alternatives */,
-                        "analyzing_roworder_intersect": {
-                          "usable": false,
-                          "cause": "too_few_roworder_scans"
-                        } /* analyzing_roworder_intersect */
-                      } /* analyzing_range_alternatives */,
-                      "chosen_range_access_summary": {
-                        "range_access_plan": {
-                          "type": "range_scan",
-                          "index": "b_idx",
-                          "rows": 2,
-                          "ranges": [
-                            "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
-                            "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
-                          ] /* ranges */
-                        } /* range_access_plan */,
-                        "rows_for_plan": 2,
-                        "cost_for_plan": 4.41,
-                        "chosen": true
-                      } /* chosen_range_access_summary */
-                    } /* range_analysis */
-                  ] /* rerunning_range_optimizer_for_single_index */
-                },
-                {
-                  "access_type_changed": {
-                    "table": "`t1`",
-                    "index": "b_idx",
-                    "old_type": "ref",
-                    "new_type": "range",
-                    "cause": "uses_more_keyparts"
-                  } /* access_type_changed */
-                }
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
-                {
-                  "table": "`t1`",
-                  "attached": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))"
-                }
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
-          },
-          {
-            "refine_plan": [
-              {
-                "table": "`t1`",
-                "pushed_index_condition": "(`t1`.`b` = 2)",
-                "table_condition_attached": "(`t1`.`a` in ('a','b'))",
-                "access_type": "range"
-              }
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_explain": {
-        "select#": 1,
-        "steps": [
-        ] /* steps */
-      } /* join_explain */
-    }
-  ] /* steps */
-}      0       0
-SET optimizer_trace="enabled=off";
+SELECT TRACE into @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "rerunning_range_optimizer_for_single_index";
+@trace RLIKE "rerunning_range_optimizer_for_single_index"
+1
 SET @@session.optimizer_switch=@optimizer_switch_saved;
 DROP TABLE t1;
index 08da7b99a674781734cc7bb79a3f5e47709371d0..d2f3ac88856a5ce2d7c9953b1f88e39a5208ed9f 100644 (file)
@@ -2447,299 +2447,17 @@ KEY b_idx(b)
 ) ENGINE=INNODB;
 INSERT INTO t1 VALUES ('a',1),('a',2),('a',3),('b',1),('b',4),('c',1),('d',1),
 ('c',4),('d',3),('e',2),('f',2);
+ANALYZE TABLE t1;
+Table  Op      Msg_type        Msg_text
+test.t1        analyze status  OK
 SET @optimizer_switch_saved=@@session.optimizer_switch;
 SET @@session.optimizer_switch=default;
-SET optimizer_trace="enabled=on";
 EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2;
 id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 1      SIMPLE  t1      range   PRIMARY,b_idx   b_idx   35      NULL    2       Using index condition; Using where
-SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
-QUERY  TRACE   MISSING_BYTES_BEYOND_MAX_MEM_SIZE       INSUFFICIENT_PRIVILEGES
-EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2       {
-  "steps": [
-    {
-      "join_preparation": {
-        "select#": 1,
-        "steps": [
-          {
-            "expanded_query": "/* select#1 */ select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where ((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))"
-          }
-        ] /* steps */
-      } /* join_preparation */
-    },
-    {
-      "join_optimization": {
-        "select#": 1,
-        "steps": [
-          {
-            "condition_processing": {
-              "condition": "WHERE",
-              "original_condition": "((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))",
-              "steps": [
-                {
-                  "transformation": "equality_propagation",
-                  "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
-                },
-                {
-                  "transformation": "constant_propagation",
-                  "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
-                },
-                {
-                  "transformation": "trivial_condition_removal",
-                  "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
-                }
-              ] /* steps */
-            } /* condition_processing */
-          },
-          {
-            "table_dependencies": [
-              {
-                "table": "`t1`",
-                "row_may_be_null": false,
-                "map_bit": 0,
-                "depends_on_map_bits": [
-                ] /* depends_on_map_bits */
-              }
-            ] /* table_dependencies */
-          },
-          {
-            "ref_optimizer_key_uses": [
-              {
-                "table": "`t1`",
-                "field": "b",
-                "equals": "2",
-                "null_rejecting": false
-              }
-            ] /* ref_optimizer_key_uses */
-          },
-          {
-            "rows_estimation": [
-              {
-                "table": "`t1`",
-                "range_analysis": {
-                  "table_scan": {
-                    "rows": 11,
-                    "cost": 5.3
-                  } /* table_scan */,
-                  "potential_range_indices": [
-                    {
-                      "index": "PRIMARY",
-                      "usable": true,
-                      "key_parts": [
-                        "a",
-                        "b"
-                      ] /* key_parts */
-                    },
-                    {
-                      "index": "b_idx",
-                      "usable": true,
-                      "key_parts": [
-                        "b",
-                        "a"
-                      ] /* key_parts */
-                    }
-                  ] /* potential_range_indices */,
-                  "setup_range_conditions": [
-                  ] /* setup_range_conditions */,
-                  "group_index_range": {
-                    "chosen": false,
-                    "cause": "not_group_by_or_distinct"
-                  } /* group_index_range */,
-                  "analyzing_range_alternatives": {
-                    "range_scan_alternatives": [
-                      {
-                        "index": "PRIMARY",
-                        "ranges": [
-                          "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
-                          "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
-                        ] /* ranges */,
-                        "index_dives_for_eq_ranges": true,
-                        "rowid_ordered": true,
-                        "using_mrr": false,
-                        "index_only": false,
-                        "rows": 2,
-                        "cost": 2.41,
-                        "chosen": true
-                      },
-                      {
-                        "index": "b_idx",
-                        "ranges": [
-                          "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
-                          "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
-                        ] /* ranges */,
-                        "index_dives_for_eq_ranges": true,
-                        "rowid_ordered": false,
-                        "using_mrr": false,
-                        "index_only": false,
-                        "rows": 2,
-                        "cost": 4.41,
-                        "chosen": false,
-                        "cause": "cost"
-                      }
-                    ] /* range_scan_alternatives */,
-                    "analyzing_roworder_intersect": {
-                      "usable": false,
-                      "cause": "too_few_roworder_scans"
-                    } /* analyzing_roworder_intersect */
-                  } /* analyzing_range_alternatives */,
-                  "chosen_range_access_summary": {
-                    "range_access_plan": {
-                      "type": "range_scan",
-                      "index": "PRIMARY",
-                      "rows": 2,
-                      "ranges": [
-                        "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
-                        "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
-                      ] /* ranges */
-                    } /* range_access_plan */,
-                    "rows_for_plan": 2,
-                    "cost_for_plan": 2.41,
-                    "chosen": true
-                  } /* chosen_range_access_summary */
-                } /* range_analysis */
-              }
-            ] /* rows_estimation */
-          },
-          {
-            "considered_execution_plans": [
-              {
-                "plan_prefix": [
-                ] /* plan_prefix */,
-                "table": "`t1`",
-                "best_access_path": {
-                  "considered_access_paths": [
-                    {
-                      "access_type": "ref",
-                      "index": "b_idx",
-                      "rows": 2,
-                      "cost": 2.4,
-                      "chosen": true
-                    },
-                    {
-                      "access_type": "range",
-                      "rows": 2,
-                      "cost": 2.81,
-                      "chosen": false
-                    }
-                  ] /* considered_access_paths */
-                } /* best_access_path */,
-                "cost_for_plan": 2.4,
-                "rows_for_plan": 2,
-                "chosen": true
-              }
-            ] /* considered_execution_plans */
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))",
-              "attached_conditions_computation": [
-                {
-                  "rerunning_range_optimizer_for_single_index": [
-                    {
-                      "table_scan": {
-                        "rows": 11,
-                        "cost": 5.3
-                      } /* table_scan */,
-                      "potential_range_indices": [
-                        {
-                          "index": "PRIMARY",
-                          "usable": false,
-                          "cause": "not_applicable"
-                        },
-                        {
-                          "index": "b_idx",
-                          "usable": true,
-                          "key_parts": [
-                            "b",
-                            "a"
-                          ] /* key_parts */
-                        }
-                      ] /* potential_range_indices */,
-                      "setup_range_conditions": [
-                      ] /* setup_range_conditions */,
-                      "group_index_range": {
-                        "chosen": false,
-                        "cause": "not_group_by_or_distinct"
-                      } /* group_index_range */,
-                      "analyzing_range_alternatives": {
-                        "range_scan_alternatives": [
-                          {
-                            "index": "b_idx",
-                            "ranges": [
-                              "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
-                              "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
-                            ] /* ranges */,
-                            "index_dives_for_eq_ranges": true,
-                            "rowid_ordered": false,
-                            "using_mrr": false,
-                            "index_only": false,
-                            "rows": 2,
-                            "cost": 4.41,
-                            "chosen": true
-                          }
-                        ] /* range_scan_alternatives */,
-                        "analyzing_roworder_intersect": {
-                          "usable": false,
-                          "cause": "too_few_roworder_scans"
-                        } /* analyzing_roworder_intersect */
-                      } /* analyzing_range_alternatives */,
-                      "chosen_range_access_summary": {
-                        "range_access_plan": {
-                          "type": "range_scan",
-                          "index": "b_idx",
-                          "rows": 2,
-                          "ranges": [
-                            "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
-                            "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
-                          ] /* ranges */
-                        } /* range_access_plan */,
-                        "rows_for_plan": 2,
-                        "cost_for_plan": 4.41,
-                        "chosen": true
-                      } /* chosen_range_access_summary */
-                    } /* range_analysis */
-                  ] /* rerunning_range_optimizer_for_single_index */
-                },
-                {
-                  "access_type_changed": {
-                    "table": "`t1`",
-                    "index": "b_idx",
-                    "old_type": "ref",
-                    "new_type": "range",
-                    "cause": "uses_more_keyparts"
-                  } /* access_type_changed */
-                }
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
-                {
-                  "table": "`t1`",
-                  "attached": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))"
-                }
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
-          },
-          {
-            "refine_plan": [
-              {
-                "table": "`t1`",
-                "pushed_index_condition": "(`t1`.`b` = 2)",
-                "table_condition_attached": "(`t1`.`a` in ('a','b'))",
-                "access_type": "range"
-              }
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_explain": {
-        "select#": 1,
-        "steps": [
-        ] /* steps */
-      } /* join_explain */
-    }
-  ] /* steps */
-}      0       0
-SET optimizer_trace="enabled=off";
+SELECT TRACE into @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "rerunning_range_optimizer_for_single_index";
+@trace RLIKE "rerunning_range_optimizer_for_single_index"
+1
 SET @@session.optimizer_switch=@optimizer_switch_saved;
 DROP TABLE t1;
index e0f1e562ae3cdc66ea596c3a965f60eb26146672..a4a886efe8545ccb8c029235e6493145ec6b7e69 100644 (file)
@@ -1871,299 +1871,17 @@ KEY b_idx(b)
 ) ENGINE=INNODB;
 INSERT INTO t1 VALUES ('a',1),('a',2),('a',3),('b',1),('b',4),('c',1),('d',1),
 ('c',4),('d',3),('e',2),('f',2);
+ANALYZE TABLE t1;
+Table  Op      Msg_type        Msg_text
+test.t1        analyze status  OK
 SET @optimizer_switch_saved=@@session.optimizer_switch;
 SET @@session.optimizer_switch=default;
-SET optimizer_trace="enabled=on";
 EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2;
 id     select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 1      SIMPLE  t1      range   PRIMARY,b_idx   b_idx   35      NULL    2       Using index condition; Using where
-SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
-QUERY  TRACE   MISSING_BYTES_BEYOND_MAX_MEM_SIZE       INSUFFICIENT_PRIVILEGES
-EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2       {
-  "steps": [
-    {
-      "join_preparation": {
-        "select#": 1,
-        "steps": [
-          {
-            "expanded_query": "/* select#1 */ select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where ((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))"
-          }
-        ] /* steps */
-      } /* join_preparation */
-    },
-    {
-      "join_optimization": {
-        "select#": 1,
-        "steps": [
-          {
-            "condition_processing": {
-              "condition": "WHERE",
-              "original_condition": "((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))",
-              "steps": [
-                {
-                  "transformation": "equality_propagation",
-                  "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
-                },
-                {
-                  "transformation": "constant_propagation",
-                  "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
-                },
-                {
-                  "transformation": "trivial_condition_removal",
-                  "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
-                }
-              ] /* steps */
-            } /* condition_processing */
-          },
-          {
-            "table_dependencies": [
-              {
-                "table": "`t1`",
-                "row_may_be_null": false,
-                "map_bit": 0,
-                "depends_on_map_bits": [
-                ] /* depends_on_map_bits */
-              }
-            ] /* table_dependencies */
-          },
-          {
-            "ref_optimizer_key_uses": [
-              {
-                "table": "`t1`",
-                "field": "b",
-                "equals": "2",
-                "null_rejecting": false
-              }
-            ] /* ref_optimizer_key_uses */
-          },
-          {
-            "rows_estimation": [
-              {
-                "table": "`t1`",
-                "range_analysis": {
-                  "table_scan": {
-                    "rows": 11,
-                    "cost": 5.3
-                  } /* table_scan */,
-                  "potential_range_indices": [
-                    {
-                      "index": "PRIMARY",
-                      "usable": true,
-                      "key_parts": [
-                        "a",
-                        "b"
-                      ] /* key_parts */
-                    },
-                    {
-                      "index": "b_idx",
-                      "usable": true,
-                      "key_parts": [
-                        "b",
-                        "a"
-                      ] /* key_parts */
-                    }
-                  ] /* potential_range_indices */,
-                  "setup_range_conditions": [
-                  ] /* setup_range_conditions */,
-                  "group_index_range": {
-                    "chosen": false,
-                    "cause": "not_group_by_or_distinct"
-                  } /* group_index_range */,
-                  "analyzing_range_alternatives": {
-                    "range_scan_alternatives": [
-                      {
-                        "index": "PRIMARY",
-                        "ranges": [
-                          "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
-                          "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
-                        ] /* ranges */,
-                        "index_dives_for_eq_ranges": true,
-                        "rowid_ordered": true,
-                        "using_mrr": false,
-                        "index_only": false,
-                        "rows": 2,
-                        "cost": 2.41,
-                        "chosen": true
-                      },
-                      {
-                        "index": "b_idx",
-                        "ranges": [
-                          "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
-                          "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
-                        ] /* ranges */,
-                        "index_dives_for_eq_ranges": true,
-                        "rowid_ordered": false,
-                        "using_mrr": false,
-                        "index_only": false,
-                        "rows": 2,
-                        "cost": 4.41,
-                        "chosen": false,
-                        "cause": "cost"
-                      }
-                    ] /* range_scan_alternatives */,
-                    "analyzing_roworder_intersect": {
-                      "usable": false,
-                      "cause": "too_few_roworder_scans"
-                    } /* analyzing_roworder_intersect */
-                  } /* analyzing_range_alternatives */,
-                  "chosen_range_access_summary": {
-                    "range_access_plan": {
-                      "type": "range_scan",
-                      "index": "PRIMARY",
-                      "rows": 2,
-                      "ranges": [
-                        "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
-                        "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
-                      ] /* ranges */
-                    } /* range_access_plan */,
-                    "rows_for_plan": 2,
-                    "cost_for_plan": 2.41,
-                    "chosen": true
-                  } /* chosen_range_access_summary */
-                } /* range_analysis */
-              }
-            ] /* rows_estimation */
-          },
-          {
-            "considered_execution_plans": [
-              {
-                "plan_prefix": [
-                ] /* plan_prefix */,
-                "table": "`t1`",
-                "best_access_path": {
-                  "considered_access_paths": [
-                    {
-                      "access_type": "ref",
-                      "index": "b_idx",
-                      "rows": 2,
-                      "cost": 2.4,
-                      "chosen": true
-                    },
-                    {
-                      "access_type": "range",
-                      "rows": 2,
-                      "cost": 2.81,
-                      "chosen": false
-                    }
-                  ] /* considered_access_paths */
-                } /* best_access_path */,
-                "cost_for_plan": 2.4,
-                "rows_for_plan": 2,
-                "chosen": true
-              }
-            ] /* considered_execution_plans */
-          },
-          {
-            "attaching_conditions_to_tables": {
-              "original_condition": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))",
-              "attached_conditions_computation": [
-                {
-                  "rerunning_range_optimizer_for_single_index": [
-                    {
-                      "table_scan": {
-                        "rows": 11,
-                        "cost": 5.3
-                      } /* table_scan */,
-                      "potential_range_indices": [
-                        {
-                          "index": "PRIMARY",
-                          "usable": false,
-                          "cause": "not_applicable"
-                        },
-                        {
-                          "index": "b_idx",
-                          "usable": true,
-                          "key_parts": [
-                            "b",
-                            "a"
-                          ] /* key_parts */
-                        }
-                      ] /* potential_range_indices */,
-                      "setup_range_conditions": [
-                      ] /* setup_range_conditions */,
-                      "group_index_range": {
-                        "chosen": false,
-                        "cause": "not_group_by_or_distinct"
-                      } /* group_index_range */,
-                      "analyzing_range_alternatives": {
-                        "range_scan_alternatives": [
-                          {
-                            "index": "b_idx",
-                            "ranges": [
-                              "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
-                              "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
-                            ] /* ranges */,
-                            "index_dives_for_eq_ranges": true,
-                            "rowid_ordered": false,
-                            "using_mrr": false,
-                            "index_only": false,
-                            "rows": 2,
-                            "cost": 4.41,
-                            "chosen": true
-                          }
-                        ] /* range_scan_alternatives */,
-                        "analyzing_roworder_intersect": {
-                          "usable": false,
-                          "cause": "too_few_roworder_scans"
-                        } /* analyzing_roworder_intersect */
-                      } /* analyzing_range_alternatives */,
-                      "chosen_range_access_summary": {
-                        "range_access_plan": {
-                          "type": "range_scan",
-                          "index": "b_idx",
-                          "rows": 2,
-                          "ranges": [
-                            "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
-                            "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
-                          ] /* ranges */
-                        } /* range_access_plan */,
-                        "rows_for_plan": 2,
-                        "cost_for_plan": 4.41,
-                        "chosen": true
-                      } /* chosen_range_access_summary */
-                    } /* range_analysis */
-                  ] /* rerunning_range_optimizer_for_single_index */
-                },
-                {
-                  "access_type_changed": {
-                    "table": "`t1`",
-                    "index": "b_idx",
-                    "old_type": "ref",
-                    "new_type": "range",
-                    "cause": "uses_more_keyparts"
-                  } /* access_type_changed */
-                }
-              ] /* attached_conditions_computation */,
-              "attached_conditions_summary": [
-                {
-                  "table": "`t1`",
-                  "attached": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))"
-                }
-              ] /* attached_conditions_summary */
-            } /* attaching_conditions_to_tables */
-          },
-          {
-            "refine_plan": [
-              {
-                "table": "`t1`",
-                "pushed_index_condition": "(`t1`.`b` = 2)",
-                "table_condition_attached": "(`t1`.`a` in ('a','b'))",
-                "access_type": "range"
-              }
-            ] /* refine_plan */
-          }
-        ] /* steps */
-      } /* join_optimization */
-    },
-    {
-      "join_explain": {
-        "select#": 1,
-        "steps": [
-        ] /* steps */
-      } /* join_explain */
-    }
-  ] /* steps */
-}      0       0
-SET optimizer_trace="enabled=off";
+SELECT TRACE into @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "rerunning_range_optimizer_for_single_index";
+@trace RLIKE "rerunning_range_optimizer_for_single_index"
+1
 SET @@session.optimizer_switch=@optimizer_switch_saved;
 DROP TABLE t1;
diff --git a/mysql-wsrep-5.6/mysql-test/suite/perfschema/r/start_server_1_digest.result b/mysql-wsrep-5.6/mysql-test/suite/perfschema/r/start_server_1_digest.result
new file mode 100644 (file)
index 0000000..cf07022
--- /dev/null
@@ -0,0 +1,7 @@
+SELECT "Digest table has a size 1 and is full already." as use_case;
+use_case
+Digest table has a size 1 and is full already.
+select SCHEMA_NAME, DIGEST, DIGEST_TEXT
+from performance_schema.events_statements_summary_by_digest;
+SCHEMA_NAME    DIGEST  DIGEST_TEXT
+NULL   NULL    NULL
diff --git a/mysql-wsrep-5.6/mysql-test/suite/perfschema/t/start_server_1_digest-master.opt b/mysql-wsrep-5.6/mysql-test/suite/perfschema/t/start_server_1_digest-master.opt
new file mode 100644 (file)
index 0000000..e59be3e
--- /dev/null
@@ -0,0 +1 @@
+--performance-schema-digests-size=1
diff --git a/mysql-wsrep-5.6/mysql-test/suite/perfschema/t/start_server_1_digest.test b/mysql-wsrep-5.6/mysql-test/suite/perfschema/t/start_server_1_digest.test
new file mode 100644 (file)
index 0000000..998d9a5
--- /dev/null
@@ -0,0 +1,15 @@
+# -----------------------------------------------------------------------
+# Tests for the performance schema statement Digests.
+# -----------------------------------------------------------------------
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/no_protocol.inc
+
+SELECT "Digest table has a size 1 and is full already." as use_case;
+
+select SCHEMA_NAME, DIGEST, DIGEST_TEXT
+  from performance_schema.events_statements_summary_by_digest;
+
+
+
diff --git a/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_alter_user.result b/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_alter_user.result
new file mode 100644 (file)
index 0000000..911e525
--- /dev/null
@@ -0,0 +1,47 @@
+include/master-slave.inc
+Warnings:
+Note   ####    Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note   ####    Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+[connection master]
+SET @old_sql_mode_master= @@session.sql_mode;
+SET @@session.sql_mode= (select replace(@@session.sql_mode,'NO_BACKSLASH_ESCAPES',''));
+SET @old_sql_mode_slave= @@session.sql_mode;
+SET @@session.sql_mode= (select replace(@@session.sql_mode,'NO_BACKSLASH_ESCAPES',''));
+SET GLOBAL DEBUG= '+d,force_hash_string_with_quote';
+CREATE USER 'user1'@'localhost' IDENTIFIED WITH sha256_password;
+SET old_passwords= 2;
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret');
+include/show_binlog_events.inc
+Log_name       Pos     Event_type      Server_id       End_log_pos     Info
+master-bin.000001      #       Query   #       #       use `test`; SET PASSWORD FOR 'user1'@'localhost'='$5$BVZy9O>\'a+2MH]_?$fpWyabcdiHjfCVqId/quykZzjaA7adpkcen/uiQrtmOK4p4'
+include/sync_slave_sql_with_master.inc
+include/show_binlog_events.inc
+Log_name       Pos     Event_type      Server_id       End_log_pos     Info
+slave-bin.000001       #       Query   #       #       use `test`; SET PASSWORD FOR 'user1'@'localhost'='$5$BVZy9O>\'a+2MH]_?$fpWyabcdiHjfCVqId/quykZzjaA7adpkcen/uiQrtmOK4p4'
+SET GLOBAL DEBUG= '-d,force_hash_string_with_quote';
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret1');
+include/sync_slave_sql_with_master.inc
+SELECT USER();
+USER()
+user1@localhost
+SET GLOBAL DEBUG= '+d,force_hash_string_with_quote';
+SET @@session.sql_mode= 'NO_BACKSLASH_ESCAPES';
+SET @@session.sql_mode= 'NO_BACKSLASH_ESCAPES';
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret');
+include/show_binlog_events.inc
+Log_name       Pos     Event_type      Server_id       End_log_pos     Info
+master-bin.000001      #       Query   #       #       use `test`; SET PASSWORD FOR 'user1'@'localhost'='$5$BVZy9O>''a+2MH]_?$fpWyabcdiHjfCVqId/quykZzjaA7adpkcen/uiQrtmOK4p4'
+include/sync_slave_sql_with_master.inc
+include/show_binlog_events.inc
+Log_name       Pos     Event_type      Server_id       End_log_pos     Info
+slave-bin.000001       #       Query   #       #       use `test`; SET PASSWORD FOR 'user1'@'localhost'='$5$BVZy9O>''a+2MH]_?$fpWyabcdiHjfCVqId/quykZzjaA7adpkcen/uiQrtmOK4p4'
+SET GLOBAL DEBUG= '-d,force_hash_string_with_quote';
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret2');
+include/sync_slave_sql_with_master.inc
+SELECT USER();
+USER()
+user1@localhost
+SET @@session.sql_mode= @old_sql_mode_slave;
+SET @@session.sql_mode= @old_sql_mode_master;
+DROP USER 'user1'@'localhost';
+include/rpl_end.inc
index 5416d278671d25cc9a7ac7bcbdf122f4df8874ab..67717b18cae7b4d6bad335a065845614f46b79a2 100644 (file)
@@ -69,5 +69,28 @@ Sync slave with master
 include/start_slave.inc
 SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('MASTER_UUID:10');
 include/assert.inc [Rows until 10 in t1 must be replicated now]
+Test WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS function with negative timeout
+value. When SQL_MODE is strict, then it will throw
+WRONG_ARGUMENTS error.
+SET @save_sql_mode=@@SESSION.SQL_MODE;
+SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES";
+SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('MASTER_UUID:100', -1);;
+ERROR HY000: Incorrect arguments to WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS.
+When SQL_MODE is non-strict mode, then it will return NULL immediately
+without doing any work and generates WRONG_ARGUMENTS warning.
+SET @@SESSION.SQL_MODE="";
+SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('MASTER_UUID:100', -1);;
+WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('MASTER_UUID:100', -1)
+NULL
+Warnings:
+Warning        1210    Incorrect arguments to WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS.
+SET @@SESSION.SQL_MODE=@save_sql_mode;
+Test WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS function with fractional timeout
+value. Earlier(before fix), 0.4 is read as integer value '0' and
+the function hanged forever (or till all the specified gtids are
+executed). Now(after fix) 0.4 will be read as double 0.4 and will waitfor
+atleast 0.4 seconds (or till all the specified  gtids are executed).
+Also check that function returns -1 if the timeout has been exceeded.
+include/assert.inc [WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS returns -1 if the timeout has been exceeded.]
 DROP TABLE t1;
 include/rpl_end.inc
index d234e729374ecaf88261e03317d4800bc552953a..04becaf962f054aa2ba6fdd9b5a0d64f002e6e55 100644 (file)
@@ -1211,6 +1211,8 @@ END;
 DELETE FROM non_trans_table2;
 Got one of the listed errors
 DROP TRIGGER trigger1;
+include/sync_slave_sql_with_master.inc
+[connection master]
 include/diff_tables.inc [master:trans_table1, slave:trans_table1]
 include/diff_tables.inc [master:trans_table2, slave:trans_table2]
 include/diff_tables.inc [master:non_trans_table1, slave:non_trans_table1]
index e9ea667c4ac8bfffcf3cf30995107baf90de6db4..e49f2d38072baa7b37a49ca72db1b32f4fa445ef 100644 (file)
@@ -22,4 +22,26 @@ show slave status;
 select master_pos_wait('foo', 98);
 master_pos_wait('foo', 98)
 NULL
+include/start_slave_sql.inc
+Test MASTER_POS_WAIT function with negative timeout value.
+When SQL_MODE is strict, then it will throw WRONG_ARGUMENTS
+error.
+SET @save_sql_mode=@@SESSION.SQL_MODE;
+SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES";
+SELECT MASTER_POS_WAIT('master-bin.999999', 4, -1);
+ERROR HY000: Incorrect arguments to MASTER_POS_WAIT.
+SET @@SESSION.SQL_MODE="";
+SELECT MASTER_POS_WAIT('master-bin.999999', 4, -1);
+MASTER_POS_WAIT('master-bin.999999', 4, -1)
+NULL
+Warnings:
+Warning        1210    Incorrect arguments to MASTER_POS_WAIT.
+SET @@SESSION.SQL_MODE=@save_sql_mode;
+Test WAIT_FOR_EXECUTED_GTID_SET function with fractional timeout value.
+Earlier(before fix), 0.4 is read as integer value '0' and the function
+hanged forever (or till all the specified gtids are executed).
+Now(after fix) 0.4 will be read as doube 0.4 and will waitfor
+atleast 0.4 seconds (or till all the specified  gtids are executed).
+Also check that in case of timeout, function returns -1.
+include/assert.inc [MASTER_POS_WAIT returns -1 if the timeout has been exceeded.]
 include/rpl_end.inc
index 8c42563508c71532edf64628bf972e0fe3a373e1..6b45132a8045673635fde8a6707f2260f84f62a0 100644 (file)
@@ -7,6 +7,7 @@ SET @save_slave_parallel_workers= @@slave_parallel_workers;
 SET @save_default_storage_engine=@@global.default_storage_engine;
 SET @@global.default_storage_engine='innodb';
 SET GLOBAL slave_parallel_workers= 4;
+call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
 call mtr.add_suppression("Request to stop slave SQL Thread received while applying a group that has non-transactional changes");
 include/stop_slave.inc
 include/start_slave.inc
diff --git a/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_sbm_fake_rotate_event.result b/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_sbm_fake_rotate_event.result
new file mode 100644 (file)
index 0000000..6b22285
--- /dev/null
@@ -0,0 +1,20 @@
+include/master-slave.inc
+Warnings:
+Note   ####    Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note   ####    Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+[connection master]
+[connection slave]
+SET @save_global_debug=@@GLOBAL.DEBUG;
+SET @@GLOBAL.DEBUG= '+d,dbug.calculate_sbm_after_fake_rotate_log_event';
+include/start_slave.inc
+[connection master]
+FLUSH LOGS;
+[connection slave]
+SET DEBUG_SYNC="now wait_for signal.reached";
+include/assert.inc [Seconds Behind Master should be less than IO_THREAD's time.]
+SET DEBUG_SYNC="now signal signal.done_sbm_calculation";
+SET DEBUG_SYNC="now wait_for signal.reached";
+include/assert.inc [Seconds Behind Master should be less than IO_THREAD's time.]
+SET DEBUG_SYNC="now signal signal.done_sbm_calculation";
+SET @@GLOBAL.DEBUG=@save_global_debug;
+include/rpl_end.inc
diff --git a/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_alter_user.test b/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_alter_user.test
new file mode 100644 (file)
index 0000000..13d1b4f
--- /dev/null
@@ -0,0 +1,104 @@
+#
+# === Purpose ===
+# This test script verifies that in a replication environment,
+# the slave correctly parses the hash password in ALTER USER or
+# SET PASSWORD query. It verifies that the slave doesn't
+# encounter an error in parsing a hash string which contains a
+# single quote. The fix ensures escaping the hash string correctly
+# depending on the server mode. Since this issue is sporadic,
+# we have used a debug flag to deterministically generate a
+# hash string which contains a single quote.
+#
+# === Related bugs and worklogs ===
+#
+# Bug#20228478: ON REPLICATION SLAVE, ALTER USER FAILING FOR USER
+#               WITH SHA256_PASSWORD PLUGIN
+#
+
+--source include/have_ssl_communication.inc
+--source include/have_openssl.inc
+--source include/have_ssl.inc
+--source include/master-slave.inc
+--source include/have_debug.inc
+
+#Scenario 1:
+# When NO_BACKSLASH_ESCAPES mode is not set on both master and the slave.
+SET @old_sql_mode_master= @@session.sql_mode;
+SET @@session.sql_mode= (select replace(@@session.sql_mode,'NO_BACKSLASH_ESCAPES',''));
+
+--connection slave
+SET @old_sql_mode_slave= @@session.sql_mode;
+SET @@session.sql_mode= (select replace(@@session.sql_mode,'NO_BACKSLASH_ESCAPES',''));
+
+--connection master
+SET GLOBAL DEBUG= '+d,force_hash_string_with_quote';
+CREATE USER 'user1'@'localhost' IDENTIFIED WITH sha256_password;
+SET old_passwords= 2;
+# Save master position
+--let $saved_master_pos= query_get_value('SHOW MASTER STATUS', Position, 1)
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret');
+# Check the binlog contents on the master
+--let $binlog_start= $saved_master_pos
+--let $binlog_limit= 2
+--source include/show_binlog_events.inc
+# Check the binlog contents on the slave
+--source include/sync_slave_sql_with_master.inc
+--source include/show_binlog_events.inc
+# Reset the flag
+--connection master
+SET GLOBAL DEBUG= '-d,force_hash_string_with_quote';
+
+# Scenario 2:
+# Make sure that we are successfully able to login to the slave from a
+# user whose password is changed and NO_BACKSLASH_ESCAPES mode is not
+# set on both master and slave. The hash string generated here may or
+# may not contain a single quote within it.
+--connection master
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret1');
+--source include/sync_slave_sql_with_master.inc
+--connect(con1, localhost, user1,'auth_secret1',,,,SSL)
+SELECT USER();
+disconnect con1;
+
+# Scenario 3:
+# When NO_BACKSLASH_ESCAPES mode is set on both master and the slave.
+--connection master
+SET GLOBAL DEBUG= '+d,force_hash_string_with_quote';
+SET @@session.sql_mode= 'NO_BACKSLASH_ESCAPES';
+--connection slave
+SET @@session.sql_mode= 'NO_BACKSLASH_ESCAPES';
+--connection master
+# Save master position
+--let $saved_master_pos= query_get_value('SHOW MASTER STATUS', Position, 1)
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret');
+# Check the binlog contents on the master
+--let $binlog_start= $saved_master_pos
+--let $binlog_limit= 2
+--source include/show_binlog_events.inc
+# Check the binlog contents on the slave
+--source include/sync_slave_sql_with_master.inc
+--source include/show_binlog_events.inc
+# Reset the flag
+--connection master
+SET GLOBAL DEBUG= '-d,force_hash_string_with_quote';
+
+# Scenario 4:
+# Make sure that we are successfully able to login to the slave
+# after the password is changed for a user and NO_BACKSLASH_ESCAPES
+# mode is set on both master and slave. This scenario will generate
+# the hash string which may or may not contain a single quote.
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret2');
+--source include/sync_slave_sql_with_master.inc
+--connect(con1, localhost, user1,'auth_secret2',,,,SSL)
+SELECT USER();
+disconnect con1;
+
+#Restore the old sql_mode at the master and the slave
+--connection slave
+SET @@session.sql_mode= @old_sql_mode_slave;
+--connection master
+SET @@session.sql_mode= @old_sql_mode_master;
+
+#cleanup
+DROP USER 'user1'@'localhost';
+--source include/rpl_end.inc
index c1d212423b8f1bf8752b1c250c5727cb485d419f..b3122907fb3868f1f70b1bbe7cb37ab72ad28caa 100644 (file)
@@ -144,6 +144,39 @@ while ($i != 11)
 --let $assert_text= Rows until 10 in t1 must be replicated now
 --source include/assert.inc
 
+#
+# Bug#24976304 WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS TIMEOUT VALUE HANDLES SOME
+# INPUTS BADLY
+#
+--echo Test WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS function with negative timeout
+--echo value. When SQL_MODE is strict, then it will throw
+--echo WRONG_ARGUMENTS error.
+SET @save_sql_mode=@@SESSION.SQL_MODE;
+SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES";
+--replace_result $master_uuid MASTER_UUID
+--error ER_WRONG_ARGUMENTS
+--eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$master_uuid:100', -1);
+
+--echo When SQL_MODE is non-strict mode, then it will return NULL immediately
+--echo without doing any work and generates WRONG_ARGUMENTS warning.
+SET @@SESSION.SQL_MODE="";
+--replace_result $master_uuid MASTER_UUID
+--eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$master_uuid:100', -1);
+SET @@SESSION.SQL_MODE=@save_sql_mode;
+
+--echo Test WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS function with fractional timeout
+--echo value. Earlier(before fix), 0.4 is read as integer value '0' and
+--echo the function hanged forever (or till all the specified gtids are
+--echo executed). Now(after fix) 0.4 will be read as double 0.4 and will waitfor
+--echo atleast 0.4 seconds (or till all the specified  gtids are executed).
+--echo Also check that function returns -1 if the timeout has been exceeded.
+--let $assert_text= WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS returns -1 if the timeout has been exceeded.
+--let $query_result= query_get_value("SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$master_uuid:100', 0.4) AS VALUE", VALUE, 1)
+--let $assert_cond= "$query_result" = "-1"
+--source include/assert.inc
+
+# End of Test Bug#24976304
+
 # Cleanup
 --connection master
 DROP TABLE t1;
index a77d0c049150dcd3959e01d7a4515057aadcd184..3f4360d0db041e0bc761804fee536db1f62288dc 100644 (file)
@@ -75,6 +75,10 @@ INSERT INTO non_trans_table2 VALUES (1);
 --let $func_or_trig_body=CREATE TEMPORARY TABLE tt1(i INT) ENGINE=MyISAM; DROP TEMPORARY TABLE IF EXISTS tt1; INSERT INTO trans_table1 VALUES (12);
 --source extra/rpl_tests/rpl_gtid_temp_table_in_func_or_trigger.inc
 
+# Sync slave with master before checking diff tables
+--source include/sync_slave_sql_with_master.inc
+--source include/rpl_connection_master.inc
+
 # Test that all Slave tables are in sync with Master tables
 --let $diff_tables=master:trans_table1, slave:trans_table1
 --source include/diff_tables.inc
index be6d9986b3fe38c6c0a2b534fa449e1a310c47d2..946489359217a3f2a0eb9d5867815f74b4d5829d 100644 (file)
@@ -31,6 +31,40 @@ query_vertical show slave status;
 echo "*** must be NULL ***";
 select master_pos_wait('foo', 98);
 
+#
+# Bug#24976304 WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS TIMEOUT VALUE HANDLES SOME
+# INPUTS BADLY
+#
+connection slave;
+--source include/start_slave_sql.inc
+
+--echo Test MASTER_POS_WAIT function with negative timeout value.
+--echo When SQL_MODE is strict, then it will throw WRONG_ARGUMENTS
+--echo error.
+SET @save_sql_mode=@@SESSION.SQL_MODE;
+SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES";
+--error ER_WRONG_ARGUMENTS
+SELECT MASTER_POS_WAIT('master-bin.999999', 4, -1);
+
+#--echo When SQL_MODE is non-strict mode, then it will return NULL immediately
+#--echo without doing any work and generates WRONG_ARGUMENTS warning.
+SET @@SESSION.SQL_MODE="";
+SELECT MASTER_POS_WAIT('master-bin.999999', 4, -1);
+SET @@SESSION.SQL_MODE=@save_sql_mode;
+
+--echo Test WAIT_FOR_EXECUTED_GTID_SET function with fractional timeout value.
+--echo Earlier(before fix), 0.4 is read as integer value '0' and the function
+--echo hanged forever (or till all the specified gtids are executed).
+--echo Now(after fix) 0.4 will be read as doube 0.4 and will waitfor
+--echo atleast 0.4 seconds (or till all the specified  gtids are executed).
+--echo Also check that in case of timeout, function returns -1.
+--let $assert_text= MASTER_POS_WAIT returns -1 if the timeout has been exceeded.
+--let $query_result= query_get_value("SELECT MASTER_POS_WAIT('master-bin.999999', 4, 0.4) AS VALUE", VALUE, 1)
+--let $assert_cond= "$query_result" = "-1"
+--source include/assert.inc
+
+# End of Test Bug#24976304
+
 # End of 4.1 tests
 --let $rpl_only_running_threads= 1
 --source include/rpl_end.inc
index 4edc7b62b19d613ac682c3d1480f083f3a3221b4..df382bc6f5e39d50ce1d04864536f53d7667cffd 100644 (file)
@@ -11,7 +11,11 @@ SET @save_default_storage_engine=@@global.default_storage_engine;
 SET @@global.default_storage_engine='innodb';
 
 eval SET GLOBAL slave_parallel_workers= $max_workers;
-#call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
+# As the test case is not going to do any synchronization with the master
+# before issuing STOP SLAVE in the non-deterministic activity, there is a
+# chance that the slave applier be in MTS mode and in a condition that it
+# will throw the following error message:
+call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
 call mtr.add_suppression("Request to stop slave SQL Thread received while applying a group that has non-transactional changes");
 
 --source include/stop_slave.inc
diff --git a/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_sbm_fake_rotate_event.test b/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_sbm_fake_rotate_event.test
new file mode 100644 (file)
index 0000000..d178b8a
--- /dev/null
@@ -0,0 +1,61 @@
+###############################################################################
+# Bug#23532304 SECONDS_BEHIND_MASTER REPORTS IO_THREAD TIME WHEN USING MTS &
+#              ROTATING RELAY-LOG
+# Problem: The value of 'Seconds_Behind_Master' (SBM) reports distorted number
+#         when rotating a relay-log.
+#
+# Steps to reproduce:
+#  1) Fake that I/O thread is started 3 minutes ago using a debug point.
+#  2) Flush the logs on the master which would have generated fake rotate
+#  event
+#  3) While the fake rotate event is getting executing, calculate the SBM
+#  4) Compare the executed SBM that it is not greater than or equal to I/O
+#     thread's active time.
+#  5) Clean the debug point.
+#
+###############################################################################
+--source include/have_debug_sync.inc
+--let rpl_skip_start_slave=1
+--source include/master-slave.inc
+
+# Step-1 Set sync debug point to calculate sbm exactly after fake
+#  rotate log event.
+--source include/rpl_connection_slave.inc
+SET @save_global_debug=@@GLOBAL.DEBUG;
+# This debug point internally fake that IO thread is started 3 minutes ago.
+SET @@GLOBAL.DEBUG= '+d,dbug.calculate_sbm_after_fake_rotate_log_event';
+# Start slave threads after enabling the debug point.
+--disable_warnings
+--source include/start_slave.inc
+--enable_warnings
+
+# Step-2 Flush logs on master which will generate a fake rotate event.
+--source include/rpl_connection_master.inc
+FLUSH LOGS;
+
+# Step-3 There will be two fake rotate events (first one while the initial setup
+# in master-slave.inc and second one due to FLUSH LOGS execution on master).
+# The following will test SBM calculation while both events are getting
+# executed.
+--source include/rpl_connection_slave.inc
+--let $iter=0
+while ($iter < 2)
+{
+# Step-4: Calcualte SBM while fake rotate log event is getting executed.
+# It should be approximately zero (some times little more than zero
+# if this test is run on a slow pb2 machine). Comparing with the
+# I/O thread age that it should be atleast less
+# than the age of I/O thread.
+SET DEBUG_SYNC="now wait_for signal.reached";
+let $sbm= query_get_value("SHOW SLAVE STATUS", Seconds_Behind_Master, 1);
+--let $assert_text= Seconds Behind Master should be less than IO_THREAD's time.
+--let $assert_cond= $sbm < 180
+--source include/assert.inc
+SET DEBUG_SYNC="now signal signal.done_sbm_calculation";
+--inc $iter
+}
+
+# Step-5: Cleanup
+SET @@GLOBAL.DEBUG=@save_global_debug;
+
+--source include/rpl_end.inc
index df7a854a9c7ca5c1465246b3e5748a6bbc657445..88b65d1e8aaab9668eec9144469ae253fa4cbe54 100644 (file)
@@ -13,9 +13,8 @@ lowercase_table3         : Bug#11762269 2010-06-30 alik main.lowercase_table3 on
 read_many_rows_innodb    : Bug#11748886 2010-11-15 mattiasj report already exists
 sum_distinct-big         : Bug#11764126 2010-11-15 mattiasj was not tested
 archive-big              : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
-log_tables-big           : Bug#11756699 2010-11-15 mattiasj report already exists
 ds_mrr-big @solaris      : Bug#14168107 2012-04-03 Hemant disabled new test added by Olav SandstÃ¥,since this leads to timeout on Solaris on slow sparc servers
-mysql_embedded_client_test     : Bug#13964673 2012-04-16 amitbha since most of the test cases are failing
+mysql_embedded_client_test      : Bug#13964673 2012-04-16 amitbha since most of the test cases are failing
 mysql_client_test_embedded : Bug#16084066 2013-01-08 Disabled since this test is failing
 file_contents : Galera mysql-wsrep#4 2014-10-28 pstoev main.file_contents MTR test fails in mysql-wsrep 
 bootstrap : Galera mysql-wsrep#19 2014-11-21 pstoev Crash in LOGGER::error_log_print when printing a WSREP message 
index 0c482f0f503f3bec51dfb1ace5ae929c87cda31d..02526263e26f5d23cb045dc0c4bbd19c3ae26fa2 100644 (file)
@@ -762,3 +762,19 @@ eval EXPLAIN $query;
 eval $query;
 
 DROP TABLE t1,t2,t3;
+
+--echo #
+--echo # Bug#22686994 REGRESSION FOR A GROUPING QUERY WITH DISTINCT
+--echo #
+
+CREATE TABLE t1 (a INTEGER, b INTEGER);
+
+INSERT INTO t1 VALUES (1,3), (2,4), (1,5),
+(1,3), (2,1), (1,5), (1,7), (3,1),
+(3,2), (3,1), (2,4);
+
+SELECT DISTINCT (COUNT(DISTINCT b) + 1) AS c FROM t1 GROUP BY a;
+DROP TABLE t1;
+
+--echo # End of test for Bug#22686994
+
index 4e64670258926e18df45bd1eb04c0697c471e32c..4cc9788b9a0458258440e31003370fd4efa28655 100644 (file)
@@ -13,7 +13,7 @@ use events_test;
 # mysql.event intact checking end
 #
 
-create event e_26 on schedule at '2038-01-19 03:14:07' disable do set @a = 5;
+create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5;
 select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
 drop event e_26;
 --error ER_WRONG_VALUE
index eab60346d8150f006e8c6ec59aa7607cdaba1e32..c41f2a6f1f78c95c2bf1cf3fffa1ee4c8981faee 100644 (file)
@@ -257,3 +257,165 @@ SET optimizer_trace=DEFAULT;
 SET end_markers_in_json=DEFAULT;
 
 DROP TABLE t0,t1,t2;
+
+--echo #
+--echo # Bug #21749123: SELECT DISTINCT, WRONG RESULTS COMBINED WITH
+--echo #                USE_INDEX_EXTENSIONS=OFF
+--echo #
+
+CREATE TABLE t1 (
+  pk_col INT AUTO_INCREMENT PRIMARY KEY,
+  a1 CHAR(64),
+  KEY a1_idx (a1)
+) ENGINE=INNODB;
+INSERT INTO t1 (a1) VALUES ('a'),('a'),('a'),('a'),('a'),('a'),('a'),('a');
+
+CREATE TABLE t2 (
+  pk_col1 INT NOT NULL,
+  pk_col2 INT NOT NULL,
+  a1 CHAR(64),
+  a2 CHAR(64),
+  PRIMARY KEY(pk_col1, pk_col2),
+  KEY a1_idx (a1),
+  KEY a1_a2_idx (a1, a2)
+) ENGINE=INNODB;
+INSERT INTO t2 (pk_col1, pk_col2, a1, a2) VALUES (1,1,'a','b'),(1,2,'a','b'),
+                                                 (1,3,'a','c'),(1,4,'a','c'),
+                                                 (2,1,'a','d');
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+
+#Doesn't use loose index scan irrespective of index extensions.
+let query1=
+SELECT DISTINCT a1
+FROM t1
+WHERE (pk_col = 2 OR pk_col = 22) AND a1 = 'a';
+
+#Doesn't use loose index scan when index extensions is off.
+let query2=
+SELECT COUNT(DISTINCT a1)
+FROM t1
+GROUP BY a1,pk_col;
+
+#Doesn't use loose index scan when index extensions is off.
+let query3=
+SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,pk_col1;
+
+#Uses loose index scan irrespective of index extensions.
+let query4=
+SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,a2;
+
+eval EXPLAIN $query1;
+eval $query1;
+eval EXPLAIN $query2;
+eval $query2;
+eval EXPLAIN $query3;
+eval $query3;
+eval EXPLAIN $query4;
+eval $query4;
+
+SET @optimizer_switch_save=@@optimizer_switch;
+SET @@optimizer_switch= "use_index_extensions=off";
+
+eval EXPLAIN $query1;
+eval $query1;
+eval EXPLAIN $query2;
+eval $query2;
+eval EXPLAIN $query3;
+eval $query3;
+eval EXPLAIN $query4;
+eval $query4;
+
+SET @@optimizer_switch= @optimizer_switch_save;
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug #24671968: WHEN THE OPTIMISER IS USING INDEX FOR GROUP-BY IT OFTEN
+--echo #                OFTEN GIVES WRONG RESULTS
+--echo #
+
+CREATE TABLE t1 (
+id int NOT NULL,
+c1 int NOT NULL,
+c2 int,
+PRIMARY KEY(id),
+INDEX c1_c2_idx(c1, c2));
+
+INSERT INTO t1 (id, c1, c2) VALUES (1,1,1), (2,2,2), (10,10,1), (11,10,8),
+                                   (12,10,1), (13,10,2), (3,1,1), (4,10,1),
+                                   (5,10,1), (6,10,8), (7,1,1), (8,10,1);
+ANALYZE TABLE t1;
+
+# Query similar to the one mentioned in the bug page. Incorrectly chooses
+# loose index scan.
+let query1=
+SELECT DISTINCT c1
+FROM t1
+WHERE EXISTS (SELECT *
+              FROM DUAL
+              WHERE (c2 = 2));
+
+# IN subquery. Incorrectly chooses loose index scan.
+let query2=
+SELECT DISTINCT c1
+FROM t1
+WHERE 1 IN (2,
+            (SELECT 1
+            FROM DUAL
+            WHERE (c2 = 2)),
+            3);
+
+# Similar to above queries but without subquery.
+let query3=
+SELECT DISTINCT c1
+FROM t1
+WHERE c2 = 2;
+
+# Same as query1 with IGNORE INDEX. So this will not choose loose index scan.
+let query4=
+SELECT DISTINCT c1
+FROM t1 IGNORE INDEX (c1_c2_idx)
+WHERE EXISTS (SELECT *
+              FROM DUAL
+              WHERE (c2 = 2));
+
+# Same as query2 with IGNORE INDEX. So this will not choose loose index scan.
+let query5=
+SELECT DISTINCT c1
+FROM t1 IGNORE INDEX (c1_c2_idx)
+WHERE 1 IN (2,
+            (SELECT 1
+            FROM DUAL
+            WHERE (c2 = 2)),
+            3);
+
+--replace_column 9 #
+eval EXPLAIN $query1;
+--replace_column 9 #
+eval EXPLAIN $query2;
+--replace_column 9 #
+eval EXPLAIN $query3;
+--replace_column 9 #
+eval EXPLAIN $query4;
+--replace_column 9 #
+eval EXPLAIN $query5;
+
+# Looking for the tag in optimizer trace: "dependent_subquery_in_where".
+SET optimizer_trace="enabled=on";
+
+eval $query1;
+SELECT TRACE INTO @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "keypart_reference_from_where_clause";
+
+SET optimizer_trace="enabled=off";
+
+eval $query2;
+eval $query3;
+eval $query4;
+eval $query5;
+
+DROP TABLE t1;
index aa7be52484e43f21288e2aa63d8c103de12ba10a..db21058daea91583e3a94dce3ddc613c736971ab 100644 (file)
@@ -292,7 +292,7 @@ SELECT * FROM v2;
 DELETE FROM t1;
 
 --echo
---error ER_LOAD_DATA_INVALID_COLUMN
+--error ER_NONUPDATEABLE_COLUMN
 LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2
   FIELDS ESCAPED BY '\\'
   TERMINATED BY ','
index 8c956fa6f5512a374f5a9a3d429d9df59a87f457..8936a163d738cc2203b2b20fbe284ee325aeadb3 100644 (file)
@@ -7,6 +7,8 @@
 # check that CSV engine was compiled in
 --source include/have_csv.inc
 
+set @@global.log_output = 'TABLE';
+
 connect (con1,localhost,root,,);
 connect (con2,localhost,root,,);
 
@@ -18,18 +20,20 @@ set session long_query_time=10;
 select get_lock('bug27638', 1);
 connection con2;
 set session long_query_time=1;
-truncate table mysql.slow_log;
 select get_lock('bug27638', 2);
-select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
-truncate table mysql.slow_log;
+select if (query_time >= '00:00:01', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
+       where sql_text = 'select get_lock(\'bug27638\', 2)';
 select get_lock('bug27638', 60);
-select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
-truncate table mysql.slow_log;
+select if (query_time >= '00:00:59', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
+       where sql_text = 'select get_lock(\'bug27638\', 60)';
 select get_lock('bug27638', 101);
-select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+select if (query_time >= '00:01:40', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
+       where sql_text = 'select get_lock(\'bug27638\', 101)';
 connection con1;
 select release_lock('bug27638');
 connection default;
 
 disconnect con1;
 disconnect con2;
+
+set @@global.log_output=default;
index 1da8c2029c268067edf8be91a716c4092c6f5b8a..54097b0ac57fc2b5dc67fbbb9937fafed1974425 100644 (file)
@@ -2523,3 +2523,53 @@ SELECT * FROM t2;
 DROP TABLE t1;
 DROP TABLE t2;
 DROP DATABASE db_20772273;
+
+--echo #
+--echo # Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
+--echo #
+
+
+CREATE DATABASE bug25717383;
+use bug25717383;
+
+CREATE TABLE `tab
+one` (a int);
+CREATE VIEW `view
+one` as SELECT * FROM `tab
+one`;
+
+CREATE PROCEDURE `proc
+one`() SELECT * from `tab
+one`;
+
+CREATE TEMPORARY TABLE `temp
+one` (id INT);
+
+CREATE TRIGGER `trig
+one` BEFORE INSERT ON `tab
+one` FOR EACH ROW SET NEW.a = 1;
+
+CREATE EVENT `event
+one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;
+
+SHOW TABLES FROM bug25717383;
+SHOW TRIGGERS FROM bug25717383;
+--replace_column 6 #
+SHOW EVENTS FROM bug25717383;
+
+SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
+       WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
+       ORDER BY ROUTINE_NAME;
+
+--exec $MYSQL_DUMP --triggers --events --routines --add-drop-database --databases bug25717383 > $MYSQLTEST_VARDIR/tmp/bug25717383.sql
+
+SHOW TABLES FROM bug25717383;
+SHOW TRIGGERS FROM bug25717383;
+--replace_column 6 #
+SHOW EVENTS FROM bug25717383;
+
+SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
+       WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
+       ORDER BY ROUTINE_NAME;
+
+DROP DATABASE bug25717383;
index f07d968359ed25a359d3dd4fb1cc77ea5ddcaade..3ab5051f7a6651f1cdaa23d970d9c97b812997a6 100644 (file)
@@ -555,6 +555,14 @@ select master_pos_wait(1);
 -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
 select master_pos_wait(1, 2, 3, 4);
 
+--disable_result_log
+SET @save_sql_mode_before_master_pos_wait=@@SESSION.SQL_MODE;
+SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES";
+--error 0, ER_WRONG_ARGUMENTS
+select master_pos_wait('master-bin.999999', 4, -1);
+SET @@SESSION.SQL_MODE=@save_sql_mode_before_master_pos_wait;
+--enable_result_log
+
 -- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
 select rand(1, 2, 3);
 
index ab28b1bb38029eee20570dd217e4dd41251f06a5..0d5f650368a25a13303786037c1e7822fe149c4d 100644 (file)
@@ -3520,3 +3520,41 @@ disconnect con1;
 --echo # Connection default
 connection default;
 DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#19894382 - SERVER SIDE PREPARED STATEMENTS LEADS TO POTENTIAL OFF-BY-SECOND
+--echo #                TIMESTAMP ON SLAVE.
+--echo #
+
+CREATE TABLE bug19894382(f1 CHAR(64) DEFAULT 'slave',
+                         f2 TIME, f3 TIMESTAMP NULL, f4 DATETIME,
+                         f5 TIME(3), f6 TIMESTAMP(3) NULL, f7 DATETIME(3));
+
+--echo # Execute prepared statements from mysql_client_test.
+--exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/bug19894382.out.log 2>&1
+--exec $MYSQL_CLIENT_TEST -d -u root test_bug19894382 >> $MYSQLTEST_VARDIR/log/bug19894382.out.log 2>&1
+
+--echo # Insert tuples from the client_test_db.bug19894382 to the test.bug19894382.
+--echo # Tuples in the client_test_db.bug19894382 are inserted from the mysql_client_test.
+INSERT INTO bug19894382 SELECT * FROM client_test_db.bug19894382;
+
+--echo # Replay binlog events
+let $MYSQLD_DATADIR= `select @@datadir`;
+--let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--exec $MYSQL_BINLOG --force-if-open -d client_test_db $MYSQLD_DATADIR/$master_log_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug19894382.binlog
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug19894382.binlog"
+
+--echo # Insert tuples from the client_test_db.bug19894382 to the test.bug19894382.
+--echo # Tuples in the client_test_db.bug19894382 are inserted from the binlog.
+INSERT INTO bug19894382(f2, f3, f4, f5, f6, f7)
+  SELECT f2, f3, f4, f5, f6, f7 FROM client_test_db.bug19894382;
+--echo # With fix, tuples of "master" and "slave" will be same. There will not be any difference
+--echo # in values inserted for time, timestamp and datetime type columns.
+SELECT * FROM bug19894382 ORDER BY f2;
+
+--echo # Cleanup
+DROP DATABASE client_test_db;
+DROP TABLE bug19894382;
+--remove_file $MYSQLTEST_VARDIR/log/bug19894382.out.log
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug19894382.binlog
index 5109137e564585043388a705acff39bf09f97df8..5916d04875b5486bf6c67c6e82fb3543acc8852a 100644 (file)
@@ -298,3 +298,19 @@ show create table t1;
 create table t2 like t1;
 show create table t2;
 drop tables t1, t2;
+
+--echo #
+--echo # Test for bug #25514146 DB_NAME IS IGNORED WHEN CREATING TABLE
+--echo # WITH DATA DIRECTORY
+--echo #
+
+--echo # Make sure we have no current database
+CREATE DATABASE x;
+USE x;
+DROP DATABASE x;
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM
+DATA DIRECTORY "$MYSQLTEST_VARDIR/tmp";
+
+DROP TABLE test.t1;
index a03643a9bb5ac1f7b0f5b9a0fdada24a83a5e9a0..381be3f47b5a93a4e76b0dae22b76679fd9cd65e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2017, 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 Library General Public
    fun:kill_server_thread
 }
 
+{
+   Bug#25391948 RPL_CHECK_GTID TEST FAILS SPORADICALLY ON PB2 - WEEKLY-5.6 FOR LINUX-VALGRIND
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   fun:_dl_close_worker
+   fun:_dl_close
+   fun:_dl_catch_error
+   fun:__libc_dlclose
+   ...
+}
+
+{
+   Bug#25391948 RPL_CHECK_GTID TEST FAILS SPORADICALLY ON PB2 - WEEKLY-5.6 FOR LINUX-VALGRIND
+   Memcheck:Leak
+   match-leak-kinds: reachable
+   fun:malloc
+   ...
+   fun:dl_open_worker
+   fun:_dl_catch_error
+   fun:_dl_open
+   fun:do_dlopen
+   fun:_dl_catch_error
+   fun:__libc_dlopen_mode
+   ...
+}
+
 #Suppress warnings from glibc implementation of 'malloc_info' 
 {
    Malloc_info uninitialised value of size 8
index e96ab0fe505e9a7b5fcc6ed33ae6ff75879a0973..9475de92722e1b37ffdc7a2504eeec36c81c148c 100644 (file)
@@ -2,7 +2,7 @@
          xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">\r
 \r
 <!--\r
-   Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.\r
+   Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.\r
    \r
    This program is free software; you can redistribute it and/or modify\r
    it under the terms of the GNU General Public License as published by\r
@@ -30,7 +30,7 @@
       <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" Disabled="yes" />\r
       <Control Id="Description" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)" />\r
       <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgTitle)" />\r
-      <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved." />\r
+      <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved." />\r
       <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />\r
       <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />\r
     </Dialog>\r
index b164fdb81ae4c5df75a4335b7c42e34747342de6..8730521a5bd4b7e650ef93fd47c7900836852cbc 100644 (file)
@@ -2,7 +2,7 @@
          xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">\r
 \r
 <!--\r
-   Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.\r
+   Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.\r
    \r
    This program is free software; you can redistribute it and/or modify\r
    it under the terms of the GNU General Public License as published by\r
diff --git a/mysql-wsrep-5.6/packaging/deb-in/CMakeLists.txt b/mysql-wsrep-5.6/packaging/deb-in/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6be1bbd
--- /dev/null
@@ -0,0 +1,250 @@
+# Copyright (c) 2016, 2017, 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
+
+IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
+  RETURN()
+ENDIF()
+
+IF (NOT DEFINED DEB_CODENAME)
+  execute_process(
+    COMMAND lsb_release -cs
+    OUTPUT_VARIABLE DEB_CODENAME
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+  )
+  SET (DEB_CODENAME ${DEB_CODENAME} CACHE STRING "")
+ENDIF()
+# Commercial or community
+IF (DEB_PRODUCT STREQUAL "commercial")
+  SET (DEB_COPYRIGHT_UPSTREAMNAME "MySQL Commercial Server ${MYSQL_BASE_VERSION}")
+  SET (DEB_PRODUCTNAME "commercial")
+  SET (DEB_PRODUCTNAMEC "Commercial")
+  SET (DEB_NOTPRODUCTNAME "community")
+  SET (DEB_LICENSENAME "Advanced")
+  SET (DEB_INSTALL_LICENSEFILE "LICENSE.mysql")
+  SET (DEB_SERVERVERSION "${VERSION}+commercial-1")
+  SET (DEB_PLUGIN_SETPERMISSION "")
+  # List of plugins that are only in commercial packages
+  # Plugins that are in both community and commercial should NOT be added here
+
+  SET (DEB_INCLUDE_BINARIES_EXTRA
+"
+debian/extra/audit_log-plugin
+debian/extra/authentication_pam-plugin
+debian/extra/firewall-plugin
+debian/extra/openssl_udf-plugin
+debian/extra/thread_pool-plugin
+")
+  SET (DEB_INSTALL_SERVER_PLUGINS
+"
+usr/lib/mysql/plugin/audit_log.so
+usr/lib/mysql/plugin/authentication_pam.so
+usr/lib/mysql/plugin/openssl_udf.so
+usr/lib/mysql/plugin/thread_pool.so
+usr/lib/mysql/plugin/firewall.so
+usr/lib/mysql/plugin/debug/audit_log.so
+usr/lib/mysql/plugin/debug/authentication_pam.so
+usr/lib/mysql/plugin/debug/openssl_udf.so
+usr/lib/mysql/plugin/debug/thread_pool.so
+usr/lib/mysql/plugin/debug/firewall.so
+")
+  SET (DEB_REMOVEPATTERN "gpl.in")
+ELSE()
+  SET (DEB_PRODUCT "community")
+  SET (DEB_COPYRIGHT_UPSTREAMNAME "MySQL Server ${MYSQL_BASE_VERSION}")
+  SET (DEB_PRODUCTNAME "community")
+  SET (DEB_PRODUCTNAMEC "Community")
+  SET (DEB_NOTPRODUCTNAME "commercial")
+  SET (DEB_LICENSENAME "GPL")
+  SET (DEB_INSTALL_LICENSEFILE "COPYING")
+  SET (DEB_SERVERVERSION "${VERSION}-1")
+  SET (DEB_REMOVEPATTERN "com.in")
+  SET (DEB_PLUGIN_SETPERMISSION "usr/bin/mysql_setpermission")
+ENDIF()
+
+# Platform specifics. The differences are generally only distro version
+# and whether or not systemd and/or apparmor are available
+IF (DEB_CODENAME STREQUAL "wheezy")
+  SET (DEB_PLATFORMRELEASE "debian7")
+  SET (DEB_CONTROL_BDEPS "")
+  SET (DEB_INSTALL_SOURCE_XZ "")
+  SET (DEB_RULES_INSTALL_SYSTEMD "")
+  SET (DEB_RULES_INSTALL_APPARMOR "")
+  SET (DEB_RULES_APPARMOR_LOAD "")
+  SET (DEB_RULES_SYSTEMD_ENABLE "")
+  SET (DEB_RULES_SYSTEMD_START "")
+  SET (DEB_INSTALL_SERVER_SYSTEMD "")
+  SET (DEB_INSTALL_SERVER_APPARMOR "")
+  SET (DEB_SERVICE_SERVER_EXECPRE "")
+  SET (DEB_INIT_APPARMOR "")
+ELSEIF(DEB_CODENAME STREQUAL "jessie")
+  SET (DEB_PLATFORMRELEASE "debian8")
+  SET (DEB_CONTROL_BDEPS "dh-systemd")
+  SET (DEB_INSTALL_SOURCE_XZ "../*.tar.xz usr/src/mysql/")
+  SET (DEB_RULES_INSTALL_SYSTEMD
+    "install -m 0755 debian/extra/mysql-systemd-start debian/tmp/usr/share/mysql/")
+  SET (DEB_RULES_INSTALL_APPARMOR "")
+  SET (DEB_RULES_APPARMOR_LOAD "")
+  SET (DEB_RULES_SYSTEMD_ENABLE "dh_systemd_enable --name=mysql")
+  SET (DEB_RULES_SYSTEMD_START "dh_systemd_start --restart-after-upgrade")
+  SET (DEB_INSTALL_SERVER_SYSTEMD "usr/share/mysql/mysql-systemd-start")
+  SET (DEB_INSTALL_SERVER_APPARMOR "")
+  SET (DEB_SERVICE_SERVER_EXECPRE
+    "ExecStartPre=/usr/share/mysql/mysql-systemd-start pre")
+  SET (DEB_INIT_APPARMOR "")
+ELSEIF(DEB_CODENAME STREQUAL "stretch")
+  SET (DEB_PLATFORMRELEASE "debian9")
+  SET (DEB_CONTROL_BDEPS "dh-systemd")
+  SET (DEB_INSTALL_SOURCE_XZ "../*.tar.xz usr/src/mysql/")
+  SET (DEB_RULES_INSTALL_SYSTEMD
+    "install -m 0755 debian/extra/mysql-systemd-start debian/tmp/usr/share/mysql/")
+  SET (DEB_RULES_INSTALL_APPARMOR "")
+  SET (DEB_RULES_APPARMOR_LOAD "")
+  SET (DEB_RULES_SYSTEMD_ENABLE "dh_systemd_enable --name=mysql")
+  SET (DEB_RULES_SYSTEMD_START "dh_systemd_start --restart-after-upgrade")
+  SET (DEB_INSTALL_SERVER_SYSTEMD "usr/share/mysql/mysql-systemd-start")
+  SET (DEB_INSTALL_SERVER_APPARMOR "")
+  SET (DEB_SERVICE_SERVER_EXECPRE
+    "ExecStartPre=/usr/share/mysql/mysql-systemd-start pre")
+  SET (DEB_INIT_APPARMOR "")
+ELSEIF(DEB_CODENAME STREQUAL "precise")
+  SET (DEB_PLATFORMRELEASE "ubuntu12.04")
+  SET (DEB_CONTROL_BDEPS "dh-apparmor")
+  SET (DEB_INSTALL_SOURCE_XZ "")
+  SET (DEB_RULES_INSTALL_SYSTEMD "")
+  SET (DEB_RULES_INSTALL_APPARMOR
+    "install -g root -o root -m 0644 -D debian/extra/apparmor-profile debian/tmp/etc/apparmor.d/usr.sbin.mysqld")
+  SET (DEB_RULES_APPARMOR_LOAD
+    "dh_apparmor -pmysql-${DEB_PRODUCTNAME}-server --profile-name=usr.sbin.mysqld")
+  SET (DEB_RULES_SYSTEMD_ENABLE "")
+  SET (DEB_RULES_SYSTEMD_START "")
+  SET (DEB_INSTALL_SERVER_SYSTEMD "")
+  SET (DEB_INSTALL_SERVER_APPARMOR "etc/apparmor.d/usr.sbin.mysqld")
+  SET (DEB_SERVICE_SERVER_EXECPRE "")
+  SET (DEB_INIT_APPARMOR "/lib/init/apparmor-profile-load usr.sbin.mysqld")
+ELSEIF(DEB_CODENAME STREQUAL "trusty")
+  SET (DEB_PLATFORMRELEASE "ubuntu14.04")
+  SET (DEB_CONTROL_BDEPS "dh-apparmor")
+  SET (DEB_INSTALL_SOURCE_XZ "")
+  SET (DEB_RULES_INSTALL_SYSTEMD "")
+  SET (DEB_RULES_INSTALL_APPARMOR
+    "install -g root -o root -m 0644 -D debian/extra/apparmor-profile debian/tmp/etc/apparmor.d/usr.sbin.mysqld")
+  SET (DEB_RULES_APPARMOR_LOAD
+    "dh_apparmor -pmysql-${DEB_PRODUCTNAME}-server --profile-name=usr.sbin.mysqld")
+  SET (DEB_RULES_SYSTEMD_ENABLE "")
+  SET (DEB_RULES_SYSTEMD_START "")
+  SET (DEB_INSTALL_SERVER_SYSTEMD "")
+  SET (DEB_INSTALL_SERVER_APPARMOR "etc/apparmor.d/usr.sbin.mysqld")
+  SET (DEB_SERVICE_SERVER_EXECPRE "")
+  SET (DEB_INIT_APPARMOR "/lib/init/apparmor-profile-load usr.sbin.mysqld")
+ELSEIF(DEB_CODENAME STREQUAL "wily")
+  SET (DEB_PLATFORMRELEASE "ubuntu15.10")
+  SET (DEB_CONTROL_BDEPS "dh-apparmor, dh-systemd (>=1.5)")
+  SET (DEB_INSTALL_SOURCE_XZ "../*.tar.xz usr/src/mysql/")
+  SET (DEB_RULES_INSTALL_SYSTEMD
+    "install -m 0755 debian/extra/mysql-systemd-start debian/tmp/usr/share/mysql/")
+  SET (DEB_RULES_INSTALL_APPARMOR
+    "install -g root -o root -m 0644 -D debian/extra/apparmor-profile debian/tmp/etc/apparmor.d/usr.sbin.mysqld")
+  SET (DEB_RULES_APPARMOR_LOAD
+    "dh_apparmor -pmysql-community-server --profile-name=usr.sbin.mysqld")
+  SET (DEB_RULES_SYSTEMD_ENABLE "dh_systemd_enable --name=mysql")
+  SET (DEB_RULES_SYSTEMD_START "dh_systemd_start --restart-after-upgrade")
+  SET (DEB_INSTALL_SERVER_SYSTEMD "usr/share/mysql/mysql-systemd-start")
+  SET (DEB_INSTALL_SERVER_APPARMOR "etc/apparmor.d/usr.sbin.mysqld")
+  SET (DEB_SERVICE_SERVER_EXECPRE
+    "ExecStartPre=/usr/share/mysql/mysql-systemd-start pre")
+  SET (DEB_INIT_APPARMOR "/lib/init/apparmor-profile-load usr.sbin.mysqld")
+ELSEIF(DEB_CODENAME STREQUAL "xenial")
+  SET (DEB_PLATFORMRELEASE "ubuntu16.04")
+  SET (DEB_CONTROL_BDEPS "dh-apparmor, dh-systemd (>=1.5)")
+  SET (DEB_INSTALL_SOURCE_XZ "../*.tar.xz usr/src/mysql/")
+  SET (DEB_RULES_INSTALL_SYSTEMD
+    "install -m 0755 debian/extra/mysql-systemd-start debian/tmp/usr/share/mysql/")
+  SET (DEB_RULES_INSTALL_APPARMOR
+    "install -g root -o root -m 0644 -D debian/extra/apparmor-profile debian/tmp/etc/apparmor.d/usr.sbin.mysqld")
+  SET (DEB_RULES_APPARMOR_LOAD
+    "dh_apparmor -pmysql-${DEB_PRODUCTNAME}-server --profile-name=usr.sbin.mysqld")
+  SET (DEB_RULES_SYSTEMD_ENABLE "dh_systemd_enable --name=mysql")
+  SET (DEB_RULES_SYSTEMD_START "dh_systemd_start --restart-after-upgrade")
+  SET (DEB_INSTALL_SERVER_SYSTEMD "usr/share/mysql/mysql-systemd-start")
+  SET (DEB_INSTALL_SERVER_APPARMOR "etc/apparmor.d/usr.sbin.mysqld")
+  SET (DEB_SERVICE_SERVER_EXECPRE
+    "ExecStartPre=/usr/share/mysql/mysql-systemd-start pre")
+  SET (DEB_INIT_APPARMOR "/lib/apparmor/profile-load usr.sbin.mysqld")
+ELSEIF(DEB_CODENAME STREQUAL "yakkety")
+  SET (DEB_PLATFORMRELEASE "ubuntu16.10")
+  SET (DEB_CONTROL_BDEPS "dh-apparmor, dh-systemd (>=1.5)")
+  SET (DEB_INSTALL_SOURCE_XZ "../*.tar.xz usr/src/mysql/")
+  SET (DEB_RULES_INSTALL_SYSTEMD
+    "install -m 0755 debian/extra/mysql-systemd-start debian/tmp/usr/share/mysql/")
+  SET (DEB_RULES_INSTALL_APPARMOR
+    "install -g root -o root -m 0644 -D debian/extra/apparmor-profile debian/tmp/etc/apparmor.d/usr.sbin.mysqld")
+  SET (DEB_RULES_APPARMOR_LOAD
+    "dh_apparmor -pmysql-${DEB_PRODUCTNAME}-server --profile-name=usr.sbin.mysqld")
+  SET (DEB_RULES_SYSTEMD_ENABLE "dh_systemd_enable --name=mysql")
+  SET (DEB_RULES_SYSTEMD_START "dh_systemd_start --restart-after-upgrade")
+  SET (DEB_INSTALL_SERVER_SYSTEMD "usr/share/mysql/mysql-systemd-start")
+  SET (DEB_INSTALL_SERVER_APPARMOR "etc/apparmor.d/usr.sbin.mysqld")
+  SET (DEB_SERVICE_SERVER_EXECPRE
+    "ExecStartPre=/usr/share/mysql/mysql-systemd-start pre")
+  SET (DEB_INIT_APPARMOR "/lib/apparmor/profile-load usr.sbin.mysqld")
+ELSEIF(DEB_CODENAME STREQUAL "zesty")
+  SET (DEB_PLATFORMRELEASE "ubuntu17.04")
+  SET (DEB_CONTROL_BDEPS "dh-apparmor, dh-systemd (>=1.5)")
+  SET (DEB_INSTALL_SOURCE_XZ "../*.tar.xz usr/src/mysql/")
+  SET (DEB_RULES_INSTALL_SYSTEMD
+    "install -m 0755 debian/extra/mysql-systemd-start debian/tmp/usr/share/mysql/")
+  SET (DEB_RULES_INSTALL_APPARMOR
+    "install -g root -o root -m 0644 -D debian/extra/apparmor-profile debian/tmp/etc/apparmor.d/usr.sbin.mysqld")
+  SET (DEB_RULES_APPARMOR_LOAD
+    "dh_apparmor -pmysql-${DEB_PRODUCTNAME}-server --profile-name=usr.sbin.mysqld")
+  SET (DEB_RULES_SYSTEMD_ENABLE "dh_systemd_enable --name=mysql")
+  SET (DEB_RULES_SYSTEMD_START "dh_systemd_start --restart-after-upgrade")
+  SET (DEB_INSTALL_SERVER_SYSTEMD "usr/share/mysql/mysql-systemd-start")
+  SET (DEB_INSTALL_SERVER_APPARMOR "etc/apparmor.d/usr.sbin.mysqld")
+  SET (DEB_SERVICE_SERVER_EXECPRE
+    "ExecStartPre=/usr/share/mysql/mysql-systemd-start pre")
+  SET (DEB_INIT_APPARMOR "/lib/apparmor/profile-load usr.sbin.mysqld")
+ELSE()
+  MESSAGE(STATUS
+    "Skipping deb packaging on unsupported platform ${DEB_CODENAME}.")
+  RETURN()
+ENDIF()
+
+# All files are configured and copied to the debian/ directory, which is used 
+# by debuild to make the packages
+SET (DEB_ROOT ${CMAKE_SOURCE_DIR}/packaging/deb-in)
+FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/debian)
+FILE(GLOB_RECURSE SOURCEFILES RELATIVE "${DEB_ROOT}" "${DEB_ROOT}/*")
+# Skip the copyright file from the "other" product type
+LIST(REMOVE_ITEM SOURCEFILES "copyright.${DEB_REMOVEPATTERN}")
+LIST(REMOVE_ITEM SOURCEFILES "CMakeLists.txt")
+# Don't install systemd file on systems without systemd
+IF(DEB_INSTALL_SERVER_SYSTEMD STREQUAL "")
+       LIST(REMOVE_ITEM SOURCEFILES "mysql-packagesource-server.mysql.service.in")
+ENDIF()
+FOREACH (SOURCEFILE ${SOURCEFILES})
+  STRING(REGEX REPLACE "-packagesource-" "-${DEB_PRODUCTNAME}-"
+    TMPFILE ${SOURCEFILE})
+  # Strip away the input file endings from the destination filenames
+  STRING(REGEX REPLACE ".in$" "" TMPFILE ${TMPFILE})
+  STRING(REGEX REPLACE ".gpl$" "" TMPFILE ${TMPFILE})
+  STRING(REGEX REPLACE ".com$" "" DESTFILE ${TMPFILE})
+  CONFIGURE_FILE("${DEB_ROOT}/${SOURCEFILE}"
+    "${CMAKE_BINARY_DIR}/debian/${DESTFILE}" @ONLY)
+ENDFOREACH()
+EXECUTE_PROCESS(
+  COMMAND chmod +x ${CMAKE_BINARY_DIR}/debian/rules
+)
+
diff --git a/mysql-wsrep-5.6/packaging/deb-in/README b/mysql-wsrep-5.6/packaging/deb-in/README
new file mode 100644 (file)
index 0000000..b20a64f
--- /dev/null
@@ -0,0 +1,16 @@
+# Copyright (c) 2016, 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
+
+To override debian platform codename, specify DEB_CODENAME when building with cmake
diff --git a/mysql-wsrep-5.6/packaging/deb-in/README.Maintainer b/mysql-wsrep-5.6/packaging/deb-in/README.Maintainer
new file mode 100644 (file)
index 0000000..4b91c8e
--- /dev/null
@@ -0,0 +1,20 @@
+# Copyright (c) 2016, 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
+
+TODO: Why /bin/bash for some files and /bin/sh for others (this is also the case in native packaging, so might be a reason)
+TODO: Related to above: Should be POSIX compliant
+TODO: Build with -DWITH_SYSTEMD and related to use inbuilt systemd support (Deb8 and Ubuntu15+)
+TODO: Maybe refactor CMakeLists.txt to remove redundancy
+TODO: Clean up install exception list so --list-missing can be changed to --fail-missing
diff --git a/mysql-wsrep-5.6/packaging/deb-in/changelog.in b/mysql-wsrep-5.6/packaging/deb-in/changelog.in
new file mode 100644 (file)
index 0000000..ca88589
--- /dev/null
@@ -0,0 +1,163 @@
+mysql-@DEB_PRODUCTNAME@ (@DEB_SERVERVERSION@@DEB_PLATFORMRELEASE@) @DEB_CODENAME@; urgency=low
+
+  [ Akhil Mohan ]
+  * new upstream release
+  * Added new libtest_* plugins to source/include-binaries, mysql-*-test.install
+  * added new plugin to source/include-binaries, mysql-*-test.install
+    libtest_framework
+    libtest_services
+    libtest_services_threaded
+    locking_service
+    test_security_context
+    version_token
+  * added support for MECAB in
+    d/{control,rules,mysql-*-server.install,source/include-binaries}
+    (Closes: #20315007)
+  * added automatic setup of ssl certs in
+    d/mysql-*-server.mysql.init
+    d/extra/mysql-systemd-start
+    (Closes: #20650118)
+  * removed pkg mysql-*-bench; sqlbench will not be packaged
+    (Closes: #21303289)
+  * removed cleanup statement for client lib symlinks *_r in d/rules
+    (Closes: #21311067)
+
+  [ Balasubramanian Kandasamy ]
+  * Added mysqlpump man page to d/mysql-*-client.install
+  * Added new decompression utilities lz4_decompress and zlib_decompress
+    binaries.
+  * Added mysqlx plugin
+
+  [ Lars Tangvald ]
+  * Added keyring directory and plugin
+
+ -- Balasubramanian Kandasamy <balasubramanian.kandasamy@oracle.com>  Wed, 26 Aug 2015 15:20:12 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.7-rc-3ubuntu15.04) vivid; urgency=low
+
+  * new upstream release
+  * forked packaging source from utopic to vivid
+  * updated Standards-Version to 3.9.6 in d/control
+  * apparmor profile updated to allow read on all files under /etc/mysql
+  * added new conf files under d/extra/*.conf
+  * mysql_plugin moved from client to server pkg
+  * innochecksum moved from client to server pkg
+  * server pkg now replaces client pkg
+  * added systemd service profile and script
+  * new /etc/mysql/my.cnf management scheme added for Ubuntu 15.04
+    as discussed in Dec 2014 for native packaging source
+  * added dh "--with systemd" for enabling systemd
+  * mysql-common now conflicts with
+    mysql-server-5.6, mysql-server-core-5.6
+    mysql-client-5.6, mysql-client-core-5.6
+  * mysql-*-server no more provides
+    mysql-server-5.6, mysql-server-core-5.6
+  * mysql-*-client no more provides
+    mysql-client-5.6, mysql-client-core-5.6
+
+ -- Akhil Mohan <akhil.mohan@oracle.com>  Mon, 15 Jun 2015 16:48:05 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.7-rc-2ubuntu15.04) vivid; urgency=low
+
+  * new upstream release
+  * forked packaging source from utopic to vivid
+
+ -- Akhil Mohan <akhil.mohan@oracle.com>  Wed, 15 Apr 2015 20:27:33 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.7-rc-1ubuntu14.10) utopic; urgency=low
+
+  * new upstream release
+  * updated d/extra/my.cnf to remove option sql_mode
+  * non-essential tools, files and plugins have been moved to
+    mysql-@DEB_PRODUCTNAME@-test pkg.
+    mysql-@DEB_PRODUCTNAME@-test now replaces mysql-@DEB_PRODUCTNAME@-{server,client}
+    (Closes: #20546298)
+    (Closes: #20636865)
+  * mysql-@DEB_PRODUCTNAME@-test now depends on perl, python, libmysqlclient-dev
+    mysql-@DEB_PRODUCTNAME@-server now depends on psmisc
+    (Closes: #20561621)
+  * mysql-*-server.{mysql.init,postinst,templates} updated to deprecate
+    my_i_db and use msyqld --initialize-insecure to create system tables.
+    Now if user does not provide password or it is not possible to
+    receive password from user then UNIX socket authentication will be
+    enabled to secure the deployment by default.
+    mysql-@DEB_PRODUCTNAME@-server now depends on mysql-@DEB_PRODUCTNAME@-client
+    (Closes: #20613327)
+
+ -- Akhil Mohan <akhil.mohan@oracle.com>  Fri, 27 Feb 2015 10:01:55 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.6-m16-1ubuntu14.10) utopic; urgency=low
+
+  * new upstream release
+  * init script will now run my_i_db if data dir is not present or empty
+  * forked packaging source from trusty and rebranded for utopic
+  * updated d/m-c-source.install to pack *.xz packaging source archive
+  * added more system resources to app armor profile
+  * dh_apparmor to now run before dh_installinit in d/rules
+  * libmysqlclient-dev now replaces mysql-client-{,core-}5.6
+  * mysql-@DEB_PRODUCTNAME@-server now recommends mysql-client
+  * mysql-@DEB_PRODUCTNAME@-server now depends on apparmor
+  * d/compat incremented to 9 from 8
+  * d/control updated to build depend on debhelper 9
+  * added d/*.lintian-overrides and d/source/lintian-overrides
+  * d/rules updated to reflect correct file permissions
+  * bumped up libmysqlclient version 18 => 20
+  * added new plugins to source/include-binaries
+    replication_observers_example
+    rewriter
+    rewrite_example
+  * new binary mysql_ssl_rsa_setup added to d/mysql-*-server.install
+  * provisioned handling of data files directory /var/lib/mysql-files
+  * cmake option to specify data dir in d/rules is now removed
+    as default path in cmake layout for DEB is now /var/lib/mysql
+
+ -- Akhil Mohan <akhil.mohan@oracle.com>  Fri, 23 Jan 2015 19:59:33 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.5-m15-1ubuntu14.04) trusty; urgency=low
+
+  * new upstream release
+  * added fakeroot as build-dep in d/control
+  * added d/*.dirs for bench, dev and test pkg
+  * updated d/rules to make compilation verbose
+  * removed default CFLAGS, CXXFLAGS in d/rules
+  * removed extra whitespaces in d/*.postrm
+  * added CMake option to download boost if not available
+  * removed extra file modification steps in d/rules
+  * removed hotcopy, mysql_zap from d/mysql-@DEB_PRODUCTNAME@-server
+  * removed mysql_waitpid from d/mysql-@DEB_PRODUCTNAME@-client
+  * added patch for testsuite search paths under d/patches
+  * modified cmake option for testsuite in d/rules
+  * removed patch d/fix-mysql_install_db.patch
+  * enabled one patch in d/patches/series
+  * removed extra permissions check in d/rules when fixed in source
+  * modified d/mysql-*-server.postinst to stop removing /usr/my.cnf
+  * modified d/*-test.* for updated location of testsuite
+  * updated d/{mysql-*-server.install,rules} to include debug plugins
+  * updated d/rules to remove storage engine cmake options
+  * modified data dir permission in d/*server.{pre,post}inst
+  * updated d/source/include-binaries to add debug plugins
+  * updated d/rules to rename debug plugins
+  * updated d/source/include-binaries to add mysql_no_login.so
+  * updated d/rules to increment -j8 as make option
+  * updated CMake option WITH_EXTRA_CHARSETS from complex to all
+  * updated d/*-server.postinst to call m_i_db with --datadir --insecure
+    --mysqld-file
+  * updated d/*-server.postinst to remove manual creation mysql db dir
+  * removed test db prompt in d/*-server.{postinst,templates,config}
+  * updated app armor profile to allow access to socket lock file
+
+ -- Akhil Mohan <akhil.mohan@oracle.com>  Fri, 08 Aug 2014 11:27:30 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.4-m14-2ubuntu14.04) trusty; urgency=low
+
+  * modified path for source tar in source pkg
+  * obscured actual filenames in d/source/include-binaries
+  * modified d/rules to handle obscured filenames
+
+ -- Akhil Mohan <akhil.mohan@oracle.com>  Mon, 05 May 2014 15:45:10 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.4-m14-1ubuntu14.04) trusty; urgency=low
+
+  * new upstream release
+
+ -- Akhil Mohan <akhil.mohan@oracle.com>  Fri, 28 Feb 2014 18:06:30 +0530
diff --git a/mysql-wsrep-5.6/packaging/deb-in/compat b/mysql-wsrep-5.6/packaging/deb-in/compat
new file mode 100644 (file)
index 0000000..ec63514
--- /dev/null
@@ -0,0 +1 @@
+9
diff --git a/mysql-wsrep-5.6/packaging/deb-in/control.in b/mysql-wsrep-5.6/packaging/deb-in/control.in
new file mode 100644 (file)
index 0000000..ab8cafb
--- /dev/null
@@ -0,0 +1,217 @@
+Source: mysql-@DEB_PRODUCTNAME@
+Maintainer: MySQL Release Engineering <mysql-build@oss.oracle.com>
+Section: database
+Priority: optional
+Standards-Version: 3.9.6
+Homepage: http://www.mysql.com/
+Build-Depends: debhelper (>= 9.0.0), libaio-dev[linux-any], libncurses5-dev (>= 5.0-6), perl, zlib1g-dev (>= 1:1.1.3-5), po-debconf, psmisc, bison, lsb-release, cmake, fakeroot, libnuma-dev, @DEB_CONTROL_BDEPS@
+
+
+Package: mysql-server
+Architecture: any
+Depends: mysql-@DEB_PRODUCTNAME@-server (= ${binary:Version}), ${misc:Depends}
+Description: MySQL Server meta package depending on latest version
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This is a meta package that depends on the latest mysql server
+ package available in the repository.
+
+Package: mysql-@DEB_PRODUCTNAME@-server
+Architecture: any
+Pre-depends: debconf (>= 0.2.17), adduser
+Depends: mysql-common (>= ${binary:Version}), mysql-client (= ${binary:Version}), perl, psmisc,
+ ${shlibs:Depends}, ${misc:Depends}
+Breaks: mysql-common (<< 5.6.36)
+Conflicts: mysql,
+ mysql-server-5.0, mysql-server-core-5.0,
+ mysql-server-5.1, mysql-server-core-5.1,
+ mysql-server-5.5, mysql-server-core-5.5,
+ mysql-server-5.6, mysql-server-core-5.6,
+ mysql-server-5.7, mysql-server-core-5.7,
+ mysql-@DEB_NOTPRODUCTNAME@-server,
+ mariadb-server-5.5, mariadb-server-core-5.5,
+ mariadb-server-10.0, mariadb-server-core-10.0,
+ mariadb-server-10.1, mariadb-server-core-10.1,
+ mariadb-server-10.2, mariadb-server-core-10.2
+Replaces: mysql,
+ mysql-server-5.0, mysql-server-core-5.0,
+ mysql-server-5.1, mysql-server-core-5.1,
+ mysql-server-5.5, mysql-server-core-5.5,
+ mysql-server-5.6, mysql-server-core-5.6,
+ mysql-server-5.7, mysql-server-core-5.7,
+ mysql-@DEB_NOTPRODUCTNAME@-server,
+ mysql-common (<< 5.6.36)
+Provides: virtual-mysql-server, virtual-mysql-server-core
+Description: MySQL Server
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package includes the MySQL server binary as well as related
+ utilities to run and administer a MySQL server.
+
+Package: mysql-client
+Architecture: any
+Depends: mysql-@DEB_PRODUCTNAME@-client (= ${binary:Version}), ${misc:Depends}
+Description: MySQL Client meta package depending on latest version
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This is a meta package that depends on the latest mysql client
+ package available in the repository.
+
+Package: mysql-@DEB_PRODUCTNAME@-client
+Architecture: any
+Depends: mysql-common (>= ${binary:Version}),
+ ${shlibs:Depends}, ${misc:Depends}
+Breaks: mysql-common (<< 5.6.36), libmysqlclient-dev (<< 5.6.36)
+Conflicts: mysql,
+ mysql-client-5.0, mysql-client-core-5.0,
+ mysql-client-5.1, mysql-client-core-5.1,
+ mysql-client-5.5, mysql-client-core-5.5,
+ mysql-client-5.6, mysql-client-core-5.6,
+ mysql-client-5.7, mysql-client-core-5.7,
+ mysql-@DEB_NOTPRODUCTNAME@-client,
+ mariadb-client-5.5, mariadb-client-core-5.5,
+ mariadb-client-10.0, mariadb-client-core-10.0,
+ mariadb-client-10.1, mariadb-client-core-10.1,
+ mariadb-client-10.2, mariadb-client-core-10.2
+Replaces: mysql,
+ mysql-client-5.0, mysql-client-core-5.0,
+ mysql-client-5.1, mysql-client-core-5.1,
+ mysql-client-5.5, mysql-client-core-5.5,
+ mysql-client-5.6, mysql-client-core-5.6,
+ mysql-client-5.7, mysql-client-core-5.7,
+ mysql-@DEB_NOTPRODUCTNAME@-client,
+ mysql-common (<< 5.6.36),
+ libmysqlclient-dev (<< 5.6.36)
+Provides: virtual-mysql-client, virtual-mysql-client-core
+Description: MySQL Client
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package contains the standard MySQL clients and
+ administration tools.
+
+Package: libmysqlclient18
+Architecture: any
+Section: libs
+Pre-Depends: ${misc:Pre-Depends}
+Multi-Arch: same
+Depends: mysql-common (>= ${binary:Version}),
+ ${shlibs:Depends}, ${misc:Depends}
+Description: MySQL shared client libraries
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package contains the shared libraries for MySQL client
+ applications.
+
+Package: mysql-common
+Architecture: any
+Pre-depends: debconf (>= 0.2.17), ${misc:Pre-Depends}
+Multi-Arch: foreign
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Conflicts: mysql, mysql-server-5.6, mysql-server-core-5.6,
+ mysql-client-5.6, mysql-client-core-5.6,
+ mysql-server-5.7, mysql-server-core-5.7,
+ mysql-client-5.7, mysql-client-core-5.7,
+ mariadb-server-5.5, percona-xtradb-cluster-common-5.5,
+ mysql-common (<< 5.6.36)
+Replaces: mysql, mysql-server-5.5, mysql-server-core-5.5, libmysqlclient-dev,
+ mysql-server-5.6, mysql-server-core-5.6,
+ mysql-server-5.7, mysql-server-core-5.7,
+ mariadb-server-5.5, percona-xtradb-cluster-common-5.5,
+ mysql-common (<< 5.6.36)
+Provides: mysql-common
+Description: MySQL Common
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package contains common files needed by MySQL client
+ library, MySQL database server, and MySQL embedded server.
+
+Package: libmysqlclient-dev
+Architecture: any
+Section: libdevel
+Depends: libmysqlclient18 (= ${binary:Version}),
+ ${shlibs:Depends}, ${misc:Depends}
+Replaces: mysql-client-5.6, mysql-client-core-5.6,
+ mysql-client-5.7, mysql-client-core-5.7
+Description: MySQL development headers
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package contains the development header files necessary
+ to develop MySQL client applications.
+
+Package: libmysqld-dev
+Architecture: any
+Section: libdevel
+Depends: libmysqlclient-dev (= ${binary:Version}),
+ ${shlibs:Depends}, ${misc:Depends}
+Description: MySQL embedded server library
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package contains the MySQL server as an embedded library.
+
+Package: mysql-testsuite
+Architecture: any
+Depends: mysql-@DEB_PRODUCTNAME@-test (= ${binary:Version}), ${misc:Depends}
+Description: MySQL Testsuite meta package depending on latest version
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This is a meta package that depends on the latest mysql test
+ package available in the repository.
+
+Package: mysql-@DEB_PRODUCTNAME@-test
+Architecture: any
+Depends: mysql-@DEB_PRODUCTNAME@-server (= ${binary:Version}),
+ mysql-@DEB_PRODUCTNAME@-client (= ${binary:Version}), python,
+ libmysqlclient-dev, ${shlibs:Depends}, ${misc:Depends}
+Breaks: mysql-@DEB_PRODUCTNAME@-server (<< 5.6.36),
+ mysql-@DEB_PRODUCTNAME@-client (<< 5.6.36)
+Conflicts: mysql,
+ mysql-testsuite-5.0, mysql-testsuite-5.1, mysql-testsuite-5.5,
+ mysql-testsuite-5.6, mysql-testsuite-5.7, mysql-@DEB_NOTPRODUCTNAME@-test,
+ mariadb-test, mariadb-test-data
+Description: MySQL Test Run MTR - The MySQL testsuite
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package contains the MySQL regression test suite for MySQL
+ database server.
+
+Package: mysql-@DEB_PRODUCTNAME@-bench
+Architecture: any
+Depends: mysql-@DEB_PRODUCTNAME@-server (= ${binary:Version}),
+ ${shlibs:Depends}, ${misc:Depends}
+Conflicts: mysql, mysql-@DEB_NOTPRODUCTNAME@-bench
+Description: MySQL Bench
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle.
+
+Package: mysql-@DEB_PRODUCTNAME@-source
+Architecture: any
+Depends: ${misc:Depends}, ${shlibs:Depends}
+Description: MySQL source
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle.
diff --git a/mysql-wsrep-5.6/packaging/deb-in/copyright.com.in b/mysql-wsrep-5.6/packaging/deb-in/copyright.com.in
new file mode 100644 (file)
index 0000000..ddc639c
--- /dev/null
@@ -0,0 +1,64 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: @DEB_COPYRIGHT_UPSTREAMNAME@
+Upstream-Contact: MySQL Release Engineering <mysql-build@oss.oracle.com>
+Source: http://dev.mysql.com/
+
+Files: *
+Copyright: 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+License: Commercial
+ This is a release of MySQL, a dual-license SQL database server.
+ For the avoidance of doubt, this particular copy of the software
+ is released under a commercial license and the GNU General Public
+ License does not apply. MySQL is brought to you by Oracle.
+ .
+ This distribution may include materials developed by third
+ parties. For license and attribution notices for these
+ materials, please refer to the documentation that accompanies
+ this distribution (see the "Licenses for Third-Party Components"
+ appendix) or view the online documentation at
+ <http://dev.mysql.com/doc/>.
+ .
+ This software and related documentation are provided under a license
+ agreement containing restrictions on use and disclosure and are protected by
+ intellectual property laws. Except as expressly permitted in your license
+ agreement or allowed by law, you may not use, copy, reproduce, translate,
+ broadcast, modify, license, transmit, distribute, exhibit, perform, publish,
+ or display any part, in any form, or by any means. Reverse engineering,
+ disassembly, or decompilation of this software, unless required by law for
+ interoperability, is prohibited.
+ .
+ If this software or related documentation is delivered to the U.S.
+ Government or anyone licensing it on behalf of the U.S. Government, the
+ following notice is applicable:
+ .
+ U.S. GOVERNMENT RIGHTS Programs, software, databases, and related
+ documentation and technical data delivered to U.S. Government customers are
+ "commercial computer software" or "commercial technical data" pursuant to
+ the applicable Federal Acquisition Regulation and agency-specific
+ supplemental regulations. As such, the use, duplication, disclosure,
+ modification, and adaptation shall be subject to the restrictions and
+ license terms set forth in the applicable Government contract, and, to the
+ extent applicable by the terms of the Government contract, the additional
+ rights set forth in FAR 52.227-19, Commercial Computer Software License
+ (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA
+ 94065.
+ .
+ This software is developed for general use in a variety of information
+ management applications. It is not developed or intended for use in any
+ inherently dangerous applications, including applications which may create a
+ risk of personal injury. If you use this software in dangerous applications,
+ then you shall be responsible to take all appropriate fail-safe, backup,
+ redundancy, and other measures to ensure the safe use of this software.
+ Oracle Corporation and its affiliates disclaim any liability for any damages
+ caused by use of this software in dangerous applications.
+ .
+ Oracle is a registered trademark of Oracle Corporation and/or its
+ affiliates. Other names may be trademarks of their respective owners.
+ .
+ This software and documentation may provide access to or information on
+ content, products, and services from third parties. Oracle Corporation and
+ its affiliates are not responsible for and expressly disclaim all warranties
+ of any kind with respect to third-party content, products, and services.
+ Oracle Corporation and its affiliates will not be responsible for any loss,
+ costs, or damages incurred due to your access to or use of third-party
+ content, products, or services.
diff --git a/mysql-wsrep-5.6/packaging/deb-in/copyright.gpl.in b/mysql-wsrep-5.6/packaging/deb-in/copyright.gpl.in
new file mode 100644 (file)
index 0000000..50e29be
--- /dev/null
@@ -0,0 +1,41 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: @DEB_COPYRIGHT_UPSTREAMNAME@
+Upstream-Contact: MySQL Release Engineering <mysql-build@oss.oracle.com>
+Source: http://dev.mysql.com/
+
+Copyright: 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+License:
+ This is a release of MySQL, a dual-license SQL database server.
+ For the avoidance of doubt, this particular copy of the software
+ is released under the version 2 of the GNU General Public License.
+ MySQL is brought to you by Oracle.
+ .
+ MySQL FOSS License Exception
+ We want free and open source software applications under certain
+ licenses to be able to use specified GPL-licensed MySQL client
+ libraries despite the fact that not all such FOSS licenses are
+ compatible with version 2 of the GNU General Public License.
+ Therefore there are special exceptions to the terms and conditions
+ of the GPLv2 as applied to these client libraries, which are
+ identified and described in more detail in the FOSS License
+ Exception at
+ <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
+ .
+ This distribution may include materials developed by third
+ parties. For license and attribution notices for these
+ materials, please refer to the documentation that accompanies
+ this distribution (see the "Licenses for Third-Party Components"
+ appendix) or view the online documentation at
+ <http://dev.mysql.com/doc/>.
+ .
+ GPLv2 Disclaimer
+ For the avoidance of doubt, except that if any license choice
+ other than GPL or LGPL is available it will apply instead,
+ Oracle elects to use only the General Public License version 2
+ (GPLv2) at this time for any software where a choice of GPL
+ license versions is made available with the language indicating
+ that GPLv2 or any later version may be used, or where a choice
+ .
+ The full text of the GNU General Public License version 2 can
+ be found in the file
+ `/usr/share/mysql/doc/@DEB_INSTALL_LICENSEFILE@'.
diff --git a/mysql-wsrep-5.6/packaging/deb-in/extra/apparmor-profile b/mysql-wsrep-5.6/packaging/deb-in/extra/apparmor-profile
new file mode 100644 (file)
index 0000000..8004069
--- /dev/null
@@ -0,0 +1,67 @@
+#include <tunables/global>
+
+/usr/sbin/mysqld {
+  #include <abstractions/base>
+  #include <abstractions/nameservice>
+  #include <abstractions/user-tmp>
+  #include <abstractions/mysql>
+  #include <abstractions/winbind>
+
+# Allow system resource access
+  /sys/devices/system/cpu/ r,
+  /sys/devices/system/node/ r,
+  /sys/devices/system/node/** r,
+  /proc/*/status r,
+  capability sys_resource,
+  capability dac_override,
+  capability setuid,
+  capability setgid,
+
+# Allow network access
+  network tcp,
+
+  /etc/hosts.allow r,
+  /etc/hosts.deny r,
+
+# Allow config access
+  /etc/mysql/** r,
+
+# Allow pid, socket, socket lock file access
+  /var/run/mysqld/mysqld.pid rw,
+  /var/run/mysqld/mysqld.sock rw,
+  /var/run/mysqld/mysqld.sock.lock rw,
+  /run/mysqld/mysqld.pid rw,
+  /run/mysqld/mysqld.sock rw,
+  /run/mysqld/mysqld.sock.lock rw,
+
+# Allow execution of server binary
+  /usr/sbin/mysqld mr,
+  /usr/sbin/mysqld-debug mr,
+
+# Allow plugin access
+  /usr/lib/mysql/plugin/ r,
+  /usr/lib/mysql/plugin/*.so* mr,
+
+# Allow error msg and charset access
+  /usr/share/mysql/ r,
+  /usr/share/mysql/** r,
+
+# Allow data dir access
+  /var/lib/mysql/ r,
+  /var/lib/mysql/** rwk,
+
+# Allow data files dir access
+  /var/lib/mysql-files/ r,
+  /var/lib/mysql-files/** rwk,
+
+# Allow keyring dir access
+  /var/lib/mysql-keyring/ r,
+  /var/lib/mysql-keyring/** rwk,
+
+# Allow log file access
+  /var/log/mysql/ r,
+  /var/log/mysql/** rw,
+
+  # Site-specific additions and overrides. See local/README for details.
+  #include <local/usr.sbin.mysqld>
+}
diff --git a/mysql-wsrep-5.6/packaging/deb-in/extra/conf.d/mysql.cnf b/mysql-wsrep-5.6/packaging/deb-in/extra/conf.d/mysql.cnf
new file mode 100644 (file)
index 0000000..37d11e3
--- /dev/null
@@ -0,0 +1,22 @@
+# Copyright (c) 2015, 2016, 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
+
+#
+# The MySQL @PRODUCTNAMEC@ Client configuration file.
+#
+# For explanations see
+# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
+
+[mysql]
diff --git a/mysql-wsrep-5.6/packaging/deb-in/extra/my.cnf.fallback b/mysql-wsrep-5.6/packaging/deb-in/extra/my.cnf.fallback
new file mode 100644 (file)
index 0000000..24940f4
--- /dev/null
@@ -0,0 +1,25 @@
+# Copyright (c) 2015, 2016, 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
+
+#
+# The MySQL @DEB_PRODUCTNAMEC@ Server configuration file.
+#
+# For explanations see
+# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
+
+# * IMPORTANT: Additional settings that can override those from this file!
+#   The files must end with '.cnf', otherwise they'll be ignored.
+#
+!includedir /etc/mysql/conf.d/
diff --git a/mysql-wsrep-5.6/packaging/deb-in/extra/mysql-helpers b/mysql-wsrep-5.6/packaging/deb-in/extra/mysql-helpers
new file mode 100644 (file)
index 0000000..538177d
--- /dev/null
@@ -0,0 +1,181 @@
+# Copyright (c) 2017, 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
+
+# Wait for server to start up (this requires the client package)
+pinger () {
+       while /bin/true ; do
+               sleep 1
+               mysqladmin ping >/dev/null 2>&1 && break
+       done
+}
+
+# To avoid having hardcoded paths in the script, we do a search on the path, as suggested at:
+# https://www.debian.org/doc/manuals/developers-reference/ch06.en.html#bpp-debian-maint-scripts
+pathfind() {
+       OLDIFS="$IFS"
+       IFS=:
+       for p in $PATH; do
+               if [ -x "$p/$*" ]; then
+                       IFS="$OLDIFS"
+                       return 0
+               fi
+       done
+       IFS="$OLDIFS"
+       return 1
+}
+
+# Fetch value from config files
+# Usage: get_mysql_option [section] [option] [default value]
+get_mysql_option() {
+       if pathfind my_print_defaults; then
+               RESULT=$(my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1)
+       fi
+       if [ -z "$RESULT" ]; then
+               RESULT="$3"
+       fi
+       echo $RESULT
+}
+
+# Check if server is running
+get_running () {
+       MYSQLDATA=$(get_mysql_option mysqld datadir "/var/lib/mysql")
+       PIDFILE=$(get_mysql_option mysqld_safe pid-file "")
+       if [ -z "$PIDFILE" ]; then
+               PIDFILE=$(get_mysql_option mysqld pid-file "$MYSQLDATA/$(hostname).pid")
+       fi
+       if [ -e "$PIDFILE" ] && [ -d "/proc/$(cat "$PIDFILE")" ]; then
+               echo 1
+       else
+               echo 0
+       fi
+}
+
+# Runs an arbitrary init sql file supplied in $1. Does not require login access
+run_init_sql() {
+       tmpdir=$(mktemp -d)
+       chown mysql:mysql "$tmpdir"
+       mysqld --bootstrap --user=mysql --socket="$tmpdir/mysqld.sock" --pid-file="$tmpdir/mysqld.pid" > /dev/null 2>&1 < "$1"
+       result=$?
+       rm -rf "$tmpdir"
+       return $result
+}
+
+# Verify that everything the server needs to run is set up
+verify_ready() {
+
+               MYSQLDATA=$(get_mysql_option mysqld datadir "/var/lib/mysql")
+               MYSQLFILES=$(get_mysql_option mysqld secure-file-priv "/var/lib/mysql-files")
+               MYSQLKEYRING=$(dirname $(get_mysql_option mysqld keyring-file-data "/var/lib/mysql-keyring/keyring"))
+               MYSQLLOG=$(dirname $(get_mysql_option mysqld log-error "/var/log/mysql/error.log"))
+               MYSQLRUN=/var/run/mysqld
+
+               if ! getent group mysql >/dev/null; then
+                       addgroup --system mysql >/dev/null
+               fi
+
+               if ! getent passwd mysql >/dev/null; then
+                       adduser --ingroup mysql --system --disabled-login --no-create-home --home ${MYSQLDATA} --shell /bin/false --gecos "MySQL Server" mysql >/dev/null
+               fi
+               ERROR_FLAG=0
+               if [ ! -d ${MYSQLDATA} -a ! -L ${MYSQLDATA} ]; then
+                       if [ "$(dirname "${MYSQLDATA}")" = "/var/lib" ]; then
+                               install -d -m0750 -omysql -gmysql ${MYSQLDATA}
+                       else
+                               echo "Error: Datadir ${MYSQLDATA} does not exist. For security reasons the service will not automatically create directories outside /var/lib.."
+                               ERROR_FLAG=1
+                       fi
+               fi
+
+               if [ ! -d ${MYSQLFILES} -a ! -L ${MYSQLFILES} ]; then
+                       if [ "$(dirname "${MYSQLFILES}")" = "/var/lib" -o ${MYSQLFILES} = NULL ]; then
+                               install -d -m0770 -omysql -gmysql ${MYSQLFILES}
+                       else
+                               echo "Error: Secure-file-priv dir ${MYSQLFILES} does not exist. For security reasons the service will not automatically create directories outside /var/lib."
+                               ERROR_FLAG=1
+                       fi
+               fi
+
+               if [ ! -d ${MYSQLKEYRING} -a ! -L ${MYSQLKEYRING} ]; then
+                       if [ "$(dirname "${MYSQLKEYRING}")" = "/var/lib" ]; then
+                               install -d -m0750 -omysql -gmysql ${MYSQLKEYRING}
+                       else
+                               echo "Warning: Keyring dir ${MYSQLKEYRING} does not exist. For security reasons the service will not automatically create directories outside /var/lib. The server may not start correctly."
+                       fi
+               fi
+
+               if [ ! -d ${MYSQLLOG} -a ! -L ${MYSQLLOG} ]; then
+                       if [ "$(dirname "${MYSQLLOG}")" = "/var/log" ]; then
+                               install -d -m0750 -omysql -gadm ${MYSQLLOG}
+                               install /dev/null -m0640 -omysql -gadm ${MYSQLLOG}/error.log
+                       else
+                               echo "Error: Log dir ${MYSQLLOG} does not exist. For security reasons the service will not automatically create directories outside /var/log."
+                               ERROR_FLAG=1
+                       fi
+               fi
+
+               if [ ${ERROR_FLAG} = 1 ]; then
+                       echo "Errors found. Aborting."
+                       exit 1
+               fi
+
+               if [ ! -d ${MYSQLRUN} -a ! -L ${MYSQLRUN} ]; then
+                       install -d -m0755 -omysql -gmysql ${MYSQLRUN}
+               fi
+}
+
+# Verify the database exists and is ssl ready
+verify_database() {
+       MYSQLDATA=$(get_mysql_option mysqld datadir "/var/lib/mysql")
+       MYSQLFILES=$(get_mysql_option mysqld secure-file-priv "/var/lib/mysql-files")
+
+       if [ ! -d "${MYSQLDATA}/mysql" ] && [ -d "${MYSQLFILES}" ]; then
+               su - mysql -s /bin/bash -c "mysql_install_db --user=mysql > /dev/null"
+       fi
+
+       if [ -x /usr/bin/mysql_ssl_rsa_setup -a ! -e "${MYSQLDATA}/server-key.pem" ]; then
+               mysql_ssl_rsa_setup --datadir="${MYSQLDATA}" --uid=mysql >/dev/null 2>&1
+       fi
+}
+
+verify_server () {
+       TIMEOUT=0
+       if [ "${1}" = "start" ]; then
+               TIMEOUT=${STARTTIMEOUT}
+       elif [ "${1}" = "stop" ]; then
+               TIMEOUT=${STOPTIMEOUT}
+       fi
+
+       COUNT=0
+       while [ ${COUNT} -lt ${TIMEOUT} ];
+       do
+               COUNT=$(( COUNT+1 ))
+               echo -n .
+               if [ "${1}" = "start" ] && [ "$(get_running)" = 1 ]; then
+                       if [ -z ${2} ]; then
+                               echo
+                       fi
+                       return 0
+               fi
+               if [ "${1}" = "stop" ] && [ "$(get_running)" = 0 ]; then
+                       if [ -z ${2} ]; then
+                               echo
+                       fi
+                       return 0
+               fi
+               sleep 1
+       done
+       return 1
+}
+
diff --git a/mysql-wsrep-5.6/packaging/deb-in/extra/mysql-systemd-start b/mysql-wsrep-5.6/packaging/deb-in/extra/mysql-systemd-start
new file mode 100644 (file)
index 0000000..4b21776
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# Copyright (c) 2015, 2017, 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
+
+# Scripts to run by MySQL systemd service
+#
+# Needed argument: pre
+#
+# pre mode  :  try to perform sanity check for configuration, log, data
+# post mode :  ping server until answer is received
+
+# Include helper functions
+. /usr/share/mysql/mysql-helpers
+
+sanity () {
+# Make sure database and required directories exist
+       verify_ready
+       verify_database
+
+
+       @DEB_INIT_APPARMOR@
+
+       if [ ! -r /etc/mysql/my.cnf ]; then
+               echo "MySQL configuration not found at /etc/mysql/my.cnf. Please install one using update-alternatives."
+               exit 1
+       fi
+}
+
+case $1 in
+       "pre")  sanity ;;
+       "post") pinger ;;
+esac
diff --git a/mysql-wsrep-5.6/packaging/deb-in/extra/mysql.cnf b/mysql-wsrep-5.6/packaging/deb-in/extra/mysql.cnf
new file mode 100644 (file)
index 0000000..1536985
--- /dev/null
@@ -0,0 +1,26 @@
+# Copyright (c) 2015, 2016, 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
+
+#
+# The MySQL @PRODUCTNAMEC@ Server configuration file.
+#
+# For explanations see
+# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
+
+# * IMPORTANT: Additional settings that can override those from this file!
+#   The files must end with '.cnf', otherwise they'll be ignored.
+#
+!includedir /etc/mysql/conf.d/
+!includedir /etc/mysql/mysql.conf.d/
diff --git a/mysql-wsrep-5.6/packaging/deb-in/extra/mysql_embedded.1 b/mysql-wsrep-5.6/packaging/deb-in/extra/mysql_embedded.1
new file mode 100644 (file)
index 0000000..735c4e0
--- /dev/null
@@ -0,0 +1 @@
+.so man1/mysql.1
diff --git a/mysql-wsrep-5.6/packaging/deb-in/extra/mysqld.cnf b/mysql-wsrep-5.6/packaging/deb-in/extra/mysqld.cnf
new file mode 100644 (file)
index 0000000..50f84c1
--- /dev/null
@@ -0,0 +1,28 @@
+# Copyright (c) 2014, 2016, 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
+
+#
+# The MySQL @PRODUCTNAMEC@ Server configuration file.
+#
+# For explanations see
+# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
+
+[mysqld]
+pid-file       = /var/run/mysqld/mysqld.pid
+socket         = /var/run/mysqld/mysqld.sock
+datadir                = /var/lib/mysql
+log-error      = /var/log/mysql/error.log
+# Disabling symbolic-links is recommended to prevent assorted security risks
+symbolic-links=0
diff --git a/mysql-wsrep-5.6/packaging/deb-in/libmysqlclient-dev.install.in b/mysql-wsrep-5.6/packaging/deb-in/libmysqlclient-dev.install.in
new file mode 100644 (file)
index 0000000..29d9046
--- /dev/null
@@ -0,0 +1,27 @@
+# Copyright (c) 2015, 2016, 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
+
+usr/include/mysql/*.h
+usr/include/mysql/mysql/*.h
+usr/include/mysql/mysql/psi/*.h
+usr/lib/*/libmysqlclient.a
+usr/lib/*/libmysqlclient.so
+usr/lib/*/libmysqlservices.a
+usr/bin/mysql_config
+usr/share/man/man1/mysql_config.1
+usr/share/aclocal/mysql.m4
+# legal
+usr/share/doc/libmysqlclient-dev/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/libmysqlclient-dev/README
diff --git a/mysql-wsrep-5.6/packaging/deb-in/libmysqlclient-dev.lintian-overrides.in b/mysql-wsrep-5.6/packaging/deb-in/libmysqlclient-dev.lintian-overrides.in
new file mode 100644 (file)
index 0000000..a5e535e
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (c) 2015, 2016, 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
+
+# Additional license file is needed so overriding this warning
+libmysqlclient-dev: extra-license-file usr/share/doc/libmysqlclient-dev/LICENSE.mysql
+libmysqlclient-dev: extra-license-file usr/share/doc/libmysqlclient-dev/@DEB_INSTALL_LICENSEFILE@.gz
+libmysqlclient-dev: copyright-should-refer-to-common-license-file-for-lgpl
+# Due to static linking this cannot be avoided and hence being overridden
+libmysqlclient-dev: embedded-library
diff --git a/mysql-wsrep-5.6/packaging/deb-in/libmysqlclient18.install.in b/mysql-wsrep-5.6/packaging/deb-in/libmysqlclient18.install.in
new file mode 100644 (file)
index 0000000..5f7ef63
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright (c) 2015, 2016, 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
+
+usr/lib/*/libmysqlclient.so.18*
+# legal
+usr/share/doc/libmysqlclient18/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/libmysqlclient18/README
diff --git a/mysql-wsrep-5.6/packaging/deb-in/libmysqlclient18.lintian-overrides.in b/mysql-wsrep-5.6/packaging/deb-in/libmysqlclient18.lintian-overrides.in
new file mode 100644 (file)
index 0000000..970480b
--- /dev/null
@@ -0,0 +1,20 @@
+# Copyright (c) 2015, 2016, 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
+
+# Additional license file is needed so overriding this warning
+libmysqlclient18: extra-license-file usr/share/doc/libmysqlclient18/@DEB_INSTALL_LICENSEFILE@.gz
+libmysqlclient18: copyright-should-refer-to-common-license-file-for-lgpl
+# Due to static linking this cannot be avoided and hence being overridden
+libmysqlclient18: embedded-library
diff --git a/mysql-wsrep-5.6/packaging/deb-in/libmysqld-dev.install.in b/mysql-wsrep-5.6/packaging/deb-in/libmysqld-dev.install.in
new file mode 100644 (file)
index 0000000..2e5065f
--- /dev/null
@@ -0,0 +1,20 @@
+# Copyright (c) 2015, 2016, 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
+
+usr/lib/*/libmysqld.a
+usr/lib/*/libmysqld-debug.a
+# legal
+usr/share/doc/libmysqld-dev/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/libmysqld-dev/README
diff --git a/mysql-wsrep-5.6/packaging/deb-in/libmysqld-dev.lintian-overrides.in b/mysql-wsrep-5.6/packaging/deb-in/libmysqld-dev.lintian-overrides.in
new file mode 100644 (file)
index 0000000..557a62e
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright (c) 2015, 2016, 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
+
+# Additional license file is needed so overriding this warning
+libmysqld-dev: extra-license-file usr/share/doc/libmysqld-dev/LICENSE.mysql
+libmysqld-dev: extra-license-file usr/share/doc/libmysqld-dev/@DEB_INSTALL_LICENSEFILE@.gz
+libmysqld-dev: copyright-should-refer-to-common-license-file-for-lgpl
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-client.install.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-client.install.in
new file mode 100644 (file)
index 0000000..26ae1bf
--- /dev/null
@@ -0,0 +1,18 @@
+# Copyright (c) 2015, 2016, 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
+
+# legal
+usr/share/doc/mysql-client/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-client/README
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-client.lintian-overrides.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-client.lintian-overrides.in
new file mode 100644 (file)
index 0000000..2e2b13e
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright (c) 2015, 2016, 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
+
+# Additional license file is needed so overriding this warning
+mysql-client: extra-license-file usr/share/doc/mysql-client/LICENSE.mysql
+mysql-client: extra-license-file usr/share/doc/mysql-client/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-client: copyright-should-refer-to-common-license-file-for-lgpl
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-common.dirs.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-common.dirs.in
new file mode 100644 (file)
index 0000000..b5b8280
--- /dev/null
@@ -0,0 +1,16 @@
+# Copyright (c) 2015, 2016, 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
+
+etc/mysql/conf.d
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-common.install.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-common.install.in
new file mode 100644 (file)
index 0000000..c8d8e9e
--- /dev/null
@@ -0,0 +1,25 @@
+# Copyright (c) 2015, 2016, 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
+
+# configuration file and script
+debian/extra/conf.d  etc/mysql/
+debian/extra/my.cnf.fallback etc/mysql/
+
+usr/share/mysql/docs/ChangeLog
+usr/share/mysql/docs/INFO_SRC
+usr/share/mysql/docs/INFO_BIN
+# legal
+usr/share/doc/mysql-common/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-common/README
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-common.lintian-overrides.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-common.lintian-overrides.in
new file mode 100644 (file)
index 0000000..f0bee93
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright (c) 2015, 2016, 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
+
+# Additional license file is needed so overriding this warning
+mysql-common: extra-license-file usr/share/doc/mysql-common/LICENSE.mysql
+mysql-common: extra-license-file usr/share/doc/mysql-common/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-common: copyright-should-refer-to-common-license-file-for-lgpl
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-common.postinst.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-common.postinst.in
new file mode 100644 (file)
index 0000000..3bf56a5
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Copyright (c) 2015, 2017, 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
+
+set -e
+
+if [ "$1" = "configure" ]; then
+       # Low priority fallback for client use when no server is installed.
+       update-alternatives --install /etc/mysql/my.cnf my.cnf /etc/mysql/my.cnf.fallback 100
+fi
+
+#DEBHELPER#
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-common.postrm.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-common.postrm.in
new file mode 100644 (file)
index 0000000..f79a243
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Copyright (c) 2015, 2016, 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
+
+set -e
+
+if [ "$1" = "purge" ]; then
+       rmdir /etc/mysql 2>/dev/null || true
+       update-alternatives --remove-all my.cnf
+fi
+
+#DEBHELPER#
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-bench.install.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-bench.install.in
new file mode 100644 (file)
index 0000000..cefabaa
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright (c) 2016, 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
+
+usr/lib/mysql/sql-bench/*
+# legal
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-bench/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-bench/README
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-bench.lintian-overrides.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-bench.lintian-overrides.in
new file mode 100644 (file)
index 0000000..f4c1687
--- /dev/null
@@ -0,0 +1,18 @@
+# Copyright (c) 2016, 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
+
+# Additional license file is needed so overriding this warning
+mysql-@DEB_PRODUCTNAME@-bench: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-bench/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-community-bench: copyright-should-refer-to-common-license-file-for-lgpl
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.conffiles.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.conffiles.in
new file mode 100644 (file)
index 0000000..84c59f2
--- /dev/null
@@ -0,0 +1,25 @@
+/usr/share/mysql/charsets/armscii8.xml
+/usr/share/mysql/charsets/ascii.xml
+/usr/share/mysql/charsets/cp1250.xml
+/usr/share/mysql/charsets/cp1251.xml
+/usr/share/mysql/charsets/cp1256.xml
+/usr/share/mysql/charsets/cp1257.xml
+/usr/share/mysql/charsets/cp850.xml
+/usr/share/mysql/charsets/cp852.xml
+/usr/share/mysql/charsets/cp866.xml
+/usr/share/mysql/charsets/dec8.xml
+/usr/share/mysql/charsets/geostd8.xml
+/usr/share/mysql/charsets/greek.xml
+/usr/share/mysql/charsets/hebrew.xml
+/usr/share/mysql/charsets/hp8.xml
+/usr/share/mysql/charsets/Index.xml
+/usr/share/mysql/charsets/keybcs2.xml
+/usr/share/mysql/charsets/koi8r.xml
+/usr/share/mysql/charsets/koi8u.xml
+/usr/share/mysql/charsets/latin1.xml
+/usr/share/mysql/charsets/latin2.xml
+/usr/share/mysql/charsets/latin5.xml
+/usr/share/mysql/charsets/latin7.xml
+/usr/share/mysql/charsets/macce.xml
+/usr/share/mysql/charsets/macroman.xml
+/usr/share/mysql/charsets/swe7.xml
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.install.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.install.in
new file mode 100644 (file)
index 0000000..5c42fd7
--- /dev/null
@@ -0,0 +1,55 @@
+# Copyright (c) 2015, 2016, 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
+
+# binaries
+usr/bin/myisam_ftdump
+usr/bin/mysql
+usr/bin/mysql_config_editor
+usr/bin/mysql_embedded
+usr/bin/mysql_find_rows
+usr/bin/mysql_fix_extensions
+usr/bin/mysql_plugin
+usr/bin/mysql_waitpid
+usr/bin/mysqlaccess
+usr/bin/mysqlaccess.conf
+usr/bin/mysqladmin
+usr/bin/mysqlbug
+usr/bin/mysqlcheck
+usr/bin/mysqldump
+usr/bin/mysqldumpslow
+usr/bin/mysqlimport
+usr/bin/mysqlshow
+usr/bin/mysqlslap
+# charsets
+usr/share/mysql/charsets/*.xml
+usr/share/mysql/charsets/README
+# man pages
+usr/share/man/man1/myisam_ftdump.1
+usr/share/man/man1/mysql.1
+usr/share/man/man1/mysql_config_editor.1
+usr/share/man/man1/mysql_embedded.1
+usr/share/man/man1/mysql_plugin.1
+usr/share/man/man1/mysqlaccess.1
+usr/share/man/man1/mysqladmin.1
+usr/share/man/man1/mysqlcheck.1
+usr/share/man/man1/mysqldump.1
+usr/share/man/man1/mysqldumpslow.1
+usr/share/man/man1/mysqlimport.1
+usr/share/man/man1/mysqlman.1
+usr/share/man/man1/mysqlshow.1
+usr/share/man/man1/mysqlslap.1
+# legal
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-client/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-client/README
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.lintian-overrides.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.lintian-overrides.in
new file mode 100644 (file)
index 0000000..cbdada7
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (c) 2015, 2016, 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
+
+# Additional license file is needed so overriding this warning
+mysql-@DEB_PRODUCTNAME@-client: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-client/LICENSE.mysql
+mysql-@DEB_PRODUCTNAME@-client: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-client/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-@DEB_PRODUCTNAME@-client: copyright-should-refer-to-common-license-file-for-lgpl
+# Due to static linking this cannot be avoided and hence being overridden
+mysql-@DEB_PRODUCTNAME@-client: embedded-library
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.config.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.config.in
new file mode 100644 (file)
index 0000000..4e801c9
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+# Copyright (c) 2015, 2016, 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
+
+. /usr/share/debconf/confmodule
+
+get_root_pass(){
+       while :; do
+               PASSWD=""
+               db_input high mysql-@DEB_PRODUCTNAME@-server/root-pass || true
+               db_go
+
+               db_get mysql-@DEB_PRODUCTNAME@-server/root-pass
+               if [ -z "${RET}" ];
+               then
+                       db_fset mysql-@DEB_PRODUCTNAME@-server/root-pass seen true
+                       db_fset mysql-@DEB_PRODUCTNAME@-server/re-root-pass seen true
+                       break
+               fi
+               PASSWD="${RET}"
+
+               db_input high mysql-@DEB_PRODUCTNAME@-server/re-root-pass || true
+               db_go
+
+               db_get mysql-@DEB_PRODUCTNAME@-server/re-root-pass
+               if [ "${RET}" == "${PASSWD}" ];
+               then
+                       PASSWD=""
+                       break
+               fi
+
+               db_fset mysql-@DEB_PRODUCTNAME@-server/root-pass-mismatch seen false
+               db_input critical mysql-@DEB_PRODUCTNAME@-server/root-pass-mismatch
+               db_set mysql-@DEB_PRODUCTNAME@-server/root-pass ""
+               db_set mysql-@DEB_PRODUCTNAME@-server/re-root-pass ""
+       done
+}
+if [ "$1" = "configure" ] && [ -z "$2" ];
+then
+
+       set -e
+
+       PKG_LIST=mysql-server-5.5:mysql-server-5.6:mysql-server-5.7:mysql-community-server:mysql-commercial-server
+       INSTALLED_PKG=none
+       MYSQLDATA=/var/lib/mysql
+
+       IFS_BACKUP=${IFS}
+       IFS=":"
+       for PKG in ${PKG_LIST};
+       do
+               STATUS=$(dpkg -s ${PKG} 2> /dev/null | grep Status: | cut -d' ' -f4)
+               if [ "${STATUS}" = "installed" ];
+               then
+                       INSTALLED_PKG=${PKG}
+                       break
+               fi
+       done
+       IFS=${IFS_BACKUP}
+
+       if [ "${INSTALLED_PKG}" = "none" ];
+       then
+               if [ -d ${MYSQLDATA} -o -L ${MYSQLDATA} ];
+               then
+                       db_input high mysql-@DEB_PRODUCTNAME@-server/data-dir || true
+               else
+                       db_fset mysql-@DEB_PRODUCTNAME@-server/data-dir seen true
+               fi
+
+               get_root_pass
+
+       else
+               db_fset mysql-@DEB_PRODUCTNAME@-server/data-dir seen true
+               # If datadir is missing, ask for root password even with existing packages
+               if [ ! -d ${MYSQLDATA} -a ! -L ${MYSQLDATA} ];
+               then
+                       get_root_pass
+               else
+                       db_fset mysql-@DEB_PRODUCTNAME@-server/root-pass seen true
+                       db_fset mysql-@DEB_PRODUCTNAME@-server/re-root-pass seen true
+               fi
+       fi
+
+       set +e
+fi
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.dirs.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.dirs.in
new file mode 100644 (file)
index 0000000..de6a09f
--- /dev/null
@@ -0,0 +1,16 @@
+# Copyright (c) 2015, 2016, 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
+
+etc/mysql/mysql.conf.d
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.install.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.install.in
new file mode 100644 (file)
index 0000000..a3ffa63
--- /dev/null
@@ -0,0 +1,103 @@
+# Copyright (c) 2015, 2017, 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
+
+# binaries
+usr/bin/innochecksum
+usr/bin/msql2mysql
+usr/bin/myisamchk
+usr/bin/myisamlog
+usr/bin/myisampack
+usr/bin/my_print_defaults
+usr/bin/mysql_convert_table_format
+usr/bin/mysql_install_db
+usr/bin/mysql_secure_installation
+@DEB_PLUGIN_SETPERMISSION@
+usr/bin/mysql_tzinfo_to_sql
+usr/bin/mysql_upgrade
+usr/bin/mysql_zap
+usr/bin/mysqld_multi
+usr/bin/mysqld_safe
+usr/bin/mysqlbinlog
+usr/bin/mysqlhotcopy
+usr/bin/perror
+usr/bin/replace
+usr/bin/resolveip
+usr/bin/resolve_stack_dump
+usr/sbin/mysqld
+# debug binary
+usr/sbin/mysqld-debug
+# man pages
+usr/share/man/man1/innochecksum.1
+usr/share/man/man1/comp_err.1
+usr/share/man/man1/myisamchk.1
+usr/share/man/man1/myisamlog.1
+usr/share/man/man1/myisampack.1
+usr/share/man/man1/my_print_defaults.1
+usr/share/man/man1/mysql.server.1
+usr/share/man/man1/mysql-stress-test.pl.1
+usr/share/man/man1/mysql_secure_installation.1
+usr/share/man/man1/mysql_tzinfo_to_sql.1
+usr/share/man/man1/mysql_upgrade.1
+usr/share/man/man1/mysqlbinlog.1
+usr/share/man/man1/mysqld_multi.1
+usr/share/man/man1/mysqld_safe.1
+usr/share/man/man1/perror.1
+usr/share/man/man1/replace.1
+usr/share/man/man1/resolveip.1
+usr/share/man/man1/resolve_stack_dump.1
+usr/share/man/man8/mysqld.8
+# confguration files
+usr/share/mysql/my-default.cnf
+debian/extra/mysql.cnf  etc/mysql/
+debian/extra/mysqld.cnf /etc/mysql/mysql.conf.d/
+# app armor profile
+@DEB_INSTALL_SERVER_APPARMOR@
+# SQL files
+usr/share/mysql/*.sql
+# plugins
+usr/lib/mysql/plugin/adt_null.so
+usr/lib/mysql/plugin/auth_socket.so
+usr/lib/mysql/plugin/connection_control.so
+usr/lib/mysql/plugin/innodb_engine.so
+usr/lib/mysql/plugin/libmemcached.so
+usr/lib/mysql/plugin/mypluglib.so
+usr/lib/mysql/plugin/mysql_no_login.so
+usr/lib/mysql/plugin/semisync_master.so
+usr/lib/mysql/plugin/semisync_slave.so
+usr/lib/mysql/plugin/validate_password.so
+usr/lib/mysql/plugin/debug/adt_null.so
+usr/lib/mysql/plugin/debug/auth_socket.so
+usr/lib/mysql/plugin/debug/connection_control.so
+usr/lib/mysql/plugin/debug/innodb_engine.so
+usr/lib/mysql/plugin/debug/libmemcached.so
+usr/lib/mysql/plugin/debug/mypluglib.so
+usr/lib/mysql/plugin/debug/mysql_no_login.so
+usr/lib/mysql/plugin/debug/semisync_master.so
+usr/lib/mysql/plugin/debug/semisync_slave.so
+usr/lib/mysql/plugin/debug/validate_password.so
+@DEB_INSTALL_SERVER_PLUGINS@
+# support files
+usr/share/mysql/dictionary.txt
+usr/share/mysql/magic
+usr/share/mysql/mysql-log-rotate
+usr/share/mysql/mysql-helpers
+# localized error msgs
+usr/share/mysql/*/errmsg.sys
+usr/share/mysql/errmsg-utf8.txt
+@DEB_INSTALL_SERVER_SYSTEMD@
+usr/share/mysql/mysqld_multi.server
+# legal
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-server/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-server/README
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.lintian-overrides.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.lintian-overrides.in
new file mode 100644 (file)
index 0000000..0b32115
--- /dev/null
@@ -0,0 +1,23 @@
+# Copyright (c) 2015, 2016, 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
+
+# Additional license file is needed so overriding this warning
+mysql-@DEB_PRODUCTNAME@-server: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-server/LICENSE.mysql
+mysql-@DEB_PRODUCTNAME@-server: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-server/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-@DEB_PRODUCTNAME@-server: copyright-should-refer-to-common-license-file-for-lgpl
+# Due to static linking this cannot be avoided and hence being overridden
+mysql-@DEB_PRODUCTNAME@-server: embedded-library
+# Since we ship debug plugins so this error is overridden
+mysql-@DEB_PRODUCTNAME@-server: unstripped-binary-or-object usr/lib/mysql/plugin/debug/*
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.mysql.init.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.mysql.init.in
new file mode 100644 (file)
index 0000000..0ebb7ae
--- /dev/null
@@ -0,0 +1,115 @@
+#!/bin/bash
+#
+### BEGIN INIT INFO
+# Provides:          mysql
+# Required-Start:    $remote_fs $syslog
+# Required-Stop:     $remote_fs $syslog
+# Should-Start:      $network $time
+# Should-Stop:       $network $time
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start/ Stop MySQL @DEB_PRODUCTNAMEC@ Server daemon
+# Description:       This service script facilitates startup and shutdown of
+#                    mysqld daemon throught its wrapper script mysqld_safe
+### END INIT INFO
+#
+
+# Copyright (c) 2015, 2017, 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
+
+. /lib/lsb/init-functions
+. /usr/share/mysql/mysql-helpers
+cd /
+umask 077
+
+# In case server is taking more to start or stop increase the timeout here
+STARTTIMEOUT=180
+STOPTIMEOUT=60
+
+# We need to check that the binaries exist; When upgrading from community to commercial this
+# script will be run after community is removed but before commercial is installed
+VERSION="unknown"
+if pathfind mysqld; then
+       VERSION=$(mysqld --version | grep mysqld | cut -d' ' -f4)
+fi
+
+MYSQLRUN=/var/run/mysqld
+MYSQLDATA=$(get_mysql_option mysqld datadir "/var/lib/mysql")
+MYSQLFILES=/var/lib/mysql-files
+MYSQLKEYRING=/var/lib/mysql-keyring
+MYSQLLOG=/var/log/mysql
+
+case "$1" in
+  'start')
+       if [ "$(get_running)" -eq 1 ];
+       then
+               log_action_msg "A MySQL Server is already started"
+       else
+               verify_ready
+               verify_database
+
+               @DEB_INIT_APPARMOR@
+
+               su - mysql -s /bin/bash -c "mysqld_safe > /dev/null &"
+               verify_server start
+               if [ "$?" -eq 0 ];
+               then
+                       log_action_msg "MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} is started"
+               else
+                       log_action_msg "MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} did not start. Please check logs for more details."
+               fi
+       fi
+       ;;
+
+  'stop')
+       if [ "$(get_running)" -eq 1 ];
+       then
+               killall -u mysql
+               verify_server stop
+               if [ "$?" -eq 0 ];
+               then
+                       log_action_msg "MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} is stopped"
+               else
+                       log_action_msg "Attempt to shutdown MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} timed out"
+               fi
+       else
+               log_action_msg "MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} is already stopped"
+       fi
+       ;;
+
+  'restart'|'reload'|'force-reload')
+       log_action_msg "Stopping MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION}"
+       $0 stop
+       log_action_msg "Re-starting MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION}"
+       $0 start
+       ;;
+
+  'status')
+       if [ "$(get_running)" -eq 1 ];
+       then
+               log_action_msg "MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} is running"
+       else
+               log_action_msg "MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} is not running"
+               exit 3
+       fi
+       ;;
+
+  *)
+       echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
+       exit 1
+       ;;
+esac
+
+exit 0
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.mysql.service.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.mysql.service.in
new file mode 100644 (file)
index 0000000..241e458
--- /dev/null
@@ -0,0 +1,34 @@
+# Copyright (c) 2015, 2016, 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
+
+# MySQL systemd service file
+
+[Unit]
+Description=MySQL @DEB_PRODUCTNAMEC@ Server
+After=network.target
+
+[Install]
+WantedBy=multi-user.target
+
+[Service]
+User=mysql
+Group=mysql
+PermissionsStartOnly=true
+@DEB_SERVICE_SERVER_EXECPRE@
+ExecStart=/usr/bin/mysqld_safe
+ExecStartPost=/usr/share/mysql/mysql-systemd-start post
+TimeoutSec=600
+LimitNOFILE = 5000
+Restart=on-failure
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.postinst.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.postinst.in
new file mode 100644 (file)
index 0000000..ae861e7
--- /dev/null
@@ -0,0 +1,98 @@
+#!/bin/bash
+
+# Copyright (c) 2015, 2017, 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
+
+. /usr/share/debconf/confmodule
+. /usr/share/mysql/mysql-helpers
+take_upstart_job_backup () {
+       if [ -e "/etc/init/mysql.conf" ] && [ -d "/var/lib/mysql" ];
+       then
+                               mysql_install_db --user=mysql > /dev/null
+               mv /etc/init/mysql.conf /var/lib/mysql/.mysql.conf.backup
+       fi
+}
+
+invoke() {
+       if pathfind invoke-rc.d; then
+               invoke-rc.d mysql
+       else
+               /etc/init.d/mysql $1
+       fi
+}
+case "$1" in
+       configure)
+
+       if [ -z "$2" ];
+       then
+
+               set -e
+               # If the existing config file is a proper file, we back it up
+               if [ -f "/etc/mysql/my.cnf" ] && [ ! -L "/etc/mysql/my.cnf" ]; then
+                       cp /etc/mysql/my.cnf /etc/mysql/my.cnf.bak
+               fi
+               update-alternatives --force --install /etc/mysql/my.cnf my.cnf "/etc/mysql/mysql.cnf" 200
+
+               verify_ready
+               MYSQLDATA=/var/lib/mysql
+               MYSQLFILES=/var/lib/mysql-files
+               if aa-status --enabled 2>/dev/null; then
+                       apparmor_parser -r -T -W /etc/apparmor.d/usr.sbin.mysqld 2>/dev/null || true
+               fi
+               if [ ! "$(ls -A ${MYSQLDATA})" ] && [ -d ${MYSQLFILES} ];
+               then
+                       db_get mysql-@DEB_PRODUCTNAME@-server/root-pass && PASSWD=${RET}
+                       db_set mysql-@DEB_PRODUCTNAME@-server/root-pass ""
+                       db_set mysql-@DEB_PRODUCTNAME@-server/re-root-pass ""
+                       SQL=$(mktemp -u ${MYSQLFILES}/XXXXXXXXXX)
+                       install /dev/null -m0600 -omysql -gmysql "${SQL}"
+                       if [ ! -z "${PASSWD}" ];
+                       then
+                               PASSWD=$(printf %q "${PASSWD}")
+                               cat << EOF > ${SQL}
+USE mysql;
+UPDATE user SET password=PASSWORD('${PASSWD}') WHERE user='root';
+DELETE FROM user WHERE user='';
+FLUSH PRIVILEGES;
+EOF
+                               PASSWD=""
+                       fi
+                       mysql_install_db --user=mysql > /dev/null
+                       run_init_sql "$SQL"
+                       rm -f "$SQL"
+               fi
+
+               set +e
+
+       fi
+
+       ;;
+
+       abort-upgrade|abort-remove|abort-configure)
+
+       ;;
+
+       *)
+       exit 1
+       ;;
+esac
+
+db_stop
+
+take_upstart_job_backup
+
+#DEBHELPER#
+
+exit 0
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.postrm.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.postrm.in
new file mode 100644 (file)
index 0000000..77a2dfb
--- /dev/null
@@ -0,0 +1,172 @@
+#!/bin/bash
+
+# Copyright (c) 2015, 2016, 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
+
+if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ];
+then
+. /usr/share/debconf/confmodule
+fi
+
+place_upstart_job_back () {
+       if [ -e "/var/lib/mysql/.mysql.conf.backup" ];
+       then
+               mv /var/lib/mysql/.mysql.conf.backup /etc/init/mysql.conf
+       fi
+}
+
+get_pcount () {
+       PSCOUNT=$(ps -ef | grep "/usr/sbin/mysqld" | wc -l)
+       echo "${PSCOUNT}"
+}
+
+server_stop () {
+       PSCOUNT=$(get_pcount)
+       COUNT=0
+       while :; do
+               COUNT=$(( COUNT+1 ))
+               echo -n .
+               if [ "${PSCOUNT}" -eq 1 ];
+               then
+                       echo
+                       break
+               fi
+               if [ "${COUNT}" -gt 15 ];
+               then
+                       echo
+                       return 1
+               fi
+               PSCOUNT=$(get_pcount)
+               sleep 1
+       done
+       return 0
+}
+
+case "$1" in
+       remove)
+
+       set -e
+
+       place_upstart_job_back
+       update-alternatives --remove my.cnf "/etc/mysql/mysql.cnf"
+
+       set +e
+
+       ;;
+
+       purge)
+
+       set -e
+
+       place_upstart_job_back
+
+       MYSQLDATA=/var/lib/mysql
+       MYSQLFILES=/var/lib/mysql-files
+       MYSQLKEYRING=/var/lib/mysql-keyring
+       MYSQLLOG=/var/log/mysql
+       MYSQLRUN=/var/run/mysqld
+
+       server_stop
+
+       db_input high mysql-@DEB_PRODUCTNAME@-server/remove-data-dir || true
+       db_go
+       db_get mysql-@DEB_PRODUCTNAME@-server/remove-data-dir && RMDATADIR=${RET}
+       if [ "${RMDATADIR}" = "true" ];
+       then
+               if [ -d ${MYSQLRUN} ] || [ -L ${MYSQLRUN} ];
+               then
+                       rm -rf ${MYSQLRUN}
+               fi
+
+               if [ -d ${MYSQLLOG} ] || [ -L ${MYSQLLOG} ];
+               then
+                       rm -rf ${MYSQLLOG}
+               fi
+
+               if [ -d ${MYSQLDATA} ] || [ -L ${MYSQLDATA} ];
+               then
+                       rm -rf ${MYSQLDATA}
+               fi
+
+               if [ -d ${MYSQLFILES} ] || [ -L ${MYSQLFILES} ];
+               then
+                       rm -rf ${MYSQLFILES}
+               fi
+
+               if [ -d ${MYSQLKEYRING} ] || [ -L ${MYSQLKEYRING} ];
+               then
+                       rm -rf ${MYSQLKEYRING}
+               fi
+
+               if getent passwd mysql >/dev/null;
+               then
+                       userdel mysql
+               fi
+       fi
+
+       set +e
+       ;;
+
+       abort-install)
+
+       set -e
+
+       place_upstart_job_back
+
+       if [ -x "/etc/init.d/mysql" ];
+       then
+               invoke-rc.d mysql start || exit $?
+       else
+               if [ -d ${MYSQLRUN} ] || [ -L ${MYSQLRUN} ];
+               then
+                       rm -rf ${MYSQLRUN}
+               fi
+
+               if [ -d ${MYSQLLOG} ] || [ -L ${MYSQLLOG} ];
+               then
+                       rm -rf ${MYSQLLOG}
+               fi
+
+               if [ -d ${MYSQLDATA} ] || [ -L ${MYSQLDATA} ];
+               then
+                       rm -rf ${MYSQLDATA}
+               fi
+
+               if [ -d ${MYSQLFILES} ] || [ -L ${MYSQLFILES} ];
+               then
+                       rm -rf ${MYSQLFILES}
+               fi
+
+               if getent passwd mysql >/dev/null;
+               then
+                       userdel mysql
+               fi
+       fi
+
+       set +e
+       ;;
+
+       upgrade|abort-upgrade)
+
+       ;;
+
+       *)
+       exit 1
+       ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.preinst.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.preinst.in
new file mode 100644 (file)
index 0000000..d4c1e6a
--- /dev/null
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+# Copyright (c) 2015, 2017, 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
+
+get_pcount () {
+       PSCOUNT=$(ps -ef | grep "/usr/sbin/mysqld" | wc -l)
+       echo "${PSCOUNT}"
+}
+
+server_stop () {
+       PSCOUNT=$(get_pcount)
+       COUNT=0
+       while :; do
+               COUNT=$(( COUNT+1 ))
+               echo -n .
+               if [ "${PSCOUNT}" -eq 1 ];
+               then
+                       echo
+                       break
+               fi
+               if [ "${COUNT}" -gt 15 ];
+               then
+                       echo
+                       return 1
+               fi
+               PSCOUNT=$(get_pcount)
+               sleep 1
+       done
+       return 0
+}
+
+case "$1" in
+       install)
+
+       if [ -z "$2" ];
+       then
+
+               set -e
+
+               if [ -x "/etc/init.d/mysql" ];
+               then
+                       invoke-rc.d mysql stop || exit $?
+                       server_stop
+               fi
+
+               set +e
+
+       fi
+
+       ;;
+
+       upgrade)
+
+       set -e
+
+       #DEBHELPER#
+       server_stop
+
+       set +e
+
+       ;;
+
+       abort-upgrade)
+
+       ;;
+
+       *)
+        exit 1
+        ;;
+esac
+
+exit 0
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.prerm.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.prerm.in
new file mode 100644 (file)
index 0000000..f38c8e3
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# Copyright (c) 2015, 2016, 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
+
+set -e
+
+#DEBHELPER#
+
+set +e
+
+exit 0
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.templates.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.templates.in
new file mode 100644 (file)
index 0000000..85366ad
--- /dev/null
@@ -0,0 +1,35 @@
+Template: mysql-@DEB_PRODUCTNAME@-server/root-pass
+Type: password
+Description: Enter root password:
+ Please provide a strong password that will be set for the root account of your MySQL database.
+ Leave it blank to enable password less login using UNIX socket based authentication.
+
+Template: mysql-@DEB_PRODUCTNAME@-server/re-root-pass
+Type: password
+Description: Re-enter root password:
+ Now that you have selected a password for the root account, please confirm by typing it again. Do not share the password with anyone.
+
+Template: mysql-@DEB_PRODUCTNAME@-server/root-pass-mismatch
+Type: error
+Description: The two passwords did not match
+ Please try again. Make sure you type the exact same password twice.
+
+Template: mysql-@DEB_PRODUCTNAME@-server/remove-data-dir
+Type: boolean
+Default: false
+Description: Remove data directories ?
+ This operation will remove the data directory at '/var/lib/mysql' that stores all the databases, tables and related meta-data.
+ Additionally, any import or export files stored at '/var/lib/mysql-files' will be removed along with directory.
+ Finally, any files in '/var/lib/mysql-keyring' will be deleted.
+ It is highly recommended to take data backup before removing the data directories.
+
+Template: mysql-@DEB_PRODUCTNAME@-server/data-dir
+Type: note
+Description: Data directory found when no MySQL server package is installed
+ A data directory '/var/lib/mysql' is present on this system when no MySQL server
+ package is currently installed on the system. The directory may be under control of
+ server package received from third-party vendors. It may also be an unclaimed data
+ directory from previous removal of mysql packages.
+ .
+ It is highly recommended to take data backup. If you have not done so, now would be
+ the time to take backup in another shell. Once completed, press 'Ok' to continue.
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-source.install.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-source.install.in
new file mode 100644 (file)
index 0000000..8fb9456
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (c) 2015, 2016, 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
+
+../*.dsc    usr/src/mysql/
+../*.tar.gz usr/src/mysql/
+@DEB_INSTALL_SOURCE_XZ@
+# legal
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-source/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-source/README
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-source.lintian-overrides.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-source.lintian-overrides.in
new file mode 100644 (file)
index 0000000..d5c9ec3
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright (c) 2015, 2016, 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
+
+# Additional license file is needed so overriding this warning
+mysql-@DEB_PRODUCTNAME@-source: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-source/LICENSE.mysql
+mysql-@DEB_PRODUCTNAME@-source: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-source/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-@DEB_PRODUCTNAME@-source: copyright-should-refer-to-common-license-file-for-lgpl
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-test.install.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-test.install.in
new file mode 100644 (file)
index 0000000..e05f6d2
--- /dev/null
@@ -0,0 +1,48 @@
+# Copyright (c) 2015, 2016, 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
+
+# binaries
+usr/bin/mysql_client_test
+usr/bin/mysql_client_test_embedded
+usr/bin/mysqltest
+usr/bin/mysqltest_embedded
+# manpages
+usr/share/man/man1/mysql_client_test.1
+usr/share/man/man1/mysql_client_test_embedded.1
+usr/share/man/man1/mysql-test-run.pl.1
+usr/share/man/man1/mysqltest.1
+usr/share/man/man1/mysqltest_embedded.1
+# plugins
+usr/lib/mysql/plugin/auth.so
+usr/lib/mysql/plugin/auth_test_plugin.so
+usr/lib/mysql/plugin/daemon_example.ini
+usr/lib/mysql/plugin/libdaemon_example.so
+usr/lib/mysql/plugin/qa_auth_client.so
+usr/lib/mysql/plugin/qa_auth_interface.so
+usr/lib/mysql/plugin/qa_auth_server.so
+usr/lib/mysql/plugin/test_udf_services.so
+usr/lib/mysql/plugin/debug/auth.so
+usr/lib/mysql/plugin/debug/auth_test_plugin.so
+usr/lib/mysql/plugin/debug/daemon_example.ini
+usr/lib/mysql/plugin/debug/libdaemon_example.so
+usr/lib/mysql/plugin/debug/qa_auth_client.so
+usr/lib/mysql/plugin/debug/qa_auth_interface.so
+usr/lib/mysql/plugin/debug/qa_auth_server.so
+usr/lib/mysql/plugin/debug/test_udf_services.so
+# test suite
+usr/lib/mysql-test/*
+# legal
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-test/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-test/README
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-test.links.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-test.links.in
new file mode 100644 (file)
index 0000000..51a5d94
--- /dev/null
@@ -0,0 +1,17 @@
+# Copyright (c) 2015, 2016, 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
+
+usr/lib/mysql-test/mysql-test-run.pl usr/lib/mysql-test/mysql-test-run
+usr/lib/mysql-test/mysql-test-run.pl usr/lib/mysql-test/mtr
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-test.lintian-overrides.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-test.lintian-overrides.in
new file mode 100644 (file)
index 0000000..7680f39
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright (c) 2015, 2016, 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
+
+# Additional license file is needed so overriding this warning
+mysql-@DEB_PRODUCTNAME@-test: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-test/LICENSE.mysql
+mysql-@DEB_PRODUCTNAME@-test: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-test/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-@DEB_PRODUCTNAME@-test: copyright-should-refer-to-common-license-file-for-lgpl
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-server.install.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-server.install.in
new file mode 100644 (file)
index 0000000..bcb11b4
--- /dev/null
@@ -0,0 +1,18 @@
+# Copyright (c) 2015, 2016, 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
+
+# legal
+usr/share/doc/mysql-server/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-server/README
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-server.lintian-overrides.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-server.lintian-overrides.in
new file mode 100644 (file)
index 0000000..b1ab604
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright (c) 2015, 2016, 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
+
+# Additional license file is needed so overriding this warning
+mysql-server: extra-license-file usr/share/doc/mysql-server/LICENSE.mysql
+mysql-server: extra-license-file usr/share/doc/mysql-server/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-server: copyright-should-refer-to-common-license-file-for-lgpl
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-testsuite.install.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-testsuite.install.in
new file mode 100644 (file)
index 0000000..644be2c
--- /dev/null
@@ -0,0 +1,18 @@
+# Copyright (c) 2015, 2016, 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
+
+# legal
+usr/share/doc/mysql-testsuite/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-testsuite/README
diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-testsuite.lintian-overrides.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-testsuite.lintian-overrides.in
new file mode 100644 (file)
index 0000000..66cc13f
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright (c) 2015, 2016, 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
+
+# Additional license file is needed so overriding this warning
+mysql-testsuite: extra-license-file usr/share/doc/mysql-testsuite/LICENSE.mysql
+mysql-testsuite: extra-license-file usr/share/doc/mysql-testsuite/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-testsuite: copyright-should-refer-to-common-license-file-for-lgpl
diff --git a/mysql-wsrep-5.6/packaging/deb-in/patches/series b/mysql-wsrep-5.6/packaging/deb-in/patches/series
new file mode 100644 (file)
index 0000000..e8dd728
--- /dev/null
@@ -0,0 +1,15 @@
+# Copyright (c) 2015, 2016, 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
+
diff --git a/mysql-wsrep-5.6/packaging/deb-in/rules.in b/mysql-wsrep-5.6/packaging/deb-in/rules.in
new file mode 100644 (file)
index 0000000..227c28f
--- /dev/null
@@ -0,0 +1,145 @@
+#!/usr/bin/make -f
+
+# Copyright (c) 2015, 2017, 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
+
+%:
+       dh $@
+
+export DH_VERBOSE=1
+export CFLAGS=
+export CXXFLAGS=
+
+override_dh_auto_configure:
+       @echo "RULES.$@"
+       cmake . \
+               -DBUILD_CONFIG=mysql_release \
+               -DCMAKE_INSTALL_PREFIX=/usr \
+               -DINSTALL_DOCDIR=share/mysql/docs \
+               -DINSTALL_DOCREADMEDIR=share/mysql \
+               -DINSTALL_INCLUDEDIR=include/mysql \
+               -DINSTALL_INFODIR=share/mysql/docs \
+               -DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \
+               -DINSTALL_MANDIR=share/man \
+               -DINSTALL_MYSQLSHAREDIR=share/mysql \
+               -DINSTALL_MYSQLTESTDIR=lib/mysql-test \
+               -DINSTALL_PLUGINDIR=lib/mysql/plugin \
+               -DINSTALL_SBINDIR=sbin \
+               -DINSTALL_SCRIPTDIR=bin \
+               -DINSTALL_SQLBENCHDIR=lib/mysql \
+               -DINSTALL_SUPPORTFILESDIR=share/mysql \
+               -DSYSCONFDIR=/etc/mysql \
+               -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
+               -DWITH_SSL=bundled \
+               -DWITH_INNODB_MEMCACHED=1 \
+               -DWITH_MECAB=system \
+               -DCOMPILATION_COMMENT="MySQL @DEB_PRODUCTNAMEC@ Server (@DEB_LICENSENAME@)" \
+               -DINSTALL_LAYOUT=DEB \
+               -DDEB_PRODUCT=@DEB_PRODUCT@ \
+               @DEB_CMAKE_EXTRAS@
+       touch $@
+
+override_dh_auto_build:
+       @echo "RULES.$@"
+       $(MAKE) -j8 VERBOSE=1
+       touch $@
+
+override_dh_auto_test:
+       @echo "RULES.$@"
+       touch $@
+
+override_dh_auto_install:
+
+       @echo "RULES.$@"
+       # complete install first
+       $(MAKE) install DESTDIR=debian/tmp
+       # remove all redundant files
+       rm debian/tmp/usr/lib/*/*_r*
+       rm debian/tmp/usr/lib/mysql-test/cmake_install.cmake
+       rm debian/tmp/usr/lib/mysql-test/CTestTestfile.cmake
+       rm debian/tmp/usr/lib/mysql-test/Makefile
+       # add missing man pages
+       install -g root -o root -m 0644 debian/extra/mysql_embedded.1 debian/tmp/usr/share/man/man1
+       # add MySQL Server debug binary and library to package
+       install -g root -o root -m 0755 debian/extra/server-binary debian/tmp/usr/sbin/mysqld-debug
+       install -g root -o root -m 0755 debian/extra/embedded-server debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqld-debug.a
+       # add debug plugin libraries to package
+       install -g root -o root -m 0755 -d debian/tmp/usr/lib/mysql/plugin/debug
+       for file in debian/extra/*-plugin; do NEW=`echo $$file | cut -d- -f1`; mv $$file $$NEW.so; done
+       install -g root -o root -m 0755 debian/extra/*.so debian/tmp/usr/lib/mysql/plugin/debug
+       install -g root -o root -m 0755 debian/extra/daemon_example.ini debian/tmp/usr/lib/mysql/plugin/debug
+       # Add helper functions for maintainer scripts
+       install -m 0644 debian/extra/mysql-helpers debian/tmp/usr/share/mysql/
+       # add apparmor profile
+       @DEB_RULES_INSTALL_APPARMOR@
+       # add systemd script
+       @DEB_RULES_INSTALL_SYSTEMD@
+       # add directory for legal docs
+       install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-server
+       install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-server
+       install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-client
+       install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-client
+       install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-common
+       install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/libmysqlclient18
+       install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/libmysqlclient-dev
+       install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/libmysqld-dev
+       install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-bench
+       install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-testsuite
+       install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-test
+       install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-source
+       # add @DEB_INSTALL_LICENSEFILE@ file to each package
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-server/@DEB_INSTALL_LICENSEFILE@
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-server/@DEB_INSTALL_LICENSEFILE@
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-client/@DEB_INSTALL_LICENSEFILE@
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-client/@DEB_INSTALL_LICENSEFILE@
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-common/@DEB_INSTALL_LICENSEFILE@
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/libmysqlclient18/@DEB_INSTALL_LICENSEFILE@
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/libmysqlclient-dev/@DEB_INSTALL_LICENSEFILE@
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/libmysqld-dev/@DEB_INSTALL_LICENSEFILE@
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-bench/@DEB_INSTALL_LICENSEFILE@
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-testsuite/@DEB_INSTALL_LICENSEFILE@
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-test/@DEB_INSTALL_LICENSEFILE@
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-source/@DEB_INSTALL_LICENSEFILE@
+       # add README file to each package
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-server/README
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-server/README
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-client/README
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-client/README
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-common/README
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/libmysqlclient18/README
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/libmysqlclient-dev/README
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/libmysqld-dev/README
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-bench/README
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-testsuite/README
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-test/README
+       install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-source/README
+       touch $@
+
+override_dh_installinit:
+       @echo "RULES.$@"
+       @DEB_RULES_APPARMOR_LOAD@
+       @DEB_RULES_SYSTEMD_ENABLE@
+       dh_installinit --name=mysql -- defaults 19 21
+       @DEB_RULES_SYSTEMD_START@
+       touch $@
+
+override_dh_install:
+       dh_install --list-missing
+               -Xusr/bin/i_mysql_client_test
+               -Xusr/share/mysql/mysql.server
+               -Xusr/share/mysql/COPYING
+               -Xusr/share/mysql/README
+               -Xusr/share/mysql/docs/mysql.info
+               -Xusr/share/man/man1/mysqlman.1
diff --git a/mysql-wsrep-5.6/packaging/deb-in/source/format b/mysql-wsrep-5.6/packaging/deb-in/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/mysql-wsrep-5.6/packaging/deb-in/source/include-binaries b/mysql-wsrep-5.6/packaging/deb-in/source/include-binaries
new file mode 100644 (file)
index 0000000..ca14101
--- /dev/null
@@ -0,0 +1,73 @@
+# Copyright (c) 2015, 2016, 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
+
+# obscured filename for mysqld-debug, libmysqld-debug.a
+debian/extra/server-binary
+debian/extra/embedded-server
+# obscured filenames for debug plugins
+debian/extra/adt_null-plugin
+debian/extra/auth-plugin
+debian/extra/auth_socket-plugin
+debian/extra/auth_test_plugin-plugin
+debian/extra/component_example_component1-plugin
+debian/extra/component_example_component2-plugin
+debian/extra/component_example_component3-plugin
+debian/extra/connection_control-plugin
+debian/extra/ha_example-plugin
+debian/extra/innodb_engine-plugin
+debian/extra/keyring_file-plugin
+debian/extra/keyring_udf-plugin
+debian/extra/libdaemon_example-plugin
+debian/extra/libmemcached-plugin
+debian/extra/libpluginmecab-plugin
+debian/extra/libtest_framework-plugin
+debian/extra/libtest_services-plugin
+debian/extra/libtest_services_threaded-plugin
+debian/extra/libtest_session_detach-plugin
+debian/extra/libtest_session_info-plugin
+debian/extra/libtest_session_in_thd-plugin
+debian/extra/libtest_sql_2_sessions-plugin
+debian/extra/libtest_sql_all_col_types-plugin
+debian/extra/libtest_sql_cmds_1-plugin
+debian/extra/libtest_sql_commit-plugin
+debian/extra/libtest_sql_complex-plugin
+debian/extra/libtest_sql_errors-plugin
+debian/extra/libtest_sql_lock-plugin
+debian/extra/libtest_sql_processlist-plugin
+debian/extra/libtest_sql_replication-plugin
+debian/extra/libtest_sql_shutdown-plugin
+debian/extra/libtest_sql_sqlmode-plugin
+debian/extra/libtest_sql_stored_procedures_functions-plugin
+debian/extra/libtest_sql_views_triggers-plugin
+debian/extra/libtest_x_sessions_deinit-plugin
+debian/extra/libtest_x_sessions_init-plugin
+debian/extra/locking_service-plugin
+debian/extra/mypluglib-plugin
+debian/extra/mysql_no_login-plugin
+debian/extra/mysqlx-plugin
+debian/extra/qa_auth_client-plugin
+debian/extra/qa_auth_interface-plugin
+debian/extra/qa_auth_server-plugin
+debian/extra/replication_observers_example_plugin-plugin
+debian/extra/rewriter-plugin
+debian/extra/rewrite_example-plugin
+debian/extra/semisync_master-plugin
+debian/extra/semisync_slave-plugin
+debian/extra/test_udf_services-plugin
+debian/extra/test_security_context-plugin
+debian/extra/test_services_plugin_registry-plugin
+debian/extra/validate_password-plugin
+debian/extra/version_token-plugin
+@DEB_INCLUDE_BINARIES_EXTRA@
diff --git a/mysql-wsrep-5.6/packaging/deb-in/source/lintian-overrides b/mysql-wsrep-5.6/packaging/deb-in/source/lintian-overrides
new file mode 100644 (file)
index 0000000..4797761
--- /dev/null
@@ -0,0 +1,18 @@
+# Copyright (c) 2015, 2016, 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
+
+# We provide our own versioning scheme so this warning is overridden
+mysql-@DEB_PRODUCTNAME@ source: changelog-should-mention-nmu
+mysql-@DEB_PRODUCTNAME@ source: source-nmu-has-incorrect-version-number
diff --git a/mysql-wsrep-5.6/packaging/deb-in/watch b/mysql-wsrep-5.6/packaging/deb-in/watch
new file mode 100644 (file)
index 0000000..2a2cc61
--- /dev/null
@@ -0,0 +1,2 @@
+version=3
+https://cdn.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@//mysql-([\d.]+).tar.gz
index 55fb390113b10ca6b0a1e7b25eb037b2d6fdf810..b9bd5eb21ead1b37f3f6f3f11ee65d1fec86d5d0 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2017, 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
@@ -122,6 +122,7 @@ Requires:       mysql-community-client%{?_isa} >= %{min}
 Requires:       mysql-community-common%{?_isa} = %{version}-%{release}
 %endif
 Obsoletes:      mariadb-server
+Obsoletes:      mariadb-server-utils
 Obsoletes:      mariadb-galera-server
 Obsoletes:      mariadb-server-galera
 Obsoletes:      community-mysql-server < %{version}-%{release}
index a316e29e115d8876bf9c8a24b79d4ff678cbf4c9..e46edd1418753cab3b6a4d25355fb4e0ecc9f5e5 100644 (file)
@@ -23,31 +23,37 @@ prog="mysqld"
 STARTTIMEOUT=120
 STOPTIMEOUT=60
 
+# Set in /etc/sysconfig/mysqld, will be passed to mysqld_safe
+MYSQLD_OPTS=
+
 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
 
 lockfile=/var/lock/subsys/$prog
 
 
-# extract value of a MySQL option from config files
-# Usage: get_mysql_option SECTION VARNAME DEFAULT
-# result is returned in $result
+# Extract value of a MySQL option from config files
+# Usage: get_mysql_option OPTION DEFAULT SECTION1 SECTION2 SECTIONN
+# Result is returned in $result
 # We use my_print_defaults which prints all options from multiple files,
 # with the more specific ones later; hence take the last match.
-get_mysql_option(){
-       result=$(/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1)
-       if [ -z "$result" ]; then
-           # not found, use default
-           result="$3"
-       fi
+get_mysql_option () {
+    option=$1
+    default=$2
+    shift 2
+    result=$(/usr/bin/my_print_defaults "$@" | sed -n "s/^--${option}=//p" | tail -n 1)
+    if [ -z "$result" ]; then
+       # not found, use default
+       result="${default}"
+    fi
 }
 
-get_mysql_option mysqld datadir "/var/lib/mysql"
+get_mysql_option datadir "/var/lib/mysql" mysqld
 datadir="$result"
-get_mysql_option mysqld socket "$datadir/mysql.sock"
+get_mysql_option socket "$datadir/mysql.sock" mysqld
 socketfile="$result"
-get_mysql_option mysqld_safe log-error "/var/log/mysqld.log"
+get_mysql_option log-error "/var/log/mysqld.log" mysqld mysqld_safe
 errlogfile="$result"
-get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
+get_mysql_option pid-file "/var/run/mysqld/mysqld.pid" mysqld mysqld_safe
 mypidfile="$result"
 
 case $socketfile in
@@ -110,7 +116,7 @@ start(){
        # and some users might prefer to configure logging to syslog.)
        # Note: set --basedir to prevent probes that might trigger SELinux
        # alarms, per bug #547485
-       $exec   --datadir="$datadir" --socket="$socketfile" \
+       $exec $MYSQLD_OPTS --datadir="$datadir" --socket="$socketfile" \
                --pid-file="$mypidfile" \
                --basedir=/usr --user=mysql >/dev/null &
        safe_pid=$!
index 8b7c94475f7543c1b9e1f8df7d11aa4185a12507..3e5c4e8b071de797fce8e3f194f2c111358530fe 100644 (file)
@@ -54,23 +54,23 @@ PROG=/usr/bin/mysqld_safe
 lockfile=/var/lock/subsys/mysql
 
 get_option () {
-    local section=$1
-    local option=$2
-    local default=$3
-    ret=$(/usr/bin/my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2- | tail -n 1)
-    [ -z $ret ] && ret=$default
+    local option=$1
+    local default=$2
+    shift 2
+    ret=$(/usr/bin/my_print_defaults "$@" | sed -n "s/^--${option}=//p" | tail -n 1)
+    [ -z $ret ] && ret=${default}
     echo $ret
 }
 
-datadir=$(get_option mysqld datadir "/var/lib/mysql")
-socket=$(get_option  mysqld socket "$datadir/mysql.sock")
-pidfile=$(get_option mysqld_safe pid-file "/var/run/mysql/mysqld.pid")
+datadir=$(get_option datadir "/var/lib/mysql" mysqld)
+socket=$(get_option  socket "$datadir/mysql.sock" mysqld)
+pidfile=$(get_option pid-file "/var/run/mysql/mysqld.pid" mysqld mysqld_safe)
 
 install_db () {
     # Note: something different than datadir=/var/lib/mysql requires 
     # SELinux policy changes (in enforcing mode)
-    datadir=$(get_option mysqld datadir "/var/lib/mysql")
-    logfile=$(get_option mysqld_safe log-error "/var/log/mysql/mysqld.log")
+    datadir=$(get_option datadir "/var/lib/mysql" mysqld)
+    logfile=$(get_option log-error "/var/log/mysql/mysqld.log" mysqld mysqld_safe)
 
     # Restore log, dir, perms and SELinux contexts
     if [ ! -d "$datadir" -a ! -h "$datadir" -a "x$(dirname "$datadir")" = "x/var/lib" ]; then
index 700a805546d02e47929c777c9c47978b3aaa1187..bce9ccf218e861ca443847342457b37327264daa 100644 (file)
@@ -18,5 +18,5 @@ MYSQL_ADD_PLUGIN(connection_control
                 connection_control.cc
                 security_context_wrapper.cc
                 connection_delay.cc
-                 MODULE_ONLY)
+                MODULE_ONLY)
 
index c19845bfc91f6fc26ac95b03c362dcef2e701b8b..8767e19ac39bae800a1b56fc175d7bbde4e8246a 100644 (file)
@@ -65,10 +65,10 @@ MYSQL_PLUGIN connection_control_plugin_info= 0;
   For connection event, notify Connection_event_coordinator
   which in turn will notify subscribers.
 
-  @param thd [in]            Handle to THD
-  @param event_class [in]    Event class.
+  @param [in] thd            Handle to THD
+  @param [in] event_class    Event class.
                              We are interested in MYSQL_AUDIT_CONNECTION_CLASS.
-  @param event [in]          mysql_event_connection handle
+  @param [in] event          mysql_event_connection handle
 */
 
 static void
@@ -101,7 +101,7 @@ connection_control_notify(MYSQL_THD thd,
 /**
   Plugin initialization function
 
-  @param plugin_info [in]  MYSQL_PLUGIN information
+  @param [in] plugin_info  MYSQL_PLUGIN information
 
   @returns initialization status
     @retval 0 Success
index ab2ea837a3fdb45f76946d8250966c6eb3b13f3a..5dd2995684cc50e234085c905e46819924807c85 100644 (file)
@@ -44,10 +44,10 @@ namespace connection_control
       2. Set of variables for which subscriber would like to receive update
       3. Set of stats for which subscriber would like to send update
 
-    @param subscriber [in]    Handle to Connection_event_observers
-    @param events [in]        Event mask supplied by subscriber
-    @param sys_vars [in]      opt_connection_control vector
-    @param status_vars [in]   stats_connection_control vector
+    @param [in] subscriber    Handle to Connection_event_observers
+    @param [in] events        Event mask supplied by subscriber
+    @param [in] sys_vars      opt_connection_control vector
+    @param [in] status_vars   stats_connection_control vector
 
     @returns subscription status
       @retval false Subscription successful
@@ -162,9 +162,9 @@ namespace connection_control
 
       Note : If we receive error from a subscriber, we log it and move on.
 
-      @param thd [in]               THD handle
-      @param error_handler [in]     Error handler class
-      @param connection_event [in]  Event information
+      @param [in] thd               THD handle
+      @param [in] error_handler     Error handler class
+      @param [in] connection_event  Event information
   */
 
   void
@@ -199,9 +199,9 @@ namespace connection_control
 
     Note : If we receive error from a subscriber, we log it and move on.
 
-    @param error_hanlder [in]     Error handler class
-    @param opt_connection_control Variable information
-    @param new_value [in]         New value for variable
+    @param [in] error_hanlder          Error handler class
+    @param [in] opt_connection_control Variable information
+    @param [in] new_value              New value for variable
   */
 
   void
@@ -232,9 +232,9 @@ namespace connection_control
   /**
     Update a status variable
 
-    @param observer [in]   Requestor
-    @param status_var [in] Status variable to be updated
-    @param action [in]     Operation to be performed on status variable
+    @param [in] observer   Requestor
+    @param [in] status_var Status variable to be updated
+    @param [in] action     Operation to be performed on status variable
 
     @returns status of the operation
       @retval false Success
index e7172ba3cd884d9a4b289b8323754ffb9df36c65..365812d32234b0448e71bfa8a94dc356a941b403 100644 (file)
@@ -57,11 +57,14 @@ namespace connection_control
 
   /** variables used by connection_delay.cc */
   static mysql_rwlock_t connection_event_delay_lock;
+
+#ifdef HAVE_PSI_INTERFACE
   static PSI_rwlock_key key_connection_event_delay_lock;
   static PSI_rwlock_info all_rwlocks[]=
   {
     {&key_connection_event_delay_lock, "connection_event_delay_lock", 0}
   };
+#endif /* HAVE_PSI_INTERFACE */
 
   static opt_connection_control opt_enums[]=
   {
@@ -85,7 +88,7 @@ namespace connection_control
   /**
     Helper function for Connection_delay_event::reset_all
 
-    @param ptr [in]        Pointer to an entry in hash
+    @param [in] ptr        Pointer to an entry in hash
 
     @returns 1 to indicate that entry is a match
   */
@@ -104,8 +107,8 @@ namespace connection_control
     fed to an internal calc_hash() which use the defined charset to
     calculate a hash from the key buffer (in most cases a murmur)
 
-    @param el [in]        Pointer to an element in the hash
-    @param length [out]   The length of the key belonging to the element
+    @param [in] el        Pointer to an element in the hash
+    @param [out] length   The length of the key belonging to the element
 
     @returns Pointer to key buffer
   */
@@ -141,7 +144,7 @@ namespace connection_control
   /**
     Creates or updates an entry in hash
 
-    @param s [in]    User information in '<user'@'<host>' format
+    @param [in] s    User information in '<user'@'<host>' format
 
     @returns status of insertion/update
       @retval false  Insertion/Update successful
@@ -205,7 +208,7 @@ namespace connection_control
   /**
     Resets count stored against given user entry
 
-    @param s [in]    User information in '<user'@'<host>' format
+    @param [in] s    User information in '<user'@'<host>' format
 
     @returns status of reset operation
       @retval false Reset successful
@@ -251,7 +254,7 @@ namespace connection_control
   /**
     Retrieve stored value for given user entry
 
-    @param s [in]        User information in '<user'@'<host>' format
+    @param [in] s        User information in '<user'@'<host>' format
     @param value [out]   Buffer to hold value stored against given user
 
     @returns whether given entry is present in hash or not
@@ -341,7 +344,7 @@ namespace connection_control
   /**
     Function to populate information_schema view.
 
-    @param ptr [in]  Entry from LF hash
+    @param [in] ptr  Entry from LF hash
 
     @returns status of row insertion
       @retval 0 Success
@@ -370,8 +373,8 @@ namespace connection_control
   /**
     Function to dump LF hash data to IS table.
 
-    @param thd [in]    THD handle
-    @param tables [in] Handle to
+    @param [in] thd    THD handle
+    @param [in] tables Handle to
                        information_schema.connection_control_failed_attempts
   */
 
@@ -448,8 +451,8 @@ namespace connection_control
     2. Use priv_user/priv_host if either of them is not empty. Else,
     3. Use user/host
 
-    @param thd [in]        THD pointer for getting security context
-    @param s [out]         Hash key is stored here
+    @param [in] thd        THD pointer for getting security context
+    @param [out] s         Hash key is stored here
   */
 
   void
@@ -509,8 +512,8 @@ namespace connection_control
   /**
     Wait till the wait_time expires or thread is killed
 
-    @param thd [in]        Handle to MYSQL_THD object
-    @param wait_time [in]  Maximum time to wait
+    @param [in] thd        Handle to MYSQL_THD object
+    @param [in] wait_time  Maximum time to wait
   */
 
   void
@@ -518,7 +521,6 @@ namespace connection_control
                                             ulonglong wait_time)
   {
     DBUG_ENTER("Connection_delay_action::conditional_wait");
-    const char * category= "connection_delay";
 
     /** mysql_cond_timedwait requires wait time in timespec format */
     struct timespec abstime;
@@ -532,6 +534,8 @@ namespace connection_control
 
     /** Initialize mutex required for mysql_cond_timedwait */
     mysql_mutex_t connection_delay_mutex;
+#ifdef HAVE_PSI_INTERFACE
+    const char * category= "conn_delay";
     PSI_mutex_key key_connection_delay_mutex;
     PSI_mutex_info connection_delay_mutex_info[]=
     {
@@ -539,11 +543,13 @@ namespace connection_control
     };
     int count_mutex= array_elements(connection_delay_mutex_info);
     PSI_server->register_mutex(category, connection_delay_mutex_info, count_mutex);
+#endif /* HAVE_PSI_INTERFACE */
     mysql_mutex_init(key_connection_delay_mutex, &connection_delay_mutex,
                      MY_MUTEX_INIT_FAST);
 
     /* Initialize condition to wait for */
     mysql_cond_t connection_delay_wait_condition;
+#ifdef HAVE_PSI_INTERFACE
     PSI_cond_key key_connection_delay_wait;
     PSI_cond_info connection_delay_wait_info[]=
     {
@@ -551,6 +557,7 @@ namespace connection_control
     };
     int count_cond= array_elements(connection_delay_wait_info);
     PSI_server->register_cond(category, connection_delay_wait_info, count_cond);
+#endif /* HAVE_PSI_INTERFACE */
     mysql_cond_init(key_connection_delay_wait, &connection_delay_wait_condition, NULL);
 
     /** Register wait condition with THD */
@@ -586,10 +593,10 @@ namespace connection_control
 
     We only care about CONNECT and CHANGE_USER sub events.
 
-    @param thd [in]                THD pointer
-    @param coordinator [in]        Connection_event_coordinator
-    @param connection_event [in]   Connection event to be handled
-    @param error_handler [in]      Error handler object
+    @param [in] thd                THD pointer
+    @param [in] coordinator        Connection_event_coordinator
+    @param [in] connection_event   Connection event to be handled
+    @param [in] error_handler      Error handler object
 
     @returns status of connection event handling
       @retval false  Successfully handled an event.
@@ -702,11 +709,11 @@ namespace connection_control
   /**
     Notification of a change in system variable value
 
-    @param coordinator [in]        Handle to coordinator
-    @param variable [in]           Enum of variable
-    @param new_value [in]          New value for variable
-    @param error_buffer [out]      Buffer to log error message if any
-    @param error_buffer_size [in]  Size of error buffer
+    @param [in] coordinator        Handle to coordinator
+    @param [in] variable           Enum of variable
+    @param [in] new_value          New value for variable
+    @param [out] error_buffer      Buffer to log error message if any
+    @param [in] error_buffer_size  Size of error buffer
 
     @returns processing status
       @retval false  Change in variable value processed successfully
@@ -770,7 +777,7 @@ namespace connection_control
   /**
     Subscribe with coordinator for connection events
 
-    @param coordinator [in]  Handle to Connection_event_coordinator_services
+    @param [in] coordinator  Handle to Connection_event_coordinator_services
                              for registration
   */
   void
@@ -812,9 +819,9 @@ namespace connection_control
   /**
     Get user information from "where userhost = <value>"
 
-    @param cond [in]        Equality condition structure
-    @param eq_arg [out]     Sql_string handle to store user information
-    @param field_name [in]  userhost field
+    @param [in] cond        Equality condition structure
+    @param [out] eq_arg     Sql_string handle to store user information
+    @param [in] field_name  userhost field
 
     @returns whether a value was found or not
       @retval false Found a value. Check eq_arg
@@ -860,10 +867,10 @@ namespace connection_control
 
     Permission : SUPER_ACL is required.
 
-    @param thd [in]     THD handle.
-    @param tables [in]  Handle to
+    @param [in] thd     THD handle.
+    @param [in] tables  Handle to
                         information_schema.connection_control_failed_attempts.
-    @param cond [in]    Condition if any.
+    @param [in] cond    Condition if any.
   */
 
   void
@@ -908,7 +915,7 @@ namespace connection_control
   /**
     Initializes required objects for handling connection events.
 
-    @param coordinator [in]    Connection_event_coordinator_services handle.
+    @param [in] coordinator    Connection_event_coordinator_services handle.
   */
 
   bool init_connection_delay_event(Connection_event_coordinator_services *coordinator,
@@ -917,9 +924,11 @@ namespace connection_control
     /*
       1. Initialize lock(s)
     */
+#ifdef HAVE_PSI_INTERFACE
     const char *category= "conn_control";
     int count= array_elements(all_rwlocks);
     mysql_rwlock_register(category, all_rwlocks, count);
+#endif /* HAVE_PSI_INTERFACE */
     mysql_rwlock_init(key_connection_event_delay_lock,
                       &connection_event_delay_lock);
     g_max_failed_connection_handler= new Connection_delay_action(g_variables.failed_connections_threshold,
@@ -957,10 +966,10 @@ namespace connection_control
 /**
   Function to fill information_schema.connection_control_failed_attempts.
 
-  @param thd [in]     THD handle.
-  @param tables [in]  Handle to
+  @param [in] thd     THD handle.
+  @param [in] tables  Handle to
                       information_schema.connection_control_failed_attempts.
-  @param cond [in]    Condition if any.
+  @param [in] cond    Condition if any.
 
   @returns Always returns FALSE.
 */
@@ -978,7 +987,7 @@ int fill_failed_attempts_view(THD *thd,
 /**
   View init function
 
-  @param ptr [in]    Handle to
+  @param [in] ptr    Handle to
                      information_schema.connection_control_failed_attempts.
 
   @returns Always returns 0.
index 44f1ade0931c51c7a67fa5fcd4ef1fea6c160358..3960064e70b8ef1df4efe0bf9b49b2c518dd3a72 100644 (file)
@@ -25,7 +25,7 @@ namespace connection_control
   /**
     Security_context_wrapper constructor.
 
-    @param thd [in]    Handle to THD
+    @param [in] thd    Handle to THD
 
     Get security context from thd.
   */
@@ -39,8 +39,8 @@ namespace connection_control
   /**
     Get value for given property from security context
 
-    @param property [in]    Property to be checked
-    @param value    [out]   Value of the property
+    @param [in] property    Property to be checked
+    @param [out] value      Value of the property
 
     @returns status of property check
       @retval true Error fetching property value
index 60fc3720df07111d2cb48c3048936e48af0af705..e013d6b2cd776545667ee24cf2b43287fe1f3993 100644 (file)
@@ -375,7 +375,7 @@ innodb_bk_thread(
                                /* binlog is running, make the thread
                                attach to conn_data->thd for binlog
                                committing */
-                               if (thd) {
+                               if (thd && conn_data->thd) {
                                        handler_thd_attach(
                                                conn_data->thd, NULL);
                                }
index 5fe6c538e46e4dd7614ab248c9bb8cf6fb3a6c3f..8842adfa6b7bfd9bdddba7f9d93fa91d0f8dc5d8 100644 (file)
@@ -551,6 +551,8 @@ int starordinary;           /* is a leading * an ordinary character? */
                        assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
                        assert(OP(p->strip[p->pend[i]]) == ORPAREN);
                        (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
+                        if (p->error != 0)
+                          break;        /* purecov: inspected */
                        EMIT(O_BACK, i);
                } else
                        SETERROR(MY_REG_ESUBREG);
@@ -1031,6 +1033,8 @@ int to;                           /* to this number of times (maybe RE_INFINITY) */
                AHEAD(THERE());                 /* ...so fix it */
                ASTERN(O_CH, THERETHERE());
                copy = dupl(p, start+1, finish+1);
+                if (p->error != 0)
+                  return;        /* purecov: inspected */
                assert(copy == finish+4);
                repeat(p, copy, 1, to-1);
                break;
@@ -1040,10 +1044,14 @@ int to;                         /* to this number of times (maybe RE_INFINITY) */
                break;
        case REP(N, N):                 /* as xx{m-1,n-1} */
                copy = dupl(p, start, finish);
+                if (p->error != 0)
+                  return;
                repeat(p, copy, from-1, to-1);
                break;
        case REP(N, INF):               /* as xx{n-1,INF} */
                copy = dupl(p, start, finish);
+                if (p->error != 0)
+                  return;        /* purecov: inspected */
                repeat(p, copy, from-1, to);
                break;
        default:                        /* "can't happen" */
@@ -1366,6 +1374,9 @@ sopno finish;                     /* to this less one */
        if (len == 0)
                return(ret);
        enlarge(p, p->ssize + len);     /* this many unexpected additions */
+        if (p->error != 0)
+          return(p->error);
+
        assert(p->ssize >= p->slen + len);
        (void) memcpy((char *)(p->strip + p->slen),
                (char *)(p->strip + start), (size_t)len*sizeof(sop));
@@ -1438,7 +1449,7 @@ sopno pos;
                }
        }
        {
-          int length=(HERE()-pos-1)*sizeof(sop);
+          size_t length=(HERE()-pos-1)*sizeof(sop);
           bmove_upp((uchar *) &p->strip[pos+1]+length,
                     (uchar *) &p->strip[pos]+length,
                     length);
@@ -1482,6 +1493,15 @@ register sopno size;
        if (p->ssize >= size)
                return;
 
+        DBUG_EXECUTE_IF("bug24449090_simulate_oom",
+                        {
+                          free(p->strip);
+                          p->strip= NULL;
+                          p->ssize= 0;
+                          SETERROR(MY_REG_ESPACE);
+                          return;
+                        });
+
        sp = (sop *)realloc(p->strip, size*sizeof(sop));
        if (sp == NULL) {
                SETERROR(MY_REG_ESPACE);
index 3e8ffad6600bad7fe9220ca58ae0e739dc76b510..7c84cf124a81297a82f676595f19ea320d5fe6c8 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2016, 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
@@ -33,6 +33,20 @@ set_echo_compat() {
     esac
 }
 
+validate_reply () {
+    ret=0
+    if [ -z "$1" ]; then
+       reply=y
+       return $ret
+    fi
+    case $1 in
+        y|Y|yes|Yes|YES) reply=y ;;
+        n|N|no|No|NO)    reply=n ;;
+        *) ret=1 ;;
+    esac
+    return $ret
+}
+
 prepare() {
     touch $config $command
     chmod 600 $config $command
@@ -284,15 +298,18 @@ echo "Setting the root password ensures that nobody can log into the MySQL"
 echo "root user without the proper authorisation."
 echo
 
-if [ $hadpass -eq 0 ]; then
-    echo $echo_n "Set root password? [Y/n] $echo_c"
-else
-    echo "You already have a root password set, so you can safely answer 'n'."
-    echo
-    echo $echo_n "Change the root password? [Y/n] $echo_c"
-fi
+while true ; do
+    if [ $hadpass -eq 0 ]; then
+       echo $echo_n "Set root password? [Y/n] $echo_c"
+    else
+       echo "You already have a root password set, so you can safely answer 'n'."
+       echo
+       echo $echo_n "Change the root password? [Y/n] $echo_c"
+    fi
+    read reply
+    validate_reply $reply && break
+done
 
-read reply
 if [ "$reply" = "n" ]; then
     echo " ... skipping."
 else
@@ -316,9 +333,11 @@ echo "go a bit smoother.  You should remove them before moving into a"
 echo "production environment."
 echo
 
-echo $echo_n "Remove anonymous users? [Y/n] $echo_c"
-
-read reply
+while true ; do
+    echo $echo_n "Remove anonymous users? [Y/n] $echo_c"
+    read reply
+    validate_reply $reply && break
+done
 if [ "$reply" = "n" ]; then
     echo " ... skipping."
 else
@@ -334,9 +353,11 @@ echo
 echo "Normally, root should only be allowed to connect from 'localhost'.  This"
 echo "ensures that someone cannot guess at the root password from the network."
 echo
-
-echo $echo_n "Disallow root login remotely? [Y/n] $echo_c"
-read reply
+while true ; do
+    echo $echo_n "Disallow root login remotely? [Y/n] $echo_c"
+    read reply
+    validate_reply $reply && break
+done
 if [ "$reply" = "n" ]; then
     echo " ... skipping."
 else
@@ -354,8 +375,12 @@ echo "access.  This is also intended only for testing, and should be removed"
 echo "before moving into a production environment."
 echo
 
-echo $echo_n "Remove test database and access to it? [Y/n] $echo_c"
-read reply
+while true ; do
+    echo $echo_n "Remove test database and access to it? [Y/n] $echo_c"
+    read reply
+    validate_reply $reply && break
+done
+
 if [ "$reply" = "n" ]; then
     echo " ... skipping."
 else
@@ -372,8 +397,12 @@ echo "Reloading the privilege tables will ensure that all changes made so far"
 echo "will take effect immediately."
 echo
 
-echo $echo_n "Reload privilege tables now? [Y/n] $echo_c"
-read reply
+while true ; do
+    echo $echo_n "Reload privilege tables now? [Y/n] $echo_c"
+    read reply
+    validate_reply $reply && break
+done
+
 if [ "$reply" = "n" ]; then
     echo " ... skipping."
 else
index eb408b34d9d3861d276d754fa1ab033a82cbf2bf..c6b4f8d598bc0a66a6e8c231af5bdf9767936f9f 100644 (file)
@@ -65,9 +65,12 @@ esac
 usage () {
         cat <<EOF
 Usage: $0 [OPTIONS]
+ The following options may be given as the first argument:
   --no-defaults              Don't read the system defaults file
   --defaults-file=FILE       Use the specified defaults file
   --defaults-extra-file=FILE Also use defaults from the specified file
+
+ Other options:
   --ledir=DIRECTORY          Look for mysqld in the specified directory
   --open-files-limit=LIMIT   Limit the number of open files
   --core-file-size=LIMIT     Limit core files to the specified size
@@ -278,7 +281,12 @@ parse_arguments() {
     case "$arg" in
       # these get passed explicitly to mysqld
       --basedir=*) MY_BASEDIR_VERSION="$val" ;;
-      --datadir=*) DATADIR="$val" ;;
+      --datadir=*)
+        case $val in
+          /) DATADIR=$val ;;
+          *) DATADIR="`echo $val | sed 's;/*$;;'`" ;;
+        esac
+        ;;
       --pid-file=*) pid_file="$val" ;;
       --plugin-dir=*) PLUGIN_DIR="$val" ;;
       --user=*) user="$val"; SET_USER=1 ;;
@@ -466,63 +474,70 @@ set_malloc_lib() {
   add_mysqld_ld_preload "$malloc_lib"
 }
 
+find_basedir_from_cmdline () {
+  for arg in "$@"; do
+    case $arg in
+      --basedir=*)
+        MY_BASEDIR_VERSION="`echo "$arg" | sed -e 's;^--[^=]*=;;'`"
+        # Convert to full path
+        cd "$MY_BASEDIR_VERSION"
+        if [ $? -ne 0 ] ; then
+          log_error "--basedir set to '$MY_BASEDIR_VERSION', however could not access directory"
+          exit 1
+        fi
+        MY_BASEDIR_VERSION="`pwd`"
+        ;;
+    esac
+  done
+}
 
 #
 # First, try to find BASEDIR and ledir (where mysqld is)
 #
 
-if echo '@pkgdatadir@' | grep '^@prefix@' > /dev/null
-then
-  relpkgdata=`echo '@pkgdatadir@' | sed -e 's,^@prefix@,,' -e 's,^/,,' -e 's,^,./,'`
+oldpwd="`pwd`"
+
+# Args not parsed yet, check if --basedir was given on command line
+find_basedir_from_cmdline "$@"
+
+# --basedir is already overridden on command line
+if test -n "$MY_BASEDIR_VERSION" -a -d "$MY_BASEDIR_VERSION" ; then
+  # Search for mysqld and set ledir
+  for dir in @INSTALL_SBINDIR@ libexec sbin bin ; do
+    if test -x "$MY_BASEDIR_VERSION/$dir/mysqld" ; then
+      ledir="$MY_BASEDIR_VERSION/$dir"
+      break
+    fi
+  done
+
 else
-  # pkgdatadir is not relative to prefix
-  relpkgdata='@pkgdatadir@'
-fi
+  # Basedir should be parent dir of bindir, unless some non-standard
+  # layout is used
 
-case "$0" in
-  /*)
-  MY_PWD='@prefix@'
-  ;;
-  *)
-  MY_PWD=`dirname $0`
-  MY_PWD=`dirname $MY_PWD`
-  ;;
-esac
-# Check for the directories we would expect from a binary release install
-if test -n "$MY_BASEDIR_VERSION" -a -d "$MY_BASEDIR_VERSION"
-then
-  # BASEDIR is already overridden on command line.  Do not re-set.
+  cd "`dirname $0`"
+  if [ -h "$0" ] ; then
+    realpath="`ls -l  "$0" | awk '{print $NF}'`"
+    cd "`dirname "$realpath"`"
+  fi
+  cd ..
+  MY_PWD="`pwd`"
+
+  # Search for mysqld and set ledir and BASEDIR
+  for dir in @INSTALL_SBINDIR@ libexec sbin bin ; do
+    if test -x "$MY_PWD/$dir/mysqld" ; then
+      MY_BASEDIR_VERSION="$MY_PWD"
+      ledir="$MY_BASEDIR_VERSION/$dir"
+      break
+    fi
+  done
 
-  # Use BASEDIR to discover le.
-  if test -x "$MY_BASEDIR_VERSION/libexec/mysqld"
-  then
-    ledir="$MY_BASEDIR_VERSION/libexec"
-  elif test -x "$MY_BASEDIR_VERSION/sbin/mysqld"
-  then
-    ledir="$MY_BASEDIR_VERSION/sbin"
-  else
-    ledir="$MY_BASEDIR_VERSION/bin"
+  # If we still didn't find anything, use the compiled-in defaults
+  if test -z "$MY_BASEDIR_VERSION" ; then
+    MY_BASEDIR_VERSION='@prefix@'
+    ledir='@libexecdir@'
   fi
-elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/bin/mysqld"
-then
-  MY_BASEDIR_VERSION="$MY_PWD"         # Where bin, share and data are
-  ledir="$MY_PWD/bin"                  # Where mysqld is
-# Check for the directories we would expect from a source install
-elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/libexec/mysqld"
-then
-  MY_BASEDIR_VERSION="$MY_PWD"         # Where libexec, share and var are
-  ledir="$MY_PWD/libexec"              # Where mysqld is
-elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/sbin/mysqld"
-then
-  MY_BASEDIR_VERSION="$MY_PWD"         # Where sbin, share and var are
-  ledir="$MY_PWD/sbin"                 # Where mysqld is
-# Since we didn't find anything, used the compiled-in defaults
-else
-  MY_BASEDIR_VERSION='@prefix@'
-  ledir='@libexecdir@'
 fi
 
-
 #
 # Second, try to find the data directory
 #
@@ -535,10 +550,6 @@ then
   then
     defaults="--defaults-extra-file=$DATADIR/my.cnf"
   fi
-# Next try where the source installs put it
-elif test -d $MY_BASEDIR_VERSION/var/mysql
-then
-  DATADIR=$MY_BASEDIR_VERSION/var
 # Or just give up and use our compiled-in default
 else
   DATADIR=@localstatedir@
@@ -569,21 +580,10 @@ export MYSQL_HOME
 
 # Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe]
 # and then merge with the command line arguments
-if test -x "$MY_BASEDIR_VERSION/bin/my_print_defaults"
-then
+if test -x "$MY_BASEDIR_VERSION/bin/my_print_defaults" ; then
   print_defaults="$MY_BASEDIR_VERSION/bin/my_print_defaults"
-elif test -x `dirname $0`/my_print_defaults
-then
-  print_defaults="`dirname $0`/my_print_defaults"
-elif test -x ./bin/my_print_defaults
-then
-  print_defaults="./bin/my_print_defaults"
-elif test -x @bindir@/my_print_defaults
-then
+elif test -x "@bindir@/my_print_defaults" ; then
   print_defaults="@bindir@/my_print_defaults"
-elif test -x @bindir@/mysql_print_defaults
-then
-  print_defaults="@bindir@/mysql_print_defaults"
 else
   print_defaults="my_print_defaults"
 fi
@@ -594,6 +594,8 @@ append_arg_to_args () {
 
 args=
 
+cd "$oldpwd"
+
 SET_USER=2
 parse_arguments `$print_defaults $defaults --loose-verbose mysqld server`
 if test $SET_USER -eq 2
@@ -691,7 +693,7 @@ fi
 logdir=`dirname "$err_log"`
 # Change the err log to the right user, if possible and it is in use
 if [ $logging = "file" -o $logging = "both" ]; then
-  if [ ! -f "$err_log" -a ! -h "$err_log" ]; then
+  if [ ! -e "$err_log" -a ! -h "$err_log" ]; then
     if test -w / -o "$USER" = "root"; then
       case $logdir in
         /var/log)
@@ -711,7 +713,7 @@ if [ $logging = "file" -o $logging = "both" ]; then
     fi
   fi
 
-  if [ -f "$err_log" ]; then        # Log to err_log file
+  if [ -f "$err_log" -o -p "$err_log" ]; then        # Log to err_log file
     log_notice "Logging to '$err_log'."
   elif [ "x$user" = "xroot" ]; then # running as root, mysqld can create log file; continue
     echo "Logging to '$err_log'." >&2
@@ -868,14 +870,23 @@ then
   fi
   if [ ! -h "$pid_file" ]; then
       rm -f "$pid_file"
+      if test -f "$pid_file"; then
+        log_error "Fatal error: Can't remove the pid file:
+$pid_file.
+Please remove the file manually and start $0 again;
+mysqld daemon not started"
+        exit 1
+      fi
   fi
-  if test -f "$pid_file"
-  then
-    log_error "Fatal error: Can't remove the pid file:
-$pid_file
-Please remove it manually and start $0 again;
+  if [ ! -h "$safe_mysql_unix_port" ]; then
+      rm -f "$safe_mysql_unix_port"
+      if test -f "$safe_mysql_unix_port"; then
+        log_error "Fatal error: Can't remove the socket file:
+$safe_mysql_unix_port.
+Please remove the file manually and start $0 again;
 mysqld daemon not started"
-    exit 1
+        exit 1
+      fi
   fi
 fi
 
@@ -923,14 +934,6 @@ max_wsrep_restarts=0
 
 while true
 do
-  # Some extra safety
-  if [ ! -h "$safe_mysql_unix_port" ]; then
-    rm -f "$safe_mysql_unix_port"
-  fi
-  if [ ! -h "$pid_file" ]; then
-    rm -f "$pid_file"
-  fi
-
   start_time=`date +%M%S`
 
   # this sets wsrep_start_position_opt
@@ -978,6 +981,13 @@ do
   if test ! -f "$pid_file"             # This is removed if normal shutdown
   then
     break
+  else                                  # self's mysqld crashed or other's mysqld running
+    PID=`cat "$pid_file"`
+    if @CHECK_PID@
+    then                                # true when above pid belongs to a running mysqld process
+      log_error "A mysqld process with pid=$PID is already running. Aborting!!"
+      exit 1
+    fi
   fi
 
 
@@ -1036,6 +1046,13 @@ do
     done
   fi
 
+  if [ ! -h "$pid_file" ]; then
+    rm -f "$pid_file"
+  fi
+  if [ ! -h "$safe_mysql_unix_port" ]; then
+   rm -f "$safe_mysql_unix_port"
+  fi
+
   if [ -n "$wsrep_restart" ]
   then
     if [ $wsrep_restart -le $max_wsrep_restarts ]
index ffedc049e95394988aac5ed6d3e6e7202b4f198d..28a82c873481a7e61e4c44943b747461f11953f0 100644 (file)
@@ -1,6 +1,6 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2017, 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 Library General Public
index cd3c2e0292d31b86d818f560a75ff684c3178650..425938b6562f731466297dc26d468400e4c839dd 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2003, 2017, 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
@@ -1038,6 +1038,7 @@ static const char *default_options[]=
   "multi-results", "multi-statements", "multi-queries", "secure-auth",
   "report-data-truncation", "plugin-dir", "default-auth",
   "bind-address", "ssl-crl", "ssl-crlpath", "enable-cleartext-plugin",
+  "ssl-mode",
   NullS
 };
 enum option_id {
@@ -1050,6 +1051,7 @@ enum option_id {
   OPT_multi_results, OPT_multi_statements, OPT_multi_queries, OPT_secure_auth, 
   OPT_report_data_truncation, OPT_plugin_dir, OPT_default_auth,
   OPT_bind_address, OPT_ssl_crl, OPT_ssl_crlpath, OPT_enable_cleartext_plugin,
+  OPT_ssl_mode,
   OPT_keep_this_one_last
 };
 
@@ -1269,6 +1271,19 @@ void mysql_read_default_options(struct st_mysql_options *options,
        case OPT_ssl_crlpath:
           EXTENSION_SET_SSL_STRING(options, ssl_crlpath, opt_arg);
           break;
+        case OPT_ssl_mode:
+          if (opt_arg &&
+              !my_strcasecmp(&my_charset_latin1, opt_arg, "required"))
+          {
+            ENSURE_EXTENSIONS_PRESENT(options);
+            options->extension->ssl_mode= SSL_MODE_REQUIRED;
+          }
+          else
+          {
+            fprintf(stderr, "Unknown option to ssl-mode: %s\n", opt_arg);
+            exit(1);
+          }
+          break;
 #else
        case OPT_ssl_key:
        case OPT_ssl_cert:
@@ -1277,6 +1292,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
         case OPT_ssl_cipher:
         case OPT_ssl_crl:
         case OPT_ssl_crlpath:
+        case OPT_ssl_mode:
          break;
 #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
        case OPT_character_sets_dir:
@@ -1798,6 +1814,7 @@ mysql_ssl_free(MYSQL *mysql MY_ATTRIBUTE((unused)))
   {
     mysql->options.extension->ssl_crl = 0;
     mysql->options.extension->ssl_crlpath = 0;
+    mysql->options.extension->ssl_mode= 0;
   }
   mysql->options.use_ssl = FALSE;
   mysql->connector_fd = 0;
@@ -2693,6 +2710,31 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
     end= buff+5;
   }
 #ifdef HAVE_OPENSSL
+  /*
+    If SSL connection is required we'll:
+      1. check if the server supports SSL;
+      2. check if the client is properly configured;
+      3. try to use SSL no matter the other options given.
+  */
+  if (mysql->options.extension &&
+      mysql->options.extension->ssl_mode == SSL_MODE_REQUIRED)
+  {
+    if (!(mysql->server_capabilities & CLIENT_SSL))
+    {
+      set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate,
+                               ER(CR_SSL_CONNECTION_ERROR),
+                               "Server doesn't support SSL");
+      goto error;
+    }
+    if (!mysql->options.use_ssl)
+    {
+      set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate,
+                               ER(CR_SSL_CONNECTION_ERROR),
+                               "Client is not configured to use SSL");
+      goto error;
+    }
+    mysql->client_flag|= CLIENT_SSL;
+  }
   if (mysql->client_flag & CLIENT_SSL)
   {
     /* Do the SSL layering. */
@@ -4585,6 +4627,13 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
     else
       mysql->options.client_flag&= ~CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS;
     break;
+  case MYSQL_OPT_SSL_MODE:
+    if (*(uint *) arg == SSL_MODE_REQUIRED)
+    {
+      ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+      mysql->options.extension->ssl_mode= SSL_MODE_REQUIRED;
+    }
+    break;
 
   default:
     DBUG_RETURN(1);
index 2b06f8501662cd4c634a507a45a9302083e25f22..268558f4eaa626ed30796be1f3c1c5251aea1aad 100644 (file)
@@ -10615,3 +10615,10 @@ Field_temporal::set_datetime_warning(Sql_condition::enum_warning_level level,
       set_warning(level, code, cut_increment))
     make_truncated_value_warning(thd, level, val, ts_type, field_name);
 }
+
+bool Field::is_part_of_actual_key(THD *thd, uint cur_index)
+{
+  return thd->optimizer_switch_flag(OPTIMIZER_SWITCH_USE_INDEX_EXTENSIONS) ?
+    part_of_key.is_set(cur_index) :
+    part_of_key_not_extended.is_set(cur_index);
+}
index eb3e3691956e7183f1b5d32746cdd49b38e34600..e5f82aba7640f7fd37423711a4a7810c22e0a769 100644 (file)
@@ -501,8 +501,13 @@ public:
   /* Field is part of the following keys */
   key_map key_start;                /* Keys that starts with this field */
   key_map part_of_key;              /* All keys that includes this field */
-  key_map part_of_key_not_clustered;/* ^ but only for non-clustered keys */
   key_map part_of_sortkey;          /* ^ but only keys usable for sorting */
+  /**
+    All keys that include this field, but not extended by the storage engine to
+    include primary key columns.
+  */
+  key_map part_of_key_not_extended;
+
   /* 
     We use three additional unireg types for TIMESTAMP to overcome limitation 
     of current binary format of .frm file. We'd like to be able to support 
@@ -1247,6 +1252,19 @@ public:
 */
   virtual bool is_updatable() const { return FALSE; }
 
+  /**
+    Check whether field is part of the index taking the index extensions flag
+    into account.
+
+    @param[in]     thd             THD object
+    @param[in]     cur_index       Index of the key
+
+    @retval true  Field is part of the key
+    @retval false otherwise
+
+  */
+  bool is_part_of_actual_key(THD *thd, uint cur_index);
+
   friend int cre_myisam(char * name, register TABLE *form, uint options,
                        ulonglong auto_increment_value);
   friend class Copy_field;
index ecb2a35f8f4cc72a12bd0035df0ed460fa336d29..36dfc275cf64fa9fe6ec0fa2232723b4d98f53da 100644 (file)
@@ -6943,6 +6943,60 @@ int handler::compare_key_icp(const key_range *range) const
   return cmp;
 }
 
+/**
+   Change the offsets of all the fields in a key range.
+
+   @param range   the key range
+   @param key_part the first key part
+   @param diff    how much to change the offsets with
+*/
+static inline void
+move_key_field_offsets(const key_range *range, const KEY_PART_INFO *key_part,
+                       my_ptrdiff_t diff)
+{
+  for (size_t len= 0; len < range->length;
+       len+= key_part->store_length, ++key_part)
+    key_part->field->move_field_offset(diff);
+}
+
+/**
+  Check if the key in the given buffer (which is not necessarily
+  TABLE::record[0]) is within range. Called by the storage engine to
+  avoid reading too many rows.
+
+  @param buf  the buffer that holds the key
+  @retval -1 if the key is within the range
+  @retval  0 if the key is equal to the end_range key, and
+             key_compare_result_on_equal is 0
+  @retval  1 if the key is outside the range
+*/
+int handler::compare_key_in_buffer(const uchar *buf) const
+{
+  DBUG_ASSERT(end_range != NULL);
+
+  /*
+    End range on descending scans is only checked with ICP for now, and then we
+    check it with compare_key_icp() instead of this function.
+  */
+  DBUG_ASSERT(range_scan_direction == RANGE_SCAN_ASC);
+
+  // Make the fields in the key point into the buffer instead of record[0].
+  const my_ptrdiff_t diff= buf - table->record[0];
+  if (diff != 0)
+    move_key_field_offsets(end_range, range_key_part, diff);
+
+   // Compare the key in buf against end_range.
+   int cmp= key_cmp(range_key_part, end_range->key, end_range->length);
+   if (cmp == 0)
+     cmp= key_compare_result_on_equal;
+
+   // Reset the field offsets.
+   if (diff != 0)
+     move_key_field_offsets(end_range, range_key_part, -diff);
+
+   return cmp;
+}
+
 int handler::index_read_idx_map(uchar * buf, uint index, const uchar * key,
                                 key_part_map keypart_map,
                                 enum ha_rkey_function find_flag)
index 484774d72fc65f8c61d3ae8cbccfdd8a9bc179e3..d000ab2f6ee39c2c4842ebcb126e0fa3bdfb959e 100644 (file)
@@ -34,6 +34,7 @@
 #include <my_compare.h>
 #include <ft_global.h>
 #include <keycache.h>
+#include "xa.h"
 
 class Alter_info;
 
@@ -496,13 +497,6 @@ struct st_system_tablename
 };
 
 
-typedef ulonglong my_xid; // this line is the same as in log_event.h
-#define MYSQL_XID_PREFIX "MySQLXid"
-#define MYSQL_XID_PREFIX_LEN 8 // must be a multiple of 8
-#define MYSQL_XID_OFFSET (MYSQL_XID_PREFIX_LEN+sizeof(server_id))
-#define MYSQL_XID_GTRID_LEN (MYSQL_XID_OFFSET+sizeof(my_xid))
-
-#define XIDDATASIZE MYSQL_XIDDATASIZE
 #define MAXGTRIDSIZE 64
 #define MAXBQUALSIZE 64
 
@@ -513,78 +507,6 @@ namespace AQP {
   class Join_plan;
 };
 
-/**
-  struct xid_t is binary compatible with the XID structure as
-  in the X/Open CAE Specification, Distributed Transaction Processing:
-  The XA Specification, X/Open Company Ltd., 1991.
-  http://www.opengroup.org/bookstore/catalog/c193.htm
-
-  @see MYSQL_XID in mysql/plugin.h
-*/
-struct xid_t {
-  long formatID;
-  long gtrid_length;
-  long bqual_length;
-  char data[XIDDATASIZE];  // not \0-terminated !
-
-  xid_t() {}                                /* Remove gcc warning */  
-  bool eq(struct xid_t *xid)
-  { return eq(xid->gtrid_length, xid->bqual_length, xid->data); }
-  bool eq(long g, long b, const char *d)
-  { return g == gtrid_length && b == bqual_length && !memcmp(d, data, g+b); }
-  void set(struct xid_t *xid)
-  { memcpy(this, xid, xid->length()); }
-  void set(long f, const char *g, long gl, const char *b, long bl)
-  {
-    formatID= f;
-    memcpy(data, g, gtrid_length= gl);
-    memcpy(data+gl, b, bqual_length= bl);
-  }
-  void set(ulonglong xid)
-  {
-    my_xid tmp;
-    formatID= 1;
-    set(MYSQL_XID_PREFIX_LEN, 0, MYSQL_XID_PREFIX);
-    memcpy(data+MYSQL_XID_PREFIX_LEN, &server_id, sizeof(server_id));
-    tmp= xid;
-    memcpy(data+MYSQL_XID_OFFSET, &tmp, sizeof(tmp));
-    gtrid_length=MYSQL_XID_GTRID_LEN;
-  }
-  void set(long g, long b, const char *d)
-  {
-    formatID= 1;
-    gtrid_length= g;
-    bqual_length= b;
-    memcpy(data, d, g+b);
-  }
-  bool is_null() { return formatID == -1; }
-  void null() { formatID= -1; }
-  my_xid quick_get_my_xid()
-  {
-    my_xid tmp;
-    memcpy(&tmp, data+MYSQL_XID_OFFSET, sizeof(tmp));
-    return tmp;
-  }
-  my_xid get_my_xid()
-  {
-    return gtrid_length == MYSQL_XID_GTRID_LEN && bqual_length == 0 &&
-           !memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ?
-           quick_get_my_xid() : 0;
-  }
-  uint length()
-  {
-    return sizeof(formatID)+sizeof(gtrid_length)+sizeof(bqual_length)+
-           gtrid_length+bqual_length;
-  }
-  uchar *key()
-  {
-    return (uchar *)&gtrid_length;
-  }
-  uint key_length()
-  {
-    return sizeof(gtrid_length)+sizeof(bqual_length)+gtrid_length+bqual_length;
-  }
-};
 typedef struct xid_t XID;
 
 /* for recover() handlerton call */
@@ -2308,6 +2230,7 @@ public:
                      enum_range_scan_direction direction);
   int compare_key(key_range *range);
   int compare_key_icp(const key_range *range) const;
+  int compare_key_in_buffer(const uchar *buf) const;
   virtual int ft_init() { return HA_ERR_WRONG_COMMAND; }
   void ft_end() { ft_handler=NULL; }
   virtual FT_INFO *ft_init_ext(uint flags, uint inx,String *key)
index 6468342cd030434b13f1c6b3041c51eb355c4e50..a75097e305cec9d9322cf1cbcb338e92faf46113 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2000, 2017, 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
@@ -3556,12 +3556,11 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
 
   value.time= *tm;
   value.time.time_type= time_type;
+  decimals= tm->second_part ? DATETIME_MAX_DECIMALS : 0;
 
   if (check_datetime_range(&value.time))
   {
-    make_truncated_value_warning(ErrConvString(&value.time,
-                                               MY_MIN(decimals,
-                                                      DATETIME_MAX_DECIMALS)),
+    make_truncated_value_warning(ErrConvString(&value.time, decimals),
                                  time_type);
     set_zero_time(&value.time, MYSQL_TIMESTAMP_ERROR);
   }
@@ -3569,7 +3568,6 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
   state= TIME_VALUE;
   maybe_null= 0;
   max_length= max_length_arg;
-  decimals= 0;
   DBUG_VOID_RETURN;
 }
 
index 5fb940c1db5d6ead1458b03975fc73c7446942f3..fee2d692f78c51d3aebbff5d906897e3a5313515 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, 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
@@ -4084,7 +4084,24 @@ longlong Item_master_pos_wait::val_int()
   }
 #ifdef HAVE_REPLICATION
   longlong pos = (ulong)args[1]->val_int();
-  longlong timeout = (arg_count==3) ? args[2]->val_int() : 0 ;
+  double timeout = (arg_count == 3) ? args[2]->val_real() : 0;
+  if (timeout < 0)
+  {
+    if (thd->is_strict_mode())
+    {
+      my_error(ER_WRONG_ARGUMENTS, MYF(0), "MASTER_POS_WAIT.");
+    }
+    else
+    {
+      push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+                          ER_WRONG_ARGUMENTS,
+                          ER(ER_WRONG_ARGUMENTS),
+                          "MASTER_POS_WAIT.");
+      null_value= 1;
+    }
+    return 0;
+  }
+
   if (active_mi == NULL ||
       (event_count = active_mi->rli->wait_for_pos(thd, log_name, pos, timeout)) == -2)
   {
@@ -4110,7 +4127,24 @@ longlong Item_master_gtid_set_wait::val_int()
   }
 
 #if defined(HAVE_REPLICATION)
-  longlong timeout = (arg_count== 2) ? args[1]->val_int() : 0;
+  double timeout = (arg_count == 2) ? args[1]->val_real() : 0;
+  if (timeout < 0)
+  {
+    if (thd->is_strict_mode())
+    {
+      my_error(ER_WRONG_ARGUMENTS, MYF(0), "WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS.");
+    }
+    else
+    {
+      push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+                          ER_WRONG_ARGUMENTS,
+                          ER(ER_WRONG_ARGUMENTS),
+                          "WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS.");
+      null_value= 1;
+    }
+    return 0;
+  }
+
   if (active_mi && active_mi->rli)
   {
     if ((event_count = active_mi->rli->wait_for_gtid_set(thd, gtid, timeout))
index 1f2499667fbb33e2dfd2970ce053d6da211db06e..3c118195842f72cc81a34a503bfcbaaba7b96cf5 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2000, 2017, 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
@@ -4346,6 +4346,17 @@ String *Item_func_quote::val_str(String *str)
   *to= '\'';
 
 ret:
+  if (new_length > current_thd->variables.max_allowed_packet)
+  {
+    push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+                        ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+                        ER_THD(current_thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+                        func_name(),
+                        current_thd->variables.max_allowed_packet);
+    null_value= true;
+    return NULL;
+  }
+
   tmp_value.length(new_length);
   tmp_value.set_charset(collation.collation);
   null_value= 0;
index a1998e96d06f4e366e7ff59ed9ab8aba52fb13d3..073efc6b40731f5c8b710d65fdf571157fdde7b0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights
+/* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights
    reserved.
 
    This program is free software; you can redistribute it and/or modify
@@ -3565,6 +3565,7 @@ bool subselect_hash_sj_engine::setup(List<Item> *tmp_columns)
     free_tmp_table(thd, tmp_table);
     delete result;
     result= NULL;
+    thd->raise_error_printf(ER_INTERNAL_ERROR, "Failed to create MyISAM temporary table for query processing, key too large");
     DBUG_RETURN(TRUE);
   }
   result= tmp_result_sink;
@@ -3723,12 +3724,15 @@ void subselect_hash_sj_engine::cleanup()
 {
   DBUG_ENTER("subselect_hash_sj_engine::cleanup");
   is_materialized= false;
-  result->cleanup(); /* Resets the temp table as well. */
+
+  if (result)
+    result->cleanup(); /* Resets the temp table as well. */
   THD * const thd= item->unit->thd;
   DEBUG_SYNC(thd, "before_index_end_in_subselect");
-  if (tab->table->file->inited)
+  if (tab && tab->table->file->inited)
     tab->table->file->ha_index_end();  // Close the scan over the index
-  free_tmp_table(thd, tab->table);
+  if (tab)
+    free_tmp_table(thd, tab->table);
   tab= NULL;
   materialize_engine->cleanup();
   DBUG_VOID_RETURN;
index 7583e87838deeca4d295ad47cc2b3875c26d51a1..5de871dd9e0c732e9faa9bb5924554b1ed8c7668 100644 (file)
@@ -2724,9 +2724,9 @@ int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len)
 
   node.parent= data->parent; // Set parent for the new node to old parent
   data->parent= numnodes;    // Remember current node as new parent
-  DBUG_ASSERT(data->level <= MAX_LEVEL);
+  DBUG_ASSERT(data->level < MAX_LEVEL);
   data->pos[data->level]= numnodes;
-  if (data->level < MAX_LEVEL)
+  if (data->level < MAX_LEVEL - 1)
     node.level= data->level++;
   else
     return MY_XML_ERROR;
index b0158efaa1d895a7b3362f8bbf391d02fb858c94..7b6f7b50946acf33e21d3ad4573f347a6b3b5676 100644 (file)
@@ -6971,9 +6971,12 @@ int Rotate_log_event::do_update_pos(Relay_log_info *rli)
                         (ulong) rli->get_group_master_log_pos()));
     mysql_mutex_unlock(&rli->data_lock);
     if (rli->is_parallel_exec())
+    {
+      bool real_event= server_id && !is_artificial_event();
       rli->reset_notified_checkpoint(0,
-                                     server_id ? when.tv_sec + (time_t) exec_time : 0,
+                                     real_event ? when.tv_sec + (time_t) exec_time : 0,
                                      true/*need_data_lock=true*/);
+    }
 
     /*
       Reset thd->variables.option_bits and sql_mode etc, because this could be the signal of
index bfa9028664ec4c480bb11b2196097102ec13ee45..4824933f2e8530944e80f48dab15a48f7705a130 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights
    reserved.
 
    This program is free software; you can redistribute it and/or modify
 
 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
 #include "../storage/perfschema/pfs_server.h"
+#else
+#include "lf.h"
+int dummy_variable_to_pull_in_lf_hash_functions= LF_HASH_OVERHEAD;
 #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
+
 #include <mysql/psi/mysql_idle.h>
 #include <mysql/psi/mysql_socket.h>
 #include <mysql/psi/mysql_statement.h>
index 9f4ecbe2ed77ead6cfd1ec2761d821702d9a73ff..87248f97830521188d3236237cc874e89e238044 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights
  * reserved.
 
    This program is free software; you can redistribute it and/or modify
@@ -11619,7 +11619,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
           part of 'cur_index'
         */
         if (bitmap_is_set(table->read_set, cur_field->field_index) &&
-            !cur_field->part_of_key_not_clustered.is_set(cur_index))
+            !cur_field->is_part_of_actual_key(thd, cur_index))
         {
           cause= "not_covering";
           goto next_index;                  // Field was not part of key
@@ -11819,7 +11819,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
         key_part_range[1]= last_part;
 
         /* Check if cur_part is referenced in the WHERE clause. */
-        if (join->conds->walk(&Item::find_item_in_field_list_processor, 0,
+        if (join->conds->walk(&Item::find_item_in_field_list_processor, 1,
                               (uchar*) key_part_range))
         {
           cause= "keypart_reference_from_where_clause";
index 08593b8f087ddeccd9b4b5a7e39af768e34b3ff4..ca394645043bda329f83071becd3d069fb453d28 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2006, 2017, 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
@@ -222,7 +222,8 @@ void Relay_log_info::reset_notified_relay_log_change()
    @param shift          number of bits to shift by Worker due to the
                          current checkpoint change.
    @param new_ts         new seconds_behind_master timestamp value
-                         unless zero. Zero could be due to FD event.
+                         unless zero. Zero could be due to FD event
+                         or fake rotate event.
    @param need_data_lock False if caller has locked @c data_lock
 */
 void Relay_log_info::reset_notified_checkpoint(ulong shift, time_t new_ts,
@@ -628,7 +629,7 @@ err:
   @param[in]  log_name        log name to wait for,
   @param[in]  log_pos         position to wait for,
   @param[in]  timeout         @c timeout in seconds before giving up waiting.
-                              @c timeout is longlong whereas it should be ulong; but this is
+                              @c timeout is double whereas it should be ulong; but this is
                               to catch if the user submitted a negative timeout.
 
   @retval  -2   improper arguments (log_pos<0)
@@ -642,7 +643,7 @@ err:
 
 int Relay_log_info::wait_for_pos(THD* thd, String* log_name,
                                     longlong log_pos,
-                                    longlong timeout)
+                                    double timeout)
 {
   int event_count = 0;
   ulong init_abort_pos_wait;
@@ -657,7 +658,7 @@ int Relay_log_info::wait_for_pos(THD* thd, String* log_name,
   DBUG_PRINT("enter",("log_name: '%s'  log_pos: %lu  timeout: %lu",
                       log_name->c_ptr_safe(), (ulong) log_pos, (ulong) timeout));
 
-  set_timespec(abstime,timeout);
+  set_timespec_nsec(abstime, (ulonglong) timeout * 1000000000ULL);
   mysql_mutex_lock(&data_lock);
   thd->ENTER_COND(&data_cond, &data_lock,
                   &stage_waiting_for_the_slave_thread_to_advance_position,
@@ -837,7 +838,7 @@ improper_arguments: %d  timed_out: %d",
   /Alfranio
 */
 int Relay_log_info::wait_for_gtid_set(THD* thd, String* gtid,
-                                      longlong timeout)
+                                      double timeout)
 {
   int event_count = 0;
   ulong init_abort_pos_wait;
@@ -849,10 +850,10 @@ int Relay_log_info::wait_for_gtid_set(THD* thd, String* gtid,
   if (!inited)
     DBUG_RETURN(-2);
 
-  DBUG_PRINT("info", ("Waiting for %s timeout %lld", gtid->c_ptr_safe(),
+  DBUG_PRINT("info", ("Waiting for %s timeout %f", gtid->c_ptr_safe(),
              timeout));
 
-  set_timespec(abstime, timeout);
+  set_timespec_nsec(abstime, (ulonglong) timeout * 1000000000ULL);
   mysql_mutex_lock(&data_lock);
   thd->ENTER_COND(&data_cond, &data_lock,
                   &stage_waiting_for_the_slave_thread_to_advance_position,
index 678d30e2e81e72de1bf6480f8fe64e7613fdf793..c9d435b1014bdda4b91dff9d8ee3abecc414b74e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2005, 2017, 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
@@ -413,8 +413,8 @@ public:
                               bool need_data_lock);
 
   int wait_for_pos(THD* thd, String* log_name, longlong log_pos, 
-                  longlong timeout);
-  int wait_for_gtid_set(THD* thd, String* gtid, longlong timeout);
+                  double timeout);
+  int wait_for_gtid_set(THD* thd, String* gtid, double timeout);
   void close_temporary_tables();
 
   /* Check if UNTIL condition is satisfied. See slave.cc for more. */
index 97a72f9329fb9df29ee5f4d4f11b90b3dabb8e35..207bab03bd31ea66a852c9132830ea5605719adc 100644 (file)
@@ -4556,6 +4556,16 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
                         DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act)));
                       }
                     };);
+      DBUG_EXECUTE_IF("dbug.calculate_sbm_after_fake_rotate_log_event",
+                    {
+                      if (ev->get_type_code() == ROTATE_EVENT && ev->is_artificial_event())
+                      {
+                      const char act[]= "now signal signal.reached wait_for signal.done_sbm_calculation";
+                      DBUG_ASSERT(opt_debug_sync_timeout > 0);
+                      DBUG_ASSERT(!debug_sync_set_action(thd,
+                                                         STRING_WITH_LEN(act)));
+                      }
+                    };);
       /*
         Format_description_log_event should not be deleted because it will be
         used to read info about the relay log's format; it will be deleted when
@@ -4902,9 +4912,14 @@ connected:
                     };);
     DBUG_EXECUTE_IF("dbug.calculate_sbm_after_previous_gtid_log_event",
                     {
-                      /* Fake that thread started 3 mints ago */
+                      /* Fake that thread started 3 minutes ago */
                       thd->start_time.tv_sec-=180;
                     };);
+  DBUG_EXECUTE_IF("dbug.calculate_sbm_after_fake_rotate_log_event",
+                  {
+                    /* Fake that thread started 3 minutes ago */
+                    thd->start_time.tv_sec-=180;
+                  };);
   mysql_mutex_lock(&mi->run_lock);
   mi->slave_running= MYSQL_SLAVE_RUN_CONNECT;
   mysql_mutex_unlock(&mi->run_lock);
index ade6664c5378a43da3e56ad2b63b33833c501a02..a22908952dc059808715471ec2eef6b3dd7c4803 100644 (file)
@@ -373,7 +373,7 @@ void Proc_table_intact::report_error(uint code, const char *fmt, ...)
   my_vsnprintf(buf, sizeof(buf), fmt, args);
   va_end(args);
 
-  if (code)
+  if (code == ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2)
     my_message(code, buf, MYF(0));
   else
     my_error(ER_CANNOT_LOAD_FROM_TABLE_V2, MYF(0), "mysql", "proc");
index eefb79394ddee4436f4cd74062b0ba06c5cc8630..5fc4085480992428fda84d74b05a4156dd2c46b6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2012, 2017, 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
@@ -422,14 +422,49 @@ bool sp_lex_instr::reset_lex_and_exec_core(THD *thd,
   thd->rollback_item_tree_changes();
 
   /*
-    Update the state of the active arena if no errors on
-    open_tables stage.
+    Change state of current arena according to outcome of execution.
+
+    When entering this function, state is STMT_INITIALIZED_FOR_SP if this is
+    the first execution, otherwise it is STMT_EXECUTED.
+
+    When an error occurs during opening tables, no execution takes place and
+    no state change will take place.
+
+    When a re-prepare error is raised, the next execution will re-prepare the
+    statement. To make sure that items are created in the statement mem_root,
+    change state to STMT_INITIALIZED_FOR_SP.
+
+    In other cases, the state should become (or remain) STMT_EXECUTED.
+    See Query_arena->state definition for explanation.
+
+    Some special handling of CREATE TABLE .... SELECT in an SP is required. The
+    state is always set to STMT_INITIALIZED_FOR_SP in such a case.
+
+    Why is this necessary? A useful pointer would be to note how
+    PREPARE/EXECUTE uses functions like select_like_stmt_test to implement
+    CREATE TABLE .... SELECT. The SELECT part of the DDL is resolved first.
+    Then there is an attempt to create the table. So in the execution phase,
+    if "table exists" error occurs or flush table preceeds the execute, the
+    item tree of the select is re-created and followed by an attempt to create
+    the table.
+
+    But SP uses mysql_execute_command (which is used by the conventional
+    execute) after doing a parse. This creates a problem for SP since it
+    tries to preserve the item tree from the previous execution.
   */
 
-  if (!rc || !thd->is_error() ||
-      (thd->get_stmt_da()->sql_errno() != ER_CANT_REOPEN_TABLE &&
-       thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE &&
-       thd->get_stmt_da()->sql_errno() != ER_UPDATE_TABLE_USED))
+  bool reprepare_error=
+    rc && thd->get_stmt_da()->sql_errno() == ER_NEED_REPREPARE;
+  bool is_create_table_select=
+    thd->lex && thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
+    thd->lex->select_lex.item_list.elements > 0;
+
+  if (reprepare_error || is_create_table_select)
+    thd->stmt_arena->state= Query_arena::STMT_INITIALIZED_FOR_SP;
+  else if (!rc || !thd->is_error() ||
+           (thd->get_stmt_da()->sql_errno() != ER_CANT_REOPEN_TABLE &&
+            thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE &&
+            thd->get_stmt_da()->sql_errno() != ER_UPDATE_TABLE_USED))
     thd->stmt_arena->state= Query_arena::STMT_EXECUTED;
 
   /*
@@ -493,7 +528,7 @@ LEX *sp_lex_instr::parse_expr(THD *thd, sp_head *sp)
     initiated. Also set the statement query arena to the lex mem_root.
   */
   MEM_ROOT *execution_mem_root= thd->mem_root;
-  Query_arena parse_arena(&m_lex_mem_root, STMT_INITIALIZED_FOR_SP);
+  Query_arena parse_arena(&m_lex_mem_root, thd->stmt_arena->state);
 
   thd->mem_root= &m_lex_mem_root;
   thd->stmt_arena->set_query_arena(&parse_arena);
index c4d3980d46a959712c7db0914ad51fa9c9ed8394..77da10edeaa8f8c53bebe5fc1a0a671ae6e82078 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
 sql_authenticate
    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
@@ -61,6 +61,11 @@ sql_authenticate
 #include <openssl/err.h>
 #endif
 
+#ifndef DBUG_OFF
+#define HASH_STRING_WITH_QUOTE \
+        "$5$BVZy9O>'a+2MH]_?$fpWyabcdiHjfCVqId/quykZzjaA7adpkcen/uiQrtmOK4p4"
+#endif
+
 using std::min;
 using std::max;
 
@@ -184,9 +189,416 @@ TABLE_FIELD_TYPE mysql_db_table_fields[MYSQL_DB_FIELD_COUNT] = {
   }
 };
 
+static const
+TABLE_FIELD_TYPE mysql_user_table_fields[MYSQL_USER_FIELD_COUNT] = {
+  {
+    { C_STRING_WITH_LEN("Host") },
+    { C_STRING_WITH_LEN("char(60)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("User") },
+    { C_STRING_WITH_LEN("char(16)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Password") },
+    { C_STRING_WITH_LEN("char(41)") },
+    { C_STRING_WITH_LEN("latin1") }
+  },
+  {
+    { C_STRING_WITH_LEN("Select_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Insert_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Update_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Delete_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Create_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Drop_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Reload_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Shutdown_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Process_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("File_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Grant_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("References_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Index_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Alter_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Show_db_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Super_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Create_tmp_table_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Lock_tables_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Execute_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Repl_slave_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Repl_client_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Create_view_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Show_view_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Create_routine_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Alter_routine_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Create_user_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Event_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Trigger_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Create_tablespace_priv") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("ssl_type") },
+    { C_STRING_WITH_LEN("enum('','ANY','X509','SPECIFIED')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("ssl_cipher") },
+    { C_STRING_WITH_LEN("blob") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("x509_issuer") },
+    { C_STRING_WITH_LEN("blob") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("x509_subject") },
+    { C_STRING_WITH_LEN("blob") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("max_questions") },
+    { C_STRING_WITH_LEN("int(11)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("max_updates") },
+    { C_STRING_WITH_LEN("int(11)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("max_connections") },
+    { C_STRING_WITH_LEN("int(11)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("max_user_connections") },
+    { C_STRING_WITH_LEN("int(11)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("plugin") },
+    { C_STRING_WITH_LEN("char(64)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("authentication_string") },
+    { C_STRING_WITH_LEN("text") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("password_expired") },
+    { C_STRING_WITH_LEN("enum('N','Y')") },
+    { C_STRING_WITH_LEN("utf8") }
+  }
+};
+
+static const
+TABLE_FIELD_TYPE mysql_proxies_priv_table_fields[MYSQL_PROXIES_PRIV_FIELD_COUNT] = {
+  {
+    { C_STRING_WITH_LEN("Host") },
+    { C_STRING_WITH_LEN("char(60)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("User") },
+    { C_STRING_WITH_LEN("char(16)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Proxied_host") },
+    { C_STRING_WITH_LEN("char(60)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Proxied_user") },
+    { C_STRING_WITH_LEN("char(16)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("With_grant") },
+    { C_STRING_WITH_LEN("tinyint(1)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Grantor") },
+    { C_STRING_WITH_LEN("char(77)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Timestamp") },
+    { C_STRING_WITH_LEN("timestamp") },
+    {NULL, 0}
+  }
+};
+
+static const
+TABLE_FIELD_TYPE mysql_procs_priv_table_fields[MYSQL_PROCS_PRIV_FIELD_COUNT] = {
+  {
+    { C_STRING_WITH_LEN("Host") },
+    { C_STRING_WITH_LEN("char(60)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Db") },
+    { C_STRING_WITH_LEN("char(64)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("User") },
+    { C_STRING_WITH_LEN("char(16)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Routine_name") },
+    { C_STRING_WITH_LEN("char(64)") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Routine_type") },
+    { C_STRING_WITH_LEN("enum('FUNCTION','PROCEDURE')") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Grantor") },
+    { C_STRING_WITH_LEN("char(77)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Proc_priv") },
+    { C_STRING_WITH_LEN("set('Execute','Alter Routine','Grant')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Timestamp") },
+    { C_STRING_WITH_LEN("timestamp") },
+    {NULL, 0}
+  }
+};
+
+static const
+TABLE_FIELD_TYPE mysql_columns_priv_table_fields[MYSQL_COLUMNS_PRIV_FIELD_COUNT] = {
+  {
+    { C_STRING_WITH_LEN("Host") },
+    { C_STRING_WITH_LEN("char(60)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Db") },
+    { C_STRING_WITH_LEN("char(64)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("User") },
+    { C_STRING_WITH_LEN("char(16)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Table_name") },
+    { C_STRING_WITH_LEN("char(64)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Column_name") },
+    { C_STRING_WITH_LEN("char(64)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Timestamp") },
+    { C_STRING_WITH_LEN("timestamp") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Column_priv") },
+    { C_STRING_WITH_LEN("set('Select','Insert','Update','References')") },
+    { C_STRING_WITH_LEN("utf8") }
+  }
+};
+
+static const
+TABLE_FIELD_TYPE mysql_tables_priv_table_fields[MYSQL_TABLES_PRIV_FIELD_COUNT] = {
+  {
+    { C_STRING_WITH_LEN("Host") },
+    { C_STRING_WITH_LEN("char(60)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Db") },
+    { C_STRING_WITH_LEN("char(64)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("User") },
+    { C_STRING_WITH_LEN("char(16)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Table_name") },
+    { C_STRING_WITH_LEN("char(64)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Grantor") },
+    { C_STRING_WITH_LEN("char(77)") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Timestamp") },
+    { C_STRING_WITH_LEN("timestamp") },
+    {NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("Table_priv") },
+    { C_STRING_WITH_LEN("set('Select','Insert','Update','Delete','Create',"
+                        "'Drop','Grant','References','Index','Alter',"
+                        "'Create View','Show view','Trigger')") },
+    { C_STRING_WITH_LEN("utf8") }
+  },
+  {
+    { C_STRING_WITH_LEN("Column_priv") },
+    { C_STRING_WITH_LEN("set('Select','Insert','Update','References')") },
+    { C_STRING_WITH_LEN("utf8") }
+  }
+};
+
+
 const TABLE_FIELD_DEF
   mysql_db_table_def= {MYSQL_DB_FIELD_COUNT, mysql_db_table_fields};
 
+const TABLE_FIELD_DEF
+  mysql_user_table_def= {MYSQL_USER_FIELD_COUNT, mysql_user_table_fields};
+
+const TABLE_FIELD_DEF
+  mysql_proxies_priv_table_def= {MYSQL_PROXIES_PRIV_FIELD_COUNT,
+                                 mysql_proxies_priv_table_fields};
+
+const TABLE_FIELD_DEF
+  mysql_procs_priv_table_def= {MYSQL_PROCS_PRIV_FIELD_COUNT,
+                               mysql_procs_priv_table_fields};
+
+const TABLE_FIELD_DEF
+  mysql_columns_priv_table_def= {MYSQL_COLUMNS_PRIV_FIELD_COUNT,
+                                 mysql_columns_priv_table_fields};
+
+const TABLE_FIELD_DEF
+  mysql_tables_priv_table_def= {MYSQL_TABLES_PRIV_FIELD_COUNT,
+                                mysql_tables_priv_table_fields};
+
 static LEX_STRING native_password_plugin_name= {
   C_STRING_WITH_LEN("mysql_native_password")
 };
@@ -631,6 +1043,35 @@ static uchar* acl_entry_get_key(acl_entry *entry, size_t *length,
   return (uchar*) entry->key;
 }
 
+
+/**
+  Class to validate the flawlessness of ACL table
+  before performing ACL operations.
+*/
+class Acl_table_intact : public Table_check_intact
+{
+protected:
+  void report_error(uint code, const char *fmt, ...)
+  {
+    va_list args;
+    va_start(args, fmt);
+
+    if (code == 0)
+      error_log_print(WARNING_LEVEL, fmt, args);
+    else if (code == ER_CANNOT_LOAD_FROM_TABLE_V2)
+    {
+      char *db_name, *table_name;
+      db_name=  va_arg(args, char *);
+      table_name= va_arg(args, char *);
+      my_error(code, MYF(ME_NOREFRESH), db_name, table_name);
+    }
+    else
+      my_printv_error(code, ER(code), MYF(ME_NOREFRESH), args);
+
+    va_end(args);
+  }
+};
+
 #define IP_ADDR_STRLEN (3 + 1 + 3 + 1 + 3 + 1 + 3)
 #define ACL_KEY_LENGTH (IP_ADDR_STRLEN + 1 + NAME_LEN + \
                         1 + USERNAME_LENGTH + 1)
@@ -663,6 +1104,33 @@ static bool update_user_table(THD *, TABLE *table, const char *host,
 static my_bool acl_load(THD *thd, TABLE_LIST *tables);
 static my_bool grant_load(THD *thd, TABLE_LIST *tables);
 static inline void get_grantor(THD *thd, char* grantor);
+
+/**
+  Escapes special characters in the unescaped string, taking into account
+  the current character set and sql mode.
+
+  @param thd    [in]  The thd structure.
+  @param to     [out] Escaped string output buffer.
+  @param from   [in]  String to escape.
+  @param length [in]  String to escape length.
+
+  @return Result value.
+    @retval != (ulong)-1 Succeeded. Number of bytes written to the output
+                         buffer without the '\0' character.
+    @retval (ulong)-1    Failed.
+*/
+
+inline ulong escape_string_mysql(THD *thd, char *to, const char *from,
+                                 ulong length)
+{
+    if (!(thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES))
+      return (uint)escape_string_for_mysql(system_charset_info, to, 0, from,
+                                           length);
+    else
+      return (uint)escape_quotes_for_mysql(system_charset_info, to, 0, from,
+                                           length);
+}
+
 /*
  Enumeration of various ACL's and Hashes used in handle_grant_struct()
 */
@@ -2200,13 +2668,15 @@ bool change_password(THD *thd, const char *host, const char *user,
 {
   TABLE_LIST tables;
   TABLE *table;
+  Acl_table_intact table_intact;
   /* Buffer should be extended when password length is extended. */
-  char buff[512];
+  char buff[2048];
   ulong query_length=0;
   bool save_binlog_row_based;
   uchar user_key[MAX_KEY_LENGTH];
   char *plugin_temp= NULL;
   bool plugin_empty;
+  char *new_escaped_password= NULL;
   uint new_password_len= (uint) strlen(new_password);
   bool result= 1;
   enum mysql_user_table_field password_field= MYSQL_USER_FIELD_PASSWORD;
@@ -2255,6 +2725,9 @@ bool change_password(THD *thd, const char *host, const char *user,
   if (!(table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
     DBUG_RETURN(1);
 
+  if (table_intact.check(table, &mysql_user_table_def))
+    DBUG_RETURN(1);
+
   if (!table->key_info)
   {
     my_error(ER_TABLE_CORRUPT, MYF(0), table->s->db.str,
@@ -2494,10 +2967,29 @@ bool change_password(THD *thd, const char *host, const char *user,
   acl_cache->clear(1);                         // Clear locked hostname cache
   mysql_mutex_unlock(&acl_cache->lock);
   result= 0;
+  /*
+     Before writing the query to binlog, correctly escape the password
+     string so that the slave can parse it correctly.
+  */
+
+  new_escaped_password= (char *)alloc_root(thd->mem_root, (new_password_len*2+1));
+  if (!new_escaped_password)
+  {
+    my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 0);
+    result= 1;
+    goto end;
+  }
+
+  DBUG_EXECUTE_IF("force_hash_string_with_quote",
+                   strcpy(new_password, HASH_STRING_WITH_QUOTE);
+                 );
+
+  escape_string_mysql(thd, new_escaped_password, new_password, new_password_len);
+
   query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
                         acl_user->user ? acl_user->user : "",
                         acl_user->host.get_host() ? acl_user->host.get_host() : "",
-                        new_password);
+                        new_escaped_password);
   result= write_bin_log(thd, true, buff, query_length,
                         table->file->has_transactions());
 end:
@@ -2838,10 +3330,14 @@ static int replace_user_table(THD *thd, TABLE *table, LEX_USER *combo,
   char what= (revoke_grant) ? 'N' : 'Y';
   uchar user_key[MAX_KEY_LENGTH];
   LEX *lex= thd->lex;
+  Acl_table_intact table_intact;
   DBUG_ENTER("replace_user_table");
 
   mysql_mutex_assert_owner(&acl_cache->lock);
-  
+
+  if (table_intact.check(table, &mysql_user_table_def))
+    goto end;
+
   if (!table->key_info)
   {
     my_error(ER_TABLE_CORRUPT, MYF(0), table->s->db.str,
@@ -3375,6 +3871,7 @@ static int replace_db_table(TABLE *table, const char *db,
   int error;
   char what= (revoke_grant) ? 'N' : 'Y';
   uchar user_key[MAX_KEY_LENGTH];
+  Acl_table_intact table_intact;
   DBUG_ENTER("replace_db_table");
 
   if (!initialized)
@@ -3383,6 +3880,9 @@ static int replace_db_table(TABLE *table, const char *db,
     DBUG_RETURN(-1);
   }
 
+  if (table_intact.check(table, &mysql_db_table_def))
+    DBUG_RETURN(-1);
+
   /* Check if there is such a user in user table in memory? */
   if (!find_acl_user(combo.host.str,combo.user.str, FALSE))
   {
@@ -3523,6 +4023,7 @@ replace_proxies_priv_table(THD *thd, TABLE *table, const LEX_USER *user,
   uchar user_key[MAX_KEY_LENGTH];
   ACL_PROXY_USER new_grant;
   char grantor[USER_HOST_BUFF_SIZE];
+  Acl_table_intact table_intact;
 
   DBUG_ENTER("replace_proxies_priv_table");
 
@@ -3532,6 +4033,9 @@ replace_proxies_priv_table(THD *thd, TABLE *table, const LEX_USER *user,
     DBUG_RETURN(-1);
   }
 
+  if (table_intact.check(table, &mysql_proxies_priv_table_def))
+    DBUG_RETURN(-1);
+
   /* Check if there is such a user in user table in memory? */
   if (!find_acl_user(user->host.str,user->user.str, FALSE))
   {
@@ -3933,8 +4437,13 @@ static int replace_column_table(GRANT_TABLE *g_t,
   int result=0;
   uchar key[MAX_KEY_LENGTH];
   uint key_prefix_length;
+  KEY_PART_INFO *key_part;
+  Acl_table_intact table_intact;
   DBUG_ENTER("replace_column_table");
 
+  if (table_intact.check(table, &mysql_columns_priv_table_def))
+    DBUG_RETURN(-1);
+
   if (!table->key_info)
   {
     my_error(ER_TABLE_CORRUPT, MYF(0), table->s->db.str,
@@ -3942,7 +4451,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
     DBUG_RETURN(-1);
   }
 
-  KEY_PART_INFO *key_part= table->key_info->key_part;
+  key_part= table->key_info->key_part;
 
   table->use_all_columns();
   table->field[0]->store(combo.host.str,combo.host.length,
@@ -4156,8 +4665,12 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
   int error=0;
   ulong store_table_rights, store_col_rights;
   uchar user_key[MAX_KEY_LENGTH];
+  Acl_table_intact table_intact;
   DBUG_ENTER("replace_table_table");
 
+  if (table_intact.check(table, &mysql_tables_priv_table_def))
+    DBUG_RETURN(-1);
+
   get_grantor(thd, grantor);
   /*
     The following should always succeed as new users are created before
@@ -4280,6 +4793,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
   int old_row_exists= 1;
   int error=0;
   ulong store_proc_rights;
+  Acl_table_intact table_intact;
   DBUG_ENTER("replace_routine_table");
 
   if (!initialized)
@@ -4288,6 +4802,9 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
     DBUG_RETURN(-1);
   }
 
+  if (table_intact.check(table, &mysql_procs_priv_table_def))
+    DBUG_RETURN(-1);
+
   get_grantor(thd, grantor);
   /*
     New users are created before this function is called.
@@ -7475,9 +7992,16 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
   int result= 0;
   int found;
   int ret;
+  Acl_table_intact table_intact;
   DBUG_ENTER("handle_grant_data");
 
   /* Handle user table. */
+  if (table_intact.check(tables[0].table, &mysql_user_table_def))
+  {
+    result= -1;
+    goto end;
+  }
+
   if ((found= handle_grant_table(tables, 0, drop, user_from, user_to)) < 0)
   {
     /* Handle of table failed, don't touch the in-memory array. */
@@ -7502,6 +8026,12 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
   }
 
   /* Handle db table. */
+  if (table_intact.check(tables[1].table, &mysql_db_table_def))
+  {
+    result= -1;
+    goto end;
+  }
+
   if ((found= handle_grant_table(tables, 1, drop, user_from, user_to)) < 0)
   {
     /* Handle of table failed, don't touch the in-memory array. */
@@ -7526,6 +8056,12 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
   }
 
   /* Handle stored routines table. */
+  if (table_intact.check(tables[4].table, &mysql_procs_priv_table_def))
+  {
+    result= -1;
+    goto end;
+  }
+
   if ((found= handle_grant_table(tables, 4, drop, user_from, user_to)) < 0)
   {
     /* Handle of table failed, don't touch in-memory array. */
@@ -7566,6 +8102,12 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
   }
 
   /* Handle tables table. */
+  if (table_intact.check(tables[2].table, &mysql_tables_priv_table_def))
+  {
+    result= -1;
+    goto end;
+  }
+
   if ((found= handle_grant_table(tables, 2, drop, user_from, user_to)) < 0)
   {
     /* Handle of table failed, don't touch columns and in-memory array. */
@@ -7582,6 +8124,12 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
     }
 
     /* Handle columns table. */
+    if (table_intact.check(tables[3].table, &mysql_columns_priv_table_def))
+    {
+      result= -1;
+      goto end;
+    }
+
     if ((found= handle_grant_table(tables, 3, drop, user_from, user_to)) < 0)
     {
       /* Handle of table failed, don't touch the in-memory array. */
@@ -7602,6 +8150,12 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
   /* Handle proxies_priv table. */
   if (tables[5].table)
   {
+    if (table_intact.check(tables[5].table, &mysql_proxies_priv_table_def))
+    {
+      result= -1;
+      goto end;
+    }
+
     if ((found= handle_grant_table(tables, 5, drop, user_from, user_to)) < 0)
     {
       /* Handle of table failed, don't touch the in-memory array. */
@@ -8050,6 +8604,7 @@ bool mysql_user_password_expire(THD *thd, List <LEX_USER> &list)
   TABLE *table;
   bool some_passwords_expired= false;
   bool save_binlog_row_based;
+  Acl_table_intact table_intact;
   DBUG_ENTER("mysql_user_password_expire");
 
   if (!initialized)
@@ -8079,6 +8634,9 @@ bool mysql_user_password_expire(THD *thd, List <LEX_USER> &list)
   if (!(table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
     DBUG_RETURN(true);
 
+  if (table_intact.check(table, &mysql_user_table_def))
+    DBUG_RETURN(true);
+
   if (!table->key_info)
   {
     my_error(ER_TABLE_CORRUPT, MYF(0), table->s->db.str,
@@ -10223,6 +10781,9 @@ char *get_56_lenc_string(char **buffer,
 {
   static char empty_string[1]= { '\0' };
   char *begin= *buffer;
+  uchar *pos= (uchar *)begin;
+  size_t required_length= 9;
+
 
   if (*max_bytes_available == 0)
     return NULL;
@@ -10243,6 +10804,29 @@ char *get_56_lenc_string(char **buffer,
     return empty_string;
   }
 
+  /* Make sure we have enough bytes available for net_field_length_ll */
+  {
+    DBUG_EXECUTE_IF("buffer_too_short_3",
+                    *pos= 252; *max_bytes_available= 2;
+    );
+    DBUG_EXECUTE_IF("buffer_too_short_4",
+                    *pos= 253; *max_bytes_available= 3;
+    );
+    DBUG_EXECUTE_IF("buffer_too_short_9",
+                    *pos= 254; *max_bytes_available= 8;
+    );
+
+    if (*pos <= 251)
+      required_length= 1;
+    if (*pos == 252)
+      required_length= 3;
+    if (*pos == 253)
+      required_length= 4;
+
+    if (*max_bytes_available < required_length)
+      return NULL;
+  }
+
   *string_length= (size_t)net_field_length_ll((uchar **)buffer);
 
   DBUG_EXECUTE_IF("sha256_password_scramble_too_long",
@@ -10250,6 +10834,9 @@ char *get_56_lenc_string(char **buffer,
   );
 
   size_t len_len= (size_t)(*buffer - begin);
+
+  DBUG_ASSERT((*max_bytes_available >= len_len) &&
+              (len_len == required_length));
   
   if (*string_length > *max_bytes_available - len_len)
     return NULL;
index 4a47e7cb3ea789f90d4c34229cf5fcc9f064a40f..4369eccd209cdfe27c95f07c75387f8f51883663 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef SQL_ACL_INCLUDED
 #define SQL_ACL_INCLUDED
 
-/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2016, 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
@@ -226,6 +226,56 @@ enum mysql_user_table_field
   MYSQL_USER_FIELD_COUNT
 };
 
+enum mysql_proxies_priv_table_feild
+{
+  MYSQL_PROXIES_PRIV_FIELD_HOST = 0,
+  MYSQL_PROXIES_PRIV_FIELD_USER,
+  MYSQL_PROXIES_PRIV_FIELD_PROXIED_HOST,
+  MYSQL_PROXIES_PRIV_FIELD_PROXIED_USER,
+  MYSQL_PROXIES_PRIV_FIELD_WITH_GRANT,
+  MYSQL_PROXIES_PRIV_FIELD_GRANTOR,
+  MYSQL_PROXIES_PRIV_FIELD_TIMESTAMP,
+  MYSQL_PROXIES_PRIV_FIELD_COUNT
+};
+
+enum mysql_procs_priv_table_field
+{
+  MYSQL_PROCS_PRIV_FIELD_HOST = 0,
+  MYSQL_PROCS_PRIV_FIELD_DB,
+  MYSQL_PROCS_PRIV_FIELD_USER,
+  MYSQL_PROCS_PRIV_FIELD_ROUTINE_NAME,
+  MYSQL_PROCS_PRIV_FIELD_ROUTINE_TYPE,
+  MYSQL_PROCS_PRIV_FIELD_GRANTOR,
+  MYSQL_PROCS_PRIV_FIELD_PROC_PRIV,
+  MYSQL_PROCS_PRIV_FIELD_TIMESTAMP,
+  MYSQL_PROCS_PRIV_FIELD_COUNT
+};
+
+enum mysql_columns_priv_table_field
+{
+  MYSQL_COLUMNS_PRIV_FIELD_HOST = 0,
+  MYSQL_COLUMNS_PRIV_FIELD_DB,
+  MYSQL_COLUMNS_PRIV_FIELD_USER,
+  MYSQL_COLUMNS_PRIV_FIELD_TABLE_NAME,
+  MYSQL_COLUMNS_PRIV_FIELD_COLUMN_NAME,
+  MYSQL_COLUMNS_PRIV_FIELD_TIMESTAMP,
+  MYSQL_COLUMNS_PRIV_FIELD_COLUMN_PRIV,
+  MYSQL_COLUMNS_PRIV_FIELD_COUNT
+};
+
+enum mysql_tables_priv_table_field
+{
+  MYSQL_TABLES_PRIV_FIELD_HOST = 0,
+  MYSQL_TABLES_PRIV_FIELD_DB,
+  MYSQL_TABLES_PRIV_FIELD_USER,
+  MYSQL_TABLES_PRIV_FIELD_TABLE_NAME,
+  MYSQL_TABLES_PRIV_FIELD_GRANTOR,
+  MYSQL_TABLES_PRIV_FIELD_TIMESTAMP,
+  MYSQL_TABLES_PRIV_FIELD_TABLE_PRIV,
+  MYSQL_TABLES_PRIV_FIELD_COLUMN_PRIV,
+  MYSQL_TABLES_PRIV_FIELD_COUNT
+};
+
 extern const TABLE_FIELD_DEF mysql_db_table_def;
 extern bool mysql_user_table_is_in_short_password_format;
 extern my_bool disconnect_on_expired_password;
index c5bbd5843c028e6f69eb8ff6f3a169797e5cd9ab..f2c36787b6cb897fe02c9e62a41706898531fb11 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, 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
@@ -6593,7 +6593,10 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
           Use own arena for Prepared Statements or data will be freed after
           PREPARE.
         */
-        Prepared_stmt_arena_holder ps_arena_holder(thd, register_tree_change);
+        Prepared_stmt_arena_holder ps_arena_holder(
+          thd,
+          register_tree_change &&
+            thd->stmt_arena->is_stmt_prepare_or_first_stmt_execute());
 
         /*
           create_item() may, or may not create a new Item, depending on
index 2397125e61c25ba1929438f6d4332967e522c314..f6c53f10c744f57ff92ac41435a424612b3aff25 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2000, 2017, 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
@@ -378,15 +378,13 @@ void thd_binlog_pos(const THD *thd,
 
   thd_new_connection_setup
 
-  @note Must be called with LOCK_thread_count locked.
-
   @param              thd            THD object
   @param              stack_start    Start of stack for connection
 */
 void thd_new_connection_setup(THD *thd, char *stack_start)
 {
   DBUG_ENTER("thd_new_connection_setup");
-  mysql_mutex_assert_owner(&LOCK_thread_count);
+  mysql_mutex_lock(&LOCK_thread_count);
 #ifdef HAVE_PSI_INTERFACE
   thd_set_psi(thd,
               PSI_THREAD_CALL(new_thread)
index 33fe0a3efa5b0a1dfde2968923bc5a174ecc1c5c..6a31d4c53205bb30a42dbeba83dd04195e1107c2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights
    reserved.
 
    This program is free software; you can redistribute it and/or modify
@@ -750,6 +750,19 @@ public:
     STMT_CONVENTIONAL_EXECUTION= 3, STMT_EXECUTED= 4, STMT_ERROR= -1
   };
 
+  /*
+    State and state changes in SP:
+    1) When state is STMT_INITIALIZED_FOR_SP, objects in the item tree are
+       created on the statement memroot. This is enforced through
+       ps_arena_holder checking the state.
+    2) After the first execute (call p1()), this state should change to
+       STMT_EXECUTED. Objects will be created on the execution memroot and will
+       be destroyed at the end of each execution.
+    3) In case an ER_NEED_REPREPARE error occurs, state should be changed to
+       STMT_INITIALIZED_FOR_SP and objects will again be created on the
+       statement memroot. At the end of this execution, state should change to
+       STMT_EXECUTED.
+  */
   enum_state state;
 
   /* We build without RTTI, so dynamic_cast can't be used. */
index 630e5b0f08177dac7601363a47076d2dca1ade39..74223c63b3da2a14fea8b39ec6c4f922b81dc9f1 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2016, 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
@@ -595,6 +595,16 @@ sql_digest_state* digest_add_token(sql_digest_state *state,
       state->m_last_id_index= (int)digest_storage->m_byte_count;
       break;
     }
+    case 0:
+    {
+      unsigned int temp_tok;
+      read_token(digest_storage,
+                 digest_storage->m_byte_count-SIZE_OF_A_TOKEN,
+                 & temp_tok);
+      if (temp_tok == ';')
+        digest_storage->m_byte_count-= SIZE_OF_A_TOKEN;
+      break;
+    }
     default:
     {
       /* Add this token to digest storage. */
index c9245bf215a9a8fc2426f9032f8abafd2f494554..57497ad786d69f1f872db023185f742f6573797a 100644 (file)
@@ -307,6 +307,24 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
                      set_fields, MARK_COLUMNS_WRITE, 0, 0) ||
         check_that_all_fields_are_given_values(thd, table, table_list))
       DBUG_RETURN(TRUE);
+
+    /*
+      Special updatability test is needed because fields_vars may contain
+      a mix of column references and user variables.
+    */
+    Item *item;
+    List_iterator<Item> it(fields_vars);
+    while ((item= it++))
+    {
+      if ((item->type() == Item::FIELD_ITEM ||
+           item->type() == Item::REF_ITEM) &&
+          item->field_for_view_update() == NULL)
+      {
+        my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), item->item_name.ptr());
+        DBUG_RETURN(true);
+      }
+    }
+
     /* Fix the expressions in SET clause */
     if (setup_fields(thd, Ref_ptr_array(), set_values, MARK_COLUMNS_READ, 0, 0))
       DBUG_RETURN(TRUE);
index 3634646e8e077b087824177551eb9561adea12ee..69f9f1beeec5d8b4a42b0aca1d10a343dcaf52ce 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, 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
@@ -1682,6 +1682,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
 
 /* PSI begin */
       thd->m_digest= & thd->m_digest_state;
+      thd->m_digest->reset(thd->m_token_array, max_digest_length);
 
       thd->m_statement_psi= MYSQL_START_STATEMENT(&thd->m_statement_state,
                                                   com_statement_info[command].m_key,
@@ -3259,7 +3260,7 @@ case SQLCOM_PREPARE:
 
     if (((lex->create_info.used_fields & HA_CREATE_USED_DATADIR) != 0 ||
          (lex->create_info.used_fields & HA_CREATE_USED_INDEXDIR) != 0) &&
-        check_access(thd, FILE_ACL, NULL, NULL, NULL, FALSE, FALSE))
+        check_access(thd, FILE_ACL, any_db, NULL, NULL, FALSE, FALSE))
     {
       res= 1;
       my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "FILE");
@@ -3304,7 +3305,7 @@ case SQLCOM_PREPARE:
     {
       partition_info *part_info= thd->lex->part_info;
       if (part_info != NULL && has_external_data_or_index_dir(*part_info) &&
-          check_access(thd, FILE_ACL, NULL, NULL, NULL, FALSE, FALSE))
+          check_access(thd, FILE_ACL, any_db, NULL, NULL, FALSE, FALSE))
       {
         res= -1;
         goto end_with_restore_list;
index 21cb3c76a6d917c6d1a58ab02e09f66c4ac2eece..f1cfaecd83c0c86fcdbb1afa959e59aaa6033640 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2002, 2017, 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
@@ -646,7 +646,7 @@ static void set_param_datetime(Item_param *param, uchar **pos, ulong len)
   else
     set_zero_time(&tm, MYSQL_TIMESTAMP_DATETIME);
   param->set_time(&tm, MYSQL_TIMESTAMP_DATETIME,
-                  MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
+                  MAX_DATETIME_FULL_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
   *pos+= length;
 }
 
index 3a557b4a88af2633597ffcd776778019ddc1d7e4..00b34e63942503af502e0e93481c4a6a47736d1b 100644 (file)
@@ -5140,7 +5140,7 @@ bool JOIN::make_tmp_tables_info()
                         select_distinct && !group_list);
       tmp_table_param.hidden_field_count= 
         tmp_all_fields1.elements - tmp_fields_list1.elements;
-      
+      sort_and_group= false;
       if (!exec_tmp_table->group && !exec_tmp_table->distinct)
       {
         // 1st tmp table were materializing join result
index 00cb417b74991688cf780e8c9a4ba2dc44f9cf4a..b0e86ce41a52accd4b13ab2b47e14909552ec47b 100644 (file)
@@ -3420,6 +3420,21 @@ mysql_prepare_create_table(THD *thd, const char *error_schema_name,
   uint total_uneven_bit_length= 0;
   DBUG_ENTER("mysql_prepare_create_table");
 
+  LEX_STRING* connect_string = &create_info->connect_string;
+  if (connect_string->length != 0 &&
+      connect_string->length > CONNECT_STRING_MAXLEN &&
+      (system_charset_info->cset->charpos(system_charset_info,
+                                          connect_string->str,
+                                          (connect_string->str +
+                                           connect_string->length),
+                                          CONNECT_STRING_MAXLEN)
+      < connect_string->length))
+  {
+    my_error(ER_WRONG_STRING_LENGTH, MYF(0),
+             connect_string->str, "CONNECTION", CONNECT_STRING_MAXLEN);
+    DBUG_RETURN(TRUE);
+  }
+
   select_field_pos= alter_info->create_list.elements - select_field_count;
   null_fields=blob_columns=0;
   create_info->varchar= 0;
index a848dd27e3a7715534c4396638333755e1873540..bfc7c13e682ceab03d9832083da2b312b4379143 100644 (file)
@@ -839,18 +839,22 @@ void KEY_PART_INFO::init_from_field(Field *fld)
 /**
   Setup key-related fields of Field object for given key and key part.
 
-  @param[in]     share         Pointer to TABLE_SHARE
-  @param[in]     handler       Pointer to handler
-  @param[in]     primary_key_n Primary key number
-  @param[in]     keyinfo       Pointer to processed key
-  @param[in]     key_n         Processed key number
-  @param[in]     key_part_n    Processed key part number
-  @param[in,out] usable_parts  Pointer to usable_parts variable
+  @param[in]     share                    Pointer to TABLE_SHARE
+  @param[in]     handler_file             Pointer to handler
+  @param[in]     primary_key_n            Primary key number
+  @param[in]     keyinfo                  Pointer to processed key
+  @param[in]     key_n                    Processed key number
+  @param[in]     key_part_n               Processed key part number
+  @param[in,out] usable_parts             Pointer to usable_parts variable
+  @param[in]     part_of_key_not_extended Set when column is part of the Key
+                                          and not appended by the storage
+                                          engine from primary key columns.
 */
 
 static void setup_key_part_field(TABLE_SHARE *share, handler *handler_file,
                                  uint primary_key_n, KEY *keyinfo, uint key_n,
-                                 uint key_part_n, uint *usable_parts)
+                                 uint key_part_n, uint *usable_parts,
+                                 bool part_of_key_not_extended)
 {
   KEY_PART_INFO *key_part= &keyinfo->key_part[key_part_n];
   Field *field= key_part->field;
@@ -869,7 +873,8 @@ static void setup_key_part_field(TABLE_SHARE *share, handler *handler_file,
     {
       share->keys_for_keyread.set_bit(key_n);
       field->part_of_key.set_bit(key_n);
-      field->part_of_key_not_clustered.set_bit(key_n);
+      if (part_of_key_not_extended)
+        field->part_of_key_not_extended.set_bit(key_n);
     }
     if (handler_file->index_flags(key_n, key_part_n, 1) & HA_READ_ORDER)
       field->part_of_sortkey.set_bit(key_n);
@@ -949,7 +954,7 @@ static uint add_pk_parts_to_sk(KEY *sk, uint sk_n, KEY *pk, uint pk_n,
 
       *current_key_part= *pk_key_part;
       setup_key_part_field(share, handler_file, pk_n, sk, sk_n,
-                           sk->actual_key_parts, usable_parts);
+                           sk->actual_key_parts, usable_parts, false);
       *current_rec_per_key++= 0;
       sk->actual_key_parts++;
       sk->unused_key_parts--;
@@ -1882,7 +1887,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
         key_part->init_flags();
 
         setup_key_part_field(share, handler_file, primary_key,
-                             keyinfo, key, i, &usable_parts);
+                             keyinfo, key, i, &usable_parts, true);
 
         field->flags|= PART_KEY_FLAG;
         if (key == primary_key)
@@ -3319,11 +3324,7 @@ bool check_column_name(const char *name)
                                and type)
 
   @retval  FALSE  OK
-  @retval  TRUE   There was an error. An error message is output
-                  to the error log.  We do not push an error
-                  message into the error stack because this
-                  function is currently only called at start up,
-                  and such errors never reach the user.
+  @retval  TRUE   There was an error.
 */
 
 bool
@@ -3413,28 +3414,28 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def)
       if (strncmp(sql_type.c_ptr_safe(), field_def->type.str,
                   field_def->type.length - 1))
       {
-        report_error(0, "Incorrect definition of table %s.%s: "
-                     "expected column '%s' at position %d to have type "
-                     "%s, found type %s.", table->s->db.str, table->alias,
-                     field_def->name.str, i, field_def->type.str,
+        report_error(ER_CANNOT_LOAD_FROM_TABLE_V2, "Incorrect definition of "
+                     "table %s.%s: expected column '%s' at position %d to "
+                     "have type %s, found type %s.", table->s->db.str,
+                     table->alias, field_def->name.str, i, field_def->type.str,
                      sql_type.c_ptr_safe());
         error= TRUE;
       }
       else if (field_def->cset.str && !field->has_charset())
       {
-        report_error(0, "Incorrect definition of table %s.%s: "
-                     "expected the type of column '%s' at position %d "
-                     "to have character set '%s' but the type has no "
-                     "character set.", table->s->db.str, table->alias,
+        report_error(ER_CANNOT_LOAD_FROM_TABLE_V2, "Incorrect definition of "
+                     "table %s.%s: expected the type of column '%s' at "
+                     "position %d to have character set '%s' but the type "
+                     "has no character set.", table->s->db.str, table->alias,
                      field_def->name.str, i, field_def->cset.str);
         error= TRUE;
       }
       else if (field_def->cset.str &&
                strcmp(field->charset()->csname, field_def->cset.str))
       {
-        report_error(0, "Incorrect definition of table %s.%s: "
-                     "expected the type of column '%s' at position %d "
-                     "to have character set '%s' but found "
+        report_error(ER_CANNOT_LOAD_FROM_TABLE_V2, "Incorrect definition of "
+                     "table %s.%s: expected the type of column '%s' at "
+                     "position %d to have character set '%s' but found "
                      "character set '%s'.", table->s->db.str, table->alias,
                      field_def->name.str, i, field_def->cset.str,
                      field->charset()->csname);
@@ -3443,11 +3444,11 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def)
     }
     else
     {
-      report_error(0, "Incorrect definition of table %s.%s: "
-                   "expected column '%s' at position %d to have type %s "
-                   " but the column is not found.",
-                   table->s->db.str, table->alias,
-                   field_def->name.str, i, field_def->type.str);
+      report_error(ER_CANNOT_LOAD_FROM_TABLE_V2, "Incorrect definition of "
+                   "table %s.%s: expected column '%s' at position %d to "
+                   "have type %s but the column is not found.",
+                   table->s->db.str, table->alias, field_def->name.str, i,
+                   field_def->type.str);
       error= TRUE;
     }
   }
diff --git a/mysql-wsrep-5.6/sql/xa.h b/mysql-wsrep-5.6/sql/xa.h
new file mode 100644 (file)
index 0000000..00dcf3b
--- /dev/null
@@ -0,0 +1,108 @@
+/* Copyright (c) 2016, 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,
+   51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#ifndef XA_H_INCLUDED
+#define XA_H_INCLUDED
+
+#include <string.h>
+#include <sys/types.h>
+
+#include "mysqld.h"
+#include "m_string.h"
+#include "my_dbug.h"
+#include "my_global.h"
+#include "sql_cmd.h"          // Sql_cmd
+
+typedef ulonglong my_xid; // this line is the same as in log_event.h
+#define XIDDATASIZE 128
+#define MYSQL_XID_PREFIX "MySQLXid"
+#define MYSQL_XID_PREFIX_LEN 8
+#define MYSQL_XID_OFFSET (MYSQL_XID_PREFIX_LEN+sizeof(server_id))
+#define MYSQL_XID_GTRID_LEN (MYSQL_XID_OFFSET+sizeof(my_xid))
+
+/**
+  struct xid_t is binary compatible with the XID structure as
+  in the X/Open CAE Specification, Distributed Transaction Processing:
+  The XA Specification, X/Open Company Ltd., 1991.
+  http://www.opengroup.org/bookstore/catalog/c193.htm
+
+  @see MYSQL_XID in mysql/plugin.h
+*/
+struct xid_t {
+  long formatID;
+  long gtrid_length;
+  long bqual_length;
+  char data[XIDDATASIZE];  // not \0-terminated !
+
+  xid_t() {}                                /* Remove gcc warning */
+  bool eq(struct xid_t *xid)
+  { return eq(xid->gtrid_length, xid->bqual_length, xid->data); }
+  bool eq(long g, long b, const char *d)
+  { return g == gtrid_length && b == bqual_length && !memcmp(d, data, g+b); }
+  void set(struct xid_t *xid)
+  { memcpy(this, xid, xid->length()); }
+  void set(long f, const char *g, long gl, const char *b, long bl)
+  {
+    formatID= f;
+    memcpy(data, g, gtrid_length= gl);
+    memcpy(data+gl, b, bqual_length= bl);
+  }
+  void set(ulonglong xid)
+  {
+    my_xid tmp;
+    formatID= 1;
+    set(MYSQL_XID_PREFIX_LEN, 0, MYSQL_XID_PREFIX);
+    memcpy(data+MYSQL_XID_PREFIX_LEN, &server_id, sizeof(server_id));
+    tmp= xid;
+    memcpy(data+MYSQL_XID_OFFSET, &tmp, sizeof(tmp));
+    gtrid_length=MYSQL_XID_GTRID_LEN;
+  }
+  void set(long g, long b, const char *d)
+  {
+    formatID= 1;
+    gtrid_length= g;
+    bqual_length= b;
+    memcpy(data, d, g+b);
+  }
+  bool is_null() { return formatID == -1; }
+  void null() { formatID= -1; }
+  my_xid quick_get_my_xid()
+  {
+    my_xid tmp;
+    memcpy(&tmp, data+MYSQL_XID_OFFSET, sizeof(tmp));
+    return tmp;
+  }
+  my_xid get_my_xid()
+  {
+    return gtrid_length == MYSQL_XID_GTRID_LEN && bqual_length == 0 &&
+           !memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ?
+           quick_get_my_xid() : 0;
+  }
+  uint length()
+  {
+    return sizeof(formatID)+sizeof(gtrid_length)+sizeof(bqual_length)+
+           gtrid_length+bqual_length;
+  }
+  uchar *key()
+  {
+    return (uchar *)&gtrid_length;
+  }
+  uint key_length()
+  {
+    return sizeof(gtrid_length)+sizeof(bqual_length)+gtrid_length+bqual_length;
+  }
+};
+typedef struct xid_t XID;
+#endif
index dd28f50f4f675a2c7763959a25104843e1a838d0..01f03b2eaf75a9bdee8332247d88b244e3c8fd2a 100644 (file)
@@ -175,7 +175,7 @@ btr_search_sys_create(
        btr_search_sys = (btr_search_sys_t*)
                mem_alloc(sizeof(btr_search_sys_t));
 
-       btr_search_sys->hash_index = ha_create(hash_size, 0,
+       btr_search_sys->hash_index = ib_create(hash_size, 0,
                                        MEM_HEAP_FOR_BTR_SEARCH, 0);
 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
        btr_search_sys->hash_index->adaptive = TRUE;
index 6f206918212c92aa07808798c41c28b36e5fe7de..fa73e80b358d80ab2e5f438a98d2be5b545d3c26 100644 (file)
@@ -1366,7 +1366,7 @@ buf_pool_init_instance(
                ut_a(srv_n_page_hash_locks != 0);
                ut_a(srv_n_page_hash_locks <= MAX_PAGE_HASH_LOCKS);
 
-               buf_pool->page_hash = ha_create(2 * buf_pool->curr_size,
+               buf_pool->page_hash = ib_create(2 * buf_pool->curr_size,
                                                srv_n_page_hash_locks,
                                                MEM_HEAP_FOR_PAGE_HASH,
                                                SYNC_BUF_PAGE_HASH);
index 62222993622c9aa6d6aa11643a5473402f73fee8..a752c3dfda50a9cbf5e1eb393f48fbdf219576a5 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, 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
@@ -355,7 +355,7 @@ recovery, this function loads the pages from double write buffer into memory. */
 void
 buf_dblwr_init_or_load_pages(
 /*=========================*/
-       os_file_t       file,
+       pfs_os_file_t   file,
        char*           path,
        bool            load_corrupt_pages)
 {
index ed27a70307d70cbfad893e4fcf1c8bd2f755d472..6c830205e2b777d465b141c6ea4b28c505fbdd07 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2011, 2017, 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
@@ -597,6 +597,7 @@ DECLARE_THREAD(buf_dump_thread)(
        void*   arg MY_ATTRIBUTE((unused)))     /*!< in: a dummy parameter
                                                required by os_thread_create */
 {
+       my_thread_init();
        ut_ad(!srv_read_only_mode);
 
        srv_buf_dump_thread_active = TRUE;
@@ -632,6 +633,7 @@ DECLARE_THREAD(buf_dump_thread)(
 
        srv_buf_dump_thread_active = FALSE;
 
+       my_thread_end();
        /* We count the number of threads in os_thread_exit(). A created
        thread should always use that to exit and not use return() to exit. */
        os_thread_exit(NULL);
index 1cdd1610c4f9cf133627c5a260634f26d8289181..6550f91680525d612e9a6907def0b5726273da80 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, 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
@@ -2388,6 +2388,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
                        /*!< in: a dummy parameter required by
                        os_thread_create */
 {
+       my_thread_init();
        ulint   next_loop_time = ut_time_ms() + 1000;
        ulint   n_flushed = 0;
        ulint   last_activity = srv_get_activity_count();
@@ -2506,6 +2507,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
 thread_exit:
        buf_page_cleaner_is_active = FALSE;
 
+       my_thread_end();
        /* We count the number of threads in os_thread_exit(). A created
        thread should always use that to exit and not use return() to exit. */
        os_thread_exit(NULL);
index 1a1dd29a2025a10d66dcb21047dea0d330091397..7873da30207b3df1d3c57479f138008ae2df6881 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2017, 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
@@ -454,7 +454,10 @@ dict_boot(void)
 
        dberr_t err = DB_SUCCESS;
 
-       if (srv_read_only_mode && !ibuf_is_empty()) {
+       /** If innodb_force_recovery is set to 6 then allow
+       the server to start even though ibuf is not empty. */
+       if (srv_force_recovery != SRV_FORCE_NO_LOG_REDO
+           && srv_read_only_mode && !ibuf_is_empty()) {
 
                ib_logf(IB_LOG_LEVEL_ERROR,
                        "Change buffer must be empty when --innodb-read-only "
index b0ba98308be71e406be10fdf915067c4de1d5f24..55a2626857957281613065d713146aa59685b75b 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 2009, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2009, 2017, 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
@@ -690,6 +690,9 @@ dict_stats_copy(
              && (src_idx = dict_table_get_next_index(src_idx)))) {
 
                if (dict_stats_should_ignore_index(dst_idx)) {
+                       if (!(dst_idx->type & DICT_FTS)) {
+                               dict_stats_empty_index(dst_idx);
+                       }
                        continue;
                }
 
@@ -1096,10 +1099,10 @@ dict_stats_analyze_index_level(
                leaf-level delete marks because delete marks on
                non-leaf level do not make sense. */
 
-               if (level == 0 && srv_stats_include_delete_marked? 0:
+               if (level == 0 && (srv_stats_include_delete_marked ? 0:
                    rec_get_deleted_flag(
                            rec,
-                           page_is_comp(btr_pcur_get_page(&pcur)))) {
+                           page_is_comp(btr_pcur_get_page(&pcur))))) {
 
                        if (rec_is_last_on_page
                            && !prev_rec_is_copied
@@ -3229,12 +3232,6 @@ dict_stats_update(
 
                        dict_table_stats_lock(table, RW_X_LATCH);
 
-                       /* Initialize all stats to dummy values before
-                       copying because dict_stats_table_clone_create() does
-                       skip corrupted indexes so our dummy object 't' may
-                       have less indexes than the real object 'table'. */
-                       dict_stats_empty_table(table);
-
                        dict_stats_copy(table, t);
 
                        dict_stats_assert_initialized(table);
index 6f01c37977651cd43f31ae6657d12d25f49c0c6d..975c8a50803bdb46d95b2eff1207289185b65eba 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2012, 2017, 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
@@ -334,6 +334,7 @@ DECLARE_THREAD(dict_stats_thread)(
        void*   arg MY_ATTRIBUTE((unused)))     /*!< in: a dummy parameter
                                                required by os_thread_create */
 {
+       my_thread_init();
        ut_a(!srv_read_only_mode);
 
        srv_dict_stats_thread_active = TRUE;
@@ -359,6 +360,7 @@ DECLARE_THREAD(dict_stats_thread)(
 
        srv_dict_stats_thread_active = FALSE;
 
+       my_thread_end();
        /* We count the number of threads in os_thread_exit(). A created
        thread should always use that to exit instead of return(). */
        os_thread_exit(NULL);
index 5e1a9d6c05e830b64da81ffcc50c03938ee86b73..20c6cc6201eb2ef1e8b6196a121eaf1057c63a30 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, 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
@@ -146,7 +146,7 @@ struct fil_node_t {
                                belongs */
        char*           name;   /*!< path to the file */
        ibool           open;   /*!< TRUE if file open */
-       os_file_t       handle; /*!< OS handle to the file, if file open */
+       pfs_os_file_t   handle; /*!< OS handle to the file, if file open */
        os_event_t      sync_event;/*!< Condition event to group and
                                serialize calls to fsync */
        ibool           is_raw_disk;/*!< TRUE if the 'file' is actually a raw
@@ -316,7 +316,8 @@ initialized. */
 static fil_system_t*   fil_system      = NULL;
 
 /** Determine if (i) is a user tablespace id or not. */
-# define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
+# define fil_is_user_tablespace_id(i) (i != 0 \
+                                      && !srv_is_undo_tablespace(i))
 
 /** Determine if user has explicitly disabled fsync(). */
 #ifndef __WIN__
@@ -2025,7 +2026,7 @@ UNIV_INTERN
 const char*
 fil_read_first_page(
 /*================*/
-       os_file_t       data_file,              /*!< in: open data file */
+       pfs_os_file_t   data_file,              /*!< in: open data file */
        ibool           one_read_already,       /*!< in: TRUE if min and max
                                                parameters below already
                                                contain sensible data */
@@ -3360,7 +3361,7 @@ fil_open_linked_file(
 /*===============*/
        const char*     tablename,      /*!< in: database/tablename */
        char**          remote_filepath,/*!< out: remote filepath */
-       os_file_t*      remote_file)    /*!< out: remote file handle */
+       pfs_os_file_t*  remote_file)    /*!< out: remote file handle */
 
 {
        ibool           success;
@@ -3420,7 +3421,8 @@ fil_create_new_single_table_tablespace(
                                        tablespace file in pages,
                                        must be >= FIL_IBD_FILE_INITIAL_SIZE */
 {
-       os_file_t       file;
+       pfs_os_file_t   file;
+
        ibool           ret;
        dberr_t         err;
        byte*           buf2;
@@ -5862,7 +5864,7 @@ fil_flush(
 {
        fil_space_t*    space;
        fil_node_t*     node;
-       os_file_t       file;
+       pfs_os_file_t   file;
 
 
        mutex_enter(&fil_system->mutex);
@@ -6224,7 +6226,7 @@ fil_buf_block_init(
 }
 
 struct fil_iterator_t {
-       os_file_t       file;                   /*!< File handle */
+       pfs_os_file_t   file;                   /*!< File handle */
        const char*     filepath;               /*!< File path name */
        os_offset_t     start;                  /*!< From where to start */
        os_offset_t     end;                    /*!< Where to stop */
@@ -6359,7 +6361,7 @@ fil_tablespace_iterate(
        PageCallback&   callback)
 {
        dberr_t         err;
-       os_file_t       file;
+       pfs_os_file_t   file;
        char*           filepath;
 
        ut_a(n_io_buffers > 0);
index 5580517afc496dac8848e4af9acc80d78a62356a..9fe3ab29f582a3401efc273f815702855cdba9d6 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
 Copyright (c) 2008, 2009 Google Inc.
 Copyright (c) 2009, Percona Inc.
 Copyright (c) 2012, Facebook Inc.
@@ -5143,6 +5143,8 @@ table_opened:
        prebuilt->default_rec = table->s->default_values;
        ut_ad(prebuilt->default_rec);
 
+       prebuilt->mysql_handler = this;
+
        /* Looks like MySQL-3.23 sometimes has primary key number != 0 */
        primary_key = table->s->primary_key;
        key_used_on_scan = primary_key;
@@ -11284,7 +11286,8 @@ ha_innobase::delete_table(
        extension, in contrast to ::create */
        normalize_table_name(norm_name, name);
 
-       if (srv_read_only_mode) {
+       if (srv_read_only_mode
+           || srv_force_recovery >= SRV_FORCE_NO_UNDO_LOG_SCAN) {
                DBUG_RETURN(HA_ERR_TABLE_READONLY);
        } else if (row_is_magic_monitor_table(norm_name)
                   && check_global_access(thd, PROCESS_ACL)) {
index a62a6400d971bc8e828cd4c3bcd5fc81a6eb646c..18e124b74378faa0a1abe4220bac5f28e1c3dc0a 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, 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
@@ -55,7 +55,7 @@ recovery, this function loads the pages from double write buffer into memory. */
 void
 buf_dblwr_init_or_load_pages(
 /*=========================*/
-       os_file_t       file,
+       pfs_os_file_t   file,
        char*           path,
        bool            load_corrupt_pages);
 
index 4d2913846b58e8a9de42f0f1fab88a985dc13f20..5806863f92664ca75e6c09a7902056f32e42ce93 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, 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
@@ -181,7 +181,7 @@ struct fsp_open_info {
        ibool           success;        /*!< Has the tablespace been opened? */
        const char*     check_msg;      /*!< fil_check_first_page() message */
        ibool           valid;          /*!< Is the tablespace valid? */
-       os_file_t       file;           /*!< File handle */
+       pfs_os_file_t   file;           /*!< File handle */
        char*           filepath;       /*!< File path to open */
        lsn_t           lsn;            /*!< Flushed LSN from header page */
        ulint           id;             /*!< Space ID */
@@ -384,7 +384,7 @@ UNIV_INTERN
 const char*
 fil_read_first_page(
 /*================*/
-       os_file_t       data_file,              /*!< in: open data file */
+       pfs_os_file_t   data_file,              /*!< in: open data file */
        ibool           one_read_already,       /*!< in: TRUE if min and max
                                                parameters below already
                                                contain sensible data */
@@ -902,12 +902,12 @@ struct PageCallback {
        Called for every page in the tablespace. If the page was not
        updated then its state must be set to BUF_PAGE_NOT_USED. For
        compressed tables the page descriptor memory will be at offset:
-                       block->frame + UNIV_PAGE_SIZE;
+               block->frame + UNIV_PAGE_SIZE;
        @param offset - physical offset within the file
        @param block - block read from file, note it is not from the buffer pool
        @retval DB_SUCCESS or error code. */
        virtual dberr_t operator()(
-               os_offset_t     offset,
+               os_offset_t     offset,
                buf_block_t*    block) UNIV_NOTHROW = 0;
 
        /**
@@ -915,7 +915,7 @@ struct PageCallback {
        to open it for the file that is being iterated over.
        @param filename - then physical name of the tablespace file.
        @param file - OS file handle */
-       void set_file(const char* filename, os_file_t file) UNIV_NOTHROW
+       void set_file(const char* filename, pfs_os_file_t file) UNIV_NOTHROW
        {
                m_file = file;
                m_filepath = filename;
@@ -951,7 +951,7 @@ struct PageCallback {
        ulint                   m_page_size;
 
        /** File handle to the tablespace */
-       os_file_t               m_file;
+       pfs_os_file_t           m_file;
 
        /** Physical file path. */
        const char*             m_filepath;
index 7351b407e8c9608decd6a4454702bef7e4cb2268..58eb581e76a71d21dab75c8a327c24cc0f72e296 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2016, 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
@@ -107,7 +107,7 @@ chosen to be a slightly bigger prime number.
 @param level   in: level of the mutexes in the latching order
 @param n_m     in: number of mutexes to protect the hash table;
                must be a power of 2, or 0 */
-# define ha_create(n_c,n_m,type,level) ha_create_func(n_c,level,n_m,type)
+# define ib_create(n_c,n_m,type,level) ha_create_func(n_c,level,n_m,type)
 #else /* UNIV_SYNC_DEBUG */
 /** Creates a hash table.
 @return                own: created table
@@ -116,7 +116,7 @@ chosen to be a slightly bigger prime number.
 @param level   in: level of the mutexes in the latching order
 @param n_m     in: number of mutexes to protect the hash table;
                must be a power of 2, or 0 */
-# define ha_create(n_c,n_m,type,level) ha_create_func(n_c,n_m,type)
+# define ib_create(n_c,n_m,type,level) ha_create_func(n_c,n_m,type)
 #endif /* UNIV_SYNC_DEBUG */
 
 /*************************************************************//**
index f047302c60c84fecedc72e6a498502e65760b3cc..76a389f9051f5e4e0f9405c495510754f5cb2a11 100644 (file)
@@ -1,6 +1,6 @@
 /***********************************************************************
 
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
 Copyright (c) 2009, Percona Inc.
 
 Portions of this file contain modifications contributed and copyrighted
@@ -89,6 +89,16 @@ typedef int  os_file_t;
 # define OS_FILE_FROM_FD(fd) fd
 #endif
 
+/*Common file descriptor for file IO instrumentation with PFS
+on windows and other platforms */
+struct pfs_os_file_t
+{
+       os_file_t   m_file;
+#ifdef UNIV_PFS_IO
+       struct PSI_file *m_psi;
+#endif
+};
+
 /** Umask for creating files */
 extern ulint   os_innodb_umask;
 
@@ -216,6 +226,8 @@ extern mysql_pfs_key_t      innodb_file_temp_key;
 various file I/O operations with performance schema.
 1) register_pfs_file_open_begin() and register_pfs_file_open_end() are
 used to register file creation, opening, closing and renaming.
+2) register_pfs_file_rename_begin() and  register_pfs_file_rename_end()
+are used to register file renaming
 2) register_pfs_file_io_begin() and register_pfs_file_io_end() are
 used to register actual file read, write and flush
 3) register_pfs_file_close_begin() and register_pfs_file_close_end()
@@ -225,17 +237,30 @@ are used to register file deletion operations*/
 do {                                                                   \
        locker = PSI_FILE_CALL(get_thread_file_name_locker)(            \
                state, key, op, name, &locker);                         \
-       if (UNIV_LIKELY(locker != NULL)) {                              \
+       if (locker != NULL) {                           \
                PSI_FILE_CALL(start_file_open_wait)(                    \
                        locker, src_file, src_line);                    \
        }                                                               \
 } while (0)
 
-# define register_pfs_file_open_end(locker, file)                      \
+# define register_pfs_file_open_end(locker, file, result)              \
 do {                                                                   \
-       if (UNIV_LIKELY(locker != NULL)) {                              \
-               PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(\
-                       locker, file);                                  \
+       if (locker != NULL) {                           \
+               file.m_psi = PSI_FILE_CALL(                             \
+               end_file_open_wait)(            \
+                       locker, result);                                        \
+       }                                                               \
+} while (0)
+
+# define register_pfs_file_rename_begin(state, locker, key, op, name,  \
+                               src_file, src_line)                     \
+       register_pfs_file_open_begin(state, locker, key, op, name,      \
+                                       src_file, src_line)             \
+
+# define register_pfs_file_rename_end(locker, result)                  \
+do {                                                                   \
+       if (locker != NULL) {                           \
+               PSI_FILE_CALL(end_file_open_wait)(locker, result);      \
        }                                                               \
 } while (0)
 
@@ -261,9 +286,9 @@ do {                                                                        \
 # define register_pfs_file_io_begin(state, locker, file, count, op,    \
                                    src_file, src_line)                 \
 do {                                                                   \
-       locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(      \
-               state, file, op);                                       \
-       if (UNIV_LIKELY(locker != NULL)) {                              \
+       locker = PSI_FILE_CALL(get_thread_file_stream_locker)(  \
+               state, file.m_psi, op);                                 \
+       if (locker != NULL) {                           \
                PSI_FILE_CALL(start_file_wait)(                         \
                        locker, count, src_file, src_line);             \
        }                                                               \
@@ -271,7 +296,7 @@ do {                                                                        \
 
 # define register_pfs_file_io_end(locker, count)                       \
 do {                                                                   \
-       if (UNIV_LIKELY(locker != NULL)) {                              \
+       if (locker != NULL) {                           \
                PSI_FILE_CALL(end_file_wait)(locker, count);            \
        }                                                               \
 } while (0)
@@ -289,7 +314,9 @@ os_file_rename
 os_aio
 os_file_read
 os_file_read_no_error_handling
+os_file_read_no_error_handling_int_fd
 os_file_write
+os_file_write_int_fd
 
 The wrapper functions have the prefix of "innodb_". */
 
@@ -307,7 +334,7 @@ The wrapper functions have the prefix of "innodb_". */
        pfs_os_file_create_simple_no_error_handling_func(               \
                key, name, create_mode, access, success, __FILE__, __LINE__)
 
-# define os_file_close(file)                                           \
+# define os_file_close_pfs(file)                                               \
        pfs_os_file_close_func(file, __FILE__, __LINE__)
 
 # define os_aio(type, mode, name, file, buf, offset,                   \
@@ -315,18 +342,27 @@ The wrapper functions have the prefix of "innodb_". */
        pfs_os_aio_func(type, mode, name, file, buf, offset,            \
                        n, message1, message2, __FILE__, __LINE__)
 
-# define os_file_read(file, buf, offset, n)                            \
+# define os_file_read_pfs(file, buf, offset, n)                                \
        pfs_os_file_read_func(file, buf, offset, n, __FILE__, __LINE__)
 
 # define os_file_read_no_error_handling(file, buf, offset, n)          \
        pfs_os_file_read_no_error_handling_func(file, buf, offset, n,   \
                                                __FILE__, __LINE__)
 
-# define os_file_write(name, file, buf, offset, n)     \
+# define os_file_read_no_error_handling_int_fd(                         \
+       file, buf, offset, n)                                           \
+       pfs_os_file_read_no_error_handling_int_fd_func(                 \
+               file, buf, offset, n, __FILE__, __LINE__)
+
+# define os_file_write_pfs(name, file, buf, offset, n) \
        pfs_os_file_write_func(name, file, buf, offset, \
                               n, __FILE__, __LINE__)
 
-# define os_file_flush(file)                                           \
+# define os_file_write_int_fd(name, file, buf, offset, n)              \
+       pfs_os_file_write_int_fd_func(name, file, buf, offset,          \
+               n, __FILE__, __LINE__)
+
+# define os_file_flush_pfs(file)                                               \
        pfs_os_file_flush_func(file, __FILE__, __LINE__)
 
 # define os_file_rename(key, oldpath, newpath)                         \
@@ -352,22 +388,29 @@ to original un-instrumented file I/O APIs */
        os_file_create_simple_no_error_handling_func(                   \
                name, create_mode, access, success)
 
-# define os_file_close(file)   os_file_close_func(file)
+# define os_file_close_pfs(file)                                               \
+       os_file_close_func(file)
 
 # define os_aio(type, mode, name, file, buf, offset, n, message1, message2) \
        os_aio_func(type, mode, name, file, buf, offset, n,             \
                    message1, message2)
 
-# define os_file_read(file, buf, offset, n)    \
+# define os_file_read_pfs(file, buf, offset, n)        \
        os_file_read_func(file, buf, offset, n)
 
 # define os_file_read_no_error_handling(file, buf, offset, n)          \
        os_file_read_no_error_handling_func(file, buf, offset, n)
+# define os_file_read_no_error_handling_int_fd(                         \
+               file, buf, offset, n)                                   \
+        os_file_read_no_error_handling_func(file, buf, offset, n)
 
-# define os_file_write(name, file, buf, offset, n)                     \
+# define os_file_write_int_fd(name, file, buf, offset, n)               \
+       os_file_write_func(name, file, buf, offset, n)
+# define os_file_write_pfs(name, file, buf, offset, n)                 \
        os_file_write_func(name, file, buf, offset, n)
 
-# define os_file_flush(file)   os_file_flush_func(file)
+
+# define os_file_flush_pfs(file)       os_file_flush_func(file)
 
 # define os_file_rename(key, oldpath, newpath)                         \
        os_file_rename_func(oldpath, newpath)
@@ -379,6 +422,33 @@ to original un-instrumented file I/O APIs */
 
 #endif /* UNIV_PFS_IO */
 
+#ifdef UNIV_PFS_IO
+       #define os_file_close(file) os_file_close_pfs(file)
+#else
+       #define os_file_close(file) os_file_close_pfs((file).m_file)
+#endif
+
+#ifdef UNIV_PFS_IO
+       #define os_file_read(file, buf, offset, n)              \
+                       os_file_read_pfs(file, buf, offset, n)
+#else
+       #define os_file_read(file, buf, offset, n)              \
+                       os_file_read_pfs(file.m_file, buf, offset, n)
+#endif
+
+#ifdef UNIV_PFS_IO
+       #define os_file_flush(file)     os_file_flush_pfs(file)
+#else
+       #define os_file_flush(file)     os_file_flush_pfs(file.m_file)
+#endif
+
+#ifdef UNIV_PFS_IO
+       #define os_file_write(name, file, buf, offset, n)                      \
+                       os_file_write_pfs(name, file, buf, offset, n)
+#else
+       #define os_file_write(name, file, buf, offset, n)                      \
+                       os_file_write_pfs(name, file.m_file, buf, offset, n)
+#endif
 /* File types for directory entry data type */
 
 enum os_file_type_t {
@@ -518,7 +588,7 @@ A simple function to open or create a file.
 @return own: handle to the file, not defined if error, error number
 can be retrieved with os_file_get_last_error */
 UNIV_INTERN
-os_file_t
+pfs_os_file_t
 os_file_create_simple_no_error_handling_func(
 /*=========================================*/
        const char*     name,   /*!< in: name of the file or path as a
@@ -548,7 +618,7 @@ Opens an existing file or creates a new.
 @return own: handle to the file, not defined if error, error number
 can be retrieved with os_file_get_last_error */
 UNIV_INTERN
-os_file_t
+pfs_os_file_t
 os_file_create_func(
 /*================*/
        const char*     name,   /*!< in: name of the file or path as a
@@ -617,7 +687,7 @@ os_file_create_simple() which opens or creates a file.
 @return own: handle to the file, not defined if error, error number
 can be retrieved with os_file_get_last_error */
 UNIV_INLINE
-os_file_t
+pfs_os_file_t
 pfs_os_file_create_simple_func(
 /*===========================*/
        mysql_pfs_key_t key,    /*!< in: Performance Schema Key */
@@ -640,7 +710,7 @@ monitor file creation/open.
 @return own: handle to the file, not defined if error, error number
 can be retrieved with os_file_get_last_error */
 UNIV_INLINE
-os_file_t
+pfs_os_file_t
 pfs_os_file_create_simple_no_error_handling_func(
 /*=============================================*/
        mysql_pfs_key_t key,    /*!< in: Performance Schema Key */
@@ -664,7 +734,7 @@ Add instrumentation to monitor file creation/open.
 @return own: handle to the file, not defined if error, error number
 can be retrieved with os_file_get_last_error */
 UNIV_INLINE
-os_file_t
+pfs_os_file_t
 pfs_os_file_create_func(
 /*====================*/
        mysql_pfs_key_t key,    /*!< in: Performance Schema Key */
@@ -693,7 +763,7 @@ UNIV_INLINE
 ibool
 pfs_os_file_close_func(
 /*===================*/
-        os_file_t      file,   /*!< in, own: handle to a file */
+        pfs_os_file_t  file,   /*!< in, own: handle to a file */
        const char*     src_file,/*!< in: file name where func invoked */
        ulint           src_line);/*!< in: line where the func invoked */
 /*******************************************************************//**
@@ -706,7 +776,7 @@ UNIV_INLINE
 ibool
 pfs_os_file_read_func(
 /*==================*/
-       os_file_t       file,   /*!< in: handle to a file */
+       pfs_os_file_t   file,   /*!< in: handle to a file */
        void*           buf,    /*!< in: buffer where to read */
        os_offset_t     offset, /*!< in: file offset where to read */
        ulint           n,      /*!< in: number of bytes to read */
@@ -724,7 +794,7 @@ UNIV_INLINE
 ibool
 pfs_os_file_read_no_error_handling_func(
 /*====================================*/
-       os_file_t       file,   /*!< in: handle to a file */
+       pfs_os_file_t   file,   /*!< in: handle to a file */
        void*           buf,    /*!< in: buffer where to read */
        os_offset_t     offset, /*!< in: file offset where to read */
        ulint           n,      /*!< in: number of bytes to read */
@@ -745,7 +815,7 @@ pfs_os_aio_func(
        ulint           mode,   /*!< in: OS_AIO_NORMAL etc. I/O mode */
        const char*     name,   /*!< in: name of the file or path as a
                                null-terminated string */
-       os_file_t       file,   /*!< in: handle to a file */
+       pfs_os_file_t   file,   /*!< in: handle to a file */
        void*           buf,    /*!< in: buffer where to read or from which
                                to write */
        os_offset_t     offset, /*!< in: file offset where to read or write */
@@ -772,7 +842,7 @@ pfs_os_file_write_func(
 /*===================*/
        const char*     name,   /*!< in: name of the file or path as a
                                null-terminated string */
-       os_file_t       file,   /*!< in: handle to a file */
+       pfs_os_file_t   file,   /*!< in: handle to a file */
        const void*     buf,    /*!< in: buffer from which to write */
        os_offset_t     offset, /*!< in: file offset where to write */
        ulint           n,      /*!< in: number of bytes to write */
@@ -789,7 +859,7 @@ UNIV_INLINE
 ibool
 pfs_os_file_flush_func(
 /*===================*/
-       os_file_t       file,   /*!< in, own: handle to a file */
+       pfs_os_file_t   file,   /*!< in, own: handle to a file */
        const char*     src_file,/*!< in: file name where func invoked */
        ulint           src_line);/*!< in: line where the func invoked */
 
@@ -860,7 +930,7 @@ UNIV_INTERN
 os_offset_t
 os_file_get_size(
 /*=============*/
-       os_file_t       file)   /*!< in: handle to a file */
+       pfs_os_file_t   file)   /*!< in: handle to a file */
        MY_ATTRIBUTE((warn_unused_result));
 /***********************************************************************//**
 Write the specified number of zeros to a newly created file.
@@ -871,7 +941,7 @@ os_file_set_size(
 /*=============*/
        const char*     name,   /*!< in: name of the file or path as a
                                null-terminated string */
-       os_file_t       file,   /*!< in: handle to a file */
+       pfs_os_file_t   file,   /*!< in: handle to a file */
        os_offset_t     size)   /*!< in: file size */
        MY_ATTRIBUTE((nonnull, warn_unused_result));
 /***********************************************************************//**
@@ -1109,7 +1179,7 @@ os_aio_func(
                                caution! */
        const char*     name,   /*!< in: name of the file or path as a
                                null-terminated string */
-       os_file_t       file,   /*!< in: handle to a file */
+       pfs_os_file_t   file,   /*!< in: handle to a file */
        void*           buf,    /*!< in: buffer where to read or from which
                                to write */
        os_offset_t     offset, /*!< in: file offset where to read or write */
index defd8204ba371850452d141b821dd65887a7b1c9..31d5cc1d6a22f4dbe5dc441c4cd2b222e76d0539 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 2010, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2010, 2017, 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
@@ -34,7 +34,7 @@ os_file_create_simple() which opens or creates a file.
 @return own: handle to the file, not defined if error, error number
 can be retrieved with os_file_get_last_error */
 UNIV_INLINE
-os_file_t
+pfs_os_file_t
 pfs_os_file_create_simple_func(
 /*===========================*/
        mysql_pfs_key_t key,    /*!< in: Performance Schema Key */
@@ -47,7 +47,7 @@ pfs_os_file_create_simple_func(
        const char*     src_file,/*!< in: file name where func invoked */
        ulint           src_line)/*!< in: line where the func invoked */
 {
-       os_file_t       file;
+       pfs_os_file_t   file;
        struct PSI_file_locker* locker = NULL;
        PSI_file_locker_state   state;
 
@@ -58,11 +58,13 @@ pfs_os_file_create_simple_func(
                                        : PSI_FILE_OPEN),
                                     name, src_file, src_line);
 
-       file = os_file_create_simple_func(name, create_mode,
+       file.m_file = os_file_create_simple_func(name, create_mode,
                                          access_type, success);
+       file.m_psi = NULL;
 
-       /* Regsiter the returning "file" value with the system */
-       register_pfs_file_open_end(locker, file);
+       /* Regsiter psi value for the file */
+       register_pfs_file_open_end(locker, file,
+                               (*success == TRUE ? success : 0));
 
        return(file);
 }
@@ -76,7 +78,7 @@ monitor file creation/open.
 @return own: handle to the file, not defined if error, error number
 can be retrieved with os_file_get_last_error */
 UNIV_INLINE
-os_file_t
+pfs_os_file_t
 pfs_os_file_create_simple_no_error_handling_func(
 /*=============================================*/
        mysql_pfs_key_t key,    /*!< in: Performance Schema Key */
@@ -91,7 +93,7 @@ pfs_os_file_create_simple_no_error_handling_func(
        const char*     src_file,/*!< in: file name where func invoked */
        ulint           src_line)/*!< in: line where the func invoked */
 {
-       os_file_t       file;
+       pfs_os_file_t   file;
        struct PSI_file_locker* locker = NULL;
        PSI_file_locker_state   state;
 
@@ -104,8 +106,10 @@ pfs_os_file_create_simple_no_error_handling_func(
 
        file = os_file_create_simple_no_error_handling_func(
                name, create_mode, access_type, success);
+       file.m_psi = NULL;
 
-       register_pfs_file_open_end(locker, file);
+       register_pfs_file_open_end(locker, file,
+                                (*success == TRUE ? success : 0));
 
        return(file);
 }
@@ -118,7 +122,7 @@ Add instrumentation to monitor file creation/open.
 @return own: handle to the file, not defined if error, error number
 can be retrieved with os_file_get_last_error */
 UNIV_INLINE
-os_file_t
+pfs_os_file_t
 pfs_os_file_create_func(
 /*====================*/
        mysql_pfs_key_t key,    /*!< in: Performance Schema Key */
@@ -137,7 +141,7 @@ pfs_os_file_create_func(
        const char*     src_file,/*!< in: file name where func invoked */
        ulint           src_line)/*!< in: line where the func invoked */
 {
-       os_file_t       file;
+       pfs_os_file_t   file;
        struct PSI_file_locker* locker = NULL;
        PSI_file_locker_state   state;
 
@@ -149,8 +153,10 @@ pfs_os_file_create_func(
                                     name, src_file, src_line);
 
        file = os_file_create_func(name, create_mode, purpose, type, success);
+       file.m_psi = NULL;
 
-       register_pfs_file_open_end(locker, file);
+       register_pfs_file_open_end(locker, file,
+                               (*success == TRUE ? success : 0));
 
        return(file);
 }
@@ -164,7 +170,7 @@ UNIV_INLINE
 ibool
 pfs_os_file_close_func(
 /*===================*/
-        os_file_t      file,   /*!< in, own: handle to a file */
+        pfs_os_file_t  file,   /*!< in, own: handle to a file */
        const char*     src_file,/*!< in: file name where func invoked */
        ulint           src_line)/*!< in: line where the func invoked */
 {
@@ -176,7 +182,7 @@ pfs_os_file_close_func(
        register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_CLOSE,
                                   src_file, src_line);
 
-       result = os_file_close_func(file);
+       result = os_file_close_func(file.m_file);
 
        register_pfs_file_io_end(locker, 0);
 
@@ -197,7 +203,7 @@ pfs_os_aio_func(
        ulint           mode,   /*!< in: OS_AIO_NORMAL etc. I/O mode */
        const char*     name,   /*!< in: name of the file or path as a
                                null-terminated string */
-       os_file_t       file,   /*!< in: handle to a file */
+       pfs_os_file_t   file,   /*!< in: handle to a file */
        void*           buf,    /*!< in: buffer where to read or from which
                                to write */
        os_offset_t     offset, /*!< in: file offset where to read or write */
@@ -242,7 +248,7 @@ UNIV_INLINE
 ibool
 pfs_os_file_read_func(
 /*==================*/
-       os_file_t       file,   /*!< in: handle to a file */
+       pfs_os_file_t   file,   /*!< in: handle to a file */
        void*           buf,    /*!< in: buffer where to read */
        os_offset_t     offset, /*!< in: file offset where to read */
        ulint           n,      /*!< in: number of bytes to read */
@@ -256,7 +262,7 @@ pfs_os_file_read_func(
        register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ,
                                   src_file, src_line);
 
-       result = os_file_read_func(file, buf, offset, n);
+       result = os_file_read_func(file.m_file, buf, offset, n);
 
        register_pfs_file_io_end(locker, n);
 
@@ -275,7 +281,7 @@ UNIV_INLINE
 ibool
 pfs_os_file_read_no_error_handling_func(
 /*====================================*/
-       os_file_t       file,   /*!< in: handle to a file */
+       pfs_os_file_t   file,   /*!< in: handle to a file */
        void*           buf,    /*!< in: buffer where to read */
        os_offset_t     offset, /*!< in: file offset where to read */
        ulint           n,      /*!< in: number of bytes to read */
@@ -289,13 +295,50 @@ pfs_os_file_read_no_error_handling_func(
        register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ,
                                   src_file, src_line);
 
-       result = os_file_read_no_error_handling_func(file, buf, offset, n);
+       result = os_file_read_no_error_handling_func(file.m_file, buf, offset, n);
 
        register_pfs_file_io_end(locker, n);
 
        return(result);
 }
 
+/** NOTE! Please use the corresponding macro
+os_file_read_no_error_handling_int_fd(), not directly this function!
+This is the performance schema instrumented wrapper function for
+os_file_read_no_error_handling_int_fd_func() which requests a
+synchronous  read operation.
+@return TRUE if request was successful, FALSE if fail */
+UNIV_INLINE
+ibool
+pfs_os_file_read_no_error_handling_int_fd_func(
+        int             file,  /*!< in: handle to a file */
+        void*           buf,   /*!< in: buffer where to read */
+        os_offset_t     offset,        /*!< in: file offset where to read */
+        ulint           n,     /*!< in: number of bytes to read */
+        const char*     src_file,/*!< in: file name where func invoked */
+        ulint           src_line)/*!< in: line where the func invoked */
+{
+               
+               PSI_file_locker_state   state;
+               struct PSI_file_locker* locker = NULL;
+
+               locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(
+                                &state, file, PSI_FILE_READ);
+               if (locker != NULL) {
+               PSI_FILE_CALL(start_file_wait)(
+                               locker, n,
+                               __FILE__, __LINE__);
+                       }
+       ibool result = os_file_read_no_error_handling_func(
+                                OS_FILE_FROM_FD(file), buf, offset, n);
+
+               if (locker != NULL) {
+                PSI_FILE_CALL(end_file_wait)(locker, n);
+        }
+
+       return(result);
+}
+
 /*******************************************************************//**
 NOTE! Please use the corresponding macro os_file_write(), not directly
 this function!
@@ -308,7 +351,7 @@ pfs_os_file_write_func(
 /*===================*/
        const char*     name,   /*!< in: name of the file or path as a
                                null-terminated string */
-       os_file_t       file,   /*!< in: handle to a file */
+       pfs_os_file_t   file,   /*!< in: handle to a file */
        const void*     buf,    /*!< in: buffer from which to write */
        os_offset_t     offset, /*!< in: file offset where to write */
        ulint           n,      /*!< in: number of bytes to write */
@@ -322,13 +365,50 @@ pfs_os_file_write_func(
        register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_WRITE,
                                   src_file, src_line);
 
-       result = os_file_write_func(name, file, buf, offset, n);
+       result = os_file_write_func(name, file.m_file, buf, offset, n);
 
        register_pfs_file_io_end(locker, n);
 
        return(result);
 }
 
+/** NOTE! Please use the corresponding macro os_file_write(), not
+directly this function!
+This is the performance schema instrumented wrapper function for
+os_file_write() which requests a synchronous write operation.
+@return TRUE if request was successful, FALSE if fail */
+UNIV_INLINE
+ibool
+pfs_os_file_write_int_fd_func(
+        const char*     name,  /*!< in: name of the file or path as a
+                                null-terminated string */
+        int             file,  /*!< in: handle to a file */
+        const void*     buf,   /*!< in: buffer from which to write */
+        os_offset_t     offset,        /*!< in: file offset where to write */
+        ulint           n,     /*!< in: number of bytes to write */
+        const char*     src_file,/*!< in: file name where func invoked */
+        ulint           src_line)/*!< in: line where the func invoked */
+{
+       PSI_file_locker_state   state;
+       struct PSI_file_locker* locker = NULL;
+
+       locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(
+                       &state, file, PSI_FILE_WRITE);
+       if (locker != NULL) {
+                PSI_FILE_CALL(start_file_wait)(
+                                locker, n,
+                                __FILE__, __LINE__);
+                }
+        ibool result = os_file_write_func(
+                                name, OS_FILE_FROM_FD(file), buf, offset, n);
+
+        if (locker != NULL) {
+                PSI_FILE_CALL(end_file_wait)(locker, n);
+        }
+
+        return(result);
+}
+
 /***********************************************************************//**
 NOTE! Please use the corresponding macro os_file_flush(), not directly
 this function!
@@ -339,7 +419,7 @@ UNIV_INLINE
 ibool
 pfs_os_file_flush_func(
 /*===================*/
-       os_file_t       file,   /*!< in, own: handle to a file */
+       pfs_os_file_t   file,   /*!< in, own: handle to a file */
        const char*     src_file,/*!< in: file name where func invoked */
        ulint           src_line)/*!< in: line where the func invoked */
 {
@@ -349,7 +429,7 @@ pfs_os_file_flush_func(
 
        register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_SYNC,
                                   src_file, src_line);
-       result = os_file_flush_func(file);
+       result = os_file_flush_func(file.m_file);
 
        register_pfs_file_io_end(locker, 0);
 
@@ -377,12 +457,12 @@ pfs_os_file_rename_func(
        struct PSI_file_locker* locker = NULL;
        PSI_file_locker_state   state;
 
-       register_pfs_file_open_begin(&state, locker, key, PSI_FILE_RENAME, newpath,
+       register_pfs_file_rename_begin(&state, locker, key, PSI_FILE_RENAME, newpath,
                                     src_file, src_line);
 
        result = os_file_rename_func(oldpath, newpath);
 
-       register_pfs_file_open_end(locker, 0);
+       register_pfs_file_rename_end(locker, 0);
 
        return(result);
 }
index fc1846b76f31226fa1b1769623a4c1f6f6d7b7a9..d0c1bdaa585e3da4792b6bf5ccad11a78b2de792 100644 (file)
@@ -652,6 +652,8 @@ struct mysql_row_templ_t {
 #define ROW_PREBUILT_ALLOCATED 78540783
 #define ROW_PREBUILT_FREED     26423527
 
+class ha_innobase;
+
 /** A struct for (sometimes lazily) prebuilt structures in an Innobase table
 handle used within MySQL; these are used to save CPU time. */
 
@@ -879,6 +881,12 @@ struct row_prebuilt_t {
                                        to InnoDB format.*/
        uint            srch_key_val_len; /*!< Size of search key */
 
+       /** MySQL handler object. */
+       ha_innobase*    mysql_handler;
+
+       /** True if exceeded the end_range while filling the prefetch cache. */
+       bool            end_range;
+
 };
 
 /** Callback for row_mysql_sys_index_iterate() */
index 29557a1b8916abfe1de2a9355b3f4c5881adcdb0..d92e24605983950f1dec470f1e569243a7cf6667 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
 Copyright (c) 2008, 2009, Google Inc.
 Copyright (c) 2009, Percona Inc.
 
@@ -789,6 +789,13 @@ void
 srv_purge_wakeup(void);
 /*==================*/
 
+/** Check whether given space id is undo tablespace id
+@param[in]     space_id        space id to check
+@return true if it is undo tablespace else false. */
+bool
+srv_is_undo_tablespace(
+       ulint   space_id);
+
 /** Status variables to be passed to MySQL */
 struct export_var_t{
        ulint innodb_data_pending_reads;        /*!< Pending reads */
index 963b767f0fb5b7db93251efca8b5d67eef0c8c9c..a60776a46657ace30e0ffa03fed8297a9cd1685c 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, 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
@@ -139,6 +139,8 @@ extern      ibool   srv_startup_is_before_trx_rollback_phase;
 /** TRUE if a raw partition is in use */
 extern ibool   srv_start_raw_disk_in_use;
 
+/** Undo tablespaces starts with space_id. */
+extern ulint   srv_undo_space_id_start;
 
 /** Shutdown state */
 enum srv_shutdown_state {
index 7caddfb7ba4ad52818a167b76b06e824fed40ac4..255431293f5add2b493a871e91db973b6468b0c9 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2009, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2016, 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
@@ -24,6 +24,8 @@ this program; if not, write to the Free Software Foundation, Inc.,
 #ifndef        XA_H
 #define        XA_H
 
+#include "xa.h"
+
 /*
  * Transaction branch identification: XID and NULLXID:
  */
@@ -35,17 +37,6 @@ this program; if not, write to the Free Software Foundation, Inc.,
 #define        MAXGTRIDSIZE     64             /*!< maximum size in bytes of gtrid */
 #define        MAXBQUALSIZE     64             /*!< maximum size in bytes of bqual */
 
-/** X/Open XA distributed transaction identifier */
-struct xid_t {
-       long formatID;                  /*!< format identifier; -1
-                                       means that the XID is null */
-       long gtrid_length;              /*!< value from 1 through 64 */
-       long bqual_length;              /*!< value from 1 through 64 */
-       char data[XIDDATASIZE];         /*!< distributed transaction
-                                       identifier */
-};
-/** X/Open XA distributed transaction identifier */
-typedef        struct xid_t XID;
 #endif
 /** X/Open XA distributed transaction status codes */
 /* @{ */
index dfb59673f0be2d8d6c43f5b646e2fbbe60a7c9f4..5d3dcafb3228ea859748a2fd2031726328593655 100644 (file)
@@ -133,14 +133,8 @@ HAVE_PSI_INTERFACE is defined. */
 #if defined HAVE_PSI_INTERFACE && !defined UNIV_HOTBACKUP
 # define UNIV_PFS_MUTEX
 # define UNIV_PFS_RWLOCK
-/* For I/O instrumentation, performance schema rely
-on a native descriptor to identify the file, this
-descriptor could conflict with our OS level descriptor.
-Disable IO instrumentation on Windows until this is
-resolved */
-# ifndef __WIN__
-#  define UNIV_PFS_IO
-# endif
+
+# define UNIV_PFS_IO
 # define UNIV_PFS_THREAD
 
 /* There are mutexes/rwlocks that we want to exclude from
index 8ff8e39d352bb2ec1366e07120e6399bc24f6a0b..51b057ec09aab30f83fed66961fc68c1690367fe 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
 Copyright (c) 2009, Google Inc.
 
 Portions of this file contain modifications contributed and copyrighted by
@@ -3406,7 +3406,12 @@ loop:
 
        lsn = log_sys->lsn;
 
-       if (lsn != log_sys->last_checkpoint_lsn
+       const bool      is_last = ((srv_force_recovery == SRV_FORCE_NO_LOG_REDO
+                                   && lsn == log_sys->last_checkpoint_lsn
+                                               + LOG_BLOCK_HDR_SIZE)
+                                  || lsn == log_sys->last_checkpoint_lsn);
+
+       if (!is_last
 #ifdef UNIV_LOG_ARCHIVE
            || (srv_log_archive_on
                && lsn != log_sys->archived_lsn + LOG_BLOCK_HDR_SIZE)
index 85f4f6ea6715d66bff3491f5566af6ff2fcb259b..69d74a99ab53fdb7b23df512fccb7d606f97490e 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
 Copyright (c) 2012, Facebook Inc.
 
 This program is free software; you can redistribute it and/or modify it under
@@ -332,6 +332,7 @@ DECLARE_THREAD(recv_writer_thread)(
                        /*!< in: a dummy parameter required by
                        os_thread_create */
 {
+       my_thread_init();
        ut_ad(!srv_read_only_mode);
 
 #ifdef UNIV_PFS_THREAD
@@ -364,6 +365,7 @@ DECLARE_THREAD(recv_writer_thread)(
 
        recv_writer_thread_active = false;
 
+       my_thread_end();
        /* We count the number of threads in os_thread_exit().
        A created thread should always use that to exit and not
        use return() to exit. */
index 1219716d381c94f4e329e5e70f37db7dd8ce4d24..5e97dfa9553f196a149842389d19a72ad086b545 100644 (file)
@@ -1,6 +1,6 @@
 /***********************************************************************
 
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
 Copyright (c) 2009, Percona Inc.
 
 Portions of this file contain modifications contributed and copyrighted
@@ -169,7 +169,7 @@ struct os_aio_slot_t{
        byte*           buf;            /*!< buffer used in i/o */
        ulint           type;           /*!< OS_FILE_READ or OS_FILE_WRITE */
        os_offset_t     offset;         /*!< file offset in bytes */
-       os_file_t       file;           /*!< file where to read or write */
+       pfs_os_file_t   file;           /*!< file where to read or write */
        const char*     name;           /*!< file name or path */
        ibool           io_already_done;/*!< used only in simulated aio:
                                        TRUE if the physical i/o already
@@ -1316,7 +1316,7 @@ A simple function to open or create a file.
 @return own: handle to the file, not defined if error, error number
 can be retrieved with os_file_get_last_error */
 UNIV_INTERN
-os_file_t
+pfs_os_file_t
 os_file_create_simple_no_error_handling_func(
 /*=========================================*/
        const char*     name,   /*!< in: name of the file or path as a
@@ -1328,7 +1328,7 @@ os_file_create_simple_no_error_handling_func(
                                used by a backup program reading the file */
        ibool*          success)/*!< out: TRUE if succeed, FALSE if error */
 {
-       os_file_t       file;
+       pfs_os_file_t   file;
 
        *success = FALSE;
 #ifdef __WIN__
@@ -1336,7 +1336,6 @@ os_file_create_simple_no_error_handling_func(
        DWORD           create_flag;
        DWORD           attributes      = 0;
        DWORD           share_mode      = FILE_SHARE_READ;
-
        ut_a(name);
 
        ut_a(!(create_mode & OS_FILE_ON_ERROR_SILENT));
@@ -1353,8 +1352,8 @@ os_file_create_simple_no_error_handling_func(
                ib_logf(IB_LOG_LEVEL_ERROR,
                        "Unknown file create mode (%lu) for file '%s'",
                        create_mode, name);
-
-               return((os_file_t) -1);
+               file.m_file = (os_file_t)-1;
+               return(file);
        }
 
        if (access_type == OS_FILE_READ_ONLY) {
@@ -1377,11 +1376,11 @@ os_file_create_simple_no_error_handling_func(
                ib_logf(IB_LOG_LEVEL_ERROR,
                        "Unknown file access type (%lu) for file '%s'",
                        access_type, name);
-
-               return((os_file_t) -1);
+               file.m_file = (os_file_t)-1;
+               return(file);
        }
 
-       file = CreateFile((LPCTSTR) name,
+       file.m_file = CreateFile((LPCTSTR) name,
                          access,
                          share_mode,
                          NULL,                 // Security attributes
@@ -1389,11 +1388,10 @@ os_file_create_simple_no_error_handling_func(
                          attributes,
                          NULL);                // No template file
 
-       *success = (file != INVALID_HANDLE_VALUE);
+       *success = (file.m_file != INVALID_HANDLE_VALUE);
 #else /* __WIN__ */
        int             create_flag;
        const char*     mode_str        = NULL;
-
        ut_a(name);
        if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW)
                WAIT_ALLOW_WRITES();
@@ -1437,13 +1435,13 @@ os_file_create_simple_no_error_handling_func(
                ib_logf(IB_LOG_LEVEL_ERROR,
                        "Unknown file create mode (%lu) for file '%s'",
                        create_mode, name);
-
-               return((os_file_t) -1);
+               file.m_file = -1;
+               return(file);
        }
 
-       file = ::open(name, create_flag, os_innodb_umask);
+       file.m_file = ::open(name, create_flag, os_innodb_umask);
 
-       *success = file == -1 ? FALSE : TRUE;
+       *success = file.m_file == -1 ? FALSE : TRUE;
 
        /* This function is always called for data files, we should disable
        OS caching (O_DIRECT) here as we do in os_file_create_func(), so
@@ -1453,18 +1451,18 @@ os_file_create_simple_no_error_handling_func(
            && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
                || srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) {
 
-               os_file_set_nocache(file, name, mode_str);
+               os_file_set_nocache(file.m_file, name, mode_str);
        }
 
 #ifdef USE_FILE_LOCK
        if (!srv_read_only_mode
            && *success
            && access_type == OS_FILE_READ_WRITE
-           && os_file_lock(file, name)) {
+           && os_file_lock(file.m_file, name)) {
 
                *success = FALSE;
-               close(file);
-               file = -1;
+               close(file.m_file);
+               file.m_file = -1;
 
        }
 #endif /* USE_FILE_LOCK */
@@ -1539,7 +1537,7 @@ Opens an existing file or creates a new.
 @return own: handle to the file, not defined if error, error number
 can be retrieved with os_file_get_last_error */
 UNIV_INTERN
-os_file_t
+pfs_os_file_t
 os_file_create_func(
 /*================*/
        const char*     name,   /*!< in: name of the file or path as a
@@ -1555,24 +1553,25 @@ os_file_create_func(
        ulint           type,   /*!< in: OS_DATA_FILE or OS_LOG_FILE */
        ibool*          success)/*!< out: TRUE if succeed, FALSE if error */
 {
-       os_file_t       file;
+       pfs_os_file_t   file;
        ibool           retry;
        ibool           on_error_no_exit;
        ibool           on_error_silent;
-
 #ifdef __WIN__
        DBUG_EXECUTE_IF(
                "ib_create_table_fail_disk_full",
                *success = FALSE;
                SetLastError(ERROR_DISK_FULL);
-               return((os_file_t) -1);
+               file.m_file = (os_file_t)-1;
+               return(file);
        );
 #else /* __WIN__ */
        DBUG_EXECUTE_IF(
                "ib_create_table_fail_disk_full",
                *success = FALSE;
                errno = ENOSPC;
-               return((os_file_t) -1);
+               file.m_file = -1;
+               return(file);
        );
 #endif /* __WIN__ */
 
@@ -1623,7 +1622,8 @@ os_file_create_func(
                        "Unknown file create mode (%lu) for file '%s'",
                        create_mode, name);
 
-               return((os_file_t) -1);
+               file.m_file = (os_file_t)-1;
+               return(file);
        }
 
        DWORD           attributes = 0;
@@ -1648,8 +1648,8 @@ os_file_create_func(
                ib_logf(IB_LOG_LEVEL_ERROR,
                        "Unknown purpose flag (%lu) while opening file '%s'",
                        purpose, name);
-
-               return((os_file_t)(-1));
+               file.m_file = (os_file_t)-1;
+               return(file);
        }
 
 #ifdef UNIV_NON_BUFFERED_IO
@@ -1676,11 +1676,11 @@ os_file_create_func(
 
        do {
                /* Use default security attributes and no template file. */
-               file = CreateFile(
+               file.m_file = CreateFile(
                        (LPCTSTR) name, access, share_mode, NULL,
                        create_flag, attributes, NULL);
 
-               if (file == INVALID_HANDLE_VALUE) {
+               if (file.m_file == INVALID_HANDLE_VALUE) {
                        const char*     operation;
 
                        operation = (create_mode == OS_FILE_CREATE
@@ -1705,9 +1705,6 @@ os_file_create_func(
 #else /* __WIN__ */
        int             create_flag;
        const char*     mode_str        = NULL;
-       if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW)
-               WAIT_ALLOW_WRITES();
-
        on_error_no_exit = create_mode & OS_FILE_ON_ERROR_NO_EXIT
                ? TRUE : FALSE;
        on_error_silent = create_mode & OS_FILE_ON_ERROR_SILENT
@@ -1745,7 +1742,8 @@ os_file_create_func(
                        "Unknown file create mode (%lu) for file '%s'",
                        create_mode, name);
 
-               return((os_file_t) -1);
+               file.m_file = -1;
+               return(file);
        }
 
        ut_a(type == OS_LOG_FILE || type == OS_DATA_FILE);
@@ -1765,9 +1763,9 @@ os_file_create_func(
 #endif /* O_SYNC */
 
        do {
-               file = ::open(name, create_flag, os_innodb_umask);
+               file.m_file = ::open(name, create_flag, os_innodb_umask);
 
-               if (file == -1) {
+               if (file.m_file == -1) {
                        const char*     operation;
 
                        operation = (create_mode == OS_FILE_CREATE
@@ -1797,14 +1795,14 @@ os_file_create_func(
            && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
                || srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) {
 
-               os_file_set_nocache(file, name, mode_str);
+               os_file_set_nocache(file.m_file, name, mode_str);
        }
 
 #ifdef USE_FILE_LOCK
        if (!srv_read_only_mode
            && *success
            && create_mode != OS_FILE_OPEN_RAW
-           && os_file_lock(file, name)) {
+           && os_file_lock(file.m_file, name)) {
 
                if (create_mode == OS_FILE_OPEN_RETRY) {
 
@@ -1816,7 +1814,7 @@ os_file_create_func(
                        for (int i = 0; i < 100; i++) {
                                os_thread_sleep(1000000);
 
-                               if (!os_file_lock(file, name)) {
+                               if (!os_file_lock(file.m_file, name)) {
                                        *success = TRUE;
                                        return(file);
                                }
@@ -1827,8 +1825,8 @@ os_file_create_func(
                }
 
                *success = FALSE;
-               close(file);
-               file = -1;
+               close(file.m_file);
+               file.m_file = -1;
        }
 #endif /* USE_FILE_LOCK */
 
@@ -2103,14 +2101,14 @@ UNIV_INTERN
 os_offset_t
 os_file_get_size(
 /*=============*/
-       os_file_t       file)   /*!< in: handle to a file */
+       pfs_os_file_t   file)   /*!< in: handle to a file */
 {
 #ifdef __WIN__
        os_offset_t     offset;
        DWORD           high;
        DWORD           low;
 
-       low = GetFileSize(file, &high);
+       low = GetFileSize(file.m_file, &high);
 
        if ((low == 0xFFFFFFFF) && (GetLastError() != NO_ERROR)) {
                return((os_offset_t) -1);
@@ -2120,7 +2118,8 @@ os_file_get_size(
 
        return(offset);
 #else
-       return((os_offset_t) lseek(file, 0, SEEK_END));
+       return((os_offset_t) lseek(file.m_file, 0, SEEK_END));
+
 #endif /* __WIN__ */
 }
 
@@ -2133,7 +2132,7 @@ os_file_set_size(
 /*=============*/
        const char*     name,   /*!< in: name of the file or path as a
                                null-terminated string */
-       os_file_t       file,   /*!< in: handle to a file */
+       pfs_os_file_t   file,   /*!< in: handle to a file */
        os_offset_t     size)   /*!< in: file size */
 {
        os_offset_t     current_size;
@@ -4207,7 +4206,7 @@ os_aio_array_reserve_slot(
                                the aio operation */
        void*           message2,/*!< in: message to be passed along with
                                the aio operation */
-       os_file_t       file,   /*!< in: file handle */
+       pfs_os_file_t   file,   /*!< in: file handle */
        const char*     name,   /*!< in: name of the file or path as a
                                null-terminated string */
        void*           buf,    /*!< in: buffer where to read or from which
@@ -4327,10 +4326,10 @@ found:
        iocb = &slot->control;
 
        if (type == OS_FILE_READ) {
-               io_prep_pread(iocb, file, buf, len, aio_offset);
+               io_prep_pread(iocb, file.m_file, buf, len, aio_offset);
        } else {
                ut_a(type == OS_FILE_WRITE);
-               io_prep_pwrite(iocb, file, buf, len, aio_offset);
+               io_prep_pwrite(iocb, file.m_file, buf, len, aio_offset);
        }
 
        iocb->data = (void*) slot;
@@ -4568,7 +4567,7 @@ os_aio_func(
                                caution! */
        const char*     name,   /*!< in: name of the file or path as a
                                null-terminated string */
-       os_file_t       file,   /*!< in: handle to a file */
+       pfs_os_file_t   file,   /*!< in: handle to a file */
        void*           buf,    /*!< in: buffer where to read or from which
                                to write */
        os_offset_t     offset, /*!< in: file offset where to read or write */
@@ -4593,8 +4592,7 @@ os_aio_func(
        ulint           dummy_type;
 #endif /* WIN_ASYNC_IO */
        ulint           wake_later;
-
-       ut_ad(file);
+       ut_ad(file.m_file);
        ut_ad(buf);
        ut_ad(n > 0);
        ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0);
@@ -4626,13 +4624,11 @@ os_aio_func(
                and os_file_write_func() */
 
                if (type == OS_FILE_READ) {
-                       return(os_file_read_func(file, buf, offset, n));
+                       return(os_file_read_func(file.m_file, buf, offset, n));
                }
-
                ut_ad(!srv_read_only_mode);
                ut_a(type == OS_FILE_WRITE);
-
-               return(os_file_write_func(name, file, buf, offset, n));
+               return(os_file_write_func(name, file.m_file, buf, offset, n));
        }
 
 try_again:
@@ -4684,9 +4680,8 @@ try_again:
                        os_n_file_reads++;
                        os_bytes_read_since_printout += n;
 #ifdef WIN_ASYNC_IO
-                       ret = ReadFile(file, buf, (DWORD) n, &len,
+                       ret = ReadFile(file.m_file, buf, (DWORD) n, &len,
                                       &(slot->control));
-
 #elif defined(LINUX_NATIVE_AIO)
                        if (!os_aio_linux_dispatch(array, slot)) {
                                goto err_exit;
@@ -4704,9 +4699,8 @@ try_again:
                if (srv_use_native_aio) {
                        os_n_file_writes++;
 #ifdef WIN_ASYNC_IO
-                       ret = WriteFile(file, buf, (DWORD) n, &len,
+                       ret = WriteFile(file.m_file, buf, (DWORD) n, &len,
                                        &(slot->control));
-
 #elif defined(LINUX_NATIVE_AIO)
                        if (!os_aio_linux_dispatch(array, slot)) {
                                goto err_exit;
@@ -4860,8 +4854,7 @@ os_aio_windows_handle(
                srv_set_io_thread_op_info(
                        orig_seg, "get windows aio return value");
        }
-
-       ret = GetOverlappedResult(slot->file, &(slot->control), &len, TRUE);
+       ret = GetOverlappedResult(slot->file.m_file, &(slot->control), &len, TRUE);
 
        *message1 = slot->message1;
        *message2 = slot->message2;
@@ -4890,7 +4883,8 @@ os_aio_windows_handle(
                and os_file_write APIs, need to register with
                performance schema explicitly here. */
                struct PSI_file_locker* locker = NULL;
-               register_pfs_file_io_begin(locker, slot->file, slot->len,
+               PSI_file_locker_state   state;
+               register_pfs_file_io_begin(&state, locker, slot->file, slot->len,
                                           (slot->type == OS_FILE_WRITE)
                                                ? PSI_FILE_WRITE
                                                : PSI_FILE_READ,
@@ -4901,16 +4895,14 @@ os_aio_windows_handle(
 
                switch (slot->type) {
                case OS_FILE_WRITE:
-                       ret = WriteFile(slot->file, slot->buf,
+                       ret = WriteFile(slot->file.m_file, slot->buf,
                                        (DWORD) slot->len, &len,
                                        &(slot->control));
-
                        break;
                case OS_FILE_READ:
-                       ret = ReadFile(slot->file, slot->buf,
+                       ret = ReadFile(slot->file.m_file, slot->buf,
                                       (DWORD) slot->len, &len,
                                       &(slot->control));
-
                        break;
                default:
                        ut_error;
@@ -4926,8 +4918,7 @@ os_aio_windows_handle(
                        file where we also use async i/o: in Windows
                        we must use the same wait mechanism as for
                        async i/o */
-
-                       ret = GetOverlappedResult(slot->file,
+                       ret = GetOverlappedResult(slot->file.m_file,
                                                  &(slot->control),
                                                  &len, TRUE);
                }
@@ -5374,12 +5365,11 @@ consecutive_loop:
                os_aio_slot_t*  slot;
 
                slot = os_aio_array_get_nth_slot(array, i + segment * n);
-
                if (slot->reserved
                    && slot != aio_slot
                    && slot->offset == aio_slot->offset + aio_slot->len
                    && slot->type == aio_slot->type
-                   && slot->file == aio_slot->file) {
+                   && slot->file.m_file == aio_slot->file.m_file) {
 
                        /* Found a consecutive i/o request */
 
index 54183759e8d31e7a10e85a70fd63b908e459ab4f..4596e2fb95130dc9b6d38b7d198cb03d92a13a02 100644 (file)
@@ -363,9 +363,9 @@ row_log_online_op(
                        goto err_exit;
                }
 
-               ret = os_file_write(
+               ret = os_file_write_int_fd(
                        "(modification log)",
-                       OS_FILE_FROM_FD(log->fd),
+                       log->fd,
                        log->tail.block, byte_offset, srv_sort_buf_size);
                log->tail.blocks++;
                if (!ret) {
@@ -479,9 +479,9 @@ row_log_table_close_func(
                        goto err_exit;
                }
 
-               ret = os_file_write(
+               ret = os_file_write_int_fd(
                        "(modification log)",
-                       OS_FILE_FROM_FD(log->fd),
+                       log->fd,
                        log->tail.block, byte_offset, srv_sort_buf_size);
                log->tail.blocks++;
                if (!ret) {
@@ -2609,11 +2609,10 @@ all_done:
                        goto func_exit;
                }
 
-               success = os_file_read_no_error_handling(
-                       OS_FILE_FROM_FD(index->online_log->fd),
+               success = os_file_read_no_error_handling_int_fd(
+                       index->online_log->fd,
                        index->online_log->head.block, ofs,
                        srv_sort_buf_size);
-
                if (!success) {
                        fprintf(stderr, "InnoDB: unable to read temporary file"
                                " for table %s\n", index->table_name);
@@ -3436,8 +3435,8 @@ all_done:
                        goto func_exit;
                }
 
-               success = os_file_read_no_error_handling(
-                       OS_FILE_FROM_FD(index->online_log->fd),
+               success = os_file_read_no_error_handling_int_fd(
+                       index->online_log->fd,
                        index->online_log->head.block, ofs,
                        srv_sort_buf_size);
 
index f8bea67906c3f35797c63810007a50b5f83efab3..2d63352feaf3c59addf14ff8533ac4b002e4c347 100644 (file)
@@ -869,8 +869,9 @@ row_merge_read(
        }
 #endif /* UNIV_DEBUG */
 
-       success = os_file_read_no_error_handling(OS_FILE_FROM_FD(fd), buf,
+       success = os_file_read_no_error_handling_int_fd(fd, buf,
                                                 ofs, srv_sort_buf_size);
+
 #ifdef POSIX_FADV_DONTNEED
        /* Each block is read exactly once.  Free up the file cache. */
        posix_fadvise(fd, ofs, srv_sort_buf_size, POSIX_FADV_DONTNEED);
@@ -904,7 +905,7 @@ row_merge_write(
 
        DBUG_EXECUTE_IF("row_merge_write_failure", return(FALSE););
 
-       ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf, ofs, buf_len);
+       ret = os_file_write_int_fd("(merge)", fd, buf, ofs, buf_len);
 
 #ifdef UNIV_DEBUG
        if (row_merge_print_block_write) {
@@ -3121,14 +3122,21 @@ row_merge_file_create_low(
        performance schema */
        struct PSI_file_locker* locker = NULL;
        PSI_file_locker_state   state;
-       register_pfs_file_open_begin(&state, locker, innodb_file_temp_key,
-                                    PSI_FILE_OPEN,
-                                    "Innodb Merge Temp File",
-                                    __FILE__, __LINE__);
+       locker = PSI_FILE_CALL(get_thread_file_name_locker)(
+                              &state, innodb_file_temp_key, PSI_FILE_OPEN,
+                              "Innodb Merge Temp File", &locker);
+       if (locker != NULL) {
+               PSI_FILE_CALL(start_file_open_wait)(locker,
+                                                   __FILE__,
+                                                   __LINE__);
+       }
 #endif
        fd = innobase_mysql_tmpfile(path);
 #ifdef UNIV_PFS_IO
-       register_pfs_file_open_end(locker, fd);
+       if (locker != NULL) {
+               PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(
+                             locker, fd);
+       }
 #endif
 
        if (fd < 0) {
@@ -3175,15 +3183,20 @@ row_merge_file_destroy_low(
 #ifdef UNIV_PFS_IO
        struct PSI_file_locker* locker = NULL;
        PSI_file_locker_state   state;
-       register_pfs_file_io_begin(&state, locker,
-                                  fd, 0, PSI_FILE_CLOSE,
-                                  __FILE__, __LINE__);
+       locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(
+                              &state, fd, PSI_FILE_CLOSE);
+       if (locker != NULL) {
+               PSI_FILE_CALL(start_file_wait)(
+                             locker, 0, __FILE__, __LINE__);
+       }
 #endif
        if (fd >= 0) {
                close(fd);
        }
 #ifdef UNIV_PFS_IO
-       register_pfs_file_io_end(locker, 0);
+       if (locker != NULL) {
+               PSI_FILE_CALL(end_file_wait)(locker, 0);
+       }
 #endif
 }
 /*********************************************************************//**
index 42b1ab5763012dc52f7329d7a85445d9efeaa82e..c53c1154f6097a6dff6ef9d9d014cb9f4f2524ed 100644 (file)
@@ -61,6 +61,9 @@ Created 12/19/1997 Heikki Tuuri
 #include "my_sys.h" /* DEBUG_SYNC_C */
 
 #include "my_compare.h" /* enum icp_result */
+#include "thr_lock.h"
+#include "handler.h"
+#include "ha_innodb.h"
 
 /* Maximum number of rows to prefetch; MySQL interface has another parameter */
 #define SEL_MAX_N_PREFETCH     16
@@ -2743,34 +2746,43 @@ row_sel_field_store_in_mysql_format_func(
 
 #ifdef UNIV_DEBUG
 /** Convert a field from Innobase format to MySQL format. */
-# define row_sel_store_mysql_field(m,p,r,i,o,f,t) \
-       row_sel_store_mysql_field_func(m,p,r,i,o,f,t)
+# define row_sel_store_mysql_field(m,p,r,i,o,f,t,c) \
+       row_sel_store_mysql_field_func(m,p,r,i,o,f,t,c)
 #else /* UNIV_DEBUG */
 /** Convert a field from Innobase format to MySQL format. */
-# define row_sel_store_mysql_field(m,p,r,i,o,f,t) \
-       row_sel_store_mysql_field_func(m,p,r,o,f,t)
+# define row_sel_store_mysql_field(m,p,r,i,o,f,t,c) \
+       row_sel_store_mysql_field_func(m,p,r,o,f,t,c)
 #endif /* UNIV_DEBUG */
-/**************************************************************//**
-Convert a field in the Innobase format to a field in the MySQL format. */
+/** Convert a field in the Innobase format to a field in the MySQL format.
+@param[out]    mysql_rec               record in the MySQL format
+@param[in,out] prebuilt                prebuilt struct
+@param[in]     rec                     InnoDB record; must be protected
+                                       by a page latch
+@param[in]     index                   index of rec
+@param[in]     offsets                 array returned by rec_get_offsets()
+@param[in]     field_no                templ->rec_field_no or
+                                       templ->clust_rec_field_no
+                                       or templ->icp_rec_field_no
+                                       or sec field no if clust_templ_for_sec
+                                       is TRUE
+@param[in]     templ                   row template
+@param[in]     clust_templ_for_sec     TRUE if rec belongs to secondary index
+                                       but prebuilt template is in clustered
+                                       index format and used only for end
+                                       range comparison. */
 static MY_ATTRIBUTE((warn_unused_result))
 ibool
 row_sel_store_mysql_field_func(
-/*===========================*/
-       byte*                   mysql_rec,      /*!< out: record in the
-                                               MySQL format */
-       row_prebuilt_t*         prebuilt,       /*!< in/out: prebuilt struct */
-       const rec_t*            rec,            /*!< in: InnoDB record;
-                                               must be protected by
-                                               a page latch */
+       byte*                   mysql_rec,
+       row_prebuilt_t*         prebuilt,
+       const rec_t*            rec,
 #ifdef UNIV_DEBUG
-       const dict_index_t*     index,          /*!< in: index of rec */
+       const dict_index_t*     index,
 #endif
-       const ulint*            offsets,        /*!< in: array returned by
-                                               rec_get_offsets() */
-       ulint                   field_no,       /*!< in: templ->rec_field_no or
-                                               templ->clust_rec_field_no or
-                                               templ->icp_rec_field_no */
-       const mysql_row_templ_t*templ)          /*!< in: row template */
+       const ulint*            offsets,
+       ulint                   field_no,
+       const mysql_row_templ_t*templ,
+       bool                    clust_templ_for_sec)
 {
        const byte*     data;
        ulint           len;
@@ -2779,10 +2791,12 @@ row_sel_store_mysql_field_func(
        ut_ad(templ);
        ut_ad(templ >= prebuilt->mysql_template);
        ut_ad(templ < &prebuilt->mysql_template[prebuilt->n_template]);
-       ut_ad(field_no == templ->clust_rec_field_no
+       ut_ad(clust_templ_for_sec
+             || field_no == templ->clust_rec_field_no
              || field_no == templ->rec_field_no
              || field_no == templ->icp_rec_field_no);
-       ut_ad(rec_offs_validate(rec, index, offsets));
+       ut_ad(rec_offs_validate(rec,
+               clust_templ_for_sec == true ? prebuilt->index : index, offsets));
 
        if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets, field_no))) {
 
@@ -2896,30 +2910,37 @@ row_sel_store_mysql_field_func(
        return(TRUE);
 }
 
-/**************************************************************//**
-Convert a row in the Innobase format to a row in the MySQL format.
+/** Convert a row in the Innobase format to a row in the MySQL format.
 Note that the template in prebuilt may advise us to copy only a few
 columns to mysql_rec, other columns are left blank. All columns may not
 be needed in the query.
+@param[out]    mysql_rec               row in the MySQL format
+@param[in]     prebuilt                prebuilt structure
+@param[in]     rec                     Innobase record in the index
+                                       which was described in prebuilt's
+                                       template, or in the clustered index;
+                                       must be protected by a page latch
+@param[in]     rec_clust               TRUE if the rec in the clustered index
+@param[in]     index                   index of rec
+@param[in]     offsets                 array returned by rec_get_offsets(rec)
+@param[in]     clust_templ_for_sec     TRUE if rec belongs to secondary index
+                                       but the prebuilt->template is in
+                                       clustered index format and it is
+                                       used only for end range comparison
 @return TRUE on success, FALSE if not all columns could be retrieved */
 static MY_ATTRIBUTE((warn_unused_result))
 ibool
 row_sel_store_mysql_rec(
-/*====================*/
-       byte*           mysql_rec,      /*!< out: row in the MySQL format */
-       row_prebuilt_t* prebuilt,       /*!< in: prebuilt struct */
-       const rec_t*    rec,            /*!< in: Innobase record in the index
-                                       which was described in prebuilt's
-                                       template, or in the clustered index;
-                                       must be protected by a page latch */
-       ibool           rec_clust,      /*!< in: TRUE if rec is in the
-                                       clustered index instead of
-                                       prebuilt->index */
-       const dict_index_t* index,      /*!< in: index of rec */
-       const ulint*    offsets)        /*!< in: array returned by
-                                       rec_get_offsets(rec) */
+       byte*           mysql_rec,
+       row_prebuilt_t* prebuilt,
+       const rec_t*    rec,
+       ibool           rec_clust,
+       const dict_index_t* index,
+       const ulint*    offsets,
+       bool            clust_templ_for_sec)
 {
-       ulint   i;
+       ulint                   i;
+       std::vector<ulint>      template_col;
 
        ut_ad(rec_clust || index == prebuilt->index);
        ut_ad(!rec_clust || dict_index_is_clust(index));
@@ -2929,9 +2950,20 @@ row_sel_store_mysql_rec(
                prebuilt->blob_heap = NULL;
        }
 
+       if (clust_templ_for_sec) {
+               /* Store all clustered index field of
+               secondary index record. */
+               for (i = 0; i < dict_index_get_n_fields(
+                               prebuilt->index); i++) {
+                       ulint   sec_field = dict_index_get_nth_field_pos(
+                               index, prebuilt->index, i);
+                       template_col.push_back(sec_field);
+               }
+       }
+
        for (i = 0; i < prebuilt->n_template; i++) {
                const mysql_row_templ_t*templ = &prebuilt->mysql_template[i];
-               const ulint             field_no
+               ulint           field_no
                        = rec_clust
                        ? templ->clust_rec_field_no
                        : templ->rec_field_no;
@@ -2940,9 +2972,24 @@ row_sel_store_mysql_rec(
                ut_ad(dict_index_get_nth_field(index, field_no)->prefix_len
                      == 0);
 
+               if (clust_templ_for_sec) {
+                       std::vector<ulint>::iterator    it;
+                       it = std::find(template_col.begin(),
+                                      template_col.end(), field_no);
+
+                       if (it == template_col.end()) {
+                               continue;
+                       }
+
+                       ut_ad(templ->rec_field_no == templ->clust_rec_field_no);
+
+                       field_no = it - template_col.begin();
+               }
+
                if (!row_sel_store_mysql_field(mysql_rec, prebuilt,
                                               rec, index, offsets,
-                                              field_no, templ)) {
+                                              field_no, templ,
+                                              clust_templ_for_sec)) {
                        return(FALSE);
                }
        }
@@ -3582,7 +3629,7 @@ row_search_idx_cond_check(
                if (!row_sel_store_mysql_field(mysql_rec, prebuilt,
                                               rec, prebuilt->index, offsets,
                                               templ->icp_rec_field_no,
-                                              templ)) {
+                                              templ, false)) {
                        return(ICP_NO_MATCH);
                }
        }
@@ -3603,7 +3650,7 @@ row_search_idx_cond_check(
                    || dict_index_is_clust(prebuilt->index)) {
                        if (!row_sel_store_mysql_rec(
                                    mysql_rec, prebuilt, rec, FALSE,
-                                   prebuilt->index, offsets)) {
+                                   prebuilt->index, offsets, false)) {
                                ut_ad(dict_index_is_clust(prebuilt->index));
                                return(ICP_NO_MATCH);
                        }
@@ -3622,6 +3669,27 @@ row_search_idx_cond_check(
        return(result);
 }
 
+/** Check the pushed down end range condition to avoid extra traversal
+if records are not within view and also to avoid prefetching in the
+cache buffer.
+@param[in]     mysql_rec       record in MySQL format
+@param[in,out] handler         the MySQL handler performing the scan
+@retval true   if the row in mysql_rec is out of range
+@retval false  if the row in mysql_rec is in range */
+static
+bool
+row_search_end_range_check(
+       const byte*     mysql_rec,
+       ha_innobase*    handler)
+{
+       if (handler->end_range &&
+           handler->compare_key_in_buffer(mysql_rec) > 0) {
+               return(true);
+       }
+
+       return(false);
+}
+
 /********************************************************************//**
 Searches for rows in the database. This is used in the interface to
 MySQL. This function opens a cursor, and also implements fetch next
@@ -3659,7 +3727,9 @@ row_search_for_mysql(
        trx_t*          trx             = prebuilt->trx;
        dict_index_t*   clust_index;
        que_thr_t*      thr;
-       const rec_t*    rec;
+       const rec_t*    prev_rec = NULL;
+       const rec_t*    rec = NULL;
+       byte*           end_range_cache = NULL;
        const rec_t*    result_rec = NULL;
        const rec_t*    clust_rec;
        dberr_t         err                             = DB_SUCCESS;
@@ -3684,6 +3754,7 @@ row_search_for_mysql(
        ulint*          offsets                         = offsets_;
        ibool           table_lock_waited               = FALSE;
        byte*           next_buf                        = 0;
+       ulint           end_loop                        = 0;
 
        rec_offs_init(offsets_);
 
@@ -3823,6 +3894,10 @@ row_search_for_mysql(
 
                        err = DB_SUCCESS;
                        goto func_exit;
+               } else if (prebuilt->end_range == true) {
+                       prebuilt->end_range = false;
+                       err = DB_RECORD_NOT_FOUND;
+                       goto func_exit;
                }
 
                if (prebuilt->fetch_cache_first > 0
@@ -3956,7 +4031,8 @@ row_search_for_mysql(
 
                                if (!row_sel_store_mysql_rec(
                                            buf, prebuilt,
-                                           rec, FALSE, index, offsets)) {
+                                           rec, FALSE, index,
+                                           offsets, false)) {
                                        /* Only fresh inserts may contain
                                        incomplete externally stored
                                        columns. Pretend that such
@@ -4205,11 +4281,62 @@ rec_loop:
                and neither can a record lock be placed on it: we skip such
                a record. */
 
+               prev_rec = NULL;
                goto next_rec;
        }
 
        if (page_rec_is_supremum(rec)) {
 
+               /** Compare the last record of the page with end range
+               passed to InnoDB when there is no ICP and number of loops
+               in row_search_for_mysql for rows found but not
+               reporting due to search views etc. */
+               if (prev_rec != NULL
+                   && prebuilt->mysql_handler->end_range != NULL
+                   && prebuilt->idx_cond == NULL
+                   && end_loop >= 100) {
+
+                       dict_index_t*   key_index = prebuilt->index;
+                       bool            clust_templ_for_sec = false;
+
+                       if (end_range_cache == NULL) {
+                               end_range_cache = static_cast<byte*>(
+                                       ut_malloc(prebuilt->mysql_row_len));
+                       }
+
+                       if (index != clust_index
+                           && prebuilt->need_to_access_clustered) {
+                               /** Secondary index record but the template
+                               based on PK. */
+                               key_index = clust_index;
+                               clust_templ_for_sec = true;
+                       }
+
+                       /** Create offsets based on prebuilt index. */
+                       offsets = rec_get_offsets(prev_rec, prebuilt->index,
+                                       offsets, ULINT_UNDEFINED, &heap);
+
+                       if (row_sel_store_mysql_rec(
+                               end_range_cache, prebuilt, prev_rec,
+                               clust_templ_for_sec, key_index, offsets,
+                               clust_templ_for_sec)) {
+
+                               if (row_search_end_range_check(
+                                       end_range_cache,
+                                       prebuilt->mysql_handler)) {
+
+                                       /** In case of prebuilt->fetch,
+                                       set the error in prebuilt->end_range. */
+                                       if (prebuilt->n_fetch_cached > 0) {
+                                               prebuilt->end_range = true;
+                                       }
+
+                                       err = DB_RECORD_NOT_FOUND;
+                                       goto normal_return;
+                               }
+                       }
+               }
+
                if (set_also_gap_locks
                    && !(srv_locks_unsafe_for_binlog
                         || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
@@ -4241,6 +4368,7 @@ rec_loop:
                /* A page supremum record cannot be in the result set: skip
                it now that we have placed a possible lock on it */
 
+               prev_rec = NULL;
                goto next_rec;
        }
 
@@ -4308,6 +4436,7 @@ wrong_offs:
 
                        btr_pcur_move_to_last_on_page(pcur, &mtr);
 
+                       prev_rec = NULL;
                        goto next_rec;
                }
        }
@@ -4334,10 +4463,13 @@ wrong_offs:
                        fputs(". We try to skip the record.\n",
                              stderr);
 
+                       prev_rec = NULL;
                        goto next_rec;
                }
        }
 
+       prev_rec = rec;
+
        /* Note that we cannot trust the up_match value in the cursor at this
        place because we can arrive here after moving the cursor! Thus
        we have to recompare rec and search_tuple to determine if they
@@ -4562,6 +4694,7 @@ no_gap_lock:
 
                        did_semi_consistent_read = TRUE;
                        rec = old_vers;
+                       prev_rec = rec;
                        break;
                default:
 
@@ -4608,6 +4741,7 @@ no_gap_lock:
                                }
 
                                rec = old_vers;
+                               prev_rec = rec;
                        }
                } else {
                        /* We are looking into a non-clustered index,
@@ -4785,7 +4919,7 @@ requires_clust_rec:
                        appropriate version of the clustered index record. */
                        if (!row_sel_store_mysql_rec(
                                    buf, prebuilt, result_rec,
-                                   TRUE, clust_index, offsets)) {
+                                   TRUE, clust_index, offsets, false)) {
                                goto next_rec;
                        }
                }
@@ -4853,7 +4987,7 @@ requires_clust_rec:
                                next_buf, prebuilt, result_rec,
                                result_rec != rec,
                                result_rec != rec ? clust_index : index,
-                               offsets)) {
+                               offsets, false)) {
 
                                if (next_buf == buf) {
                                        ut_a(prebuilt->n_fetch_cached == 0);
@@ -4908,7 +5042,7 @@ requires_clust_rec:
                                    buf, prebuilt, result_rec,
                                    result_rec != rec,
                                    result_rec != rec ? clust_index : index,
-                                   offsets)) {
+                                   offsets, false)) {
                                /* Only fresh inserts may contain
                                incomplete externally stored
                                columns. Pretend that such records do
@@ -4960,6 +5094,8 @@ idx_cond_failed:
        goto normal_return;
 
 next_rec:
+       end_loop++;
+
        /* Reset the old and new "did semi-consistent read" flags. */
        if (UNIV_UNLIKELY(prebuilt->row_read_type
                          == ROW_READ_DID_SEMI_CONSISTENT)) {
@@ -5146,6 +5282,11 @@ normal_return:
 
 func_exit:
        trx->op_info = "";
+
+       if (end_range_cache != NULL) {
+               ut_free(end_range_cache);
+       }
+
        if (UNIV_LIKELY_NULL(heap)) {
                mem_heap_free(heap);
        }
index 7a7588d12af08aa7b09ef6813c5385e4c3e27d2c..7119522e52437d86190f6353361e0a82d236108c 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
 Copyright (c) 2008, 2009 Google Inc.
 Copyright (c) 2009, Percona Inc.
 
@@ -2344,6 +2344,8 @@ DECLARE_THREAD(srv_master_thread)(
                        /*!< in: a dummy parameter required by
                        os_thread_create */
 {
+       my_thread_init();
+
        srv_slot_t*     slot;
        ulint           old_activity_count = srv_get_activity_count();
        ib_time_t       last_print_time;
@@ -2405,6 +2407,7 @@ suspend_thread:
        os_event_wait(slot->event);
 
        if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
+               my_thread_end();
                os_thread_exit(NULL);
        }
 
@@ -2487,6 +2490,8 @@ DECLARE_THREAD(srv_worker_thread)(
        void*   arg MY_ATTRIBUTE((unused)))     /*!< in: a dummy parameter
                                                required by os_thread_create */
 {
+       my_thread_init();
+
        srv_slot_t*     slot;
 
        ut_ad(!srv_read_only_mode);
@@ -2545,6 +2550,7 @@ DECLARE_THREAD(srv_worker_thread)(
                os_thread_pf(os_thread_get_curr_id()));
 #endif /* UNIV_DEBUG_THREAD_CREATION */
 
+       my_thread_end();
        /* We count the number of threads in os_thread_exit(). A created
        thread should always use that to exit and not use return() to exit. */
        os_thread_exit(NULL);
@@ -2745,6 +2751,8 @@ DECLARE_THREAD(srv_purge_coordinator_thread)(
        void*   arg MY_ATTRIBUTE((unused)))     /*!< in: a dummy parameter
                                                required by os_thread_create */
 {
+       my_thread_init();
+
        srv_slot_t*     slot;
        ulint           n_total_purged = ULINT_UNDEFINED;
 
@@ -2850,6 +2858,7 @@ DECLARE_THREAD(srv_purge_coordinator_thread)(
                srv_release_threads(SRV_WORKER, srv_n_purge_threads - 1);
        }
 
+       my_thread_end();
        /* We count the number of threads in os_thread_exit(). A created
        thread should always use that to exit and not use return() to exit. */
        os_thread_exit(NULL);
@@ -2918,3 +2927,18 @@ srv_purge_wakeup(void)
        }
 }
 
+/** Check whether given space id is undo tablespace id
+@param[in]     space_id        space id to check
+@return true if it is undo tablespace else false. */
+bool
+srv_is_undo_tablespace(
+       ulint   space_id)
+{
+       if (srv_undo_space_id_start == 0) {
+               return (false);
+       }
+
+       return(space_id >= srv_undo_space_id_start
+              && space_id < (srv_undo_space_id_start
+                             + srv_undo_tablespaces_open));
+}
index 697107a1e0d3993c0f3710ac25ce9a14805dff62..f6b68a73b748556470f41ca8454bdaae51a624bf 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
 Copyright (c) 2008, Google Inc.
 Copyright (c) 2009, Percona Inc.
 
@@ -109,6 +109,9 @@ UNIV_INTERN ibool   srv_have_fullfsync = FALSE;
 /** TRUE if a raw partition is in use */
 UNIV_INTERN ibool      srv_start_raw_disk_in_use = FALSE;
 
+/** UNDO tablespaces starts with space id. */
+ulint  srv_undo_space_id_start;
+
 /** TRUE if the server is being started, before rolling back any
 incomplete transactions */
 UNIV_INTERN ibool      srv_startup_is_before_trx_rollback_phase = FALSE;
@@ -124,7 +127,7 @@ SRV_SHUTDOWN_CLEANUP and then to SRV_SHUTDOWN_LAST_PHASE, and so on */
 UNIV_INTERN enum srv_shutdown_state    srv_shutdown_state = SRV_SHUTDOWN_NONE;
 
 /** Files comprising the system tablespace */
-static os_file_t       files[1000];
+static pfs_os_file_t   files[1000];
 
 /** io_handler_thread parameters for thread identification */
 static ulint           n[SRV_MAX_N_IO_THREADS + 6];
@@ -530,7 +533,7 @@ static MY_ATTRIBUTE((nonnull, warn_unused_result))
 dberr_t
 create_log_file(
 /*============*/
-       os_file_t*      file,   /*!< out: file handle */
+       pfs_os_file_t*  file,   /*!< out: file handle */
        const char*     name)   /*!< in: log file name */
 {
        ibool           ret;
@@ -737,7 +740,7 @@ static MY_ATTRIBUTE((nonnull, warn_unused_result))
 dberr_t
 open_log_file(
 /*==========*/
-       os_file_t*      file,   /*!< out: file handle */
+       pfs_os_file_t*  file,   /*!< out: file handle */
        const char*     name,   /*!< in: log file name */
        os_offset_t*    size)   /*!< out: file size */
 {
@@ -853,7 +856,7 @@ open_or_create_data_files(
                                   && os_file_get_last_error(false)
                                   != OS_FILE_ALREADY_EXISTS
 #ifdef UNIV_AIX
-                                  /* AIX 5.1 after security patch ML7 may have
+                                  /* AIX 5.1 after security patch ML7 may have
                                   errno set to 0 here, which causes our
                                   function to return 100; work around that
                                   AIX problem */
@@ -1156,7 +1159,7 @@ srv_undo_tablespace_create(
        const char*     name,           /*!< in: tablespace name */
        ulint           size)           /*!< in: tablespace size in pages */
 {
-       os_file_t       fh;
+       pfs_os_file_t   fh;
        ibool           ret;
        dberr_t         err = DB_SUCCESS;
 
@@ -1233,7 +1236,7 @@ srv_undo_tablespace_open(
        const char*     name,           /*!< in: tablespace name */
        ulint           space)          /*!< in: tablespace id */
 {
-       os_file_t       fh;
+       pfs_os_file_t   fh;
        dberr_t         err     = DB_ERROR;
        ibool           ret;
        ulint           flags;
@@ -1332,13 +1335,23 @@ srv_undo_tablespaces_init(
 
        for (i = 0; create_new_db && i < n_conf_tablespaces; ++i) {
                char    name[OS_FILE_MAX_PATH];
+               ulint   space_id  = i + 1;
+
+               DBUG_EXECUTE_IF("innodb_undo_upgrade",
+                               space_id = i + 3;);
 
                ut_snprintf(
                        name, sizeof(name),
                        "%s%cundo%03lu",
-                       srv_undo_dir, SRV_PATH_SEPARATOR, i + 1);
+                       srv_undo_dir, SRV_PATH_SEPARATOR, space_id);
+
+               if (i == 0) {
+                       srv_undo_space_id_start = space_id;
+                       prev_space_id = srv_undo_space_id_start - 1;
+               }
+
+               undo_tablespace_ids[i] = space_id;
 
-               /* Undo space ids start from 1. */
                err = srv_undo_tablespace_create(
                        name, SRV_UNDO_TABLESPACE_SIZE_IN_PAGES);
 
@@ -1360,14 +1373,16 @@ srv_undo_tablespaces_init(
        if (!create_new_db) {
                n_undo_tablespaces = trx_rseg_get_n_undo_tablespaces(
                        undo_tablespace_ids);
-       } else {
-               n_undo_tablespaces = n_conf_tablespaces;
 
-               for (i = 1; i <= n_undo_tablespaces; ++i) {
-                       undo_tablespace_ids[i - 1] = i;
+               if (n_undo_tablespaces != 0) {
+                       srv_undo_space_id_start = undo_tablespace_ids[0];
+                       prev_space_id = srv_undo_space_id_start - 1;
                }
 
-               undo_tablespace_ids[i] = ULINT_UNDEFINED;
+       } else {
+               n_undo_tablespaces = n_conf_tablespaces;
+
+               undo_tablespace_ids[n_conf_tablespaces] = ULINT_UNDEFINED;
        }
 
        /* Open all the undo tablespaces that are currently in use. If we
@@ -1391,8 +1406,6 @@ srv_undo_tablespaces_init(
                ut_a(undo_tablespace_ids[i] != 0);
                ut_a(undo_tablespace_ids[i] != ULINT_UNDEFINED);
 
-               /* Undo space ids start from 1. */
-
                err = srv_undo_tablespace_open(name, undo_tablespace_ids[i]);
 
                if (err != DB_SUCCESS) {
@@ -1427,11 +1440,23 @@ srv_undo_tablespaces_init(
                        break;
                }
 
+               /** Note the first undo tablespace id in case of
+               no active undo tablespace. */
+               if (n_undo_tablespaces == 0) {
+                       srv_undo_space_id_start = i;
+               }
+
                ++n_undo_tablespaces;
 
                ++*n_opened;
        }
 
+       /** Explictly specify the srv_undo_space_id_start
+       as zero when there are no undo tablespaces. */
+       if (n_undo_tablespaces == 0) {
+               srv_undo_space_id_start = 0;
+       }
+
        /* If the user says that there are fewer than what we find we
        tolerate that discrepancy but not the inverse. Because there could
        be unused undo tablespaces for future use. */
@@ -1476,10 +1501,11 @@ srv_undo_tablespaces_init(
                mtr_start(&mtr);
 
                /* The undo log tablespace */
-               for (i = 1; i <= n_undo_tablespaces; ++i) {
+               for (i = 0; i < n_undo_tablespaces; ++i) {
 
                        fsp_header_init(
-                               i, SRV_UNDO_TABLESPACE_SIZE_IN_PAGES, &mtr);
+                               undo_tablespace_ids[i],
+                               SRV_UNDO_TABLESPACE_SIZE_IN_PAGES, &mtr);
                }
 
                mtr_commit(&mtr);
@@ -1554,6 +1580,10 @@ innobase_start_or_create_for_mysql(void)
        char*           logfile0        = NULL;
        size_t          dirnamelen;
 
+       if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) {
+               srv_read_only_mode = 1;
+       }
+
        high_level_read_only = srv_read_only_mode
                || srv_force_recovery > SRV_FORCE_NO_TRX_UNDO;
 
index efc600d16b1cc49f9a21760fcc315f766a6f428f..55af54991c666eb4efd62d6ef32ed55776f988a4 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2017, 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
@@ -692,7 +692,8 @@ trx_purge_get_rseg_with_min_trx_id(
 
        /* We assume in purge of externally stored fields that space id is
        in the range of UNDO tablespace space ids */
-       ut_a(purge_sys->rseg->space <= srv_undo_tablespaces_open);
+       ut_a(purge_sys->rseg->space == 0
+            || srv_is_undo_tablespace(purge_sys->rseg->space));
 
        zip_size = purge_sys->rseg->zip_size;
 
index 306b982b6e3d3b2955ac4cd75df2f7cf2d92b964..a69bad15a1cfa1a8215ad4cce50f3bfdf21561c2 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2017, 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
@@ -808,6 +808,7 @@ DECLARE_THREAD(trx_rollback_or_clean_all_recovered)(
                        /*!< in: a dummy parameter required by
                        os_thread_create */
 {
+       my_thread_init();
        ut_ad(!srv_read_only_mode);
 
 #ifdef UNIV_PFS_THREAD
@@ -818,6 +819,7 @@ DECLARE_THREAD(trx_rollback_or_clean_all_recovered)(
 
        trx_rollback_or_clean_is_active = false;
 
+       my_thread_end();
        /* We count the number of threads in os_thread_exit(). A created
        thread should always use that to exit and not use return() to exit. */
 
index 96b906803d7951e150ce25d0957c4b73f6984872..fe8337b2ac3c727bbb1417ef9bb711af7ededc48 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2017, 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
@@ -1043,18 +1043,12 @@ trx_sys_create_rsegs(
                ulint   new_rsegs = n_rsegs - n_used;
 
                for (i = 0; i < new_rsegs; ++i) {
-                       ulint   space;
+                       ulint   space_id;
+                       space_id = (n_spaces == 0) ? 0
+                               : (srv_undo_space_id_start + i % n_spaces);
 
-                       /* Tablespace 0 is the system tablespace. All UNDO
-                       log tablespaces start from 1. */
-
-                       if (n_spaces > 0) {
-                               space = (i % n_spaces) + 1;
-                       } else {
-                               space = 0; /* System tablespace */
-                       }
-
-                       if (trx_rseg_create(space) != NULL) {
+                       /* Tablespace 0 is the system tablespace. */
+                       if (trx_rseg_create(space_id) != NULL) {
                                ++n_used;
                        } else {
                                break;
index 3bbc0a4602e8545535a66bf6428b44cd6f18facd..18c58294b5c573e883f1d0dc6854ede487a0f437 100644 (file)
@@ -3951,9 +3951,11 @@ static PSI_file* end_file_open_wait_v1(PSI_file_locker *locker,
   switch (state->m_operation)
   {
   case PSI_FILE_STAT:
+  case PSI_FILE_RENAME:
     break;
   case PSI_FILE_STREAM_OPEN:
   case PSI_FILE_CREATE:
+  case PSI_FILE_OPEN:
     if (result != NULL)
     {
       PFS_file_class *klass= reinterpret_cast<PFS_file_class*> (state->m_class);
@@ -3964,7 +3966,6 @@ static PSI_file* end_file_open_wait_v1(PSI_file_locker *locker,
       state->m_file= reinterpret_cast<PSI_file*> (pfs_file);
     }
     break;
-  case PSI_FILE_OPEN:
   default:
     DBUG_ASSERT(false);
     break;
index 5886c379b2f491cfba5fa14d75745e645d96cc78..3b5f1d35862dc813373c4c72b857565ab8544346 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2017, 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
@@ -255,10 +255,11 @@ search:
     if (safe_index == 0)
     {
       /* Record [0] is reserved. */
-      safe_index= 1;
+      continue;
     }
 
     /* Add a new record in digest stat array. */
+    DBUG_ASSERT(safe_index < digest_max);
     pfs= &statements_digest_stat_array[safe_index];
 
     if (pfs->m_lock.is_free())
index 8b24cee9eaf6167082ac87b95662e46f38ccf4f7..7861c74a401d60048c1944b059b154e1441a33ae 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2017, 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
@@ -27,6 +27,8 @@
 #include "stub_print_error.h"
 #include "stub_pfs_defaults.h"
 
+void unload_performance_schema();
+
 /* test helpers, to simulate the setup */
 
 void setup_thread(PSI_thread *t, bool enabled)
@@ -126,7 +128,7 @@ void test_bootstrap()
   psi_2= boot->get_interface(PSI_VERSION_2);
   ok(psi_2 == NULL, "version 2");
 
-  shutdown_performance_schema();
+  unload_performance_schema();
 }
 
 /*
@@ -183,6 +185,28 @@ PSI * load_perfschema()
   return (PSI*) psi;
 }
 
+void unload_performance_schema()
+{
+  cleanup_table_share();
+  cleanup_instruments();
+  cleanup_sync_class();
+  cleanup_thread_class();
+  cleanup_table_share();
+  cleanup_file_class();
+  cleanup_stage_class();
+  cleanup_statement_class();
+  cleanup_socket_class();
+  cleanup_events_waits_history_long();
+  cleanup_events_stages_history_long();
+  cleanup_events_statements_history_long();
+  cleanup_table_share_hash();
+  cleanup_file_hash();
+  cleanup_digest();
+  PFS_atomic::cleanup();
+
+  shutdown_performance_schema();
+}
+
 void test_bad_registration()
 {
   PSI *psi;
@@ -581,8 +605,7 @@ void test_bad_registration()
   psi->register_socket("X", bad_socket_3, 1);
   ok(dummy_socket_key == 2, "assigned key");
 
-
-  shutdown_performance_schema();
+  unload_performance_schema();
 }
 
 void test_init_disabled()
@@ -1016,7 +1039,7 @@ void test_init_disabled()
   socket_A1= psi->init_socket(99, NULL, NULL, 0);
   ok(socket_A1 == NULL, "broken socket key not instrumented");
   
-  shutdown_performance_schema();
+  unload_performance_schema();
 }
 
 void test_locker_disabled()
@@ -1321,8 +1344,9 @@ void test_locker_disabled()
   ok(socket_A1 != NULL, "instrumented");
   /* Socket thread owner has not been set */
   socket_locker= psi->start_socket_wait(&socket_state, socket_A1, PSI_SOCKET_SEND, 12, "foo.cc", 12);
-  ok(socket_locker == NULL, "no locker (no thread owner)");
-  
+  ok(socket_locker != NULL, "locker (owner not used)");
+  psi->end_socket_wait(socket_locker, 10);
+
   /* Pretend the running thread is not instrumented */
   /* ---------------------------------------------- */
 
@@ -1350,7 +1374,7 @@ void test_locker_disabled()
   socket_locker= psi->start_socket_wait(&socket_state, socket_A1, PSI_SOCKET_SEND, 12, "foo.cc", 12);
   ok(socket_locker == NULL, "no locker");
 
-  shutdown_performance_schema();
+  unload_performance_schema();
 }
 
 void test_file_instrumentation_leak()
@@ -1437,7 +1461,7 @@ void test_file_instrumentation_leak()
   file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_WRITE);
   ok(file_locker == NULL, "no locker, no leak");
 
-  shutdown_performance_schema();
+  unload_performance_schema();
 }
 
 void test_enabled()
@@ -1473,7 +1497,7 @@ void test_enabled()
     { & cond_key_B, "C-B", 0}
   };
 
-  shutdown_performance_schema();
+  unload_performance_schema();
 #endif
 }
 
@@ -1642,6 +1666,6 @@ int main(int, char **)
   plan(216);
   MY_INIT("pfs-t");
   do_all_tests();
-  return 0;
+  return (exit_status());
 }
 
index ef8a7c195e0b7f95d2f80e7813b7b8660fcf117b..fccb9ef2e436db59bdea012c95a459ed5c3ff2ce 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2017, 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
@@ -111,6 +111,6 @@ int main(int, char **)
   plan(6);
   MY_INIT("pfs_account-oom-t");
   do_all_tests();
-  return 0;
+  return (exit_status());
 }
 
index 7bee1d063a1a5372c225a4ae5320f29c18884298..ecf790eeedea8192507ea3f27d7c05c9d71c6d2e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2017, 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
@@ -341,5 +341,5 @@ int main(int, char **)
     diag("skipping the cp1251 tests : missing character set");
   plan(59 + (cs_cp1251 ? 10 : 0));
   do_all_tests();
-  return 0;
+  return (exit_status());
 }
index 6627dd48df2b18f191b954624910babb68f987f9..95a375c4d100779a35a989c9cfdb61d22b0860e7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2017, 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
@@ -111,6 +111,6 @@ int main(int, char **)
   plan(6);
   MY_INIT("pfs_host-oom-t");
   do_all_tests();
-  return 0;
+  return (exit_status());
 }
 
index 161060aa6bf1097e899fac7632f94ff73ed9392f..f58d9026c7d5cea12dfd82b28c95a8f961743832 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2017, 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
@@ -355,6 +355,11 @@ void test_oom()
   rc= init_instruments(& param);
   ok(rc == 1, "oom (per thread wait)");
 
+  cleanup_sync_class();
+  cleanup_thread_class();
+  cleanup_file_class();
+  cleanup_instruments();
+
   param.m_enabled= true;
   param.m_mutex_class_sizing= 0;
   param.m_rwlock_class_sizing= 0;
@@ -432,6 +437,8 @@ void test_oom()
   init_event_name_sizing(& param);
   rc= init_instruments(& param);
   ok(rc == 1, "oom (thread stages history sizing)");
+
+  cleanup_thread_class();
   cleanup_instruments();
 
   param.m_enabled= true;
@@ -467,6 +474,9 @@ void test_oom()
   init_event_name_sizing(& param);
   rc= init_instruments(& param);
   ok(rc == 1, "oom (per thread stages)");
+  
+  cleanup_stage_class();
+  cleanup_thread_class();
   cleanup_instruments();
 
   param.m_enabled= true;
@@ -502,6 +512,8 @@ void test_oom()
   init_event_name_sizing(& param);
   rc= init_instruments(& param);
   ok(rc == 1, "oom (thread statements history sizing)");
+
+  cleanup_thread_class();
   cleanup_instruments();
 
   param.m_enabled= true;
@@ -537,6 +549,9 @@ void test_oom()
   init_event_name_sizing(& param);
   rc= init_instruments(& param);
   ok(rc == 1, "oom (per thread statements)");
+
+  cleanup_statement_class();
+  cleanup_thread_class();
   cleanup_instruments();
 
   param.m_enabled= true;
@@ -572,6 +587,8 @@ void test_oom()
   init_event_name_sizing(& param);
   rc= init_instruments(& param);
   ok(rc == 1, "oom (global waits)");
+
+  cleanup_sync_class();
   cleanup_instruments();
 
   param.m_enabled= true;
@@ -609,8 +626,10 @@ void test_oom()
   ok(rc == 0, "init stage class");
   rc= init_instruments(& param);
   ok(rc == 1, "oom (global stages)");
-  cleanup_instruments();
+
+  cleanup_sync_class();
   cleanup_stage_class();
+  cleanup_instruments();
 
   param.m_enabled= true;
   param.m_mutex_class_sizing= 10;
@@ -647,8 +666,10 @@ void test_oom()
   ok(rc == 0, "init statement class");
   rc= init_instruments(& param);
   ok(rc == 1, "oom (global statements)");
-  cleanup_instruments();
+
+  cleanup_sync_class();
   cleanup_statement_class();
+  cleanup_instruments();
 }
 
 void do_all_tests()
@@ -665,6 +686,6 @@ int main(int, char **)
   plan(20);
   MY_INIT("pfs_instr-oom-t");
   do_all_tests();
-  return 0;
+  return (exit_status());
 }
 
index 3cc4c48388d63ba0c7274de37a53e3e9de352828..f457bf1f811282c891843c7f9ce073fc6f8cf20f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2017, 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
 
 #include <memory.h>
 
+PFS_global_param param;
+
 void test_no_instruments()
 {
   int rc;
-  PFS_global_param param;
 
   memset(& param, 0xFF, sizeof(param));
   param.m_enabled= true;
@@ -86,7 +87,6 @@ void test_no_instances()
   PFS_file *file;
   PFS_socket *socket;
   PFS_table *table;
-  PFS_global_param param;
 
   memset(& param, 0xFF, sizeof(param));
   param.m_enabled= true;
@@ -227,7 +227,6 @@ void test_with_instances()
   PFS_socket *socket_2;
   PFS_table *table_1;
   PFS_table *table_2;
-  PFS_global_param param;
 
   memset(& param, 0xFF, sizeof(param));
   param.m_enabled= true;
@@ -417,6 +416,6 @@ int main(int, char **)
   plan(103);
   MY_INIT("pfs_instr-t");
   do_all_tests();
-  return 0;
+  return (exit_status());
 }
 
index e98250d8567a839a1d7f976f3e10d544982b73d8..9b01044e31facaf20c683bf9591d8fd90e5579ec 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2017, 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
@@ -67,6 +67,6 @@ int main(int, char **)
   plan(9);
   MY_INIT("pfs_instr_info-oom-t");
   do_all_tests();
-  return 0;
+  return (exit_status());
 }
 
index ee483312e3cad75ff7bd57f8c0521b0e77f585ec..b58ae2e371d85a6b0952938d7e21108d6910f0d0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2017, 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
@@ -673,6 +673,6 @@ int main(int, char **)
   plan(181);
   MY_INIT("pfs_instr_info-t");
   do_all_tests();
-  return 0;
+  return (exit_status());
 }
 
index a0fff2f593c1056d545de05e3e5f2a325e55866b..d960b5fe0a0ac30a64caacba53b4ae961fcb5544 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2015, 2017, 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
@@ -66,6 +66,6 @@ int main(int, char **)
   plan(2);
   MY_INIT("pfs_misc-t");
   do_all_tests();
-  return exit_status();
+  return (exit_status());
 }
 
index 9c9ae0f75f16b7172941d316ef255f77ad929d4f..7ea1326365e689bd044678c938c6d2e1a1700764 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2017, 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
@@ -117,6 +117,6 @@ int main(int, char **)
   plan(5);
   MY_INIT("pfs_timer-t");
   do_all_tests();
-  return 0;
+  return (exit_status());
 }
 
index 0e4c5eb341100b36ef997f2fb9bd5b6ccc23e914..87558e9e8136baaf9d079c870e758d480336335c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2017, 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
@@ -110,6 +110,6 @@ int main(int, char **)
   plan(6);
   MY_INIT("pfs_user-oom-t");
   do_all_tests();
-  return 0;
+  return (exit_status());
 }
 
index e4d1faa2a8f46a19afb0152d7c3e05b4eb8add62..db4cdfc0c21910bc6fff95cbc040bc35e87e1768 100644 (file)
@@ -5083,15 +5083,30 @@ my_wildcmp_unicode(const CHARSET_INFO *cs,
 */
 
 static size_t
-my_strxfrm_pad_nweights_unicode(uchar *str, uchar *strend, size_t nweights)
+my_strxfrm_pad_nweights_unicode(uchar *str,
+                                const uchar *const strend,
+                                size_t nweights)
 {
-  uchar *str0;
-  DBUG_ASSERT(str && str <= strend); 
-  for (str0= str; str < strend && nweights; nweights--)
+  const uchar *const str0 = str;
+  const uchar *const weightend = str + (nweights*2);
+  const uchar *const end = (weightend < strend) ? weightend : strend;
+  DBUG_ASSERT(str && str <= strend);
+
+  while (str < end-3)
+  {
+    *str++= 0x00;
+    *str++= 0x20;
+    *str++= 0x00;
+    *str++= 0x20;
+  }
+  if (str < end-1)
+  {
+    *str++= 0x00;
+    *str++= 0x20;
+  }
+  if (str < end)
   {
     *str++= 0x00;
-    if (str < strend)
-      *str++= 0x20;
   }
   return str - str0;
 }
@@ -5112,15 +5127,26 @@ my_strxfrm_pad_nweights_unicode(uchar *str, uchar *strend, size_t nweights)
 */
 
 static size_t
-my_strxfrm_pad_unicode(uchar *str, uchar *strend)
+my_strxfrm_pad_unicode(uchar *str, const uchar *const strend)
 {
-  uchar *str0= str;
+  const uchar *const str0 = str;
   DBUG_ASSERT(str && str <= strend); 
-  for ( ; str < strend ; )
+
+  while (str < strend-3)
+  {
+    *str++= 0x00;
+    *str++= 0x20;
+    *str++= 0x00;
+    *str++= 0x20;
+  }
+  if (str < strend-1)
+  {
+    *str++= 0x00;
+    *str++= 0x20;
+  }
+  if (str < strend)
   {
     *str++= 0x00;
-    if (str < strend)
-      *str++= 0x20;
   }
   return str - str0;
 }
@@ -5142,9 +5168,9 @@ my_strnxfrm_unicode(const CHARSET_INFO *cs,
 {
   my_wc_t wc;
   int res;
-  uchar *dst0= dst;
-  uchar *de= dst + dstlen;
-  const uchar *se= src + srclen;
+  uchar *const dst0= dst;
+  const uchar *const de= dst + dstlen;
+  const uchar *const se= src + srclen;
   MY_UNICASE_INFO *uni_plane= (cs->state & MY_CS_BINSORT) ?
                                NULL : cs->caseinfo;
   LINT_INIT(wc);
@@ -5185,9 +5211,9 @@ my_strnxfrm_unicode_full_bin(const CHARSET_INFO *cs,
                              const uchar *src, size_t srclen, uint flags)
 {
   my_wc_t wc;
-  uchar *dst0= dst;
-  uchar *de= dst + dstlen;
-  const uchar *se = src + srclen;
+  uchar *const dst0= dst;
+  const uchar *const de= dst + dstlen;
+  const uchar *const se= src + srclen;
 
   LINT_INIT(wc);
   DBUG_ASSERT(src);
@@ -5210,7 +5236,17 @@ my_strnxfrm_unicode_full_bin(const CHARSET_INFO *cs,
 
   if (flags & MY_STRXFRM_PAD_WITH_SPACE)
   {
-    for ( ; dst < de && nweights; nweights--)
+    const uchar *const weightend = dst + (nweights*3);
+    const uchar *const end = (weightend < de) ? weightend : de;
+
+    while (dst < end-2)
+    {
+      *dst++= 0x00;
+      *dst++= 0x00;
+      *dst++= 0x20;
+      nweights--;
+    }
+    if (dst < de && nweights > 0)
     {
       *dst++= 0x00;
       if (dst < de)
@@ -5226,7 +5262,13 @@ my_strnxfrm_unicode_full_bin(const CHARSET_INFO *cs,
 
   if (flags & MY_STRXFRM_PAD_TO_MAXLEN)
   {
-    while (dst < de)
+    while (dst < de-2)
+    {
+      *dst++= 0x00;
+      *dst++= 0x00;
+      *dst++= 0x20;
+    }
+    if (dst < de)
     {
       *dst++= 0x00;
       if (dst < de)
index 74b1075cf251846f2076a4a2c01ee14bd536472d..a74558933c83873a30ffbbaa5266b528a62f9d84 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2016, 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
@@ -51,6 +51,11 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${inifile}.${ini_file_extension}
         DESTINATION ${inst_location} COMPONENT IniFiles)
 
 IF(UNIX)
+  IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+    SET (PIDOF "pidof")
+  ELSE()
+    SET (PIDOF "pgrep -d' ' -f")
+  ENDIF()
   SET(prefix ${CMAKE_INSTALL_PREFIX})
   FOREACH(script  mysqld_multi.server mysql-log-rotate binary-configure)
     CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${script}.sh 
index 3f9ca946fa204c778211ab429dad7f832bcef797..ca693fb4e735f857e33f9d7ebad2d9e297e83ed6 100644 (file)
@@ -209,15 +209,8 @@ wait_for_pid () {
 
 # Get arguments from the my.cnf file,
 # the only group, which is read from now on is [mysqld]
-if test -x ./bin/my_print_defaults
-then
-  print_defaults="./bin/my_print_defaults"
-elif test -x $bindir/my_print_defaults
-then
+if test -x "$bindir/my_print_defaults";  then
   print_defaults="$bindir/my_print_defaults"
-elif test -x $bindir/mysql_print_defaults
-then
-  print_defaults="$bindir/mysql_print_defaults"
 else
   # Try to find basedir in /etc/my.cnf
   conf=/etc/my.cnf
@@ -234,11 +227,6 @@ else
         print_defaults="$d/bin/my_print_defaults"
         break
       fi
-      if test -x "$d/bin/mysql_print_defaults"
-      then
-        print_defaults="$d/bin/mysql_print_defaults"
-        break
-      fi
     done
   fi
 
@@ -371,7 +359,7 @@ case "$mode" in
       fi
     else
       # Try to find appropriate mysqld process
-      mysqld_pid=`pidof $libexecdir/mysqld`
+      mysqld_pid=`@PIDOF@ $libexecdir/mysqld`
 
       # test if multiple pids exist
       pid_count=`echo $mysqld_pid | wc -w`
index 04ba0138731d90cdde71358165ad0c3cad2e15f7..0bac685872e3001e41e7297afdb880671998f64b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2002, 2017, 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
@@ -6293,7 +6293,7 @@ static void test_temporal_param()
   /* Check values.  */
   DIE_UNLESS(bigint ==  20011020101100LL);
   DIE_UNLESS(real == 20011020101059.5);
-  DIE_UNLESS(!strcmp(dec, "20011020101059.5"));
+  DIE_UNLESS(!strcmp(dec, "20011020101059.500000"));
 
   mysql_stmt_close(stmt);
 
@@ -6337,7 +6337,7 @@ static void test_temporal_param()
   /* Check returned values */
   DIE_UNLESS(bigint ==  101100);
   DIE_UNLESS(real ==  101059.5);
-  DIE_UNLESS(!strcmp(dec, "101059.5"));
+  DIE_UNLESS(!strcmp(dec, "101059.500000"));
 
   mysql_stmt_close(stmt);
 }
@@ -14243,14 +14243,6 @@ static void test_bug10760()
     3: check that cursors to InnoDB tables are closed (for now) by
     COMMIT/ROLLBACK.
   */
-  if (! have_innodb)
-  {
-    if (!opt_silent)
-      printf("Testing that cursors are closed at COMMIT/ROLLBACK requires "
-             "InnoDB.\n");
-  }
-  else
-  {
     stmt_text= "select id from t1 order by 1";
     rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
     check_execute(stmt, rc);
@@ -14279,7 +14271,6 @@ static void test_bug10760()
     if (!opt_silent)
       printf("Got error (as expected): %s\n", mysql_error(mysql));
 #endif
-  }
 
   mysql_stmt_close(stmt);
   rc= mysql_query(mysql, "drop table t1");
@@ -14667,13 +14658,6 @@ static void test_bug12243()
 
   myheader("test_bug12243");
 
-  if (! have_innodb)
-  {
-    if (!opt_silent)
-      printf("This test requires InnoDB.\n");
-    return;
-  }
-
   /* create tables */
   mysql_query(mysql, "drop table if exists t1");
   mysql_query(mysql, "create table t1 (a int) engine=InnoDB");
@@ -19559,6 +19543,96 @@ static void test_bug22559575()
   myquery(rc);
 }
 
+/**
+   BUG#19894382 - SERVER SIDE PREPARED STATEMENTS LEADS TO POTENTIAL OFF-BY-SECOND
+                  TIMESTAMP ON SLAVE
+*/
+static void test_bug19894382()
+{
+  MYSQL_STMT *stmt1;
+  const char *stmt1_txt= "INSERT INTO client_test_db.bug19894382 VALUES"
+                         " ('master', ?, ?, ?, ?, ?, ?);";
+  my_bool    is_null= 0;
+  MYSQL_BIND bind_val[6];
+  MYSQL_TIME tm[6];
+  MYSQL_TIME tm_common;
+  ulong      length= sizeof(MYSQL_TIME);
+  int ind;
+  int rc;
+
+  myheader("test_bug19894382");
+
+  rc= mysql_query(mysql, "DROP TABLE IF EXISTS client_test_db.bug19894382;");
+  myquery(rc);
+  rc= mysql_query(mysql, "CREATE TABLE client_test_db.bug19894382(f1 CHAR(64),"
+                         " f2 TIME, f3 TIMESTAMP NULL, f4 DATETIME,"
+                         " f5 TIME(3), f6 TIMESTAMP(3) NULL,"
+                         " f7 DATETIME(3));");
+  myquery(rc);
+
+  stmt1 = mysql_stmt_init(mysql);
+  check_stmt(stmt1);
+
+  // Prepare statement
+  rc= mysql_stmt_prepare(stmt1, stmt1_txt, strlen(stmt1_txt));
+  check_execute(stmt1, rc);
+
+  // Prepare and bind values.
+  tm_common.year= 2015;
+  tm_common.month= 4;
+  tm_common.day= 24;
+  tm_common.hour= 7;
+  tm_common.minute= 30;
+  tm_common.second= 30;
+  tm_common.second_part= 5010;
+  tm_common.neg= 0;
+  tm_common.time_type= MYSQL_TIMESTAMP_NONE;
+
+  memset(bind_val, 0, sizeof(MYSQL_BIND) * 6);
+  for (ind= 0; ind < 6; ind++)
+  {
+    tm[ind]= tm_common;
+    bind_val[ind].buffer= (void *) &tm[ind];
+    bind_val[ind].is_null= &is_null;
+    bind_val[ind].length= &length;
+    bind_val[ind].buffer_length= sizeof(MYSQL_TIME);
+    switch(ind%3)
+    {
+    case 0:
+      tm[ind].year= tm[ind].month= tm[ind].day= 0;
+      bind_val[ind].buffer_type= MYSQL_TYPE_TIME;
+      tm[ind].time_type= MYSQL_TIMESTAMP_TIME;
+      break;
+    case 1:
+      bind_val[ind].buffer_type= MYSQL_TYPE_TIMESTAMP;
+      tm[ind].time_type= MYSQL_TIMESTAMP_DATETIME;
+      break;
+    case 2:
+      bind_val[ind].buffer_type= MYSQL_TYPE_DATETIME;
+      tm[ind].time_type= MYSQL_TIMESTAMP_DATETIME;
+      break;
+    }
+  }
+  rc= mysql_stmt_bind_param(stmt1, bind_val);
+  check_execute(stmt1, rc);
+
+  /* Execute the insert statement */
+  rc= mysql_stmt_execute(stmt1);
+  check_execute(stmt1, rc);
+  for (ind= 0; ind < 6; ind++)
+  {
+    tm[ind].second_part= 501900;
+  }
+  /* Execute the insert statement */
+  rc= mysql_stmt_execute(stmt1);
+  check_execute(stmt1, rc);
+
+  rc= mysql_commit(mysql);
+  myquery(rc);
+
+  mysql_stmt_close(stmt1);
+}
+
 static struct my_tests_st my_tests[]= {
   { "disable_query_logs", disable_query_logs },
   { "test_view_sp_list_fields", test_view_sp_list_fields },
@@ -19837,6 +19911,7 @@ static struct my_tests_st my_tests[]= {
   { "test_bug20810928", test_bug20810928 },
   { "test_bug17883203", test_bug17883203 },
   { "test_bug22559575", test_bug22559575 },
+  { "test_bug19894382", test_bug19894382 },
   { 0, 0 }
 };
 
index 225f62e4822b44329c8e01b866988a800869b8c9..fc51212bb9266b88606cc69935a174835e2e8dae 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 
+/* Copyright (c) 2010, 2016, 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
@@ -80,23 +80,19 @@ TEST(DebugPrintTest, PrintEval)
   int y= 0;
 
   // This DBUG_PRINT args should never be evaluated.
-  DBUG_PRINT("never",("%d",1/y));
+  DBUG_PRINT("never",("%d", y+= 1));
+  EXPECT_EQ(y, 0) << "DBUG_PRINT arg is evaluated.";
 }
 
 
-TEST(DebugPrintDeathTest, PrintEval)
+TEST(DebugPrintEvalTest, PrintEval)
 {
   int y= 0;
 
-  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
-
   DBUG_SET("+d,never");
-  /*
-    The DBUG_PRINT would be evaluated resulting in floating point exception
-    killing the server.
-  */
-  EXPECT_DEATH_IF_SUPPORTED(DBUG_PRINT("never",("%d",1/y)), "");
+  DBUG_PRINT("never",("%d", y+= 1));
   DBUG_SET("");
+  EXPECT_GE(y, 1) << "DBUG_PRINT arg is not evaluated.";
 }